Skip to content

HDDS-15438. [DiskBalancer] Validate persisted diskbalancer.info while reading YAML.#10395

Open
slfan1989 wants to merge 2 commits into
apache:masterfrom
slfan1989:HDDS-15438
Open

HDDS-15438. [DiskBalancer] Validate persisted diskbalancer.info while reading YAML.#10395
slfan1989 wants to merge 2 commits into
apache:masterfrom
slfan1989:HDDS-15438

Conversation

@slfan1989
Copy link
Copy Markdown
Contributor

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.

@ChenSammi ChenSammi requested a review from Gargi-jais11 June 1, 2026 04:57
.replace("operationalState: RUNNING\n", ""),
"DiskBalancer operationalState is missing"),
Arguments.of(validYaml()
.replace("threshold: 10.0\n", "threshold: 0.0\n"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add similar cases for bandwidth and parallelThread (zero values) since they follow the same validation path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Gargi-jais11
Copy link
Copy Markdown
Contributor

@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.

@slfan1989
Copy link
Copy Markdown
Contributor Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants