From 9da6394f2fce5d87ff7883030e69846a0c2d0da3 Mon Sep 17 00:00:00 2001 From: Tyler Karaszewski Date: Tue, 17 Dec 2024 12:38:55 -0800 Subject: [PATCH] Add log lines --- BedrockServer.cpp | 7 +++++++ sqlitecluster/SQLite.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/BedrockServer.cpp b/BedrockServer.cpp index 98e59414f..a31c7f40e 100644 --- a/BedrockServer.cpp +++ b/BedrockServer.cpp @@ -1823,6 +1823,7 @@ atomic __quiesceShouldUnlock(false); thread* __quiesceThread = nullptr; void BedrockServer::_control(unique_ptr& command) { + SINFO("Received control command: " << command->request.methodLine); SData& response = command->response; string reason = "MANUAL"; response.methodLine = "200 OK"; @@ -1913,7 +1914,9 @@ void BedrockServer::_control(unique_ptr& command) { if (dbPoolCopy) { SQLiteScopedHandle dbScope(*_dbPool, _dbPool->getIndex()); SQLite& db = dbScope.db(); + SINFO("[quiesce] Exclusive locking DB"); db.exclusiveLockDB(); + SINFO("[quiesce] Exclusive locked DB"); locked = true; while (true) { if (__quiesceShouldUnlock) { @@ -1936,12 +1939,16 @@ void BedrockServer::_control(unique_ptr& command) { response.methodLine = "200 Blocked"; } } else if (SIEquals(command->request.methodLine, "UnblockWrites")) { + SINFO("[quiesce] Locking __quiesceLock"); lock_guard lock(__quiesceLock); + SINFO("[quiesce] __quiesceLock locked"); if (!__quiesceThread) { response.methodLine = "200 Not Blocked"; } else { __quiesceShouldUnlock = true; + SINFO("[quiesce] Joining __quiesceThread"); __quiesceThread->join(); + SINFO("[quiesce] __quiesceThread joined"); delete __quiesceThread; __quiesceThread = nullptr; response.methodLine = "200 Unblocked"; diff --git a/sqlitecluster/SQLite.cpp b/sqlitecluster/SQLite.cpp index f31888cd6..26d3b9a18 100644 --- a/sqlitecluster/SQLite.cpp +++ b/sqlitecluster/SQLite.cpp @@ -323,13 +323,17 @@ void SQLite::exclusiveLockDB() { // writes in this case. // So when these are both locked by the same thread at the same time, `commitLock` is always locked first, and we do it the same way here to avoid deadlocks. try { + SINFO("Locking commitLock"); _sharedData.commitLock.lock(); + SINFO("commitLock Locked"); } catch (const system_error& e) { SWARN("Caught system_error calling _sharedData.commitLock, code: " << e.code() << ", message: " << e.what()); throw; } try { + SINFO("Locking writeLock"); _sharedData.writeLock.lock(); + SINFO("writeLock Locked"); } catch(const system_error& e) { SWARN("Caught system_error calling _sharedData.writeLock, code: " << e.code() << ", message: " << e.what()); throw;