replication-manager
replication-manager copied to clipboard
Bootstrap command without --clean-all flag incorrectly reports existing master/slave setup
I apologize if I'm reading the code wrong (I have little experience with go), but I am using 1.0.2 to bootstrap a master-slave replication cluster without the --clean-all flag, and I receive an error:
ERROR: Environment already has an existing master/slave setup
.
This message was also written to the log:
DEBUG: In Failover skip topology detection
When looking at the code it seems like this error is inevitable when cleanall
is false.
From provision.go
:
func bootstrap() error {
sme.SetFailoverState()
if cleanall {
...
} else {
err := topologyDiscover()
if err == nil {
sme.RemoveFailoverState()
return errors.New("ERROR: Environment already has an existing master/slave setup")
}
}
From topology.go
:
func topologyDiscover() error {
if sme.IsInFailover() {
logprintf("DEBUG: In Failover skip topology detection")
return nil
}
...
}
This problem also seems to still exist on the develop
branch.
Hi,
thanks for the report, I actually noticed this yesterday but haven't had time to look at it yet.
Hello, this is expected , when one destroy and recreate replication you don't wan't to failover when for example configure in automatic failover , and this message is auto printed when we force skip the failover via sme.SetFailoverState(), a fixe would be to create sme.SetBootstrapState() and change the error message in such case