-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fixes Iterator boundaries #2136
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -503,11 +503,18 @@ func (i *timeRangedIterator) Next() bool { | |
ts := i.EntryIterator.Entry().Timestamp | ||
for ok && i.mint.After(ts) { | ||
ok = i.EntryIterator.Next() | ||
if !ok { | ||
continue | ||
} | ||
ts = i.EntryIterator.Entry().Timestamp | ||
} | ||
|
||
if ok && (i.maxt.Before(ts) || i.maxt.Equal(ts)) { // The maxt is exclusive. | ||
ok = false | ||
if ok { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. couldn't this more simply be expressed as if i.maxt.Before(ts) || i.maxt.Equal(ts) {
ok = false
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this is a very specific path covering the case where both maxt == mint == ts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The shortcut is required. I tried it but the test wasn't passing. |
||
if ts.Equal(i.mint) { // The mint is inclusive | ||
return true | ||
} | ||
if i.maxt.Before(ts) || i.maxt.Equal(ts) { // The maxt is exclusive. | ||
ok = false | ||
} | ||
} | ||
if !ok { | ||
i.EntryIterator.Close() | ||
|
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.
Just thinking out loud, clarifying how this addresses #2124.
With the patch: ignore the current block when none of its entries is within the interval
[mint, maxt]
. Otherwise append it for further processing. Or, in other words: if the current block has any entry within the interval[mint, maxt]
then append it for further processing.The special case discussed in #2124 corresponds to
b.maxt == mint
in this code section here, and with the old behaviormaxt > b.mint && b.maxt > mint
a block containing an entry within the interval[mint, maxt]
was erroneously ignored for further processing.