Add comments about the use of protectedAddresses.

This commit is contained in:
Dan Adkins 2022-09-22 17:01:01 -07:00
parent c5366e1116
commit 48e1b06d29
2 changed files with 10 additions and 0 deletions

View File

@ -451,7 +451,13 @@ public:
int physicalDatacenters;
int processesPerMachine;
int listenersPerProcess;
// We won't kill machines in this set, but we might reboot
// them. This is a conservatie mechanism to prevent the
// simulator from killing off imporant processes and rendering
// the cluster unrecoverable, e.g. a quorum of coordinators.
std::set<NetworkAddress> protectedAddresses;
std::map<NetworkAddress, ProcessInfo*> currentlyRebootingProcesses;
std::vector<std::string> extraDatabases;
Reference<IReplicationPolicy> storagePolicy;

View File

@ -2172,6 +2172,10 @@ void setupSimulatedSystem(std::vector<Future<Void>>* systemActors,
}
ASSERT(coordinatorAddresses.size() > 0);
// Mark a random majority of the coordinators as protected, so
// we won't accidently kill off a quorum and render the
// cluster unrecoverable.
deterministicRandom()->randomShuffle(coordinatorAddresses);
for (int i = 0; i < (coordinatorAddresses.size() / 2) + 1; i++) {
TraceEvent("ProtectCoordinator")