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

Fix lazy postings with zero length #7083

Merged
merged 4 commits into from Jan 22, 2024

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Jan 20, 2024

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

When lazy expanded postings enabled, we will have expanded postings using partial matchers and matchers that will be evaluated lazily. However, it is possible that with partial matchers, the expanded postings already have 0 length then there is no need to evaluate lazy postings.

In this case, there is a bug that the expanded postings will not be cached. So add a check to return emptyLazyPostings if length is 0. Since emtpyLazyPostings doesn't have any matchers, it will be cached here https://github.com/thanos-io/thanos/blob/main/pkg/store/bucket.go#L2514

Verification

Added unit tests

Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
Signed-off-by: Ben Ye <benye@amazon.com>
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 20, 2024
Signed-off-by: Ben Ye <benye@amazon.com>
Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

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

lgtm

@yeya24 yeya24 merged commit e215fa5 into thanos-io:main Jan 22, 2024
20 checks passed
@yeya24 yeya24 deleted the fix-lazy-postings-zero-length branch January 22, 2024 18:25
@yeya24
Copy link
Contributor Author

yeya24 commented Jan 22, 2024

Thanks @MichaHoffmann

jnyi pushed a commit to jnyi/thanos that referenced this pull request Apr 4, 2024
* fix lazy postings with zero length

Signed-off-by: Ben Ye <benye@amazon.com>

* changelog

Signed-off-by: Ben Ye <benye@amazon.com>

* unit tests

Signed-off-by: Ben Ye <benye@amazon.com>

* fix doc

Signed-off-by: Ben Ye <benye@amazon.com>

---------

Signed-off-by: Ben Ye <benye@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants