MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / removeNode

Method removeNode

store/cluster_shard.go:133–149  ·  view source on GitHub ↗
(nodeID string)

Source from the content-addressed store, hash-verified

131}
132
133func (shard *Shard) removeNode(nodeID string) error {
134 isFound := false
135 for i, node := range shard.Nodes {
136 if node.ID() != nodeID {
137 continue
138 }
139 if node.IsMaster() {
140 return fmt.Errorf("cannot remove master node: %w", consts.ErrInvalidArgument)
141 }
142 shard.Nodes = append(shard.Nodes[:i], shard.Nodes[i+1:]...)
143 isFound = true
144 }
145 if !isFound {
146 return consts.ErrNotFound
147 }
148 return nil
149}
150
151func (shard *Shard) getNewMasterNodeIndex(ctx context.Context, masterNodeIndex int, preferredNodeID string) int {
152 newMasterNodeIndex := -1

Callers 1

RemoveNodeMethod · 0.80

Calls 3

ErrorfMethod · 0.80
IDMethod · 0.65
IsMasterMethod · 0.65

Tested by

no test coverage detected