How it works
When a node token joins between predecessor P and successor S, it becomes owner of keys in the interval (P, new token], meaning positions just after P up to and including the new token. Those keys move from S. Other intervals keep their owner. When a token leaves, its former interval moves to its successor.
Continue the 0 to 99 example with A at 20, B at 50, and C at 80. New node D joins at 35. It takes positions 21 to 35 from B, which keeps 36 to 50. A and C are untouched, so 15% of the ring moves. With evenly spread tokens, expected movement for one equally sized new node is roughly 1/(N+1) of keys, which would be 25% here; real layouts vary. Notice that D relieved only B, while A still owns 40 of the 100 positions. Virtual nodes, in the next lesson, address that.
Do not flip routing before the new owner has the data if the store is durable. Use a controlled transition: publish a membership version, copy the affected range, catch up concurrent writes, then switch ownership and verify. Cassandra follows this shape: a joining node streams its ranges and receives new writes for them, but serves no reads until streaming finishes. A cache may tolerate misses and refill instead. Node failure also requires replicas or fallback; hashing alone merely points to a new location.
A new durable-store node is announced before its range has been copied. What can go wrong?
Clients may read the new owner and see missing data. Transfer the range and concurrent changes before cutover, or maintain an explicit fallback during the transition.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Join and leave affect local ring intervals rather than the entire keyspace.
- Ownership transfer needs a data migration and cutover protocol.