diff --git a/fdbclient/FailureMonitorClient.actor.cpp b/fdbclient/FailureMonitorClient.actor.cpp index cd51792fcb..86d6431248 100644 --- a/fdbclient/FailureMonitorClient.actor.cpp +++ b/fdbclient/FailureMonitorClient.actor.cpp @@ -169,6 +169,7 @@ ACTOR Future failureMonitorClientLoop( ACTOR Future failureMonitorClient( Reference>> ci, bool trackMyStatus ) { state SimpleFailureMonitor* monitor = static_cast( &IFailureMonitor::failureMonitor() ); state Reference fmState = Reference(new FailureMonitorClientState()); + TraceEvent("FailureMonitorStart").detail("IsClient", FlowTransport::transport().isClient()); auto localAddr = g_network->getLocalAddresses(); monitor->setStatus(localAddr.address, FailureStatus(false)); if(localAddr.secondaryAddress.present()) { diff --git a/fdbrpc/FlowTransport.actor.cpp b/fdbrpc/FlowTransport.actor.cpp index 52750230b2..4206af0399 100644 --- a/fdbrpc/FlowTransport.actor.cpp +++ b/fdbrpc/FlowTransport.actor.cpp @@ -1182,9 +1182,15 @@ bool FlowTransport::incompatibleOutgoingConnectionsPresent() { return self->numIncompatibleConnections > 0; } -void FlowTransport::createInstance( uint64_t transportId ) +void FlowTransport::createInstance( bool isClient, uint64_t transportId ) { - g_network->setGlobal(INetwork::enFailureMonitor, (flowGlobalType) new SimpleFailureMonitor()); + if (isClient) { + g_network->setGlobal(INetwork::enFailureMonitor, (flowGlobalType) new SimpleFailureMonitor()); + g_network->setGlobal(INetwork::enClientFailureMonitor, (flowGlobalType)1); + } else { + g_network->setGlobal(INetwork::enFailureMonitor, (flowGlobalType) new SimpleFailureMonitor()); + g_network->setGlobal(INetwork::enClientFailureMonitor, nullptr); + } g_network->setGlobal(INetwork::enFlowTransport, (flowGlobalType) new FlowTransport(transportId)); g_network->setGlobal(INetwork::enNetworkAddressFunc, (flowGlobalType) &FlowTransport::getGlobalLocalAddress); g_network->setGlobal(INetwork::enNetworkAddressesFunc, (flowGlobalType) &FlowTransport::getGlobalLocalAddresses); diff --git a/fdbrpc/FlowTransport.h b/fdbrpc/FlowTransport.h index 5ff872821e..e7a2302af2 100644 --- a/fdbrpc/FlowTransport.h +++ b/fdbrpc/FlowTransport.h @@ -109,10 +109,14 @@ public: FlowTransport(uint64_t transportId); ~FlowTransport(); - static void createInstance(uint64_t transportId = 0); + static void createInstance(bool isClient, uint64_t transportId = 0); // Creates a new FlowTransport and makes FlowTransport::transport() return it. This uses g_network->global() variables, // so it will be private to a simulation. + static bool isClient() { + return g_network->global(INetwork::enClientFailureMonitor) != nullptr; + } + void initMetrics(); // Metrics must be initialized after FlowTransport::createInstance has been called diff --git a/fdbserver/SimulatedCluster.actor.cpp b/fdbserver/SimulatedCluster.actor.cpp index 25650a8dc7..fdcdb5061d 100644 --- a/fdbserver/SimulatedCluster.actor.cpp +++ b/fdbserver/SimulatedCluster.actor.cpp @@ -240,7 +240,7 @@ ACTOR Future simulatedFDBDRebooter(Referenceregister_network(); @@ -1402,7 +1402,7 @@ ACTOR void setupAndRun(std::string dataFolder, const char *testFile, bool reboot ProcessClass(ProcessClass::TesterClass, ProcessClass::CommandLineSource), "", ""), TaskDefaultYield)); Sim2FileSystem::newFileSystem(); - FlowTransport::createInstance(1); + FlowTransport::createInstance(true, 1); if (tlsOptions->enabled()) { simInitTLS(tlsOptions); } diff --git a/fdbserver/fdbserver.actor.cpp b/fdbserver/fdbserver.actor.cpp index a13e2c815d..e0a35c7c7e 100644 --- a/fdbserver/fdbserver.actor.cpp +++ b/fdbserver/fdbserver.actor.cpp @@ -1523,7 +1523,7 @@ int main(int argc, char* argv[]) { openTraceFile(NetworkAddress(), rollsize, maxLogsSize, logFolder, "trace", logGroup); } else { g_network = newNet2(useThreadPool, true, useObjectSerializer); - FlowTransport::createInstance(1); + FlowTransport::createInstance(false, 1); const bool expectsPublicAddress = (role == FDBD || role == NetworkTestServer || role == Restore); if (publicAddressStrs.empty()) { diff --git a/flow/network.h b/flow/network.h index 4b33c9c8c9..536e2f9ca2 100644 --- a/flow/network.h +++ b/flow/network.h @@ -353,7 +353,7 @@ public: enum enumGlobal { enFailureMonitor = 0, enFlowTransport = 1, enTDMetrics = 2, enNetworkConnections = 3, enNetworkAddressFunc = 4, enFileSystem = 5, enASIOService = 6, enEventFD = 7, enRunCycleFunc = 8, enASIOTimedOut = 9, enBlobCredentialFiles = 10, - enNetworkAddressesFunc = 11 + enNetworkAddressesFunc = 11, enClientFailureMonitor = 12 }; virtual void longTaskCheck( const char* name ) {}