Skip to content

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Apr 3, 2025

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.

@Copilot Copilot AI review requested due to automatic review settings April 3, 2025 12:21
@emasab emasab requested a review from a team as a code owner April 3, 2025 12:21
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

@Copilot Copilot AI left a 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) {

@emasab emasab changed the title [KIP-714] Fix idle ratio calculation for not forwarded queues [KIP-714] Fix idle ratio calculation for non forwarded queues Apr 6, 2025
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_idle_ratio_calculation_not_forwarded_queues branch from 8f5aafc to a7ff5bb Compare April 8, 2025 18:32
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_idle_ratio_calculation_not_forwarded_queues branch 2 times, most recently from d2d3692 to 99a1941 Compare June 5, 2025 09:14
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_idle_ratio_calculation_not_forwarded_queues branch from 942fff1 to 9eee36a Compare June 10, 2025 10:25
emasab added 2 commits June 16, 2025 10:13
…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.
@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_kip714_fix_idle_ratio_calculation_not_forwarded_queues branch from 9eee36a to 46e5582 Compare June 16, 2025 08:20
Copy link
Member

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

@emasab emasab merged commit 1510d2b into master Jun 17, 2025
2 checks passed
@emasab emasab deleted the dev_kip714_fix_idle_ratio_calculation_not_forwarded_queues branch June 17, 2025 10:58
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.

3 participants