Skip to main content

Module name

Module name 

Source
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 at base_offset.
leader_epoch_checkpoint_path
Path to the per-partition .leader-epoch-checkpoint file.
log_path
Path to the .log file of the segment that starts at base_offset. It holds the record batches.
log_start_offset_checkpoint_path
Path to the per-partition log-start-offset-checkpoint file.
parse_log_filename
Parse a .log filename and return its base offset. "00000000000000001847.log" → Ok(1847).
parse_partition_dir
Parses <topic>-<partition> from a directory name. It returns None when the name does not match the pattern.
partition_dir
Builds the directory path for a (topic, partition).
producer_snapshot_path
Path to the .snapshot file that holds the producer state as of offset.
stampindex_path
Path to the per-segment .stampindex sidecar. 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 at base_offset.
txnindex_path
Path to the aborted-transaction index, .txnindex, of the segment that starts at base_offset.