From 1c7e1f549807f869d96aa4b7e5ce573aeddaab7d Mon Sep 17 00:00:00 2001 From: Pawel Lampe Date: Fri, 26 Jan 2024 11:16:29 +0100 Subject: [PATCH] Prevent journal files from wasting disk space --- Source/WebCore/platform/sql/SQLiteDatabase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.cpp b/Source/WebCore/platform/sql/SQLiteDatabase.cpp index fe1d96cb0afd9..e254bff2f32d9 100644 --- a/Source/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/Source/WebCore/platform/sql/SQLiteDatabase.cpp @@ -152,6 +152,12 @@ bool SQLiteDatabase::open(const String& filename, OpenMode openMode) LOG_ERROR("SQLite database could not set temp_store to memory"); } + { + SQLiteTransactionInProgressAutoCounter transactionCounter; + // prevent wasting disk space, see https://www.sqlite.org/pragma.html#pragma_journal_size_limit + executeCommand("PRAGMA journal_size_limit = 0;"_s); + } + if (filename != inMemoryPath()) { if (openMode != OpenMode::ReadOnly && !useWALJournalMode()) return false;