Solaris-star opened a new pull request, #17429:
URL: https://github.com/apache/iceberg/pull/17429

   ## Summary
   
   Fixes #17427
   
   The reference REST server-side scan planning implementation retains all 
planned `FileScanTask` objects in the singleton `InMemoryPlanningState` even 
after clients have successfully fetched every plan task. Neither 
`fileScanTasksForPlanTask` nor `nextPlanTask` removes the fetched entries, and 
the state is only released via `cancelPlan`. Per the REST Catalog OpenAPI spec, 
cancellation is not required after all plan tasks have been fetched, so a 
successful fetch lifecycle must release state without an explicit cancel 
request.
   
   ## Fix
   
   Add two methods to `InMemoryPlanningState`:
   
   - **`releasePlanTask(planTaskKey)`** — removes a single fetched plan task's 
`FileScanTask` list and next-task link
   - **`releaseAsyncPlanForTask(planTaskKey)`** — removes the async planning 
state when the last plan task in a chain is fetched (extracts the planId from 
the key format `{planId}-{tableId}-{sequence}`)
   
   Call both from `CatalogHandlers.fetchScanTasks` after building the response:
   
   ```java
   IN_MEMORY_PLANNING_STATE.releasePlanTask(planTask);
   if (nextPlanTasks.isEmpty()) {
     IN_MEMORY_PLANNING_STATE.releaseAsyncPlanForTask(planTask);
   }
   ```
   
   ## Tests
   
   Added `TestInMemoryPlanningState` with 4 unit tests:
   
   - `releasePlanTask` removes both file scan tasks and next-task link
   - `releaseAsyncPlanForTask` removes async planning state
   - malformed keys are handled gracefully (no exception, no side effects)
   - releasing unknown keys is a no-op
   
   **Note:** I could not run the full Gradle test suite locally (partial clone 
conflicts with the multi-module build), but the changes are minimal 
`Map.remove()` calls following existing patterns in the codebase. CI should 
validate.


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