Repository navigation
fix(core): only rewind payload ops in direct-rewind catch-up - #309
Draft
marcus-pousette wants to merge 1 commit into
Draft
marcus-pousette wants to merge 1 commit into
marcus-pousette wants to merge 1 commit into
Conversation
Direct rewind reattached a rewound insert or move but left it in `last_change`, which defensive deletion reads, and restored the latest earlier structural op even when a cycle check had rejected it. When a late op made an applied move a cycle, the node that move had revived stayed visible in the reported outcome. Return None when the materialized part of the suffix holds an insert or move, so the caller runs the full catch-up. That catch-up already ran eagerly after every direct rewind, so this adds no work. Remove the structural rewind helpers and `FrontierRewindStorage::latest_structural_before`.
This branch has not been deployed
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.
Direct-rewind catch-up could not undo an insert or move exactly. It reattached the node, but the op stayed in
last_change, which defensive deletion reads. It also restored the latest earlier structural op even when a cycle check had rejected that op.Example: ROOT → G → D → T, with D deleted and N under ROOT. S (lamport 7) moves N under T, which revives D. X (lamport 6) moves G under N and arrives after S. In canonical order S is a cycle, so D stays deleted. After the direct rewind,
last_change(T)still held S, so D stayed visible.Change
Noneand the caller runscatch_up_materialized_state.rewind_structure_op_in_placeandlatest_structural_before(core default, sqlite and Postgres) are removed.Cost
Out-of-order appends with an insert or move in the materialized suffix now take the full catch-up instead of the direct rewind. That costs nothing over main.
orchestrate_persisted_remote_appendcalls.unwrap_or(catch_up(..)?), which evaluates the full catch-up eagerly. It has run after every successful direct rewind since #123 and repaired the rows, but its outcome was discarded. That is why reads converged on main whileonMaterialized,onMaterializedDurableandchangedSincemissed D's deletion. These appends now skip the redundant rewind.Making the fallback lazy, so payload-only suffixes actually skip the full catch-up, is left for a follow-up.
Tests
replayed_conflicting_moves_report_final_parentsdrops itsfull_replayflag. A move in the materialized suffix now forces the full catch-up by itself, so both variants ran the same path.-D warnings, rustfmt, prettier