Skip to content

Commit da1090b

Browse files
committed
executor: use analyze context for adaptive concurrency
1 parent 01d951e commit da1090b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pkg/executor/analyze_col_sampling.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func (e *AnalyzeColumnsExec) handleNDVForSpecialIndexes(ctx context.Context, ind
431431
}
432432
}
433433
}()
434-
tasks := e.buildSubIndexJobForSpecialIndex(indexInfos)
434+
tasks := e.buildSubIndexJobForSpecialIndex(ctx, indexInfos)
435435
taskCh := make(chan *analyzeTask, len(tasks))
436436
pendingJobs := make(map[uint64]*statistics.AnalyzeJob, len(tasks))
437437
for _, task := range tasks {
@@ -533,11 +533,11 @@ func (e *AnalyzeColumnsExec) subIndexWorkerForNDV(ctx context.Context, taskCh ch
533533

534534
// buildSubIndexJobForSpecialIndex builds sub index pushed down task to calculate the NDV information for indexes containing virtual column.
535535
// This is because we cannot push the calculation of the virtual column down to the tikv side.
536-
func (e *AnalyzeColumnsExec) buildSubIndexJobForSpecialIndex(indexInfos []*model.IndexInfo) []*analyzeTask {
536+
func (e *AnalyzeColumnsExec) buildSubIndexJobForSpecialIndex(ctx context.Context, indexInfos []*model.IndexInfo) []*analyzeTask {
537537
_, offset := timeutil.Zone(e.ctx.GetSessionVars().Location())
538538
tasks := make([]*analyzeTask, 0, len(indexInfos))
539539
sc := e.ctx.GetSessionVars().StmtCtx
540-
concurrency := adaptiveAnlayzeDistSQLConcurrency(context.Background(), e.ctx)
540+
concurrency := adaptiveAnlayzeDistSQLConcurrency(ctx, e.ctx)
541541
for _, indexInfo := range indexInfos {
542542
base := baseAnalyzeExec{
543543
ctx: e.ctx,

pkg/executor/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,7 +3083,7 @@ func (b *executorBuilder) buildAnalyzeIndexPushdown(task plannercore.AnalyzeInde
30833083
failpoint.Inject("injectAnalyzeSnapshot", func(val failpoint.Value) {
30843084
startTS = uint64(val.(int))
30853085
})
3086-
concurrency := adaptiveAnlayzeDistSQLConcurrency(context.Background(), b.sctx)
3086+
concurrency := adaptiveAnlayzeDistSQLConcurrency(b.stmtCtx, b.sctx)
30873087
base := baseAnalyzeExec{
30883088
ctx: b.sctx,
30893089
tableID: task.TableID,
@@ -3200,7 +3200,7 @@ func (b *executorBuilder) buildAnalyzeSamplingPushdown(
32003200
PartitionName: task.PartitionName,
32013201
SampleRateReason: sampleRateReason,
32023202
}
3203-
concurrency := adaptiveAnlayzeDistSQLConcurrency(context.Background(), b.sctx)
3203+
concurrency := adaptiveAnlayzeDistSQLConcurrency(b.stmtCtx, b.sctx)
32043204
base := baseAnalyzeExec{
32053205
ctx: b.sctx,
32063206
tableID: task.TableID,

0 commit comments

Comments
 (0)