chihsuan commented on code in PR #11216:
URL: https://github.com/apache/ozone/pull/11216#discussion_r3951370833


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3ExpiredMultipartUploadsAbortRequest.java:
##########
@@ -106,18 +108,44 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager, Execut
     Result result = null;
     Map<OmBucketInfo, List<OmMultipartAbortInfo>>
         abortedMultipartUploads = new HashMap<>();
+    // One accumulated copy per bucket, so a bucket listed more than once 
keeps a single entry.
+    Map<Pair<String, String>, OmBucketInfo> bucketInfoMap = new HashMap<>();
+
+    OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager();
+    List<String[]> bucketLockKeys = submittedExpiredMPUsPerBucket.stream()
+        .map(mpuByBucket -> Pair.of(mpuByBucket.getVolumeName(), 
mpuByBucket.getBucketName()))
+        .distinct()
+        .map(volBucketPair -> new String[]{volBucketPair.getLeft(), 
volBucketPair.getRight()})
+        .collect(Collectors.toList());
+    boolean acquiredLocks = false;
 
     try {
+      // Hold every bucket lock for the whole request, so the accumulated 
copies can be published
+      // once all buckets have been processed. A later bucket failing turns 
the whole request into
+      // an error response, which persists nothing.
+      
mergeOmLockDetails(omMetadataManager.getLock().acquireWriteLocks(BUCKET_LOCK, 
bucketLockKeys));

Review Comment:
   Same as above.



##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyPurgeRequestAndResponse.java:
##########
@@ -137,6 +141,67 @@ private OMRequest preExecute(OMRequest originalOmRequest) 
throws IOException {
     return modifiedOmRequest;
   }
 
+  @Test
+  public void testPurgedSizesReachCacheAndDb() throws Exception {
+    Pair<List<String>, List<String>> deleteKeysAndRenamedEntry =
+        createAndDeleteKeysAndRenamedEntry(1, null);
+
+    String bucketKey = omMetadataManager.getBucketKey(volumeName, bucketName);
+    OmBucketInfo bucketInfo = omMetadataManager.getBucketTable()
+        .getCacheValue(new CacheKey<>(bucketKey)).getCacheValue();
+    bucketInfo.incrSnapshotUsedBytes(500L);
+    bucketInfo.incrSnapshotUsedNamespace(5L);

Review Comment:
   This only sets up test data. Explicit publication is optional.



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