Skip to content

Commit 28b9b31

Browse files
committed
kvserverbase: update validation check for LoadBasedRebalancingMode
Previously, we introduced LBRebalancingMultiMetricOnly and renamed LBRebalancingMultiMetric to LBRebalancingMultiMetricAndCount. However, a hardcoded enum string check in the cluster setting was overlooked and not updated. This commit fixes that by updating the check correctly.
1 parent 0f058aa commit 28b9b31

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<tr><td><div id="setting-jobs-retention-time" class="anchored"><code>jobs.retention_time</code></div></td><td>duration</td><td><code>336h0m0s</code></td><td>the amount of time for which records for completed jobs are retained</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
8787
<tr><td><div id="setting-kv-allocator-lease-rebalance-threshold" class="anchored"><code>kv.allocator.lease_rebalance_threshold</code></div></td><td>float</td><td><code>0.05</code></td><td>minimum fraction away from the mean a store&#39;s lease count can be before it is considered for lease-transfers</td><td>Advanced/Self-Hosted</td></tr>
8888
<tr><td><div id="setting-kv-allocator-load-based-lease-rebalancing-enabled" class="anchored"><code>kv.allocator.load_based_lease_rebalancing.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>set to enable rebalancing of range leases based on load and latency</td><td>Advanced/Self-Hosted</td></tr>
89-
<tr><td><div id="setting-kv-allocator-load-based-rebalancing" class="anchored"><code>kv.allocator.load_based_rebalancing</code></div></td><td>enumeration</td><td><code>leases and replicas</code></td><td>whether to rebalance based on the distribution of load across stores [off = 0, leases = 1, leases and replicas = 2, multi-metric = 3, multi-metric and count = 4]</td><td>Advanced/Self-Hosted</td></tr>
89+
<tr><td><div id="setting-kv-allocator-load-based-rebalancing" class="anchored"><code>kv.allocator.load_based_rebalancing</code></div></td><td>enumeration</td><td><code>leases and replicas</code></td><td>whether to rebalance based on the distribution of load across stores [off = 0, leases = 1, leases and replicas = 2, multi-metric only = 3, multi-metric and count = 4]</td><td>Advanced/Self-Hosted</td></tr>
9090
<tr><td><div id="setting-kv-allocator-load-based-rebalancing-objective" class="anchored"><code>kv.allocator.load_based_rebalancing.objective</code></div></td><td>enumeration</td><td><code>cpu</code></td><td>what objective does the cluster use to rebalance; if set to `qps` the cluster will attempt to balance qps among stores, if set to `cpu` the cluster will attempt to balance cpu usage among stores [qps = 0, cpu = 1]</td><td>Advanced/Self-Hosted</td></tr>
9191
<tr><td><div id="setting-kv-allocator-load-based-rebalancing-interval" class="anchored"><code>kv.allocator.load_based_rebalancing_interval</code></div></td><td>duration</td><td><code>1m0s</code></td><td>the rough interval at which each store will check for load-based lease / replica rebalancing opportunities</td><td>Advanced/Self-Hosted</td></tr>
9292
<tr><td><div id="setting-kv-allocator-qps-rebalance-threshold" class="anchored"><code>kv.allocator.qps_rebalance_threshold</code></div></td><td>float</td><td><code>0.1</code></td><td>minimum fraction away from the mean a store&#39;s QPS (such as queries per second) can be before it is considered overfull or underfull</td><td>Advanced/Self-Hosted</td></tr>

pkg/kv/kvserver/kvserverbase/base.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@ var LoadBasedRebalancingMode = settings.RegisterEnumSetting(
129129
LBRebalancingOff: "off",
130130
LBRebalancingLeasesOnly: "leases",
131131
LBRebalancingLeasesAndReplicas: "leases and replicas",
132-
LBRebalancingMultiMetricOnly: "multi-metric",
132+
LBRebalancingMultiMetricOnly: "multi-metric only",
133133
LBRebalancingMultiMetricAndCount: "multi-metric and count",
134134
},
135135
settings.WithPublic,
136136
settings.WithValidateEnum(func(enumStr string) error {
137-
if buildutil.CrdbTestBuild || enumStr != "multi-metric" || allowMMA {
137+
isMMA := enumStr == "multi-metric and count" || enumStr == "multi-metric only"
138+
if buildutil.CrdbTestBuild || !isMMA || allowMMA {
138139
return nil
139140
}
140141
return unimplemented.NewWithIssue(

0 commit comments

Comments
 (0)