Skip to content

Commit

Permalink
sqlite: disable WAL mode
Browse files Browse the repository at this point in the history
As shown in containers#17831, WAL mode plays a role in causing `database is locked`
errors.  Those are errors, in theory, should not happen as the DB should
busy wait.  mattn/go-sqlite3/issues/274 has some comments indicating
that the busy handler behaves differently in WAL mode which may be an
explanation to the error.

For now, let's disable WAL mode and only re-enable it when we have
clearer understanding of what's going on.  The upstream issue along with
the SQLite documentation do not give me the clear guidance that I would
need.

[NO NEW TESTS NEEDED] - flake is only reproducible in CI.

Fixes: containers#18356
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed May 9, 2023
1 parent edcb29b commit 1fb3cdf
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions libpod/sqlite_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ type SQLiteState struct {
const (
// Deal with timezone automatically.
sqliteOptionLocation = "_loc=auto"
// Set the journal mode (https://www.sqlite.org/pragma.html#pragma_journal_mode).
sqliteOptionJournal = "&_journal=WAL"
// Force WAL mode to fsync after each transaction (https://www.sqlite.org/pragma.html#pragma_synchronous).
// Force an fsync after each transaction (https://www.sqlite.org/pragma.html#pragma_synchronous).
sqliteOptionSynchronous = "&_sync=FULL"
// Allow foreign keys (https://www.sqlite.org/pragma.html#pragma_foreign_keys).
sqliteOptionForeignKeys = "&_foreign_keys=1"
Expand All @@ -44,7 +42,6 @@ const (
// Assembled sqlite options used when opening the database.
sqliteOptions = "db.sql?" +
sqliteOptionLocation +
sqliteOptionJournal +
sqliteOptionSynchronous +
sqliteOptionForeignKeys +
sqliteOptionTXLock
Expand Down

0 comments on commit 1fb3cdf

Please sign in to comment.