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

loki: Fixed out of order entries allowed in a chunk on edge case #859

Merged
merged 1 commit into from
Aug 7, 2019

Conversation

pracucci
Copy link
Contributor

@pracucci pracucci commented Aug 6, 2019

What this PR does / why we need it:
A chunk can contain log entries out of order (leading also to incorrect values returned by .Bounds()) if an out of order log entry is pushed as first entry of a new block, right after the previous block has been cut.

Checklist

  • Documentation added
  • Tests updated

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

@cyriltovena
Copy link
Contributor

How did you figured this was happening ?

@slim-bean
Copy link
Collaborator

@pracucci nice find!

When you have a chance can you fix the few linter issues:

pkg/chunkenc/gzip_test.go:236:11: Error return value of `chk.cut` is not checked (errcheck)
			chk.cut()
			       ^
pkg/chunkenc/gzip_test.go:242:11: Error return value of `chk.cut` is not checked (errcheck)
			chk.cut()
			       ^
pkg/chunkenc/gzip_test.go:245:11: Error return value of `chk.cut` is not checked (errcheck)
			chk.cut()
			       ^

@pracucci
Copy link
Contributor Author

pracucci commented Aug 7, 2019

How did you figured this was happening ?

@cyriltovena I was reviewing the chunk implementation and noticed it. Then I tried to manually reproduce it pushing an out of order log with promtail right after cutting a block, and was reproduced.

can you fix the few linter issues

Sure, done! Yesterday I've pushed the PR and went to sleep without waiting for the CI result.

@cyriltovena cyriltovena merged commit c955702 into grafana:master Aug 7, 2019
@pracucci pracucci deleted the fix-chunk-out-of-order branch August 7, 2019 14:02
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.

3 participants