Skip to content

Commit

Permalink
core: fail user attempt to abort global rebalance when
Browse files Browse the repository at this point in the history
* when the system undergoes critical (maintenance, decommission)
  transitions
* TIP: use `--no-rebalance` option OR wait

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jul 25, 2023
1 parent 29912f3 commit 81fe467
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ais/prxclu.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,25 @@ func (p *proxy) xstop(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg) {
return
}
xargs.Kind, _ = xact.GetKindName(xargs.Kind) // display name => kind

if xargs.Kind == apc.ActRebalance {
// disallow aborting rebalance during
// critical (meta.SnodeMaint => meta.SnodeMaintPostReb) and (meta.SnodeDecomm => removed) transitions
smap := p.owner.smap.get()
for _, tsi := range smap.Tmap {
if tsi.Flags.IsAnySet(meta.SnodeMaint) && !tsi.Flags.IsAnySet(meta.SnodeMaintPostReb) {
p.writeErrf(w, r, "cannot abort %s: putting target %s in maintenance mode - rebalancing cluster...",
xargs.String(), tsi.StringEx())
return
}
if tsi.Flags.IsAnySet(meta.SnodeDecomm) {
p.writeErrf(w, r, "cannot abort %s: decommissioning target %s - rebalancing cluster...",
xargs.String(), tsi.StringEx())
return
}
}
}

body := cos.MustMarshal(apc.ActMsg{Action: msg.Action, Value: xargs})
args := allocBcArgs()
args.req = cmn.HreqArgs{Method: http.MethodPut, Path: apc.URLPathXactions.S, Body: body}
Expand Down

0 comments on commit 81fe467

Please sign in to comment.