This is an automated email from the ASF dual-hosted git repository.
czy006 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 80e331020 [AMORO-4163][ams] Fix CommitFailedException when loading
legacy mixed-iceberg tables on Iceberg 1.7.2 (#4182)
80e331020 is described below
commit 80e3310208209bf9f4970f6929b827353b69a9ca
Author: Darcy <[email protected]>
AuthorDate: Thu Apr 16 10:17:39 2026 +0800
[AMORO-4163][ams] Fix CommitFailedException when loading legacy
mixed-iceberg tables on Iceberg 1.7.2 (#4182)
[AMORO-4163][ams] Fix CommitFailedException when loading legacy
mixed-iceberg tables on Iceberg 1.7.x
Found while investigating the CI failure in #4179.
Iceberg 1.7.x introduced a breaking change in
HadoopTableOperations.commit(): it
now uses reference equality (==) to compare the `base` argument against the
cached
currentMetadata. Previously, newTableOperations() called ops.current() to
obtain the
current metadata, but versionAndMetadata() inside commit() may refresh the
internal
state and return a different object instance. When the two references
differ, commit()
throws CommitFailedException("Cannot commit changes based on stale table
metadata")
even though the metadata content is identical, causing table loading to
fail.
Fix: replace ops.current() with ops.refresh() so that the returned
TableMetadata
reference is the same object stored in ops' internal cache. When commit()
then calls
versionAndMetadata(), it finds the version unchanged on disk and returns
the same
cached reference, satisfying the reference-equality check.
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../amoro/server/table/internal/InternalMixedIcebergHandler.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/table/internal/InternalMixedIcebergHandler.java
b/amoro-ams/src/main/java/org/apache/amoro/server/table/internal/InternalMixedIcebergHandler.java
index e838440a9..c53c45594 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/table/internal/InternalMixedIcebergHandler.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/table/internal/InternalMixedIcebergHandler.java
@@ -69,7 +69,12 @@ public class InternalMixedIcebergHandler extends
InternalIcebergHandler {
MixedHadoopTableOperations ops =
new MixedHadoopTableOperations(new Path(tableLocation), io,
metaStore.getConfiguration());
- org.apache.iceberg.TableMetadata current = ops.current();
+ // Use refresh() instead of current() so that the returned TableMetadata
reference is the
+ // same object cached inside ops. Iceberg 1.7.x commit() starts with
versionAndMetadata()
+ // which compares the `base` argument against the cached reference using
== (reference
+ // equality). If current() and versionAndMetadata() return different
object instances,
+ // commit() throws CommitFailedException even when the metadata content
is identical.
+ org.apache.iceberg.TableMetadata current = ops.refresh();
if (current == null) {
return ops;
}