Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: remove support for hidden sysvars #35740

Merged
merged 4 commits into from Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion executor/set_test.go
Expand Up @@ -679,7 +679,6 @@ func TestSetVar(t *testing.T) {
tk.MustQuery("select @@global.tidb_enable_new_cost_interface").Check(testkit.Rows("0")) // default value is 0
tk.MustExec("set global tidb_enable_new_cost_interface=1")
tk.MustQuery("select @@global.tidb_enable_new_cost_interface").Check(testkit.Rows("1"))
tk.MustQuery("show global variables like 'tidb_enable_new_cost_interface'").Check(testkit.Rows()) // hidden
tk.MustExec("set global tidb_enable_new_cost_interface=0")
tk.MustQuery("select @@global.tidb_enable_new_cost_interface").Check(testkit.Rows("0"))

Expand Down
4 changes: 2 additions & 2 deletions executor/show.go
Expand Up @@ -835,7 +835,7 @@ func (e *ShowExec) fetchShowVariables() (err error) {
} else if fieldPatternsLike != nil && !fieldPatternsLike.DoMatch(v.Name) {
continue
}
if v.Hidden || e.sysVarHiddenForSem(v.Name) {
if e.sysVarHiddenForSem(v.Name) {
continue
}
value, err = variable.GetGlobalSystemVar(sessionVars, v.Name)
Expand All @@ -860,7 +860,7 @@ func (e *ShowExec) fetchShowVariables() (err error) {
} else if fieldPatternsLike != nil && !fieldPatternsLike.DoMatch(v.Name) {
continue
}
if v.Hidden || e.sysVarHiddenForSem(v.Name) {
if e.sysVarHiddenForSem(v.Name) {
continue
}
value, err = variable.GetSessionOrGlobalSystemVar(sessionVars, v.Name)
Expand Down
8 changes: 0 additions & 8 deletions executor/showtest/show_test.go
Expand Up @@ -1586,10 +1586,6 @@ func TestShowVar(t *testing.T) {
sessionVars := make([]string, 0, len(variable.GetSysVars()))
globalVars := make([]string, 0, len(variable.GetSysVars()))
for _, v := range variable.GetSysVars() {
if v.Hidden {
continue
}

if v.Scope == variable.ScopeSession {
sessionVars = append(sessionVars, v.Name)
} else {
Expand All @@ -1614,10 +1610,6 @@ func TestShowVar(t *testing.T) {
res = tk.MustQuery(showSQL)
require.Len(t, res.Rows(), len(globalVars))

// Test Hidden tx_read_ts
res = tk.MustQuery("show variables like '%tx_read_ts'")
require.Len(t, res.Rows(), 0)

// Test versions' related variables
res = tk.MustQuery("show variables like 'version%'")
for _, row := range res.Rows() {
Expand Down
3 changes: 2 additions & 1 deletion sessionctx/variable/variable.go
Expand Up @@ -122,7 +122,8 @@ type SysVar struct {
SetGlobal func(*SessionVars, string) error
// IsHintUpdatable indicate whether it's updatable via SET_VAR() hint (optional)
IsHintUpdatable bool
// Hidden means that it still responds to SET but doesn't show up in SHOW VARIABLES
// Deprecated: Hidden previously meant that the variable still responds to SET but doesn't show up in SHOW VARIABLES
// However, this feature is no longer used. All variables are visble.
Hidden bool
// Aliases is a list of sysvars that should also be updated when this sysvar is updated.
// Updating aliases calls the SET function of the aliases, but does not update their aliases (preventing SET recursion)
Expand Down
12 changes: 0 additions & 12 deletions statistics/handle/handle_test.go
Expand Up @@ -2554,18 +2554,6 @@ func TestHideIndexUsageSyncLease(t *testing.T) {
}
}

func TestHideExtendedStatsSwitch(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
// NOTICE: remove this test when this extended-stats reaches GA state.
tk := testkit.NewTestKit(t, store)
rs := tk.MustQuery("show variables").Rows()
for _, r := range rs {
require.NotEqual(t, "tidb_enable_extended_stats", strings.ToLower(r[0].(string)))
}
tk.MustQuery("show variables like 'tidb_enable_extended_stats'").Check(testkit.Rows())
}

func TestRepetitiveAddDropExtendedStats(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
Expand Down