Skip to content

Commit 71c61b9

Browse files
authored
ddl: fix unexpected nil pointer dereference (#64244)
close #64243
1 parent 4a5681f commit 71c61b9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/ddl/job_scheduler.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ type jobScheduler struct {
152152
// those fields are created or initialized on start
153153
reorgWorkerPool *workerPool
154154
generalDDLWorkerPool *workerPool
155-
bgJobWorkerPool *workerPool
156-
seqAllocator atomic.Uint64
155+
// bgJobWorkerPool is only used in the next-gen kernel. NOTE: Need to check it is not nil before use.
156+
bgJobWorkerPool *workerPool
157+
seqAllocator atomic.Uint64
157158

158159
// those fields are shared with 'ddl' instance
159160
// TODO ddlCtx is too large for here, we should remove dependency on it.
@@ -666,6 +667,9 @@ func (s *jobScheduler) cleanMDLInfo(job *model.Job, ownerID string) {
666667
}
667668

668669
func (s *jobScheduler) workerPoolExhausted() bool {
670+
if s.bgJobWorkerPool == nil {
671+
return s.generalDDLWorkerPool.available() == 0 && s.reorgWorkerPool.available() == 0
672+
}
669673
return s.generalDDLWorkerPool.available() == 0 &&
670674
s.reorgWorkerPool.available() == 0 &&
671675
s.bgJobWorkerPool.available() == 0

0 commit comments

Comments
 (0)