From f48ba989c38012236c022588f66ff612bb36ce58 Mon Sep 17 00:00:00 2001 From: Xiaoxi Wang Date: Tue, 1 Mar 2022 15:27:27 -0800 Subject: [PATCH] add status --- fdbclient/Schemas.cpp | 1 + fdbserver/DataDistributionQueue.actor.cpp | 3 ++- fdbserver/Status.actor.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fdbclient/Schemas.cpp b/fdbclient/Schemas.cpp index 2e9fcc53a6..5f74b2a502 100644 --- a/fdbclient/Schemas.cpp +++ b/fdbclient/Schemas.cpp @@ -699,6 +699,7 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema( "maintenance_seconds_remaining":1.0, "data_distribution_disabled_for_ss_failures":true, "data_distribution_disabled_for_rebalance":true, + "data_distribution_disabled_hex": "1", "data_distribution_disabled":true, "active_primary_dc":"pv", "bounce_impact":{ diff --git a/fdbserver/DataDistributionQueue.actor.cpp b/fdbserver/DataDistributionQueue.actor.cpp index 5333235610..55b3642d07 100644 --- a/fdbserver/DataDistributionQueue.actor.cpp +++ b/fdbserver/DataDistributionQueue.actor.cpp @@ -1577,7 +1577,8 @@ ACTOR Future BgDDValleyFiller(DDQueueData* self, int teamCollectionIndex) // reset loop interval rebalancePollingInterval = SERVER_KNOBS->BG_REBALANCE_POLLING_INTERVAL; } else if (val.present()) { - if (val.get().size() > 0) { + // FIXME: better way for upgrade? for example, using a new key to record mode + if (val.get().size() > sizeof(int)) { int ddIgnore = BinaryReader::fromStringRef(val.get(), Unversioned()); if (ddIgnore & DDIgnore::REBALANCE_DISK) { disableReadBalance = true; diff --git a/fdbserver/Status.actor.cpp b/fdbserver/Status.actor.cpp index 1c4ab387d8..01904cd00a 100644 --- a/fdbserver/Status.actor.cpp +++ b/fdbserver/Status.actor.cpp @@ -1535,6 +1535,8 @@ struct LoadConfigurationResult { Optional healthyZone; double healthyZoneSeconds; bool rebalanceDDIgnored; + // FIXME: possible convert it to int if upgrade value can be resolved? + std::string rebalanceDDIgnoreHex; // any or combination of 0, 1, 2, see enum DDIgnore; bool dataDistributionDisabled; LoadConfigurationResult() @@ -1609,6 +1611,9 @@ loadConfiguration(Database cx, JsonBuilderArray* messages, std::set } } res.rebalanceDDIgnored = rebalanceDDIgnored.get().present(); + if (res.rebalanceDDIgnored) { + res.rebalanceDDIgnoreHex = rebalanceDDIgnored.get().get().toHexString(); + } if (ddModeKey.get().present()) { BinaryReader rd(ddModeKey.get().get(), Unversioned()); int currentMode; @@ -2955,6 +2960,7 @@ ACTOR Future clusterGetStatus( } if (loadResult.get().rebalanceDDIgnored) { statusObj["data_distribution_disabled_for_rebalance"] = true; + statusObj["data_distribution_disabled_hex"] = loadResult.get().rebalanceDDIgnoreHex; } if (loadResult.get().dataDistributionDisabled) { statusObj["data_distribution_disabled"] = true;