HADOOP-16255. Add ChecksumFs.rename(path, path, boolean). Contributed by Jungtaek Lim.
This commit is contained in:
parent
6eb7c28293
commit
14ff6171a5
|
@ -472,6 +472,32 @@ public abstract class ChecksumFs extends FilterFs {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renameInternal(Path src, Path dst, boolean overwrite)
|
||||
throws AccessControlException, FileAlreadyExistsException,
|
||||
FileNotFoundException, ParentNotDirectoryException,
|
||||
UnresolvedLinkException, IOException {
|
||||
Options.Rename renameOpt = Options.Rename.NONE;
|
||||
if (overwrite) {
|
||||
renameOpt = Options.Rename.OVERWRITE;
|
||||
}
|
||||
|
||||
if (isDirectory(src)) {
|
||||
getMyFs().rename(src, dst, renameOpt);
|
||||
} else {
|
||||
getMyFs().rename(src, dst, renameOpt);
|
||||
|
||||
Path checkFile = getChecksumFile(src);
|
||||
if (exists(checkFile)) { //try to rename checksum
|
||||
if (isDirectory(dst)) {
|
||||
getMyFs().rename(checkFile, dst, renameOpt);
|
||||
} else {
|
||||
getMyFs().rename(checkFile, getChecksumFile(dst), renameOpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the delete(Path, boolean) in checksum
|
||||
* file system.
|
||||
|
|
Loading…
Reference in New Issue