@@ -19,9 +19,12 @@ import (
19
19
"time"
20
20
21
21
"github.com/pingcap/failpoint"
22
+ "github.com/pingcap/log"
22
23
"github.com/pingcap/tidb/pkg/ddl"
23
24
"github.com/pingcap/tidb/pkg/ddl/syncer"
25
+ dist_store "github.com/pingcap/tidb/pkg/disttask/framework/storage"
24
26
"github.com/pingcap/tidb/pkg/domain"
27
+ "github.com/pingcap/tidb/pkg/kv"
25
28
"github.com/pingcap/tidb/pkg/owner"
26
29
sessiontypes "github.com/pingcap/tidb/pkg/session/types"
27
30
"github.com/pingcap/tidb/pkg/sessionctx"
@@ -77,11 +80,12 @@ func SyncUpgradeState(s sessionctx.Context, timeout time.Duration) error {
77
80
78
81
// SyncNormalRunning syncs normal state to etcd.
79
82
func SyncNormalRunning (s sessionctx.Context ) error {
83
+ bgCtx := context .Background ()
80
84
failpoint .Inject ("mockResumeAllJobsFailed" , func (val failpoint.Value ) {
81
85
if val .(bool ) {
82
86
dom := domain .GetDomain (s )
83
87
//nolint: errcheck
84
- dom .DDL ().StateSyncer ().UpdateGlobalState (context . Background () , syncer .NewStateInfo (syncer .StateNormalRunning ))
88
+ dom .DDL ().StateSyncer ().UpdateGlobalState (bgCtx , syncer .NewStateInfo (syncer .StateNormalRunning ))
85
89
failpoint .Return (nil )
86
90
}
87
91
})
@@ -95,7 +99,15 @@ func SyncNormalRunning(s sessionctx.Context) error {
95
99
logger .Warn ("resume the job failed" , zap .Error (e ))
96
100
}
97
101
98
- ctx , cancelFunc := context .WithTimeout (context .Background (), 3 * time .Second )
102
+ if mgr , _ := dist_store .GetTaskManager (); mgr != nil {
103
+ ctx := kv .WithInternalSourceType (bgCtx , kv .InternalDistTask )
104
+ err := mgr .AdjustTaskOverflowConcurrency (ctx , s )
105
+ if err != nil {
106
+ log .Warn ("cannot adjust task overflow concurrency" , zap .Error (err ))
107
+ }
108
+ }
109
+
110
+ ctx , cancelFunc := context .WithTimeout (bgCtx , 3 * time .Second )
99
111
defer cancelFunc ()
100
112
dom := domain .GetDomain (s )
101
113
err = dom .DDL ().StateSyncer ().UpdateGlobalState (ctx , syncer .NewStateInfo (syncer .StateNormalRunning ))
0 commit comments