MCPcopy
hub / github.com/pingcap/tidb / RefreshSession

Method RefreshSession

pkg/testkit/testkit.go:124–137  ·  view source on GitHub ↗

RefreshSession set a new session for the testkit

()

Source from the content-addressed store, hash-verified

122
123// RefreshSession set a new session for the testkit
124func (tk *TestKit) RefreshSession() {
125 tk.session = NewSession(tk.t, tk.store)
126 if intest.InTest {
127 seed := uint64(time.Now().UnixNano())
128 tk.t.Logf("RefreshSession rand seed: %d", seed)
129 rng := rand.New(rand.NewSource(int64(seed)))
130 if rng.Intn(10) < 3 { // 70% chance to run infoschema v2
131 tk.MustExec("set @@global.tidb_schema_cache_size = 0")
132 }
133 }
134
135 // enforce sysvar cache loading, ref loadCommonGlobalVariableIfNeeded
136 tk.MustExec("select 3")
137}
138
139// SetSession set the session of testkit
140func (tk *TestKit) SetSession(session sessiontypes.Session) {

Calls 5

MustExecMethod · 0.95
LogfMethod · 0.80
NewSessionFunction · 0.70
NowMethod · 0.65
NewMethod · 0.65