|
Panu Matilainen |
d4a60d |
From 33c8b214425c2860fdfe485d597e210b9723a792 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
d4a60d |
Message-Id: <33c8b214425c2860fdfe485d597e210b9723a792.1653292401.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
d4a60d |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
d4a60d |
Date: Mon, 23 May 2022 10:42:13 +0300
|
|
Panu Matilainen |
d4a60d |
Subject: [PATCH] Prevent uncontrolled sqlite WAL growth during large
|
|
Panu Matilainen |
d4a60d |
transactions
|
|
Panu Matilainen |
d4a60d |
|
|
Panu Matilainen |
d4a60d |
Sqlite WAL threshold of 1000 pages is way too low for rpmdb as a single
|
|
Panu Matilainen |
d4a60d |
header often exceeds that, but disabling the checkpointing entirely can
|
|
Panu Matilainen |
d4a60d |
cause the WAL to grow to multiple gigabytes during large distro update
|
|
Panu Matilainen |
d4a60d |
transactions, which isn't healty either. Bump the threshold to 10000
|
|
Panu Matilainen |
d4a60d |
pages which caps the WAL size to tens of megabytes, which hopefully
|
|
Panu Matilainen |
d4a60d |
is a reasonable balance between performance on rotational disks (anybody
|
|
Panu Matilainen |
d4a60d |
remember those?) and diskpace consumption.
|
|
Panu Matilainen |
d4a60d |
|
|
Panu Matilainen |
d4a60d |
Also drop no longer meaningful link to %_flush_io configuration.
|
|
Panu Matilainen |
d4a60d |
---
|
|
Panu Matilainen |
d4a60d |
lib/backend/sqlite.c | 5 ++---
|
|
Panu Matilainen |
d4a60d |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
Panu Matilainen |
d4a60d |
|
|
Panu Matilainen |
d4a60d |
diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
|
|
Panu Matilainen |
d4a60d |
index 31f77e845..d5389736b 100644
|
|
Panu Matilainen |
d4a60d |
--- a/lib/backend/sqlite.c
|
|
Panu Matilainen |
d4a60d |
+++ b/lib/backend/sqlite.c
|
|
Panu Matilainen |
d4a60d |
@@ -180,9 +180,8 @@ static int sqlite_init(rpmdb rdb, const char * dbhome)
|
|
Panu Matilainen |
d4a60d |
int one = 1;
|
|
Panu Matilainen |
d4a60d |
/* Annoying but necessary to support non-privileged readers */
|
|
Panu Matilainen |
d4a60d |
sqlite3_file_control(sdb, NULL, SQLITE_FCNTL_PERSIST_WAL, &one);
|
|
Panu Matilainen |
d4a60d |
-
|
|
Panu Matilainen |
d4a60d |
- if (!rpmExpandNumeric("%{?_flush_io}"))
|
|
Panu Matilainen |
d4a60d |
- sqlexec(sdb, "PRAGMA wal_autocheckpoint = 0");
|
|
Panu Matilainen |
d4a60d |
+ /* Sqlite default threshold is way too low for rpmdb */
|
|
Panu Matilainen |
d4a60d |
+ sqlexec(sdb, "PRAGMA wal_autocheckpoint = 10000");
|
|
Panu Matilainen |
d4a60d |
}
|
|
Panu Matilainen |
d4a60d |
}
|
|
Panu Matilainen |
d4a60d |
|
|
Panu Matilainen |
d4a60d |
--
|
|
Panu Matilainen |
d4a60d |
2.35.3
|
|
Panu Matilainen |
d4a60d |
|