Skip to content

Commit

Permalink
staleread: fix flaky test TestStaleReadProcessorWithExecutePreparedSt…
Browse files Browse the repository at this point in the history
…mt (#39805)

close #39804
  • Loading branch information
hawkingrei authored Dec 12, 2022
1 parent 3884b28 commit ee5d8cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sessiontxn/staleread/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,18 @@ func TestStaleReadProcessorWithExecutePreparedStmt(t *testing.T) {
tk.MustExec("set @@tx_read_ts=''")

// `@@tidb_read_staleness`
tk.MustExec("set @@tidb_read_staleness=-5")
tk.MustExec("set @@tidb_read_staleness=-100")
processor = createProcessor(t, tk.Session())
err = processor.OnExecutePreparedStmt(nil)
require.True(t, processor.IsStaleness())
require.Equal(t, int64(0), processor.GetStalenessInfoSchema().SchemaMetaVersion())
expectedTS, err := staleread.CalculateTsWithReadStaleness(tk.Session(), -5*time.Second)
expectedTS, err := staleread.CalculateTsWithReadStaleness(tk.Session(), -100*time.Second)
require.NoError(t, err)
require.Equal(t, expectedTS, processor.GetStalenessReadTS())
tk.MustExec("set @@tidb_read_staleness=''")

// `@@tidb_read_staleness` will be ignored when `as of` or `@@tx_read_ts`
tk.MustExec("set @@tidb_read_staleness=-5")
tk.MustExec("set @@tidb_read_staleness=-100")
processor = createProcessor(t, tk.Session())
err = processor.OnExecutePreparedStmt(func(sctx sessionctx.Context) (uint64, error) {
return p1.ts, nil
Expand Down

0 comments on commit ee5d8cc

Please sign in to comment.