[7.x] Optimistic concurrency control for updating ingest pipelines #79364
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.
This commit adds optional optimistic concurrency control to the API for updating ingest pipelines. This is achieved through the addition of an
if_version
query parameter similar to theif_seq_no
andif_primary_term
parameters used for optimistic concurrency control in Elasticsearch. When this parameter is specified, the pipeline update succeeds only if there is an existing pipeline with a version that matches the specified version.In the example above, the update succeeds only if "my_pipeline" exists with a version of 5. Any version can be specified in the body of the update so long as it is not the existing version. If no version is specified in the body of the update, the version is automatically set to
<currentVersion> + 1
. Pipelines that do not have aversion
attribute with a numeric value cannot be updated with theif_version
parameter because checking for a null or missing version is not a meaningful guard against concurrent updates.Note that any pipeline updates that do not include an
if_version
parameter will be processed unconditionally. Note also that there are no optimizations possible for no-op pipeline updates when theif_version
parameter is specified because such an update will always change, at the very least, the version attribute of the pipeline and will therefore never be a no-op update.Fixes #77031
Backport of #78551