-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
storage: fix missing logs with batched chunk iterator #1299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple small questions, but the inclusivity work looks great.
pkg/storage/iterator_test.go
Outdated
for name, tt := range tests { | ||
tt := tt | ||
t.Run(fmt.Sprintf("large-batchsize/%s", name), func(t *testing.T) { | ||
it := newBatchChunkIterator(context.Background(), tt.chunks, 1000, newMatchers(tt.matchers), nil, newQuery("", tt.start, tt.end, tt.direction)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the benefit of the large batchsize tests? Additionally, would it be better to use len(tt.chunks)
instead of 1000
here for extensibility to ensure the the batch is always large enough to hold all the chunks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't know whether these tests are needed or not. I added these tests for debugging purposes since the bug described in #1187 don't happen when the batchsize is big enough to hold all of the chunks. I can remove those if deemed unnecessary.
Signed-off-by: Owen Diehl <ow.diehl@gmail.com>
Nice work @putrasattvika! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive @putrasattvika.
Thank you for effort of diving into it.
What this PR does / why we need it:
This PR addresses bugs that cause missing logs issue described in #1187:
__name__
label matcher for queries against the chunk storage. The__name__
chunk label is removed from all chunks that are passed intobuildHeapIterator()
. Overlapping chunks (according tobatchSize
) will go through that function multiple times, and they will be filtered out on the second call since they no longer have the chunk label.[from, through)
to(from, through]
. This fixes an issue where the last log entry of the first chunk of a batch is not retrieved.from
/through
for batched iterator with more than two batchesWhich issue(s) this PR fixes:
Fixes #1187
Checklist