Expand description
Offline point-in-time restore of a krabka cluster.
krabka restore reads a KIP-405 tiered-storage archive from object storage
and materializes a complete, bootable krabka data directory, replayed up to
a bound and verified segment by segment as it rehydrates. The bound is an
offset, a timestamp, or a set of exclude-record predicates, so an operator
can recover an event-sourced system to the state it held just before a bad
write. Recovery of that kind is a hand-built runbook everywhere else.
The tool runs when the cluster does not. It reads the archive through the
object-store layer and formats the target through [krabka_format], and it
does not depend on the broker.
§Stages
A restore runs five stages, and restore drives them in order:
- Discover lists the archive and groups the keys into segments per topic partition.
- Verify checks the framing and the CRC of every archived segment, and derives its true end offset and maximum timestamp.
- Bound compiles the operator’s predicates and decides which batches and records survive.
- Materialize formats the target log directory and writes the partition data.
- Report renders what happened, as text or as JSON.
§Limits
A batch that the bound filters is re-encoded from the records that survive,
so its bytes are not identical to the archived bytes. --exclude-key and
--exclude-header match raw bytes and decode no payload. Without
--rlmm-snapshot a segment the old cluster had marked for deletion is
indistinguishable from a live one. Without --metadata-snapshot, topic
configuration, ACLs, client quotas, SCRAM credentials, and finalized
feature levels cannot be recovered.
§Errors and exit codes
The library returns RestoreError. Only run and the binary map one
onto an exit code, so an embedding tool keeps the structured error. See
EXIT_OK for the codes.
Structs§
- Archive
Args - Where the archive is, and the restore inputs that sit beside it.
- Archive
Inventory - Everything the scan found.
- Archive
Object - One artifact of one archived segment, as the scan found it.
- Archive
Store - A read handle on the archive, with the operator’s key prefix applied.
- Authentication
Report - Signed WORM evidence applied to the bytes consumed by restore.
- Cli
- The restore command line.
- Diskless
Partition Report - Recovery boundary for one diskless partition.
- Diskless
Restore Report - Diskless-WAL recovery outcome and its explicit limitations.
- Format
Target Outcome - The formatter outcome needed by the final restore report.
- Header
Pattern - One
--exclude-headerpattern. - Leader
Epoch Start - The offset a leader epoch starts at, from a leader-epoch checkpoint row.
- Metadata
Restore Report - Cluster metadata recovered alongside the archived partition data.
- Offset
Bound - One
--to-offsetbound: the last offset the restore keeps in a partition. - Offset
Range - One
--exclude-offsetrange, normalized to a half-open interval. - Partition
Inventory - One partition of the archive.
- Partition
Ref - A topic partition an operator names in a bound.
- Partition
Report - What the restore did for one partition.
- Predicates
- The compiled predicate set.
- Restore
Args - Arguments of an offline point-in-time restore.
- Restore
Report - What the restore did, as a whole.
- Segment
Facts - What verification established about one segment.
- Segment
Inventory - One archived segment and the artifacts the archive holds for it.
- Segment
Outcome - What writing one segment into the target produced.
- Skipped
Segment - One segment the restore could not verify and did not write.
- Target
Args - The cluster the restore writes.
- Unrecognized
Keys - The keys the scan could not attribute to a segment.
- Verified
Segment - A segment that passed verification, with the bytes that passed it.
Enums§
- Batch
Decision - What the bound decides about one archived batch.
- Record
Decision - What the bound decides about one record inside a filtered batch.
- Report
Format - How
RestoreReport::renderwrites the summary. - Restore
Error - Every way a point-in-time restore stops.
Constants§
- EXIT_
ARCHIVE_ UNREADABLE - See
EXIT_OK. - EXIT_
BAD_ ARGUMENTS - See
EXIT_OK. - EXIT_
DIRTY_ LOG_ DIR - See
EXIT_OK. - EXIT_
INTEGRITY - See
EXIT_OK. - EXIT_
MATERIALIZE - See
EXIT_OK. - EXIT_OK
- Exit codes:
- UNRECOGNIZED_
SAMPLE_ LIMIT - How many unattributable keys the scan keeps.
Functions§
- format_
target - Format the target log directory, seed it with the recovered topics, and return the cluster id it was formatted with.
- inventory
- Scan
storeand build the inventory of the partitionsargsselects. - object_
store_ config - Map the
--archive-*flags onto an object-store configuration. - open_
archive - Build the archive handle the
--archive-*flags describe. - restore
- Run a restore and return its report.
- run
- Run a restore and return the process exit code.
- run_
from_ args - Run a restore from an argv-style iterator and return the process exit code.
- seed_
rlmm_ snapshot - Seed the restored broker’s local RLMM cache while resetting its Kafka
cursors for the new
__remote_log_metadatatopic. - verify_
segment - Fetch and verify one segment.
- verify_
segment_ authenticated - Fetch and verify one segment against signed WORM object claims.
- write_
segment - Write one verified segment into its target partition, under the bound.