diff --git a/ais/proxy.go b/ais/proxy.go index 2e24f064433..fa292fe9bf1 100644 --- a/ais/proxy.go +++ b/ais/proxy.go @@ -2674,13 +2674,7 @@ func (p *proxy) httpdaeget(w http.ResponseWriter, r *http.Request) { return } if checkReady := r.Header.Get(apc.HdrReadyToJoinClu); checkReady != "" { - err := p.pready(smap, true) - if err == nil { - if cmn.GCO.Get().Rebalance.Enabled && smap.CountTargets() > 1 { - err = errors.New(p.String() + ": please disable global rebalance for the duration of the critical (force-join) operation") - } - } - if err != nil { + if err := p.readyToJoinClu(smap); err != nil { p.writeErr(w, r, err) return } @@ -2691,6 +2685,18 @@ func (p *proxy) httpdaeget(w http.ResponseWriter, r *http.Request) { } } +func (p *proxy) readyToJoinClu(smap *smapX) error { + switch { + case !smap.IsPrimary(p.si): + return newErrNotPrimary(p.si, smap) + case cmn.GCO.Get().Rebalance.Enabled && smap.CountTargets() > 1: + return errors.New(p.String() + ": please disable global rebalance for the duration of the critical (force-join) operation") + case nlog.Stopping(): + return p.errStopping() + } + return p.pready(smap, true) +} + func (p *proxy) httpdaeput(w http.ResponseWriter, r *http.Request) { apiItems, err := p.parseURL(w, r, apc.URLPathDae.L, 0, true) if err != nil { diff --git a/ais/psetforce.go b/ais/psetforce.go index c0d37717750..3aac1b700f6 100644 --- a/ais/psetforce.go +++ b/ais/psetforce.go @@ -216,7 +216,7 @@ func (p *proxy) forceJoin(w http.ResponseWriter, r *http.Request, npid string, q // 2. the first inter-cluster network call: // get and validate destination Smap, henceforth nsmap nsmap, ern := p._getSmapCheckReady(nurl) - if _destinationNotReady(ern) { + if ern != nil && _destinationNotReady(ern) { p.writeErr(w, r, ern) return } @@ -374,6 +374,7 @@ func (p *proxy) forceJoin(w http.ResponseWriter, r *http.Request, npid string, q p.metasyncer.becomeNonPrimary() time.Sleep(time.Second) + // TODO -- FIXME: remove? // 10. finally, ask npsi to bump versions and metasync all (see `msyncForceAll`) const act2 = "\"bump\"" nlog.Infoln(act, "(10) npsi to", act2, "metasync")