Hi,
I would like to understand how does __consumer_offsets work (kafka
0.11.0.0)? If I look at the contents of this topic for a particular
consumer group (e.g. pigeon):
#./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic
__consumer_offsets --from-beginning --formatter
"kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter"
| grep pigeon
[pigeon,ClusterEvents,0]::[OffsetMetadata[264458,NO_METADATA],CommitTime
1507285596838,ExpirationTime 1509877596838]
<.....>
[pigeon,ClusterEvents,0]::[OffsetMetadata[275620,NO_METADATA],CommitTime
1507813712886,ExpirationTime 1510405712886]
The first entry in that topic is offset 264458 and the last 275620.
How does the client know which one to use? Because if I issue another
command:
# ./kafka-run-class.sh kafka.admin.ConsumerGroupCommand
--bootstrap-server localhost:9092 --group pigeon --new-consumer
--describe`
TOPIC PARTITION CURRENT-OFFSET
LOG-END-OFFSET LAG CONSUMER-ID
HOST CLIENT-ID
ClusterEvents 0 264458 275645
11187
It says that current offset is 264458, though form __consumer_offsets
(and from consumer logs) I do understand that consumer has commited at
least 275620 offset. I could launch the consumer, bring it up to date
(LAG - 0), then do a kill -9 on kafka server (this is a single
instance testing machine) and then everything will revert -
ConsumerGroupCommand will again show that current-offset is 264458
though before the kill it was > 275620. So how does a consumer from
__consumer_offsets understand which offset to use?
Thanks!