Expand description
Names inside a Kafka log directory: the per-partition directory, and the segment files in it.
A partition’s data lives in <log_dir>/<topic>-<partition>/. Kafka names each segment in that directory by its 20-digit zero-padded base offset, with the .log, .index, and .timeindex extensions.
The module is public because a tool that opens a log directory needs the same paths the broker uses, and it must not have to link the broker to compute them.
Constants§
- FILENAME_
DIGITS - Digit count of a segment filename stem. Kafka zero-pads the base offset to this width.
- FUTURE_
SUFFIX - Suffix that the broker appends to a future-log partition directory while a KIP-113 intra-broker move runs.
Functions§
- format_
base_ offset 0→"00000000000000000000".1847→"00000000000000001847".- index_
path - Path to the sparse offset index,
.index, of the segment that starts atbase_offset. - leader_
epoch_ checkpoint_ path - Path to the per-partition
.leader-epoch-checkpointfile. - log_
path - Path to the
.logfile of the segment that starts atbase_offset. It holds the record batches. - log_
start_ offset_ checkpoint_ path - Path to the per-partition
log-start-offset-checkpointfile. - parse_
log_ filename - Parse a
.logfilename and return its base offset."00000000000000001847.log"→Ok(1847). - parse_
partition_ dir - Parses
<topic>-<partition>from a directory name. It returnsNonewhen the name does not match the pattern. - partition_
dir - Builds the directory path for a (topic, partition).
- producer_
snapshot_ path - Path to the
.snapshotfile that holds the producer state as ofoffset. - stampindex_
path - Path to the per-segment
.stampindexsidecar. It holds the additional internal stamp coordinate and is never a client-facing file. - timeindex_
path - Path to the sparse timestamp index,
.timeindex, of the segment that starts atbase_offset. - txnindex_
path - Path to the aborted-transaction index,
.txnindex, of the segment that starts atbase_offset.