From 389bc5fe608b6e35db1c8e4f05e40809917843ab Mon Sep 17 00:00:00 2001 From: Kenan Yao Date: Thu, 18 Mar 2021 14:03:36 +0800 Subject: [PATCH] sessionctx: hide extended stats variable in SHOW VARIABLES temporarily (#23345) --- sessionctx/variable/tidb_vars.go | 1 + statistics/handle/handle_test.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go index 5400eac9f944d..8acc5841bd1a6 100644 --- a/sessionctx/variable/tidb_vars.go +++ b/sessionctx/variable/tidb_vars.go @@ -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. diff --git a/statistics/handle/handle_test.go b/statistics/handle/handle_test.go index 20d837c3a956c..b4a2baca5da94 100644 --- a/statistics/handle/handle_test.go +++ b/statistics/handle/handle_test.go @@ -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()) +}