Repository navigation
Expiry actions refuse stale source heads - #1057
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
force-pushed
the
fix/issue-1029
branch
from
November 20, 2026 16:08
7bbdf49 to
b86e8d5
Compare
zlareb1
force-pushed
the
fix/issue-1028
branch
from
November 20, 2026 16:55
deeb6c3 to
6cb861a
Compare
zlareb1
force-pushed
the
fix/issue-1029
branch
from
November 20, 2026 17:03
6f42a20 to
21df67e
Compare
zlareb1
changed the base branch from
fix/issue-1028
to
stack/issue-1029-parent-6cb861a1
November 20, 2026 17:56
Check expiry plans under the shared memory writer fence before inserting their versions. Recheck refused batches and retry only the unchanged candidates. Signed-off-by: Lareb Zafar <[email protected]>
Construct complete persisted rows so the two-client regression runs against ClickHouse. Signed-off-by: Lareb Zafar <[email protected]>
Record each accepted batch before holder cleanup and retain its mirror and announcement in cancellation cleanup. Cover same-version authored changes and cancellation before and after acknowledgement. Signed-off-by: Lareb Zafar <[email protected]>
Writes with equal version stamps share the history sort key. Assert the distinct source and renewal versions so background merges do not change the expected count. Signed-off-by: Lareb Zafar <[email protected]>
A strong head read applies only to that statement. Read the version history in its own consistency scope so a lagging replica cannot hide the committed renewal. Signed-off-by: Lareb Zafar <[email protected]>
ClickHouse expiry can refuse moved heads, so its reported count is no longer always zero. Signed-off-by: Lareb Zafar <[email protected]>
Protect the full announcement and mirror sequence with the existing cancellation helper, then preserve the original cancellation. Document authoritative source selection before admission, including the still-expired Postgres head refresh. Signed-off-by: Lareb Zafar <[email protected]>
Postgres keeps equal-version authoritative heads without rechecking expiry. Qualify candidate selection separately from exact admission so the documentation does not promise that every renewal is skipped. Signed-off-by: Lareb Zafar <[email protected]>
Recheck expiry on every selected source before planning. Postgres permits equal-version replacements, so exact admission alone can accept a plan built from an already renewed head. Keep shared head selection and still-expired replanning intact. Signed-off-by: Lareb Zafar <[email protected]>
A second refusal leaves unchanged candidates in the remaining batch too. Document that accounting and extend the retry control to retain an unchanged third head. Signed-off-by: Lareb Zafar <[email protected]>
zlareb1
force-pushed
the
fix/issue-1029
branch
from
November 20, 2026 20:54
a5f60d5 to
2f9b286
Compare
zlareb1
changed the base branch from
stack/issue-1029-parent-6cb861a1
to
main
November 20, 2026 20:54
zlareb1
marked this pull request as ready for review
November 20, 2026 20:54
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.
Closes: #1029
Related: #1038
Draft stacked on PR1038. This diff contains eight expiry-related files above its parent; shared writer-fence code is supplied by PR1038. Full CI begins after rebasing and retargeting to main.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
Expiry actions refuse a memory changed after its source head is selected for planning. The sweep retries unchanged candidates and leaves moved heads for a later pass.
Why
The sweep planned a full-row copy from an expired candidate and inserted it at a higher version. An update that completed between the scan and insert could be overwritten. Both expiry insert attempts request exact-head admission under the shared memory writer fence. A read outside that fence would leave another check/insert race. Postgres can refresh a scan to a renewed head with the same version, so eligibility is checked independently before planning.
Scope and risk
The shared writer fence is merged. This branch applies only the ten expiry commits on top of the merged fixes. The concrete writer-drain and bounded-send cutover procedure remains linked from the storage-authority guide.
The change covers tombstone, demote and anonymize actions, including same-version authored changes and partial-batch retries. Before planning, the sweep rechecks expiry on every authoritative source, including equal-version renewals. Postgres still replans from rewritten heads that remain expired. The exact comparison applies after that selection. Acknowledged actions keep their announcements and mirrors even when cancellation repeats during those follow-ups, then raise the original cancellation. Refused candidates produce no search mirror or webhook event. The exact comparison excludes
recall_count,evidence_countandlast_recalled_at; their in-place usage updates remain outside this fence. Themoved_skippedfield description covers both storage authorities and unchanged candidates left by a second whole-batch refusal. Dry runs and empty scans still write nothing. Tests cover an update after the scan, a writer arriving inside the protected check/insert window, and a head moving during retry.Compatibility, rollout and rollback
moved_skippeddescription drops the obsolete ClickHouse-zero claim.Tests
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated: Codex wrote the change and regression tests. Validation covers stale scans, retry contention, the shared-funnel inventory, and real ClickHouse readback.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.