Add replicate flags to pump Litestream manually #488
+105
−14
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.
For some special setups it is sometimes useful to run Litestream manually instead of letting it replicate in the background.
This commit implements the following flags for replicate:
Because running once does not respect the snapshot interval the caller is expected to use -force-snapshot and -enforce-retention regularly to ensure the replication targets stay clean.
For this to work correctly with a live database it needs to be opened with auto checkpointing disabled and SQLITE_FCNTL_PERSIST_WAL.
Other uses include only using -force-snapshot to create regular backups of the database instead of live replication.
Fixes #486
This PR is still WIP but it'd be nice to hear suggestions around the implementation and leveraging the exec stuff. Screwing around checkpointing by changing the values feels quite dirty.
MinCheckpointPageN
is checked onOpen()
so in most normal runs the added check for it to be non-zero doesn't make a difference.