From 26cc6d4e7b707ee1eace9599df78300c25ae9499 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 13 May 2025 10:37:04 -0700 Subject: [PATCH] SQLite: Add busy_timeout pragma to default options --- scripts/policy/frameworks/storage/backend/sqlite/main.zeek | 1 + src/storage/backend/sqlite/SQLite.cc | 2 -- .../Baseline/scripts.base.frameworks.storage.sqlite-basic/out | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/policy/frameworks/storage/backend/sqlite/main.zeek b/scripts/policy/frameworks/storage/backend/sqlite/main.zeek index 81de566a8e..7557d73121 100644 --- a/scripts/policy/frameworks/storage/backend/sqlite/main.zeek +++ b/scripts/policy/frameworks/storage/backend/sqlite/main.zeek @@ -24,6 +24,7 @@ export { ## database. These must be pairs that can be passed to the ``pragma`` ## command in sqlite. tuning_params: table[string] of string &default=table( + ["busy_timeout"] = "5000", ["journal_mode"] = "WAL", ["synchronous"] = "normal", ["temp_store"] = "memory" diff --git a/src/storage/backend/sqlite/SQLite.cc b/src/storage/backend/sqlite/SQLite.cc index e5ddbd15b5..208b639169 100644 --- a/src/storage/backend/sqlite/SQLite.cc +++ b/src/storage/backend/sqlite/SQLite.cc @@ -107,8 +107,6 @@ OperationResult SQLite::DoOpen(OpenResultCallback* cb, RecordValPtr options) { erase_stmt = std::move(stmt_ptrs[3]); expire_stmt = std::move(stmt_ptrs[4]); - sqlite3_busy_timeout(db, 5000); - return {ReturnCode::SUCCESS}; } diff --git a/testing/btest/Baseline/scripts.base.frameworks.storage.sqlite-basic/out b/testing/btest/Baseline/scripts.base.frameworks.storage.sqlite-basic/out index 7121683d22..0c0634a0c0 100644 --- a/testing/btest/Baseline/scripts.base.frameworks.storage.sqlite-basic/out +++ b/testing/btest/Baseline/scripts.base.frameworks.storage.sqlite-basic/out @@ -1,8 +1,9 @@ ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. Storage::backend_opened, Storage::STORAGE_BACKEND_SQLITE, [serializer=Storage::STORAGE_SERIALIZER_JSON, sqlite=[database_path=test.sqlite, table_name=testing, tuning_params={ [synchronous] = normal, +[journal_mode] = WAL, [temp_store] = memory, -[journal_mode] = WAL +[busy_timeout] = 5000 }]] open result, [code=Storage::SUCCESS, error_str=, value=] put result, [code=Storage::SUCCESS, error_str=, value=]