Starts the connection monitor by creating a database object at an old version. Must be called from the main thread
| 2114 | // Starts the connection monitor by creating a database object at an old version. |
| 2115 | // Must be called from the main thread |
| 2116 | void 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 |
no test coverage detected