From cb2868faabcf445afec62caca8eeac54d1c5d904 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Tue, 29 Apr 2025 09:57:21 -0700 Subject: [PATCH 1/4] Bump version for development --- kafka/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/version.py b/kafka/version.py index 36a511eca..8c2fbc4b4 100644 --- a/kafka/version.py +++ b/kafka/version.py @@ -1 +1 @@ -__version__ = '2.2.1' +__version__ = '2.2.2.dev' From 998efc250d3d228e29ce1a488a4d2c0d60d31a2b Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Tue, 29 Apr 2025 10:10:28 -0700 Subject: [PATCH 2/4] Fix lint errors --- kafka/admin/client.py | 2 +- kafka/producer/sender.py | 2 +- kafka/producer/transaction_manager.py | 12 ++++++------ kafka/record/default_records.py | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/kafka/admin/client.py b/kafka/admin/client.py index 5bbc99f30..82aaa68e9 100644 --- a/kafka/admin/client.py +++ b/kafka/admin/client.py @@ -274,7 +274,7 @@ def _refresh_controller_id(self, timeout_ms=30000): self._controller_id = controller_id return else: - raise Errors.NodeNotAvailableError('controller') + raise Errors.NodeNotReadyError('controller') else: raise UnrecognizedBrokerVersion( "Kafka Admin interface cannot determine the controller using MetadataRequest_v{}." diff --git a/kafka/producer/sender.py b/kafka/producer/sender.py index dcb3ecbdc..4a88b2f7a 100644 --- a/kafka/producer/sender.py +++ b/kafka/producer/sender.py @@ -315,7 +315,7 @@ def _maybe_send_transactional_request(self): return True except Exception as e: - log.warn("%s: Got an exception when trying to find a node to send a transactional request to. Going to back off and retry", str(self), e) + log.warn("%s: Got an exception when trying to find a node to send a transactional request to. Going to back off and retry: %s", str(self), e) if next_request_handler.needs_coordinator(): self._transaction_manager.lookup_coordinator_for_request(next_request_handler) break diff --git a/kafka/producer/transaction_manager.py b/kafka/producer/transaction_manager.py index f8f9d2f52..7302eb00e 100644 --- a/kafka/producer/transaction_manager.py +++ b/kafka/producer/transaction_manager.py @@ -260,7 +260,7 @@ def transition_to_abortable_error(self, exc): with self._lock: if self._current_state == TransactionState.ABORTING_TRANSACTION: log.debug("Skipping transition to abortable error state since the transaction is already being " - " aborted. Underlying exception: ", exc) + " aborted. Underlying exception: %s", exc) return self._transition_to(TransactionState.ABORTABLE_ERROR, error=exc) @@ -687,7 +687,7 @@ def handle_response(self, response): if error is Errors.NoError: continue elif error in (Errors.CoordinatorNotAvailableError, Errors.NotCoordinatorError): - self.transaction_manager._lookup_coordinator('transaction', self.transactiona_id) + self.transaction_manager._lookup_coordinator('transaction', self.transactional_id) self.reenqueue() return elif error is Errors.ConcurrentTransactionsError: @@ -726,7 +726,7 @@ def handle_response(self, response): self.transaction_manager._pending_partitions_in_transaction -= partitions if unauthorized_topics: - self.abortable_error(Errors.TopicAuthorizationError(unauthorized_topics)) + self.abortable_error(Errors.TopicAuthorizationFailedError(unauthorized_topics)) elif has_partition_errors: self.abortable_error(Errors.KafkaError("Could not add partitions to transaction due to errors: %s" % (results))) else: @@ -795,7 +795,7 @@ def handle_response(self, response): elif error is Errors.TransactionalIdAuthorizationFailedError: self.fatal_error(error()) elif error is Errors.GroupAuthorizationFailedError: - self.abortable_error(Errors.GroupAuthorizationError(self._coord_key)) + self.abortable_error(error(self._coord_key)) else: self.fatal_error(Errors.KafkaError( "Could not find a coordinator with type %s with key %s due to" @@ -888,7 +888,7 @@ def handle_response(self, response): elif error is Errors.TransactionalIdAuthorizationFailedError: self.fatal_error(error()) elif error is Errors.GroupAuthorizationFailedError: - self.abortable_error(Errors.GroupAuthorizationError(self.consumer_group_id)) + self.abortable_error(error(self.consumer_group_id)) else: self.fatal_error(Errors.KafkaError("Unexpected error in AddOffsetsToTxnResponse: %s" % (error()))) @@ -955,7 +955,7 @@ def handle_response(self, response): elif error is Errors.UnknownTopicOrPartitionError: retriable_failure = True elif error is Errors.GroupAuthorizationFailedError: - self.abortable_error(Errors.GroupAuthorizationError(self.consumer_group_id)) + self.abortable_error(error(self.consumer_group_id)) return elif error in (Errors.TransactionalIdAuthorizationFailedError, Errors.InvalidProducerEpochError, diff --git a/kafka/record/default_records.py b/kafka/record/default_records.py index b495c76fe..a3b9cd5d8 100644 --- a/kafka/record/default_records.py +++ b/kafka/record/default_records.py @@ -117,6 +117,8 @@ def _assert_has_codec(self, compression_type): checker, name = codecs.has_lz4, "lz4" elif compression_type == self.CODEC_ZSTD: checker, name = codecs.has_zstd, "zstd" + else: + raise UnsupportedCodecError("Unrecognized compression type: %s" % (compression_type,)) if not checker(): raise UnsupportedCodecError( "Libraries for {} compression codec not found".format(name)) From 3d31c14bedd15e26b18cfc3c62811005b85596c1 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Wed, 30 Apr 2025 10:34:48 -0700 Subject: [PATCH 3/4] Patch Release 2.2.2 --- CHANGES.md | 5 +++++ docs/changelog.rst | 8 ++++++++ kafka/version.py | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index ab037e3b4..62ac81460 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# 2.2.2 (Apr 30, 2025) + +Fixes +* Fix lint errors + # 2.2.1 (Apr 29, 2025) Fixes diff --git a/docs/changelog.rst b/docs/changelog.rst index c701f5e9c..f2d7d4702 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,14 @@ Changelog ========= +2.2.2 (Apr 30, 2025) +#################### + +Fixes +----- +* Fix lint errors + + 2.2.1 (Apr 29, 2025) #################### diff --git a/kafka/version.py b/kafka/version.py index 8c2fbc4b4..f1edb192f 100644 --- a/kafka/version.py +++ b/kafka/version.py @@ -1 +1 @@ -__version__ = '2.2.2.dev' +__version__ = '2.2.2' From 26fbd2eed37224a6815cf61f4f302bf060945576 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Wed, 30 Apr 2025 10:46:59 -0700 Subject: [PATCH 4/4] Bump version for development --- kafka/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/version.py b/kafka/version.py index f1edb192f..9c8fb8355 100644 --- a/kafka/version.py +++ b/kafka/version.py @@ -1 +1 @@ -__version__ = '2.2.2' +__version__ = '2.2.3.dev'