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
