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

Merge downstream gh #211

Merged
merged 5 commits into from
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions go/inst/instance_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -2419,25 +2419,28 @@ func relocateBelowInternal(instance, other *Instance) (*Instance, error) {
if InstancesAreSiblings(instance, other) && other.IsBinlogServer() {
return MoveBelow(&instance.Key, &other.Key)
}
instanceMaster, found, err := ReadInstance(&instance.MasterKey)
if err != nil || !found {
instanceMaster, _, err := ReadInstance(&instance.MasterKey)
if err != nil {
return instance, err
}
if instanceMaster.MasterKey.Equals(&other.Key) && instanceMaster.IsBinlogServer() {
if instanceMaster != nil && instanceMaster.MasterKey.Equals(&other.Key) && instanceMaster.IsBinlogServer() {
// Moving to grandparent via binlog server
return Repoint(&instance.Key, &instanceMaster.MasterKey, GTIDHintDeny)
}
if other.IsBinlogServer() {
if instanceMaster.IsBinlogServer() && InstancesAreSiblings(instanceMaster, other) {
if instanceMaster != nil && instanceMaster.IsBinlogServer() && InstancesAreSiblings(instanceMaster, other) {
// Special case: this is a binlog server family; we move under the uncle, in one single step
return Repoint(&instance.Key, &other.Key, GTIDHintDeny)
}

// Relocate to its master, then repoint to the binlog server
otherMaster, found, err := ReadInstance(&other.MasterKey)
if err != nil || !found {
if err != nil {
return instance, err
}
if !found {
return instance, log.Errorf("Cannot find master %+v", other.MasterKey)
}
if !other.IsLastCheckValid {
return instance, log.Errorf("Binlog server %+v is not reachable. It would take two steps to relocate %+v below it, and I won't even do the first step.", other.Key, instance.Key)
}
Expand Down Expand Up @@ -2474,11 +2477,11 @@ func relocateBelowInternal(instance, other *Instance) (*Instance, error) {
}
}
// See if we need to MoveUp
if instanceMaster.MasterKey.Equals(&other.Key) {
if instanceMaster != nil && instanceMaster.MasterKey.Equals(&other.Key) {
// Moving to grandparent--handles co-mastering writable case
return MoveUp(&instance.Key)
}
if instanceMaster.IsBinlogServer() {
if instanceMaster != nil && instanceMaster.IsBinlogServer() {
// Break operation into two: move (repoint) up, then continue
if _, err := MoveUp(&instance.Key); err != nil {
return instance, err
Expand Down
Loading