Open
Conversation
82ada96 to
ff6c292
Compare
wgtmac
reviewed
Feb 27, 2026
Member
wgtmac
left a comment
There was a problem hiding this comment.
Review Report: PR #576
(Generated by gemini-cli)
📄 File: src/iceberg/table.cc
Java Counterpart: Table.java / BaseTable.java
- Parity Check: ✅ Correctly matches the Java behavior where the cached metadata location is updated upon
Refresh(). - Style & Comments: ✅ Clean and straightforward.
- Logic Check: ✅ Fixes a bug where
metadata_location_could be stale. - Design & Conciseness: ✅ Good.
- Test Quality: ✅ Covered by general refresh logic in existing tests.
📄 File: src/iceberg/transaction.cc & src/iceberg/transaction.h
Java Counterpart: BaseTransaction.java
- Parity Check: ✅ The retry execution cleanly mimics
BaseTransaction.commitSimpleTransaction()behavior utilizingRetryRunner. The use ofapplying_updates_correctly prevents recursive commits for single-operation transactions. - Style & Comments: ✅ Well documented.
- Logic Check: ✅ Mapping
ErrorKind::kCommitFailedinsideCommitOnce()during a re-apply toValidationFailedis a clever and correct way to abort the retry loop when a logical conflict occurs with the newly refreshed state. - Design & Conciseness: ✅ Elegant restructuring of the commit phase.
- Test Quality: ✅ Good.
📄 File: src/iceberg/update/snapshot_update.cc
Java Counterpart: SnapshotProducer.java
- Parity Check: ✅ Clearing
manifest_lists_and cleaning uncommitted files before reapplying correctly mirrors the cleanup loop in Java'sSnapshotProducer.apply(). Snapshot ID generation also properly handles collisions, achieving parity. - Style & Comments: ✅ Good.
- Logic Check: ✅ State resets cleanly before each retry attempt.
- Design & Conciseness: ✅ Well integrated into the existing
Apply()flow. - Test Quality: ✅ Assumed covered by integration tests simulating conflicts.
📄 File: src/iceberg/update/update_snapshot_reference.cc
Java Counterpart: UpdateSnapshotReferencesOperation.java
- Parity Check: ✅ Matches and arguably improves upon Java's
internalApply(). - Style & Comments: ✅ Good.
- Logic Check: ✅ The introduction of
initial_refs_to compute the user's intended delta (additions/removals) and applying that delta to the refreshedcurrent_refsis a very robust way to handle transaction rebasing. It properly avoids inadvertently dropping concurrent reference changes during a retry. - Design & Conciseness: ✅ Concise and logical.
- Test Quality: ✅ Good.
📄 File: src/iceberg/util/retry_util.h & src/iceberg/test/retry_util_test.cc
Java Counterpart: Tasks.java (specifically the retry builder)
- Parity Check: ✅ Config defaults (e.g., 4 retries, 100ms min wait, 60s max wait, 30m total timeout) directly match Iceberg Java's
COMMIT_NUM_RETRIES_DEFAULT, etc. - Style & Comments:
⚠️ Minor Style Point: InRetryRunner::CalculateDelay,std::random_device rd;andstd::mt19937 gen(rd());are instantiated on every single retry attempt. While the overhead is mostly negligible due to the surroundingsleep,std::random_devicecan block on/dev/urandomor throw exceptions in constrained environments. It is standard C++ practice to use athread_localgenerator to avoid repeatedly initializing the PRNG. For example:
static thread_local std::mt19937 gen(std::random_device{}());- Logic Check: ✅ Exponential backoff and jitter math is sound. Timeout and max attempts logic is flawless.
- Design & Conciseness: ✅ Excellent standalone utility. Does not reinvent the wheel as STL/Arrow lack an equivalent drop-in.
- Test Quality: ✅
retry_util_test.ccis exhaustive and tests all major edge cases (exhaustion, filters, zero retries).
Summary & Recommendation
- Comment
Overall, a beautifully constructed PR. The implementation of transaction retries and rebasing (especially calculating the intent delta inUpdateSnapshotReference) is very robust and accurately achieves parity with the Java spec.
I have left a minor suggestion regarding the PRNG initialization in RetryRunner::CalculateDelay to adhere to modern C++ best practices, but otherwise, the code is solid.
ec7234f to
c624990
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit implements the retry for transaction commits. It introduces a generic RetryRunner utility with exponential backoff and error-kind filtering, and integrates it into Transaction::Commit() to automatically refresh table metadata and retry on commit conflicts.