ivandika3 commented on code in PR #9746:
URL: https://github.com/apache/ozone/pull/9746#discussion_r2791497291


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadAbortRequest.java:
##########
@@ -150,29 +150,36 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, Execut
           .get(multipartOpenKey);
       omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
 
-      // If there is no entry in openKeyTable, then there is no multipart
-      // upload initiated for this key.
       if (omKeyInfo == null) {
+        // In old env, OpenKeycleanupservice may have deleted key from 
openKeyTable leaving behind
+        // orphan parts in multipartInfoTable.
+        LOG.warn("Entry doesn't exist in openKeyTable, bucket: {}, key: {}", 
bucketName, keyName);
+      }
+
+      multipartKeyInfo = omMetadataManager.getMultipartInfoTable()
+          .get(multipartKey);
+
+      if (multipartKeyInfo == null) {
         throw new OMException("Abort Multipart Upload Failed: volume: " +
             requestedVolume + "bucket: " + requestedBucket + "key: " + keyName,
             OMException.ResultCodes.NO_SUCH_MULTIPART_UPLOAD_ERROR);
       }
 
-      multipartKeyInfo = omMetadataManager.getMultipartInfoTable()
-          .get(multipartKey);
       multipartKeyInfo = multipartKeyInfo.toBuilder()
           .setUpdateID(trxnLogIndex)
           .build();
 
       // When abort uploaded key, we need to subtract the PartKey length from
       // the volume usedBytes.
-      long quotaReleased = 0;
-      for (PartKeyInfo iterPartKeyInfo : multipartKeyInfo.getPartKeyInfoMap()) 
{
-        quotaReleased += QuotaUtil.getReplicatedSize(
-            iterPartKeyInfo.getPartKeyInfo().getDataSize(),
-            omKeyInfo.getReplicationConfig());
+      if (omKeyInfo != null) {
+        long quotaReleased = 0;
+        for (PartKeyInfo iterPartKeyInfo : 
multipartKeyInfo.getPartKeyInfoMap()) {
+          quotaReleased += QuotaUtil.getReplicatedSize(
+              iterPartKeyInfo.getPartKeyInfo().getDataSize(),
+              omKeyInfo.getReplicationConfig());

Review Comment:
   Can we use `multipartKeyInfo.getReplicationConfig()` instead of 
`omKeyInfo.getReplicationConfig()`?



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