diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java index c3bd21f5c39f47..e1c7bf7569c421 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java @@ -1558,7 +1558,7 @@ public void rename(final Path source, final Path destination, } renameBlobDir(source, destination, tracingContext, listBlobQueue, - blobPropOnSrc, srcDirLease, isAtomicRename); + srcDirLease, isAtomicRename); if (renameAtomicityUtils != null) { renameAtomicityUtils.cleanup(); @@ -1615,7 +1615,7 @@ private void renameBlobDir(final Path source, final Path destination, final TracingContext tracingContext, final ListBlobQueue listBlobQueue, - final BlobProperty blobPropOnSrc, final AbfsBlobLease srcDirBlobLease, + final AbfsBlobLease srcDirBlobLease, final Boolean isAtomicRename) throws AzureBlobFileSystemException { List blobList; ListBlobConsumer listBlobConsumer = new ListBlobConsumer(listBlobQueue); @@ -1650,7 +1650,7 @@ private void renameBlobDir(final Path source, renameBlob( blobProperty.getPath(), createDestinationPathForBlobPartOfRenameSrcDir(destination, - blobProperty, source), + blobProperty.getPath(), source), blobLease != null ? blobLease.getLeaseID() : null, tracingContext); } catch (AzureBlobFileSystemException e) { @@ -1673,8 +1673,8 @@ private void renameBlobDir(final Path source, renameBlobExecutorService.shutdown(); renameBlob( - blobPropOnSrc.getPath(), createDestinationPathForBlobPartOfRenameSrcDir(destination, - blobPropOnSrc, source), + source, createDestinationPathForBlobPartOfRenameSrcDir(destination, + source, source), srcDirBlobLease != null ? srcDirBlobLease.getLeaseID() : null, tracingContext); } @@ -1686,17 +1686,18 @@ private Boolean isCreateOperationOnBlobEndpoint() { /** * Translates the destination path for a blob part of a source directory getting * renamed. + * * @param destinationDir destination directory for the rename operation - * @param srcBlobProperty blob part of the source directory getting renamed + * @param blobPath path of blob inside sourceDir being renamed. * @param sourceDir source directory for the rename operation + * * @return translated path for the blob */ private Path createDestinationPathForBlobPartOfRenameSrcDir(final Path destinationDir, - final BlobProperty srcBlobProperty, - final Path sourceDir) { + final Path blobPath, final Path sourceDir) { String destinationPathStr = destinationDir.toUri().getPath(); String sourcePathStr = sourceDir.toUri().getPath(); - String srcBlobPropertyPathStr = srcBlobProperty.getPath().toUri().getPath(); + String srcBlobPropertyPathStr = blobPath.toUri().getPath(); if (sourcePathStr.equals(srcBlobPropertyPathStr)) { return destinationDir; } @@ -2567,11 +2568,10 @@ public void redo(final Path destination, final Path src) String listSrc = listSrcBuilder.toString(); new ListBlobProducer(listSrc, client, listBlobQueue, null, tracingContext); - BlobProperty srcBlobProperty = getBlobProperty(src, tracingContext); AbfsBlobLease abfsBlobLease = new AbfsBlobLease(client, src.toUri().getPath(), BLOB_LEASE_ONE_MINUTE_DURATION, tracingContext); renameBlobDir(src, destination, tracingContext, listBlobQueue, - srcBlobProperty, abfsBlobLease, true); + abfsBlobLease, true); } }; }