lirui-apache commented on code in PR #12637:
URL: https://github.com/apache/iceberg/pull/12637#discussion_r2013335765


##########
core/src/main/java/org/apache/iceberg/BaseMetastoreOperations.java:
##########
@@ -63,6 +64,31 @@ protected CommitStatus checkCommitStatus(
       String newMetadataLocation,
       Map<String, String> properties,
       Supplier<Boolean> commitStatusSupplier) {
+    if (metadataLocationCommitted(
+            tableOrViewName, newMetadataLocation, properties, 
commitStatusSupplier)
+        .orElse(false)) {
+      return CommitStatus.SUCCESS;
+    }
+    return CommitStatus.UNKNOWN;
+  }
+
+  /**
+   * Attempt to load the content and see if any current or past metadata 
location matches the one we
+   * were attempting to set.
+   *
+   * @param tableOrViewName full name of the Table/View
+   * @param newMetadataLocation the path of the new commit file
+   * @param properties properties for retry
+   * @param commitStatusSupplier check if the latest metadata presents or not 
using metadata
+   *     location for table.
+   * @return Empty if locations cannot be checked, e.g. unable to refresh. 
True if the new location
+   *     is committed, false otherwise.
+   */
+  protected Optional<Boolean> metadataLocationCommitted(

Review Comment:
   Yeah but I would like `checkCommitStatusStrict` and `checkCommitStatus` to 
share the same underlying check logic. The difference is 
`checkCommitStatusStrict` treats false as `CommitStatus.FAILURE` while 
`checkCommitStatus` treats false as `CommitStatus.UNKNOWN`. So I think we can 
keep the method returning `Optional<Boolean>`, but make it private?



-- 
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...@iceberg.apache.org

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


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

Reply via email to