summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-08-16 11:29:02 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-08-16 11:29:02 +0000
commit7aeb25653d623f12aa7eac23c000a544c4a30c4a (patch)
tree79673a63b994719279af23bf76cd33698876cb45 /storage
parent28912325d52e239e1563cc5004723de8d650ac25 (diff)
Drop number of anonymous namespaces by grouping related methods together.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/distributor/statecheckers.cpp80
1 files changed, 34 insertions, 46 deletions
diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp
index 6f453ca417b..f3a9080b800 100644
--- a/storage/src/vespa/storage/distributor/statecheckers.cpp
+++ b/storage/src/vespa/storage/distributor/statecheckers.cpp
@@ -195,6 +195,36 @@ isInconsistentlySplit(const StateChecker::Context& c)
return (c.entries.size() > 1);
}
+// We don't want to invoke joins on buckets that have more replicas than
+// required. This is in particular because joins cause ideal states to change
+// for the target buckets and trigger merges. Since the removal of the non-
+// ideal replicas is done by the DeleteBuckets state-checker, it will become
+// preempted by potential follow-up joins unless we explicitly avoid these.
+bool
+contextBucketHasTooManyReplicas(const StateChecker::Context& c)
+{
+ return (c.entry->getNodeCount() > c.distribution.getRedundancy());
+}
+
+bool
+bucketAtDistributionBitLimit(const document::BucketId& bucket, const StateChecker::Context& c)
+{
+ return (bucket.getUsedBits() <= std::max(uint32_t(c.systemState.getDistributionBitCount()),
+ c.distributorConfig.getMinimalBucketSplit()));
+}
+
+bool
+legalBucketSplitLevel(const document::BucketId& bucket, const StateChecker::Context& c)
+{
+ return bucket.getUsedBits() >= c.distributorConfig.getMinimalBucketSplit();
+}
+
+bool
+bucketHasMultipleChildren(const document::BucketId& bucket, const StateChecker::Context& c)
+{
+ return c.db.childCount(bucket) > 1;
+}
+
} // anon ns
bool
@@ -254,28 +284,6 @@ JoinBucketsStateChecker::singleBucketJoinIsEnabled(const Context& c)
return c.distributorConfig.getEnableJoinForSiblingLessBuckets();
}
-namespace {
-
-// We don't want to invoke joins on buckets that have more replicas than
-// required. This is in particular because joins cause ideal states to change
-// for the target buckets and trigger merges. Since the removal of the non-
-// ideal replicas is done by the DeleteBuckets state-checker, it will become
-// preempted by potential follow-up joins unless we explicitly avoid these.
-bool
-contextBucketHasTooManyReplicas(const StateChecker::Context& c)
-{
- return (c.entry->getNodeCount() > c.distribution.getRedundancy());
-}
-
-bool
-bucketAtDistributionBitLimit(const document::BucketId& bucket, const StateChecker::Context& c)
-{
- return (bucket.getUsedBits() <= std::max(uint32_t(c.systemState.getDistributionBitCount()),
- c.distributorConfig.getMinimalBucketSplit()));
-}
-
-}
-
bool
JoinBucketsStateChecker::shouldJoin(const Context& c)
{
@@ -369,22 +377,6 @@ JoinBucketsStateChecker::smallEnoughToJoin(const Context& c)
return true;
}
-namespace {
-
-bool
-legalBucketSplitLevel(const document::BucketId& bucket, const StateChecker::Context& c)
-{
- return bucket.getUsedBits() >= c.distributorConfig.getMinimalBucketSplit();
-}
-
-bool
-bucketHasMultipleChildren(const document::BucketId& bucket, const StateChecker::Context& c)
-{
- return c.db.childCount(bucket) > 1;
-}
-
-}
-
document::Bucket
JoinBucketsStateChecker::computeJoinBucket(const Context& c)
{
@@ -490,12 +482,6 @@ SplitInconsistentStateChecker::getReason(const document::BucketId& bucketId, con
return reason.str();
}
-namespace {
-
-
-
-}
-
StateChecker::Result
SplitInconsistentStateChecker::check(Context& c) const
{
@@ -517,7 +503,8 @@ SplitInconsistentStateChecker::check(Context& c) const
namespace {
-bool containsMaintenanceNode(ConstNodesRef ideal, const StateChecker::Context& c)
+bool
+containsMaintenanceNode(ConstNodesRef ideal, const StateChecker::Context& c)
{
for (uint16_t n : ideal) {
if (c.systemState.getNodeState(lib::Node(lib::NodeType::STORAGE, n)).getState() == lib::State::MAINTENANCE) {
@@ -527,7 +514,8 @@ bool containsMaintenanceNode(ConstNodesRef ideal, const StateChecker::Context& c
return false;
}
-bool ideal_node_is_unavailable_in_pending_state(const StateChecker::Context& c) {
+bool
+ideal_node_is_unavailable_in_pending_state(const StateChecker::Context& c) {
if (!c.pending_cluster_state) {
return false;
}