errose28 commented on code in PR #3778:
URL: https://github.com/apache/ozone/pull/3778#discussion_r1001120819


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestWithFSO.java:
##########
@@ -177,6 +181,26 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
         omBucketInfo.incrUsedNamespace(1L);
       }
 
+      // let the uncommitted blocks pretend as key's old version blocks
+      // which will be deleted as RepeatedOmKeyInfo
+      if (!uncommitted.isEmpty()) {
+        LOG.info("Detect allocated but uncommitted blocks {} in key {}.",
+            uncommitted, keyName);
+        OmKeyInfo pseudoKeyInfo = omKeyInfo.copyObject();
+        // set dataSize -1 here to distinguish from normal keyInfo
+        pseudoKeyInfo.setDataSize(-1);
+        List<OmKeyLocationInfoGroup> uncommittedGroups = new ArrayList<>();
+        // version not matters in the current logic of keyDeletingService,
+        // all versions of blocks will be deleted.
+        uncommittedGroups.add(new OmKeyLocationInfoGroup(0, uncommitted));
+        pseudoKeyInfo.setKeyLocationVersions(uncommittedGroups);
+        if (oldKeyVersionsToDelete == null) {
+          oldKeyVersionsToDelete = new RepeatedOmKeyInfo(pseudoKeyInfo);
+        } else {
+          oldKeyVersionsToDelete.addOmKeyInfo(pseudoKeyInfo);
+        }
+      }

Review Comment:
   Can we move this duplicated code block used by the FSO and OBS versions of 
this request to a helper method in the parent OMKeyRequest class?



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java:
##########
@@ -239,6 +243,26 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
         omBucketInfo.incrUsedNamespace(1L);
       }
 
+      // let the uncommitted blocks pretend as key's old version blocks
+      // which will be deleted as RepeatedOmKeyInfo
+      if (!uncommitted.isEmpty()) {
+        LOG.info("Detect allocated but uncommitted blocks {} in key {}.",
+            uncommitted, keyName);
+        OmKeyInfo pseudoKeyInfo = omKeyInfo.copyObject();
+        // set dataSize -1 here to distinguish from normal keyInfo
+        pseudoKeyInfo.setDataSize(-1);

Review Comment:
   Why is this necessary? Can we not set this value instead?



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