Skip to content

Commit

Permalink
disttask: use the correct session pool for dist tasks (#44981) (#44989)
Browse files Browse the repository at this point in the history
close #44983
  • Loading branch information
ti-chi-bot authored Jun 27, 2023
1 parent 727a3b0 commit db79551
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions disttask/framework/storage/task_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ type SessionExecutor interface {
// TaskManager is the manager of global/sub task.
type TaskManager struct {
ctx context.Context
sePool *pools.ResourcePool
sePool sessionPool
}

type sessionPool interface {
Get() (pools.Resource, error)
Put(resource pools.Resource)
}

var _ SessionExecutor = &TaskManager{}
Expand All @@ -59,7 +64,7 @@ var (
)

// NewTaskManager creates a new task manager.
func NewTaskManager(ctx context.Context, sePool *pools.ResourcePool) *TaskManager {
func NewTaskManager(ctx context.Context, sePool sessionPool) *TaskManager {
ctx = util.WithInternalSourceType(ctx, kv.InternalDistTask)
return &TaskManager{
ctx: ctx,
Expand Down
4 changes: 1 addition & 3 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ type Domain struct {

mdlCheckCh chan struct{}
stopAutoAnalyze atomicutil.Bool
resourcePool *pools.ResourcePool
}

type mdlCheckTableInfo struct {
Expand Down Expand Up @@ -1129,7 +1128,6 @@ func (do *Domain) Init(
return sysExecutorFactory(do)
}
sysCtxPool := pools.NewResourcePool(sysFac, 128, 128, resourceIdleTimeout)
do.resourcePool = sysCtxPool
ctx, cancelFunc := context.WithCancel(context.Background())
do.cancel = cancelFunc
var callback ddl.Callback
Expand Down Expand Up @@ -1654,7 +1652,7 @@ func (do *Domain) InitDistTaskLoop(ctx context.Context) error {
}
})

taskManager := storage.NewTaskManager(ctx, do.resourcePool)
taskManager := storage.NewTaskManager(ctx, do.sysSessionPool)
var serverID string
if intest.InTest {
do.InitInfo4Test()
Expand Down

0 comments on commit db79551

Please sign in to comment.