Skip to content

Commit f471b0b

Browse files
authored
disttask: enable on default (#52401) (#52532)
ref #52441
1 parent 4ba4bcd commit f471b0b

File tree

20 files changed

+89
-144
lines changed

20 files changed

+89
-144
lines changed

pkg/ddl/ingest/integration_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func TestIngestError(t *testing.T) {
8585
store := testkit.CreateMockStore(t)
8686
tk := testkit.NewTestKit(t, store)
8787
tk.MustExec("use test;")
88+
tk.MustExec("set global tidb_enable_dist_task = 0")
8889
defer ingesttestutil.InjectMockBackendMgr(t, store)()
8990

9091
tk.MustExec("set @@global.tidb_ddl_reorg_worker_cnt = 1;")
@@ -126,6 +127,8 @@ func TestAddIndexIngestPanic(t *testing.T) {
126127
tk.MustExec("use test;")
127128
defer ingesttestutil.InjectMockBackendMgr(t, store)()
128129

130+
tk.MustExec("set global tidb_enable_dist_task = 0")
131+
129132
// Mock panic on coprocessor request sender.
130133
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/mockCopSenderPanic", "return(true)"))
131134
tk.MustExec("create table t (a int, b int, c int, d int, primary key (a) clustered);")

pkg/ddl/ingest/tests/partition_table_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func TestAddIndexIngestRecoverPartition(t *testing.T) {
3232
defer ingesttestutil.InjectMockBackendMgr(t, tc.Store)()
3333
tk := testkit.NewTestKit(t, tc.Store)
3434
tk.MustExec("use test;")
35+
tk.MustExec("set global tidb_enable_dist_task = 0")
3536
tk.MustExec("create table t (a int primary key, b int) partition by hash(a) partitions 8;")
3637
tk.MustExec("insert into t values (2, 3), (3, 3), (5, 5);")
3738

pkg/ddl/modify_column_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,10 @@ func TestModifyColumnReorgInfo(t *testing.T) {
162162
// Test encountering a "notOwnerErr" error which caused the processing backfill job to exit halfway.
163163
// During the period, the old TiDB version(do not exist the element information) is upgraded to the new TiDB version.
164164
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/MockGetIndexRecordErr", `return("addIdxNotOwnerErr")`))
165-
// TODO: Remove this check after "err" isn't nil in runReorgJobAndHandleErr.
166-
if variable.EnableDistTask.Load() {
167-
err = tk.ExecToErr("alter table t1 add index idx2(c1)")
168-
require.EqualError(t, err, "[ddl:8201]TiDB server is not a DDL owner")
169-
} else {
170-
tk.MustExec("alter table t1 add index idx2(c1)")
171-
expectedElements = []*meta.Element{
172-
{ID: 7, TypeKey: meta.IndexElementKey}}
173-
checkReorgHandle(elements, expectedElements)
174-
}
165+
tk.MustExec("alter table t1 add index idx2(c1)")
166+
expectedElements = []*meta.Element{
167+
{ID: 7, TypeKey: meta.IndexElementKey}}
168+
checkReorgHandle(elements, expectedElements)
175169
tk.MustExec("admin check table t1")
176170
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/MockGetIndexRecordErr"))
177171
}

pkg/ddl/multi_schema_change_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ func TestMultiSchemaChangeMixCancelled(t *testing.T) {
621621
store, dom := testkit.CreateMockStoreAndDomain(t)
622622
tk := testkit.NewTestKit(t, store)
623623
tk.MustExec("use test;")
624+
tk.MustExec("set global tidb_enable_dist_task = 0;")
624625
tk.MustExec("set global tidb_ddl_enable_fast_reorg = 0;")
625626

626627
tk.MustExec("create table t (a int, b int, c int, index i1(c), index i2(c));")

pkg/executor/importer/importer_testkit_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,13 @@ func TestVerifyChecksum(t *testing.T) {
157157

158158
func TestGetTargetNodeCpuCnt(t *testing.T) {
159159
_, tm, ctx := testutil.InitTableTest(t)
160-
require.False(t, variable.EnableDistTask.Load())
160+
old := variable.EnableDistTask.Load()
161161

162+
variable.EnableDistTask.Store(false)
162163
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/util/cpu/mockNumCpu", "return(16)"))
163164
t.Cleanup(func() {
164165
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/util/cpu/mockNumCpu"))
165-
variable.EnableDistTask.Store(false)
166+
variable.EnableDistTask.Store(old)
166167
})
167168
require.NoError(t, tm.InitMeta(ctx, "tidb1", ""))
168169

pkg/executor/test/ddl/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ go_test(
2222
"//pkg/parser/model",
2323
"//pkg/parser/mysql",
2424
"//pkg/sessionctx/variable",
25-
"//pkg/sessionctx/variable/featuretag/disttask",
2625
"//pkg/sessiontxn",
2726
"//pkg/store/mockstore",
2827
"//pkg/table",

pkg/executor/test/ddl/ddl_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/pingcap/tidb/pkg/parser/model"
3535
"github.com/pingcap/tidb/pkg/parser/mysql"
3636
"github.com/pingcap/tidb/pkg/sessionctx/variable"
37-
"github.com/pingcap/tidb/pkg/sessionctx/variable/featuretag/disttask"
3837
"github.com/pingcap/tidb/pkg/sessiontxn"
3938
"github.com/pingcap/tidb/pkg/store/mockstore"
4039
"github.com/pingcap/tidb/pkg/table"
@@ -884,14 +883,14 @@ func TestLoadDDLDistributeVars(t *testing.T) {
884883
store := testkit.CreateMockStore(t)
885884
tk := testkit.NewTestKit(t, store)
886885
tk.MustExec("use test")
887-
require.Equal(t, variable.DefTiDBEnableDistTask, disttask.TiDBEnableDistTask)
888886

887+
require.Equal(t, variable.DefTiDBEnableDistTask, variable.EnableDistTask.Load())
889888
tk.MustGetDBError("set @@global.tidb_enable_dist_task = invalid_val", variable.ErrWrongValueForVar)
890-
require.Equal(t, disttask.TiDBEnableDistTask, variable.EnableDistTask.Load())
889+
require.Equal(t, variable.DefTiDBEnableDistTask, variable.EnableDistTask.Load())
891890
tk.MustExec("set @@global.tidb_enable_dist_task = 'on'")
892891
require.Equal(t, true, variable.EnableDistTask.Load())
893-
tk.MustExec(fmt.Sprintf("set @@global.tidb_enable_dist_task = %v", disttask.TiDBEnableDistTask))
894-
require.Equal(t, disttask.TiDBEnableDistTask, variable.EnableDistTask.Load())
892+
tk.MustExec(fmt.Sprintf("set @@global.tidb_enable_dist_task = %v", false))
893+
require.Equal(t, false, variable.EnableDistTask.Load())
895894
}
896895

897896
// this test will change the fail-point `mockAutoIDChange`, so we move it to the `testRecoverTable` suite

pkg/session/bootstrap.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,11 @@ var (
13101310
SupportUpgradeHTTPOpVer int64 = version174
13111311
)
13121312

1313-
func checkDistTask(s sessiontypes.Session) {
1313+
func checkDistTask(s sessiontypes.Session, ver int64) {
1314+
if ver > version195 {
1315+
// since version195 we enable dist task by default, no need to check
1316+
return
1317+
}
13141318
ctx := kv.WithInternalSourceType(context.Background(), kv.InternalTxnBootstrap)
13151319
rs, err := s.ExecuteInternal(ctx, "SELECT HIGH_PRIORITY variable_value from mysql.global_variables where variable_name = %?;", variable.TiDBEnableDistTask)
13161320
if err != nil {
@@ -1361,7 +1365,7 @@ func upgrade(s sessiontypes.Session) {
13611365
return
13621366
}
13631367

1364-
checkDistTask(s)
1368+
checkDistTask(s, ver)
13651369
printClusterState(s, ver)
13661370

13671371
// Only upgrade from under version92 and this TiDB is not owner set.

0 commit comments

Comments
 (0)