aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-05-17 11:26:06 +0200
committerHarald Welte <laforge@osmocom.org>2022-05-17 14:04:44 +0200
commit1d72e301cbac3ff63a00b607d13e34ac993615b8 (patch)
treebf2a2dd78ec9a503e4b59d370b0d484c5133ffa3
parentd43c22ef65ae645a8babb2907fd8de2be42383a6 (diff)
db: Switch from 'synchronous = FULL' to 'synchronous = NORMAL'
As we're using WAL mode, it is not neccessary to use synchronous=FULL but rely on synchronous=NORMAL mode while still guaranteeing database consistency. To do this, we can fix the typo in one of our two PRAGMA statements, and remove the other. See https://www.sqlite.org/pragma.html#pragma_synchronous for the sqlite3 documentation on that topic. Change-Id: Ie782f0fe90e7204c4d55cdb3948b728c348367d1 Closes: OS#5566 RelateD: OS#5564, OS#5563
-rw-r--r--src/libmsc/db.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index 000002a3d..07081d54f 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -562,7 +562,7 @@ int db_init(void *ctx, const char *fname, bool enable_sqlite_logging)
}
char *err_msg;
- rc = sqlite3_exec(g_dbc->db, "PRAGMA journal_mode=WAL; PRAGMA synchonous = NORMAL;", 0, 0, &err_msg);
+ rc = sqlite3_exec(g_dbc->db, "PRAGMA journal_mode=WAL; PRAGMA synchronous = NORMAL;", 0, 0, &err_msg);
if (rc != SQLITE_OK) {
LOGP(DDB, LOGL_ERROR, "Unable to set Write-Ahead Logging: %s\n", err_msg);
sqlite3_free(err_msg);
@@ -617,13 +617,6 @@ static int db_run_statements(struct db_context *dbc, const char **statements, si
return 0;
}
-static int db_configure(struct db_context *dbc)
-{
- const char *sync_stmts[] = { "PRAGMA synchronous = FULL" };
-
- return db_run_statements(dbc, sync_stmts, ARRAY_SIZE(sync_stmts));
-}
-
int db_prepare(void)
{
unsigned int i;
@@ -642,8 +635,6 @@ int db_prepare(void)
return -1;
}
- db_configure(g_dbc);
-
/* prepare all SQL statements */
for (i = 0; i < ARRAY_SIZE(g_dbc->stmt); i++) {
rc = sqlite3_prepare_v2(g_dbc->db, stmt_sql[i], -1,