Repository navigation
Add [db] synchronous to choose how write connections sync the WAL - #1
Conversation
Write connections always ran PRAGMA synchronous = NORMAL, so a power loss could drop the last commits after they were broadcast. `synchronous = "full"` syncs the WAL at every commit, before the commit is broadcast. The default stays "normal".
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Why
Ployz deploys stall for minutes after a partition heals (getployz/ployz#2925). Ployz made Corrosion's commits survive power loss by setting the inode sync flag (
chattr +S) on the store, because write connections always usePRAGMA synchronous = NORMAL. That flag syncs every page write. While a healing node ingests changes, its one write connection then holds a single commit for 45 to 51 s on a slow disk. Every API write waits behind it.synchronous = FULLgives the same guarantee, a commit durable before Corrosion broadcasts it, with one sync per commit. Measured on the same Boat sandboxes with plain SQLite WAL, 50 transactions of 200 rows:+S, NORMAL+SChange
DbConfig.synchronous, aSynchronousenum, defaults toNormal, so a config without it behaves as before.rusqlite_to_crsqlite_writesets it besidecache_size. That covers the write pool andclient_dedicated. Read connections and subscription databases keep NORMAL.SplitPool::createtakes it. Test and reaper callers pass the default.doc/config/db.md, and listed in the README's patch table as "not offered yet". Any upstream offer goes through Nick first.Tests
sqlite::tests::write_connections_use_the_configured_synchronousreadsPRAGMA synchronousback for each mode (1, 2).config::db_config_tests::synchronous_defaults_to_normal_and_reads_fullcovers the default and"full"parsing.cargo clippy --all-targets -- -D warningsandcargo fmt -- --checkpass locally.