From 8b1f9f733749ffc347543152fe101d47c2427701 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Tue, 11 May 2021 00:05:08 +0000 Subject: [PATCH 1/4] Add command line support --- .gitignore | 2 +- fdbcli/fdbcli.actor.cpp | 11 ++++++++--- fdbclient/DatabaseConfiguration.cpp | 11 +++++++---- fdbclient/DatabaseConfiguration.h | 3 +++ fdbclient/ManagementAPI.actor.cpp | 8 ++++++++ 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 2b74cc1f7c..f555965fab 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ bindings/java/foundationdb-client*.jar bindings/java/foundationdb-tests*.jar bindings/java/fdb-java-*-sources.jar packaging/msi/FDBInstaller.msi - +builds/ # Generated source, build, and packaging files *.g.cpp *.g.h diff --git a/fdbcli/fdbcli.actor.cpp b/fdbcli/fdbcli.actor.cpp index d10da845ec..7f1bb3b735 100644 --- a/fdbcli/fdbcli.actor.cpp +++ b/fdbcli/fdbcli.actor.cpp @@ -496,7 +496,8 @@ void initHelp() { helpMap["configure"] = CommandHelp( "configure [new] " "|" - "commit_proxies=|grv_proxies=|logs=|resolvers=>*", + "commit_proxies=|grv_proxies=|logs=|resolvers=>*|" + "perpetual_storage_wiggle=", "change the database configuration", "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 " @@ -517,8 +518,11 @@ void initHelp() { "1, or set to -1 which restores the number of GRV proxies to the default value.\n\nlogs=: Sets the " "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=: 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 " - "FoundationDB Administration Guide for more information."); + "Must be at least 1, or set to -1 which restores the number of resolvers to the default value.\n\n" + "perpetual_storage_wiggle=: 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( "fileconfigure [new] ", "change the database configuration from a file", @@ -2766,6 +2770,7 @@ void configureGenerator(const char* text, const char* line, std::vectorinfo() != "dcid^2 x zoneid^2 x 1") && + // We cannot specify regions with three_datacenter replication + (perpetualStorageWiggleSpeed == 0 || perpetualStorageWiggleSpeed == 1))) { return false; } std::set dcIds; @@ -352,7 +353,7 @@ StatusObject DatabaseConfiguration::toJSON(bool noPolicies) const { } result["backup_worker_enabled"] = (int32_t)backupWorkerEnabled; - + result["perpetual_storage_wiggle"] = perpetualStorageWiggleSpeed; return result; } @@ -499,6 +500,8 @@ bool DatabaseConfiguration::setInternal(KeyRef key, ValueRef value) { parse(&repopulateRegionAntiQuorum, value); } else if (ck == LiteralStringRef("regions")) { parse(®ions, value); + } else if (ck == LiteralStringRef("perpetual_storage_wiggle")) { + parse(&perpetualStorageWiggleSpeed, value); } else { return false; } diff --git a/fdbclient/DatabaseConfiguration.h b/fdbclient/DatabaseConfiguration.h index bc64a6c9c5..ef539f40b0 100644 --- a/fdbclient/DatabaseConfiguration.h +++ b/fdbclient/DatabaseConfiguration.h @@ -239,6 +239,9 @@ struct DatabaseConfiguration { int32_t repopulateRegionAntiQuorum; std::vector regions; + // Perpetual Storage Setting + int32_t perpetualStorageWiggleSpeed; + // Excluded servers (no state should be here) bool isExcludedServer(NetworkAddressList) const; std::set getExcludedServers() const; diff --git a/fdbclient/ManagementAPI.actor.cpp b/fdbclient/ManagementAPI.actor.cpp index 90d670e801..f53cf65828 100644 --- a/fdbclient/ManagementAPI.actor.cpp +++ b/fdbclient/ManagementAPI.actor.cpp @@ -134,6 +134,14 @@ std::map configForToken(std::string const& mode) { 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; } From 6065d247f86e12988cdab05a1adc910a8abc7ea4 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Mon, 17 May 2021 20:22:27 +0000 Subject: [PATCH 2/4] fix perpetualStorageWiggleKey --- fdbclient/SystemData.cpp | 3 +++ fdbclient/SystemData.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/fdbclient/SystemData.cpp b/fdbclient/SystemData.cpp index 314df8930b..fd8d2faa9f 100644 --- a/fdbclient/SystemData.cpp +++ b/fdbclient/SystemData.cpp @@ -594,6 +594,9 @@ ProcessClass decodeProcessClassValue(ValueRef const& value) { const KeyRangeRef configKeys(LiteralStringRef("\xff/conf/"), LiteralStringRef("\xff/conf0")); const KeyRef configKeysPrefix = configKeys.begin; +const KeyRef perpetualStorageWiggleKey(LiteralStringRef("\xff/conf/perpetual_storage_wiggle")); +const KeyRef wigglingStorageServerKey(LiteralStringRef("\xff/storageWiggleUID")); + const KeyRef triggerDDTeamInfoPrintKey(LiteralStringRef("\xff/triggerDDTeamInfoPrint")); const KeyRangeRef excludedServersKeys(LiteralStringRef("\xff/conf/excluded/"), LiteralStringRef("\xff/conf/excluded0")); diff --git a/fdbclient/SystemData.h b/fdbclient/SystemData.h index e7a54e632c..79efb688c8 100644 --- a/fdbclient/SystemData.h +++ b/fdbclient/SystemData.h @@ -196,6 +196,8 @@ UID decodeProcessClassKeyOld(KeyRef const& key); extern const KeyRangeRef configKeys; 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. extern const KeyRef triggerDDTeamInfoPrintKey; From 93c809764f647a173adf73bcab6990c276213302 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Wed, 19 May 2021 23:52:16 +0000 Subject: [PATCH 3/4] fix Schema check error --- fdbclient/Schemas.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdbclient/Schemas.cpp b/fdbclient/Schemas.cpp index 682ddc9c9a..ae85799e85 100644 --- a/fdbclient/Schemas.cpp +++ b/fdbclient/Schemas.cpp @@ -727,7 +727,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema( "auto_logs":3, "commit_proxies":5, "grv_proxies":1, - "backup_worker_enabled":1 + "backup_worker_enabled":1, + "perpetual_storage_wiggle":0 }, "data":{ "least_operating_space_bytes_log_server":0, From a57061a5ed0de7b8ce9c60f40c0e31b4ee2f94d7 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Thu, 20 May 2021 00:06:53 +0000 Subject: [PATCH 4/4] change UID to PID meaning Process ID --- fdbclient/SystemData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdbclient/SystemData.cpp b/fdbclient/SystemData.cpp index fd8d2faa9f..0f035b745c 100644 --- a/fdbclient/SystemData.cpp +++ b/fdbclient/SystemData.cpp @@ -595,7 +595,7 @@ const KeyRangeRef configKeys(LiteralStringRef("\xff/conf/"), LiteralStringRef("\ const KeyRef configKeysPrefix = configKeys.begin; const KeyRef perpetualStorageWiggleKey(LiteralStringRef("\xff/conf/perpetual_storage_wiggle")); -const KeyRef wigglingStorageServerKey(LiteralStringRef("\xff/storageWiggleUID")); +const KeyRef wigglingStorageServerKey(LiteralStringRef("\xff/storageWigglePID")); const KeyRef triggerDDTeamInfoPrintKey(LiteralStringRef("\xff/triggerDDTeamInfoPrint"));