avijayanhwx commented on a change in pull request #1004:
URL: https://github.com/apache/hadoop-ozone/pull/1004#discussion_r434125451
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyRenameResponse.java
##########
@@ -88,11 +88,22 @@ public void addToDBBatch(OMMetadataManager
omMetadataManager,
omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
} else if (createToKeyAndDeleteFromKey()) {
// If both from and toKeyName are equal do nothing
- omMetadataManager.getKeyTable().deleteWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
- omMetadataManager.getKeyTable().putWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
- newKeyInfo);
+ if (!toKeyName.equals(fromKeyName)) {
Review comment:
Isn't this check already done inside createToKeyAndDeleteFromKey()?
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyRenameResponse.java
##########
@@ -88,11 +88,22 @@ public void addToDBBatch(OMMetadataManager
omMetadataManager,
omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
} else if (createToKeyAndDeleteFromKey()) {
// If both from and toKeyName are equal do nothing
- omMetadataManager.getKeyTable().deleteWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, fromKeyName));
- omMetadataManager.getKeyTable().putWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
- newKeyInfo);
+ if (!toKeyName.equals(fromKeyName)) {
+ omMetadataManager.getKeyTable().deleteWithBatch(batchOperation,
+ omMetadataManager.getOzoneKey(volumeName, bucketName,
fromKeyName));
+ omMetadataManager.getKeyTable().putWithBatch(batchOperation,
+ omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
+ newKeyInfo);
+ // At this point we can also update the KeyIdTable.
+ if (newKeyInfo.getFileHandleInfo() != 0) {
Review comment:
What does it mean for the fileHandleInfo to be zero? If it is zero, we
do not delete the old Id from the keyIdTable?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]