Merge pull request #4838 from sfc-gh-xwang/ppwiggle

perpetual storage wiggling command line support
This commit is contained in:
Markus Pilman 2021-05-24 14:48:00 -06:00 committed by GitHub
commit e1254d38a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 34 additions and 9 deletions

2
.gitignore vendored
View File

@ -7,7 +7,7 @@ bindings/java/foundationdb-client*.jar
bindings/java/foundationdb-tests*.jar bindings/java/foundationdb-tests*.jar
bindings/java/fdb-java-*-sources.jar bindings/java/fdb-java-*-sources.jar
packaging/msi/FDBInstaller.msi packaging/msi/FDBInstaller.msi
builds/
# Generated source, build, and packaging files # Generated source, build, and packaging files
*.g.cpp *.g.cpp
*.g.h *.g.h

View File

@ -496,7 +496,8 @@ void initHelp() {
helpMap["configure"] = CommandHelp( helpMap["configure"] = CommandHelp(
"configure [new] " "configure [new] "
"<single|double|triple|three_data_hall|three_datacenter|ssd|memory|memory-radixtree-beta|proxies=<PROXIES>|" "<single|double|triple|three_data_hall|three_datacenter|ssd|memory|memory-radixtree-beta|proxies=<PROXIES>|"
"commit_proxies=<COMMIT_PROXIES>|grv_proxies=<GRV_PROXIES>|logs=<LOGS>|resolvers=<RESOLVERS>>*", "commit_proxies=<COMMIT_PROXIES>|grv_proxies=<GRV_PROXIES>|logs=<LOGS>|resolvers=<RESOLVERS>>*|"
"perpetual_storage_wiggle=<WIGGLE_SPEED>",
"change the database configuration", "change the database configuration",
"The `new' option, if present, initializes a new database with the given configuration rather than changing " "The `new' option, if present, initializes a new database with the given configuration rather than changing "
"the configuration of an existing one. When used, both a redundancy mode and a storage engine must be " "the configuration of an existing one. When used, both a redundancy mode and a storage engine must be "
@ -517,8 +518,11 @@ void initHelp() {
"1, or set to -1 which restores the number of GRV proxies to the default value.\n\nlogs=<LOGS>: Sets the " "1, or set to -1 which restores the number of GRV proxies to the default value.\n\nlogs=<LOGS>: Sets the "
"desired number of log servers in the cluster. Must be at least 1, or set to -1 which restores the number of " "desired number of log servers in the cluster. Must be at least 1, or set to -1 which restores the number of "
"logs to the default value.\n\nresolvers=<RESOLVERS>: Sets the desired number of resolvers in the cluster. " "logs to the default value.\n\nresolvers=<RESOLVERS>: Sets the desired number of resolvers in the cluster. "
"Must be at least 1, or set to -1 which restores the number of resolvers to the default value.\n\nSee the " "Must be at least 1, or set to -1 which restores the number of resolvers to the default value.\n\n"
"FoundationDB Administration Guide for more information."); "perpetual_storage_wiggle=<WIGGLE_SPEED>: Set the value speed (a.k.a., the number of processes that the Data "
"Distributor should wiggle at a time). Currently, only 0 and 1 are supported. The value 0 means to disable the "
"perpetual storage wiggle.\n\n"
"See the FoundationDB Administration Guide for more information.");
helpMap["fileconfigure"] = CommandHelp( helpMap["fileconfigure"] = CommandHelp(
"fileconfigure [new] <FILENAME>", "fileconfigure [new] <FILENAME>",
"change the database configuration from a file", "change the database configuration from a file",
@ -2766,6 +2770,7 @@ void configureGenerator(const char* text, const char* line, std::vector<std::str
"grv_proxies=", "grv_proxies=",
"logs=", "logs=",
"resolvers=", "resolvers=",
"perpetual_storage_wiggle=",
nullptr }; nullptr };
arrayGenerator(text, line, opts, lc); arrayGenerator(text, line, opts, lc);
} }

View File

@ -43,6 +43,7 @@ void DatabaseConfiguration::resetInternal() {
remoteDesiredTLogCount = -1; remoteDesiredTLogCount = -1;
remoteTLogReplicationFactor = repopulateRegionAntiQuorum = 0; remoteTLogReplicationFactor = repopulateRegionAntiQuorum = 0;
backupWorkerEnabled = false; backupWorkerEnabled = false;
perpetualStorageWiggleSpeed = 0;
} }
void parse(int* i, ValueRef const& v) { void parse(int* i, ValueRef const& v) {
@ -194,9 +195,9 @@ bool DatabaseConfiguration::isValid() const {
getDesiredRemoteLogs() >= 1 && remoteTLogReplicationFactor >= 0 && repopulateRegionAntiQuorum >= 0 && getDesiredRemoteLogs() >= 1 && remoteTLogReplicationFactor >= 0 && repopulateRegionAntiQuorum >= 0 &&
repopulateRegionAntiQuorum <= 1 && usableRegions >= 1 && usableRegions <= 2 && regions.size() <= 2 && repopulateRegionAntiQuorum <= 1 && usableRegions >= 1 && usableRegions <= 2 && regions.size() <= 2 &&
(usableRegions == 1 || regions.size() == 2) && (regions.size() == 0 || regions[0].priority >= 0) && (usableRegions == 1 || regions.size() == 2) && (regions.size() == 0 || regions[0].priority >= 0) &&
(regions.size() == 0 || (regions.size() == 0 || tLogPolicy->info() != "dcid^2 x zoneid^2 x 1") &&
tLogPolicy->info() != // We cannot specify regions with three_datacenter replication
"dcid^2 x zoneid^2 x 1"))) { // We cannot specify regions with three_datacenter replication (perpetualStorageWiggleSpeed == 0 || perpetualStorageWiggleSpeed == 1))) {
return false; return false;
} }
std::set<Key> dcIds; std::set<Key> dcIds;
@ -352,7 +353,7 @@ StatusObject DatabaseConfiguration::toJSON(bool noPolicies) const {
} }
result["backup_worker_enabled"] = (int32_t)backupWorkerEnabled; result["backup_worker_enabled"] = (int32_t)backupWorkerEnabled;
result["perpetual_storage_wiggle"] = perpetualStorageWiggleSpeed;
return result; return result;
} }
@ -499,6 +500,8 @@ bool DatabaseConfiguration::setInternal(KeyRef key, ValueRef value) {
parse(&repopulateRegionAntiQuorum, value); parse(&repopulateRegionAntiQuorum, value);
} else if (ck == LiteralStringRef("regions")) { } else if (ck == LiteralStringRef("regions")) {
parse(&regions, value); parse(&regions, value);
} else if (ck == LiteralStringRef("perpetual_storage_wiggle")) {
parse(&perpetualStorageWiggleSpeed, value);
} else { } else {
return false; return false;
} }

View File

@ -239,6 +239,9 @@ struct DatabaseConfiguration {
int32_t repopulateRegionAntiQuorum; int32_t repopulateRegionAntiQuorum;
std::vector<RegionInfo> regions; std::vector<RegionInfo> regions;
// Perpetual Storage Setting
int32_t perpetualStorageWiggleSpeed;
// Excluded servers (no state should be here) // Excluded servers (no state should be here)
bool isExcludedServer(NetworkAddressList) const; bool isExcludedServer(NetworkAddressList) const;
std::set<AddressExclusion> getExcludedServers() const; std::set<AddressExclusion> getExcludedServers() const;

View File

@ -134,6 +134,14 @@ std::map<std::string, std::string> configForToken(std::string const& mode) {
BinaryWriter::toValue(regionObj, IncludeVersion(ProtocolVersion::withRegionConfiguration())).toString(); BinaryWriter::toValue(regionObj, IncludeVersion(ProtocolVersion::withRegionConfiguration())).toString();
} }
if (key == "perpetual_storage_wiggle" && isInteger(value)) {
int ppWiggle = atoi(value.c_str());
if (ppWiggle >= 2 || ppWiggle < 0) {
printf("Error: Only 0 and 1 are valid values of perpetual_storage_wiggle at present.\n");
return out;
}
out[p + key] = value;
}
return out; return out;
} }

View File

@ -741,7 +741,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
"auto_logs":3, "auto_logs":3,
"commit_proxies":5, "commit_proxies":5,
"grv_proxies":1, "grv_proxies":1,
"backup_worker_enabled":1 "backup_worker_enabled":1,
"perpetual_storage_wiggle":0
}, },
"data":{ "data":{
"least_operating_space_bytes_log_server":0, "least_operating_space_bytes_log_server":0,

View File

@ -594,6 +594,9 @@ ProcessClass decodeProcessClassValue(ValueRef const& value) {
const KeyRangeRef configKeys(LiteralStringRef("\xff/conf/"), LiteralStringRef("\xff/conf0")); const KeyRangeRef configKeys(LiteralStringRef("\xff/conf/"), LiteralStringRef("\xff/conf0"));
const KeyRef configKeysPrefix = configKeys.begin; const KeyRef configKeysPrefix = configKeys.begin;
const KeyRef perpetualStorageWiggleKey(LiteralStringRef("\xff/conf/perpetual_storage_wiggle"));
const KeyRef wigglingStorageServerKey(LiteralStringRef("\xff/storageWigglePID"));
const KeyRef triggerDDTeamInfoPrintKey(LiteralStringRef("\xff/triggerDDTeamInfoPrint")); const KeyRef triggerDDTeamInfoPrintKey(LiteralStringRef("\xff/triggerDDTeamInfoPrint"));
const KeyRangeRef excludedServersKeys(LiteralStringRef("\xff/conf/excluded/"), LiteralStringRef("\xff/conf/excluded0")); const KeyRangeRef excludedServersKeys(LiteralStringRef("\xff/conf/excluded/"), LiteralStringRef("\xff/conf/excluded0"));

View File

@ -196,6 +196,8 @@ UID decodeProcessClassKeyOld(KeyRef const& key);
extern const KeyRangeRef configKeys; extern const KeyRangeRef configKeys;
extern const KeyRef configKeysPrefix; extern const KeyRef configKeysPrefix;
extern const KeyRef perpetualStorageWiggleKey;
extern const KeyRef wigglingStorageServerKey;
// Change the value of this key to anything and that will trigger detailed data distribution team info log. // Change the value of this key to anything and that will trigger detailed data distribution team info log.
extern const KeyRef triggerDDTeamInfoPrintKey; extern const KeyRef triggerDDTeamInfoPrintKey;