You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tk.MustQuery("SELECT Query FROM `information_schema`.`slow_query` "+
159
160
"where query like 'select%sleep%' order by time desc limit 1").
160
161
Check(testkit.Rows("select `sleep` ( ? ) , ?;"))
162
+
163
+
// Test 3 kinds of stale-read query.
164
+
tk.MustExec("create table test.t_stale_read (a int)")
165
+
time.Sleep(time.Second+time.Millisecond*10)
166
+
tk.MustExec("set tidb_redact_log=0;")
167
+
tk.MustExec("set @@tidb_read_staleness='-1'")
168
+
tk.MustQuery("select a from test.t_stale_read")
169
+
tk.MustExec("set @@tidb_read_staleness='0'")
170
+
t1:=time.Now()
171
+
tk.MustQuery(fmt.Sprintf("select a from test.t_stale_read as of timestamp '%s'", t1.Format("2006-1-2 15:04:05")))
172
+
tk.MustExec(fmt.Sprintf("start transaction read only as of timestamp '%v'", t1.Format("2006-1-2 15:04:05")))
173
+
tk.MustQuery("select a from test.t_stale_read")
174
+
tk.MustExec("commit")
175
+
require.Len(t, tk.MustQuery("SELECT query, txn_start_ts FROM `information_schema`.`slow_query` "+
176
+
"where (query = 'select a from test.t_stale_read;' or query like 'select a from test.t_stale_read as of timestamp %') and Txn_start_ts > 0").Rows(), 3)
0 commit comments