Reject out-of-range WLM node threshold updates at validation time - #22649
Reject out-of-range WLM node threshold updates at validation time#22649dzane17 wants to merge 3 commits into
Conversation
Signed-off-by: David Zane <davizane@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit 56e8d35)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 56e8d35
Previous suggestionsSuggestions up to commit 9a3ccc8
|
|
❌ Gradle check result for 9a3ccc8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
@jainankitk @rajiv-kv @kaushalmahi12 |
Signed-off-by: David Zane <davizane@amazon.com>
|
Persistent review updated to latest commit 56e8d35 |
|
❌ Gradle check result for 56e8d35: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
The four node-level WLM threshold settings —
wlm.workload_group.node.{cpu,memory}_{rejection,cancellation}_threshold— had their range checks (max value, and therejection <= cancellationordering invariant) enforced only inside their settings-update consumers (the setters registered viaaddSettingsUpdateConsumer).Cluster settings updates are validated by a dry run (
ClusterSettings.validateUpdate/validate) that runs each setting's parser and itsSetting.Validator, but not its update consumer. The consumer runs later, when the committed cluster state is applied. So an out-of-range value (e.g.cpu_cancellation_threshold = 0.98, above the 0.95 max) passed validation, was committed to cluster state, and only threwIllegalArgumentExceptionat apply time. On the elected cluster-manager that aborts cluster-state application, causing it to step down and re-elect repeatedly; because the bad value is already persisted, a corrective update cannot be published either.This change attaches a
Setting.Validatorto each of the four settings so the bounds and ordering invariant are enforced at validation time — the update is rejected up front with a400and never committed. Key points:rejection <= cancellationordering invariant is enforced only in the validator (against the final, consistent settings) and at startup in the constructor — deliberately not in the setters. Consumers are applied one setting at a time, so a setter checking ordering against the sibling's not-yet-updated field would throw when both thresholds are lowered together (a consistent final state), reintroducing the same apply-time failure.Related Issues
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.