1

I have a group with two topics. I am trying to reset the offset of one of them to 1 but getting a message that offset (1) is lower than earliest offset for topic partition.

➜  local-kafka_2.12-2.0.0 bin/kafka-consumer-groups.sh --bootstrap-server myserver:1025 --group mygroup --topic mytopic --reset-offsets --to-offset 1 --dry-run
[2019-01-31 21:41:35,664] WARN New offset (1) is lower than earliest offset for topic partition mytopic-0. Value will be set to 121 (kafka.admin.ConsumerGroupCommand$)

TOPIC                          PARTITION  NEW-OFFSET
mytopic                      0          121

I get the same message when I try different partitions:

➜  local-kafka_2.12-2.0.0 bin/kafka-consumer-groups.sh --bootstrap-server myserver:1025 --group mygroup --topic mytopic:0,1,2 --reset-offsets --to-offset 1 --dry-run
[2019-01-31 21:43:16,526] WARN New offset (1) is lower than earliest offset for topic partition mytopic-0. Value will be set to 121 (kafka.admin.ConsumerGroupCommand$)
[2019-01-31 21:43:16,528] WARN New offset (1) is higher than latest offset for topic partition mytopic-1. Value will be set to 0 (kafka.admin.ConsumerGroupCommand$)
[2019-01-31 21:43:16,528] WARN New offset (1) is higher than latest offset for topic partition mytopic-2. Value will be set to 0 (kafka.admin.ConsumerGroupCommand$)

TOPIC                      PARTITION  NEW-OFFSET
mytopic                      0          121
mytopic                      1          0
mytopic                      2          0

Is there a way I can set the offset to 1? or better yet why am I not able to reset the kafka topic to 1?

Anthony
  • 33,838
  • 42
  • 169
  • 278

1 Answers1

1

New offset (1) is higher than latest offset for topic partition mytopic-2. Value will be set to 0

This means the end offset for mytopic-2 is zero, largely due to the fact there is no record stored in this partition, so you cannot set a greater-than-zero offset.

New offset (1) is lower than earliest offset for topic partition mytopic-0. Value will be set to 121

This means the start offset for mytopic-0 is 121, which is the earliest offset allowed to be exposed to the client, so you cannot set a lower offset for this partition. Possible situations where start offset will be updated includes: 1. log retention; 2.log truncation; 3. issuing kafka-delete-records script or DeleteRecordsRequest.

amethystic
  • 6,821
  • 23
  • 25
  • Why is it not possible to set a lower offset? I can continue from the lower offset if I use a different group ID, but that's not what I need. – Michal Špondr Jun 03 '21 at 11:23