RemoveNode removes a node from the cluster config, then triggers replication rebalance. Retries on CAS failure, is no-op if node doesn't exist in config
(nodeUUID string)
| 981 | // RemoveNode removes a node from the cluster config, then triggers replication rebalance. |
| 982 | // Retries on CAS failure, is no-op if node doesn't exist in config |
| 983 | func (m *sgReplicateManager) RemoveNode(nodeUUID string) error { |
| 984 | removeNodeCallback := func(cluster *SGRCluster) (cancel bool, err error) { |
| 985 | _, exists := cluster.Nodes[nodeUUID] |
| 986 | if !exists { |
| 987 | return true, nil |
| 988 | } |
| 989 | delete(cluster.Nodes, nodeUUID) |
| 990 | cluster.RebalanceReplications() |
| 991 | return false, nil |
| 992 | } |
| 993 | return m.updateCluster(removeNodeCallback) |
| 994 | } |
| 995 | |
| 996 | func (m *sgReplicateManager) getNodes() (nodes map[string]*SGNode, err error) { |
| 997 | sgrCluster, _, err := m.loadSGRCluster() |