mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 18:02:31 +08:00
added satellite_none and remote_none options to unconfigure from a fearless setup
fix: log_router configuration was broken
This commit is contained in:
parent
cb25564d38
commit
31b89a638f
@ -65,7 +65,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 == "satellite_logs") && isInteger(value) ) {
|
||||
if( (key == "logs" || key == "proxies" || key == "resolvers" || key == "remote_logs" || key == "satellite_logs" || key == "log_routers") && isInteger(value) ) {
|
||||
out[p+key] = value;
|
||||
}
|
||||
|
||||
@ -157,7 +157,11 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
|
||||
std::string remote_redundancy, remote_log_replicas;
|
||||
IRepPolicyRef remoteTLogPolicy;
|
||||
bool remoteRedundancySpecified = true;
|
||||
if (mode == "remote_single") {
|
||||
if (mode == "remote_none") {
|
||||
remote_redundancy="0";
|
||||
remote_log_replicas="0";
|
||||
remoteTLogPolicy = IRepPolicyRef();
|
||||
} else if (mode == "remote_single") {
|
||||
remote_redundancy="1";
|
||||
remote_log_replicas="1";
|
||||
remoteTLogPolicy = IRepPolicyRef(new PolicyOne());
|
||||
@ -180,8 +184,7 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
|
||||
if (remoteRedundancySpecified) {
|
||||
out[p+"remote_storage_replicas"] =
|
||||
out[p+"remote_storage_quorum"] = remote_redundancy;
|
||||
out[p+"remote_log_replicas"] =
|
||||
out[p+"log_routers"] = remote_log_replicas;
|
||||
out[p+"remote_log_replicas"] = remote_log_replicas;
|
||||
|
||||
BinaryWriter policyWriter(IncludeVersion());
|
||||
serializeReplicationPolicy(policyWriter, remoteTLogPolicy);
|
||||
@ -192,7 +195,12 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
|
||||
std::string satellite_log_replicas, satellite_anti_quorum, satellite_usable_dcs;
|
||||
IRepPolicyRef satelliteTLogPolicy;
|
||||
bool satelliteRedundancySpecified = true;
|
||||
if (mode == "one_satellite_single") {
|
||||
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";
|
||||
@ -240,13 +248,15 @@ std::map<std::string, std::string> configForToken( std::string const& mode ) {
|
||||
ConfigurationResult::Type buildConfiguration( std::vector<StringRef> const& modeTokens, std::map<std::string, std::string>& outConf ) {
|
||||
for(auto it : modeTokens) {
|
||||
std::string mode = it.toString();
|
||||
|
||||
auto m = configForToken( mode );
|
||||
if( !m.size() )
|
||||
if( !m.size() ) {
|
||||
TraceEvent(SevWarnAlways, "UnknownOption").detail("option", mode);
|
||||
return ConfigurationResult::UNKNOWN_OPTION;
|
||||
}
|
||||
|
||||
for( auto t = m.begin(); t != m.end(); ++t ) {
|
||||
if( outConf.count( t->first ) ) {
|
||||
TraceEvent(SevWarnAlways, "ConflictingOption").detail("option", printable(StringRef(t->first)));
|
||||
return ConfigurationResult::CONFLICTING_OPTIONS;
|
||||
}
|
||||
outConf[t->first] = t->second;
|
||||
@ -268,7 +278,6 @@ ConfigurationResult::Type buildConfiguration( std::vector<StringRef> const& mode
|
||||
serializeReplicationPolicy(policyWriter, logPolicy);
|
||||
outConf[p+"log_replication_policy"] = policyWriter.toStringRef().toString();
|
||||
}
|
||||
|
||||
return ConfigurationResult::SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -248,14 +248,16 @@ void serializeReplicationPolicy(Ar& ar, IRepPolicyRef& policy) {
|
||||
pointer->serialize(ar);
|
||||
policy = IRepPolicyRef(pointer);
|
||||
}
|
||||
else if(name == LiteralStringRef("None")) {
|
||||
policy = IRepPolicyRef();
|
||||
}
|
||||
else {
|
||||
TraceEvent(SevError, "SerializingInvalidPolicyType")
|
||||
.detailext("PolicyName", name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ASSERT(policy);
|
||||
std::string name = policy->name();
|
||||
std::string name = policy ? policy->name() : "None";
|
||||
Standalone<StringRef> nameRef = StringRef(name);
|
||||
ar & nameRef;
|
||||
if(name == "One") {
|
||||
@ -267,6 +269,7 @@ void serializeReplicationPolicy(Ar& ar, IRepPolicyRef& policy) {
|
||||
else if(name == "And") {
|
||||
((PolicyAnd*)policy.getPtr())->serialize(ar);
|
||||
}
|
||||
else if(name == "None") {}
|
||||
else {
|
||||
TraceEvent(SevError, "SerializingInvalidPolicyType")
|
||||
.detail("PolicyName", name);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
ISimulator() : desiredCoordinators(1), physicalDatacenters(1), processesPerMachine(0), isStopped(false), lastConnectionFailure(0), connectionFailuresDisableDuration(0), speedUpSimulation(false), allSwapsDisabled(false), backupAgents(WaitForType), extraDB(NULL) {}
|
||||
|
||||
// Order matters!
|
||||
enum KillType { None, KillInstantly, InjectFaults, RebootAndDelete, Reboot, RebootProcessAndDelete, RebootProcess };
|
||||
enum KillType { KillInstantly, InjectFaults, RebootAndDelete, RebootProcessAndDelete, Reboot, RebootProcess, None };
|
||||
|
||||
enum BackupAgentType { NoBackupAgents, WaitForType, BackupToFile, BackupToDB };
|
||||
|
||||
|
@ -118,7 +118,7 @@ struct DatabaseConfiguration {
|
||||
int32_t getDesiredLogs() const { if(desiredTLogCount == -1) return autoDesiredTLogCount; return desiredTLogCount; }
|
||||
int32_t getDesiredSatelliteLogs() const { if(satelliteDesiredTLogCount == -1) return autoDesiredTLogCount; return satelliteDesiredTLogCount; }
|
||||
int32_t getDesiredRemoteLogs() const { if(remoteDesiredTLogCount == -1) return autoDesiredTLogCount; return remoteDesiredTLogCount; }
|
||||
int32_t getDesiredLogRouters() const { if(desiredLogRouterCount == -1) return autoDesiredTLogCount; return desiredLogRouterCount; }
|
||||
int32_t getDesiredLogRouters() const { if(desiredLogRouterCount == -1) return getDesiredRemoteLogs(); return desiredLogRouterCount; }
|
||||
|
||||
bool operator == ( DatabaseConfiguration const& rhs ) const {
|
||||
const_cast<DatabaseConfiguration*>(this)->makeConfigurationImmutable();
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "LogSystem.h"
|
||||
#include "WaitFailure.h"
|
||||
#include "RecoveryState.h"
|
||||
#include "fdbrpc/simulator.h"
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
@ -567,7 +566,7 @@ ACTOR Future<Void> updateStorage( TLogData* self ) {
|
||||
state int totalSize = 0;
|
||||
|
||||
if(logData->stopped) {
|
||||
if (self->bytesInput - self->bytesDurable >= SERVER_KNOBS->TLOG_SPILL_THRESHOLD || (g_network->isSimulated() && g_simulator.speedUpSimulation)) {
|
||||
if (self->bytesInput - self->bytesDurable >= SERVER_KNOBS->TLOG_SPILL_THRESHOLD) {
|
||||
while(logData->persistentDataDurableVersion != logData->version.get()) {
|
||||
std::vector<std::pair<std::deque<std::pair<Version, LengthPrefixedStringRef>>::iterator, std::deque<std::pair<Version, LengthPrefixedStringRef>>::iterator>> iters;
|
||||
for(auto tag = logData->tag_data.begin(); tag != logData->tag_data.end(); ++tag)
|
||||
|
Loading…
x
Reference in New Issue
Block a user