risingwave_common::vnode_mapping::vnode_placement

Function place_vnode

source
pub fn place_vnode(
    hint_worker_slot_mapping: Option<&WorkerSlotMapping>,
    workers: &[WorkerNode],
    max_parallelism: Option<usize>,
    vnode_count: usize,
) -> Option<WorkerSlotMapping>
Expand description

Calculate a new vnode mapping, keeping locality and balance on a best effort basis. The strategy is similar to rebalance_actor_vnode used in meta node, but is modified to consider max_parallelism too.