Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Fixed ReadUnambiguousSuggestedClusterAliases logic #1161

Merged
merged 2 commits into from
May 14, 2020
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
3 changes: 2 additions & 1 deletion go/inst/cluster_alias_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func ReplaceAliasClusterName(oldClusterName string, newClusterName string) (err
return err
}

// ReadUnambiguousSuggestedClusterAliases reads hostname:port who have suggested cluster aliases,
// ReadUnambiguousSuggestedClusterAliases reads potential master hostname:port who have suggested cluster aliases,
// where no one else shares said suggested cluster alias. Such hostname:port are likely true owners
// of the alias.
func ReadUnambiguousSuggestedClusterAliases() (result map[string]InstanceKey, err error) {
Expand All @@ -210,6 +210,7 @@ func ReadUnambiguousSuggestedClusterAliases() (result map[string]InstanceKey, er
database_instance
where
suggested_cluster_alias != ''
and replication_depth=0
group by
suggested_cluster_alias
having
Expand Down
8 changes: 6 additions & 2 deletions go/inst/instance_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -1774,8 +1774,12 @@ func TakeMaster(instanceKey *InstanceKey, allowTakingCoMaster bool) (*Instance,
// swap is done!

Cleanup:
instance, _ = StartSlave(&instance.Key)
masterInstance, _ = StartSlave(&masterInstance.Key)
if instance != nil {
instance, _ = StartSlave(&instance.Key)
}
if masterInstance != nil {
masterInstance, _ = StartSlave(&masterInstance.Key)
}
if err != nil {
return instance, err
}
Expand Down