HADOOP-14048. REDO operation of WASB#AtomicRename should create placeholder blob for destination folder. Contributed by NITIN VERMA

(cherry picked from commit c571cda5c7)
This commit is contained in:
Mingliang Liu 2017-03-06 16:53:30 -08:00
parent 3f23d50c9a
commit ff706261be
1 changed files with 10 additions and 0 deletions

View File

@ -537,6 +537,16 @@ public class NativeAzureFileSystem extends FileSystem {
// Remove the source folder. Don't check explicitly if it exists, // Remove the source folder. Don't check explicitly if it exists,
// to avoid triggering redo recursively. // to avoid triggering redo recursively.
try { try {
// Rename the source folder 0-byte root file
// as destination folder 0-byte root file.
FileMetadata srcMetaData = this.getSourceMetadata();
if (srcMetaData.getBlobMaterialization() == BlobMaterialization.Explicit) {
// We already have a lease. So let's just rename the source blob
// as destination blob under same lease.
fs.getStoreInterface().rename(this.getSrcKey(), this.getDstKey(), false, lease);
}
// Now we can safely delete the source folder.
fs.getStoreInterface().delete(srcKey, lease); fs.getStoreInterface().delete(srcKey, lease);
} catch (Exception e) { } catch (Exception e) {
LOG.info("Unable to delete source folder during folder rename redo. " LOG.info("Unable to delete source folder during folder rename redo. "