Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka consumer offset max value?

I was googling and reading Kafka documentation but I couldn't find out the max value of a consumer offset and whether there is offset wraparound after max value. I understand offset is an Int64 value so max value is 0xFFFFFFFFFFFFFFFF. If there is wraparound, how does Kafka handle this situation?

like image 917
rodolk Avatar asked Dec 22 '15 05:12

rodolk


People also ask

What is Max offset in Kafka?

Fundamentally, the only maximum offset imposed by Kafka is that it has to be a 64-bit value. So it could be as large as LONG_MAX.

What determines Kafka consumer offset?

Consumer offset is recorded in Kafka so if the consumer processing the partition in the consumer group goes down and when the consumer comes back, the consumer will read the offset to start reading the messages from the topic from where it is left off. This avoids duplication in message consumption.

What is offset value in Kafka?

The offset is a simple integer number that is used by Kafka to maintain the current position of a consumer. That's it. The current offset is a pointer to the last record that Kafka has already sent to a consumer in the most recent poll. So, the consumer doesn't get the same record twice because of the current offset.

How do I set consumer offset in Kafka?

How to change consumer offset? Use the kafka-consumer-groups.sh to change or reset the offset. You would have to specify the topic, consumer group and use the –reset-offsets flag to change the offset.


2 Answers

According to this post, the offset is not reset:

We don't roll back offset at this moment. Since the offset is a long, it can last for a really long time. If you write 1TB a day, you can keep going for about 4 million days.

Plus, you can always use more partitions (each partition has its own offset).

So as Luciano said, probably not worth worrying about.

like image 71
Matt Hulse Avatar answered Nov 11 '22 15:11

Matt Hulse


It seems that this is not really "handled". But, taking into account that the offset is per partition, it seems this is something we should not worry about :)

Please see http://search-hadoop.com/m/uyzND1uRn8D1sSH322/rollover/v=threaded

like image 35
Luciano Afranllie Avatar answered Nov 11 '22 14:11

Luciano Afranllie