Compaction: cell-walk optimizations, sharded compaction sessions, and the output’s format version #798
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 624 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.385
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #798"
general
weight: 0.35
MarkWolters
Three commits on the on-disk graph compactor, one per topic: sharded compaction, the output's format version, and the cell-walk optimizations that make large merges practical.
1. Sharded compaction sessions
Cassandra's sharded compaction writes K output sstables per compaction, each over a token range. Running K independent compactions over the same N sources repeats everything that does not depend on the shard, codebook training above all, and loses recall: a hash shard keeps 1/K of each node's same-source edges and nothing replaced them (at K=64 a node kept 0.5 of its 32, and the output was nearly bipartite between the sources).
sharded()opens a session; eachcompactShardmerges one output with that shard's nodes as its live set and returns the shard's ordinal mappers. Shards may become known one at a time.QuantizationCompactionStrategy.adoptCompressor).No live nodes found at maxLevel).Measured on tessera-2M, two 1M sources (1024-d, cosine, degree 32) into K hash shards, total wall time and recall@10 over all shards, 8 cores:
| K | one compaction per shard | one session | rebuild of every shard |
|---|---|---|---|
| 4 | 454 s, 0.781 | 566 s, 0.825 | 876 s, 0.836 |
| 16 | 981 s, 0.823 | 567 s, 0.894 | 946 s, 0.903 |
| 64 | 1203 s, 0.875 | 627 s, 0.945 | 886 s, 0.947 |
The session's cost is flat in K and its recall within a point of a rebuild. At K=4 the same-source join costs more than the shared training saves; from K=16 it wins on both.
ShardExpin benchmarks-jmh is the experiment (seeCompactorBenchmark.md).2.
withVersionchooses the output's on-disk format versionThe compactor wrote
OnDiskGraphIndex.CURRENT_VERSIONonly.withVersion(int)names the version of the output, any oneGraphIndexFormatFactoryknows; the header follows the version's format, the footer is written only for footer-based versions (5+), and a version that cannot hold the output is rejected up front (fused PQ needs 6, upper layers need 4+). Source versions are detected from their files and may differ from the output's. A session writes every shard at its compactor's version.3. Cell-walk optimizations for large merges
The level-0 cell walk and the passes around it, tuned for merges whose store is larger than memory:
POSIX_MADV_WILLNEEDon the native reader), instead of one demand fault at a time.The walk's budgets, announce-ahead and direct-read decision have package-private setters for the tests only; each has a default the compactor derives from the machine or the sources.
Tests
TestOnDiskGraphIndexCompactor: direct reads and fixed budgets produce the same merge; sharded sessions over full-precision and fused sources (membership, ordinals, vectors, edge mix, rejection of a non-live node); the empty-top-level merge;withVersionround-trips at every version through the versioned loader and checks the rejections. 27 tests.