Tune client bootstrap sqlite cache size#2790
Conversation
How to use the Graphite Merge QueueAdd the label Raindex-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughBootstrap now runs a SQLite cache-size pragma before applying dump SQL during startup, and the affected tests were updated to match the new call order. ChangesBootstrap dump flow
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
Merge activity
|
## Motivation Browser local DB bootstrap spends most of its time applying the downloaded SQL dump through sqlite-web. Benchmarks with the real schema and 186,170-statement dump showed that increasing SQLite's connection-local page cache before dump execution significantly improves bootstrap time. ## What changed - Added a client bootstrap helper that runs `PRAGMA cache_size = -25000` through the existing local DB query path immediately before applying a dump. - Reused that helper for both dump application paths in `ClientBootstrapAdapter::engine_run`: fresh DB bootstrap and threshold-triggered rebootstrap. - Updated unit tests to assert the pragma runs before the dump SQL. ## What intentionally did not change - Did not use sqlite-web `transaction()`; this continues to rely only on the existing `query()` callback path. - Did not add unsafe pragmas such as `journal_mode = OFF` or `synchronous = OFF`. - Did not change the CLI/producer bootstrap path. - Did not restore `cache_size` after bootstrap; this setting is intentionally left connection-local for the app session. ## Verification - `cargo test -p raindex_common raindex_client::local_db::pipeline::bootstrap` - `cargo test -p raindex_common` - `cargo check --target wasm32-unknown-unknown -p raindex_common` - `nix develop -c rainix-rs-static` - Staged local review round with 2 read-only reviewers; both reported no actionable findings. ## Reviewer notes The key behavior to check is ordering: `PRAGMA cache_size = -25000` should execute only when a bootstrap dump is about to be applied, and immediately before `execute_batch(dump_stmt)`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved database bootstrap behavior by applying a cache-related setting before loading imported data. * Made initialization more reliable when setting up a fresh database or rebuilding after size limits are exceeded. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
399c7ae to
8fed043
Compare
## Motivation Browser local DB bootstrap spends most of its time applying the downloaded SQL dump through sqlite-web. Benchmarks with the real schema and 186,170-statement dump showed that increasing SQLite's connection-local page cache before dump execution significantly improves bootstrap time. ## What changed - Added a client bootstrap helper that runs `PRAGMA cache_size = -25000` through the existing local DB query path immediately before applying a dump. - Reused that helper for both dump application paths in `ClientBootstrapAdapter::engine_run`: fresh DB bootstrap and threshold-triggered rebootstrap. - Updated unit tests to assert the pragma runs before the dump SQL. ## What intentionally did not change - Did not use sqlite-web `transaction()`; this continues to rely only on the existing `query()` callback path. - Did not add unsafe pragmas such as `journal_mode = OFF` or `synchronous = OFF`. - Did not change the CLI/producer bootstrap path. - Did not restore `cache_size` after bootstrap; this setting is intentionally left connection-local for the app session. ## Verification - `cargo test -p raindex_common raindex_client::local_db::pipeline::bootstrap` - `cargo test -p raindex_common` - `cargo check --target wasm32-unknown-unknown -p raindex_common` - `nix develop -c rainix-rs-static` - Staged local review round with 2 read-only reviewers; both reported no actionable findings. ## Reviewer notes The key behavior to check is ordering: `PRAGMA cache_size = -25000` should execute only when a bootstrap dump is about to be applied, and immediately before `execute_batch(dump_stmt)`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved database bootstrap behavior by applying a cache-related setting before loading imported data. * Made initialization more reliable when setting up a fresh database or rebuilding after size limits are exceeded. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
8fed043 to
5670a84
Compare
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
|
Tip For best results, initiate chat on the files or code changes. SIZE=M |

Motivation
Browser local DB bootstrap spends most of its time applying the downloaded SQL dump through sqlite-web. Benchmarks with the real schema and 186,170-statement dump showed that increasing SQLite's connection-local page cache before dump execution significantly improves bootstrap time.
What changed
PRAGMA cache_size = -25000through the existing local DB query path immediately before applying a dump.ClientBootstrapAdapter::engine_run: fresh DB bootstrap and threshold-triggered rebootstrap.What intentionally did not change
transaction(); this continues to rely only on the existingquery()callback path.journal_mode = OFForsynchronous = OFF.cache_sizeafter bootstrap; this setting is intentionally left connection-local for the app session.Verification
cargo test -p raindex_common raindex_client::local_db::pipeline::bootstrapcargo test -p raindex_commoncargo check --target wasm32-unknown-unknown -p raindex_commonnix develop -c rainix-rs-staticReviewer notes
The key behavior to check is ordering:
PRAGMA cache_size = -25000should execute only when a bootstrap dump is about to be applied, and immediately beforeexecute_batch(dump_stmt).Summary by CodeRabbit