Repository navigation
fix(daemon): report WAL checkpoint blockers - #1456
Conversation
Problem: live catch-up can leave the archive WAL above the checkpoint threshold, but the checkpoint observation only reported busy pages. In practice the blocker can be an external reader such as a Lynchpin current-state job or stale MCP process, which makes the daemon look like the sole culprit while checkpoints cannot truncate. What changed: record processes holding the SQLite db/wal/shm files when a checkpoint is busy, locked, or remains above the truncate threshold. Batch ingest logs the first blockers on checkpoint contention, and the periodic daemon checkpoint log includes the same blocker list. Verification: pytest tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py -q; python -m mypy polylogue/storage/sqlite/wal_checkpoint.py polylogue/pipeline/services/ingest_batch/_core.py polylogue/daemon/cli.py tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py; devtools verify-file-budgets; ruff check polylogue/storage/sqlite/wal_checkpoint.py polylogue/pipeline/services/ingest_batch/_core.py polylogue/daemon/cli.py tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py. Ref #1447
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 41 minutes and 6 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90af70792a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| proc_root = Path("/proc") | ||
| for entry in proc_root.iterdir(): |
There was a problem hiding this comment.
Catch /proc scan errors when collecting blocker processes
_sqlite_file_holders iterates Path("/proc").iterdir() without a top-level OSError guard, so on non-Linux hosts (no /proc) or restricted /proc mounts this raises and escapes maybe_checkpoint_wal. Because ingest calls maybe_checkpoint_wal inside _process_ingest_batch_sync’s main try-block, that exception can fail the batch after commit-side effects instead of returning a best-effort observation; this contradicts the intended “degrades quietly” behavior for blocker diagnostics.
Useful? React with 👍 / 👎.
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds process-holder diagnostics to WAL checkpoint observations so live ingest and daemon checkpoint logs can explain when SQLite checkpointing is blocked by another reader instead of silently leaving a large WAL behind.
Problem
While deploying the FTS trigger repair work from #1455,
polyloguedgenerated a growing WAL during catch-up and checkpointing stayed busy. The live blocker was an unrelated long-runninglynchpin.cli.current_stateprocess holding Polylogue database files open, but Polylogue only reported checkpoint mode/page counts. That left the operator to manually correlate/proc,fuser, and service logs.Solution
WalCheckpointObservationnow carries bounded/procprocess-holder details when a checkpoint is busy, locked, or leaves the WAL above the truncate threshold. Batch ingest logswal_checkpoint_blockedwith the checkpoint reason, WAL sizes, busy pages, and first blockers; the daemon periodic checkpoint log includes the same blocker list. The/procscan is Linux-only, bounded to active file descriptors forpolylogue.db,.db-wal, and.db-shm, and degrades quietly when/procentries vanish during iteration.Ref #1447.
Verification
pytest tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py -q→2 passed in 0.08spython -m mypy polylogue/storage/sqlite/wal_checkpoint.py polylogue/pipeline/services/ingest_batch/_core.py polylogue/daemon/cli.py tests/unit/pipeline/test_ingest_batch_wal_checkpoint.py→Success: no issues found in 4 source filesdevtools verify --quick→ exit 0, total38.78s