arunsarin85 opened a new pull request, #9912: URL: https://github.com/apache/ozone/pull/9912
## What changes were proposed in this pull request? HDDS-14827. Sync chart labels with sorted filesize data - insightsFilePlot Please describe your PR in detail: The bug is a label-value misalignment in the frontend chart rendering, introduced when the sorting step was added to the v2 insightsFilePlot.tsx component. In updatePlotData(), the code did three things in this order: Build fileCountMap from API data (insertion order = API response order) Compute fileCountValues (x-axis labels) from the unsorted map Sort fileCountMap by file size and store it in state ECharts then wired: x-axis labels → fileCountValues (derived from unsorted map) bar heights → fileCountMap.values() (derived from sorted map) These two arrays are in different orders, so each label gets the wrong bar height. When the API starts returning 100 GiB entries before smaller entries (which happens around 2500+ files, as the large bucket becomes dominant in the RocksDB iterator scan), the "64 GiB – 128 GiB" label ends up at index 0 while ECharts renders the small-file count at index 0 - and the tall bar for 100 GiB files gets the "512 KiB – 1 MiB" label. Fix In both insightsFilePlot.tsx (v2) and insights.tsx (legacy), the map is now sorted first, and only then are the x-axis labels computed - ensuring labels and bar values are always derived from the same ordered sequence. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-14827 ## How was this patch tested? Locally: Pre-requisites : Added the dummy data in db.json Volume | Bucket | fileSize (upper bound) | Count | Expected label -- | -- | -- | -- | -- voltpb | buck1pb | 137,438,953,472 (2³⁷) | 2857 | 64 GiB – 128 GiB voltpb | buck2pb | 137,438,953,472 (2³⁷) | 143 | 64 GiB – 128 GiB vol1 | bucket1–6 | 1024 – 131072 | various | 0 B – 128 KiB range vol2 | bucket7 | 1,048,576 (2²⁰) | 410 | 512 KiB – 1 MiB vol2 | bucket8 | 16,777,216 (2²⁴) | 94 | 8 MiB – 16 MiB vol3 | bucket9 | 134,217,728 (2²⁷) | 38 | 64 MiB – 128 MiB vol3 | bucket10 | 1024 | 217 | 0 B – 1 KiB 1. Navigate to Insights → File Size Distribution 2. Select voltpb from the Volumes dropdown — the tall bar (3000 files) should be labelled "64 GiB – 128 GiB", not "512 KiB – 1 MiB" 3. Select "All volumes" — bars should appear in ascending size order left-to-right with correct labels throughout <img width="795" height="790" alt="image" src="https://github.com/user-attachments/assets/f83e730e-9f4a-442e-bf0b-930eb1adea44" /> <img width="762" height="794" alt="image" src="https://github.com/user-attachments/assets/ac8e3706-e7b9-4803-a282-a412b6e3d94f" /> -- 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]
