Skip to content

Commit

Permalink
variable: make lc_messages read only (pingcap#33708)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanrenhoo authored and espresso98 committed Apr 25, 2022
1 parent 7dc7ef8 commit eb556e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sessionctx/variable/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
8 changes: 8 additions & 0 deletions sessionctx/variable/sysvar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit eb556e3

Please sign in to comment.