Skip to content

Add [db] synchronous to choose how write connections sync the WAL - #1

Merged
nick-potts merged 2 commits into
ployzfrom
sync-full
Oct 31, 2026
Merged

nick-potts merged 2 commits into
ployzfrom
sync-full

Conversation

@nick-potts

Copy link
Copy Markdown

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 use PRAGMA 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 = FULL gives 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:

Disk +S, NORMAL FULL, no +S
slow (47 ms per sync write) 209.8 s, worst commit 24.2 s 23.6 s, worst 1.77 s
normal (0.4 ms) 17.0 s, worst 0.99 s 0.54 s, worst 0.034 s

Change

[db]
synchronous = "full"   # or "normal", the default
  • DbConfig.synchronous, a Synchronous enum, defaults to Normal, so a config without it behaves as before.
  • rusqlite_to_crsqlite_write sets it beside cache_size. That covers the write pool and client_dedicated. Read connections and subscription databases keep NORMAL.
  • SplitPool::create takes it. Test and reaper callers pass the default.
  • Documented in 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_synchronous reads PRAGMA synchronous back for each mode (1, 2).
  • config::db_config_tests::synchronous_defaults_to_normal_and_reads_full covers the default and "full" parsing.
  • cargo clippy --all-targets -- -D warnings and cargo fmt -- --check pass locally.

Codex added 2 commits October 31, 2026 00:10
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".
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfbea1c5-656b-4557-a137-9a8994ed8449

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T00:12:02.426521Z b4e0768 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nick-potts
nick-potts merged commit 28f00b4 into ployz Oct 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant