Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

The KIP-630 .checkpoint artifacts under a node’s metadata directory.

It is public because a broker-only observer keeps its __cluster_metadata snapshot in the same on-disk layout, and reads and writes it with these helpers rather than with a second file format of its own. The KIP-630 .checkpoint artifacts under the controller’s metadata directory: their filename encoding, atomic write, id ordering, and the two-snapshot retention the engine keeps the directory at.

Functions§

checkpoint_id_is_newer
latest_checkpoint_id
Scan dir for <end_offset>-<epoch>.checkpoint artifacts and return the highest (end_offset, epoch) id, or None when the directory is absent or holds no checkpoint.
load_checkpoint_by_id
Read a specific checkpoint <end_offset>-<epoch>.checkpoint by id, or None if it is absent (the leader’s FetchSnapshot serve path).
load_latest_checkpoint
Scan dir for <end_offset>-<epoch>.checkpoint artifacts, pick the highest (end_offset, epoch), and return its raw bytes.
retain_latest_checkpoint
Delete every .checkpoint in dir except the latest (end_offset, epoch).
retain_recent_checkpoints
Delete every .checkpoint in dir except the two newest (end_offset, epoch) ids, after the controller’s snapshot+prune or an install. Best-effort: read/remove errors are ignored.
write_checkpoint
Write a KIP-630 .checkpoint artifact (bytes only) atomically and durably: the temporary file is synced before the rename and the directory after it, as Kafka’s FileRawSnapshotWriter.freeze does.