Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The local connection already wraps
libsql_wal_disable_checkpoint, and sync databases call it when they connect, but the method is private, so there's no way to reach it from alibsql::Connection.We need it because we read frames out of the WAL with
libsql_wal_get_frameand ship them to a second machine.PRAGMA wal_autocheckpoint = 0isn't enough for that. It stops the checkpoint after commits, but SQLite still checkpoints when the last connection closes, and any frames we haven't shipped yet end up in the database file.This exposes it the same way as
set_reserved_bytes: a default onConnthat returns a newError::WalDisableCheckpointNotSupported, and the local connection forwards to the existing method. Remote, replica and sync connections return the error.Erroris#[non_exhaustive], so the new variant shouldn't break anyone.Turso has the same function in its C bindings (it's in the "Turso-specific Extensions" table in
COMPAT.md), and its doc comment draws the same line between it andsqlite3_wal_autocheckpoint().The test closes a WAL database with checkpointing disabled, checks that the
-walfile is still there, and reads the row back. It fails if the method only sets the pragma.We've been running this as a patch on 0.9.30 since September.