HADOOP-12856. FileUtil.checkDest() and RawLocalFileSystem.mkdirs() to throw stricter IOEs; RawLocalFS contract tests to verify. Contributed by Steve Loughran
This commit is contained in:
parent
475f933b41
commit
d11d280b8b
@ -492,11 +492,12 @@ private static Path checkDest(String srcName, FileSystem dstFS, Path dst,
|
||||
if (null != sdst) {
|
||||
if (sdst.isDirectory()) {
|
||||
if (null == srcName) {
|
||||
throw new IOException("Target " + dst + " is a directory");
|
||||
throw new PathIsDirectoryException(dst.toString());
|
||||
}
|
||||
return checkDest(null, dstFS, new Path(dst, srcName), overwrite);
|
||||
} else if (!overwrite) {
|
||||
throw new IOException("Target " + dst + " already exists");
|
||||
throw new PathExistsException(dst.toString(),
|
||||
"Target " + dst + " already exists");
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
|
@ -552,7 +552,7 @@ private boolean mkdirsWithOptionalPermission(Path f, FsPermission permission)
|
||||
}
|
||||
}
|
||||
if (p2f.exists() && !p2f.isDirectory()) {
|
||||
throw new FileNotFoundException("Destination exists" +
|
||||
throw new FileAlreadyExistsException("Destination exists" +
|
||||
" and is not a directory: " + p2f.getCanonicalPath());
|
||||
}
|
||||
return (parent == null || parent2f.exists() || mkdirs(parent)) &&
|
||||
|
@ -34,7 +34,7 @@ public RawlocalFSContract(Configuration conf) {
|
||||
super(conf);
|
||||
}
|
||||
|
||||
public static final String RAW_CONTRACT_XML = "contract/localfs.xml";
|
||||
public static final String RAW_CONTRACT_XML = "contract/rawlocal.xml";
|
||||
|
||||
@Override
|
||||
protected String getContractXml() {
|
||||
|
@ -17,10 +17,24 @@
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
|
||||
<!--
|
||||
Here are most of the local FS contract options.
|
||||
some of them may be overridden at run time based on the OS,
|
||||
others potentially generated.
|
||||
case sensitivity and permission options are determined at run time from OS type
|
||||
-->
|
||||
|
||||
<property>
|
||||
<name>fs.contract.is-case-sensitive</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-unix-permissions</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<!--
|
||||
The remaining options are static
|
||||
-->
|
||||
|
||||
<property>
|
||||
@ -33,11 +47,6 @@
|
||||
<value>1000</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.is-case-sensitive</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-append</name>
|
||||
<value>true</value>
|
||||
@ -73,6 +82,11 @@
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.rename-remove-dest-if-empty-dir</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>fs.contract.supports-seek</name>
|
||||
<value>true</value>
|
||||
|
Loading…
Reference in New Issue
Block a user