fix: excluded servers were the same fitness as storage servers for the master role
fix: better master exists did not considers exclusion for master fitness
This commit is contained in:
parent
45a1fd1681
commit
57aba0b3bc
|
@ -27,7 +27,7 @@
|
|||
struct ProcessClass {
|
||||
// This enum is stored in restartInfo.ini for upgrade tests, so be very careful about changing the existing items!
|
||||
enum ClassType { UnsetClass, StorageClass, TransactionClass, ResolutionClass, TesterClass, ProxyClass, MasterClass, StatelessClass, LogClass, ClusterControllerClass, InvalidClass = -1 };
|
||||
enum Fitness { BestFit, GoodFit, BestOtherFit, UnsetFit, WorstFit, NeverAssign };
|
||||
enum Fitness { BestFit, GoodFit, BestOtherFit, UnsetFit, WorstFit, ExcludeFit, NeverAssign };
|
||||
enum ClusterRole { Storage, TLog, Proxy, Master, Resolver, ClusterController };
|
||||
enum ClassSource { CommandLineSource, AutoSource, DBSource, InvalidSource = -1 };
|
||||
int16_t _class;
|
||||
|
|
|
@ -198,7 +198,7 @@ public:
|
|||
for( auto& it : id_worker ) {
|
||||
auto fit = it.second.processClass.machineClassFitness( ProcessClass::Master );
|
||||
if(conf.isExcludedServer(it.second.interf.address())) {
|
||||
fit = std::max(fit, ProcessClass::WorstFit);
|
||||
fit = std::max(fit, ProcessClass::ExcludeFit);
|
||||
}
|
||||
if( workerAvailable(it.second, checkStable) && fit != ProcessClass::NeverAssign ) {
|
||||
if( fit < bestFit || (fit == bestFit && bestIsClusterController) ) {
|
||||
|
@ -707,10 +707,14 @@ public:
|
|||
|
||||
ProcessClass::Fitness oldMasterFit = masterWorker->second.processClass.machineClassFitness( ProcessClass::Master );
|
||||
if(db.config.isExcludedServer(dbi.master.address())) {
|
||||
oldMasterFit = std::max(oldMasterFit, ProcessClass::WorstFit);
|
||||
oldMasterFit = std::max(oldMasterFit, ProcessClass::ExcludeFit);
|
||||
}
|
||||
|
||||
ProcessClass::Fitness newMasterFit = getMasterWorker(db.config, true).second.machineClassFitness( ProcessClass::Master );
|
||||
auto mworker = getMasterWorker(db.config, true);
|
||||
ProcessClass::Fitness newMasterFit = mworker.second.machineClassFitness( ProcessClass::Master );
|
||||
if(db.config.isExcludedServer(mworker.first.address())) {
|
||||
newMasterFit = std::max(newMasterFit, ProcessClass::ExcludeFit);
|
||||
}
|
||||
|
||||
if(dbi.recoveryState < RecoveryState::FULLY_RECOVERED) {
|
||||
if(oldMasterFit > newMasterFit) {
|
||||
|
|
|
@ -1202,6 +1202,7 @@ struct ConsistencyCheckWorkload : TestWorkload
|
|||
// Check master
|
||||
ProcessClass::Fitness bestMasterFitness = getBestAvailableFitness(availableClassTypes, ProcessClass::Master);
|
||||
if (!workerProcessMap.count(db.master.address()) || workerProcessMap[db.master.address()].machineClassFitness(ProcessClass::Master) != bestMasterFitness) {
|
||||
TraceEvent("ConsistencyCheck_MasterNotBest").detail("bestMasterFitness", bestMasterFitness).detail("existingMasterFit", workerProcessMap.count(db.master.address()) ? workerProcessMap[db.master.address()].machineClassFitness(ProcessClass::Master) : -1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1209,6 +1210,7 @@ struct ConsistencyCheckWorkload : TestWorkload
|
|||
ProcessClass::Fitness bestMasterProxyFitness = getBestAvailableFitness(availableClassTypes, ProcessClass::Proxy);
|
||||
for (auto masterProxy : db.client.proxies) {
|
||||
if (!workerProcessMap.count(masterProxy.address()) || workerProcessMap[masterProxy.address()].machineClassFitness(ProcessClass::Proxy) != bestMasterProxyFitness) {
|
||||
TraceEvent("ConsistencyCheck_ProxyNotBest").detail("bestMasterProxyFitness", bestMasterProxyFitness).detail("existingMasterProxyFitness", workerProcessMap.count(masterProxy.address()) ? workerProcessMap[masterProxy.address()].machineClassFitness(ProcessClass::Proxy) : -1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1217,6 +1219,7 @@ struct ConsistencyCheckWorkload : TestWorkload
|
|||
ProcessClass::Fitness bestResolverFitness = getBestAvailableFitness(availableClassTypes, ProcessClass::Resolver);
|
||||
for (auto resolver : db.resolvers) {
|
||||
if (!workerProcessMap.count(resolver.address()) || workerProcessMap[resolver.address()].machineClassFitness(ProcessClass::Resolver) != bestResolverFitness) {
|
||||
TraceEvent("ConsistencyCheck_ResolverNotBest").detail("bestResolverFitness", bestResolverFitness).detail("existingResolverFitness", workerProcessMap.count(resolver.address()) ? workerProcessMap[resolver.address()].machineClassFitness(ProcessClass::Resolver) : -1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue