*: make 'tidb_enable_change_column_type' available as a session variable (#20399)

This commit is contained in:
cncal
2021-01-18 14:29:48 +08:00
committed by GitHub
parent 4658536793
commit 405c6bbaba
2 changed files with 10 additions and 4 deletions

View File

@ -408,11 +408,17 @@ func (s *testSerialSuite1) TestSetVar(c *C) {
tk.MustQuery("select @@session.tidb_store_limit;").Check(testkit.Rows("0"))
tk.MustQuery("select @@global.tidb_store_limit;").Check(testkit.Rows("100"))
tk.MustQuery("select @@tidb_enable_change_column_type;").Check(testkit.Rows("0"))
tk.MustQuery("select @@global.tidb_enable_change_column_type;").Check(testkit.Rows("0"))
tk.MustExec("set global tidb_enable_change_column_type = 1")
tk.MustQuery("select @@tidb_enable_change_column_type;").Check(testkit.Rows("1"))
tk.MustQuery("select @@global.tidb_enable_change_column_type;").Check(testkit.Rows("1"))
tk.MustExec("set global tidb_enable_change_column_type = off")
tk.MustQuery("select @@tidb_enable_change_column_type;").Check(testkit.Rows("0"))
tk.MustQuery("select @@global.tidb_enable_change_column_type;").Check(testkit.Rows("0"))
// test tidb_enable_change_column_type in session scope.
tk.MustQuery("select @@session.tidb_enable_change_column_type;").Check(testkit.Rows("0"))
tk.MustExec("set @@session.tidb_enable_change_column_type = 1")
tk.MustQuery("select @@session.tidb_enable_change_column_type;").Check(testkit.Rows("1"))
tk.MustExec("set @@session.tidb_enable_change_column_type = off")
tk.MustQuery("select @@session.tidb_enable_change_column_type;").Check(testkit.Rows("0"))
tk.MustQuery("select @@session.tidb_metric_query_step;").Check(testkit.Rows("60"))
tk.MustExec("set @@session.tidb_metric_query_step = 120")

View File

@ -660,7 +660,7 @@ var defaultSysVars = []*SysVar{
{Scope: ScopeGlobal, Name: TiDBDDLErrorCountLimit, Value: strconv.Itoa(DefTiDBDDLErrorCountLimit), Type: TypeUnsigned, MinValue: 0, MaxValue: uint64(math.MaxInt64), AutoConvertOutOfRange: true},
{Scope: ScopeSession, Name: TiDBDDLReorgPriority, Value: "PRIORITY_LOW"},
{Scope: ScopeGlobal, Name: TiDBMaxDeltaSchemaCount, Value: strconv.Itoa(DefTiDBMaxDeltaSchemaCount), Type: TypeUnsigned, MinValue: 100, MaxValue: 16384, AutoConvertOutOfRange: true},
{Scope: ScopeGlobal, Name: TiDBEnableChangeColumnType, Value: BoolToOnOff(DefTiDBChangeColumnType), Type: TypeBool},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEnableChangeColumnType, Value: BoolToOnOff(DefTiDBChangeColumnType), Type: TypeBool},
{Scope: ScopeGlobal, Name: TiDBEnableChangeMultiSchema, Value: BoolToOnOff(DefTiDBChangeMultiSchema), Type: TypeBool},
{Scope: ScopeGlobal, Name: TiDBEnablePointGetCache, Value: BoolToOnOff(DefTiDBPointGetCache), Type: TypeBool},
{Scope: ScopeGlobal, Name: TiDBEnableAlterPlacement, Value: BoolToOnOff(DefTiDBEnableAlterPlacement), Type: TypeBool},