admin: reuse cluster._coordinators; use CoordinatorType#3050
Merged
Conversation
…collide with group lookups
Prep for KIP-664 (DescribeTransactions). FindCoordinator's KeyType
distinguishes group (0) from transaction (1) coordinators, and the
same string id can legitimately be both. The previous
`_coordinator_cache` was keyed by raw key only, so a transaction
coordinator lookup could silently return a group-coordinator node id
(and vice versa).
- `_find_coordinator_id(s)` gain a `key_type` parameter, default 0.
- `_coordinator_cache` is now keyed by `(key_type, key)`.
- All existing callers (consumer-group paths) keep the default
`key_type=0` and behaviour is unchanged.
…cache
KafkaAdminClient owned its own `_coordinator_cache` dict that
mirrored ClusterMetadata._coordinators in both shape (keyed by
(CoordinatorType, key)) and lifecycle. Drop the duplicate.
- _find_coordinator_ids now reads through cluster.get_coordinator
and writes through cluster.add_coordinator(synthesize_node_id=False)
so admin keeps reusing the existing broker connection (unlike
the producer's TransactionManager which gets a dedicated
`coordinator-N` connection).
- The v4+ Coordinator row is duck-compatible with the v0-v3
response shape (both have error_code/error_message/node_id/host/port),
so add_coordinator handles either with no adapter.
- Per-row errors raise from add_coordinator now, so the explicit
error_code check in the admin path is gone too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.