0

I'm looking for a specification of Kafka's partition ids. If a topic has n partitions, are its partition ids guaranteed to be 0 1 2 ... n-1 or are there ever scenarios in which gaps can appear, e. g. the partition ids are 0 2 3?

It's not possible to delete a specific Kafka partition, so at least a gap can't be produced this way.

Amaterasu
  • 153
  • 10
  • In case is you are using Kafka transactions you can have gaps in offset(messages which you can;t see). you can have a look at this [thread](https://stackoverflow.com/a/56183132/14394219) – artiomi Feb 03 '23 at 11:28
  • @artiomi yes offsets, but this is about partition ids – Amaterasu Feb 03 '23 at 11:47

1 Answers1

1

It's not possible. When you create a topic, you specify the number of partitions and they are created from 0 to N-1. Then you cannot delete partitions so you cannot create holes (or even deleting the last one). You can increase them, but Kafka will add from N to M-1. And so on.

ppatierno
  • 9,431
  • 1
  • 30
  • 45