failmon: Identify client vs server when starting failure monitoring client
This commit is contained in:
parent
5bdf5aaeb6
commit
6b4d30c3ae
|
@ -169,6 +169,7 @@ ACTOR Future<Void> failureMonitorClientLoop(
|
|||
ACTOR Future<Void> failureMonitorClient( Reference<AsyncVar<Optional<struct ClusterInterface>>> ci, bool trackMyStatus ) {
|
||||
state SimpleFailureMonitor* monitor = static_cast<SimpleFailureMonitor*>( &IFailureMonitor::failureMonitor() );
|
||||
state Reference<FailureMonitorClientState> fmState = Reference<FailureMonitorClientState>(new FailureMonitorClientState());
|
||||
TraceEvent("FailureMonitorStart").detail("IsClient", FlowTransport::transport().isClient());
|
||||
auto localAddr = g_network->getLocalAddresses();
|
||||
monitor->setStatus(localAddr.address, FailureStatus(false));
|
||||
if(localAddr.secondaryAddress.present()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ ACTOR Future<ISimulator::KillType> simulatedFDBDRebooter(Reference<ClusterConnec
|
|||
|
||||
try {
|
||||
//SOMEDAY: test lower memory limits, without making them too small and causing the database to stop making progress
|
||||
FlowTransport::createInstance(1);
|
||||
FlowTransport::createInstance(processClass == ProcessClass::TesterClass, 1);
|
||||
Sim2FileSystem::newFileSystem();
|
||||
if (sslEnabled) {
|
||||
tlsOptions->register_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);
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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 ) {}
|
||||
|
|
Loading…
Reference in New Issue