summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-03-23 15:05:16 +0000
committerGeir Storli <geirst@oath.com>2018-03-23 15:05:16 +0000
commitca284490120ff726fd1e86910aaa14626b91b4e7 (patch)
tree33aa584ba8d0c50c1705ab723344022fcdb077f6 /storage
parent2195b89a872190087899ad9143ba0c2e5ce356ba (diff)
Simplify.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/storageserver/statemanager.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp
index 7a9d4247c91..e643350aa65 100644
--- a/storage/src/vespa/storage/storageserver/statemanager.cpp
+++ b/storage/src/vespa/storage/storageserver/statemanager.cpp
@@ -363,29 +363,23 @@ using BucketSpaceToTransitionString = std::unordered_map<document::BucketSpace,
document::BucketSpace::hash>;
void
-considerInsertTransitionString(const document::BucketSpace &bucketSpace,
- const lib::State &lhsDerived,
- const lib::State &rhsDerived,
- BucketSpaceToTransitionString &transitions)
+considerInsertDerivedTransition(const lib::State &currentBaseline,
+ const lib::State &newBaseline,
+ const lib::State &currentDerived,
+ const lib::State &newDerived,
+ const document::BucketSpace &bucketSpace,
+ BucketSpaceToTransitionString &transitions)
{
- if (transitions.find(bucketSpace) == transitions.end()) {
+ bool considerDerivedTransition = ((currentDerived != newDerived) &&
+ ((currentDerived != currentBaseline) || (newDerived != newBaseline)));
+ if (considerDerivedTransition && (transitions.find(bucketSpace) == transitions.end())) {
transitions[bucketSpace] = vespalib::make_string("%s space: '%s' to '%s'",
document::FixedBucketSpaces::to_string(bucketSpace).c_str(),
- lhsDerived.getName().c_str(),
- rhsDerived.getName().c_str());
+ currentDerived.getName().c_str(),
+ newDerived.getName().c_str());
}
}
-bool
-considerDerivedTransition(const lib::State &currentBaseline,
- const lib::State &newBaseline,
- const lib::State &currentDerived,
- const lib::State &newDerived)
-{
- return ((currentDerived != newDerived) &&
- ((currentDerived != currentBaseline) || (newDerived != newBaseline)));
-}
-
BucketSpaceToTransitionString
calculateDerivedClusterStateTransitions(const ClusterStateBundle &currentState,
const ClusterStateBundle &newState,
@@ -397,16 +391,12 @@ calculateDerivedClusterStateTransitions(const ClusterStateBundle &currentState,
for (const auto &entry : currentState.getDerivedClusterStates()) {
const lib::State &currentDerived = entry.second->getNodeState(node).getState();
const lib::State &newDerived = newState.getDerivedClusterState(entry.first)->getNodeState(node).getState();
- if (considerDerivedTransition(currentBaseline, newBaseline, currentDerived, newDerived)) {
- considerInsertTransitionString(entry.first, currentDerived, newDerived, result);
- }
+ considerInsertDerivedTransition(currentBaseline, newBaseline, currentDerived, newDerived, entry.first, result);
}
for (const auto &entry : newState.getDerivedClusterStates()) {
const lib::State &newDerived = entry.second->getNodeState(node).getState();
const lib::State &currentDerived = currentState.getDerivedClusterState(entry.first)->getNodeState(node).getState();
- if (considerDerivedTransition(currentBaseline, newBaseline, currentDerived, newDerived)) {
- considerInsertTransitionString(entry.first, currentDerived, newDerived, result);
- }
+ considerInsertDerivedTransition(currentBaseline, newBaseline, currentDerived, newDerived, entry.first, result);
}
return result;
}