nastra opened a new issue, #7278: URL: https://github.com/apache/iceberg/issues/7278
### Apache Iceberg version 1.2.0 (latest release) ### Query engine None ### Please describe the bug 🐞 Currently, a `CreateSnapshotEvent` or a `CommitReport` are both sent in [SnapshotProducer#notifyListeners()](https://github.com/apache/iceberg/blob/ba2a21506407df117bf55e6725c2ec4f44304898/core/src/main/java/org/apache/iceberg/SnapshotProducer.java#L432-L456) right after commit was successful. However, when using a TX, that commit is only staged and only committed when the TX itself commits. This results in premature sending of `CreateSnapshotEvent` / `CommitReport` for a table that potentially won't be committed. This can be reproduced by adding this to `TestCreateSnapshotEvent` ``` @Test public void snapshotEventAvailableAfterTransactionCommit() { Transaction transaction = table.newTransaction(); transaction.newAppend().appendFile(FILE_A).commit(); // the event should only be available after the TX was committed Assertions.assertThat(currentEvent).isNull(); transaction.commitTransaction(); Assertions.assertThat(currentEvent).isNotNull(); } ``` and this to `TestCommitReporting` ``` @Test public void commitReportAvailableAfterTransactionCommit() { String tableName = "reporting-inside-tx"; Table table = TestTables.create( tableDir, tableName, SCHEMA, SPEC, SortOrder.unsorted(), formatVersion, reporter); Transaction transaction = table.newTransaction(); transaction.newAppend().appendFile(FILE_A).commit(); assertThat(reporter.lastCommitReport()).isNull(); // commit report should only be available after the TX was committed transaction.commitTransaction(); CommitReport report = reporter.lastCommitReport(); assertThat(report).isNotNull(); assertThat(report.operation()).isEqualTo("append"); assertThat(report.snapshotId()).isEqualTo(1L); assertThat(report.sequenceNumber()).isEqualTo(1L); assertThat(report.tableName()).isEqualTo(tableName); } ``` -- 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]
