Add initial_delay parameter to the transform _start API - #150358
Add initial_delay parameter to the transform _start API#150358shahzad31 wants to merge 8 commits into
initial_delay parameter to the transform _start API#150358Conversation
9a9ebb4 to
ff65033
Compare
🔍 Preview links for changed docsThis PR only changes snippets or data files. No direct page links are available. |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
ff65033 to
fbe5d9b
Compare
fbe5d9b to
89fe869
Compare
89fe869 to
9885e8e
Compare
9885e8e to
e94b45d
Compare
|
Pinging @elastic/ml-core (Team:ML) |
e94b45d to
988a869
Compare
initial_delay to continuous transform time syncinitial_delay parameter to the transform _start API
988a869 to
c13ee29
Compare
06300e2 to
86ceb15
Compare
prwhelan
left a comment
There was a problem hiding this comment.
Please remove all of the benchmark files
86ceb15 to
ff32d25
Compare
ff32d25 to
b1d326b
Compare
Continuous transforms apply a single steady-state sync.time.delay to every checkpoint's upper bound. That delay must be conservative for ingest/refresh lag, so already-present or just-arrived data is not processed until it ages past the full delay. For chained transforms (e.g. Kibana SLO rollup -> summary) this compounds into a visible ~60-120s lag before the first downstream document appears. Add an optional initial_delay parameter to the _start API. It is a one-time, reduced sync delay applied while the transform is still in its initial catch-up phase, i.e. until it has processed its first document; afterwards it reverts to the steady-state delay. Keying off "has processed data" rather than "checkpoint elastic#1" lets a downstream transform pick up source data that lands shortly after its first (empty) checkpoint. It is modelled on the existing _start?from= parameter: a transient, one-time-use value carried on the start request and the persistent task params rather than persisted in the transform config. The signal is threaded through TransformContext (a monotonic hasProcessedData flag, set once documents are processed) and honored by both createNextCheckpoint and the sourceHasChanged change-detection gate. Wire BWC is guarded by a new transport version. It is rejected for batch transforms and when greater than the steady-state delay. Closes elastic#150357
b1d326b to
c6b8dff
Compare
…transform/action/StartTransformAction.java Co-authored-by: Pat Whelan <pat.whelan@elastic.co>
…ial-delay # Conflicts: # server/src/main/resources/transport/upper_bounds/9.6.csv
…ial-delay # Conflicts: # server/src/main/resources/transport/upper_bounds/9.6.csv
Summary
Continuous transforms apply a single steady-state
sync.time.delayto every checkpoint's upper time bound (now - delay). That delay has to be conservative enough to tolerate source ingest/refresh lag, so already-present or just-arrived data is not processed until it has aged past the full delay. For chained transforms (e.g. the Kibana SLO rollup → summary pair, bothdelay: 65s) this compounds into a visible ~60–120s lag before the first downstream document appears.This PR adds an optional
initial_delayparameter to the_startAPI:initial_delayis a one-time, reduced delay applied while the transform is still in its initial catch-up phase — i.e. until it has processed its first document — after which it reverts to the steady-statedelay. Keying off "has processed data" rather than literally "checkpoint #1" matters for chained transforms: the source data often lands shortly after the downstream transform's first (empty) checkpoint, so a checkpoint-#1-only rule would revert to the steady-state delay before any data was ever seen.Closes #150357
Why a
_startparameter (not asyncconfig field)Per review feedback (thanks @prwhelan),
initial_delayis a one-time-use value that only matters on initial catch-up, so it is modelled on the existing_start?from=parameter rather than persisted into the transform config in the system index. It is a transient value carried on the start request and the persistent task params.Implementation
initial_delayis added toStartTransformAction.Request(REST param on_start) and carried intoTransformTaskParams.TransformContextas a monotonichasProcessedDataflag, set once the indexer processes documents (TransformIndexer#finalizeCheckpoint, and seeded from persisted stats on restart so a restarting transform does not re-apply the override).TimeBasedCheckpointProviderselectsinitial_delayvsdelayvia that flag, honored by bothcreateNextCheckpoint(the upper-bound calculation) andsourceHasChanged(the change-detection gate — these must agree or the gate would reject the just-landed backfill)._start: rejected for batch (non-continuous) transforms and wheninitial_delay > delay.Backwards compatibility
StartTransformAction.RequestandTransformTaskParamsguarded by a new transport version (transform_start_initial_delay); older nodes simply do not see the field.Scope
This bounds first-data latency by the transform's
frequencyrather thandelay + frequency. Local end-to-end test against Kibana SLOs (summaryfrequency: 1m): first summary document dropped from ~122s to ~62s by starting withinitial_delay=0s, with no orchestration changes. Reaching seconds-level latency additionally requires the downstream transform to be triggered promptly after the upstream writes (e.g._schedule_nowor a shorterfrequency) and is intentionally out of scope.Evidence (measured against a local Kibana)
Ran this change against a locally-built ES with a local Kibana that starts its SLO summary transform with
initial_delay=0s(delay: 65s,frequency: 1m), then created an SLO and timed the first summary document:initial_delay)initial_delay=0s(run 1)initial_delay=0s(run 2)That is a ~60s reduction in time-to-first SLO summary document, with no Kibana orchestration changes. The summary document landing at checkpoint #2 confirms the new behavior: checkpoint #1 was empty (the rollup had not written its SLI docs yet), so
initial_delaystayed in effect for checkpoint #2 instead of reverting to the65ssteady-state delay.Test plan
StartTransformActionRequestTests/TransformTaskParamsTests— wire + XContent BWC for the newinitial_delayfield.TimeBasedCheckpointProviderTests—initial_delaykept until first non-empty checkpoint, switch to steady state once data processed, gate usesinitial_delayduring catch-up, clamping.RestStartTransformActionTests—initial_delayparam parsing.TransformInitialDelayIT— end-to-end: a pre-present backfill is processed on the first checkpoint after_start?initial_delay=0sdespite a long steady-state delay.transforms_start_stop.yml—_startwithinitial_delay, rejection for batch transforms and wheninitial_delay > delay.Made with Cursor