CNDB-20430: Keep memtable graph searchers from pinning released graphs #2864
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 178 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.310
Real PR Conversation Timeline
1 comments
"Review active on #2864"
general
weight: 0.35
MarkWolters
What is the issue
riptano/cndb#20430.
CassandraOnHeapGraphcaches oneGraphSearcherper thread in ajava.lang.ThreadLocal. Java keeps those values in each thread and clears stale entries only lazily, so after a memtable is flushed and its index is dropped, request threads that searched it keep the whole on-heap graph and its vectors reachable. Memtable accounting no longer counts that memory. A 10M-vector live load ran a 32 GB heap out of memory this way (5 flushed graphs, about 12.5 GB, held only by stale entries).What does this PR fix and why was it fixed
CassandraOnHeapGraph.searchersis now anExplicitThreadLocal, as inCassandraDiskAnn. Its per-thread searchers live in a map inside the graph object, so they are collected together with the graph.VectorMemtableIndexTest.releasedGraphIsNotPinnedBySearchThreads: searches from a thread that outlives the index, drops the index, and checks the graph is collected. It fails on main and passes with this change.ExplicitThreadLocalis in the JVector version CC already uses.Tests (Ice Lake, 32 cores, JDK 22): the 46 SAI vector test classes on this branch and on unmodified main. No new failures.
VectorSiftSmallTest.testCompactionfails on both (recall 0.97 vs a 0.975 bar; main failed 3 of 3 reruns, this branch 1 of 3), andVectorKeyRestrictedOnPartitionTesttimed out once on main only. Checkstyle passes.