ChenSammi commented on code in PR #6046:
URL: https://github.com/apache/ozone/pull/6046#discussion_r1469163671
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java:
##########
@@ -260,15 +260,22 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, TermIn
" metadata while recovery flag is not set in request",
KEY_UNDER_LEASE_RECOVERY);
}
}
- omKeyInfo.getMetadata().putAll(KeyValueUtil.getFromProtobuf(
- commitKeyArgs.getMetadataList()));
+
+ // non-null indicates it is necessary to update the open key
+ OmKeyInfo newOpenKeyInfo = null;
if (isHSync) {
- omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID,
clientIdString);
+ if (!OmKeyHSyncUtil.isHSyncedPreviously(omKeyInfo, clientIdString,
dbOpenKey)) {
+ omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID,
clientIdString);
+ newOpenKeyInfo = omKeyInfo.copyObject();
+ }
} else if (isRecovery) {
omKeyInfo.getMetadata().remove(OzoneConsts.HSYNC_CLIENT_ID);
omKeyInfo.getMetadata().remove(OzoneConsts.LEASE_RECOVERY);
}
+
+ omKeyInfo.getMetadata().putAll(KeyValueUtil.getFromProtobuf(
+ commitKeyArgs.getMetadataList()));
Review Comment:
Or you can remove L272-275, and add remove both HSYNC_CLIENT_ID and
LEASE_RECOVERY in L349.
--
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]