Skip to content

Commit

Permalink
Enable background overlay by default, drop 'experimental' prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
marta-lokhova committed Nov 16, 2024
1 parent 0579fd9 commit d04ddea
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/herder/test/HerderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/main/ApplicationImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ApplicationImpl::ApplicationImpl(VirtualClock& clock, Config const& cfg)
mEvictionIOContext
? std::make_unique<asio::io_context::work>(*mEvictionIOContext)
: nullptr)
, mOverlayIOContext(mConfig.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING
, mOverlayIOContext(mConfig.BACKGROUND_OVERLAY_PROCESSING
? std::make_unique<asio::io_context>(1)
: nullptr)
, mOverlayWork(mOverlayIOContext ? std::make_unique<asio::io_context::work>(
Expand Down Expand Up @@ -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(); }};
Expand Down
15 changes: 10 additions & 5 deletions src/main/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1066,9 +1066,14 @@ Config::processConfig(std::shared_ptr<cpptoml::table> 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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class Config : public std::enable_shared_from_this<Config>
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.
Expand Down
3 changes: 1 addition & 2 deletions src/overlay/Peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ class Peer : public std::enable_shared_from_this<Peer>,
virtual bool
useBackgroundThread() const
{
return mAppConnector.getConfig()
.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING;
return mAppConnector.getConfig().BACKGROUND_OVERLAY_PROCESSING;
}

void initialize(PeerBareAddress const& address);
Expand Down
7 changes: 3 additions & 4 deletions src/overlay/PeerDoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TCPPeer::SocketType>(ioContext, TCPPeer::BUFSZ);
mAcceptor.async_accept(sock->next_layer(),
[this, sock](asio::error_code const& ec) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlay/TCPPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SocketType>(ioContext, BUFSZ);
Expand Down
8 changes: 4 additions & 4 deletions src/overlay/test/TCPPeerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down Expand Up @@ -92,15 +92,15 @@ 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;
};
}
SECTION("main thread only")
{
cfgGen = [](int i) {
Config cfg = getTestConfig(i);
cfg.EXPERIMENTAL_BACKGROUND_OVERLAY_PROCESSING = false;
cfg.BACKGROUND_OVERLAY_PROCESSING = false;
return cfg;
};
}
Expand Down Expand Up @@ -183,7 +183,7 @@ TEST_CASE("TCPPeer read malformed messages", "[overlay]")
Simulation::pointer s = std::make_shared<Simulation>(
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);
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d04ddea

Please sign in to comment.