mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-17 03:12:21 +08:00
parent
6b1b127ee1
commit
bcd9a00a50
@ -982,11 +982,12 @@ ACTOR Future<CoordinatorsResult::Type> changeQuorum( Database cx, Reference<IQuo
|
|||||||
|
|
||||||
if(g_network->isSimulated()) {
|
if(g_network->isSimulated()) {
|
||||||
for(int i = 0; i < (desiredCoordinators.size()/2)+1; i++) {
|
for(int i = 0; i < (desiredCoordinators.size()/2)+1; i++) {
|
||||||
auto addresses = g_simulator.getProcessByAddress(desiredCoordinators[i])->addresses;
|
auto process = g_simulator.getProcessByAddress(desiredCoordinators[i]);
|
||||||
|
ASSERT(process->isReliable() || process->rebooting);
|
||||||
|
|
||||||
g_simulator.protectedAddresses.insert(addresses.address);
|
g_simulator.protectedAddresses.insert(process->addresses.address);
|
||||||
if(addresses.secondaryAddress.present()) {
|
if (process->addresses.secondaryAddress.present()) {
|
||||||
g_simulator.protectedAddresses.insert(addresses.secondaryAddress.get());
|
g_simulator.protectedAddresses.insert(process->addresses.secondaryAddress.get());
|
||||||
}
|
}
|
||||||
TraceEvent("ProtectCoordinator").detail("Address", desiredCoordinators[i]).backtrace();
|
TraceEvent("ProtectCoordinator").detail("Address", desiredCoordinators[i]).backtrace();
|
||||||
}
|
}
|
||||||
@ -1185,6 +1186,11 @@ struct AutoQuorumChange : IQuorumChange {
|
|||||||
if(addressExcluded(excluded, worker->address)) {
|
if(addressExcluded(excluded, worker->address)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Exclude faulty node due to machine assassination
|
||||||
|
if (g_network->isSimulated() && !g_simulator.getProcessByAddress(worker->address)->isReliable()) {
|
||||||
|
TraceEvent("AutoSelectCoordinators").detail("SkipUnreliableWorker", worker->address.toString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
for(auto field = fields.begin(); field != fields.end(); field++) {
|
for(auto field = fields.begin(); field != fields.end(); field++) {
|
||||||
if(maxCounts[*field] == 0) {
|
if(maxCounts[*field] == 0) {
|
||||||
@ -1967,6 +1973,12 @@ TEST_CASE("/ManagementAPI/AutoQuorumChange/checkLocality") {
|
|||||||
data.locality.set(LiteralStringRef("machineid"), StringRef(machineId));
|
data.locality.set(LiteralStringRef("machineid"), StringRef(machineId));
|
||||||
data.address.ip = IPAddress(i);
|
data.address.ip = IPAddress(i);
|
||||||
|
|
||||||
|
if (g_network->isSimulated()) {
|
||||||
|
g_simulator.newProcess(
|
||||||
|
format("TestProcess%d", i).c_str(), data.address.ip, data.address.port, false, 1, data.locality,
|
||||||
|
ProcessClass(ProcessClass::CoordinatorClass, ProcessClass::CommandLineSource), "", "");
|
||||||
|
}
|
||||||
|
|
||||||
workers.push_back(data);
|
workers.push_back(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user