mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdmian: fix initialization confilct
Fix #3142 Ignore flags if etcd is already initialized.
This commit is contained in:
parent
24db661401
commit
6be02ff5ec
@ -93,19 +93,28 @@ func Main() {
|
|||||||
which := identifyDataDirOrDie(cfg.dir)
|
which := identifyDataDirOrDie(cfg.dir)
|
||||||
if which != dirEmpty {
|
if which != dirEmpty {
|
||||||
plog.Noticef("the server is already initialized as %v before, starting as etcd %v...", which, which)
|
plog.Noticef("the server is already initialized as %v before, starting as etcd %v...", which, which)
|
||||||
}
|
switch which {
|
||||||
|
case dirMember:
|
||||||
shouldProxy := cfg.isProxy() || which == dirProxy
|
stopped, err = startEtcd(cfg)
|
||||||
if !shouldProxy {
|
case dirProxy:
|
||||||
stopped, err = startEtcd(cfg)
|
err = startProxy(cfg)
|
||||||
if err == discovery.ErrFullCluster && cfg.shouldFallbackToProxy() {
|
default:
|
||||||
plog.Noticef("discovery cluster full, falling back to %s", fallbackFlagProxy)
|
plog.Panicf("unhandled dir type %v", which)
|
||||||
shouldProxy = true
|
}
|
||||||
|
} else {
|
||||||
|
shouldProxy := cfg.isProxy()
|
||||||
|
if !shouldProxy {
|
||||||
|
stopped, err = startEtcd(cfg)
|
||||||
|
if err == discovery.ErrFullCluster && cfg.shouldFallbackToProxy() {
|
||||||
|
plog.Noticef("discovery cluster full, falling back to %s", fallbackFlagProxy)
|
||||||
|
shouldProxy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if shouldProxy {
|
||||||
|
err = startProxy(cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if shouldProxy {
|
|
||||||
err = startProxy(cfg)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
case discovery.ErrDuplicateID:
|
case discovery.ErrDuplicateID:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user