added the ability to configure satellite_logs by satellite location, this will overwrite the region configure if both are present
This commit is contained in:
parent
80015146cd
commit
35e816e9ad
|
@ -599,7 +599,8 @@ Regions are configured in FoundationDB as a json document. For example::
|
|||
"datacenters":[{
|
||||
"id":"WC1",
|
||||
"priority":1,
|
||||
"satellite":1
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":"one_satellite_double",
|
||||
"satellite_logs":2
|
||||
|
@ -659,7 +660,8 @@ This is the region configuration that implements the example::
|
|||
},{
|
||||
"id":"WC2",
|
||||
"priority":0,
|
||||
"satellite":1
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":"one_satellite_double"
|
||||
},{
|
||||
|
|
|
@ -494,11 +494,47 @@
|
|||
"three_data_hall",
|
||||
"three_data_hall_fallback"
|
||||
]},
|
||||
|
||||
|
||||
{ "regions":[{
|
||||
"datacenters":[{
|
||||
"id":"DC1",
|
||||
"priority":1
|
||||
},
|
||||
{
|
||||
"id":"DC3",
|
||||
"priority":0,
|
||||
"satellite":1,
|
||||
"satellite_logs":1
|
||||
},
|
||||
{
|
||||
"id":"DC4",
|
||||
"priority":1,
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":"one_satellite_single",
|
||||
"satellite_logs":1
|
||||
},{
|
||||
"datacenters":[{
|
||||
"id":"DC2",
|
||||
"priority":0
|
||||
}],
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"regions":[{
|
||||
"datacenters":[{
|
||||
"id":"mr",
|
||||
"priority":1,
|
||||
"satellite":1
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":{
|
||||
"$enum":[
|
||||
|
|
|
@ -73,6 +73,7 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
|||
s.get("id", idStr);
|
||||
satInfo.dcId = idStr;
|
||||
s.get("priority", satInfo.priority);
|
||||
s.tryGet("satellite_logs", satInfo.satelliteDesiredTLogCount);
|
||||
info.satellites.push_back(satInfo);
|
||||
} else {
|
||||
if (foundNonSatelliteDatacenter) throw invalid_option();
|
||||
|
@ -365,6 +366,9 @@ StatusArray DatabaseConfiguration::getRegionJSON() const {
|
|||
satObj["id"] = s.dcId.toString();
|
||||
satObj["priority"] = s.priority;
|
||||
satObj["satellite"] = 1;
|
||||
if(s.satelliteDesiredTLogCount != -1) {
|
||||
satObj["satellite_logs"] = s.satelliteDesiredTLogCount;
|
||||
}
|
||||
|
||||
dcArr.push_back(satObj);
|
||||
}
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
struct SatelliteInfo {
|
||||
Key dcId;
|
||||
int32_t priority;
|
||||
int32_t satelliteDesiredTLogCount;
|
||||
|
||||
SatelliteInfo() : priority(0) {}
|
||||
SatelliteInfo() : priority(0), satelliteDesiredTLogCount(-1) {}
|
||||
|
||||
struct sort_by_priority {
|
||||
bool operator ()(SatelliteInfo const&a, SatelliteInfo const& b) const { return a.priority > b.priority; }
|
||||
|
@ -41,7 +42,7 @@ struct SatelliteInfo {
|
|||
|
||||
template <class Ar>
|
||||
void serialize(Ar& ar) {
|
||||
serializer(ar, dcId, priority);
|
||||
serializer(ar, dcId, priority, satelliteDesiredTLogCount);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
|
|||
std::string key = mode.substr(0, pos);
|
||||
std::string value = mode.substr(pos+1);
|
||||
|
||||
if( (key == "logs" || key == "proxies" || key == "resolvers" || key == "remote_logs" || key == "log_routers" || key == "satellite_logs" || key == "usable_regions" || key == "repopulate_anti_quorum") && isInteger(value) ) {
|
||||
if( (key == "logs" || key == "proxies" || key == "resolvers" || key == "remote_logs" || key == "log_routers" || key == "usable_regions" || key == "repopulate_anti_quorum") && isInteger(value) ) {
|
||||
out[p+key] = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -522,7 +522,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
|
|||
"datacenters":[{
|
||||
"id":"mr",
|
||||
"priority":1,
|
||||
"satellite":1
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":{
|
||||
"$enum":[
|
||||
|
@ -732,7 +733,8 @@ const KeyRef JSONSchemas::clusterConfigurationSchema = LiteralStringRef(R"config
|
|||
"datacenters":[{
|
||||
"id":"mr",
|
||||
"priority":1,
|
||||
"satellite":1
|
||||
"satellite":1,
|
||||
"satellite_logs":2
|
||||
}],
|
||||
"satellite_redundancy_mode":{
|
||||
"$enum":[
|
||||
|
|
|
@ -398,8 +398,14 @@ public:
|
|||
try {
|
||||
bool remoteDCUsedAsSatellite = false;
|
||||
std::set<Optional<Key>> satelliteDCs;
|
||||
int32_t desiredSatelliteTLogs = 0;
|
||||
for(int s = startDC; s < std::min<int>(startDC + (satelliteFallback ? region.satelliteTLogUsableDcsFallback : region.satelliteTLogUsableDcs), region.satellites.size()); s++) {
|
||||
satelliteDCs.insert(region.satellites[s].dcId);
|
||||
if(region.satellites[s].satelliteDesiredTLogCount == -1 || desiredSatelliteTLogs == -1) {
|
||||
desiredSatelliteTLogs = -1;
|
||||
} else {
|
||||
desiredSatelliteTLogs += region.satellites[s].satelliteDesiredTLogCount;
|
||||
}
|
||||
if (region.satellites[s].dcId == remoteRegion.dcId) {
|
||||
remoteDCUsedAsSatellite = true;
|
||||
}
|
||||
|
@ -413,9 +419,9 @@ public:
|
|||
std::transform(remoteLogs.begin(), remoteLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerDetails &in) { return in.interf.id(); });
|
||||
}
|
||||
if(satelliteFallback) {
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactorFallback, conf.getDesiredSatelliteLogs(region.dcId)*region.satelliteTLogUsableDcsFallback/region.satelliteTLogUsableDcs, region.satelliteTLogPolicyFallback, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactorFallback, desiredSatelliteTLogs>0 ? desiredSatelliteTLogs : conf.getDesiredSatelliteLogs(region.dcId)*region.satelliteTLogUsableDcsFallback/region.satelliteTLogUsableDcs, region.satelliteTLogPolicyFallback, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
} else {
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactor, conf.getDesiredSatelliteLogs(region.dcId), region.satelliteTLogPolicy, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
return getWorkersForTlogs( conf, region.satelliteTLogReplicationFactor, desiredSatelliteTLogs>0 ? desiredSatelliteTLogs : conf.getDesiredSatelliteLogs(region.dcId), region.satelliteTLogPolicy, id_used, checkStable, satelliteDCs, exclusionWorkerIds);
|
||||
}
|
||||
} catch (Error &e) {
|
||||
if(e.code() != error_code_no_more_servers) {
|
||||
|
|
|
@ -945,11 +945,8 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
}
|
||||
}
|
||||
|
||||
if (deterministicRandom()->random01() < 0.25) {
|
||||
int logs = deterministicRandom()->randomInt(1,7);
|
||||
primaryObj["satellite_logs"] = logs;
|
||||
remoteObj["satellite_logs"] = logs;
|
||||
}
|
||||
if (deterministicRandom()->random01() < 0.25) primaryObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
if (deterministicRandom()->random01() < 0.25) remoteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
|
||||
//We cannot run with a remote DC when MAX_READ_TRANSACTION_LIFE_VERSIONS is too small, because the log routers will not be able to keep up.
|
||||
if (minimumRegions <= 1 && (deterministicRandom()->random01() < 0.25 || SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS < SERVER_KNOBS->VERSIONS_PER_SECOND)) {
|
||||
|
@ -998,12 +995,14 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
primarySatelliteObj["id"] = useNormalDCsAsSatellites ? "1" : "2";
|
||||
primarySatelliteObj["priority"] = 1;
|
||||
primarySatelliteObj["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) primarySatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
primaryDcArr.push_back(primarySatelliteObj);
|
||||
|
||||
StatusObject remoteSatelliteObj;
|
||||
remoteSatelliteObj["id"] = useNormalDCsAsSatellites ? "0" : "3";
|
||||
remoteSatelliteObj["priority"] = 1;
|
||||
remoteSatelliteObj["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
remoteDcArr.push_back(remoteSatelliteObj);
|
||||
|
||||
if (datacenters > 4) {
|
||||
|
@ -1011,12 +1010,14 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
|||
primarySatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "4";
|
||||
primarySatelliteObjB["priority"] = 1;
|
||||
primarySatelliteObjB["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) primarySatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
primaryDcArr.push_back(primarySatelliteObjB);
|
||||
|
||||
StatusObject remoteSatelliteObjB;
|
||||
remoteSatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "5";
|
||||
remoteSatelliteObjB["priority"] = 1;
|
||||
remoteSatelliteObjB["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||
}
|
||||
if (useNormalDCsAsSatellites) {
|
||||
|
|
|
@ -75,12 +75,14 @@ std::string generateRegions() {
|
|||
primarySatelliteObj["id"] = "2";
|
||||
primarySatelliteObj["priority"] = 1;
|
||||
primarySatelliteObj["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) primarySatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
primaryDcArr.push_back(primarySatelliteObj);
|
||||
|
||||
StatusObject remoteSatelliteObj;
|
||||
remoteSatelliteObj["id"] = "3";
|
||||
remoteSatelliteObj["priority"] = 1;
|
||||
remoteSatelliteObj["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
remoteDcArr.push_back(remoteSatelliteObj);
|
||||
|
||||
if(g_simulator.physicalDatacenters > 5 && deterministicRandom()->random01() < 0.5) {
|
||||
|
@ -88,12 +90,14 @@ std::string generateRegions() {
|
|||
primarySatelliteObjB["id"] = "4";
|
||||
primarySatelliteObjB["priority"] = 1;
|
||||
primarySatelliteObjB["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) primarySatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
primaryDcArr.push_back(primarySatelliteObjB);
|
||||
|
||||
StatusObject remoteSatelliteObjB;
|
||||
remoteSatelliteObjB["id"] = "5";
|
||||
remoteSatelliteObjB["priority"] = 1;
|
||||
remoteSatelliteObjB["satellite"] = 1;
|
||||
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||
|
||||
int satellite_replication_type = deterministicRandom()->randomInt(0,3);
|
||||
|
@ -146,11 +150,8 @@ std::string generateRegions() {
|
|||
}
|
||||
}
|
||||
|
||||
if (deterministicRandom()->random01() < 0.25) {
|
||||
int logs = deterministicRandom()->randomInt(1,7);
|
||||
primaryObj["satellite_logs"] = logs;
|
||||
remoteObj["satellite_logs"] = logs;
|
||||
}
|
||||
if (deterministicRandom()->random01() < 0.25) primaryObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
if (deterministicRandom()->random01() < 0.25) remoteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||
|
||||
int remote_replication_type = deterministicRandom()->randomInt(0, 4);
|
||||
switch (remote_replication_type) {
|
||||
|
|
Loading…
Reference in New Issue