diff --git a/ddl/column_test.go b/ddl/column_test.go index 10b883a76935a..289f026bf1d0a 100644 --- a/ddl/column_test.go +++ b/ddl/column_test.go @@ -1159,6 +1159,8 @@ func (s *testColumnSuite) TestModifyColumn(c *C) { WithLease(testLease), ) ctx := testNewContext(d) + ctx.GetSessionVars().EnableChangeColumnType = false + defer func() { err := d.Stop() c.Assert(err, IsNil) diff --git a/ddl/column_type_change_test.go b/ddl/column_type_change_test.go index 8e3f7d6d30e8a..5764875a75e7f 100644 --- a/ddl/column_type_change_test.go +++ b/ddl/column_type_change_test.go @@ -1651,6 +1651,7 @@ func (s *testColumnTypeChangeSuite) TestRowFormat(c *C) { func (s *testColumnTypeChangeSuite) TestColumnTypeChangeFlenErrorMsg(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") + tk.Se.GetSessionVars().EnableChangeColumnType = false tk.MustExec("drop table if exists t") tk.MustExec("create table t(a int4)") diff --git a/ddl/db_change_test.go b/ddl/db_change_test.go index 041f35c7734a8..befcd8d31c8c3 100644 --- a/ddl/db_change_test.go +++ b/ddl/db_change_test.go @@ -82,6 +82,11 @@ func (s *testStateChangeSuiteBase) SetUpSuite(c *C) { c.Assert(err, IsNil) _, err = s.se.Execute(context.Background(), "use test_db_state") c.Assert(err, IsNil) + // Set the variable to default 0 as it was before in case of modifying the test. + _, err = s.se.Execute(context.Background(), "set @@global.tidb_enable_change_column_type=0") + c.Assert(err, IsNil) + _, err = s.se.Execute(context.Background(), "set @@tidb_enable_change_column_type=0") + c.Assert(err, IsNil) s.p = parser.New() } diff --git a/ddl/db_integration_test.go b/ddl/db_integration_test.go index c65fb27de399e..e37585ce384e8 100644 --- a/ddl/db_integration_test.go +++ b/ddl/db_integration_test.go @@ -88,6 +88,10 @@ func setupIntegrationSuite(s *testIntegrationSuite, c *C) { s.ctx = se.(sessionctx.Context) _, err = se.Execute(context.Background(), "create database test_db") c.Assert(err, IsNil) + _, err = se.Execute(context.Background(), "set @@global.tidb_enable_change_column_type=0") + c.Assert(err, IsNil) + _, err = se.Execute(context.Background(), "set @@tidb_enable_change_column_type=0") + c.Assert(err, IsNil) } func tearDownIntegrationSuiteTest(s *testIntegrationSuite, c *C) { diff --git a/ddl/db_test.go b/ddl/db_test.go index 2a114b49d205f..e67b0a9c1795f 100644 --- a/ddl/db_test.go +++ b/ddl/db_test.go @@ -123,6 +123,10 @@ func setUpSuite(s *testDBSuite, c *C) { c.Assert(err, IsNil) _, err = s.s.Execute(context.Background(), "set @@global.tidb_max_delta_schema_count= 4096") c.Assert(err, IsNil) + _, err = s.s.Execute(context.Background(), "set @@global.tidb_enable_change_column_type=0") + c.Assert(err, IsNil) + _, err = s.s.Execute(context.Background(), "set @@tidb_enable_change_column_type=0") + c.Assert(err, IsNil) } func tearDownSuite(s *testDBSuite, c *C) { diff --git a/executor/executor_test.go b/executor/executor_test.go index 7cb72b266e263..eef914d9de15d 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -202,6 +202,13 @@ func (s *baseTestSuite) SetUpSuite(c *C) { } d, err := session.BootstrapSession(s.store) c.Assert(err, IsNil) + se, err := session.CreateSession4Test(s.store) + c.Assert(err, IsNil) + // Set the variable to default 0 as it was before in case of modifying the test. + _, err = se.Execute(context.Background(), "set @@global.tidb_enable_change_column_type=0") + c.Assert(err, IsNil) + _, err = se.Execute(context.Background(), "set @@tidb_enable_change_column_type=0") + c.Assert(err, IsNil) d.SetStatsUpdating(true) s.domain = d config.UpdateGlobal(func(conf *config.Config) { diff --git a/expression/integration_test.go b/expression/integration_test.go index 1cf17e1d36bfa..cc1b160c405e3 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -94,6 +94,13 @@ func (s *testIntegrationSuiteBase) SetUpSuite(c *C) { s.store, s.dom, err = newStoreWithBootstrap() c.Assert(err, IsNil) s.ctx = mock.NewContext() + se, err := session.CreateSession4Test(s.store) + c.Assert(err, IsNil) + // Set the variable to default 0 as it was before in case of modifying the test. + _, err = se.Execute(context.Background(), "set @@global.tidb_enable_change_column_type=0") + c.Assert(err, IsNil) + _, err = se.Execute(context.Background(), "set @@tidb_enable_change_column_type=0") + c.Assert(err, IsNil) } func (s *testIntegrationSuiteBase) TearDownSuite(c *C) { diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go index e93414bc5e26e..d9c23a0d49b48 100644 --- a/sessionctx/variable/tidb_vars.go +++ b/sessionctx/variable/tidb_vars.go @@ -650,7 +650,7 @@ const ( DefTiDBDDLReorgBatchSize = 256 DefTiDBDDLErrorCountLimit = 512 DefTiDBMaxDeltaSchemaCount = 1024 - DefTiDBChangeColumnType = false + DefTiDBChangeColumnType = true DefTiDBChangeMultiSchema = false DefTiDBPointGetCache = false DefTiDBEnableAlterPlacement = false