Repository navigation
Metadata copies refuse intervening memory writes - #1038
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks done
zlareb1
force-pushed
the
fix/issue-1028
branch
2 times, most recently
from
November 20, 2026 15:19
9dd6473 to
60d7247
Compare
8 of 9 tasks
zlareb1
force-pushed
the
fix/issue-1028
branch
5 times, most recently
from
November 20, 2026 19:32
eedccc1 to
ad7385c
Compare
Serialize ClickHouse version inserts through Keeper and check metadata source versions while the same fences exclude value writers. Retain uncertain holders until bounded sends finish, and preserve the earliest nested lease deadline. Signed-off-by: Lareb Zafar <[email protected]>
Acquire Keeper holders in bounded waves and check the earliest deadline before sending. Publish embeddings and retire vectors only after the memory insert succeeds, so a refused writer leaves no searchable value. Signed-off-by: Lareb Zafar <[email protected]>
The shared memory insert fence addresses the full identity tuple. Preserve it in the partial row builders used by these handler tests so their assertions exercise the same fenced path. Signed-off-by: Lareb Zafar <[email protected]>
Track memory sends after Keeper admission, keep cleanup within the connection pool and restore large snapshots in bounded batches. Expose the limits as settings and preserve the original backend cancellation identity. Signed-off-by: Lareb Zafar <[email protected]>
Translate only the fence-owned timeout and report unknown outcome after a send began. Keep uncertain holders until admitted sends expire and preserve errors raised by the inner operation. Signed-off-by: Lareb Zafar <[email protected]>
A searchable update needs a committed memory row. Assert the dependency with an event barrier while retaining the independent embedding and transport latency checks. Signed-off-by: Lareb Zafar <[email protected]>
Clock skew lets independent writers select the same version. Compare the served value and metadata inside admission on both authorities. Preserve high-sensitivity search fencing when cancellation arrives during holder release, and isolate rate-limit assertions from same-key contention. Signed-off-by: Lareb Zafar <[email protected]>
Ordinary concurrent writes retry admission after releasing partial batches. Track admitted and acknowledged memory inserts before holder cleanup so high-sensitivity bulk writes and committed copies retain privacy fences and follow-ups when cancellation arrives during release. Keep expired absence-admission fixtures complete and preserve existing assertions. Signed-off-by: Lareb Zafar <[email protected]>
Record ClickHouse acknowledgement before Keeper release so cancellation retains the audit receipt and announcement for plain and searchable sets and updates. Refused and unknown inserts do not emit committed-row receipts. Signed-off-by: Lareb Zafar <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
Signed-off-by: Lareb Zafar <[email protected]>
The retry repairs search when the memory insert lands without acknowledgement. Fail the raw memory client call so the funnel cannot mark it acknowledged, and verify the unknown-outcome, retry and completed no-op sequence through the restore functions. Signed-off-by: Lareb Zafar <[email protected]>
Anchor the event-loop and send clocks before reading the remaining holder budget. Relative timeout entry can otherwise move the send deadline after a pause and consume the margin protecting Keeper ownership. Signed-off-by: Lareb Zafar <[email protected]>
A retry wakeup or slow acquisition could return after the wait budget and still enter the writer. An absolute admission timeout covers acquisition and backoff; successful late holders are released before refusal. Zero-wait callers keep one attempt, and partial holders finish shielded cleanup. Signed-off-by: Lareb Zafar <[email protected]>
A second cancellation could interrupt an acknowledged copy before its search mirror, and the same pattern affected point receipts, bulk announcements and high-sensitivity fences. Finish those sequences before propagating the first cancellation. Event-driven regressions preserve the original exception and every owed callback. Carry the webhook budget tag back to the request without changing its pricing or sharing unrelated context. Document metadata contention in the API models and generated reference, and add the writer-drain and bounded-send cutover procedure. Bulk embedding failures propagate directly while its existing finally announces acknowledged rows. Signed-off-by: Lareb Zafar <[email protected]>
Cancellation at the second gather could skip successful-holder bookkeeping and strand Keeper keys until expiry. Settle tasks and record their holders under shielded cleanup before releasing them. Preserve the first cancellation through settlement and release, including a backend cancellation followed by repeated caller cancellation. Signed-off-by: Lareb Zafar <[email protected]>
…urns Shield the initial acquisition gather and cancel unfinished tasks once. Protect leases.take failure cleanup too: a backend error may have entered release before the first caller cancellation. Real Keeper-table fake regressions cover backend cancellation and ordinary failure, single and repeated caller cancellation, successful acquisition and no-cancellation controls. Correct memory/embedding publication comments and describe whole-batch Postgres expiry deferral in the generated operation reference. Signed-off-by: Lareb Zafar <[email protected]>
zlareb1
force-pushed
the
fix/issue-1028
branch
from
November 20, 2026 20:36
ff827ff to
d184265
Compare
4 of 5 tasks
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: #1028
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):
memory.lock,memory.unlockandmemory.verifyreturn a retryable error when another write replaces the row they read, preserving the acknowledged value. The source check distinguishes changed rows with equal versions on both storage authorities.Why
A metadata operation copies the complete memory row into a later version. An update could return between its source read and insert, after which the metadata copy became the head with the older value.
Every ClickHouse memory version insert takes a per-key Keeper fence. The metadata operations compare their source row inside that fence, while other writers take the same fence. A re-read alone leaves an insert window; the shared store closes it across serving processes. Comparing only versions also misses two writers whose clocks trail the same head and both select that head's version plus two. Exact admission compares normalized values and metadata; Postgres uses that comparison under its existing transaction. Loose protection-only admission keeps its existing behavior.
Scope and risk
Lock, unlock, verify and verification revocation opt into the source check. Other copy writers still need their own source checks. In-place counter updates and redaction mutations remain outside the insertion fence guarantee; usage overlays and JSON projection formatting do not identify a revision.
Writers wait for admission within the effective write timeout's budget, releasing partial batches before retrying. The absolute admission deadline covers acquisition and retry wakeups; late successful acquisitions release their holders before any memory insert. An unavailable Keeper or an exhausted admission budget returns a retryable 503. Each key adds control-store round trips. Cancellation waits for acquisition tasks to settle and successful holders to be recorded before cleanup. Acquisition failure releases accepted holders even when the backend begins cleanup before caller cancellation; repeated cancellation cannot interrupt that cleanup. Acquisition and release use bounded waves capped by the configured HTTP pool; large namespace restores insert bounded batches. A later failed restore batch can leave earlier batches in place, and retrying writes the snapshot again.
Memory rows commit before their search documents are published. Definite admission refusal publishes no search row, committed-row receipt or privacy fence. Admitted high-sensitivity writes retain their privacy fence when the send outcome is unknown; acknowledged bulk writes retain their announcements, and committed copies retain their follow-ups if cancellation arrives during holder release. Point set and update receipts and announcements survive cancellation during acknowledged holder release. Repeated cancellation cannot interrupt an owed follow-up sequence or high-sensitivity fence; the first cancellation propagates after completion. Webhook budget tags return to the request without sharing unrelated child-task context. Unknown inserts keep their holders until admitted sends finish or expire. The fence deadline returns 503
BACKEND_UNAVAILABLE, withoutcome_unknownwhen a send may have landed.Compatibility, rollout and rollback
ADMISSION_CONTENDEDwhen their source row moved.docs/operations/upgrades.md; every active memory writer must run the fence-aware build before relying on the concurrency guarantee. Older builds do not participate: drain those writers and let their bounded in-flight sends settle before relying on the guarantee. No migration, backfill or re-index is required. Optional settingsLOOM_CH_WRITE_FENCE_CONCURRENCY(default 16) andLOOM_CH_RESTORE_BATCH_ROWS(default 1000) bound admission waves and restore batches. Configure these optional fields after every writer has upgraded.Tests
Merge status: hosted checks are still running, and final review of this rebased commit is incomplete. The seventeen issue patches match the locally tested source; all reported source findings are corrected.
Current composition: 19 focused metadata source-admission cases and nine real-Keeper-fake acquisition cleanup cases cover intervening writes, equal versions, concurrent insertion, backend failure and repeated cancellation. All 28 pass under the bounded local gate.
Historical pre-composition evidence includes 1,767 focused unit/documentation cases, source-admission fail-first regressions, and private ClickHouse/analyzer checks. Those results do not qualify this composed head.
The same-source admission and repeated-cancellation regressions failed before their corresponding corrections. Existing receipt, announcement, privacy-fence and webhook-budget assertions remain intact.
Earlier hosted failures included a native claim-release wait and a SQL splitter CPU bound. Their causes are not established. No threshold, timeout or assertion is changed here, and no unchanged CI run is retried.
Full exact-head hosted CI and a fresh independent whole review are incomplete at merge. Pending validation includes Linux unit shards, coverage, database integrations, isolation, mixed-version, quickstarts and Cell acceptance. Earlier validation remains attributed to its tested source.
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated: Codex wrote the implementation and tests. The source, failure cases, real database behavior, generated files and CI failures were checked. Reported independent review findings are corrected; final rebased-source review is incomplete.
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.