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


##########
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:
   The error message includes `snapshotInfo.getTableKey()` but this method may 
not exist on SnapshotInfo. Consider using a more appropriate identifier like 
the snapshot ID or name for better clarity.
   ```suggestion
                   "Snapshot ID '" + snapshotInfo.getSnapshotId() +
   ```



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