Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Sep 13, 2024
1 parent c3d683a commit 3faf1e2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2301,8 +2301,8 @@ func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) err
if do.statsLease >= 0 {
do.wg.Run(do.loadStatsWorker, "loadStatsWorker")
}
variable.EnableStatsOwner = do.EnableStatsOwner
variable.DisableStatsOwner = do.DisableStatsOwner
variable.EnableStatsOwner = do.enableStatsOwner
variable.DisableStatsOwner = do.disableStatsOwner
do.statsOwner = do.newOwnerManager(handle.StatsPrompt, handle.StatsOwnerKey)
do.wg.Run(func() {
do.indexUsageWorker()
Expand Down Expand Up @@ -2370,20 +2370,20 @@ func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) err
return nil
}

// EnableStatsOwner enables this node to execute stats owner jobs.
// enableStatsOwner enables this node to execute stats owner jobs.
// Since ownerManager.CampaignOwner will start a new goroutine to run ownerManager.campaignLoop,
// we should make sure that before invoking EnableStatsOwner(), stats owner is DISABLE.
func (do *Domain) EnableStatsOwner() error {
// we should make sure that before invoking enableStatsOwner(), stats owner is DISABLE.
func (do *Domain) enableStatsOwner() error {
if !do.statsOwner.IsOwner() {
err := do.statsOwner.CampaignOwner()
return errors.Trace(err)
}
return nil
}

// DisableStatsOwner disable this node to execute stats owner.
// We should make sure that before invoking DisableStatsOwner(), stats owner is ENABLE.
func (do *Domain) DisableStatsOwner() error {
// disableStatsOwner disable this node to execute stats owner.
// We should make sure that before invoking disableStatsOwner(), stats owner is ENABLE.
func (do *Domain) disableStatsOwner() error {
if do.statsOwner.IsOwner() {
// disable campaign by interrupting campaignLoop
do.statsOwner.CampaignCancel()
Expand Down

0 comments on commit 3faf1e2

Please sign in to comment.