Commit 08d49f4
[AMORO-4163][ams] Fix Version-N-already-exists race in newTableOperations for legacy mixed-iceberg (#4185)
When AMS saves a new legacy mixed-iceberg table to the database, a background
table-explorer thread can concurrently pick up the same table and call
newTableOperations(), which now commits the mixed-format properties to the
Iceberg metadata (introduced by the AMORO-4163 fix). If the background thread
wins the race and writes v2.metadata.json before the onTableCreated() path
attempts the same commit, HadoopTableOperations throws CommitFailedException:
"Version 2 already exists", aborting the createTableMeta RPC.
Fix: catch CommitFailedException in the commit block, refresh to obtain the
latest on-disk metadata, and proceed if a concurrent writer already committed
the correct properties. Re-throw only when the properties still differ after
refresh, indicating a genuine commit conflict.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ec2a448 commit 08d49f4
1 file changed
Lines changed: 13 additions & 1 deletion
File tree
- amoro-ams/src/main/java/org/apache/amoro/server/table/internal
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
0 commit comments