feat(litestream): add configurable busy timeout #5301
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.
Summary
Adds
--litestream-busy-timeoutoption to configure SQLite'sbusy_timeoutfor litestream's database connection. Value is a duration string (e.g."5s","30s","1m").Default is
"1s", which we believe is litestream's internal default (see litestream db.go NewDB -BusyTimeout: 1 * time.Second).Motivation
We've been experiencing "database is locked" errors during heavy write operations. There's a comment in Zero's codebase that suggests this could cause deadlocks:
However, we found that litestream's source code shows a default
BusyTimeoutof 1 second. We'd appreciate clarification from the Zero team on whether this comment is still accurate or if something else is happening.Change
busyTimeoutconfig option (default"1s")ZERO_LITESTREAM_BUSY_TIMEOUTenv var to litestreambusy-timeoutline to config.ymlSince we're setting the default to what we believe is litestream's internal default (
1s), this should preserve existing behavior while allowing operators to tune it higher if needed.Usage
# Increase busy timeout to 30 seconds zero-cache --litestream-busy-timeout=30sQuestions for Zero Team
wal-checkpoint.test.tsstill accurate? Does litestream actually not set a busy_timeout in Zero's setup?