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



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/s3/multipart/S3MultipartUploadCompleteResponse.java
##########
@@ -94,18 +102,25 @@ 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 (keyVersionsToDelete == null) {
+        keyVersionsToDelete = new RepeatedOmKeyInfo(partsUnusedList);
       } else {
-        for (OmKeyInfo unUsedPart : partsUnusedList) {
-          repeatedOmKeyInfo.addOmKeyInfo(unUsedPart);
+        for (OmKeyInfo unusedParts : partsUnusedList) {
+          keyVersionsToDelete.addOmKeyInfo(unusedParts);
         }
       }
-
+    }
+    if (keyVersionsToDelete != null) {
       omMetadataManager.getDeletedTable().putWithBatch(batchOperation,
-          ozoneKey, repeatedOmKeyInfo);
+          ozoneKey, keyVersionsToDelete);
+    }
+
+
+    // update bucket usedBytes, only when total bucket size has changed due to 
.

Review comment:
       NIT: sentence end missing.

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCompleteRequest.java
##########
@@ -497,12 +536,16 @@ private static String failureMessage(String volume, 
String bucket,
         volume + " bucket: " + bucket + " key: " + keyName;
   }
 
+  @SuppressWarnings("parameternumber")
   private void updateCache(OMMetadataManager omMetadataManager,
+      String dbBucketKey, OmBucketInfo omBucketInfo,

Review comment:
       NIT: we can void passing an extra parameter here if we use the 
omBucketInfo to generate the dbBucketKey here.

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java
##########
@@ -770,4 +772,31 @@ protected String getDBMultipartOpenKey(String volumeName, 
String bucketName,
     return omMetadataManager
         .getMultipartKey(volumeName, bucketName, keyName, uploadID);
   }
+
+  /**
+   * Prepare key for deletion service on overwrite.
+   *
+   * @param dbOzoneKey key to point to an object in RocksDB
+   * @param omMetadataManager
+   * @param trxnLogIndex
+   * @param isRatisEnabled
+   * @return Old keys eligible for deletion.
+   * @throws IOException
+   */
+  protected RepeatedOmKeyInfo getOldVersionsToCleanUp(
+      String dbOzoneKey, OmKeyInfo keyToDelete,
+      OMMetadataManager omMetadataManager, long trxnLogIndex,
+      boolean isRatisEnabled) throws IOException {
+
+    // Past keys that was deleted but still in deleted table,
+    // waiting for deletion service.
+    RepeatedOmKeyInfo keysToDelete =
+        omMetadataManager.getDeletedTable().get(dbOzoneKey);
+
+    if (keyToDelete != null) {
+      keysToDelete = OmUtils.prepareKeyForDelete(keyToDelete, keysToDelete,

Review comment:
       The null check here is redundant as this check is done prior to calling 
this method.




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