Skip to content

Commit

Permalink
sessionctx: hide extended stats variable in SHOW VARIABLES temporarily (
Browse files Browse the repository at this point in the history
  • Loading branch information
eurekaka authored Mar 18, 2021
1 parent 1ab3b48 commit 389bc5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ var FeatureSwitchVariables = []string{
TiDBAnalyzeVersion,
TiDBPartitionPruneMode,
TiDBIntPrimaryKeyDefaultAsClustered,
TiDBEnableExtendedStats,
}

// FilterImplicitFeatureSwitch is used to filter result of show variables, these switches should be turn blind to users.
Expand Down
11 changes: 11 additions & 0 deletions statistics/handle/handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2091,3 +2091,14 @@ func (s *testStatsSuite) TestExtendedStatsPartitionTable(c *C) {
err = tk.ExecToErr("alter table t2 add stats_extended s1 correlation(b,c)")
c.Assert(err.Error(), Equals, "Extended statistics on partitioned tables are not supported now")
}

func (s *testStatsSuite) TestHideExtendedStatsSwitch(c *C) {
// NOTICE: remove this test when this extended-stats reaches GA state.
defer cleanEnv(c, s.store, s.do)
tk := testkit.NewTestKit(c, s.store)
rs := tk.MustQuery("show variables").Rows()
for _, r := range rs {
c.Assert(strings.ToLower(r[0].(string)), Not(Equals), "tidb_enable_extended_stats")
}
tk.MustQuery("show variables like 'tidb_enable_extended_stats'").Check(testkit.Rows())
}

0 comments on commit 389bc5f

Please sign in to comment.