aswinshakil commented on code in PR #4333:
URL: https://github.com/apache/ozone/pull/4333#discussion_r1123861669
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMKeyRenameResponse.java:
##########
@@ -73,13 +75,26 @@ public void addToDBBatch(OMMetadataManager
omMetadataManager,
BatchOperation batchOperation) throws IOException {
String volumeName = renameKeyInfo.getVolumeName();
String bucketName = renameKeyInfo.getBucketName();
+ String fromDbKey = omMetadataManager
+ .getOzoneKey(volumeName, bucketName, fromKeyName);
omMetadataManager.getKeyTable(getBucketLayout())
- .deleteWithBatch(batchOperation,
- omMetadataManager.getOzoneKey(volumeName, bucketName,
fromKeyName));
+ .deleteWithBatch(batchOperation, fromDbKey);
omMetadataManager.getKeyTable(getBucketLayout())
.putWithBatch(batchOperation,
omMetadataManager.getOzoneKey(volumeName, bucketName, toKeyName),
renameKeyInfo);
+
+ String renameDbKey = omMetadataManager.getRenameKey(
+ renameKeyInfo.getVolumeName(), renameKeyInfo.getBucketName(),
+ renameKeyInfo.getObjectID());
+ OmKeyRenameInfo omKeyRenameInfo = omMetadataManager.getRenamedKeyTable()
+ .get(renameDbKey);
+ if (omKeyRenameInfo == null) {
+ omKeyRenameInfo = new OmKeyRenameInfo(fromDbKey);
+ omMetadataManager.getRenamedKeyTable().putWithBatch(
+ batchOperation, renameDbKey, omKeyRenameInfo);
+ }
Review Comment:
Yes correct, We only need the original key name. In between key renames are
not necessary. But keeping this to store `OmKeyRenameInfo` instead single
`String`, so we can expand on it further if needed.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]