-
Notifications
You must be signed in to change notification settings - Fork 675
Feat: ingest align block ranges. #2521
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
Conversation
cc @bryanhuhta check out the small refactoring it should make your life easier. |
Co-authored-by: Anton Kolesnikov <[email protected]>
…lock' into feat/ingest-align-block
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.
Great work!
I have tried hard to break it but could not find a way 😆
LGTM
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.
@@ -268,7 +267,7 @@ func (i *Ingester) Flush(ctx context.Context, req *connect.Request[ingesterv1.Fl | |||
i.instancesMtx.RLock() | |||
defer i.instancesMtx.RUnlock() | |||
for _, inst := range i.instances { | |||
if err := inst.Flush(ctx); err != nil { | |||
if err := inst.Flush(ctx, true, "api"); err != nil { |
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.
Should "api"
be a constant somewhere? Just like flushReasonMaxBlockBytes
and flushReasonMaxDuration
.
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.
may be ? It doesn't add much if it used once, but +1 on consistency.
if req.Msg.Start == 0 || req.Msg.End == 0 { | ||
return f.headQueriers().Series(ctx, req) |
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.
👍
@@ -405,6 +423,19 @@ func InRange(q Querier, start, end model.Time) bool { | |||
return true | |||
} | |||
|
|||
type ReadAPI interface { |
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.
This type is here strictly to enforce Queriers
implements these methods, correct? I don't see it used anywhere else.
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.
Yeah we don't really need it, but I think this is the start of a bigger refactoring, we in fact should only implement this in Queriers.
This aligns block ranges when flushing heads.
To do this and still support out of order, we actually maintain multiple head and flush them after a certain period once they go stale.
Still needs to add some tests but it basically work nicely here is a screenshot showing 1m and 30m block perfectly aligned now
Todos