question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

specify partition for one consumer in a group can not rebalance the others

See original GitHub issue

I have a topic with 150 partitions [0 - 149] And I have three consumers joinning the same group.

By default, each consumer is assigned with their own ranges.

  • Consumer A : [0-49]
  • Consumer B : [50-99]
  • Consumer C : [100-149]

I want consumer B only consumes a specific partition. Hence within its SetPartitionsRevokedHandler, only a specific one is returned.

IEnumerable<TopicPartitionOffset> OnPartitionsAssigned(IConsumer<MessageKey, byte[]> consumer, List<TopicPartition> partitions)
 {
            return new TopicPartitionOffset[]
            {
                new TopicPartitionOffset(  new TopicPartition(_topic, 0), Offset.Unset),
            };
}

I expect consumer A and C would be assigned with partition [1 - 149] I tested but it does not work in that way. Consumer A & C are not rebalanced and they are still assigned with 50 partitions each.

  • Consumer A : [0-49]
  • Consumer C : [100-149]

Is this a bug of client?

Confluent.Kafka nuget version : 1.2.1

  • Apache Kafka version : 0.10
  • Client configuration : EnableAutoCommit : false; AutoOffsetReset : Earliest

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ChadJessupcommented, May 24, 2020

+1 for custom partition assignors feature, I need that for kafka stream .net implementation. Image you have a joiner processor between KStream(topic1) and one KTable(topic2). Your stream application is scalable, so you must have the same subscription partition in one instance of your application. Without custom partition assignors, it’s very complicated to that, or maybe assign partition manually but more complicated.

@LGouellec - I’ve had a PR open for a few months at https://github.com/confluentinc/confluent-kafka-dotnet/pull/1133 with this.

If you’re blocked, that might help you out until some official API comes into the picture.

0reactions
ChadJessupcommented, Jul 24, 2020

+1 for custom partition assignors feature, I need that for kafka stream .net implementation. Image you have a joiner processor between KStream(topic1) and one KTable(topic2). Your stream application is scalable, so you must have the same subscription partition in one instance of your application. Without custom partition assignors, it’s very complicated to that, or maybe assign partition manually but more complicated.

@LGouellec - I’ve had a PR open for a few months at #1133 with this. If you’re blocked, that might help you out until some official API comes into the picture.

@ChadJessup I can’t see where I can set my custom partition assignor in your PR. I see your SetPartitioner(…) in ProducerBuilder, but my need is setting : Custom Partition Assignor (like JAVA Api) because with .net library, you just have both choice for partition assignor strategy (range ou roundrobin)

@LGouellec - you’re right, sorry - I got confused on partitioners and assignors. I’m taking a look at adding assignors here real soon as a PR, but it’ll probably wait on feedback on whatever happens with #1297

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kafka Consumers under the same group are ...
Kafka Consumers under the same group are consuming the same partition after rebalancing ... According to Kafka documentation: Kafka provides the ...
Read more >
Kafka consumer group not rebalancing when increasing ...
I have a situation where in my dev environment, my Kafka consumer groups will rebalance and distribute partitions to consumer instances just ...
Read more >
Solving My Weird Kafka Rebalancing Problems & ...
The group leader reassigns all partitions and removes every partition from the assignment that is to be transferred to another consumer.
Read more >
Understanding Increased Consumer Rebalance Time
Rebalancing comes into play in Kafka when consumers join or leave a consumer group. In either case, there is a different number of...
Read more >
Consumer Group Protocol: Scalability and Fault Tolerance
As consumers are added to the group, or when consumers fail or are removed from the group for some other reason, the workload...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found