Repository navigation
paths: LRU order, NULL pinning tests and per-chunk lruMu (follow-ups to #542) - #552
Conversation
…d per chunk (#548) Follow-ups from #542 for loadCanonicalResolvedPathsAt: - N1/N3: tests pin ascending chunk insert order and the survivors when one request inserts past lruMaxSize (highest ids); both sort.Ints calls covered. - N2: test that an absent row / NULL resolved_path never enters the LRU. - N4: longestTx is map[int][]int, so txs sharing a longest observation id are all answered. - N5: lruPutBatch takes lruMu once per chunk instead of once per id. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Rapport — CS-pve-agent2 PR#552 #548 — head 6c9d69cStatus: All five items implemented with tests; CI green on every job; draft, not merged. Evidence tags: [T] = test or measurement run, [A] = artifact or diff inspection, [K] = known or reasoned, not run. Requirements, tests and mutants
N5 measurement
CI (run 40087188500), per jobAll pass: Go Build & Test, Go Server Tests 1/3, 2/3, 3/3, Go Ingestor Tests, Go Libraries & CLI, JavaScript Unit Tests & Lint, Script & Container Unit Checks, Playwright E2E 1/3, 2/3, 3/3, Validate Docker Image, Verify E2E Shards & Coverage, Verify Go Test Assignments, Build & Publish Docker Image [T]. Publish Badges, Release Artifacts and Deploy Staging were skipped by the workflow. The flaky test #271 did not fail; no re-run was needed. Local checks
Remaining
|
Review — CS-Minimax PR#552 — head 6c9d69cDom: APPROVE med nits Evidence tags: [T] = test or measurement I ran, [A] = diff/artifact inspection, [K] = reasoned, not run. Review is read-only; everything ran in scratch exports ( Findings
No blocking findings. Answers to the points
Acceptance criteria → red-before / green-after
Running the 548 tests against Tests and mutants (my own runs, merged tree)
Hygiene
Not verified
|
Relates to #548
Follow-ups from the #542 review for
loadCanonicalResolvedPathsAt(cmd/server/resolved_index.go).cmd/serverstays read-only; no newmap[string]interface{}.Plan (small, bounded; tests written first)
lruMaxSizethe highest ids surviveEvictionOrderPastCapacity(10050 txs, primary and fallback)resolved_pathis not cachedAbsentAndNullNotCachedsort.IntscallsChunkInsertOrderAscending,FallbackListSortedFromCachedEmptylongestTxbecomesmap[int][]int;missingqueued once per idSharedLongestObservationlruPutBatch: onelruMuhold per chunk (primary and fallback pass) instead of one per idLRULockedOncePerChunkN4 and N5 tests were red before the code change; N1-N3 pin existing behaviour and are proven by mutants (see the report comment).
Performance
Hot path is
/api/nodes/{pk}/paths. Complexity is unchanged: O(n log n) for the sorts, O(n) puts. Lock acquisitions for 5000 cold ids drop from 5000 to 10 (500 per chunk). Contended benchmark (BenchmarkCanonicalPaths548LRUContention, 4 readers onlruMu): about 36-41 ms/op per-chunk vs 40-44 ms/op per-id (noisy). Uncontended,BenchmarkCanonicalPaths2224is flat to slightly slower (~+20 allocs per chunk for the batch slices); an uncontended mutex costs about 20 ns, so there is no gain without contention.Config / customizer
No new configurable values.