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

Method runGrvProbe

fdbclient/MultiVersionTransaction.actor.cpp:2153–2167  ·  view source on GitHub ↗

Runs a GRV probe on the cluster to determine if the client version is compatible with the cluster. Must be called from main thread

Source from the content-addressed store, hash-verified

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
2153void MultiVersionDatabase::LegacyVersionMonitor::runGrvProbe(Reference<MultiVersionDatabase::DatabaseState> dbState) {
2154 tr = db->createTransaction();
2155 Reference<LegacyVersionMonitor> self = Reference<LegacyVersionMonitor>::addRef(this);
2156 versionMonitor = mapThreadFuture<Version, Void>(tr->getReadVersion(), [self, dbState](ErrorOr<Version> v) {
2157 // If the version attempt returns an error, we regard that as a connection (except operation_cancelled)
2158 if (!v.isError() || v.getError().code() != error_code_operation_cancelled) {
2159 onMainThreadVoid([self, dbState]() {
2160 self->monitorRunning = false;
2161 dbState->protocolVersionChanged(self->client->protocolVersion);
2162 });
2163 }
2164
2165 return v.map<Void>([](Version v) { return Void(); });
2166 });
2167}
2168
2169void MultiVersionDatabase::LegacyVersionMonitor::close() {
2170 if (versionMonitor.isValid()) {

Callers 1

Calls 8

onMainThreadVoidFunction · 0.85
createTransactionMethod · 0.65
getReadVersionMethod · 0.65
VoidClass · 0.50
isErrorMethod · 0.45
codeMethod · 0.45
getErrorMethod · 0.45

Tested by

no test coverage detected