session: fix unseccessfully isolation read engines init session (#16465)
This commit is contained in:
committed by
GitHub
parent
34ea06d9b3
commit
39cc8935cd
@ -568,6 +568,7 @@ func setGlobalVars() {
|
||||
variable.SysVars[variable.Socket].Value = cfg.Socket
|
||||
variable.SysVars[variable.DataDir].Value = cfg.Path
|
||||
variable.SysVars[variable.TiDBSlowQueryFile].Value = cfg.Log.SlowQueryFile
|
||||
variable.SysVars[variable.TiDBIsolationReadEngines].Value = strings.Join(cfg.IsolationRead.Engines, ", ")
|
||||
|
||||
// For CI environment we default enable prepare-plan-cache.
|
||||
plannercore.SetPreparedPlanCache(config.CheckTableBeforeDrop || cfg.PreparedPlanCache.Enabled)
|
||||
|
||||
@ -17,6 +17,8 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/pingcap/check"
|
||||
"github.com/pingcap/tidb/config"
|
||||
"github.com/pingcap/tidb/sessionctx/variable"
|
||||
)
|
||||
|
||||
var isCoverageServer = "0"
|
||||
@ -32,3 +34,19 @@ func TestRunMain(t *testing.T) {
|
||||
func TestT(t *testing.T) {
|
||||
TestingT(t)
|
||||
}
|
||||
|
||||
var _ = Suite(&testMainSuite{})
|
||||
|
||||
type testMainSuite struct{}
|
||||
|
||||
func (t *testMainSuite) TestSetGlobalVars(c *C) {
|
||||
c.Assert(variable.SysVars[variable.TiDBIsolationReadEngines].Value, Equals, "tikv, tiflash, tidb")
|
||||
c.Assert(variable.SysVars[variable.TIDBMemQuotaQuery].Value, Equals, "1073741824")
|
||||
|
||||
config.GetGlobalConfig().IsolationRead.Engines = []string{"tikv", "tidb"}
|
||||
config.GetGlobalConfig().MemQuotaQuery = 9999999
|
||||
setGlobalVars()
|
||||
|
||||
c.Assert(variable.SysVars[variable.TiDBIsolationReadEngines].Value, Equals, "tikv, tidb")
|
||||
c.Assert(variable.SysVars[variable.TIDBMemQuotaQuery].Value, Equals, "9999999")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user