Conversation
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
Signed-off-by: Peng Huo <penghuo@gmail.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 7abe947.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (63.26%) 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 #5809 +/- ##
============================================
+ Coverage 63.23% 63.26% +0.02%
- Complexity 8823 8829 +6
============================================
Files 938 939 +1
Lines 40236 40276 +40
Branches 4537 4537
============================================
+ Hits 25445 25480 +35
- Misses 13966 13971 +5
Partials 825 825
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:
|
| * <p>This class is thread-safe. The registry is concurrent, capacity counters are guarded by {@code | ||
| * admissionLock}, and each job synchronizes its own lifecycle transitions. | ||
| */ | ||
| public final class PPLAsyncQueryService extends AbstractLifecycleComponent { |
There was a problem hiding this comment.
- Can we make this new lifecycle layer language-neutral, similar to Livy’s control plane over Spark?
- Probably the execution boundary can also be engine-neutral? SQL and PPL can both run on AE too, although AE does not currently support progress listeners.
| * lock. | ||
| * | ||
| * <pre> | ||
| * Every job starts in RUNNING. It becomes retained when wait_for_completion_timeout expires. |
There was a problem hiding this comment.
Could we separate execution state from retention and treat wait_for_completion_timeout only as submit-response behavior? In a BigQuery-style model, the job remains RUNNING whether or not the request is still waiting.
| private final Supplier<String> ownerNodeIdSupplier; | ||
| private final LongSupplier currentTimeMillis; | ||
| private final TimeoutScheduler timeoutScheduler; | ||
| private final IntSupplier maxRunningQueries; | ||
| private final IntSupplier maxRetainedJobs; | ||
| private final Supplier<TimeValue> maxWaitForCompletion; | ||
| private final Supplier<TimeValue> maxKeepAlive; | ||
| private final ThreadPool threadPool; | ||
| private final ConcurrentMap<String, PPLAsyncQueryJob> jobs = new ConcurrentHashMap<>(); | ||
| private final Object admissionLock = new Object(); |
There was a problem hiding this comment.
wondering shall we extract serveral internal components to offload the responsibilities of this service class, such as async-query-core’s JobStore, LeaseManager etc?
Description
This is the first implementation slice of #5796, under the PPL async-query meta issue #5765. It adds the execution contract and owner-node lifecycle core without registering REST routes or changing the existing synchronous PPL API.
The lifecycle module depends only on:
A successful final result must be visible through
currentResult()beforecompletion()completes normally.Core components:
PPLAsyncQueryJob: synchronized state machine for one query.PPLAsyncQueryService: job registry, timeout race, leases, capacity, task ownership, cancellation, expiration, and cleanup.PPLAsyncQueryJobId: opaque owner-routable identifier.PPLAsyncQueryUser: retained-job owner identity.DefaultAsyncQueryExecution: final-result adapter for existing PPL execution.Result before timeout
sequenceDiagram participant C as Submit caller participant S as PPLAsyncQueryService participant J as PPLAsyncQueryJob participant E as AsyncQueryExecution participant T as Wait timeout C->>S: start(wait) S->>J: create RUNNING S->>T: schedule S->>E: start and attach E-->>S: completion() S-->>T: cancel S->>J: complete() J-->>S: DirectResponse S->>E: currentResult() S-->>C: final snapshot without ID S->>E: close()Timeout before result
sequenceDiagram participant C as Submit caller participant S as PPLAsyncQueryService participant J as PPLAsyncQueryJob participant E as AsyncQueryExecution participant T as Wait timeout C->>S: start(wait) S->>J: create RUNNING S->>T: schedule S->>E: start and attach T-->>S: wait expires S->>J: retain() J-->>S: Retained(RUNNING) S->>E: currentResult() S-->>C: RUNNING snapshot with ID E-->>S: completion() S->>J: complete() J-->>S: ExecutionFinished C->>S: get(ID) S->>J: get() J-->>S: succeeded snapshot source S->>E: currentResult() S-->>C: retained final snapshotDELETE, expiration, startup abort, and shutdown produce typed removal transitions. The service removes registry state and releases tasks/executions after leaving the job lock.
The follow-up PR adds request parsing, REST/transport actions, owner-node forwarding, response formatting, and integration tests.
Related Issues
Part of #5796.
Parent meta issue: #5765.
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.