-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[KIP-714] Fix idle ratio calculation for non forwarded queues #5017
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
[KIP-714] Fix idle ratio calculation for non forwarded queues #5017
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
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.
Pull Request Overview
This PR fixes the idle ratio calculation for partition queues that are not forwarded to the main poll queue by switching from per-instance to per-queue timestamps and adjusting related polling logic. Key changes include:
- Adding new per-queue timestamp fields (rkq_ts_last_poll_start and rkq_ts_last_poll_end) in the queue structure.
- Refactoring queue serve/consume functions to pass an additional flag and use the new per-queue timestamps.
- Updating inline functions and call sites in rdkafka_int.h and rdkafka.c to use the per-queue approach.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/rdkafka_queue.h | Introduces new per-queue timestamp fields and prototypes for consume operations. |
src/rdkafka_queue.c | Updates initialization and serve functions to use per-queue timestamps and propagate a consume flag. |
src/rdkafka_int.h | Modifies inline poll functions to operate on per-queue timestamps instead of global instance fields. |
src/rdkafka.c | Adjusts poll and consume call sites to pass the queue pointer to the updated functions. |
Comments suppressed due to low confidence (2)
src/rdkafka_queue.c:390
- [nitpick] Consider renaming the parameter 'consume_call' to 'is_consume_call' to more clearly indicate that it flags a consume operation.
static rd_kafka_op_t *rd_kafka_q_pop_serve0(rd_kafka_q_t *rkq, ... , rd_bool_t consume_call) {
src/rdkafka_int.h:1168
- [nitpick] Since this function now operates on per-queue timestamps, consider renaming it (e.g., to 'rd_kafka_queue_poll_start') to better reflect its behavior.
static RD_INLINE RD_UNUSED void rd_kafka_app_poll_start(rd_kafka_t *rk, rd_kafka_q_t *rkq, rd_ts_t now, rd_bool_t is_blocking) {
8f5aafc
to
a7ff5bb
Compare
d2d3692
to
99a1941
Compare
942fff1
to
9eee36a
Compare
…oll_start" in test 0056. Partition queues can be not forwarded to the main poll queue so these timestamps must be per-queue instead of per-instance. We avoid checking if app polled should be called in case of internal poll calls where we're sure it's not a consume call, we also avoid checking it if "app polled" was already called by a dedicated consume function.
9eee36a
to
46e5582
Compare
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.
Re-approval as already reviewed by @anchitj
Fix for devel assert "rkq->rkq_ts_last_poll_end >= rkq->rkq_ts_last_poll_start" in test 0056.
Partition queues can be not forwarded to the main poll queue so these timestamps must be per-queue instead of per-instance. We avoid checking if app polled should be called in case of internal poll calls where we're sure it's not a consume call, we also avoid checking it if "app polled" was already called by a dedicated consume function.