Skip to content

Commit

Permalink
Address comments: Cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
milindl committed Sep 4, 2023
1 parent 6239372 commit beccb0c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
7 changes: 4 additions & 3 deletions src/rdkafka_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -7990,7 +7990,7 @@ rd_kafka_TopicPartitionInfo_destroy(rd_kafka_TopicPartitionInfo_t *pinfo) {
* @param authorized_operations acl operations allowed for topic.
* @param error Topic error reported by the broker.
* @return A newly allocated TopicDescription object.
* Use rd_kafka_TopicDescription_destroy() to free when done.
* @remark Use rd_kafka_TopicDescription_destroy() to free when done.
*/
static rd_kafka_TopicDescription_t *rd_kafka_TopicDescription_new(
const char *topic,
Expand Down Expand Up @@ -8041,7 +8041,7 @@ static rd_kafka_TopicDescription_t *rd_kafka_TopicDescription_new(
* @param topic topic name
* @param error Topic error reported by the broker.
* @return A newly allocated TopicDescription with the passed error.
* Use rd_kafka_TopicDescription_destroy() to free when done.
* @remark Use rd_kafka_TopicDescription_destroy() to free when done.
*/
static rd_kafka_TopicDescription_t *
rd_kafka_TopicDescription_new_error(const char *topic,
Expand Down Expand Up @@ -8364,7 +8364,8 @@ const rd_kafka_Node_t *rd_kafka_DescribeCluster_result_controller(
* @param controller_id current controller_id.
* @param md metadata struct returned by parse_metadata().
*
* @returns new ClusterDescription object.
* @returns newly allocated ClusterDescription object.
* @remark Use rd_kafka_ClusterDescription_destroy() to free when done.
*/
static rd_kafka_ClusterDescription_t *
rd_kafka_ClusterDescription_new(const rd_kafka_metadata_internal_t *mdi) {
Expand Down
42 changes: 24 additions & 18 deletions src/rdkafka_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,11 @@ rd_kafka_parse_Metadata0(rd_kafka_broker_t *rkb,
rd_kafka_metadata_internal_t *mdi = NULL;
rd_kafka_metadata_t *md = NULL;
size_t rkb_namelen;
const int log_decode_errors = LOG_ERR;
rd_list_t *missing_topics = NULL;
const rd_list_t *requested_topics =
request ? request->rkbuf_u.Metadata.topics : request_topics;
rd_bool_t all_topics =
request ? request->rkbuf_u.Metadata.all_topics : rd_false;
rd_bool_t cgrp_update =
request ? (request->rkbuf_u.Metadata.cgrp_update && rk->rk_cgrp)
: rd_false;
const int log_decode_errors = LOG_ERR;
rd_list_t *missing_topics = NULL;
const rd_list_t *requested_topics = request_topics;
rd_bool_t all_topics = rd_false;
rd_bool_t cgrp_update = rd_false;
rd_bool_t has_reliable_leader_epochs =
rd_kafka_has_reliable_leader_epochs(rkb);
int ApiVersion = rkbuf->rkbuf_reqhdr.ApiVersion;
Expand All @@ -510,11 +506,15 @@ rd_kafka_parse_Metadata0(rd_kafka_broker_t *rkb,
* to contain the partition to rack map. */
rd_bool_t has_client_rack = rk->rk_conf.client_rack &&
RD_KAFKAP_STR_LEN(rk->rk_conf.client_rack);
/* If force_racks is true, the outptr mdip has to contain the partition
* to rack map. */
rd_bool_t force_rack_computation =
request ? request->rkbuf_u.Metadata.force_racks : rd_false;
rd_bool_t compute_racks = has_client_rack || force_rack_computation;
rd_bool_t compute_racks = has_client_rack;

if (request) {
requested_topics = request->rkbuf_u.Metadata.topics;
all_topics = request->rkbuf_u.Metadata.all_topics;
cgrp_update =
request->rkbuf_u.Metadata.cgrp_update && rk->rk_cgrp;
compute_racks |= request->rkbuf_u.Metadata.force_racks;
}

/* If there's reason is NULL, set it to a human-readable string. */
if (!reason)
Expand Down Expand Up @@ -1024,10 +1024,12 @@ rd_kafka_parse_Metadata0(rd_kafka_broker_t *rkb,
*
* @param request Initial Metadata request, containing the topic information.
* Must not be NULL.
* We require the topic information while parsing to make sure
* that there are no missing topics.
* @param mdip A pointer to (rd_kafka_metadata_internal_t *) into which the
* metadata will be marshalled (set to NULL on error.)
*
* @returns an error code on parse failure, else NO_ERRRO.
* @returns an error code on parse failure, else NO_ERROR.
*
* @locality rdkafka main thread
*/
Expand All @@ -1044,12 +1046,16 @@ rd_kafka_parse_Metadata(rd_kafka_broker_t *rkb,
/**
* @brief Handle a Metadata response message for admin requests.
*
* @param request_topics List containing topics in Metadata request. Must not be
* NULL.
* @param request_topics List containing topics in Metadata request. Must not
* be NULL. It is more convenient in the Admin flow to
* preserve the topic names rather than the initial
* Metadata request.
* We require the topic information while parsing to make
* sure that there are no missing topics.
* @param mdip A pointer to (rd_kafka_metadata_internal_t *) into which the
* metadata will be marshalled (set to NULL on error.)
*
* @returns an error code on parse failure, else NO_ERRRO.
* @returns an error code on parse failure, else NO_ERROR.
*
* @locality rdkafka main thread
*/
Expand Down
11 changes: 6 additions & 5 deletions src/rdkafka_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -2180,11 +2180,12 @@ static void rd_kafka_handle_Metadata(rd_kafka_t *rk,
/**
* @brief Internal implementation of MetadataRequest (does not send).
*
* @param force - 1: force a full request (including all topics and brokers)
* even if there is such a request already in flight.
* - 0: check if there are multiple outstanding full requests, and
* don't send one if there is already one present.
* (See note below.)
* @param force - rd_true: force a full request (including all topics and
* brokers) even if there is such a request already
* in flight.
* - rd_false: check if there are multiple outstanding full
* requests, and don't send one if there is already
* one present. (See note below.)
*
* If full metadata for all topics is requested (or
* all brokers, which results in all-topics on older brokers) and there is
Expand Down

0 comments on commit beccb0c

Please sign in to comment.