Repository navigation
Conversation
Owner
Author
|
TODO |
penghuo
added a commit
that referenced
this pull request
Sep 29, 2026
Address the review checklist:
1. Hand-rolled JSON in asyncRunningResponse — replaced with JSONObject
(safe escaping, matches the existing json library used elsewhere in
this file). Renamed to runningSnapshot for clarity.
2. Duplicated tryParseAsJobId + forwardToOwner across two transport
actions — extracted:
- QueryJobId.tryParse(String) → Optional<QueryJobId> (on the record
itself so callers pattern-match one abstraction).
- AsyncQueryOwnerRouting.forwardToOwner(...) → shared helper in the
async-query transport package.
TransportGetAsyncQueryResultAction and TransportCancelAsyncQueryRequestAction
collapse to two-line routing hops each.
3. Ad-hoc ExecutionException unwrap in submitAsync — replaced with the
promoted-to-public QueryJob.unwrap(Throwable), the same helper the
state machine already uses. One canonical unwrap for every consumer
of QueryJob.completion().
4. effectiveKeepAlive() defined but unreachable — removed along with
DEFAULT_KEEP_ALIVE constant until retention wiring makes the value
observable. keep_alive still triggers isAsync() via field presence.
No dead code promising behavior it does not deliver.
5. AsyncQueryExecutionResponse.explainJson set via @Setter on an
otherwise immutable @DaTa class — now final. The one-arg constructor
Lombok generated widens to include explainJson; existing callers pass
null. Response shape is now immutable end-to-end.
7. submitAsync was ~55 lines and did four things — split:
- submitAsync : construct runner, submit, dispatch to await path.
- awaitOrReturnId : race the runner, hand off terminal / timeout.
- renderTerminal : switch on QueryResult.Rows / Explain variant.
- runningSnapshot : format the RUNNING response (was smell #1).
Each new method is 5-15 lines with one job.
8. Trivial @provides AsyncQueryExecutorService(...) that returned the
impl unchanged — replaced with a Guice bind() call inside configure().
Smell #6 (two-mode AsyncQueryExecutorServiceImpl driven by nullable
fields) is architectural; defer per the audit note. The pragmatic escape
around OpenSearch DI's runtime-type matching stays as-is.
Signed-off-by: Peng Huo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workflow test run for issue opensearch-project#5114 using gotrek01 leader+developer handoff.