Skip to content

Commit

Permalink
feat(kafka): Start ingester flush loop before trying to catch up from…
Browse files Browse the repository at this point in the history
… Kafka
  • Loading branch information
benclive committed Oct 16, 2024
1 parent 08b1a90 commit 37259bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ func (i *Ingester) starting(ctx context.Context) (err error) {
i.setPrepareShutdown()
}

// start our flush loop: this needs to start before the partition-reader in order for chunks to be shipped in the case of Kafka catching up.
i.loopDone.Add(1)
go i.loop()

// When kafka ingestion is enabled, we have to make sure that reader catches up replaying the partition
// BEFORE the ingester ring lifecycler is started, because once the ingester ring lifecycler will start
// it will switch the ingester state in the ring to ACTIVE.
Expand Down Expand Up @@ -646,9 +650,7 @@ func (i *Ingester) starting(ctx context.Context) (err error) {
return fmt.Errorf("failed to start partition ring lifecycler: %w", err)
}
}
// start our loop
i.loopDone.Add(1)
go i.loop()

return nil
}

Expand Down

0 comments on commit 37259bf

Please sign in to comment.