From 59794ffcb2b6bab0d8e4de220cc72cc9e528192b Mon Sep 17 00:00:00 2001 From: sfc-gh-tclinkenbeard Date: Mon, 28 Feb 2022 13:12:08 -0800 Subject: [PATCH] Add randomlyRenameZoneId test parameter --- fdbserver/SimulatedCluster.actor.cpp | 18 ++++++++++++++++-- .../from_7.1.0/ConfigureTestRestart-2.toml | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fdbserver/SimulatedCluster.actor.cpp b/fdbserver/SimulatedCluster.actor.cpp index be39ee49e8..87481d76d6 100644 --- a/fdbserver/SimulatedCluster.actor.cpp +++ b/fdbserver/SimulatedCluster.actor.cpp @@ -269,6 +269,9 @@ class TestConfig { configDBType = configDBTypeFromString(value); } } + if (attrib == "randomlyRenameZoneId") { + randomlyRenameZoneId = strcmp(value.c_str(), "true") == 0; + } } ifs.close(); @@ -306,6 +309,7 @@ public: Optional datacenters, desiredTLogCount, commitProxyCount, grvProxyCount, resolverCount, storageEngineType, stderrSeverity, machineCount, processesPerMachine, coordinators; Optional config; + bool randomlyRenameZoneId = false; ConfigDBType getConfigDBType() const { return configDBType; } @@ -357,7 +361,8 @@ public: .add("processesPerMachine", &processesPerMachine) .add("coordinators", &coordinators) .add("configDB", &configDBType) - .add("extraMachineCountDC", &extraMachineCountDC); + .add("extraMachineCountDC", &extraMachineCountDC) + .add("randomlyRenameZoneId", &randomlyRenameZoneId); try { auto file = toml::parse(testFile); if (file.contains("configuration") && toml::find(file, "configuration").is_table()) { @@ -1032,6 +1037,11 @@ ACTOR Future restartSimulatedSystem(std::vector>* systemActor auto configDBType = testConfig.getConfigDBType(); + // Randomly change data center id names to test that localities + // can be modified on cluster restart + bool renameZoneIds = testConfig.randomlyRenameZoneId ? deterministicRandom()->random01() < 0.1 : false; + TEST(renameZoneIds); // Zone ID names altered in restart test + // allows multiple ipAddr entries ini.SetMultiKey(); @@ -1080,7 +1090,11 @@ ACTOR Future restartSimulatedSystem(std::vector>* systemActor if (zoneIDini == nullptr) { zoneId = machineId; } else { - zoneId = StringRef(zoneIDini); + auto zoneIdStr = std::string(zoneIDini); + if (renameZoneIds) { + zoneIdStr = "modified/" + zoneIdStr; + } + zoneId = Standalone(zoneIdStr); } ProcessClass::ClassType cType = diff --git a/tests/restarting/from_7.1.0/ConfigureTestRestart-2.toml b/tests/restarting/from_7.1.0/ConfigureTestRestart-2.toml index a181ce821e..8230bec479 100644 --- a/tests/restarting/from_7.1.0/ConfigureTestRestart-2.toml +++ b/tests/restarting/from_7.1.0/ConfigureTestRestart-2.toml @@ -1,3 +1,6 @@ +[[configuration]] +randomlyRenameZoneId=true + [[test]] testTitle='CloggedConfigureDatabaseTest' runSetup=false