From d04ddea45c0e96e8352c4229e5ea98a8ee24a995 Mon Sep 17 00:00:00 2001 From: marta-lokhova Date: Mon, 4 Nov 2024 12:01:09 -0800 Subject: [PATCH] Enable background overlay by default, drop 'experimental' prefix --- src/herder/test/HerderTests.cpp | 2 +- src/main/ApplicationImpl.cpp | 4 ++-- src/main/Config.cpp | 15 ++++++++++----- src/main/Config.h | 2 +- src/overlay/Peer.h | 3 +-- src/overlay/PeerDoor.cpp | 7 +++---- src/overlay/TCPPeer.cpp | 2 +- src/overlay/test/TCPPeerTests.cpp | 8 ++++---- src/simulation/Simulation.cpp | 4 ++-- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/herder/test/HerderTests.cpp b/src/herder/test/HerderTests.cpp index acdf87a2a7..fcc07519f4 100644 --- a/src/herder/test/HerderTests.cpp +++ b/src/herder/test/HerderTests.cpp @@ -3361,7 +3361,7 @@ TEST_CASE("overlay parallel processing") Topologies::core(4, 1, Simulation::OVER_TCP, networkID, [](int i) { auto cfg = getTestConfig(i); cfg.TESTING_UPGRADE_MAX_TX_SET_SIZE = 100; - cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = true; + cfg.BACKGROUND_OVERLAY_PROCESSING = true; return cfg; }); simulation->startAllNodes(); diff --git a/src/main/ApplicationImpl.cpp b/src/main/ApplicationImpl.cpp index 4deada6568..67f7f5dfd4 100644 --- a/src/main/ApplicationImpl.cpp +++ b/src/main/ApplicationImpl.cpp @@ -96,7 +96,7 @@ ApplicationImpl::ApplicationImpl(VirtualClock& clock, Config const& cfg) mEvictionIOContext ? std::make_unique(*mEvictionIOContext) : nullptr) - , mOverlayIOContext(mConfig.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING + , mOverlayIOContext(mConfig.BACKGROUND_OVERLAY_PROCESSING ? std::make_unique(1) : nullptr) , mOverlayWork(mOverlayIOContext ? std::make_unique( @@ -181,7 +181,7 @@ ApplicationImpl::ApplicationImpl(VirtualClock& clock, Config const& cfg) mWorkerThreads.emplace_back(std::move(thread)); } - if (mConfig.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING) + if (mConfig.BACKGROUND_OVERLAY_PROCESSING) { // Keep priority unchanged as overlay processes time-sensitive tasks mOverlayThread = std::thread{[this]() { mOverlayIOContext->run(); }}; diff --git a/src/main/Config.cpp b/src/main/Config.cpp index 927883ee8d..2208e68949 100644 --- a/src/main/Config.cpp +++ b/src/main/Config.cpp @@ -162,7 +162,7 @@ Config::Config() : NODE_SEED(SecretKey::random()) CATCHUP_COMPLETE = false; CATCHUP_RECENT = 0; EXPERIMENTAL_PRECAUTION_DELAY_META = false; - EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = false; + BACKGROUND_OVERLAY_PROCESSING = true; DEPRECATED_SQL_LEDGER_STATE = false; BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 14; // 2^14 == 16 kb BUCKETLIST_DB_INDEX_CUTOFF = 20; // 20 mb @@ -1066,9 +1066,14 @@ Config::processConfig(std::shared_ptr t) }}, {"EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING", [&]() { - EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = - readBool(item); + CLOG_WARNING(Overlay, + "EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING " + "is deprecated. Use " + "BACKGROUND_OVERLAY_PROCESSING instead"); + BACKGROUND_OVERLAY_PROCESSING = readBool(item); }}, + {"BACKGROUND_OVERLAY_PROCESSING", + [&]() { BACKGROUND_OVERLAY_PROCESSING = readBool(item); }}, {"BACKGROUND_EVICTION_SCAN", [&]() { BACKGROUND_EVICTION_SCAN = readBool(item); }}, // TODO: Flag is no longer supported, remove in next release. @@ -1984,9 +1989,9 @@ Config::logBasicInfo() LOG_INFO(DEFAULT_LOG, "MAX_INBOUND_PENDING_CONNECTIONS: {}", MAX_INBOUND_PENDING_CONNECTIONS); LOG_INFO(DEFAULT_LOG, - "EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING=" + "BACKGROUND_OVERLAY_PROCESSING=" "{}", - EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING ? "true" : "false"); + BACKGROUND_OVERLAY_PROCESSING ? "true" : "false"); } void diff --git a/src/main/Config.h b/src/main/Config.h index 600a349259..ef52aaddcb 100644 --- a/src/main/Config.h +++ b/src/main/Config.h @@ -405,7 +405,7 @@ class Config : public std::enable_shared_from_this size_t BUCKETLIST_DB_INDEX_CUTOFF; // Enable parallel processing of overlay operations (experimental) - bool EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING; + bool BACKGROUND_OVERLAY_PROCESSING; // When set to true, BucketListDB indexes are persisted on-disk so that the // BucketList does not need to be reindexed on startup. Defaults to true. diff --git a/src/overlay/Peer.h b/src/overlay/Peer.h index a59cdbb72b..0f0ee1c33c 100644 --- a/src/overlay/Peer.h +++ b/src/overlay/Peer.h @@ -207,8 +207,7 @@ class Peer : public std::enable_shared_from_this, virtual bool useBackgroundThread() const { - return mAppConnector.getConfig() - .EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING; + return mAppConnector.getConfig().BACKGROUND_OVERLAY_PROCESSING; } void initialize(PeerBareAddress const& address); diff --git a/src/overlay/PeerDoor.cpp b/src/overlay/PeerDoor.cpp index 23a9ead14d..a930446fd7 100644 --- a/src/overlay/PeerDoor.cpp +++ b/src/overlay/PeerDoor.cpp @@ -65,10 +65,9 @@ PeerDoor::acceptNextPeer() // io_context on main (as long as the socket is not accessed by multiple // threads simultaneously, or the caller manually synchronizes access to the // socket). - auto& ioContext = - mApp.getConfig().EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING - ? mApp.getOverlayIOContext() - : mApp.getClock().getIOContext(); + auto& ioContext = mApp.getConfig().BACKGROUND_OVERLAY_PROCESSING + ? mApp.getOverlayIOContext() + : mApp.getClock().getIOContext(); auto sock = make_shared(ioContext, TCPPeer::BUFSZ); mAcceptor.async_accept(sock->next_layer(), [this, sock](asio::error_code const& ec) { diff --git a/src/overlay/TCPPeer.cpp b/src/overlay/TCPPeer.cpp index bd8d2885ca..f3129f94ab 100644 --- a/src/overlay/TCPPeer.cpp +++ b/src/overlay/TCPPeer.cpp @@ -54,7 +54,7 @@ TCPPeer::initiate(Application& app, PeerBareAddress const& address) releaseAssert(address.getType() == PeerBareAddress::Type::IPv4); CLOG_DEBUG(Overlay, "TCPPeer:initiate to {}", address.toString()); - auto& ioContext = app.getConfig().EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING + auto& ioContext = app.getConfig().BACKGROUND_OVERLAY_PROCESSING ? app.getOverlayIOContext() : app.getClock().getIOContext(); auto socket = make_shared(ioContext, BUFSZ); diff --git a/src/overlay/test/TCPPeerTests.cpp b/src/overlay/test/TCPPeerTests.cpp index f43613f8a3..c8b35c62d7 100644 --- a/src/overlay/test/TCPPeerTests.cpp +++ b/src/overlay/test/TCPPeerTests.cpp @@ -26,7 +26,7 @@ TEST_CASE("TCPPeer lifetime", "[overlay]") cfg.MAX_OUTBOUND_PENDING_CONNECTIONS = i % 2; cfg.TARGET_PEER_CONNECTIONS = i % 2; cfg.MAX_ADDITIONAL_PEER_CONNECTIONS = i % 2; - cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = true; + cfg.BACKGROUND_OVERLAY_PROCESSING = true; return cfg; }); @@ -92,7 +92,7 @@ TEST_CASE("TCPPeer can communicate", "[overlay]") { cfgGen = [](int i) { Config cfg = getTestConfig(i); - cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = true; + cfg.BACKGROUND_OVERLAY_PROCESSING = true; return cfg; }; } @@ -100,7 +100,7 @@ TEST_CASE("TCPPeer can communicate", "[overlay]") { cfgGen = [](int i) { Config cfg = getTestConfig(i); - cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = false; + cfg.BACKGROUND_OVERLAY_PROCESSING = false; return cfg; }; } @@ -183,7 +183,7 @@ TEST_CASE("TCPPeer read malformed messages", "[overlay]") Simulation::pointer s = std::make_shared( Simulation::OVER_TCP, networkID, [](int i) { Config cfg = getTestConfig(i); - cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = true; + cfg.BACKGROUND_OVERLAY_PROCESSING = true; // Slow down the main thread to delay drops cfg.ARTIFICIALLY_SLEEP_MAIN_THREAD_FOR_TESTING = std::chrono::milliseconds(300); diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 0818922f6a..f6b91cbf2e 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -41,7 +41,7 @@ Simulation::Simulation(Mode mode, Hash const& networkID, ConfigGen confGen, , mQuorumSetAdjuster(qSetAdjust) { auto cfg = newConfig(); - auto& parallel = cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING; + auto& parallel = cfg.BACKGROUND_OVERLAY_PROCESSING; parallel = parallel && mVirtualClockMode == VirtualClock::REAL_TIME; mIdleApp = Application::create(mClock, cfg); mPeerMap.emplace(mIdleApp->getConfig().PEER_PORT, mIdleApp); @@ -99,7 +99,7 @@ Simulation::addNode(SecretKey nodeKey, SCPQuorumSet qSet, Config const* cfg2, cfg->adjust(); cfg->NODE_SEED = nodeKey; cfg->MANUAL_CLOSE = false; - auto& parallel = cfg->EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING; + auto& parallel = cfg->BACKGROUND_OVERLAY_PROCESSING; parallel = parallel && mVirtualClockMode == VirtualClock::REAL_TIME; if (mQuorumSetAdjuster)