Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

graceful-takeover-auto switchover failed. when i set true for PreventCrossDataCenterMasterFailover. #1406

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

baijiu1
Copy link

@baijiu1 baijiu1 commented Sep 17, 2021

I don't know if this is a bug. When I use one master and two slave architecture and set true for PreventCrossDataCenterMasterFailover, the instance selected for automatic switching is always the instance of another machine room, resulting in the failure of the whole switching

from orchestrator base version: 3.2.4

my architecture:

db.045.stg
+db.046.stg
+db.047.stg

When I use PreventCrossDataCenterMasterFailover set true, and DetectDataCenterQuery is :

select dc_vaild from meta.cluster where id = 1

Main configuration:

PreventCrossDataCenterMasterFailover: true
DataCenterPattern: ""

I issue this command:

orchestrator-client -c graceful-master-takeover-auto -alias test

return error:

PreventCrossRegionMasterFailover: will not promote server in Y when failed server in N

Status after switching:

db.045.stg
  +db.046.stg
    +db.047.stg

I Debug code, find this code and i fell this logic unreasonable:
function calls:

getGracefulMasterTakeoverDesignatedInstance->GetCandidateReplica->chooseCandidateReplica.

This result is caused by the error of the promotion instance returned here:

func chooseCandidateReplica(...) {
...golang
for _, replica := range replicas {
		replica := replica
		if isGenerallyValidAsCandidateReplica(replica) &&
			!IsBannedFromBeingCandidateReplica(replica) &&
			!IsSmallerMajorVersion(priorityMajorVersion, replica.MajorVersionString()) &&
			!IsSmallerBinlogFormat(priorityBinlogFormat, replica.Binlog_format) {
                        #######################################################
                        // Here should be added to the judgment of the data center
			// this is the one
			candidateReplica = replica
			break
		}
	}
...
}

And I have added judgment on the data center, so that I can switch in the test environment.

I think the automatic selection of instances should follow the configuration of the configuration file, otherwise the configuration will be meaningless.

Thanks!

root and others added 4 commits September 17, 2021 19:56
add PreventCrossDataCenterMasterFailover decide
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant