Skip to content

Commit 3274b6c

Browse files
MB-60720 - Handling rebalance status key better
This PR sets the rebalance status keys prior to rebalance completion. Also resets the key on a successful prepare.
1 parent ccf0eac commit 3274b6c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

ctl/ctl.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ func (ctl *Ctl) onSuccessfulPrepare(affectsTopology bool) {
219219
}
220220
}
221221
ctl.m.Unlock()
222+
// Resetting the rebalance status cfg key to the nil equivalent, in keeping
223+
// in line with the other related fields.
224+
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebNoRecord)
222225
}
223226

224227
func (ctl *Ctl) getManagerOptions() map[string]string {
@@ -1006,6 +1009,12 @@ func (ctl *Ctl) startCtlLOCKED(
10061009
ctl.prevWarnings = ctlWarnings
10071010
ctl.prevErrs = ctlErrs
10081011

1012+
if !(mode != "rebalance" && mode != "failover-hard") {
1013+
if !wasCtlStopped && len(ctlWarnings) == 0 && len(ctlErrs) == 0 {
1014+
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebCompleted)
1015+
}
1016+
}
1017+
10091018
if ctlOnProgress != nil {
10101019
ctlOnProgress(0, 0, nil, nil, nil, nil, nil, ctlErrs)
10111020
}
@@ -1017,14 +1026,6 @@ func (ctl *Ctl) startCtlLOCKED(
10171026
ctl.setTaskOrchestratorTo(false)
10181027

10191028
close(ctlDoneCh)
1020-
1021-
if mode != "rebalance" && mode != "failover-hard" {
1022-
return
1023-
}
1024-
1025-
if !wasCtlStopped && len(ctlWarnings) == 0 && len(ctlErrs) == 0 {
1026-
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebCompleted)
1027-
}
10281029
}()
10291030

10301031
indexDefsStart, err :=

0 commit comments

Comments
 (0)