Skip to content

[PR] fix: storage boot line states the actual selection and writer state (#7408) - #7409

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-11-20_storage-boot-log-pure-sqlite
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-11-20_storage-boot-log-pure-sqlite

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

What

The full-mode [storage] boot line in src/storage/shadow.ts still carried the pre-#6480 wording:

unified FULL mode ENABLED (storage.unified=full or BILI_STORAGE_UNIFIED=full): index.db is the load path (unified-first, legacy fallback); legacy files keep being written — unset the knob to roll back

Since #6480 flipped the default to pure-sqlite, resolveStorageMode() resolves to "full" with no knob set and the JSON envelope writer defaults off — so under the default posture (the one every stock install boots into) all three clauses were false: no such knob was set, legacy files are NOT written, and there is no knob to unset. In the same boot, src/persist.ts prints the accurate line json envelope writer off (pure-sqlite default — index.db is the only persistent copy; ...), so the two lines directly contradicted each other. Field impact (reported in #7408 §3b): the stale line steered diagnosis into chasing a non-existent dual-write.

Fix

The line now branches on the raw selection (unifiedSelectionIsSqlite) and the effective writer state (effectiveJsonWriterOff — at that point in maybeOpen this equals persist.ts's jsonWriterOff: mode is full, backend is sqlite, and an encryption-blocked open never reaches the line):

posture boot line now says
default pure-sqlite (writer off) …(pure-sqlite selection (storage.unified absent or =sqlite)): index.db is the load path AND the only persistent copy — JSON envelopes are not written; restore dual-write with storage.jsonWriter=on
explicit full (writer on) unchanged historical wording: …legacy files keep being written — unset the knob to roll back
pure-sqlite + explicit jsonWriter=on …legacy files keep being written — remove the explicit storage.jsonWriter=on to return to the pure-sqlite default
explicit full + explicit jsonWriter=off writer-off wording (same as the default row, with the explicit-full selection named)

Plumbing: maybeOpen/openAsync take the file-tier jsonWriter value as a new optional parameter; persist.ts passes fileStorageJsonWriter() at both call sites (constructor + #5188 reopen). The module doc header is updated to the four current postures.

Behavior change disclosure (log wording only)

  • OLD (default posture): unified FULL mode ENABLED (storage.unified=full or BILI_STORAGE_UNIFIED=full): … legacy files keep being written — unset the knob to roll back
  • NEW (default posture): unified FULL mode ENABLED (pure-sqlite selection (storage.unified absent or =sqlite)): index.db is the load path AND the only persistent copy — JSON envelopes are not written; restore dual-write with storage.jsonWriter=on
  • Explicit-full boots print the exact old string as before (pinned by the new test).
  • No wire, config, storage-semantics, or code-path change — one info log line's wording + a doc comment.

Tests

  • New: tests/issue7408-storage-boot-log.test.ts — pins the exact boot line for all five reachable postures (default, explicit full, explicit jsonWriter=on env tier, explicit full + jsonWriter=off, file tier through the new parameter).
  • Targeted local runs green: the new file + issue5046-second-writer-degrade + issue4341-early-twin-adoption + issue5188-sidecar-recoverable-open + storage-unified + storage-json-writer-off* + storage-mode-label (48 tests). Full-suite verdict = CI on the pushed head.

Addresses the §3b finding reported in #7408 (the datapoint's other findings are folded into their existing boards — #5796, #7254, the #5744/#5756 residual thread #6169, and #7382 — via comments on those threads). Per the owner's 2026-11-20 directive, #7408 is folded into the root-cause aggregation issue #7413 and stays OPEN for batch closure after fix verification — so this PR deliberately carries no auto-close keyword (close/fix/resolve) for #7408.

… writer state (#7408)

The pre-#6480 wording ("storage.unified=full or BILI_STORAGE_UNIFIED=full:
... legacy files keep being written — unset the knob to roll back") survived
the pure-sqlite default flip. Under the default posture — no knob set, JSON
envelopes NOT written — all three clauses were false, contradicting the
accurate jsonWriter-off line persist.ts prints in the same boot and steering
field diagnosis into chasing a non-existent dual-write (#7408 §3b).

The line now branches on the raw selection (unifiedSelectionIsSqlite) and
the effective writer state (effectiveJsonWriterOff, which at that point
equals persist.ts's jsonWriterOff: mode is full, backend is sqlite, and an
encryption-blocked open never reaches the line):
  - writer off → "index.db is the load path AND the only persistent copy —
    JSON envelopes are not written; restore dual-write with
    storage.jsonWriter=on"
  - writer on + pure-sqlite selection → names the explicit
    storage.jsonWriter=on as the reason envelopes are written
  - writer on + explicit full → the historical dual-write wording, unchanged

maybeOpen/openAsync take the file-tier jsonWriter value as a new optional
parameter (persist.ts passes fileStorageJsonWriter() at both call sites);
the module doc header is updated to the four current postures.

Regression test: tests/issue7408-storage-boot-log.test.ts pins the exact
boot line for all five reachable postures.

Log wording only — no wire, config, or storage-semantics change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — no other open PR targets the storage boot line / the #7408 §3b finding. Scanned all open [PR] rows; the storage-adjacent ones (#7344 narrow-read restore path, #7338 CAS parse isolation, #7336 content digests) are different mechanisms.

Labels: source issue #7408 already carries bug / p2 / dsh / scope/storage; PR #7409 carries bug / p3 / scope/storage / root-cause. Both correctly labeled — no change made (add-only rule).

Verification (this is a completed [PR] — I verified, did not redo):

  • Code review: pulled pr-7409 @ 3e82f42. The full-mode line now branches on unifiedSelectionIsSqlite(env, fileUnified) (raw selection) and effectiveJsonWriterOff(env, fileJsonWriter, fileUnified) (effective writer state). I traced all five reachable postures against the helper implementations in src/knobs.ts:1048/1081 — every one produces the line the PR table promises, including the writer-off-beats-selection case (explicit full + jsonWriter=off). The claim that effectiveJsonWriterOff equals persist's own jsonWriterOff at the maybeOpen site holds: persist.ts:684 computes effectiveJsonWriterOff(...) && mode==="full" && !encryptionBlocked && writerBackendIsSqlite, and at the full-line site all four are true (mode is full, sqlite backend, persist gates the open on encryption). The shadow-mode line is byte-identical to before.
  • Local targeted tests (green): new tests/issue7408-storage-boot-log.test.ts 5/5; related suites issue5046 + issue4341 + issue5188 + storage-unified + storage-json-writer-off + storage-json-writer-off-json-writes + storage-mode-label = 42 pass / 1 skip / 0 fail. typecheck clean.
  • CI: still running on the pushed head — 8 test shards in progress, 0 failures, all fast static gates + mysql-contract green. Full-suite verdict = CI; I'll report the final result when it lands.

One non-blocking observation: the new fileJsonWriter param on openAsync (shadow.ts:442) is only exercised by its non-mysql early-return (shadow.ts:445), which the current call graph never takes — openAsync is invoked only for the mysql backend (persist.ts:703), which logs its own line. It's a correctly-plumbed defensive param, not a defect; leaving it as-is.


结构化八问

  1. 是什么问题:full 模式 [storage] 启动行还带着 [PR] storage: pure-SQLite default — JSON envelopes stop being written unless dual-write is requested (#6479) #6480 之前的措辞("legacy files keep being written — unset the knob to roll back"),在纯 sqlite 默认下三个分句全错(没设任何 knob、并不双写、没有可 unset 的 knob),且与同一次启动里 persist.ts 打印的准确 jsonWriter-off 行自相矛盾,把现场诊断带向追查不存在的双写。
  2. 什么原因导致的:[PR] storage: pure-SQLite default — JSON envelopes stop being written unless dual-write is requested (#6479) #6480 把默认翻成纯 sqlite(jsonWriter 默认关),但这行启动日志的措辞没跟着更新——它把 selection 和 writer 状态写死成"显式 full = 双写"的历史姿态,而不是读实际值。
  3. 影响范围与严重程度:仅日志措辞。波及所有以默认纯 sqlite 姿态启动的存量安装(多数)。严重度 p3——行有误导性但不破坏功能,只误导诊断;无 wire/config/存储语义变更。
  4. 怎么修复的:该行改为按原始 selection(unifiedSelectionIsSqlite)与有效 writer 状态(effectiveJsonWriterOff)分支,四种可达姿态各出正确措辞;maybeOpen/openAsync 新增可选 file-tier jsonWriter 参数,persist.ts 在两个 maybeOpen 调用点传入 fileStorageJsonWriter()。
  5. 是否有回归问题:无。改动 = 日志措辞 + 文档注释 + 一个可选参数。persist.ts 里真正的 jsonWriterOff 计算未动——双写行为与之前完全一致,只是日志现在与事实一致。shadow 模式行逐字节未变。新可选参数默认 undefined(不传时行为不变)。
  6. 是否破坏缓存:不涉及。未触碰任何缓存/重试/游标/去重键逻辑。
  7. 是否改了设计方向:不涉及。存储架构不变,仅启动行措辞反映实际状态。
  8. 是否引入了新的配置:不涉及。无新 env/config/默认值;fileJsonWriter 是内部管线(把既有 storage.jsonWriter 值透传),不是新 knob。

判定:代码审核通过、定向测试绿、typecheck 干净、无回归面;待 CI 全量绿即可合并。CI 收尾后我再补一条最终结果。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 全量绿 — pushed head 3e82f42: 全部 11 个 test 分片(ubuntu 22/24 × 3 分片 + windows 22 × 5 分片)+ 两个 static-gates 均 completed/success,0 失败;快速静态门禁 + mysql-contract 全绿。(镜像缓存里 test 矩阵汇总行显示 skipped 是 GitHub 矩阵展开成独立 job 的正常现象,逐分片实跑全 success。)

最终判定:可合并。 代码审核通过、定向测试绿、typecheck 干净、CI 全量绿、无回归面。这是一条纯日志措辞修复(启动行现在说实际的 selection 与 writer 状态),不触碰 wire/config/存储语义。合并权在你。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant