Skip to content
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

ShardUtils#getElasticsearchLeafReader() should use FilterLeafReader#getDelegate() instead of FilterLeafReader#unwrap #12437

Merged

Conversation

@martijnvg
Copy link
Member

commented Jul 24, 2015

If there are multiple levels of filtered leaf readers then with the unwrap() method it immediately returns the most inner leaf reader and thus skipping of over any other filtered leaf reader that may be instance of ElasticsearchLeafReader. By using #getDelegate() method we can check each filter reader layer if it is instance of ElasticsearchLeafReader, so that we never skip over any wrapped filtered leaf reader and lose the shard id.

@jpountz

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2015

LGTM

Can you add a comment to the code about why we use getDelegate and not unwrap?

…etDelegate() instead of FilterLeafReader#unwrap

If there are multiple levels of filtered leaf readers then with the unwrap() method it immediately returns the most inner leaf reader and thus skipping of over any other filtered leaf reader that may be instance of ElasticsearchLeafReader. By using #getDelegate() method we can check each filter reader layer if it is instance of ElasticsearchLeafReader, so that we never skip over any wrapped filtered leaf reader and lose the shard id.
@martijnvg martijnvg force-pushed the martijnvg:bug/shards_utils_extract_shard_id branch to c781c89 Jul 24, 2015
@martijnvg martijnvg merged commit c781c89 into elastic:master Jul 24, 2015
1 check passed
1 check passed
CLA Commit author is a member of Elasticsearch
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.