shivadarshan-devadiga opened a new issue, #19186: URL: https://github.com/apache/iceberg/issues/19186
### Apache Iceberg version main (development) ### Query engine None ### Please describe the bug 🐞 When a transaction retries after a concurrent commit, a manifest staged by an earlier operation in the transaction keeps its path, and the retry gives it a new sequence number (v2+) and first row ID (v3+) in the new manifest list. A later operation in the same transaction can still use that manifest as it was in the first attempt, because two caches are keyed by `ManifestFile`, which compares by path: - `SnapshotProducer.manifestsWithMetadata` returns the first attempt's `ManifestFile`, so the later operation's manifest list is written with its old sequence numbers and first row ID. - `ManifestFilterManager.filteredManifests` returns the first attempt's result: the old `ManifestFile` for a manifest it keeps, or, for one it rewrites, the filtered manifest written from the first attempt's entries. Reproduction in `core`: ```java Transaction txn = table.newTransaction(); txn.newFastAppend().appendFile(FILE_A).commit(); txn.newFastAppend().appendFile(FILE_B).commit(); // a concurrent commit makes the transaction retry table.newFastAppend().appendFile(FILE_C).commit(); txn.commitTransaction(); ``` FILE_A, added by the transaction's first snapshot, should have that snapshot's data sequence number (2) and, in v3, first row ID (1). It has 1 and 0 instead: the same as FILE_C, the concurrent commit's file, whose row IDs it then overlaps. The same happens when the later operation is a delete: | Second operation in the transaction | FILE_A data sequence number (expected 2) | |---|---| | `newFastAppend().appendFile(FILE_B)` | 1 | | `newDelete().deleteFile(FILE_D)`, which keeps the staged manifest | 1 | | `newDelete().deleteFile(FILE_B)` after appending FILE_A and FILE_B, which rewrites it | 1 | | `newAppend().appendFile(FILE_B)` with manifest merging | 2 (not affected) | The wrong data sequence number changes which equality and position deletes apply to FILE_A, and in v3+ its row IDs overlap those of the concurrent commit. Found while addressing a review comment on #19027 (@timothyw553), where it also lets a `RewriteManifests` in such a transaction bypass the check that PR adds. ### Willingness to contribute - [x] I can contribute a fix for this bug independently - [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community - [ ] I cannot contribute a fix for this bug at this time -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
