diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-03-23 14:21:54 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-03-23 14:21:54 +0000 |
commit | 1bf4da826021c74155aff58c34a010fb870eb9af (patch) | |
tree | fa29e7dac5858e8349bbf686a7d7962d4541bff6 /storage | |
parent | 3cac0e5276c9fb7006e1752baa2d5cb716eae693 (diff) |
Constify getDerivedNodeState() method.
Remove useWantedStateIfPossible parameter to deriveNodeState().
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/storageserver/bouncer.cpp | 20 | ||||
-rw-r--r-- | storage/src/vespa/storage/storageserver/bouncer.h | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/storage/src/vespa/storage/storageserver/bouncer.cpp b/storage/src/vespa/storage/storageserver/bouncer.cpp index 620376cfb1d..2f8838d14eb 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.cpp +++ b/storage/src/vespa/storage/storageserver/bouncer.cpp @@ -288,15 +288,12 @@ namespace { lib::NodeState deriveNodeState(const lib::NodeState &reportedNodeState, - const lib::NodeState ¤tNodeState, - bool useWantedStateIfPossible) + const lib::NodeState ¤tNodeState) { - if (useWantedStateIfPossible) { - // If current node state is more strict than our own reported state, - // set node state to our current state - if (reportedNodeState.getState().maySetWantedStateForThisNodeState(currentNodeState.getState())) { - return currentNodeState; - } + // If current node state is more strict than our own reported state, + // set node state to our current state + if (reportedNodeState.getState().maySetWantedStateForThisNodeState(currentNodeState.getState())) { + return currentNodeState; } return reportedNodeState; } @@ -312,17 +309,16 @@ Bouncer::handleNewState() const auto &clusterState = *clusterStateBundle->getBaselineClusterState(); _clusterState = &clusterState.getClusterState(); const lib::Node node(_component.getNodeType(), _component.getIndex()); - const bool useWantedStateIfPossible = _config->useWantedStateIfPossible; - _baselineNodeState = deriveNodeState(reportedNodeState, clusterState.getNodeState(node), useWantedStateIfPossible); + _baselineNodeState = deriveNodeState(reportedNodeState, clusterState.getNodeState(node)); _derivedNodeStates.clear(); for (const auto &derivedClusterState : clusterStateBundle->getDerivedClusterStates()) { _derivedNodeStates[derivedClusterState.first] = - deriveNodeState(reportedNodeState, derivedClusterState.second->getNodeState(node), useWantedStateIfPossible); + deriveNodeState(reportedNodeState, derivedClusterState.second->getNodeState(node)); } } const lib::NodeState & -Bouncer::getDerivedNodeState(document::BucketSpace bucketSpace) +Bouncer::getDerivedNodeState(document::BucketSpace bucketSpace) const { auto itr = _derivedNodeStates.find(bucketSpace); if (itr != _derivedNodeStates.end()) { diff --git a/storage/src/vespa/storage/storageserver/bouncer.h b/storage/src/vespa/storage/storageserver/bouncer.h index a5646a12787..83c0c82ff57 100644 --- a/storage/src/vespa/storage/storageserver/bouncer.h +++ b/storage/src/vespa/storage/storageserver/bouncer.h @@ -87,7 +87,7 @@ private: bool onDown(const std::shared_ptr<api::StorageMessage>&) override; void handleNewState() override; - const lib::NodeState &getDerivedNodeState(document::BucketSpace bucketSpace); + const lib::NodeState &getDerivedNodeState(document::BucketSpace bucketSpace) const; }; |