Support Questions
Find answers, ask questions, and share your expertise

DistCP is failing when when creating file listing and encountering a file name with a space

New Contributor


I'm running HDP 2.6, and attempting to use distcp to copy from a much older Hadoop cluster into HDP, so I'm running the distcp utility on the target cluster and accessing the source cluster via hftp:<host>:<port>/<path>. For example:

hadoop distcp -i -log /distcp/logpath hftp://oldhadoop.hostname:50070/path/ /newpath

In the source path there is a file with a space in its name 'Email Address.json', and while distcp is building the copy listing, it appears to fail to decode the name properly (stack trace is below).

17/11/28 16:17:45 INFO tools.DistCp: DistCp job log path: /distcp/logpath

Exception in thread "pool-5-thread-1" java.lang.AssertionError: Failed to decode URI: /path/Email Address.json

	at org.apache.hadoop.util.ServletUtil.decodePath(
	at org.apache.hadoop.hdfs.web.HftpFileSystem$LsParser.startElement(
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.hadoop.hdfs.web.HftpFileSystem$LsParser.fetchList(
	at org.apache.hadoop.hdfs.web.HftpFileSystem$LsParser.listStatus(
	at org.apache.hadoop.hdfs.web.HftpFileSystem$LsParser.listStatus(
	at org.apache.hadoop.hdfs.web.HftpFileSystem.listStatus(
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

I was hoping that the -i (ignore) option would have ignored errors in creating the file listing as well as the copy phase, but that doesn't appear to be the case. Is there any way to exclude certain file names from the file listing, and/or other ways to possibly work around this issue?


Expert Contributor

@Joe Karau What is the exact HDP version you are using?

In 2.6 the -filters option should be available to exclude certain files. It is documented as "The path to a file containing a list of pattern strings, one string per line, such that paths matching the pattern will be excluded from the copy. Supports regular expressions specified by java.util.regex.Pattern." However, it's questionable whether the filtering happens before the exception. Can you give it a try?

If it doesn't work, unfortunately I think the easiest way to fix this is to specify only the "correct" files to be copied.

New Contributor

Thank you, the -filters option worked like a charm.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.