waterWang opened a new pull request, #17767:
URL: https://github.com/apache/iceberg/pull/17767

   Detect duplicate page tokens in `RESTSessionCatalog` pagination to prevent 
infinite loops when a REST catalog server returns a repeated `next-page-token`.
   
   ### Problem
   `RESTSessionCatalog.listTables()`, `listNamespaces()`, and `listViews()` all 
use a `do-while` loop that continues as long as `nextPageToken != null`. If a 
REST catalog server returns a token that the client has already seen, the loop 
never terminates — each repeated response is also added to the result builder, 
so memory use and request volume grow unbounded.
   
   ### Fix
   Track every page token used by each listing call with a `HashSet<String>`. 
If the set already contains the token, throw `IllegalStateException` with a 
clear error message before the next request.
   
   ### Changes
   - `RESTSessionCatalog.java`: Added `seenPageTokens` set and duplicate 
detection guard to `listTables()`, `listNamespaces()`, and `listViews()`
   - `TestDuplicatePageToken.java`: New test class verifying all three methods 
throw on a repeated page token
   


-- 
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]

Reply via email to