smengcl commented on code in PR #8554:
URL: https://github.com/apache/ozone/pull/8554#discussion_r2143397550


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/SnapshotDeletingService.java:
##########
@@ -173,12 +154,19 @@ public BackgroundTaskResult call() throws 
InterruptedException {
                 snapInfo.getTableKey());
             continue;
           }
+          lockIds.clear();
+          lockIds.add(snapInfo.getSnapshotId());
+          if (nextSnapshot != null) {
+            lockIds.add(nextSnapshot.getSnapshotId());
+          }
+          // Acquire write lock on current snapshot and next snapshot in chain.
+          if (!snapshotIdLocks.acquireLock(lockIds).isLockAcquired()) {
+            continue;
+          }
 
           // nextSnapshot = null means entries would be moved to AOS.
           if (nextSnapshot == null) {
             LOG.info("Snapshot: {} entries will be moved to AOS.", 
snapInfo.getTableKey());
-            waitForKeyDeletingService();
-            waitForDirDeletingService();
           } else {
             LOG.info("Snapshot: {} entries will be moved to next active 
snapshot: {}",
                 snapInfo.getTableKey(), nextSnapshot.getTableKey());

Review Comment:
   Shall we print this message before the lock? It makes it easier to debug 
later if things happen in my opinion.



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to