Do not enable doc-partitioning for count#143544
Merged
dnhatn merged 6 commits intoelastic:mainfrom Mar 4, 2026
Merged
Conversation
Collaborator
|
Hi @dnhatn, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
romseygeek
approved these changes
Mar 4, 2026
| static LuceneSliceQueue.PartitioningStrategy partitioningStrategyForCount(Query q) { | ||
| final Query unwrapped = LuceneSourceOperator.Factory.unwrapQuery(q); | ||
| return switch (unwrapped) { | ||
| case MatchAllDocsQuery unused -> LuceneSliceQueue.PartitioningStrategy.SHARD; |
Contributor
There was a problem hiding this comment.
Nit: do we need the unused token here?
Member
Author
There was a problem hiding this comment.
yes, we need it for switch.
Member
Author
|
Thanks Alan! |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
burqen
pushed a commit
to burqen/elasticsearch
that referenced
this pull request
Mar 5, 2026
We can't use Weight#count with doc-partitioning because if the query gets cached mid-way, the count becomes incorrect. Over-counting occurs when some parts are counted doc-by-doc while the first part is counted entirely via the cached shortcut. Under-counting occurs when the first part is not cached but later parts are, causing those parts to be skipped. To make doc-partitioning work properly for count, we would need coordination between threads. This change also restores the default partitioning to SEGMENT, which accidentally changed to SHARD. Closes elastic#134512
jfreden
pushed a commit
to jfreden/elasticsearch
that referenced
this pull request
Mar 5, 2026
We can't use Weight#count with doc-partitioning because if the query gets cached mid-way, the count becomes incorrect. Over-counting occurs when some parts are counted doc-by-doc while the first part is counted entirely via the cached shortcut. Under-counting occurs when the first part is not cached but later parts are, causing those parts to be skipped. To make doc-partitioning work properly for count, we would need coordination between threads. This change also restores the default partitioning to SEGMENT, which accidentally changed to SHARD. Closes elastic#134512
spinscale
pushed a commit
to spinscale/elasticsearch
that referenced
this pull request
Mar 6, 2026
We can't use Weight#count with doc-partitioning because if the query gets cached mid-way, the count becomes incorrect. Over-counting occurs when some parts are counted doc-by-doc while the first part is counted entirely via the cached shortcut. Under-counting occurs when the first part is not cached but later parts are, causing those parts to be skipped. To make doc-partitioning work properly for count, we would need coordination between threads. This change also restores the default partitioning to SEGMENT, which accidentally changed to SHARD. Closes elastic#134512
This was referenced Mar 6, 2026
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.
We can't use
Weight#countwith doc-partitioning because if the query gets cached mid-way, the count becomes incorrect. Over-counting occurs when some parts are counted doc-by-doc while the first part is counted entirely via the cached shortcut. Under-counting occurs when the first part is not cached but later parts are, causing those parts to be skipped. To make doc-partitioning work properly for count, we would need coordination between threads.This change also restores the default partitioning to SEGMENT, which accidentally changed to SHARD.
Closes #134512