Skip to content

Commit 35f0d7d

Browse files
metonymic-smokeyabhinavdangeti
authored andcommitted
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. Change-Id: Ib8bed3adc43bda6d17c2aee33348c5d252cc9c85 Reviewed-on: https://review.couchbase.org/c/cbgt/+/205329 Tested-by: Abhi Dangeti <[email protected]> Well-Formed: Build Bot <[email protected]> Reviewed-by: Abhi Dangeti <[email protected]>
1 parent ccf0eac commit 35f0d7d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ctl/ctl.go

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

224228
func (ctl *Ctl) getManagerOptions() map[string]string {
@@ -1006,6 +1010,12 @@ func (ctl *Ctl) startCtlLOCKED(
10061010
ctl.prevWarnings = ctlWarnings
10071011
ctl.prevErrs = ctlErrs
10081012

1013+
if mode == "rebalance" || mode == "failover-hard" {
1014+
if !wasCtlStopped && len(ctlWarnings) == 0 && len(ctlErrs) == 0 {
1015+
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebCompleted)
1016+
}
1017+
}
1018+
10091019
if ctlOnProgress != nil {
10101020
ctlOnProgress(0, 0, nil, nil, nil, nil, nil, ctlErrs)
10111021
}
@@ -1017,14 +1027,6 @@ func (ctl *Ctl) startCtlLOCKED(
10171027
ctl.setTaskOrchestratorTo(false)
10181028

10191029
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-
}
10281030
}()
10291031

10301032
indexDefsStart, err :=

0 commit comments

Comments
 (0)