Repository navigation
Conversation
The v42 rebuild's serial engine pass (~10-17 min per 2000-raw page) had zero internal visibility -- the operator's 'why is this slow' question was unanswerable without invasive profiling (py-spy cannot read the nix interpreter). Thread the existing per-method stage_timings_s plumbing through backfill_historical_revision_evidence (census, spill loads, both replay apply paths) and log one aggregated INFO line per call, largest stage first. Zero behavior change; timings dict was already accepted by apply_raw_revision_replay / apply_raw_membership_classification.
📝 WalkthroughWalkthroughThe historical revision backfill now measures census and spill-loading durations, propagates timing data through byte and membership replay operations, and logs collected stage timings sorted by duration. ChangesBackfill timing instrumentation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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: a0db0d487d
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@polylogue/sources/revision_backfill.py`:
- Around line 750-754: Add the same spill_load timing wrapper to the earlier
spill.for_raw call inside the convertible_full_revision_raw_ids loop, recording
the elapsed time in stage_timings["spill_load"] while preserving the existing
sessions and _payload_bytes assignment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5d03aab9-d35a-496c-9d42-7289e6de80c7
📒 Files selected for processing (1)
polylogue/sources/revision_backfill.py
| spill_started = time.perf_counter() | ||
| sessions, payload_bytes = spill.for_raw(archive, raw_id) | ||
| stage_timings["spill_load"] = stage_timings.get("spill_load", 0.0) + ( | ||
| time.perf_counter() - spill_started | ||
| ) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Track spill_load timing for full-revision conversions.
The spill_load timing is accurately captured here and at line 813. However, an earlier load at line 733 (sessions, _payload_bytes = spill.for_raw(archive, raw_id)) was missed, which will cause the telemetry to under-report the total time spent loading from the spill cache during replay.
📈 Proposed fix to include the missed telemetry
Apply the same timing wrapper at line 733:
for raw_id in archive.convertible_full_revision_raw_ids(logical_key):
spill_started = time.perf_counter()
sessions, _payload_bytes = spill.for_raw(archive, raw_id)
stage_timings["spill_load"] = stage_timings.get("spill_load", 0.0) + (
time.perf_counter() - spill_started
)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@polylogue/sources/revision_backfill.py` around lines 750 - 754, Add the same
spill_load timing wrapper to the earlier spill.for_raw call inside the
convertible_full_revision_raw_ids loop, recording the elapsed time in
stage_timings["spill_load"] while preserving the existing sessions and
_payload_bytes assignment.
|
Live receipt from resume #14, first instrumented page (cursor 14000→16000): 'backfill stage timings: census=135.0s spill_load=105.2s membership_replay.index_parsed_write=50.8s membership_replay.index.full_replace=31.8s …'. Headline: ~55% of the serial engine pass is census + spill reload (two-phase overhead), not index writes — that's the optimization target the telemetry was built to find. |
…pt + total, missed spill wrap CodeRabbit on #3206: (1) raw stdlib logger is discarded under polylogue.logging's structlog config — route through polylogue.logging.get_logger so the line emits in real daemon/CLI runs, not only under the driver's basicConfig; (2) census timer stopped before archive.commit() + _record_raw_authority_parser_census — now timed as census_receipt, and a total= figure makes unaccounted time visible; (3) the convertible-full spill load was missing its spill_load wrap.
|
Superseded by #3208, which carries this commit plus fixes for all three review findings (polylogue logger routing, census_receipt + total timing, missed spill wrap). |
…it batching (#3208) ## Summary One coherent perf phase for the full-archive rebuild (operator mandate: 100K-raw import must be dramatically faster). Three commits: (1) per-page stage-timing telemetry (supersedes #3206, includes all three CodeRabbit fixes from its review); (2) census-spill fast path — no-fsync pragmas for the disposable cache, spill placed beside the resolved index tier (NVMe, not the wear-limited root SSD), 256MiB decoded-session RAM layer (supersedes #3207); (3) rebuild path opts into the existing amg1/oikv commit batching (`commit_batch_size=200`) instead of one fsync'd commit per censused raw / replayed cohort. ## Problem Live v42 telemetry measured `census=135s spill_load=105s` vs ~50-100s of index writes per 2,000-raw page — over half the serial engine pass was cache overhead and per-unit commit cycles. ## Solution `polylogue/sources/revision_backfill.py` (telemetry + spill) and `polylogue/maintenance/replay.py` (batching constant + call-site). Crash behavior for batching is the already-pinned batch-discard/resume contract. Telemetry routes through `polylogue.logging.get_logger`; census receipt work and a `total=` figure are included per review. ## Verification `devtools test tests/unit/sources/test_revision_backfill.py` → 39 passed; batching/resume subset 8 passed; maintenance suite 194 passed; mypy/ruff clean. Live before/after page timings from the resumed v42 walk will be posted here.
|
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. |
|
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
One aggregated stage-timing INFO line per
backfill_historical_revision_evidencecall (census / spill_load / index_parsed_write / …, largest first), using the per-methodstage_timings_splumbing that already existed but was never threaded from this caller.Problem
The live v42 rebuild's engine pass runs 10-17 min per 2,000-raw page with no internal attribution; py-spy cannot read the nix-built interpreter, so the serial-writer cost question ("where do 0.3s/raw go?") was unanswerable.
Solution
polylogue/sources/revision_backfill.pyonly: timing dict + census/spill wraps +stage_timings_s=threading into both apply paths + one INFO log before return. No behavior change.Verification
devtools test tests/unit/sources/test_revision_backfill.py→ 39 passed; mypy/ruff clean. Live receipt: the resumed v42 walk logs the line each page — will be quoted on this PR.Summary by CodeRabbit