Repository navigation
feat(transaction): add idempotency key to fast append - #3372
Closed
NoahKusaba wants to merge 3 commits into
Closed
NoahKusaba wants to merge 3 commits into
NoahKusaba wants to merge 3 commits into
Conversation
Contributor
Author
|
cc @mbutrovich @comphead @gabotechs This is a major blocker for correct inserts into iceberg for distributed engines. |
comphead
reviewed
Oct 7, 2026
comphead
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR. Suggestions below, none blocking.
Smaller points:
test_rerun_finds_its_key_below_later_snapshotsandtest_snapshot_with_idempotency_key_finds_each_keywalk the same two-snapshot history, andalready_committedonly forwards to the helper. The first one can go.test_append_without_files_records_its_keyasserts the whole summary map, including thetotal-*zeros, so an unrelated summary change breaks it. Asserting theIDEMPOTENCY_KEY_SUMMARY_PROPERTYentry is enough.- No test covers a skipped append next to a sibling action that still has updates, for example
update_table_propertiesin the same transaction. That is the case where the new early return indo_commitmust not fire. A short test besideappendinidempotency_key_testswould pin it. - A skip is silent, and the caller gets
Okwith no signal. Atracing::info!with the key and the matching snapshot id would make a dropped append diagnosable. Spark logs the same event inSparkWrite("Skipping epoch ... as it was already committed"). snapshot_properties()shares its name with the field but returns the field plus the key. A name likesummary_properties()avoids the confusion.
Contributor
Author
|
Sorry for responding late (having a busy week) @comphead and thanks for the review, all addressed in db9d1a5:
|
Contributor
Author
|
I meant to cc @alexanderbianchi, as this may be relevant to datafusion-distributed, but I'm not sure how it handles partial executor commits. |
14 of 38 tasks
Contributor
|
Today datafusion-distributed hasn't put any effort into writes. It is something we'd like to get too, but the current priority is the read path. |
NoahKusaba
marked this pull request as draft
October 18, 2026 22:14
Contributor
Author
|
Actually this isn't the write solution. Closing |
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.
Which issue does this PR close?
TransactionActionpublic).What changes are included in this PR?
An engine that reruns a task can commit the same append twice. Checking for an earlier commit before
Transaction::commitcosts an extra table load and still races, becausedo_commitreloads the table and rebuilds the actions.FastAppendAction::with_idempotency_key(key)recordskeyin the snapshot summary and checks the refreshed table for it on every commit attempt, skipping the append if a snapshot onmainalready has it. A racing loser fails its ref requirement, retries, finds the key and skips. Flink's committer uses the same pattern withflink.job-id.Not obvious from the diff:
do_commitno longer callsupdate_tablewhen no action produced updates or requirements, as in Java. This affects every transaction: for example,expire_snapshotswith nothing to expire no longer writes a metadata file.mainare not found.Are these changes tested?
Yes, unit tests: reruns from a stale table and with the same files, the race (replayed through a mock catalog in sequence), appends without files with and without snapshot properties, a skipped append next to an action that still commits, and a commit without updates.
AI Disclosure
Drafted with Claude Code; I reviewed it and ran the tests, clippy and fmt.