kuenishi commented on a change in pull request #2813:
URL: https://github.com/apache/ozone/pull/2813#discussion_r817443789



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/s3/multipart/S3MultipartUploadCompleteResponse.java
##########
@@ -94,19 +102,23 @@ public void addToDBBatch(OMMetadataManager 
omMetadataManager,
     // 3. Delete unused parts
     if (!partsUnusedList.isEmpty()) {
       // Add unused parts to deleted key table.
-      RepeatedOmKeyInfo repeatedOmKeyInfo = omMetadataManager.getDeletedTable()
-          .get(ozoneKey);
-      if (repeatedOmKeyInfo == null) {
-        repeatedOmKeyInfo = new RepeatedOmKeyInfo(partsUnusedList);
+      if (keysToDelete == null) {
+        keysToDelete = new RepeatedOmKeyInfo(partsUnusedList);
       } else {
-        for (OmKeyInfo unUsedPart : partsUnusedList) {
-          repeatedOmKeyInfo.addOmKeyInfo(unUsedPart);
+        for (OmKeyInfo unusedParts : partsUnusedList) {
+          keysToDelete.addOmKeyInfo(unusedParts);
         }
       }
-
+    }
+    if (keysToDelete != null) {
       omMetadataManager.getDeletedTable().putWithBatch(batchOperation,
-          ozoneKey, repeatedOmKeyInfo);
+          ozoneKey, keysToDelete);
     }
+
+    // update bucket usedBytes.
+    omMetadataManager.getBucketTable().putWithBatch(batchOperation,
+        omMetadataManager.getBucketKey(omBucketInfo.getVolumeName(),
+            omBucketInfo.getBucketName()), omBucketInfo);

Review comment:
       I agree with that. Besides, when thinking about this, I have found 
another bug around updating usedBytes and filed it: 
https://issues.apache.org/jira/browse/HDDS-6399




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