-
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
queue drain option support #6433
Conversation
Looks good to me so far. I was planning to port the Q clients to Java/JRuby soon anyway. I would rather do the port when the source is restructured i.e. #6431 |
Sorry didn't notice I need to review this, I will take a look asap. |
5ba395f
to
fbb92ac
Compare
I rebased and would like to reboot this PR. |
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.
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.
The code looks good to me, but there are some tests failings that need to be adjusted for this changes.
1e05eb0
to
7cb70b3
Compare
@ph ok found and fixed the spec problems, some where related to empty batch handling as discussed, others related to the metrics start where my refactor had the call to |
Build successful! 🎉 |
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.
LGTM
wip queue drain option metrics on empty batches reenabled spec cosmetic fixes stats collection, mutex, specs, empty batch handling start_metrics
9e8f961
to
568666c
Compare
rebased & squashed, merged into master and 5.x |
This is in [WIP] state because the metrics on empty batch/queue need to be assessed - The creation of an empty final batch to handle the final flush upon shutdown which did not contain metrics yielded some errors so I added metrics to empty batches. There was originally a check for empty batches read to not start metrics but I believe this was bug because if this empty batch got used in a flush signal (slim chance) it would have crashed because of unstarted metrics for that batch.
Core tests/specs are passing locally.
This PR adds support for a queue drain option. It relates to issue #6085 and it is necessary for the upcoming BatchedQueue implementation. The goal is to be able to signal logstash to drain the queue before exiting on a normal shutdown. It is necessary for in-memory queueing support where events can be buffered.
It refactors the Wrapped xxx Queue ReadClient classes to not read the next batch directly in the constructor but instead expose a
read_batch
method so it is now possible to create a new empty batch.The pipeline worker loop becomes a bit clearer to understand with regard to signal handling (shutdown & flush) and shutdown handling for final flush in particular.
By default this option is currently turned off and can be turned on in the config using
queue.drain: true
.TODO