Skip to content

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

Merged
merged 9 commits into from
Oct 12, 2023
Merged

Feat: ingest align block ranges. #2521

merged 9 commits into from
Oct 12, 2023

Conversation

cyriltovena
Copy link
Contributor

@cyriltovena cyriltovena commented Oct 11, 2023

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

image

Todos

  • Cleanup and better default config
  • Tests
  • Reword config parameters

@cyriltovena cyriltovena requested a review from a team as a code owner October 11, 2023 15:46
@cyriltovena
Copy link
Contributor Author

cc @bryanhuhta check out the small refactoring it should make your life easier.

@cyriltovena cyriltovena marked this pull request as draft October 11, 2023 15:49
@cyriltovena cyriltovena marked this pull request as ready for review October 12, 2023 14:18
@cyriltovena cyriltovena mentioned this pull request Oct 12, 2023
7 tasks
Copy link
Contributor

@simonswine simonswine left a 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

Copy link
Contributor

@bryanhuhta bryanhuhta left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +394 to +395
if req.Msg.Start == 0 || req.Msg.End == 0 {
return f.headQueriers().Series(ctx, req)
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@cyriltovena cyriltovena merged commit 75cc34d into main Oct 12, 2023
@cyriltovena cyriltovena deleted the feat/ingest-align-block branch October 12, 2023 18:48
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.

4 participants