Skip to main content

Module backup

Module backup 

Source
Expand description

Hot backup primitives (M11 #92).

backup_pager_to_path is the obj-core entry point the obj crate’s Db::backup_to dispatches through. The function takes a &Pager<F> (the caller has already pinned a ReaderSnapshot) and writes a self-contained .obj file at dest. Writers may continue against the source pager throughout; their post-snapshot commits do not appear in the destination.

See docs/format.md § Hot backup for the algorithm this module implements.

§Power-of-ten posture

  • Rule 2. The page-copy loop is bounded by source.page_count(); the WAL-overlay loop is bounded by the snapshot’s frozen-view size (which is itself bounded by source.page_count()).
  • Rule 4. The driver is short; per-phase helpers (copy_main_file, overlay_frozen_view, patch_destination_header) factor the work.
  • Rule 7. No unwrap / expect in the production path. Every syscall is ?-propagated. On any mid-backup error the destination file is removed best-effort so a half-written backup does not linger.

Functions§

backup_pager_to_path
Build a self-contained .obj file at dest carrying the state of source as of snapshot.pinned_lsn().