Skip to content

Handle empty terms index in TermsSliceQuery #43078

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 2 commits into from
Jun 11, 2019

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Jun 11, 2019

#40741 introduced a merge policy that can drop the postings for the _id
field on soft deleted documents. However the TermsSliceQuery assumes that every document
has has an entry in the postings for that field so it doesn't check if the terms
index exists or not. This change fixes this bug by checking if the terms index for
the _id field is null and ignore the segment entirely if it's the case. This should
be harmless since segments without an _id terms index should only contain soft deleted
documents.

Closes #42996

elastic#40741 introduced a merge policy that can drop the postings for the `_id`
field on soft deleted documents. The TermsSliceQuery assumes that every document
has has an entry in the postings for that field so it doesn't check if the terms
index exists or not. This change fixes this bug by checking if the terms index for
the `_id` field is null and ignore the segment entirely if it's the case. This should
be harmless since segments without an `_id` terms index should only contain soft deleted
documents.

Closes elastic#42996
@jimczi jimczi added >bug :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.3.0 labels Jun 11, 2019
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

LGTM

@jimczi jimczi merged commit 46c8f28 into elastic:master Jun 11, 2019
@jimczi jimczi deleted the bug/empty_slice_field branch June 11, 2019 09:53
@jimczi jimczi added >non-issue and removed >bug labels Jun 11, 2019
@jimczi
Copy link
Contributor Author

jimczi commented Jun 11, 2019

I removed the bug label because the issue is not present in any released versions (only in master and 7.x).

jimczi added a commit that referenced this pull request Jun 11, 2019
#40741 introduced a merge policy that can drop the postings for the `_id`
field on soft deleted documents. The TermsSliceQuery assumes that every document
has has an entry in the postings for that field so it doesn't check if the terms
index exists or not. This change fixes this bug by checking if the terms index for
the `_id` field is null and ignore the segment entirely if it's the case. This should
be harmless since segments without an `_id` terms index should only contain soft deleted
documents.

Closes #42996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Search Search-related issues that do not fall into other categories v7.3.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE in slice query when running DeleteByQuery
3 participants