Skip to content

Fix DocValuesConsumerUtil to detect usage of source pruning filter doc values producer #126836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

martijnvg
Copy link
Member

The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader. This change addresses that.

Failing to detect this means that the optimized merge will not kick in.

The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader.
This change addresses that.

Failing to detect this means that the optimized merge will not kick in.
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@martijnvg martijnvg changed the title Fix DocValuesConsumerUtil Fix DocValuesConsumerUtil to detect usage of source pruning filter doc values producer Apr 15, 2025
Copy link
Contributor

@jordan-powers jordan-powers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@martijnvg
Copy link
Member Author

Thanks Jordan!

@martijnvg martijnvg merged commit 929d79a into elastic:main Apr 15, 2025
17 checks passed
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Apr 15, 2025
The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader.
This change addresses that.

Failing to detect this means that the optimized merge will not kick in.
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Apr 16, 2025
The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader.
This change addresses that.

Failing to detect this means that the optimized merge will not kick in.
elasticsearchmachine pushed a commit that referenced this pull request Apr 17, 2025
* [8.x] First step optimizing tsdb doc values codec merging.

Backporting #125403 to the 8.x branch.

The doc values codec iterates a few times over the doc value instance that needs to be written to disk. In case when merging and index sorting is enabled, this is much more expensive, as each time the doc values instance is iterated a merge sorting is performed (in order to get the doc ids of new segment in order of index sorting).

There are several reasons why the doc value instance is iterated multiple times:
* To compute stats (num values, number of docs with value) required for writing values to disk.
* To write bitset that indicate which documents have a value. (indexed disi, jump table)
* To write the actual values to disk.
* To write the addresses to disk (in case docs have multiple values)

This applies for numeric doc values, but also for the ordinals of sorted (set) doc values.

This PR addresses solving the first reason why doc value instance needs to be iterated. This is done only when in case of merging and when the segments to be merged with are also of type es87 doc values, codec version is the same and there are no deletes. Note this optimized merged is behind a feature flag for now.

* fixed compile errors in benchmark

* Fix DocValuesConsumerUtil (#126836)

The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader.
This change addresses that.

Failing to detect this means that the optimized merge will not kick in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants