What happens to the offsets that are compacted in a kafka partition?

845 views Asked by At

Let us say, I have a partion-0 with 2 log segments. The first segment contains keys v1, v2 and v3 at offsets 0, 1 and 2. The second segment has keys v3, v4, v1 at offsets 3, 4 and 5.

When the log compaction happens, the keys at offset 0 and 2 in first segment will be deleted.

What happens to the offsets 0 and 2? Do they become empty? If so what happens to this empty offsets?

1

There are 1 answers

1
Michael Heil On BEST ANSWER

The offsets disappear together with the keys (and values).

An offset is like a unique identifier that never changes in the lifetime of the topic and always belongs to the same message.