Repository navigation
Resolve shared context entries once per read batch - #3933
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Summary
Two files, +112/-31 at the initial checkpoint. This continues P1086 after #3923's authentic original capture succeeded: the saved selection has6,274 entries,54requests and216versions. Its ordinary-reader profile made21,978
ContextEntry.originalcalls in17.66s;13.07s accumulated in FieldCodec decoding. That is measured reader cost, not attribution of the whole114.85s capture hold.Mechanism: one batch per ordinary-reader snapshot
Before: each
ContextStore.resolvecall reconstructed its own predecessor/entry maps. Page reads, selected context annotation reads and original/retained comparison repeated decoding of shared entries for every requested row.After: the same resolver accepts requested rows and yields their restored contexts. It builds one local dependency map per invocation, reuses shared original entries, and streams restored results.
latest, page reads,original_segmentsandrequire_retaineduse that owner. No compatibility overload, persistent cache, extra schema, forwarder, new freezer or changed storage format.Original and retained connections keep separate maps. Every predecessor edge checks its thread even when already loaded. Dependencies remain segment-only; session AND path AND entry identity remain the keys. Page limits, saved-page object reuse, missing-source/missing-record refusals, complete version comparison and source integrity remain intact.
Removed work
The31deleted lines include per-request restoration loops and repeated source-identity reads. New code factors the shared snapshot lifetime rather than moving it into a service. Four single-row test call sites now consume the batched reader. Added controls cover shared-entry decoding once, foreign-thread predecessors both cold and preloaded, and identical session/entry IDs on different paths.
Evidence
git diff --checkpassed.shared-board/p1086-selected-reader-profile-01.{json,log,prof}.shared-board/p1086-context-batch-{original,candidate,parity}-01.json, matching logs/rc and profiles. Driver.p1086-context-batch-reader-01.pyuses installed old code for baseline and checkout src/tools for the candidate; both ordinary readers use the existing TestLease. No advanced original store was opened.Still open
This does not recreate the original capture, certify complete aggregate/temp/WAL/RSS/handle peaks, grant native launch authority or close P867/P667/B4 physical acceptance. The authentic captured cut and all failed/UNKNOWN epochs remain preserved. The entire114.85s hold still lacks internal phase attribution.
Assumed: each batch consumes rows from the same open SQLite snapshot; the iterator is exhausted inside that snapshot by its owning caller. No stored schema or external wire format changes.