From 384ea046b331e42255d0c21fe77aa410307469f9 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 21 May 2025 14:41:07 -0700 Subject: [PATCH] SQLite: Fix logging/error messages around executing pragmas --- src/storage/backend/sqlite/SQLite.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/storage/backend/sqlite/SQLite.cc b/src/storage/backend/sqlite/SQLite.cc index d0773530ef..c421a532ce 100644 --- a/src/storage/backend/sqlite/SQLite.cc +++ b/src/storage/backend/sqlite/SQLite.cc @@ -22,7 +22,7 @@ OperationResult SQLite::RunPragma(std::string_view name, std::optionalempty() ) cmd += util::fmt(" = %.*s", static_cast(value->size()), value->data()); - DBG_LOG(DBG_STORAGE, "Executing pragma %s on %s", cmd.c_str(), full_path.c_str()); + DBG_LOG(DBG_STORAGE, "Executing '%s' on %s", cmd.c_str(), full_path.c_str()); while ( pragma_timeout == 0ms || time_spent < pragma_timeout ) { int res = sqlite3_exec(db, cmd.c_str(), NULL, NULL, &errorMsg); @@ -37,18 +37,21 @@ OperationResult SQLite::RunPragma(std::string_view name, std::optional= pragma_timeout ) { - std::string err = - util::fmt("Database was busy while executing %.*s pragma", static_cast(name.size()), name.data()); + std::string err = util::fmt("Database was busy while executing '%s'", cmd.c_str()); + DBG_LOG(DBG_STORAGE, "%s", err.c_str()); return {ReturnCode::INITIALIZATION_FAILED, std::move(err)}; } + DBG_LOG(DBG_STORAGE, "'%s' successful", cmd.c_str()); + return {ReturnCode::SUCCESS}; }