confluentinc / librdkafka

The Apache Kafka C/C++ library
Other
7.36k stars 3.11k forks source link

KIP 951 - All phases - cherry picked #4756

Closed anchitj closed 1 week ago

emasab commented 1 week ago

Please add this fix too to the PR. To avoid logging when the id doesn't change and to use rd_kafka_Uuid_base64str instead of rd_kafka_Uuid_str that allocates and leaks memory (and is only for debugging)

                if (rd_kafka_Uuid_cmp(mdit->topic_id, RD_KAFKA_UUID_ZERO) &&
                    rd_kafka_Uuid_cmp(mdit->topic_id, rkt->rkt_topic_id)) {
                        /* FIXME: an offset reset must be triggered.
                         * when rkt_topic_id wasn't zero.
                         * There are no problems
                         * in test 0107_topic_recreate if offsets in new
                         * topic are lower than in previous one,
                         * causing an out of range and an offset reset,
                         * but the rarer case where they're higher needs
                         * to be checked. */
                        rd_kafka_dbg(
                            rk, TOPIC | RD_KAFKA_DBG_METADATA, "METADATA",
                            "Topic %s changed id from %s to %s",
                            rkt->rkt_topic->str,
                            rd_kafka_Uuid_base64str(&rkt->rkt_topic_id),
                            rd_kafka_Uuid_base64str(&mdit->topic_id));
                        rkt->rkt_topic_id = mdit->topic_id;
                }
emasab commented 1 week ago

Please rebase with dependency upgrade commit merged