slfan1989 opened a new pull request, #10562: URL: https://github.com/apache/ozone/pull/10562
## What changes were proposed in this pull request? This PR makes DiskBalancer report output stable when multiple datanodes have the same `currentVolumeDensitySum`. Previously, the report command collected successful datanode reports from `ConcurrentHashMap.values()` before sorting by density. Since `ConcurrentHashMap` does not preserve insertion order, datanodes with the same density could be displayed in an order different from the user-provided datanode order. This patch builds the report list according to the successful datanode order instead. The existing density sort is stable, so datanodes with different density values are still sorted by `currentVolumeDensitySum` in descending order, while datanodes with the same density keep the input order. ## What is the link to the Apache JIRA JIRA: HDDS-15628. [DiskBalancer] Preserve report output order for datanodes with the same density. ## How was this patch tested? Add Junit Test. For example, when running: ``` ozone admin datanode diskbalancer report host-2 host-1 ``` and both datanodes have the same density, the output should keep host-2 before host-1. Before the fix: ``` Report result: Datanode: host-1 (127.0.0.1:19864) Aggregate VolumeDataDensity: 14.09% ------- Datanode: host-2 (127.0.0.1:19864) Aggregate VolumeDataDensity: 14.09% ``` After the fix: ``` Report result: Datanode: host-2 (127.0.0.1:19864) Aggregate VolumeDataDensity: 14.09% ------- Datanode: host-1 (127.0.0.1:19864) Aggregate VolumeDataDensity: 14.09% ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
