feat: add keep_alive to async task status#144010
Conversation
|
💚 CLA has been signed |
|
CLA is signed. Could an Elastic maintainer please add an assignee and the |
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
...k/plugin/async-search/src/test/java/org/elasticsearch/xpack/search/AsyncSearchTaskTests.java
Outdated
Show resolved
Hide resolved
|
buildkite test this please |
|
@lxrbox there's several test failures, most specifically from |
Thanks for flagging this. I'll update from main, regenerate the transport version, and fix the failing checks. |
04cec53 to
a53f32f
Compare
|
buildkite test this please |
| var targetTaskId = AsyncExecutionId.decode(asyncSearchId).getTaskId(); | ||
| TaskInfo found = null; | ||
| for (TaskInfo taskInfo : client().admin().cluster().prepareListTasks().setDetailed(true).get().getTasks()) { | ||
| if (taskInfo.taskId().equals(targetTaskId)) { |
There was a problem hiding this comment.
could this be a stream? ...getTasks().stream().filter(task()==targetTaskId).findAny()
| try (AsyncSearchTask task = createAsyncSearchTask()) { | ||
| TaskInfo taskInfo = task.taskInfo("node1", true); | ||
| assertThat(taskInfo.status(), notNullValue()); | ||
| assertThat(taskInfo.toString(), containsString("\"request_id\" : \"" + task.getExecutionId().getEncoded() + "\"")); |
There was a problem hiding this comment.
nit - these can be hasToString(containsString(...))
| List.of(new NamedWriteableRegistry.Entry(Task.Status.class, RawTaskStatus.NAME, RawTaskStatus::new)) | ||
| ); | ||
| TaskInfo taskInfo = task.taskInfo("node1", true); | ||
| TransportVersion previousVersion = TransportVersionUtils.getPreviousVersion(TransportVersion.current()); |
There was a problem hiding this comment.
You need to get the transport version previous to the specific change you're introducing here, not the previous to current() (which will move forwards). You can use the randomVersionNotSupporting method for this.
| new AsyncExecutionId(randomAlphaOfLength(10), new TaskId(randomAlphaOfLength(4), randomNonNegativeLong())), | ||
| TimeValue.timeValueDays(2) | ||
| ); | ||
| TransportVersion previousVersion = TransportVersionUtils.getPreviousVersion(TransportVersion.current()); |
There was a problem hiding this comment.
See comment on TransportVersion checks above
|
Looking pretty good. A couple more comments, and this also needs a changelog, and an update from main, and then we're good to go |
a53f32f to
5ecd818
Compare
Addressed the remaining comments:
|
|
The changelog needs to be for this PR number, #144010 |
5ecd818 to
500e696
Compare
|
buildkite test this |
Add keep_alive field to task status for async search and ES|QL query tasks. The keep_alive value is now tracked in the task state and exposed via the task status API, allowing clients to observe the current keep_alive setting for running async operations. - Update AsyncTask interface to track keep_alive alongside expiration - Expose keep_alive in AsyncSearchTask and EsqlQueryTask status - Maintain backwards compatibility in task status serialization - Add integration tests verifying keep_alive in task info
Use hasEntry with allOf in AsyncSearchTaskTests to assert the serialized RawTaskStatus map more explicitly and avoid repeated toMap() calls.
Use a feature-specific transport version for async task status compatibility checks instead of deriving from current(). Also apply the follow-up review cleanups by switching the task lookup helper to a stream-based implementation, using hasToString assertions, and adding a changelog entry.
Rename the changelog entry to match the actual PR number so the community PR validation passes.
bd8f1c0 to
deacdfb
Compare
|
updated the transport-version checks to use the feature-specific version boundary |
|
buildkite test this |
|
All merged, thanks for the contribution! |
Thanks for the review and merge! Glad to contribute. |
…elocations * upstream/main: (33 commits) Unmute InferenceRestIT and DefaultEndPointsIT (elastic#144217) feat: add keep_alive to async task status (elastic#144010) Add explicit isNoOpUpdate() method to MapperService (elastic#144113) Always attach APM Agent (elastic#144120) Fix random_score nightly tests (elastic#144176) Add nested query checks for disabled sequence numbers (elastic#144185) Return sentinel values from Fetch when sequence numbers are disabled (elastic#144212) [Test] Test peer-recovery with sequence numbers pruning (elastic#144116) Remove `scaled-*` field assertions from mixed cluster downsampling test (elastic#144295) Refactor: Use range syntax in ES|QL exponential histogram tests (elastic#144110) Move resolve aliases to IndexAbstractionOptions (elastic#143953) unmute test (elastic#144299) Fix approximation csvtests (elastic#144233) fix test (elastic#144171) Add int4 vector scoring benchmarks (elastic#144105) Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT test elastic#143023 Mute org.elasticsearch.test.apmintegration.MetricsApmIT testApmIntegration {withOTel=false} elastic#144282 Native cli launcher (elastic#143712) Mute org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT test elastic#143023 Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackSubqueryIT testManyRandomKeywordFieldsInSubqueryIntermediateResults elastic#144274 ...
Add keep_alive field to task status for async search and ES|QL query tasks. The keep_alive value is now tracked in the task state and exposed via the task status API, allowing clients to observe the current keep_alive setting for running async operations. --------- Co-authored-by: Simon Cooper <simon.cooper@elastic.co>
Add keep_alive field to task status for async search and ES|QL query tasks. The keep_alive value is now tracked in the task state and exposed via the task status API, allowing clients to observe the current keep_alive setting for running async operations.
gradle check?