replication-manager icon indicating copy to clipboard operation
replication-manager copied to clipboard

Bootstrap command without --clean-all flag incorrectly reports existing master/slave setup

Open jondavidnd1 opened this issue 7 years ago • 2 comments

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.

jondavidnd1 avatar Mar 31 '17 19:03 jondavidnd1

Hi,

thanks for the report, I actually noticed this yesterday but haven't had time to look at it yet.

tanji avatar Apr 03 '17 01:04 tanji

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

svaroqui avatar Sep 16 '17 17:09 svaroqui