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

Method PromoteNewMaster

store/cluster.go:134–147  ·  view source on GitHub ↗
(ctx context.Context,
	shardIdx int, masterNodeID, preferredNodeID string,
)

Source from the content-addressed store, hash-verified

132}
133
134func (cluster *Cluster) PromoteNewMaster(ctx context.Context,
135 shardIdx int, masterNodeID, preferredNodeID string,
136) (string, error) {
137 shard, err := cluster.GetShard(shardIdx)
138 if err != nil {
139 return "", err
140 }
141 newMasterNodeID, err := shard.promoteNewMaster(ctx, masterNodeID, preferredNodeID)
142 if err != nil {
143 return "", err
144 }
145 cluster.Shards[shardIdx] = shard
146 return newMasterNodeID, nil
147}
148
149func (cluster *Cluster) SyncToNodes(ctx context.Context) error {
150 for i := 0; i < len(cluster.Shards); i++ {

Callers 3

increaseFailureCountMethod · 0.80
FailoverMethod · 0.80

Calls 2

GetShardMethod · 0.95
promoteNewMasterMethod · 0.80

Tested by 1