added support for single region configurations
This commit is contained in:
parent
59723f51f8
commit
65b532658f
|
@ -643,6 +643,17 @@ public:
|
|||
}
|
||||
throw;
|
||||
}
|
||||
} else if(req.configuration.regions.size() == 1) {
|
||||
vector<Optional<Key>> dcPriority;
|
||||
dcPriority.push_back(req.configuration.regions[0].dcId);
|
||||
desiredDcIds.set(dcPriority);
|
||||
auto reply = findWorkersForConfiguration(req, req.configuration.regions[0].dcId);
|
||||
if(reply.isError()) {
|
||||
throw reply.getError();
|
||||
} else if(clusterControllerDcId.present() && req.configuration.regions[0].dcId == clusterControllerDcId.get()) {
|
||||
return reply.get();
|
||||
}
|
||||
throw no_more_servers();
|
||||
} else {
|
||||
RecruitFromConfigurationReply result;
|
||||
result.logRouterCount = 0;
|
||||
|
@ -730,7 +741,7 @@ public:
|
|||
}
|
||||
|
||||
void checkPrimaryDC() {
|
||||
if(db.config.regions.size() && clusterControllerDcId.present() && db.config.regions[0].dcId != clusterControllerDcId.get()) {
|
||||
if(db.config.regions.size() > 1 && clusterControllerDcId.present() && db.config.regions[0].dcId != clusterControllerDcId.get()) {
|
||||
try {
|
||||
std::map< Optional<Standalone<StringRef>>, int> id_used;
|
||||
getWorkerForRoleInDatacenter(db.config.regions[0].dcId, ProcessClass::ClusterController, ProcessClass::ExcludeFit, db.config, id_used, true);
|
||||
|
@ -854,7 +865,7 @@ public:
|
|||
std::set<Optional<Key>> remoteDC;
|
||||
|
||||
RegionInfo region;
|
||||
if(db.config.regions.size() > 1 && clusterControllerDcId.present()) {
|
||||
if(db.config.regions.size() && clusterControllerDcId.present()) {
|
||||
primaryDC.insert(clusterControllerDcId);
|
||||
for(auto& r : db.config.regions) {
|
||||
if(r.dcId != clusterControllerDcId.get()) {
|
||||
|
|
|
@ -155,7 +155,7 @@ bool DatabaseConfiguration::isValid() const {
|
|||
getDesiredRemoteLogs() >= 1 &&
|
||||
getDesiredLogRouters() >= 1 &&
|
||||
remoteTLogReplicationFactor >= 0 &&
|
||||
(regions.size() == 0 || regions.size() == 2) &&
|
||||
regions.size() <= 2 &&
|
||||
( remoteTLogReplicationFactor == 0 || ( remoteTLogPolicy && regions.size() == 2 && durableStorageQuorum == storageTeamSize ) ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -682,7 +682,7 @@ StringRef StringRefOf(const char* s) {
|
|||
|
||||
void SimulationConfig::generateNormalConfig(int minimumReplication) {
|
||||
set_config("new");
|
||||
bool generateFearless = false; //FIXME g_random->random01() < 0.5;
|
||||
bool generateFearless = true; //FIXME g_random->random01() < 0.5;
|
||||
datacenters = generateFearless ? 4 : g_random->randomInt( 1, 4 );
|
||||
if (g_random->random01() < 0.25) db.desiredTLogCount = g_random->randomInt(1,7);
|
||||
if (g_random->random01() < 0.25) db.masterProxyCount = g_random->randomInt(1,7);
|
||||
|
@ -763,9 +763,10 @@ void SimulationConfig::generateNormalConfig(int minimumReplication) {
|
|||
remoteSatellitesArr.push_back(remoteSatelliteObj);
|
||||
remoteObj["satellites"] = remoteSatellitesArr;
|
||||
|
||||
int satellite_replication_type = 2;//FIXME: g_random->randomInt(0,5);
|
||||
int satellite_replication_type = g_random->randomInt(0,5);
|
||||
switch (satellite_replication_type) {
|
||||
case 0: {
|
||||
//FIXME: implement
|
||||
TEST( true ); // Simulated cluster using custom satellite redundancy mode
|
||||
break;
|
||||
}
|
||||
|
@ -801,9 +802,10 @@ void SimulationConfig::generateNormalConfig(int minimumReplication) {
|
|||
remoteObj["satellite_logs"] = logs;
|
||||
}
|
||||
|
||||
int remote_replication_type = 2;//FIXME: g_random->randomInt(0,5);
|
||||
int remote_replication_type = g_random->randomInt(0,5);
|
||||
switch (remote_replication_type) {
|
||||
case 0: {
|
||||
//FIXME: implement
|
||||
TEST( true ); // Simulated cluster using custom remote redundancy mode
|
||||
break;
|
||||
}
|
||||
|
@ -907,6 +909,15 @@ void setupSimulatedSystem( vector<Future<Void>> *systemActors, std::string baseF
|
|||
for(auto s : simconfig.db.regions[1].satellites) {
|
||||
g_simulator.remoteSatelliteDcIds.push_back(s.dcId);
|
||||
}
|
||||
} else if(simconfig.db.regions.size() == 1) {
|
||||
g_simulator.primaryDcId = simconfig.db.regions[0].dcId;
|
||||
g_simulator.hasSatelliteReplication = simconfig.db.regions[0].satelliteTLogReplicationFactor > 0;
|
||||
g_simulator.satelliteTLogPolicy = simconfig.db.regions[0].satelliteTLogPolicy;
|
||||
g_simulator.satelliteTLogWriteAntiQuorum = simconfig.db.regions[0].satelliteTLogWriteAntiQuorum;
|
||||
|
||||
for(auto s : simconfig.db.regions[0].satellites) {
|
||||
g_simulator.primarySatelliteDcIds.push_back(s.dcId);
|
||||
}
|
||||
} else {
|
||||
g_simulator.hasSatelliteReplication = false;
|
||||
g_simulator.satelliteTLogWriteAntiQuorum = 0;
|
||||
|
|
|
@ -554,7 +554,9 @@ ACTOR Future<Void> recruitEverything( Reference<MasterData> self, vector<Storage
|
|||
self->remoteDcIds.clear();
|
||||
if(recruits.dcId.present()) {
|
||||
self->primaryDcId.push_back(recruits.dcId);
|
||||
self->remoteDcIds.push_back(recruits.dcId.get() == self->configuration.regions[0].dcId ? self->configuration.regions[1].dcId : self->configuration.regions[0].dcId);
|
||||
if(self->configuration.regions.size() > 1) {
|
||||
self->remoteDcIds.push_back(recruits.dcId.get() == self->configuration.regions[0].dcId ? self->configuration.regions[1].dcId : self->configuration.regions[0].dcId);
|
||||
}
|
||||
}
|
||||
|
||||
TraceEvent("MasterRecoveryState", self->dbgid)
|
||||
|
|
|
@ -1070,9 +1070,10 @@ struct ConsistencyCheckWorkload : TestWorkload
|
|||
}
|
||||
}
|
||||
|
||||
if((!configuration.regions.size() && missingStorage.size()) ||
|
||||
(configuration.regions.size() && configuration.remoteTLogReplicationFactor == 0 && missingStorage.count(configuration.regions[0].dcId) && missingStorage.count(configuration.regions[1].dcId)) ||
|
||||
(configuration.regions.size() && configuration.remoteTLogReplicationFactor > 0 && (missingStorage.count(configuration.regions[0].dcId) || missingStorage.count(configuration.regions[1].dcId)))) {
|
||||
if(( configuration.regions.size() == 0 && missingStorage.size()) ||
|
||||
(configuration.regions.size() == 1 && missingStorage.count(configuration.regions[0].dcId)) ||
|
||||
(configuration.regions.size() == 2 && configuration.remoteTLogReplicationFactor == 0 && missingStorage.count(configuration.regions[0].dcId) && missingStorage.count(configuration.regions[1].dcId)) ||
|
||||
(configuration.regions.size() == 2 && configuration.remoteTLogReplicationFactor > 0 && (missingStorage.count(configuration.regions[0].dcId) || missingStorage.count(configuration.regions[1].dcId)))) {
|
||||
self->testFailure("No storage server on worker");
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue