Repository navigation
Fix PIT (Point in Time) resource leaks in v2 query engine - #5221
Conversation
Signed-off-by: Lantao Jin <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
PR Code Suggestions ✨Latest suggestions up to 35203c9 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit c2ab5c7
Suggestions up to commit 2f6c5a6
|
PIT isn't really needed for plan explain, I think creating PIT here is a kind of resource wasting. |
I checked the code and find it maybe not worth to fix it in |
…ring execution Signed-off-by: Lantao Jin <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
|
Persistent review updated to latest commit c2ab5c7 |
Signed-off-by: Lantao Jin <[email protected]>
|
Persistent review updated to latest commit 35203c9 |
* Fix PIT (Point in Time) resource leaks in v2 query engine Signed-off-by: Lantao Jin <[email protected]> * Fix PIT context leaks when a query without cursor/pagination fails during execution Signed-off-by: Lantao Jin <[email protected]> * Avoid to expose sensitive document Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit e11e11e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix PIT (Point in Time) resource leaks in v2 query engine Signed-off-by: Lantao Jin <[email protected]> * Fix PIT context leaks when a query without cursor/pagination fails during execution Signed-off-by: Lantao Jin <[email protected]> * Avoid to expose sensitive document Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit e11e11e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…y engine (#5229) * Fix PIT (Point in Time) resource leaks in v2 query engine (#5221) * Fix PIT (Point in Time) resource leaks in v2 query engine Signed-off-by: Lantao Jin <[email protected]> * Fix PIT context leaks when a query without cursor/pagination fails during execution Signed-off-by: Lantao Jin <[email protected]> * Avoid to expose sensitive document Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> (cherry picked from commit e11e11e) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Resolve compile error Signed-off-by: Lantao Jin <[email protected]> --------- Signed-off-by: Lantao Jin <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Lantao Jin <[email protected]>
Description
This PR fixes multiple PIT (Point in Time) resource leak scenarios in the v2 query engine. PITs are server-side resources created for paginated search; if not properly deleted, they accumulate and eventually hit the
search.max_open_pit_context limit, causing all subsequent queries to fail.Three distinct PIT leak paths were identified:
explain()never closes the physical plan —OpenSearchExecutionEngine.explain()builds a physical plan (which creates a PIT) to generate explain output, then discards it without callingclose(). Every explain call leaks a PIT per index matched. For example,source=test*against 50 indices leaks 50 PITs per call, exhausting the default 300 limit in just 6 calls.OpenSearchIndexScan.close()skips PIT deletion on non-final pages —close()delegates torequest.clean()which only deletes the PIT whenneedClean=true(last page consumed). If the scan is closed early due to LIMIT, exception, or timeout, the PIT is orphaned.Explicit cursor close doesn't delete PIT —
CursorCloseOperatorpropagatesclose()to children, butOpenSearchIndexScan.close()→cleanup()→clean()skips PIT deletion becauseneedClean=falsemid-pagination. The PIT is never reclaimed.Related Issues
Resolves #5220
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.