Expand description
Moving a node off LMDB and onto the file store without losing a chunk.
LMDB never returns a deleted page to the filesystem. Disk comes back exactly once,
when chunks.mdb is removed whole, so a node cannot free space by deleting chunks
and cannot compact its way out either (compaction needs free space equal to the live
data, which is the same condition). That single fact shapes everything here.
§The two ways this could lose data, and why neither can happen
- A node deletes its LMDB before the chunks are safely in files. Retirement is gated on the file store already holding every key the node still claims, and on the existing retention contract: a key the node is still answerable for under a gossiped commitment vetoes the delete.
- Every node sheds the same chunk at once. A node only sheds when it cannot fit its own payload, and it sheds by close-group rank, furthest first. A chunk has exactly one 7th-closest and one 6th-closest holder, so it is only ever a shed candidate for two of its seven holders, and the staged rollout brings that to one.
§Three releases
Slashing is the auditor’s decision, so a node cannot protect itself from being penalised for a shed. Everyone else has to stop first, which is why this lands over three releases rather than one:
| Release | Penalise not holding a close-group chunk? | MigrationConfig::retire_legacy |
|---|---|---|
| First: stop that one penalty | no | false |
| Second: migrate | no | true |
| Third: restore it | yes | true |
The penalty column is not a field here. It lives once, in
crate::replication::config::RELEASE_SUSPEND_CLOSE_GROUP_STORAGE_PENALTY, and both
the auditors that apply it and the shedder that depends on it being withheld read that
same switch. Two copies would let a node shed while its peers still penalised.
Audits keep running and keep recording throughout. What the first release withholds is narrow and deliberate: only the penalty for not holding a close-group chunk. The commitment-bound subtree audit still penalises in every release, because the whole migration turns on a node’s reduced commitment still being binding. The record those audits keep is also how we will know when the third release is safe to ship.
Structs§
- Copy
Report - Summary of what the copier moved during one pass.
- Migration
Config - Operator-facing controls for the migration.
- Migration
Context - The network facts the driver needs, kept behind one type so the store itself stays free of any knowledge of routing or commitments.
- Migration
State - The persisted migration marker.
- Volume
Lock - A host-wide advisory lock that serialises migrations sharing one volume.
Enums§
- Group
Rank - Where this node sits in a key’s admission group.
- Lock
Attempt - The result of asking for the volume lock.
- Migration
Phase - Where a node is in the migration.
Constants§
- CONCURRENT_
MIGRATIONS_ PER_ GROUP - How many nodes of one close group may be giving chunks up at the same time.
- LOCK_
DIR_ ENV - Environment override for the directory the per-volume migration lock lives in.
- MIGRATION_
EVENT - Structured field marking every line the fleet gate for R3 is read from.
- MIGRATION_
STATE_ FILE - Filename of the persisted migration marker, under the node root.
- MIN_
RETIRE_ DELAY_ HOURS - Floor on
MigrationConfig::retire_delay_hours. - RELEASE_
RETIRE_ LEGACY - Whether this build deletes the legacy environment once the gate is satisfied.
- REQUIRED_
REBUILDS_ BEFORE_ RETIRE - How many commitment rebuilds must be observed after the node commits to its file-backed set before the legacy environment may be retired.
- RETIRE_
LEGACY_ ENV - Environment override for
RELEASE_RETIRE_LEGACY, for a canary node. - SHEDDABLE_
TAIL_ RANKS - How many positions from the end of the admission group a node may give up.
Functions§
- log_
migration_ complete - Log the operator-facing summary of a completed migration.
- migration_
wave_ count - How many waves a close group is divided into, so that at most
CONCURRENT_MIGRATIONS_PER_GROUPof it are giving chunks up at once. - migration_
wave_ for - Which wave this node belongs to, derived from its own ID.
- now_
unix - Seconds since the Unix epoch, saturating at zero if the clock is before it.
- rank_
closest_ first - Order keys closest-first by XOR distance from this node.
- rank_
is_ sheddable - Whether a position in the admission group may be given up.
- run
- Runs the migration to completion, then returns.
- should_
migrate - Whether this store needs a migration driver at all.
- state_
path - Path of the persisted marker.
- unconfirmed_
by_ neighbours - Which of
keysthis node has no proof anyone else is holding. - wave_
has_ opened - Whether this node’s wave has opened yet.
- wave_
opens_ at - When a given wave opens, in Unix seconds.