KIP-848 migration guide says never use assign()/unassign() with group.protocol='consumer'; it's only rejected after subscribe
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- kafka, python
- Área
- documentation
Línea de trabajo
Empieza por la sección «Rebalance Callback Changes» de docs/kip-848-migration-guide.md y la sección correspondiente de docs/kip-848-migration-guide.rst. Compara la redacción con el comportamiento descrito en el issue y con la sección «Manual partition assignment» de la guía de .NET. El objetivo se cumple cuando ambas guías de Python aclaran que manual assign() está admitido antes de suscribirse y describen la restricción después de suscribirse.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
docs/kip-848-migration-guide.md, section "Rebalance Callback Changes":
- **Do not** use `consumer.assign()` or `consumer.unassign()` when using `group.protocol='consumer'` (KIP-848).
docs/kip-848-migration-guide.rst has the same text:
- **Do not** use ``consumer.assign()`` or ``consumer.unassign()`` when
using ``group.protocol='consumer'`` (KIP-848).
This is broader than what the client actually enforces. In librdkafka, the
check that rejects a non-incremental assign ("Changes to the current
assignment must be made using incremental_assign() or incremental_unassign()
when rebalance protocol type is COOPERATIVE") only applies once the rebalance
protocol is COOPERATIVE. With the consumer protocol, that only happens
after the consumer has subscribed. Before that, rd_kafka_cgrp_rebalance_protocol()
returns NONE:
if (rkcg->rkcg_group_protocol == RD_KAFKA_GROUP_PROTOCOL_CONSUMER) {
if (!(rkcg->rkcg_consumer_flags &
RD_KAFKA_CGRP_CONSUMER_F_SUBSCRIBED_ONCE))
return RD_KAFKA_REBALANCE_PROTOCOL_NONE;
return RD_KAFKA_REBALANCE_PROTOCOL_COOPERATIVE;
}
So consumer.assign() for manual partition assignment, without calling
subscribe(), still works with group.protocol='consumer'.
Why it matters
Applications that use manual assignment, often with a group.id set only for
committing offsets, read this guide to decide whether they can switch
group.protocol. As written, the guide tells them they can't use assign()
at all, which isn't true. The restriction that actually matters, using only
incremental_assign()/incremental_unassign() once subscribed, gets lost
in the over-broad wording.
Suggested fix
-- **Do not** use `consumer.assign()` or `consumer.unassign()` when using `group.protocol='consumer'` (KIP-848).
+- **Do not** use `consumer.assign()` or `consumer.unassign()` after subscribing with `group.protocol='consumer'` (KIP-848).
+ `consumer.assign()` can still be used for manual partition assignment without subscribing.
and the same change in docs/kip-848-migration-guide.rst:
-- **Do not** use ``consumer.assign()`` or ``consumer.unassign()`` when
- using ``group.protocol='consumer'`` (KIP-848).
+- **Do not** use ``consumer.assign()`` or ``consumer.unassign()`` after
+ subscribing with ``group.protocol='consumer'`` (KIP-848).
+ ``consumer.assign()`` can still be used for manual partition assignment
+ without subscribing.
Upstream reference
confluent-kafka-go fixed the same sentence in its copy of this guide in
confluentinc/confluent-kafka-go@cc3d3f7 ("Few minor nits", 2025-10-10):
--- a/kafka/kip-848-migration-guide.md
+++ b/kafka/kip-848-migration-guide.md
@@ -51,15 +51,15 @@
- In the **rebalance callbacks**, you **must only use** (optional - if not used, client will handle it internally):
- `consumer.IncrementalAssign(e.Partitions)` to assign new partitions
- `consumer.IncrementalUnassign(e.Partitions)` to revoke partitions
-- **Do not** use `consumer.Assign()` or `consumer.Unassign()` when using `group.protocol='consumer'` (KIP-848).
+- **Do not** use `consumer.Assign()` or `consumer.Unassign()` after subscribing with `group.protocol='consumer'` (KIP-848).
The .NET guide (doc/kip-848-migration-guide.md) already describes it
correctly in its "Manual partition assignment" section: "You can still use
Assign() before being subscribed but after subscribing you can only use
IncrementalAssign() and IncrementalUnassign()." All three clients use
the same librdkafka check, so the Python guide can use the same wording.
I can submit a PR for this.
- Lenguaje dominante
- Python
- Estrellas
- 528
- Forks
- 977
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 19
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de confluentinc/confluent-kafka-python
-
init_transactions docstring says the transaction.timeout.ms clock starts there; it starts at begin_transactionPosiblemente ocupada @hidingmyname la tomó hace 22 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
confluentinc/confluent-kafka-python#2404 ·
Los mantenedores suelen responder en 3 días
-
Wrong type annotations for read only mapping types.Posiblemente ocupada @RasmusNygren la tomó hace 198 días. Abiertostatus:under-review
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
confluentinc/confluent-kafka-python#2244 ·
Los mantenedores suelen responder en 3 días
-
Wrong signature for `KafkaError`'s 1st parameter in `.pyi`Posiblemente ocupada @wgu9 la tomó hace 159 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
confluentinc/confluent-kafka-python#2243 ·
Los mantenedores suelen responder en 3 días
-
Use joserfc instead of authlib.josePosiblemente ocupada @yvaishalirao la tomó hace 135 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
confluentinc/confluent-kafka-python#2242 · 2 comentarios ·
Los mantenedores suelen responder en 3 días
-
Producer.poll(timeout) blocks for full timeout after delivery callback fires (regression in 2.13.0)Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertocomponent:producer
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
confluentinc/confluent-kafka-python#2215 · 1 comentario · 3 reacciones ·
Los mantenedores suelen responder en 3 días
Todos los issues de confluentinc/confluent-kafka-python
Issues similares
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
flashinfer-ai/flashinfer#9803 ·
Los mantenedores suelen responder en 1 día
-
bug frontend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oscarbol09/thesisforge#61 ·
-
api bug performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
oscarbol09/audiobard#159 ·
-
area:web p2 product:business triage:active type:bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 89/100
cuadrao-ai/argus#2328 ·
Los mantenedores suelen responder en 1 día
-
bug frontend good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nikhilb2/simple_invoicing#907 ·