Repository navigation
[PR] fix: route oversized kv values to the content CAS instead of throwing (#7378) - #7389
ranxianglei wants to merge 1 commit into
Conversation
…#7378) The session-order skeleton (179 entries, ~4-8 MiB) exceeded the 4 MiB inline extension-value cap (EXT_VALUE_MAX_BYTES), so serializeExtValue threw on every start and the hydrate fell back to the legacy file path for the process lifetime. The error message itself said "store large payloads in the content CAS instead" — this fix implements that. setKv now routes values over the inline cap to the content CAS: the kv row stores a small {"$biliCas": "<sha256>"} ref and the payload lives in the refcount-managed content table (GC-safe: gc only sweeps refcount<=0; delete-on-zero keeps it leak-free). getKv/listKv resolve the ref transparently; deleteKv releases the ref so the blob is reclaimed. Both the sqlite (UnifiedStore) and MySQL backends. Behavior change: setKv no longer throws for over-cap values — it stores a CAS ref. setSessionExt is unchanged (still inline, still throws over the cap). Fixes #7378
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — Only this PR (#7389 / mirror #7390) targets #7378; no open parallel PR fixes the same thread. Labels: Source issue #7378 and PR #7389 are already labeled ( Review in progress. I've read the full diff and traced the mechanism end-to-end:
CI: the Minor observations (non-blocking):
Full 8-question review follows once CI is green. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 八问
CI 状态与结论
|
Summary
Fixes #7378 — the session-order skeleton (179 entries, ~4-8 MiB) exceeded the 4 MiB inline extension-value cap (
EXT_VALUE_MAX_BYTES), soserializeExtValuethrew on every start and the hydrate fell back to the legacy file path for the process lifetime. The error message itself said "store large payloads in the content CAS instead" — this PR implements that.What changed
setKvnow routes values over the inline cap to the content CAS: the kv row stores a small{"$biliCas": "<sha256>"}ref and the payload lives in the refcount-managed content table.UnifiedStore) and MySQL backends both get the routing.getKv/listKvresolve the ref transparently (a missing CAS blob falls back to the ref with a warning — never throws, so one corrupt row can't break the whole hydrate).deleteKvreleases the ref before deleting so the blob is reclaimed (refcount balanced, delete-on-zero → no leak).setSessionExtis unchanged (still inline, still throws over the cap) — the issue scope is kv_store.setKvno longer throws for over-cap values — it stores a CAS ref instead. Old:throw "extension value exceeds 4194304 bytes". New: store a small CAS ref + the payload in the content table. This is the intended fix (the error message was the TODO).setSessionExtis unaffected.Tests
tests/kv-cas-routing.test.ts(7 tests): oversized setKv no-throw + CAS routing, byte-exact round-trip, listKv resolution, small-value inline, overwrite refcount balance, deleteKv ref release, whole-namespace delete.tests/order-unified-store.test.ts: new test — oversized skeleton (>4 MiB) migrates into the kv via the CAS and survives a restart.tests/extension-storage-contract.test.ts+tests/storage-ext.test.tsto assert the new behavior (setKv routes, setSessionExt still rejects).GC / leak safety
The content CAS
gc()only sweepsrefcount <= 0rows;putContentbumps,releaseContentdrops + deletes-on-zero. So a live CAS ref is GC-safe and a released ref is reclaimed — no leak.Closes #7378