LsomeYeah commented on code in PR #6121:
URL: https://github.com/apache/paimon/pull/6121#discussion_r2297055177


##########
paimon-core/src/main/java/org/apache/paimon/iceberg/IcebergCommitCallback.java:
##########
@@ -1030,6 +1043,24 @@ public void notifyCreation(String tagName, long 
snapshotId) {
             IcebergMetadata baseMetadata =
                     IcebergMetadata.fromPath(table.fileIO(), baseMetadataPath);
 
+            // Tags can only be included in Iceberg if they point to an 
Iceberg snapshot that
+            // exists. Otherwise an Iceberg client fails to parse the metadata 
and all reads fail.
+            boolean tagSnapshotInIceberg = false;
+            for (IcebergSnapshot snapshot : baseMetadata.snapshots()) {
+                if (snapshot.snapshotId() == snapshotId) {
+                    tagSnapshotInIceberg = true;
+                    break;
+                }
+            }
+
+            if (!tagSnapshotInIceberg) {
+                LOG.info(
+                        "Snapshot {} does not exist in Iceberg metadata. 
Unable to create tag {}.",
+                        snapshotId,
+                        tagName);
+                return;

Review Comment:
   NIT: LOG.warn or LOG.error



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