laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/28130 )

Change subject: db: Switch from 'synchronous = FULL' to 'synchronous = NORMAL'
......................................................................

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
---
M src/libmsc/db.c
1 file changed, 1 insertion(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index 000002a..07081d5 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -562,7 +562,7 @@
        }

        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 @@
        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 @@
                 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,

--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28130
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ie782f0fe90e7204c4d55cdb3948b728c348367d1
Gerrit-Change-Number: 28130
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to