Expand description
Continuous backup of a mushroomdb store to S3-compatible object storage.
A BackupWorker runs beside the server. Every wal_interval_ms it ships
the WAL bytes fsynced since the last tick as one immutable segment,
{prefix}/wal/{generation}/{start:020}-{end:020}; when a snapshot is
written it uploads snapshot.bin, any new wal.N.archive and the side
files; and it writes manifests ({prefix}/manifest/{commit_seq:020}.json,
pointed to by {prefix}/LATEST) naming consistent restore points.
The recovery point is the segment cadence, not the snapshot interval: a commit is off-box durable once the segment holding it is uploaded.
Before it uploads anything the worker takes the prefix’s BucketLease,
an advisory single-writer lock, and while another instance holds a fresh
one it uploads nothing and reports itself unhealthy (see lease).
restore_from_s3 reads a restore point back — the newest, or the one
holding a point in time — verifies every object, and installs it as a
store with a new backup lineage (see restore). boot::restore_on_boot
does the same into an empty data directory when a server starts, and
hands the bucket lease it took to the worker (see boot).
The worker never takes an engine lock and never writes to the store; a
failed upload is retried with back-off and reported through
BackupHandle, never to the write path.
Re-exports§
pub use boot::restore_on_boot;pub use boot::BootError;pub use boot::BootLease;pub use boot::BootRestore;pub use lease::BucketLease;pub use lease::Exclusion;pub use lease::LeaseError;pub use manifest::FileEntry;pub use manifest::Manifest;pub use manifest::SegmentEntry;pub use manifest::MANIFEST_VERSION;pub use restore::restore_from_s3;pub use restore::restore_from_store;pub use restore::RestoreS3Error;pub use restore::RestoreS3Outcome;pub use restore::RestoreTarget;pub use store::build_store;pub use store::BackupConfig;pub use store::S3Location;pub use worker::BackupCounters;pub use worker::BackupHandle;pub use worker::BackupTrigger;pub use worker::BackupWorker;pub use worker::WalSource;pub use worker::SIDE_FILES;pub use object_store;
Modules§
- boot
- Restore on boot: a server whose data directory holds no store restores
the newest restore point of a backup prefix into it before it opens the
store (
MUSHROOMDB_RESTORE_FROM_S3). - disk
- Everything the worker reads from the store directory, as blocking calls.
- lease
- The bucket lease: an advisory, remote single-writer lock on a backup prefix.
- manifest
- The manifest: one consistent restore point, and the object keys it names.
- restore
- Restore a store from a backup prefix:
mushroomdb restore --from s3://…. - segment
- Tailing
wal.bin: the next byte range to ship, in whole frames. - store
- Configuration from the environment, and the object store it names.
- worker
- The backup task: ships WAL segments, snapshots, archives and side files, and writes the manifests that name consistent restore points.
Enums§
- Backup
Error - Why a backup step or its configuration failed.
Functions§
- redact
textwith access-key ids, signatures and other credential material replaced by[redacted]: the content of [REDACTED_ELEMENTS] XML elements, the value after each of [REDACTED_FIELDS], and anything shaped like an AWS access key id (AKIA…,ASIA…: four letters and sixteen more upper-case letters or digits).