Skip to content

Add Topic and Partition Deletion Functionality to Mock Broker#5350

Open
Ankith L (Ankith-Confluent) wants to merge 3 commits intodev_kip-932_queues-for-kafkafrom
dev_kip-932_mock_broker_additional_functionalitles
Open

Add Topic and Partition Deletion Functionality to Mock Broker#5350
Ankith L (Ankith-Confluent) wants to merge 3 commits intodev_kip-932_queues-for-kafkafrom
dev_kip-932_mock_broker_additional_functionalitles

Conversation

@Ankith-Confluent
Copy link
Member

Implement rd_kafka_mock_topic_delete() to delete a topic and its partitions.
Implement rd_kafka_mock_partition_delete_records() to delete records before a specified offset.
Add tests for topic deletion and partition record deletion to ensure correct behavior.

- Implement `rd_kafka_mock_topic_delete()` to delete a topic and its partitions.
- Implement `rd_kafka_mock_partition_delete_records()` to delete records before a specified offset.
- Update command handling in the mock cluster to support new delete operations.
- Add tests for topic deletion and partition record deletion to ensure correct behavior.
- Introduce max size limit for share groups with appropriate handling in join requests.
@Ankith-Confluent Ankith L (Ankith-Confluent) requested a review from a team as a code owner March 7, 2026 14:17
@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
Member

@k-raina Kaushik Raina (k-raina) left a comment

Choose a reason for hiding this comment

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

Thanks for PR! Left couple of comments

* @brief Create a share consumer connected to mock cluster using the
* public share consumer API.
*/
static rd_kafka_share_t *create_mock_share_consumer(const char *bootstraps,

Choose a reason for hiding this comment

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

Is new function needed?

/**
* @brief Deletes a topic and all its partitions.
*
* Subsequent requests referencing the topic will recieve

Choose a reason for hiding this comment

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

Nit: receive

Comment on lines +261 to +262
* @return RD_KAFKA_RESP_ERR_NO_ERROR on success
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PARTITION if the topic does not

Choose a reason for hiding this comment

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

Suggested change
* @return RD_KAFKA_RESP_ERR_NO_ERROR on success
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PARTITION if the topic does not
* @return RD_KAFKA_RESP_ERR_NO_ERROR on success
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART if the topic does not

/* Consume - expect no data messages since topic is deleted */
rkm = rd_kafka_consumer_poll(c, 5000);
if (rkm) {
TEST_ASSERT(rkm->err != RD_KAFKA_RESP_ERR_NO_ERROR,

Choose a reason for hiding this comment

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

Suggested change
TEST_ASSERT(rkm->err != RD_KAFKA_RESP_ERR_NO_ERROR,
TEST_ASSERT(rkm != NULL && rkm->err != RD_KAFKA_RESP_ERR_NO_ERROR,
"Expected error from deleted topic");R,

Maybe check rkm?

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