Skip to content
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

Add rd_kafka_query_watermark_offsets call to rd_kafka_topic_leader_query #694

Closed
wants to merge 1 commit into from

Conversation

JohanAR
Copy link

@JohanAR JohanAR commented Jun 16, 2016

Query watermark offsets uses rd_kafka_toppar_get2 to create a topic which
in turn calls rd_kafka_topic_new0, which unlike rd_kafka_topic_new does
not call rd_kafka_topic_leader_query.

This had the effect that rd_kafka_toppar_leader would return NULL until
rd_kafka_topic_leader_query was called by rd_kafka_topic_scan_tmr_cb,
which is run every 1000ms by a timer. Because of this query watermark
offsets would occasionally take 1000ms longer to finish, or return
WAIT_COORD error if timeout was shorter than that.

Query watermark offsets uses rd_kafka_toppar_get2 to create a topic which
in turn calls rd_kafka_topic_new0, which unlike rd_kafka_topic_new does
not call rd_kafka_topic_leader_query.

This had the effect that rd_kafka_toppar_leader would return NULL until
rd_kafka_topic_leader_query was called by rd_kafka_topic_scan_tmr_cb,
which is run every 1000ms by a timer. Because of this query watermark
offsets would occasionally take 1000ms longer to finish, or return
WAIT_COORD error if timeout was shorter than that.
@@ -1911,6 +1911,9 @@ rd_kafka_query_watermark_offsets (rd_kafka_t *rk, const char *topic,
return RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION;
rktp = rd_kafka_toppar_s2i(s_rktp);

/* Query for the topic leader (async) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to do this if there is no leader found, so maybe move this down a couple of lines below the failing rd_kafka_toppar_leader() check?

@edenhill edenhill closed this in 1277250 Jun 18, 2016
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.

2 participants