Commit 603e139
[AMORO-4163][ams] Fix CommitFailedException when loading legacy mixed-iceberg tables on Iceberg 1.7.x
Found while investigating the CI failure in apache#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 <noreply@anthropic.com>1 parent 10d13d4 commit 603e139
1 file changed
Lines changed: 6 additions & 1 deletion
File tree
- amoro-ams/src/main/java/org/apache/amoro/server/table/internal
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
0 commit comments