feat: watch 多库化(统一 reconcile 核心)— 适配 Codex 26.609,PR4#19
Closed
Wangnov wants to merge 2 commits into
Closed
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
2aa959e to
7e18e57
Compare
3acf323 to
449d73c
Compare
7e18e57 to
030fd33
Compare
a9a7e6c to
315fef8
Compare
030fd33 to
61940f9
Compare
315fef8 to
1f56a37
Compare
61940f9 to
5d6cce5
Compare
1f56a37 to
c81350b
Compare
5d6cce5 to
20e1a7e
Compare
90c7860 to
758c950
Compare
PR3 of the multi-store adaptation (builds on #17). Before writing, the multi-store path now waits (bounded) for each store's Codex startup-backfill to finish, so threadripper never races Codex's rebuild. - wait_for_store_backfill polls backfill_state (read-only): no table or a `complete` status is ready immediately; otherwise it waits up to backfill_wait (default 10s) and then reports the store busy. - A busy store is reported StoreOutcome::Skipped, and neither its rollout targets nor its DB are touched. - Because rewriting the shared rollout JSONL would race a running backfill's reads (the rollout files are its source of truth), a rollout-rewriting scope (AllRows) combined with any in-progress backfill skips the whole round; --sqlite-only (RolloutScope::None) still writes its ready stores. - main returns Partial(2) / Failed(1) accordingly; the --sqlite-only App warning now fires only when the App store was actually updated. Reviewed in parallel by Codex and a Claude subagent. Codex caught that the first cut still rewrote the shared rollout JSONL (racing the backfill) even while skipping busy stores' DBs; fixed with the whole-round skip above, plus a regression test asserting that a shared rollout and both DBs stay untouched while a backfill runs. 53 tests, clippy and fmt clean.
PR4 of the multi-store adaptation (builds on #18). `watch` now maintains every discovered store, not just one, by sharing the multi-store write path. - Extract reconcile_stores_core(.., backup, ..) used by both the one-shot backed-up path (reconcile_all_stores_with_backup) and a new no-backup reconcile_all_stores for the continuous watch service. - The core supports the incremental MismatchedRows scope with an AllRows rollout followup (when rows change), matching the former single-store watch path. - backup=false skips per-store backups AND the rollout change journal, so watch does not litter backups/ every poll (matching the old reconcile_once, which passed no journal path). - watch passes Duration::ZERO as the backfill wait: a store mid-backfill is skipped this poll and retried next, never blocking the loop. With a rollout-rewriting scope, PR3's whole-round skip means watch quietly waits out a backfill and resumes when it completes. - Remove the now-unused single-store path: reconcile_once, ReconcileSummary, print_sync_summary, add_rollout_summary. Reviewed in parallel by Codex and a Claude subagent. Codex caught that the no-backup path still wrote a rollout change journal (a regression vs the old watch); fixed by gating the journal on backup, with a regression test asserting the watch path writes no backups/rollouts.*.jsonl. 54 tests, clippy and fmt clean.
758c950 to
1fc292e
Compare
6954175 to
1fc292e
Compare
Owner
Author
|
✅ 已随这条 stack 通过快进合并落到 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
PR1(#16 只读发现+多库 status)、PR2(#17 sync/bucket 写路径多库化)、PR3(#18 backfill 守卫)。
watch(后台连续监听服务,用MismatchedRows增量 scope +AllRowsfollowup,不做备份)在前三个 PR 里一直走旧的单库reconcile_once。PR4 把它也多库化。共识见 #14。改动
reconcile_stores_core(.., backup: bool, ..):在 PR2/PR3 的多库写逻辑上加backup标志 + MismatchedRows followup(翻完各 ready 库 DB 后若总 changed_rows>0,对 ready 库再跑一次AllRowsrollout 并合并计数)。reconcile_all_stores_with_backup(backup=true,sync/bucket)与新增reconcile_all_stores(backup=false,watch)都委托给它。.bak备份与 rollout 变更日志 —— watch 不再每轮往backups/写东西(与旧reconcile_once一致,旧路径传的 journal 就是None)。watch传Duration::ZERO作 backfill 等待:某库重建中则本轮跳过、下轮再试,绝不在单轮阻塞;配合 PR3 的整轮跳过规则,backfill 期间 watch 静默等待、完成后自动恢复。reconcile_once/_with_progress/_unlocked/add_rollout_summary/ReconcileSummary/print_sync_summary;reconcile_rollout_metadata_from_sqlite_with_progress现仅测试用,标#[cfg(test)]。并行 Review(Codex × Claude subagent)
journal=None→ watch 会每轮往backups/落rollouts.*.jsonl。backup上(backup=false 不写);新增回归测试reconcile_all_stores_writes_no_journal_without_backup(断言 watch 路径改了 rollout 但不写 journal)。failed_stores防御建议也采纳(加了debug_assert)。测试 / 质量
cargo test:54 passed(新增 no-journal 回归;MismatchedRows followup 等价测试现走统一reconcile_all_stores)。cargo clippy --all-targets:0;cargo fmt --check:clean。watch对空CODEX_HOME启动→无库错误优雅处理→进入轮询→循环不崩;真实库status只读回归正常。后续
--store cli|app|configured|allflag(最后一项)。