Repository navigation
RFC: Stateful Transaction Action - #2620
Conversation
CTTY
left a comment
There was a problem hiding this comment.
Java's ManifestFilterManager allows you to cache across multiple commit attempts. Since we only store transaction actions in a Transaction, we cannot do that easily. I haven't got a chance to think deeply on that
|
@CTTY I noticed that there might currently a small detail missing in I created a small patch including a test here: brgr-s@46a1cc1 The test was creating comparing snapshot summaries before and after compacting a table with Spark. I will be testing this PR soon by implementing a very simple bin-pack compaction using iceberg-rust. |
|
@CTTY I added a second cherry-pick-able (?) commit, that allows I haven't managed to write a test, and the "design" could maybe use some re-thinking. I renamed Here is the commit: brgr-s@03702ad |
dannycjones
left a comment
There was a problem hiding this comment.
Thanks for driving this conversation, @CTTY!
|
@CTTY I tested the PR with the two small additions that I linked and I successfully rewrote a simple table (no partitions, 4 pos delete files, about 20 small files); commit succeeded, table was readable and logically equivalent to the previous table. |
| // Validate if there are deletes using delete file index | ||
| for data_file in data_files { | ||
| let delete_files = delete_file_index | ||
| .get_deletes_for_data_file(data_file, Some(starting_sequence_number)) |
There was a problem hiding this comment.
get_deletes_for_data_file does not yet check if a position delete file is applicable to data_file by path. Thats fine when starting_sequence_number is set to a value greater than the greatest seq number of all position delete files, but I am not sure if there are scenarios where a client does not want to set starting_sequence_number; in that case we get false-positives for rewritten data files.
blackmwk
left a comment
There was a problem hiding this comment.
After reading java's implementation, I still feel the approach of building everything on a MergingSnapshotProducer is the correct way to go. When we do commit and retry, we may need to mutate internal state due to caching behavior.
CTTY
left a comment
There was a problem hiding this comment.
Hi folks, thanks for the feedback so far!
One biggest limitation I noticed is that the current design doesn't allow a cache to survive across retries. I'm not a fan of building a brand new MergingSnapshotProducer, and was thinking of extracting the cache/context and store them in transaction actions?
I've commented the thought with slightly more details below.
Would love to hear more feedbacks on this direction!
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions. |
|
@CTTY I'd like to help get this landed — while integrating in-process Why this matters concretely: without Where the branch stands: the current head's What I have on a branch
Live verification (beyond the in-repo tests): built a small runner against On the open design question (cross-retry filter cache): the single Two smaller things I noticed while in there, fine as follow-ups: staged Happy to rebase/split/reshape any of this to fit how you want the PR to move — |
|
Hey folks, thanks for all the proposals and discussion — I'd really like to see this land too. On the open MergeCache-per-action vs MergingSnapshotProducer question, I would like to give my two cents and maybe provide a different perspective. If we start from "a MergeCache in each action" and actually build it out:
At that point the fields are, field-for-field, what the MSP already holds. And the conflict-validation stays as stateless free functions in either design — it's recomputed against the refreshed base every attempt, so it doesn't belong in the struct regardless. So that half of the concern is orthogonal to this decision. Which leaves one real question: are add_file / delete_file / filter_existing_manifests / commit methods on the struct or free functions taking it as an argument? I think that's the main question that needs to be answered and I think it's largely organizational. |
|
Hi folks, thanks for the discussion here! I still want to push this forward, but unfortunately, due to limited bandwidth, the progress has been slow. Last week I had a offline discussion with @blackmwk and he proposed something on top of what's in this PR: blackmwk#19 . I think moving the mutable states to Another thing worth mentioning is that the onging V4 work on the Java side will change how manifests are generated, filtered, and merged. It may be a bit early, but I believe a design that can survive thru V4 upgrade would greatly help us in the long term. Considering the complexity of even refactoring the transaction level logic, I think it's worth investing a bit more time make sure we don't have to rewrite the code when adopting V4 in the future. I'll update this PR as soon I have a clearer view of how it's going to look like in rust from end to end. Meanwhile, any thoughts about the transaction layer and how it could look like in rust would be appreciated |
|
+1 on moving mutable state to the Transaction level — the Since the last update I've been exercising the revival branch against a live
Design implication for the retry cache specifically: any cached On V4: the filter semantics (drop removed entries, re-emit survivors as Happy to rebase these (plus the earlier summary-subtraction fix) as small |
|
I agree that @blackmwk 's proposed solution (blackmwk#19) nicely gets us around the locking problem. I think it would be best to open a new PR with the the proposed solution such that we can have a separate discussion about the approach there. Once this is settled we could come back to this PR and try to adopt it to the new architecture. |
|
Good catch — the lifetime table tells us when validation runs and what must be recomputed on rebase, but not what the predicates are. Those two halves compose naturally: each conflict predicate (conflicting appends, conflicting deletes, added-files-match-filter, data-files-exist, deleted-manifests, …) has inputs that are either base-dependent (recompute per invariant 1) or attempt-stable (reusable while the base holds). I'd be happy to draft that as a companion section: one row per predicate with its requiring operation, inputs classified by lifetime, and the forced-conflict test that proves it — mirroring Java's MergingSnapshotProducer validations so nothing from the previous document is lost. From the rewrite-files side we already have test evidence for the conflicting-delete case. |
|
The conflict-predicate matrix offered above is drafted: CTTY#20 (targets |
|
@blackmwk, @dannycjones what do you think about the new RFC? |
|
I had an offline sync with @CTTY about a newer version, waiting for him to update the design |
|
The rewrite reads well. Trading the numbered invariants for the three-lifetimes table (section 2.1) plus the preserve/recompute table (section 5.1) keeps the same guarantees with much less surface to keep consistent, and section 6's write-once rule for generated metadata paths resolves the retry-overwrite concern from the previous draft more cleanly than an ordering invariant would have. Two items from the earlier draft that I think still need a home now that the phase-level test lists are gone:
Both are semantics the merging-producer and filter-manager steps will hit regardless of which operation consumes them first, so pinning them now saves a round-trip later. |
|
Let's move! |
Which issue does this PR close?
What changes are included in this PR?
Are these changes tested?