diff --git a/fdbclient/DatabaseContext.h b/fdbclient/DatabaseContext.h index 14a9075cc1..16f32c5aa5 100644 --- a/fdbclient/DatabaseContext.h +++ b/fdbclient/DatabaseContext.h @@ -95,14 +95,14 @@ public: Future onConnected(); // Returns after a majority of coordination servers are available and have reported a leader. The cluster file therefore is valid, but the database might be unavailable. Reference getConnectionFile(); - // Change the database to use the new connection file, and recreate all pending watches for committed transactions. + // Switch the database to use the new connection file, and recreate all pending watches for committed transactions. // // Meant to be used as part of a 'hot standby' solution to switch to the standby. A correct switch will involve // advancing the version on the new cluster sufficiently far that any transaction begun with a read version from the // old cluster will fail to commit. Assuming the above version-advancing is done properly, a call to - // changeConnectionFile guarantees that any read with a version from the old cluster will not be attempted on the + // switchConnectionFile guarantees that any read with a version from the old cluster will not be attempted on the // new cluster. - Future changeConnectionFile(Reference standby); + Future switchConnectionFile(Reference standby); Future recreateWatches(); // private: diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index bca7d5d9f6..2c9da7abbe 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -779,10 +779,10 @@ Future DatabaseContext::onConnected() { return cluster->onConnected(); } -ACTOR static Future changeConnectionFileImpl(Reference connFile, DatabaseContext* self) { - TEST(true); // Change connection file - TraceEvent("ChangeClusterFile") - .detail("ClusterFile", connFile->canGetFilename() ? connFile->getFilename() : "") +ACTOR static Future switchConnectionFileImpl(Reference connFile, DatabaseContext* self) { + TEST(true); // Switch connection file + TraceEvent("SwitchConnectionFile") + .detail("ConnectionFile", connFile->canGetFilename() ? connFile->getFilename() : "") .detail("ConnectionString", connFile->getConnectionString().toString()); // Reset state from former cluster. @@ -797,16 +797,16 @@ ACTOR static Future changeConnectionFileImpl(ReferenceminAcceptableReadVersion); ASSERT(self->minAcceptableReadVersion != std::numeric_limits::max()); self->recreateWatchesTrigger.trigger(); return Void(); } catch (Error& e) { - TraceEvent("ChangeClusterFileError").detail("Error", e.what()); + TraceEvent("SwitchConnectionFileError").detail("Error", e.what()); wait(tr.onError(e)); } } @@ -817,8 +817,8 @@ Reference DatabaseContext::getConnectionFile() { return cluster->getConnectionFile()->get(); } -Future DatabaseContext::changeConnectionFile(Reference standby) { - return changeConnectionFileImpl(standby, this); +Future DatabaseContext::switchConnectionFile(Reference standby) { + return switchConnectionFileImpl(standby, this); } Future DatabaseContext::recreateWatches() { diff --git a/fdbserver/workloads/DifferentClustersSameRV.actor.cpp b/fdbserver/workloads/DifferentClustersSameRV.actor.cpp index 50084403e4..77442a172f 100644 --- a/fdbserver/workloads/DifferentClustersSameRV.actor.cpp +++ b/fdbserver/workloads/DifferentClustersSameRV.actor.cpp @@ -51,8 +51,8 @@ struct DifferentClustersSameRVWorkload : TestWorkload { if (clientId != 0) { return Void(); } - auto changeConnFileDb = Database::createDatabase(cx->getConnectionFile(), -1); - std::vector> clients = { readerClientSeparateDBs(cx, this), doSwitch(changeConnFileDb, this), + auto switchConnFileDb = Database::createDatabase(cx->getConnectionFile(), -1); + std::vector> clients = { readerClientSeparateDBs(cx, this), doSwitch(switchConnFileDb, this), writerClient(cx, this), writerClient(extraDB, this) }; return success(timeout(waitForAll(clients), testDuration)); } @@ -130,9 +130,9 @@ struct DifferentClustersSameRVWorkload : TestWorkload { TraceEvent("DifferentClusters_CopiedDatabase"); wait(advanceVersion(self->extraDB, rv)); TraceEvent("DifferentClusters_AdvancedVersion"); - wait(cx->changeConnectionFile(Reference( + wait(cx->switchConnectionFile(Reference( new ClusterConnectionFile(self->extraDB->getConnectionFile()->getConnectionString())))); - TraceEvent("DifferentClusters_ChangedConnectionFile"); + TraceEvent("DifferentClusters_SwitchdConnectionFile"); state Transaction tr(cx); tr.setVersion(rv); tr.setOption(FDBTransactionOptions::READ_LOCK_AWARE); @@ -145,7 +145,7 @@ struct DifferentClustersSameRVWorkload : TestWorkload { TraceEvent("DifferentClusters_ReadError").error(e); wait(tr.onError(e)); } - // In an actual switch we would call changeConnectionFile after unlocking the database. But it's possible + // In an actual switch we would call switchConnectionFile after unlocking the database. But it's possible // that a storage server serves a read at |rv| even after the recovery caused by unlocking the database, and we // want to make that more likely for this test. So read at |rv| then unlock. wait(unlockDatabase(self->extraDB, lockUid));