aswinshakil commented on code in PR #5554:
URL: https://github.com/apache/ozone/pull/5554#discussion_r1387298782
##########
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:
In #5339, `KeyDeletingService` runs every 100ms. So even before the 1st
request is flushed by the OMDoubleBuffer, The second request(same) comes again.
At that time the chain already removed the current deleted snapshot (from the
1st request). When the 2nd request (same as 1st) comes this will throw
`NoSuchElementException`
--
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]