Skip to content

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
It adds two new components related to making the compactor horizontally scalable:

  1. Worker: It gets the job from the job queue over GRPC, executes the job, and sends the job response to the job queue. It keeps going while it can get jobs from the GRPC connection. If the stream gets disconnected, the worker tries to re-establish it to work on the jobs from the queue.
  2. Worker Manager: It creates a specified number of workers and implements a Stop method to stop all the workers at once.

I have done some minor changes to the existing Queue code, like:

  1. Retry the failed jobs in the goroutine we run for retrying the timed-out jobs.
  2. Removed unused Stop function.
  3. Close the q.stop channel before closing q.queue so that builders stop first, and they avoid writing to the queue, which otherwise would lead to panics.

Checklist

  • Tests updated

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner June 19, 2025 10:32
@sandeepsukhani sandeepsukhani merged commit d05c4bc into main Jun 20, 2025
65 checks passed
@sandeepsukhani sandeepsukhani deleted the compactor-hs-add-worker branch June 20, 2025 14:03
@paul1r paul1r mentioned this pull request Jun 20, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants