swamirishi commented on code in PR #5554:
URL: https://github.com/apache/ozone/pull/5554#discussion_r1387278364


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotUtils.java:
##########
@@ -143,23 +144,33 @@ public static void checkSnapshotActive(SnapshotInfo 
snapInfo,
   public static SnapshotInfo getNextActiveSnapshot(SnapshotInfo snapInfo,
       SnapshotChainManager chainManager, OmSnapshotManager omSnapshotManager)
       throws IOException {
-    while (chainManager.hasNextPathSnapshot(snapInfo.getSnapshotPath(),
-        snapInfo.getSnapshotId())) {
 
-      UUID nextPathSnapshot =
-          chainManager.nextPathSnapshot(
-              snapInfo.getSnapshotPath(), snapInfo.getSnapshotId());
+    // If the snapshot is deleted in the previous run, then the in-memory
+    // SnapshotChainManager might throw NoSuchElementException as the snapshot
+    // is removed in-memory but OMDoubleBuffer has not flushed yet.
+    try {
+      while (chainManager.hasNextPathSnapshot(snapInfo.getSnapshotPath(),
+          snapInfo.getSnapshotId())) {
 
-      String tableKey = chainManager.getTableKey(nextPathSnapshot);
-      SnapshotInfo nextSnapshotInfo =
-          omSnapshotManager.getSnapshotInfo(tableKey);
+        UUID nextPathSnapshot =

Review Comment:
   If we are deleting the current snapshot from the chain then why call this 
function at the first place, it would return null anyhow right? So do you mean 
to say we are deleting snapshots which are not deep cleaned? So are we not 
taking any lock on the portion of the chain. 



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