Rebalancing Traffic In Leaderless Distributed Architecture
Author: wonka
Originally Sourced from: https://stackoverflow.com/questions/79920428/rebalancing-traffic-in-leaderless-distributed-architecture
Using Go I am creating an in-memory distributed store similar to Cassandra.
I have concept of storage_node with get_by_key and put_key_value. When a new node starts it starts to gossip with a seed node and then gossips with rest of the nodes in cluster. This allows it to find all other nodes. Any node in the cluster can handle traffic. When a node receives a request it identifies the owner node and redirects the request to that node. At present, when a node is added to the cluster it immediately takes ownership of the data it is responsible for. It serves read and write traffic. Writes can be handled but reads return null/none because the key is stored in previous owner node.
How do I handle mutation/inserts when a new node is added to the cluster so that it first replicates the data and then starts to serve the traffic?