Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Signed-off-by: root <root@DESKTOP-581SH48.localdomain>
Signed-off-by: baijiu1 <baijiu1100@hotmail.com>
Signed-off-by: baijiu1 <baijiu1100@hotmail.com>
add PreventCrossDataCenterMasterFailover decide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant