Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions pkg/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,10 @@ func (do *Domain) LoadBindInfoLoop(ctxForHandle sessionctx.Context, ctxForEvolve
}

owner := do.newOwnerManager(bindinfo.Prompt, bindinfo.OwnerKey)
err = owner.CampaignOwner()
if err != nil {
logutil.BgLogger().Warn("campaign owner failed", zap.Error(err))
}
do.globalBindHandleWorkerLoop(owner)
return nil
}
Expand Down Expand Up @@ -2387,6 +2391,12 @@ func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) err
variable.DisableStatsOwner = do.disableStatsOwner
do.statsOwner = do.newOwnerManager(handle.StatsPrompt, handle.StatsOwnerKey)
do.statsOwner.SetListener(owner.NewListenersWrapper(statsHandle, do.ddlNotifier))
if config.GetGlobalConfig().Instance.TiDBEnableStatsOwner.Load() {
err := do.statsOwner.CampaignOwner()
if err != nil {
logutil.BgLogger().Warn("campaign owner failed", zap.Error(err))
}
}
do.wg.Run(func() {
do.indexUsageWorker()
}, "indexUsageWorker")
Expand Down Expand Up @@ -2495,13 +2505,6 @@ func (do *Domain) newOwnerManager(prompt, ownerKey string) owner.Manager {
} else {
statsOwner = owner.NewOwnerManager(context.Background(), do.etcdClient, prompt, id, ownerKey)
}
// TODO: Need to do something when err is not nil.
if ownerKey == handle.StatsOwnerKey && config.GetGlobalConfig().Instance.TiDBEnableStatsOwner.Load() {
err := statsOwner.CampaignOwner()
if err != nil {
logutil.BgLogger().Warn("campaign owner failed", zap.Error(err))
}
}
return statsOwner
}

Expand Down