@@ -2006,6 +2006,11 @@ func (do *Domain) LoadBindInfoLoop(ctxForHandle sessionctx.Context, ctxForEvolve
2006
2006
}
2007
2007
2008
2008
owner := do .newOwnerManager (bindinfo .Prompt , bindinfo .OwnerKey )
2009
+ err = owner .CampaignOwner ()
2010
+ if err != nil {
2011
+ logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2012
+ return err
2013
+ }
2009
2014
do .globalBindHandleWorkerLoop (owner )
2010
2015
return nil
2011
2016
}
@@ -2330,6 +2335,13 @@ func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) err
2330
2335
variable .DisableStatsOwner = do .disableStatsOwner
2331
2336
do .statsOwner = do .newOwnerManager (handle .StatsPrompt , handle .StatsOwnerKey )
2332
2337
do .statsOwner .SetListener (owner .NewListenersWrapper (statsHandle , do .ddlNotifier ))
2338
+ if config .GetGlobalConfig ().Instance .TiDBEnableStatsOwner .Load () {
2339
+ err := do .statsOwner .CampaignOwner ()
2340
+ if err != nil {
2341
+ logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2342
+ return err
2343
+ }
2344
+ }
2333
2345
do .wg .Run (func () {
2334
2346
do .indexUsageWorker ()
2335
2347
}, "indexUsageWorker" )
@@ -2438,13 +2450,6 @@ func (do *Domain) newOwnerManager(prompt, ownerKey string) owner.Manager {
2438
2450
} else {
2439
2451
statsOwner = owner .NewOwnerManager (context .Background (), do .etcdClient , prompt , id , ownerKey )
2440
2452
}
2441
- // TODO: Need to do something when err is not nil.
2442
- if ownerKey == handle .StatsOwnerKey && config .GetGlobalConfig ().Instance .TiDBEnableStatsOwner .Load () {
2443
- err := statsOwner .CampaignOwner ()
2444
- if err != nil {
2445
- logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2446
- }
2447
- }
2448
2453
return statsOwner
2449
2454
}
2450
2455
0 commit comments