Removal is the mirror image of adding. When a node leaves, only the keys it owned move - and they all go to the same place, the next node clockwise. Today you pin exactly which keys move and confirm the rest stay put.
Show that removing a node reassigns only its own keys, all to its successor.
Removing a node is the exact reverse of adding one. gamma at 5130 owns the keys that
wrap past the top of the ring - cherry, grape, kiwi, mango, all sitting above
beta (58567). Take gamma away and those four keys wrap to the new lowest node,
alpha. Crucially, only those four move, and they all go to the same successor.
The eight keys gamma never owned do not shift at all.
That “all to one successor” detail is what makes removal cheap and predictable: a failed node’s entire load lands on its single clockwise neighbor, not scattered across the cluster. (It is also why an overloaded node can be a problem when its predecessor fails - a wrinkle virtual nodes smooth out in the next chapter.) With adding and removing both pinned to a handful of keys, the minimal-remapping promise is proven; the next lesson puts the ring and modulo side by side to make the contrast unmissable.
// Reuse Get before and MovedKeys after Remove.// gamma's keys are the ones whose position is past beta (wrapping)// or at/below gamma; with gamma gone they wrap to the new lowest// node, alpha. Assert the moved set AND that each moved to alpha.