sumitagrawl commented on code in PR #6046:
URL: https://github.com/apache/ozone/pull/6046#discussion_r1464535165


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java:
##########
@@ -263,8 +263,14 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, TermIn
       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)) {

Review Comment:
   newOpenKeyInfo is created after omKeyInfo updated with commit metadata args 
above. This might have additional change of openKeyInfo. We can avoid this 
updating other info.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestWithFSO.java:
##########
@@ -173,8 +174,16 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, TermIn
 
       omKeyInfo.getMetadata().putAll(KeyValueUtil.getFromProtobuf(
           commitKeyArgs.getMetadataList()));
+
+      final String clientIdString = String.valueOf(writerClientId);
+      // non-null indicates it is necessary to update the open key
+      OmKeyInfo newOpenKeyInfo = null;
+
       if (isHSync) {
-        omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID, 
String.valueOf(writerClientId));
+        if (!OmKeyHSyncUtil.isHSyncedPreviously(omKeyInfo, clientIdString, 
dbOpenFileKey)) {
+          omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID, 
clientIdString);
+          newOpenKeyInfo = omKeyInfo.copyObject();

Review Comment:
   newOpenKeyInfo is created after omKeyInfo updated with commit metadata args 
above. This might have additional change of openKeyInfo. We can avoid this 
updating other info.



-- 
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]

Reply via email to