Skip to content

Commit

Permalink
MB-60720 - Handling rebalance status key better
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
metonymic-smokey authored and abhinavdangeti committed Feb 8, 2024
1 parent ccf0eac commit 35f0d7d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ctl/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ func (ctl *Ctl) onSuccessfulPrepare(affectsTopology bool) {
}
}
ctl.m.Unlock()

// Resetting the rebalance status cfg key to the nil equivalent, in keeping
// in line with the other related fields.
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebNoRecord)
}

func (ctl *Ctl) getManagerOptions() map[string]string {
Expand Down Expand Up @@ -1006,6 +1010,12 @@ func (ctl *Ctl) startCtlLOCKED(
ctl.prevWarnings = ctlWarnings
ctl.prevErrs = ctlErrs

if mode == "rebalance" || mode == "failover-hard" {
if !wasCtlStopped && len(ctlWarnings) == 0 && len(ctlErrs) == 0 {
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebCompleted)
}
}

if ctlOnProgress != nil {
ctlOnProgress(0, 0, nil, nil, nil, nil, nil, ctlErrs)
}
Expand All @@ -1017,14 +1027,6 @@ func (ctl *Ctl) startCtlLOCKED(
ctl.setTaskOrchestratorTo(false)

close(ctlDoneCh)

if mode != "rebalance" && mode != "failover-hard" {
return
}

if !wasCtlStopped && len(ctlWarnings) == 0 && len(ctlErrs) == 0 {
rebalance.CheckPointRebalanceStatus(ctl.cfg, cbgt.RebCompleted)
}
}()

indexDefsStart, err :=
Expand Down

0 comments on commit 35f0d7d

Please sign in to comment.