Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fearless features #63

Merged
merged 11 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 8 additions & 55 deletions fdbclient/ManagementAPI.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
out[p+key] = value;
}

if( key == "primary_dc" || key == "remote_dc" || key == "primary_satellite_dcs" || key == "remote_satellite_dcs" ) {
out[p+key] = value;
if( key == "regions" ) {
json_spirit::mValue mv;
json_spirit::read_string( value, mv );

StatusObject regionObj;
regionObj["regions"] = mv;
out[p+key] = BinaryWriter::toValue(regionObj, IncludeVersion()).toString();
}

return out;
Expand Down Expand Up @@ -173,7 +178,7 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
remote_redundancy="3";
remote_log_replicas="3";
remoteTLogPolicy = IRepPolicyRef(new PolicyAcross(3, "zoneid", IRepPolicyRef(new PolicyOne())));
} else if(mode == "remote_three_data_hall") {
} else if(mode == "remote_three_data_hall") { //FIXME: not tested in simulation
remote_redundancy="3";
remote_log_replicas="4";
remoteTLogPolicy = IRepPolicyRef(new PolicyAcross(2, "data_hall",
Expand All @@ -182,8 +187,6 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
} else
remoteRedundancySpecified = false;
if (remoteRedundancySpecified) {
out[p+"remote_storage_replicas"] =
out[p+"remote_storage_quorum"] = remote_redundancy;
out[p+"remote_log_replicas"] = remote_log_replicas;

BinaryWriter policyWriter(IncludeVersion());
Expand All @@ -192,56 +195,6 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
return out;
}

std::string satellite_log_replicas, satellite_anti_quorum, satellite_usable_dcs;
IRepPolicyRef satelliteTLogPolicy;
bool satelliteRedundancySpecified = true;
if (mode == "satellite_none") {
satellite_anti_quorum="0";
satellite_usable_dcs="0";
satellite_log_replicas="0";
satelliteTLogPolicy = IRepPolicyRef();
} else if (mode == "one_satellite_single") {
satellite_anti_quorum="0";
satellite_usable_dcs="1";
satellite_log_replicas="1";
satelliteTLogPolicy = IRepPolicyRef(new PolicyOne());
} else if(mode == "one_satellite_double") {
satellite_anti_quorum="0";
satellite_usable_dcs="1";
satellite_log_replicas="2";
satelliteTLogPolicy = IRepPolicyRef(new PolicyAcross(2, "zoneid", IRepPolicyRef(new PolicyOne())));
} else if(mode == "one_satellite_triple") {
satellite_anti_quorum="0";
satellite_usable_dcs="1";
satellite_log_replicas="3";
satelliteTLogPolicy = IRepPolicyRef(new PolicyAcross(3, "zoneid", IRepPolicyRef(new PolicyOne())));
} else if(mode == "two_satellite_safe") {
satellite_anti_quorum="0";
satellite_usable_dcs="2";
satellite_log_replicas="4";
satelliteTLogPolicy = IRepPolicyRef(new PolicyAcross(2, "dcid",
IRepPolicyRef(new PolicyAcross(2, "zoneid", IRepPolicyRef(new PolicyOne())))
));
} else if(mode == "two_satellite_fast") {
satellite_anti_quorum="2";
satellite_usable_dcs="2";
satellite_log_replicas="4";
satelliteTLogPolicy = IRepPolicyRef(new PolicyAcross(2, "dcid",
IRepPolicyRef(new PolicyAcross(2, "zoneid", IRepPolicyRef(new PolicyOne())))
));
} else
satelliteRedundancySpecified = false;
if (satelliteRedundancySpecified) {
out[p+"satellite_anti_quorum"] = satellite_anti_quorum;
out[p+"satellite_usable_dcs"] = satellite_usable_dcs;
out[p+"satellite_log_replicas"] = satellite_log_replicas;

BinaryWriter policyWriter(IncludeVersion());
serializeReplicationPolicy(policyWriter, satelliteTLogPolicy);
out[p+"satellite_log_policy"] = policyWriter.toStringRef().toString();
return out;
}

return out;
}

Expand Down
16 changes: 12 additions & 4 deletions fdbrpc/sim2.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ class Sim2 : public ISimulator, public INetworkConnections {
std::vector<LocalityData> badCombo;
std::set<Optional<Standalone<StringRef>>> uniqueMachines;

if(!hasRemoteReplication) {
if(!primaryDcId.present()) {
for (auto processInfo : availableProcesses) {
primaryProcessesLeft.add(processInfo->locality);
primaryLocalitiesLeft.push_back(processInfo->locality);
Expand Down Expand Up @@ -1093,21 +1093,29 @@ class Sim2 : public ISimulator, public INetworkConnections {
bool notEnoughLeft = false;
bool primaryTLogsDead = tLogWriteAntiQuorum ? !validateAllCombinations(badCombo, primaryProcessesDead, tLogPolicy, primaryLocalitiesLeft, tLogWriteAntiQuorum, false) : primaryProcessesDead.validate(tLogPolicy);

if(!hasRemoteReplication) {
if(!primaryDcId.present()) {
tooManyDead = primaryTLogsDead || primaryProcessesDead.validate(storagePolicy);
notEnoughLeft = !primaryProcessesLeft.validate(tLogPolicy) || !primaryProcessesLeft.validate(storagePolicy);
} else {
bool remoteTLogsDead = tLogWriteAntiQuorum ? !validateAllCombinations(badCombo, remoteProcessesDead, tLogPolicy, remoteLocalitiesLeft, tLogWriteAntiQuorum, false) : remoteProcessesDead.validate(tLogPolicy);

if(!hasSatelliteReplication) {
tooManyDead = primaryTLogsDead || remoteTLogsDead || ( primaryProcessesDead.validate(storagePolicy) && remoteProcessesDead.validate(storagePolicy) );
notEnoughLeft = ( !primaryProcessesLeft.validate(tLogPolicy) || !primaryProcessesLeft.validate(storagePolicy) ) && ( !remoteProcessesLeft.validate(tLogPolicy) || !remoteProcessesLeft.validate(storagePolicy) );
if(hasRemoteReplication) {
tooManyDead = primaryTLogsDead || remoteTLogsDead || ( primaryProcessesDead.validate(storagePolicy) && remoteProcessesDead.validate(storagePolicy) );
} else {
tooManyDead = primaryTLogsDead || remoteTLogsDead || primaryProcessesDead.validate(storagePolicy) || remoteProcessesDead.validate(storagePolicy);
}
} else {
bool primarySatelliteTLogsDead = satelliteTLogWriteAntiQuorum ? !validateAllCombinations(badCombo, primarySatelliteProcessesDead, satelliteTLogPolicy, primarySatelliteLocalitiesLeft, satelliteTLogWriteAntiQuorum, false) : primarySatelliteProcessesDead.validate(satelliteTLogPolicy);
bool remoteSatelliteTLogsDead = satelliteTLogWriteAntiQuorum ? !validateAllCombinations(badCombo, remoteSatelliteProcessesDead, satelliteTLogPolicy, remoteSatelliteLocalitiesLeft, satelliteTLogWriteAntiQuorum, false) : remoteSatelliteProcessesDead.validate(satelliteTLogPolicy);

tooManyDead = ( primaryTLogsDead && primarySatelliteTLogsDead ) || ( remoteTLogsDead && remoteSatelliteTLogsDead ) || ( primaryProcessesDead.validate(storagePolicy) && remoteProcessesDead.validate(storagePolicy) );
notEnoughLeft = ( !primaryProcessesLeft.validate(tLogPolicy) || !primaryProcessesLeft.validate(storagePolicy) || !primarySatelliteProcessesLeft.validate(satelliteTLogPolicy) ) && ( !remoteProcessesLeft.validate(tLogPolicy) || !remoteProcessesLeft.validate(storagePolicy) || !remoteSatelliteProcessesLeft.validate(satelliteTLogPolicy) );
if(hasRemoteReplication) {
tooManyDead = ( primaryTLogsDead && primarySatelliteTLogsDead ) || ( remoteTLogsDead && remoteSatelliteTLogsDead ) || ( primaryProcessesDead.validate(storagePolicy) && remoteProcessesDead.validate(storagePolicy) );
} else {
tooManyDead = ( primaryTLogsDead && primarySatelliteTLogsDead ) || ( remoteTLogsDead && remoteSatelliteTLogsDead ) || primaryProcessesDead.validate(storagePolicy) || remoteProcessesDead.validate(storagePolicy);
}
}
}

Expand Down
Loading