Repository navigation
[FEATURE] Cancel and delete async PPL queries - #5846
Conversation
PR Reviewer Guide 🔍(Review updated until commit f45c375)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to f45c375 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 6d653e9
Suggestions up to commit 7d243cd
Suggestions up to commit 163015d
Suggestions up to commit 57ed0bc
Suggestions up to commit 893a012
|
|
Persistent review updated to latest commit ff7e4e8 |
|
Persistent review updated to latest commit aa9f803 |
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (63.87%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #5846 +/- ##
============================================
+ Coverage 63.64% 63.87% +0.23%
- Complexity 9017 9091 +74
============================================
Files 958 962 +4
Lines 40806 41033 +227
Branches 4632 4668 +36
============================================
+ Hits 25971 26211 +240
+ Misses 13964 13944 -20
- Partials 871 878 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Persistent review updated to latest commit 03d00bb |
Signed-off-by: Peng Huo <penghuo@amazon.com>
Signed-off-by: Peng Huo <penghuo@amazon.com>
Signed-off-by: Peng Huo <penghuo@amazon.com>
Track sync and async cancellation during engine fallback in opensearch-project#5849. Require a cancellable PPLQueryTask before publishing an async job. Signed-off-by: Peng Huo <penghuo@amazon.com>
03d00bb to
893a012
Compare
|
Persistent review updated to latest commit 893a012 |
Signed-off-by: Peng Huo <penghuo@amazon.com>
|
Persistent review updated to latest commit 57ed0bc |
Signed-off-by: Peng Huo <penghuo@amazon.com>
|
Persistent review updated to latest commit 163015d |
RyanL1997
left a comment
There was a problem hiding this comment.
LGTM - Tested this locally and it looks good to me. DELETE stopped queued and running jobs and freed their memory.
While testing I found a separate bug and opened an issue for it: #5860. A query rejected with Insufficient resources to start query leaves its PIT open until the keep-alive expires. It's pre-existing on main and not caused by this PR.
Mentioning it here because async PPL makes it easier to hit: one client can queue many queries and push the node past the memory limit.
Addresses PR opensearch-project#5846 review from @ahkcs. 1. PPL DELETE no longer contends with async query execution on sql-worker. RestAsyncQueryManagementAction routes PPL DELETE to the GENERIC pool; Spark DELETE keeps its existing sql-worker dispatch. Scheduler gains a pool-name overload so ThreadContext propagation is preserved for both paths. 2. Forwarded errors from the owner node arrive wrapped in RemoteTransportException, leaking the owner's hostname+port and masking the real cause. AsyncQueryOwnerRouting now wraps the listener with ExceptionsHelper.unwrapCause so the client sees the real exception; fixes GET and DELETE together. 3. GET and DELETE disagreed on 404 when the owner node left the cluster (GET→400 via AsyncQueryNotFoundException, DELETE→404 via a one-off remap). AsyncQueryOwnerRouting now throws ResourceNotFoundException on absent owner, so both paths return 404 by the same mechanism. The DELETE-only instanceof remap in TransportCancelAsyncQueryRequestAction is removed. Tests ----- - AsyncQueryOwnerRoutingTest: departedOwner expects ResourceNotFoundException; new forwardedRemoteTransportExceptionIsUnwrappedBeforeReturningToListener. - SchedulerTest: new schedulesOnNamedPool covering the overload. - AsyncPPLMultiNodeRoutingIT: {get,delete}UnknownPplIdFromNonOwner_returns404 extended with assertForwardedErrorIsUnwrapped — asserts type and no leaked address/action in details. - AsyncPPLQueryLifecycleIT: new async_getWithAbsentOwnerReturns404 to match the existing DELETE absent-owner test. Full async-query:test, datasources:test, AsyncPPL*IT, and AsyncPPLSecurityIT all green locally. Signed-off-by: Peng Huo <penghuo@amazon.com>
|
Persistent review updated to latest commit 7d243cd |
Jacoco branch coverage on AsyncQueryOwnerRouting dropped to 0.7 (required 1.0) in CI — the new ternary wrapping unwrapped non-Exception Throwables in RuntimeException had no test exercising the else branch. Adds forwardedCauseThatIsNotAnExceptionIsWrappedInRuntimeException: feeds a RemoteTransportException whose cause is an AssertionError, verifies the listener receives a RuntimeException whose cause is the original AssertionError. Signed-off-by: Peng Huo <penghuo@amazon.com>
|
Persistent review updated to latest commit 6d653e9 |
Comment out assertPitsClosed inside assertStopped. The 5s deadline is not enough on slow CI legs (seen on windows-latest/21/en-BZ with 2-thread JVM), and the flake masks real cancel-path signal. Private helpers (assertPitsClosed, openPits) are left in place so re-enabling is a one-line uncomment. Tracked at opensearch-project#5860. Signed-off-by: Peng Huo <penghuo@amazon.com>
|
Persistent review updated to latest commit f45c375 |
Description
Add
DELETE /_plugins/_async_query/{id}for async PPL jobs. Authorize the caller, forward to the owner node when needed, remove the stored job, and request cooperative cancellation through its PPL execution task. Deleting a job also disarms its retention timer. Async submission rejects a task that cannot provide the expected PPL cancellation hook.DELETE contract:
200with{"status":"CANCELLED"}when cancellation wins against a running job, or the existingSUCCEEDED/FAILEDstatus for a completed job.404. Unknown, expired, already-deleted, and absent-owner ids return404.403; custom roles needcluster:admin/opensearch/ql/async_query/delete.Additional verification for commit
163015dba2used Java 21 and seed5846DE1E20261008::integ-test:integTestWithSecuritytask passed 97 security test methods with zero failures/errors/skips, including both async PPL security ITs. Gradle also reported one successful class/container entry separately from these test methods.cluster:admin/opensearch/ql/async_query/deletereceives HTTP403on both owner and peer nodes, with the completed job still readable. Granting DELETE to the same user then allows deletion through the peer and subsequent GET returns404.spotlessApply,spotlessCheck, and integration-test compilation passed. This follow-up changes onlyAsyncPPLSecurityIT.java.Related Issues
Related to #5765.
Follows merged #5832.
Rebased onto upstream including #5847.
Cancellation/fallback follow-up: #5849.
Cross-version transport follow-up: #5801.
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.