Skip to main content

offload_cmd

Function offload_cmd 

Source
pub(crate) fn offload_cmd(verb: &str, m: &ArgMatches) -> Result<(), String>
Expand description

mira offload list, mira offload restore and mira offload push.

All three are readdir against one side or the other and nothing else. There is no state here to be stale, no index to rebuild and nothing to reconcile with a running server: a restore into the data directory of a live node is a block appearing in it, which is the same event as a publish and is already how the read path learns about anything (section 4).

push copies and does not unlink, and that is the design rather than caution. A node derives two numbers from the blocks it still holds locally, and emptying the directory walks both backwards: the WAL watermark (mira_core::block::wal_watermarks) falls to 0 for any signal left with no block, so the next boot replays a log that has already been absorbed, and the block sequence resumes at max(seq) + 1 over the local scan, so the node reissues (node, seq) pairs that are still alive wherever they were copied — and Cursor is documented as a total order over exactly that pair. The case this verb exists for is a volume that is about to be deleted, where freeing space on it buys nothing at all, let alone those two.

ponytail: push reads the directory live, so a block being compacted at that moment — <table>.arrow.<node>.tmp renamed over <table>.arrow — can be copied mid-rewrite. It is meant for a volume whose server is stopped, which is the case it was asked for; holding it against a running one needs the compaction lock this module deliberately does not have.