JingsongLi commented on code in PR #9476:
URL: https://github.com/apache/paimon/pull/9476#discussion_r3911875617


##########
paimon-core/src/main/java/org/apache/paimon/AbstractFileStore.java:
##########
@@ -597,13 +596,19 @@ public List<TagCallback> 
createTagCallbacks(FileStoreTable table) {
         if (options.tagCreateSuccessFile()) {
             callbacks.add(new SuccessFileTagCallback(fileIO, 
newTagManager().tagDirectory()));
         }
-        if 
(options.toConfiguration().get(IcebergOptions.METADATA_ICEBERG_STORAGE)
-                != IcebergOptions.StorageType.DISABLED) {
+        if (icebergCompatibilityEnabled(table)) {
             callbacks.add(new IcebergCommitCallback(table, ""));
         }
         return callbacks;
     }
 
+    private boolean icebergCompatibilityEnabled(FileStoreTable table) {
+        return 
options.toConfiguration().get(IcebergOptions.METADATA_ICEBERG_STORAGE)
+                        != IcebergOptions.StorageType.DISABLED
+                && BranchManager.isMainBranch(

Review Comment:
   [P1] Refresh Iceberg metadata when a branch is fast-forwarded to main
   
   Disabling these callbacks on non-main branches prevents the premature 
overwrite, but it also leaves the normal promotion path without any Iceberg 
refresh. `FileSystemBranchManager.fastForward` only copies the branch 
snapshot/schema/tag files into the main directories and invalidates the Paimon 
snapshot cache; it never runs a main-branch `IcebergCommitCallback`. Therefore, 
after `table.fastForward("b1")`, Paimon main points at the promoted snapshot 
while the external Iceberg catalog and `version-hint.text` still point at the 
old main snapshot indefinitely. The new test stops before promotion, so it does 
not expose this stale-reader state.
   
   Please make the fast-forward path rebuild/commit Iceberg metadata for the 
newly promoted main snapshot (while keeping branch commits callback-free), and 
add a regression that verifies the external pointer advances only after 
fast-forward.
   



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

Reply via email to