Skip to content

Commit

Permalink
domon,statistics: remove useless code for sync load (#52358)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Apr 7, 2024
1 parent 03f8dd1 commit c7d4c9c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
3 changes: 1 addition & 2 deletions pkg/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2243,11 +2243,10 @@ func quitStatsOwner(do *Domain, mgr owner.Manager) {
// StartLoadStatsSubWorkers starts sub workers with new sessions to load stats concurrently.
func (do *Domain) StartLoadStatsSubWorkers(ctxList []sessionctx.Context) {
statsHandle := do.StatsHandle()
for i, ctx := range ctxList {
for _, ctx := range ctxList {
// The sync load will affect how optimizer choose the plan.
// We need to assign high priority to it so that we can get the stats as quick as we can.
ctx.GetSessionVars().StmtCtx.Priority = mysql.HighPriority
statsHandle.SetSubCtxs(i, ctx)
do.wg.Add(1)
go statsHandle.SubLoadWorker(ctx, do.exit, do.wg)
}
Expand Down
7 changes: 0 additions & 7 deletions pkg/statistics/handle/syncload/stats_syncload.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type statsSyncLoad struct {
func NewStatsSyncLoad(statsHandle statstypes.StatsHandle) statstypes.StatsSyncLoad {
s := &statsSyncLoad{statsHandle: statsHandle}
cfg := config.GetGlobalConfig()
s.StatsLoad.SubCtxs = make([]sessionctx.Context, cfg.Performance.StatsLoadConcurrency)
s.StatsLoad.NeededItemsCh = make(chan *statstypes.NeededItemTask, cfg.Performance.StatsLoadQueueSize)
s.StatsLoad.TimeoutItemsCh = make(chan *statstypes.NeededItemTask, cfg.Performance.StatsLoadQueueSize)
return s
Expand All @@ -58,12 +57,6 @@ type statsWrapper struct {
idx *statistics.Index
}

// SetSubCtxs sets the sessionctx which is used to run queries background.
// TODO: use SessionPool instead.
func (s *statsSyncLoad) SetSubCtxs(idx int, sctx sessionctx.Context) {
s.StatsLoad.SubCtxs[idx] = sctx
}

// SendLoadRequests send neededColumns requests
func (s *statsSyncLoad) SendLoadRequests(sc *stmtctx.StatementContext, neededHistItems []model.StatsLoadItem, timeout time.Duration) error {
remainedItems := s.removeHistLoadedColumns(neededHistItems)
Expand Down
5 changes: 0 additions & 5 deletions pkg/statistics/handle/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ type StatsLoad struct {
NeededItemsCh chan *NeededItemTask
TimeoutItemsCh chan *NeededItemTask
Singleflight singleflight.Group
SubCtxs []sessionctx.Context
sync.Mutex
}

Expand All @@ -418,10 +417,6 @@ type StatsSyncLoad interface {

// HandleOneTask will handle one task.
HandleOneTask(sctx sessionctx.Context, lastTask *NeededItemTask, exit chan struct{}) (task *NeededItemTask, err error)

// SetSubCtxs sets the sessionctx which is used to run queries background.
// TODO: use SessionPool instead.
SetSubCtxs(idx int, sctx sessionctx.Context)
}

// StatsGlobal is used to manage partition table global stats.
Expand Down

0 comments on commit c7d4c9c

Please sign in to comment.