ArafatKhan2198 commented on PR #8796: URL: https://github.com/apache/ozone/pull/8796#issuecomment-3104237343
> Thanks @ArafatKhan2198 for the patch. Current impl looks good. But can you pls update the problem or issue with existing current implementation in your PR description ? ## **What was the problem earlier?** The unhealthy containers API had **broken pagination** - it only worked in one direction (forward). **The issue:** - Users could only click "Next" to see more containers - There was no way to go back to previous pages - If you were on page 3 and wanted to see page 2, you had to start over from the beginning - This made the UI unusable for browsing large lists of unhealthy containers **Why this was bad:** - Poor user experience - imagine trying to browse through 1000+ unhealthy containers - Inconsistent with other APIs that had proper pagination - Made the Recon UI containers page frustrating to use ## **How did we solve it?** We added **bidirectional pagination** by introducing two new parameters: 1. **`maxContainerId`** - for going backwards (Previous button) 2. **`minContainerId`** - for going forwards (Next button) ## **Explanation with Example:** **Before (broken):** ``` GET /unhealthy?limit=3&prevKey=6 ``` - Only could get containers with ID > 6 - No way to get containers with ID < 6 - Users stuck going only forward **After (fixed):** ``` # Forward pagination (Next button) GET /unhealthy?limit=3&minContainerId=6 # Returns containers with ID > 6: [7, 8, 9] # Backward pagination (Previous button) GET /unhealthy?limit=3&maxContainerId=6 # Returns containers with ID < 6: [3, 4, 5] ``` **Real-world scenario:** - You have 1000 unhealthy containers: [1, 2, 3, ..., 1000] - You're viewing containers [7, 8, 9] (page 3) - **Before:** Could only go to [10, 11, 12] (page 4), couldn't go back to [4, 5, 6] (page 2) - **After:** Can go both ways - to [10, 11, 12] OR back to [4, 5, 6] **The fix:** - Updated the database query logic to handle both directions - Added proper documentation explaining how to use each parameter - Made the API consistent with other paginated endpoints **Result:** - Users can now navigate both forward and backward through unhealthy containers - UI can have proper "Previous" and "Next" buttons - Much better user experience for browsing large datasets **In simple terms:** We fixed the pagination so users can go both ways instead of being stuck going only forward. -- 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]
