Skip to main content

Module boot

Module boot 

Source
Expand description

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).

In order:

  1. A data directory that holds a store, and no install marker, is never restored over: BootRestore::Skipped. Only what killed restores into it left is swept.
  2. The prefix’s bucket lease is taken. A fresh lease of another instance means that instance may still be writing: nothing is restored and nothing is written to the data directory (BootError::ForeignLease).
  3. Under the lease, a restore on boot that a crash stopped while it moved its files in is undone (crate::restore::undo_interrupted_install), unless the store has changed since that install (it may have served): then nothing is removed and the boot fails.
  4. The newest restore point is restored in place (crate::restore::restore_in_place) while the lease is renewed. The store gets a new lineage and records the restore point it came from, so its backup can continue under the same prefix beside the parent’s chain without ever touching it (see crate::worker, Lineage). A prefix with no backup at all is BootRestore::NoBackup: a first deploy starts an empty store. Any other failure is an error, and the data directory is left without a store.

The lease stays held, and renewed, until the caller hands it to the backup worker (BootLease::into_lease, then crate::BackupWorker::adopt_lease) or releases it.

Structs§

BootLease
The bucket lease a restore on boot took, renewed until it is handed on.

Enums§

BootError
Why a restore on boot failed. The data directory then holds no store.
BootRestore
What a restore on boot did.

Functions§

restore_on_boot
Restore the newest restore point of config.s3_url’s prefix into data_dir if it holds no store. See the module docs.