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

Rollback the tmp storage of BytesRefHash to -1 after sort #13014

Merged
merged 1 commit into from Jan 25, 2024

Conversation

gf2121
Copy link
Contributor

@gf2121 gf2121 commented Jan 16, 2024

In #12784 we cache buckets into extra slots in BytesRefHash to speed up BytesRefHash#sort. This causes an AssertError for TermsQuery because it could call sort more than once on a BytesRefHash instance. Not sure if any other users were relying on this but it would be great to keep consistent with before.

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM.

@ChrisHegarty ChrisHegarty added this to the 9.9.2 milestone Jan 24, 2024
@ChrisHegarty
Copy link
Contributor

@gf2121 I've added the 9.9.2 milestone to this PR. Do you agree? If so, is it possible to merge and backport to the branch_9x and branch_9_9 branches.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

Thanks @gf2121 !

@mikemccand
Copy link
Member

Thanks for finding/fixing this @gf2121!

because it could call sort more than once on a BytesRefHash instance

Hmm -- that sounds buggy (on TermsQuery part)? Shouldn't callers be prevented from calling .sort() more than once (I think it is a destructive operation?). Or at least let's fix TermsQuery to not do this?

@cpoerschke
Copy link
Contributor

... Or at least let's fix TermsQuery to not do this?

Thanks for the input! Wondering if perhaps I was too hasty closing out the naive #13019 change ... WDYT?

@mikemccand
Copy link
Member

Wondering if perhaps I was too hasty closing out the naive #13019 change ... WDYT?

+1 -- let's reopen? I would rather move towards making this API prevent such abuse than being lenient about it, if we can. Thanks @cpoerschke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants