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
documentation/sphinx/source
fdbclient
fdbserver
|
@ -599,7 +599,8 @@ Regions are configured in FoundationDB as a json document. For example::
|
||||||
"datacenters":[{
|
"datacenters":[{
|
||||||
"id":"WC1",
|
"id":"WC1",
|
||||||
"priority":1,
|
"priority":1,
|
||||||
"satellite":1
|
"satellite":1,
|
||||||
|
"satellite_logs":2
|
||||||
}],
|
}],
|
||||||
"satellite_redundancy_mode":"one_satellite_double",
|
"satellite_redundancy_mode":"one_satellite_double",
|
||||||
"satellite_logs":2
|
"satellite_logs":2
|
||||||
|
@ -659,7 +660,8 @@ This is the region configuration that implements the example::
|
||||||
},{
|
},{
|
||||||
"id":"WC2",
|
"id":"WC2",
|
||||||
"priority":0,
|
"priority":0,
|
||||||
"satellite":1
|
"satellite":1,
|
||||||
|
"satellite_logs":2
|
||||||
}],
|
}],
|
||||||
"satellite_redundancy_mode":"one_satellite_double"
|
"satellite_redundancy_mode":"one_satellite_double"
|
||||||
},{
|
},{
|
||||||
|
|
|
@ -494,11 +494,47 @@
|
||||||
"three_data_hall",
|
"three_data_hall",
|
||||||
"three_data_hall_fallback"
|
"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":[{
|
"regions":[{
|
||||||
"datacenters":[{
|
"datacenters":[{
|
||||||
"id":"mr",
|
"id":"mr",
|
||||||
"priority":1,
|
"priority":1,
|
||||||
"satellite":1
|
"satellite":1,
|
||||||
|
"satellite_logs":2
|
||||||
}],
|
}],
|
||||||
"satellite_redundancy_mode":{
|
"satellite_redundancy_mode":{
|
||||||
"$enum":[
|
"$enum":[
|
||||||
|
|
|
@ -73,6 +73,7 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
||||||
s.get("id", idStr);
|
s.get("id", idStr);
|
||||||
satInfo.dcId = idStr;
|
satInfo.dcId = idStr;
|
||||||
s.get("priority", satInfo.priority);
|
s.get("priority", satInfo.priority);
|
||||||
|
s.tryGet("satellite_logs", satInfo.satelliteDesiredTLogCount);
|
||||||
info.satellites.push_back(satInfo);
|
info.satellites.push_back(satInfo);
|
||||||
} else {
|
} else {
|
||||||
if (foundNonSatelliteDatacenter) throw invalid_option();
|
if (foundNonSatelliteDatacenter) throw invalid_option();
|
||||||
|
@ -365,6 +366,9 @@ StatusArray DatabaseConfiguration::getRegionJSON() const {
|
||||||
satObj["id"] = s.dcId.toString();
|
satObj["id"] = s.dcId.toString();
|
||||||
satObj["priority"] = s.priority;
|
satObj["priority"] = s.priority;
|
||||||
satObj["satellite"] = 1;
|
satObj["satellite"] = 1;
|
||||||
|
if(s.satelliteDesiredTLogCount != -1) {
|
||||||
|
satObj["satellite_logs"] = s.satelliteDesiredTLogCount;
|
||||||
|
}
|
||||||
|
|
||||||
dcArr.push_back(satObj);
|
dcArr.push_back(satObj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,9 @@
|
||||||
struct SatelliteInfo {
|
struct SatelliteInfo {
|
||||||
Key dcId;
|
Key dcId;
|
||||||
int32_t priority;
|
int32_t priority;
|
||||||
|
int32_t satelliteDesiredTLogCount;
|
||||||
|
|
||||||
SatelliteInfo() : priority(0) {}
|
SatelliteInfo() : priority(0), satelliteDesiredTLogCount(-1) {}
|
||||||
|
|
||||||
struct sort_by_priority {
|
struct sort_by_priority {
|
||||||
bool operator ()(SatelliteInfo const&a, SatelliteInfo const& b) const { return a.priority > b.priority; }
|
bool operator ()(SatelliteInfo const&a, SatelliteInfo const& b) const { return a.priority > b.priority; }
|
||||||
|
@ -41,7 +42,7 @@ struct SatelliteInfo {
|
||||||
|
|
||||||
template <class Ar>
|
template <class Ar>
|
||||||
void serialize(Ar& 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 key = mode.substr(0, pos);
|
||||||
std::string value = mode.substr(pos+1);
|
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;
|
out[p+key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,7 +522,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
|
||||||
"datacenters":[{
|
"datacenters":[{
|
||||||
"id":"mr",
|
"id":"mr",
|
||||||
"priority":1,
|
"priority":1,
|
||||||
"satellite":1
|
"satellite":1,
|
||||||
|
"satellite_logs":2
|
||||||
}],
|
}],
|
||||||
"satellite_redundancy_mode":{
|
"satellite_redundancy_mode":{
|
||||||
"$enum":[
|
"$enum":[
|
||||||
|
@ -732,7 +733,8 @@ const KeyRef JSONSchemas::clusterConfigurationSchema = LiteralStringRef(R"config
|
||||||
"datacenters":[{
|
"datacenters":[{
|
||||||
"id":"mr",
|
"id":"mr",
|
||||||
"priority":1,
|
"priority":1,
|
||||||
"satellite":1
|
"satellite":1,
|
||||||
|
"satellite_logs":2
|
||||||
}],
|
}],
|
||||||
"satellite_redundancy_mode":{
|
"satellite_redundancy_mode":{
|
||||||
"$enum":[
|
"$enum":[
|
||||||
|
|
|
@ -398,8 +398,14 @@ public:
|
||||||
try {
|
try {
|
||||||
bool remoteDCUsedAsSatellite = false;
|
bool remoteDCUsedAsSatellite = false;
|
||||||
std::set<Optional<Key>> satelliteDCs;
|
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++) {
|
for(int s = startDC; s < std::min<int>(startDC + (satelliteFallback ? region.satelliteTLogUsableDcsFallback : region.satelliteTLogUsableDcs), region.satellites.size()); s++) {
|
||||||
satelliteDCs.insert(region.satellites[s].dcId);
|
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) {
|
if (region.satellites[s].dcId == remoteRegion.dcId) {
|
||||||
remoteDCUsedAsSatellite = true;
|
remoteDCUsedAsSatellite = true;
|
||||||
}
|
}
|
||||||
|
@ -413,9 +419,9 @@ public:
|
||||||
std::transform(remoteLogs.begin(), remoteLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerDetails &in) { return in.interf.id(); });
|
std::transform(remoteLogs.begin(), remoteLogs.end(), std::back_inserter(exclusionWorkerIds), [](const WorkerDetails &in) { return in.interf.id(); });
|
||||||
}
|
}
|
||||||
if(satelliteFallback) {
|
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 {
|
} 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) {
|
} catch (Error &e) {
|
||||||
if(e.code() != error_code_no_more_servers) {
|
if(e.code() != error_code_no_more_servers) {
|
||||||
|
|
|
@ -945,11 +945,8 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deterministicRandom()->random01() < 0.25) {
|
if (deterministicRandom()->random01() < 0.25) primaryObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
int logs = deterministicRandom()->randomInt(1,7);
|
if (deterministicRandom()->random01() < 0.25) remoteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryObj["satellite_logs"] = logs;
|
|
||||||
remoteObj["satellite_logs"] = logs;
|
|
||||||
}
|
|
||||||
|
|
||||||
//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.
|
//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)) {
|
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["id"] = useNormalDCsAsSatellites ? "1" : "2";
|
||||||
primarySatelliteObj["priority"] = 1;
|
primarySatelliteObj["priority"] = 1;
|
||||||
primarySatelliteObj["satellite"] = 1;
|
primarySatelliteObj["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) primarySatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryDcArr.push_back(primarySatelliteObj);
|
primaryDcArr.push_back(primarySatelliteObj);
|
||||||
|
|
||||||
StatusObject remoteSatelliteObj;
|
StatusObject remoteSatelliteObj;
|
||||||
remoteSatelliteObj["id"] = useNormalDCsAsSatellites ? "0" : "3";
|
remoteSatelliteObj["id"] = useNormalDCsAsSatellites ? "0" : "3";
|
||||||
remoteSatelliteObj["priority"] = 1;
|
remoteSatelliteObj["priority"] = 1;
|
||||||
remoteSatelliteObj["satellite"] = 1;
|
remoteSatelliteObj["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
remoteDcArr.push_back(remoteSatelliteObj);
|
remoteDcArr.push_back(remoteSatelliteObj);
|
||||||
|
|
||||||
if (datacenters > 4) {
|
if (datacenters > 4) {
|
||||||
|
@ -1011,12 +1010,14 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
|
||||||
primarySatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "4";
|
primarySatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "4";
|
||||||
primarySatelliteObjB["priority"] = 1;
|
primarySatelliteObjB["priority"] = 1;
|
||||||
primarySatelliteObjB["satellite"] = 1;
|
primarySatelliteObjB["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) primarySatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryDcArr.push_back(primarySatelliteObjB);
|
primaryDcArr.push_back(primarySatelliteObjB);
|
||||||
|
|
||||||
StatusObject remoteSatelliteObjB;
|
StatusObject remoteSatelliteObjB;
|
||||||
remoteSatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "5";
|
remoteSatelliteObjB["id"] = useNormalDCsAsSatellites ? "2" : "5";
|
||||||
remoteSatelliteObjB["priority"] = 1;
|
remoteSatelliteObjB["priority"] = 1;
|
||||||
remoteSatelliteObjB["satellite"] = 1;
|
remoteSatelliteObjB["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||||
}
|
}
|
||||||
if (useNormalDCsAsSatellites) {
|
if (useNormalDCsAsSatellites) {
|
||||||
|
|
|
@ -75,12 +75,14 @@ std::string generateRegions() {
|
||||||
primarySatelliteObj["id"] = "2";
|
primarySatelliteObj["id"] = "2";
|
||||||
primarySatelliteObj["priority"] = 1;
|
primarySatelliteObj["priority"] = 1;
|
||||||
primarySatelliteObj["satellite"] = 1;
|
primarySatelliteObj["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) primarySatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryDcArr.push_back(primarySatelliteObj);
|
primaryDcArr.push_back(primarySatelliteObj);
|
||||||
|
|
||||||
StatusObject remoteSatelliteObj;
|
StatusObject remoteSatelliteObj;
|
||||||
remoteSatelliteObj["id"] = "3";
|
remoteSatelliteObj["id"] = "3";
|
||||||
remoteSatelliteObj["priority"] = 1;
|
remoteSatelliteObj["priority"] = 1;
|
||||||
remoteSatelliteObj["satellite"] = 1;
|
remoteSatelliteObj["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
remoteDcArr.push_back(remoteSatelliteObj);
|
remoteDcArr.push_back(remoteSatelliteObj);
|
||||||
|
|
||||||
if(g_simulator.physicalDatacenters > 5 && deterministicRandom()->random01() < 0.5) {
|
if(g_simulator.physicalDatacenters > 5 && deterministicRandom()->random01() < 0.5) {
|
||||||
|
@ -88,12 +90,14 @@ std::string generateRegions() {
|
||||||
primarySatelliteObjB["id"] = "4";
|
primarySatelliteObjB["id"] = "4";
|
||||||
primarySatelliteObjB["priority"] = 1;
|
primarySatelliteObjB["priority"] = 1;
|
||||||
primarySatelliteObjB["satellite"] = 1;
|
primarySatelliteObjB["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) primarySatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryDcArr.push_back(primarySatelliteObjB);
|
primaryDcArr.push_back(primarySatelliteObjB);
|
||||||
|
|
||||||
StatusObject remoteSatelliteObjB;
|
StatusObject remoteSatelliteObjB;
|
||||||
remoteSatelliteObjB["id"] = "5";
|
remoteSatelliteObjB["id"] = "5";
|
||||||
remoteSatelliteObjB["priority"] = 1;
|
remoteSatelliteObjB["priority"] = 1;
|
||||||
remoteSatelliteObjB["satellite"] = 1;
|
remoteSatelliteObjB["satellite"] = 1;
|
||||||
|
if (deterministicRandom()->random01() < 0.25) remoteSatelliteObjB["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
remoteDcArr.push_back(remoteSatelliteObjB);
|
remoteDcArr.push_back(remoteSatelliteObjB);
|
||||||
|
|
||||||
int satellite_replication_type = deterministicRandom()->randomInt(0,3);
|
int satellite_replication_type = deterministicRandom()->randomInt(0,3);
|
||||||
|
@ -146,11 +150,8 @@ std::string generateRegions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deterministicRandom()->random01() < 0.25) {
|
if (deterministicRandom()->random01() < 0.25) primaryObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
int logs = deterministicRandom()->randomInt(1,7);
|
if (deterministicRandom()->random01() < 0.25) remoteObj["satellite_logs"] = deterministicRandom()->randomInt(1,7);
|
||||||
primaryObj["satellite_logs"] = logs;
|
|
||||||
remoteObj["satellite_logs"] = logs;
|
|
||||||
}
|
|
||||||
|
|
||||||
int remote_replication_type = deterministicRandom()->randomInt(0, 4);
|
int remote_replication_type = deterministicRandom()->randomInt(0, 4);
|
||||||
switch (remote_replication_type) {
|
switch (remote_replication_type) {
|
||||||
|
|
Loading…
Reference in New Issue