wbarnha / kafka-python-ng

Fork for Python client for Apache Kafka
https://wbarnha.github.io/kafka-python-ng/
Apache License 2.0
67 stars 8 forks source link

feat AdminClient: support delete_records #136

Open wbarnha opened 6 months ago

wbarnha commented 6 months ago

Hey!

This PR is based on https://github.com/dpkp/kafka-python/pull/2062 It implements delete_records for AdminClient. Thanks to @10101010 for the initial PR.

This PR contains the following improvements on that version:

  1. It fixes review comments: adds tests and removes formatting peculiarities
  2. It contains an optimization that is important to me: if multiple partitions live on the same broker, it sends one request, instead of one per partition. It is important because I use delete_records in integration tests, and this significantly improves test startup/teardown speed.
  3. It checks for errors as much as it can.

I tested it locally with 2.6.0 + py3.9, I'm assuming CI will check for everything else. Additionally, I would like some direction from maintainers on whether it is possible/required to test this with a multi-broker setup - I couldn't find an example in the tests that uses multiple brokers.

Resolves: #2344


This change is Reviewable