summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2022-05-23 10:42:13 +0300
committerMichal Domonkos <mdomonko@redhat.com>2022-07-01 10:52:14 +0200
commit2f83c32a086e4a9ab8575c79010d4024d73b03cf (patch)
tree6e7a511b8f98efda053fc2ca6536be6afc852a45
parentc484a11cba429bc04c3b8ca4618c6229d75799c3 (diff)
downloadrpm-2f83c32a086e4a9ab8575c79010d4024d73b03cf.tar.gz
Prevent uncontrolled sqlite WAL growth during large transactions
Sqlite WAL threshold of 1000 pages is way too low for rpmdb as a single header often exceeds that, but disabling the checkpointing entirely can cause the WAL to grow to multiple gigabytes during large distro update transactions, which isn't healty either. Bump the threshold to 10000 pages which caps the WAL size to tens of megabytes, which hopefully is a reasonable balance between performance on rotational disks (anybody remember those?) and diskpace consumption. Also drop no longer meaningful link to %_flush_io configuration. (cherry picked from commit cbfba05d7f0d01e91570e450a549a3e9644f49ed)
-rw-r--r--lib/backend/sqlite.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
index c22a27019..322191f39 100644
--- a/lib/backend/sqlite.c
+++ b/lib/backend/sqlite.c
@@ -179,9 +179,8 @@ static int sqlite_init(rpmdb rdb, const char * dbhome)
int one = 1;
/* Annoying but necessary to support non-privileged readers */
sqlite3_file_control(sdb, NULL, SQLITE_FCNTL_PERSIST_WAL, &one);
-
- if (!rpmExpandNumeric("%{?_flush_io}"))
- sqlexec(sdb, "PRAGMA wal_autocheckpoint = 0");
+ /* Sqlite default threshold is way too low for rpmdb */
+ sqlexec(sdb, "PRAGMA wal_autocheckpoint = 10000");
}
}