HDDS-15438. [DiskBalancer] Validate persisted diskbalancer.info while reading YAML.#10395
HDDS-15438. [DiskBalancer] Validate persisted diskbalancer.info while reading YAML.#10395slfan1989 wants to merge 2 commits into
Conversation
| .replace("operationalState: RUNNING\n", ""), | ||
| "DiskBalancer operationalState is missing"), | ||
| Arguments.of(validYaml() | ||
| .replace("threshold: 10.0\n", "threshold: 0.0\n"), |
There was a problem hiding this comment.
Add similar cases for bandwidth and parallelThread (zero values) since they follow the same validation path.
There was a problem hiding this comment.
Thanks for the suggestion! I added zero-value YAML validation cases for both bandwidth and parallelThread, covering the same persisted configuration validation path as threshold.
|
@slfan1989 for any new DiskBalancer tickets, please create it as a sub-task under this umbrella ticket https://issues.apache.org/jira/browse/HDDS-15445 , it will be easy for us to track. |
@Gargi-jais11 Got it. I will create any new DiskBalancer JIRAs as sub-tasks under HDDS-15445 for easier tracking. |
What changes were proposed in this pull request?
This PR adds validation when DiskBalancer reads the persisted diskbalancer.info YAML file.
Previously, DiskBalancerYaml.readDiskBalancerInfoFile() could deserialize malformed persisted data and return a partially invalid DiskBalancerInfo. For example, missing operationalState, missing or unsupported version, or invalid configuration values such as an out-of-range threshold or non-movable container states were not rejected at the YAML read boundary. Such invalid data could fail later during service initialization or persistence, making the failure harder to diagnose.
What is the link to the Apache JIRA
JIRA: HDDS-15438. [DiskBalancer] Validate persisted diskbalancer.info while reading YAML.
How was this patch tested?
Add Junit Test.