adoroszlai commented on code in PR #9327:
URL: https://github.com/apache/ozone/pull/9327#discussion_r2544443128


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java:
##########
@@ -557,10 +557,9 @@ public static RepeatedOmKeyInfo prepareKeyForDelete(long 
bucketId, OmKeyInfo key
     }
 
     // Set the updateID
-    sanitizedKeyInfo.setUpdateID(trxnLogIndex);
-    if (sanitizedKeyInfo != keyInfo) {
-      keyInfo.setUpdateID(trxnLogIndex);
-    }
+    sanitizedKeyInfo = sanitizedKeyInfo.toBuilder()
+        .withUpdateID(trxnLogIndex)
+        .build();

Review Comment:
   Yes, something like this (need to change 
`WithMetadata.Builder.getMetadata()` to `public`):
   
   ```java
       OmKeyInfo.Builder builder = omKeyInfo.toBuilder();
   
       // If this key is in a GDPR enforced bucket, then before moving
       // KeyInfo to deletedTable, remove the GDPR related metadata and
       // FileEncryptionInfo from KeyInfo.
       if (Boolean.parseBoolean(
               keyInfo.getMetadata().get(OzoneConsts.GDPR_FLAG))
       ) {
         Map<String, String> metadata = builder.getMetadata();
         metadata.remove(OzoneConsts.GDPR_FLAG);
         metadata.remove(OzoneConsts.GDPR_ALGORITHM)
         metadata.remove(OzoneConsts.GDPR_SECRET);
   
         builder.setFileEncryptionInfo(null);
       }
   
       // Set the updateID
       builder.withUpdateID(trxnLogIndex);
   
       return new RepeatedOmKeyInfo(builder.build(), bucketId);
   ```



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