From c97c440b3f3eb80e540e2e509c27ddedabd99f86 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 17 Sep 2024 23:40:16 +1000 Subject: [PATCH] openAndSetUpSQLCipher: Enable checkpoint_fullfsync pragma --- ts/sql/Server.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index 0bedf3122..09688f111 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -700,6 +700,19 @@ function openAndSetUpSQLCipher( throw error; } + try { + // fullfsync is only supported on macOS + db.pragma('fullfsync = false'); + + // a lower-impact approach, if fullfsync is too impactful + db.pragma('checkpoint_fullfsync = true'); + } catch (error) { + logger.warn( + 'openAndSetUpSQLCipher: Unable to set fullfsync', + Errors.toLogFormat(error) + ); + } + return db; }