Skip to content

Commit be9619d

Browse files
committed
gh-849: To check the cluster replication type based on cluster spec instead of masterdb spec
1 parent fc23394 commit be9619d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/sentinel/cmd/sentinel.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,11 @@ func (s *Sentinel) updateCluster(cd *cluster.ClusterData, pis cluster.ProxiesInf
10101010
} else {
10111011
// if synchronous replication is enabled, only choose new master in the synchronous replication standbys.
10121012
var bestNewMasterDB *cluster.DB
1013-
if curMasterDB.Spec.SynchronousReplication {
1013+
if *cd.Cluster.Spec.SynchronousReplication {
10141014
commonSyncStandbys := util.CommonElements(curMasterDB.Status.SynchronousStandbys, curMasterDB.Spec.SynchronousStandbys)
10151015
if len(commonSyncStandbys) == 0 {
10161016
log.Warnw("cannot choose synchronous standby since there are no common elements between the latest master reported synchronous standbys and the db spec ones", "reported", curMasterDB.Status.SynchronousStandbys, "spec", curMasterDB.Spec.SynchronousStandbys)
1017+
bestNewMasterDB = bestNewMasters[0]
10171018
} else {
10181019
for _, nm := range bestNewMasters {
10191020
if util.StringInSlice(commonSyncStandbys, nm.UID) {

0 commit comments

Comments
 (0)