variable: make lc_messages read only (#33708)

close pingcap/tidb#33707
This commit is contained in:
fanrenhoo
2022-04-25 11:32:49 +08:00
committed by GitHub
parent 25255ce81b
commit f10db388c5
2 changed files with 9 additions and 1 deletions

View File

@ -296,7 +296,7 @@ var noopSysVars = []*SysVar{
{Scope: ScopeGlobal, Name: SlowQueryLog, Value: "0"},
{Scope: ScopeSession, Name: "debug_sync", Value: ""},
{Scope: ScopeGlobal, Name: InnodbStatsAutoRecalc, Value: "1"},
{Scope: ScopeGlobal | ScopeSession, Name: "lc_messages", Value: "en_US"},
{Scope: ScopeGlobal | ScopeSession, Name: "lc_messages", Value: "en_US", ReadOnly: true},
{Scope: ScopeGlobal | ScopeSession, Name: "bulk_insert_buffer_size", Value: "8388608", IsHintUpdatable: true},
{Scope: ScopeGlobal | ScopeSession, Name: BinlogDirectNonTransactionalUpdates, Value: Off, Type: TypeBool},
{Scope: ScopeGlobal, Name: "innodb_change_buffering", Value: "all"},

View File

@ -819,6 +819,14 @@ func TestLcTimeNamesReadOnly(t *testing.T) {
require.Error(t, err)
}
func TestLcMessagesReadOnly(t *testing.T) {
sv := GetSysVar("lc_messages")
vars := NewSessionVars()
vars.GlobalVarsAccessor = NewMockGlobalAccessor4Tests()
_, err := sv.Validate(vars, "newvalue", ScopeGlobal)
require.Error(t, err)
}
func TestDDLWorkers(t *testing.T) {
svWorkerCount, svBatchSize := GetSysVar(TiDBDDLReorgWorkerCount), GetSysVar(TiDBDDLReorgBatchSize)
vars := NewSessionVars()