Disable OCC in update/delete-by-query for seq_no-less indices#143465
Disable OCC in update/delete-by-query for seq_no-less indices#143465fcofdez merged 10 commits intoelastic:mainfrom
Conversation
When an index has `index.disable_sequence_numbers` enabled, the update-by-query and delete-by-query actions now skip setting ifSeqNo/ifPrimaryTerm on bulk write requests and stop requesting seq_no in the search source. A new resolver validates that all target indices (or their parent data streams) agree on the setting, rejecting mixed configurations. Within a single data stream, if any backing index disables seq_no the entire stream is treated as seq_no-disabled.
|
Pinging @elastic/es-distributed (Team:Distributed) |
|
Hi @fcofdez, I've created a changelog YAML for you. |
modules/reindex/src/main/java/org/elasticsearch/reindex/AsyncDeleteByQueryAction.java
Outdated
Show resolved
Hide resolved
modules/reindex/src/main/java/org/elasticsearch/reindex/BulkByScrollOCCResolver.java
Show resolved
Hide resolved
| Map<String, Boolean> seqNoDisabledPerSource = new HashMap<>(); | ||
| for (Index concreteIndex : concreteIndices) { | ||
| IndexMetadata indexMetadata = projectMetadata.index(concreteIndex); | ||
| boolean seqNoDisabled = hasSequenceNumbersDisabled(indexMetadata); |
There was a problem hiding this comment.
I have the impression that we could early exit in this for loop (maybe with 2 booleans: "anySeqNoDisabled" and "anySeqNoEnabled" or something along those lines and check if they are both true).
I'm mentioning this because it's not unusual to resolve hundreds of concrete indices in requests...
There was a problem hiding this comment.
The issue is that if the index expression is targeting multiple data streams, you kind of need to evaluate all the indices before doing the validation, otherwise you risk throwing an exception too early, i.e. if DS-2 latest index is the only one with seq_no disabled. I took this route because it's likely that a data stream would have a mix of seq_no enabled and disabled and we want to accept that scenario.
There was a problem hiding this comment.
But happy to change this if we think that there are other ways to optimize this.
There was a problem hiding this comment.
Makes sense, let's keep it as it is.
modules/reindex/src/main/java/org/elasticsearch/reindex/TransportDeleteByQueryAction.java
Outdated
Show resolved
Hide resolved
…ez/elasticsearch into disable-occ-update-delete-by-query
| Map<String, Boolean> seqNoDisabledPerSource = new HashMap<>(); | ||
| for (Index concreteIndex : concreteIndices) { | ||
| IndexMetadata indexMetadata = projectMetadata.index(concreteIndex); | ||
| boolean seqNoDisabled = hasSequenceNumbersDisabled(indexMetadata); |
There was a problem hiding this comment.
Makes sense, let's keep it as it is.
...src/internalClusterTest/java/org/elasticsearch/index/reindex/BulkByScrollSeqNoSettingIT.java
Show resolved
Hide resolved
...src/internalClusterTest/java/org/elasticsearch/index/reindex/BulkByScrollSeqNoSettingIT.java
Outdated
Show resolved
Hide resolved
...src/internalClusterTest/java/org/elasticsearch/index/reindex/BulkByScrollSeqNoSettingIT.java
Show resolved
Hide resolved
...src/internalClusterTest/java/org/elasticsearch/index/reindex/BulkByScrollSeqNoSettingIT.java
Show resolved
Hide resolved
|
@elasticmachine update branch |
…c#143465) When an index has `index.disable_sequence_numbers` enabled, the update-by-query and delete-by-query actions now skip setting ifSeqNo/ifPrimaryTerm on bulk write requests and stop requesting seq_no in the search source. A new resolver validates that all target indices (or their parent data streams) agree on the setting, rejecting mixed configurations. Within a single data stream, if any backing index disables seq_no the entire stream is treated as seq_no-disabled. Related to elastic#136305
…c#143465) When an index has `index.disable_sequence_numbers` enabled, the update-by-query and delete-by-query actions now skip setting ifSeqNo/ifPrimaryTerm on bulk write requests and stop requesting seq_no in the search source. A new resolver validates that all target indices (or their parent data streams) agree on the setting, rejecting mixed configurations. Within a single data stream, if any backing index disables seq_no the entire stream is treated as seq_no-disabled. Related to elastic#136305
When an index has
index.disable_sequence_numbersenabled,the update-by-query and delete-by-query actions now skip setting
ifSeqNo/ifPrimaryTerm on bulk write requests and stop requesting seq_no
in the search source. A new resolver validates that all target indices
(or their parent data streams) agree on the setting, rejecting mixed configurations.
Within a single data stream, if any backing index disables seq_no
the entire stream is treated as seq_no-disabled.
Related to #136305