rebalance

package
v0.31.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rebalance computes the minimal ownership changes to apply a cluster membership change (DESIGN.md §11). Because the data lives in the shared object store, a rebalance is an **ownership handoff**, not a data copy: when a shard's ring-owners change, the nodes that gained it start serving/compacting it (reading parts from S3 via the bucket index) and the nodes that lost it stop — no bytes move between nodes.

The plan is a pure function of the old and new ring.Ring: thanks to HRW hashing only the ~1/N shards whose owner set actually changed appear, each with a one-in/one-out handoff, so the orchestrator that executes it (etcd-coordinated, a later piece) moves the minimum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reassignment

type Reassignment struct {
	Shard   string
	Added   []string
	Removed []string
}

Reassignment is how one shard's owner set changes between two rings: the node IDs that newly own it (Added — must take it on) and those that no longer do (Removed — may drop it), each sorted. A shard with unchanged ownership produces no Reassignment.

func Plan

func Plan(shards []string, prev, next *ring.Ring, rf int) []Reassignment

Plan returns the reassignments needed to move ownership of shards from prev to next at replication factor rf, omitting shards whose owner set is unchanged. The result is ordered by shard, so it is deterministic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL