From 0dd9fdf9de71dc026b1e42624871ecd76f76afad Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Thu, 11 Mar 2021 14:09:52 -0800 Subject: [PATCH] Throw an error if the local client is disabled and there are no external clients --- fdbclient/MultiVersionTransaction.actor.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fdbclient/MultiVersionTransaction.actor.cpp b/fdbclient/MultiVersionTransaction.actor.cpp index 504a2412db..54ddf4bd18 100644 --- a/fdbclient/MultiVersionTransaction.actor.cpp +++ b/fdbclient/MultiVersionTransaction.actor.cpp @@ -1333,6 +1333,18 @@ void MultiVersionApi::setupNetwork() { } } + if (externalClients.empty() && localClientDisabled) { + // SOMEDAY: this should be allowed when it's possible to add external clients after the + // network is setup. + // + // Typically we would create a more specific error for this case, but since we expect + // this case to go away soon, we can use a trace event and a generic error. + TraceEvent(SevWarn, "CannotSetupNetwork") + .detail("Reason", "Local client is disabled and no external clients configured"); + + throw client_invalid_operation(); + } + networkStartSetup = true; if (externalClients.empty()) { @@ -1453,8 +1465,7 @@ Reference MultiVersionApi::createDatabase(const char* clusterFilePath } std::string clusterFile(clusterFilePath); - if (threadCount > 1 || localClientDisabled) { - ASSERT(localClientDisabled); + if (localClientDisabled) { ASSERT(!bypassMultiClientApi); int threadIdx = nextThread; @@ -1470,6 +1481,8 @@ Reference MultiVersionApi::createDatabase(const char* clusterFilePath lock.leave(); + ASSERT_LE(threadCount, 1); + auto db = localClient->api->createDatabase(clusterFilePath); if (bypassMultiClientApi) { return db;