HADOOP-13867. FilterFileSystem should override rename(.., options) to take effect of Rename options called via FilterFileSystem implementations. Contributed By Vinayakumar B.
(cherry picked from commit 0ef796174ecb5383f79cfecfcbfc4f309d093cd7) (cherry picked from commit 6f445408022f210e01f826499d447d4e7792b429)
This commit is contained in:
parent
587d47cfec
commit
a1421de70e
@ -34,6 +34,7 @@
|
||||
import org.apache.hadoop.fs.permission.FsAction;
|
||||
import org.apache.hadoop.fs.permission.FsPermission;
|
||||
import org.apache.hadoop.fs.Options.ChecksumOpt;
|
||||
import org.apache.hadoop.fs.Options.Rename;
|
||||
import org.apache.hadoop.security.AccessControlException;
|
||||
import org.apache.hadoop.util.Progressable;
|
||||
|
||||
@ -234,6 +235,12 @@ public boolean rename(Path src, Path dst) throws IOException {
|
||||
return fs.rename(src, dst);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rename(Path src, Path dst, Rename... options)
|
||||
throws IOException {
|
||||
fs.rename(src, dst, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean truncate(Path f, final long newLength) throws IOException {
|
||||
return fs.truncate(f, newLength);
|
||||
|
@ -64,7 +64,6 @@ public BlockLocation[] getFileBlockLocations(Path p, long start,
|
||||
public FSDataOutputStream append(Path f, int bufferSize) throws
|
||||
IOException;
|
||||
public long getLength(Path f);
|
||||
public void rename(Path src, Path dst, Rename... options);
|
||||
public boolean exists(Path f);
|
||||
public boolean isDirectory(Path f);
|
||||
public boolean isFile(Path f);
|
||||
@ -262,6 +261,17 @@ public void testWriteChecksumPassthru() {
|
||||
verify(mockFs).setWriteChecksum(eq(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenameOptions() throws Exception {
|
||||
FileSystem mockFs = mock(FileSystem.class);
|
||||
FileSystem fs = new FilterFileSystem(mockFs);
|
||||
Path src = new Path("/src");
|
||||
Path dst = new Path("/dest");
|
||||
Rename opt = Rename.TO_TRASH;
|
||||
fs.rename(src, dst, opt);
|
||||
verify(mockFs).rename(eq(src), eq(dst), eq(opt));
|
||||
}
|
||||
|
||||
private void checkInit(FilterFileSystem fs, boolean expectInit)
|
||||
throws Exception {
|
||||
URI uri = URI.create("filter:/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user