Skip to main content

resolve_vnode_assignment

Function resolve_vnode_assignment 

Source
async fn resolve_vnode_assignment(
    self_id: NodeId,
    peers: &[NodeInfo],
    state_cfg: &StateBackendConfig,
) -> Result<(Arc<VnodeRegistry>, Option<Arc<AssignmentSnapshotStore>>), ClusterStartupError>
Expand description

Boot-time vnode assignment. If an AssignmentSnapshot exists in shared storage (written by a prior cluster incarnation or a peer that raced here first), every node adopts it — the fresh node doesn’t fight over vnodes that are already claimed. Otherwise we compute a round-robin split of this node’s known peers and CAS-create the snapshot; losers of the CAS race re-load and adopt.

Returns the registry plus the snapshot store (when one is available) so the ClusterController can watch for future rotations. None store means the deployment is on a non-object- store state backend (in-process), where no snapshot is possible or needed.