allow multiple regions with the same priority
configurations must have at least one region with non-negative priority
This commit is contained in:
parent
26b7dd32da
commit
0c6825eb43
|
@ -160,24 +160,22 @@ bool DatabaseConfiguration::isValid() const {
|
|||
getDesiredRemoteLogs() >= 1 &&
|
||||
remoteTLogReplicationFactor >= 0 &&
|
||||
regions.size() <= 2 &&
|
||||
( remoteTLogReplicationFactor == 0 || ( remoteTLogPolicy && regions.size() == 2 && durableStorageQuorum == storageTeamSize ) ) ) ) {
|
||||
( remoteTLogReplicationFactor == 0 || ( remoteTLogPolicy && regions.size() == 2 && durableStorageQuorum == storageTeamSize ) ) &&
|
||||
( regions.size() == 0 || regions[0].priority >= 0 ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::set<Key> dcIds;
|
||||
std::set<int> priorities;
|
||||
dcIds.insert(Key());
|
||||
for(auto& r : regions) {
|
||||
if( !(!dcIds.count(r.dcId) &&
|
||||
!priorities.count(r.priority) &&
|
||||
r.satelliteTLogReplicationFactor >= 0 &&
|
||||
r.satelliteTLogWriteAntiQuorum >= 0 &&
|
||||
r.satelliteTLogUsableDcs >= 0 &&
|
||||
r.satelliteTLogUsableDcs >= 1 &&
|
||||
( r.satelliteTLogReplicationFactor == 0 || ( r.satelliteTLogPolicy && r.satellites.size() ) ) ) ) {
|
||||
return false;
|
||||
}
|
||||
dcIds.insert(r.dcId);
|
||||
priorities.insert(r.priority);
|
||||
for(auto& s : r.satellites) {
|
||||
if(dcIds.count(s.dcId)) {
|
||||
return false;
|
||||
|
|
|
@ -577,9 +577,6 @@ public:
|
|||
if(regions[0].priority == regions[1].priority && clusterControllerDcId.present() && regions[1].dcId == clusterControllerDcId.get()) {
|
||||
std::swap(regions[0], regions[1]);
|
||||
}
|
||||
if(regions[0].priority < 0) {
|
||||
throw no_more_servers();
|
||||
}
|
||||
bool setPrimaryDesired = false;
|
||||
try {
|
||||
auto reply = findWorkersForConfiguration(req, regions[0].dcId);
|
||||
|
@ -614,9 +611,6 @@ public:
|
|||
throw;
|
||||
}
|
||||
} else if(req.configuration.regions.size() == 1) {
|
||||
if(req.configuration.regions[0].priority < 0) {
|
||||
throw no_more_servers();
|
||||
}
|
||||
vector<Optional<Key>> dcPriority;
|
||||
dcPriority.push_back(req.configuration.regions[0].dcId);
|
||||
desiredDcIds.set(dcPriority);
|
||||
|
|
Loading…
Reference in New Issue