jojochuang commented on code in PR #8999:
URL: https://github.com/apache/ozone/pull/8999#discussion_r2320276975


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -397,9 +394,29 @@ public OmSnapshot load(@Nonnull UUID snapshotId) throws 
IOException {
         // on that.
         OMMetadataManager snapshotMetadataManager;
         try {
+          // The check is only to prevent every snapshot read to perform a 
disk IO
+          // and check if a checkpoint dir exists. If entry is present in 
cache,
+          // it is most likely DB entries will get flushed in this wait time.
+          Duration maxPollDuration =
+              Duration.ofMillis(conf.getTimeDuration(
+                  OZONE_SNAPSHOT_CHECKPOINT_DIR_CREATION_POLL_TIMEOUT,
+                  OZONE_SNAPSHOT_CHECKPOINT_DIR_CREATION_POLL_TIMEOUT_DEFAULT,
+                  TimeUnit.MILLISECONDS));
+          boolean flushed = RatisHelper.attemptUntilTrue(() -> {
+            try {
+              return 
OmSnapshotManager.isSnapshotFlushedToDB(ozoneManager.getMetadataManager(), 
snapshotInfo);
+            } catch (IOException e) {
+              return false;
+            }
+          }, POLL_INTERVAL_DURATION, maxPollDuration);
+          if (!flushed) {
+            throw new OMException("Unable to load snapshot. " +
+                "Create Snapshot Txn '" + snapshotInfo.getTableKey() +

Review Comment:
   maybe it should log snapshotInfo.getCreateTransactionInfo() instead?



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