From 2a935092309bb631a5453950f4e5a3f5e0d729a1 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Thu, 21 Jul 2022 10:55:09 +0800 Subject: [PATCH] ddl: set reorgCnt by judging the GOMAXPROCS (#36392) ref pingcap/tidb#32031 --- ddl/ddl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddl/ddl.go b/ddl/ddl.go index c2351b525337e..96f0abeb0b12a 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -612,7 +612,7 @@ func (d *ddl) prepareWorkers4ConcurrencyDDL() { } } // reorg worker count at least 1 at most 10. - reorgCnt := mathutil.Min(mathutil.Max(runtime.NumCPU()/4, 1), reorgWorkerCnt) + reorgCnt := mathutil.Min(mathutil.Max(runtime.GOMAXPROCS(0)/4, 1), reorgWorkerCnt) d.reorgWorkerPool = newDDLWorkerPool(pools.NewResourcePool(workerFactory(addIdxWorker), reorgCnt, reorgCnt, 0), reorg) d.generalDDLWorkerPool = newDDLWorkerPool(pools.NewResourcePool(workerFactory(generalWorker), generalWorkerCnt, generalWorkerCnt, 0), general) failpoint.Inject("NoDDLDispatchLoop", func(val failpoint.Value) {