From cf9e098967dd99bb81322ae462567de1ec34db70 Mon Sep 17 00:00:00 2001 From: Tyler Karaszewski Date: Thu, 5 Oct 2023 10:41:10 -0700 Subject: [PATCH 1/2] Throw in a way that will get handled and retried --- sqlitecluster/SQLiteNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlitecluster/SQLiteNode.cpp b/sqlitecluster/SQLiteNode.cpp index 85bac7b23..a2d1f783a 100644 --- a/sqlitecluster/SQLiteNode.cpp +++ b/sqlitecluster/SQLiteNode.cpp @@ -1657,7 +1657,7 @@ void SQLiteNode::_onMESSAGE(SQLitePeer* peer, const SData& message) { thread(&SQLiteNode::_replicate, this, peer, message, _dbPool->getIndex(false), threadAttemptStartTimestamp).detach(); } catch (const system_error& e) { SWARN("Caught system_error starting _replicate thread with " << _replicationThreadCount.load() << " threads. e.what()=" << e.what()); - throw; + STHROW("Error starting replicate thread so giving up and reconnecting."); } SDEBUG("Done spawning concurrent replicate thread: " << threadID); } From 6a30cf392de7e4bafd2e7d3ed183d1f673c837c3 Mon Sep 17 00:00:00 2001 From: Tyler Karaszewski Date: Thu, 5 Oct 2023 10:59:03 -0700 Subject: [PATCH 2/2] Remove obsolete API --- BedrockCommand.h | 4 ---- BedrockServer.cpp | 5 +---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/BedrockCommand.h b/BedrockCommand.h index d385de33d..1b551364f 100644 --- a/BedrockCommand.h +++ b/BedrockCommand.h @@ -140,10 +140,6 @@ class BedrockCommand : public SQLiteCommand { // A list of timing sets, with an info type, start, and end. list> timingInfo; - // This defaults to false, but a specific plugin can set it to 'true' to force this command to be passed - // to the sync thread for processing, thus guaranteeing that process() will not result in a conflict. - virtual bool onlyProcessOnSyncThread() { return false; } - // Add any sockets that this command has opened (not the socket the client sent it on, but any outgoing sockets // it's opened itself) to a fd_map so that they can be polled for activity. void prePoll(fd_map& fdm); diff --git a/BedrockServer.cpp b/BedrockServer.cpp index 8f721e7e5..b79297266 100644 --- a/BedrockServer.cpp +++ b/BedrockServer.cpp @@ -983,10 +983,7 @@ void BedrockServer::runCommand(unique_ptr&& _command, bool isBlo } // Peek wasn't enough to handle this command. See if we think it should be writable in parallel. - // We check `onlyProcessOnSyncThread` here, rather than before processing the command, because it's - // not set at creation time, it's set in `peek`, so we need to wait at least until after peek is - // called to check it. - if (command->onlyProcessOnSyncThread() || !canWriteParallel) { + if (!canWriteParallel) { // Roll back the transaction, it'll get re-run in the sync thread. core.rollback(); auto _clusterMessengerCopy = _clusterMessenger;