@@ -2063,6 +2063,11 @@ func (do *Domain) LoadBindInfoLoop(ctxForHandle sessionctx.Context, ctxForEvolve
2063
2063
}
2064
2064
2065
2065
owner := do .newOwnerManager (bindinfo .Prompt , bindinfo .OwnerKey )
2066
+ err = owner .CampaignOwner ()
2067
+ if err != nil {
2068
+ logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2069
+ return err
2070
+ }
2066
2071
do .globalBindHandleWorkerLoop (owner )
2067
2072
return nil
2068
2073
}
@@ -2387,6 +2392,13 @@ func (do *Domain) UpdateTableStatsLoop(ctx, initStatsCtx sessionctx.Context) err
2387
2392
variable .DisableStatsOwner = do .disableStatsOwner
2388
2393
do .statsOwner = do .newOwnerManager (handle .StatsPrompt , handle .StatsOwnerKey )
2389
2394
do .statsOwner .SetListener (owner .NewListenersWrapper (statsHandle , do .ddlNotifier ))
2395
+ if config .GetGlobalConfig ().Instance .TiDBEnableStatsOwner .Load () {
2396
+ err := do .statsOwner .CampaignOwner ()
2397
+ if err != nil {
2398
+ logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2399
+ return err
2400
+ }
2401
+ }
2390
2402
do .wg .Run (func () {
2391
2403
do .indexUsageWorker ()
2392
2404
}, "indexUsageWorker" )
@@ -2495,13 +2507,6 @@ func (do *Domain) newOwnerManager(prompt, ownerKey string) owner.Manager {
2495
2507
} else {
2496
2508
statsOwner = owner .NewOwnerManager (context .Background (), do .etcdClient , prompt , id , ownerKey )
2497
2509
}
2498
- // TODO: Need to do something when err is not nil.
2499
- if ownerKey == handle .StatsOwnerKey && config .GetGlobalConfig ().Instance .TiDBEnableStatsOwner .Load () {
2500
- err := statsOwner .CampaignOwner ()
2501
- if err != nil {
2502
- logutil .BgLogger ().Warn ("campaign owner failed" , zap .Error (err ))
2503
- }
2504
- }
2505
2510
return statsOwner
2506
2511
}
2507
2512
0 commit comments