From d7654e3c93c81bbf0f2da6dee16e4ee8269bf651 Mon Sep 17 00:00:00 2001 From: "Zhuomin(Charming) Liu" Date: Wed, 5 Feb 2020 11:30:21 +0800 Subject: [PATCH] test: fix random "IsolationRead" fails (#14615) Co-authored-by: pingcap-github-bot --- planner/core/integration_test.go | 8 +++----- planner/core/planbuilder.go | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index e4f2bd5569..cded25fea8 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -264,16 +264,14 @@ func (s *testIntegrationSuite) TestNoneAccessPathsFoundByIsolationRead(c *C) { _, err = tk.Exec("select * from t") c.Assert(err, NotNil) - c.Assert(err.Error(), Equals, "[planner:1815]Internal : Can not find access path matching 'tidb_isolation_read_engines'(value: '[tikv tiflash tidb]') and tidb-server config isolation-read(engines: 'tiflash'). Available values are 'tikv'.") + c.Assert(err.Error(), Equals, "[planner:1815]Internal : Can not find access path matching 'tidb_isolation_read_engines'(value: 'tiflash') and tidb-server config isolation-read(engines: '[tikv tiflash tidb]'). Available values are 'tikv'.") tk.MustExec("set @@session.tidb_isolation_read_engines = 'tikv, tiflash'") config.GetGlobalConfig().IsolationRead.Engines = []string{"tiflash"} - defer func() { - config.GetGlobalConfig().IsolationRead.Engines = []string{"tikv", "tiflash", "tidb"} - }() _, err = tk.Exec("select * from t") + config.GetGlobalConfig().IsolationRead.Engines = []string{"tikv", "tiflash", "tidb"} c.Assert(err, NotNil) - c.Assert(err.Error(), Equals, "[planner:1815]Internal : Can not find access path matching 'tidb_isolation_read_engines'(value: '[tiflash]') and tidb-server config isolation-read(engines: 'tikv,tiflash'). Available values are 'tikv'.") + c.Assert(err.Error(), Equals, "[planner:1815]Internal : Can not find access path matching 'tidb_isolation_read_engines'(value: 'tikv,tiflash') and tidb-server config isolation-read(engines: '[tiflash]'). Available values are 'tikv'.") } func (s *testIntegrationSuite) TestSelPushDownTiFlash(c *C) { diff --git a/planner/core/planbuilder.go b/planner/core/planbuilder.go index 9b69243167..026f325c84 100644 --- a/planner/core/planbuilder.go +++ b/planner/core/planbuilder.go @@ -756,7 +756,7 @@ func (b *PlanBuilder) filterPathByIsolationRead(paths []*util.AccessPath, dbName engineVals, _ := b.ctx.GetSessionVars().GetSystemVar(variable.TiDBIsolationReadEngines) err = ErrInternal.GenWithStackByArgs(fmt.Sprintf("Can not find access path matching '%v'(value: '%v') "+ "and tidb-server config isolation-read(engines: '%v'). Available values are '%v'.", - variable.TiDBIsolationReadEngines, config.GetGlobalConfig().IsolationRead.Engines, engineVals, availableEngineStr)) + variable.TiDBIsolationReadEngines, engineVals, config.GetGlobalConfig().IsolationRead.Engines, availableEngineStr)) } return paths, err }