aboutsummaryrefslogtreecommitdiffstats
path: root/configd
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-06-04 14:07:10 +0000
committerArne Juul <arnej@verizonmedia.com>2021-06-04 14:07:10 +0000
commitdae3aad759563085301d651c438eb783c271c27e (patch)
treee7ac19d1e0eeecec53cb1520c701ad259bfcf3c1 /configd
parentc585fcd3e4732c8f0c7b0ad85e3602d2a5e9d61c (diff)
minor fixes after review
Diffstat (limited to 'configd')
-rw-r--r--configd/src/apps/sentinel/connectivity.cpp13
-rw-r--r--configd/src/apps/sentinel/connectivity.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/configd/src/apps/sentinel/connectivity.cpp b/configd/src/apps/sentinel/connectivity.cpp
index 4ba16f95e15..9cced1d3475 100644
--- a/configd/src/apps/sentinel/connectivity.cpp
+++ b/configd/src/apps/sentinel/connectivity.cpp
@@ -67,7 +67,6 @@ std::map<std::string, std::string> specsFrom(const ModelConfig &model) {
Connectivity::CheckResult
Connectivity::checkConnectivity(const ModelConfig &model) {
- CheckResult result{false, false, {}};
const auto checkSpecs = specsFrom(model);
size_t clusterSize = checkSpecs.size();
OutwardCheckContext checkContext(clusterSize,
@@ -83,12 +82,9 @@ Connectivity::checkConnectivity(const ModelConfig &model) {
size_t numFailedReverse = 0;
bool allChecksOk = true;
for (const auto & [hostname, check] : connectivityMap) {
+ LOG_ASSERT(check.result() != CcResult::UNKNOWN);
if (check.result() == CcResult::CONN_FAIL) ++numFailedConns;
if (check.result() == CcResult::REVERSE_FAIL) ++numFailedReverse;
- if (check.result() == CcResult::UNKNOWN) {
- LOG(error, "Missing ConnectivityCheck result from %s", hostname.c_str());
- allChecksOk = false;
- }
}
if (numFailedReverse > size_t(_config.maxBadReverseCount)) {
LOG(warning, "%zu of %zu nodes report problems connecting to me (max is %d)",
@@ -96,17 +92,20 @@ Connectivity::checkConnectivity(const ModelConfig &model) {
allChecksOk = false;
}
if (numFailedConns * 100.0 > _config.maxBadOutPercent * clusterSize) {
- double pct = numFailedConns * 100ul / clusterSize;
+ double pct = numFailedConns * 100.0 / clusterSize;
LOG(warning, "Problems connecting to %zu of %zu nodes, %.2f %% (max is %d)",
numFailedConns, clusterSize, pct, _config.maxBadOutPercent);
allChecksOk = false;
}
+ std::vector<std::string> details;
for (const auto & [hostname, check] : connectivityMap) {
std::string detail = fmt("%s -> %s", hostname.c_str(), toString(check.result()));
- result.details.push_back(detail);
+ details.push_back(detail);
}
+ CheckResult result{false, false, {}};
result.enoughOk = allChecksOk;
result.allOk = (numFailedConns == 0) && (numFailedReverse == 0);
+ result.details = std::move(details);
return result;
}
diff --git a/configd/src/apps/sentinel/connectivity.h b/configd/src/apps/sentinel/connectivity.h
index d2ec075b75e..0e32b5243e0 100644
--- a/configd/src/apps/sentinel/connectivity.h
+++ b/configd/src/apps/sentinel/connectivity.h
@@ -29,7 +29,7 @@ public:
CheckResult checkConnectivity(const ModelConfig &model);
private:
- const SentinelConfig::Connectivity & _config;
+ const SentinelConfig::Connectivity _config;
RpcServer &_rpcServer;
};