MCPcopy Create free account
hub / github.com/apple/foundationdb / startConnectionMonitor

Method startConnectionMonitor

fdbclient/MultiVersionTransaction.actor.cpp:2116–2149  ·  view source on GitHub ↗

Starts the connection monitor by creating a database object at an old version. Must be called from the main thread

Source from the content-addressed store, hash-verified

2114// Starts the connection monitor by creating a database object at an old version.
2115// Must be called from the main thread
2116void MultiVersionDatabase::LegacyVersionMonitor::startConnectionMonitor(
2117 Reference<MultiVersionDatabase::DatabaseState> dbState) {
2118 if (!monitorRunning) {
2119 monitorRunning = true;
2120
2121 auto itr = dbState->legacyDatabaseConnections.find(client->protocolVersion);
2122 ASSERT(itr != dbState->legacyDatabaseConnections.end());
2123
2124 db = itr->second;
2125 tr = Reference<ITransaction>();
2126
2127 TraceEvent("StartingLegacyVersionMonitor").detail("ProtocolVersion", client->protocolVersion);
2128 Reference<LegacyVersionMonitor> self = Reference<LegacyVersionMonitor>::addRef(this);
2129 versionMonitor =
2130 mapThreadFuture<Void, Void>(db.castTo<DLDatabase>()->onReady(), [self, dbState](ErrorOr<Void> ready) {
2131 onMainThreadVoid([self, ready, dbState]() {
2132 if (ready.isError()) {
2133 if (ready.getError().code() != error_code_operation_cancelled) {
2134 TraceEvent(SevError, "FailedToOpenDatabaseOnClient")
2135 .error(ready.getError())
2136 .detail("LibPath", self->client->libPath);
2137
2138 self->client->failed = true;
2139 MultiVersionApi::api->updateSupportedVersions();
2140 }
2141 } else {
2142 self->runGrvProbe(dbState);
2143 }
2144 });
2145
2146 return ready;
2147 });
2148 }
2149}
2150
2151// Runs a GRV probe on the cluster to determine if the client version is compatible with the cluster.
2152// Must be called from main thread

Callers 1

Calls 12

runGrvProbeMethod · 0.95
TraceEventClass · 0.85
onMainThreadVoidFunction · 0.85
detailMethod · 0.80
findMethod · 0.45
endMethod · 0.45
onReadyMethod · 0.45
isErrorMethod · 0.45
codeMethod · 0.45
getErrorMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected