Skip to content

Commit 9cc0948

Browse files
committed
fix(transaction): move flag assignment after auto-commit
Move last_update_committed_ assignment to after auto-commit attempt. If Commit() fails, ICEBERG_RETURN_UNEXPECTED returns early and the flag remains false, preventing the transaction from incorrectly reporting the update as committed when it actually failed.
1 parent 1a56283 commit 9cc0948

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/iceberg/transaction.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ Status Transaction::Apply(std::vector<std::unique_ptr<TableUpdate>> updates) {
6565
update->ApplyTo(*metadata_builder_);
6666
}
6767

68-
last_update_committed_ = true;
69-
7068
if (auto_commit_) {
71-
ICEBERG_RETURN_UNEXPECTED(Commit());
69+
auto result = Commit();
70+
ICEBERG_RETURN_UNEXPECTED(result);
7271
}
7372

73+
last_update_committed_ = true;
7474
return {};
7575
}
7676

0 commit comments

Comments
 (0)