liveBook · Manning

Partition directory

As explained in Apache Kafka in Action

A partition directory is a broker filesystem directory containing the files for a Kafka partition assigned to that broker.

A partition directory is a broker filesystem subdirectory containing the local files for a Kafka partition assigned to that broker. Kafka creates one directory per assigned partition under the broker’s data directory, not one directory for every partition in the cluster. section 8.3.2

For a replicated topic, each broker stores a directory for every replica assigned to it. A directory such as products.prices.changelog.file-structure-0 identifies partition 0 of the topic, while the broker’s partition role can be checked with topic metadata. section 8.3.2

A typical partition directory contains:

  • partition.metadata, recording the metadata version and topic ID. section 8.3.2
  • leader-epoch-checkpoint, recording leader-epoch information and the log offset at leader selection. section 8.3.2

Inspecting a partition directory

List the broker data directory, then inspect the files for partition 0: ls -1 ~/kafka/data/kafka1/ and ls -1 ~/kafka/data/kafka1/products.prices.changelog.file-structure-0. Compare the local directory with kafka-topics.sh --describe to determine which broker leads or replicates that partition.

Deleting a topic does not immediately remove its partition directories. Kafka first renames them with a .<UniqueID>-delete suffix and permanently deletes them after the configured delay, leaving a short recovery window. section 8.3.5

How Apache Kafka in Action covers it

How deep it goes
Explains directory naming, metadata files, log indexes, and leader-epoch checkpoints, without detailing every log-file format.
Examples
Uses broker directory listings, partition metadata, topic descriptions, and delayed deletion markers as concrete inspection examples.
What it assumes
Assumes Kafka brokers and topics, while grounding partition storage in broker directories and assigned replicas.
What you can do after
Operate/configure Kafka by locating partition files, correlating them with broker assignments, and recognizing pending deletion.
How it connects
Connects partition directories to Kafka topics, partition replicas, replication factor, leaders, and leader epochs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.