Skip to content

Commit

Permalink
statistics: fix flaky test TestSyncLoadOnObjectWhichCanNotFoundInStorage
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <[email protected]>
  • Loading branch information
hawkingrei committed Dec 11, 2024
1 parent 2a1f646 commit cf13c82
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/statistics/handle/syncload/stats_syncload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,11 @@ func TestSyncLoadOnObjectWhichCanNotFoundInStorage(t *testing.T) {

// Try sync load.
tk.MustExec("select * from t where a >= 1 and b = 2 and c = 3 and d = 4")
statsTbl, ok = h.Get(tblInfo.ID)
require.True(t, ok)
require.Eventually(t, func() bool {
statsTbl, ok = h.Get(tblInfo.ID)
require.True(t, ok)
return statsTbl.ColNum() == 3
}, 5*time.Second, 100*time.Millisecond)
require.True(t, statsTbl.GetCol(tblInfo.Columns[0].ID).IsFullLoad())
require.True(t, statsTbl.GetCol(tblInfo.Columns[1].ID).IsFullLoad())
require.True(t, statsTbl.GetCol(tblInfo.Columns[3].ID).IsFullLoad())
Expand All @@ -463,8 +466,11 @@ func TestSyncLoadOnObjectWhichCanNotFoundInStorage(t *testing.T) {
tk.MustExec("analyze table t columns a, b, c")
require.NoError(t, h.InitStatsLite(context.TODO()))
tk.MustExec("select * from t where a >= 1 and b = 2 and c = 3 and d = 4")
statsTbl, ok = h.Get(tblInfo.ID)
require.True(t, ok)
require.Eventually(t, func() bool {
statsTbl, ok = h.Get(tblInfo.ID)
require.True(t, ok)
return statsTbl.ColNum() == 4
}, 5*time.Second, 100*time.Millisecond)
// a, b, d's status is not changed.
require.True(t, statsTbl.GetCol(tblInfo.Columns[0].ID).IsFullLoad())
require.True(t, statsTbl.GetCol(tblInfo.Columns[1].ID).IsFullLoad())
Expand Down

0 comments on commit cf13c82

Please sign in to comment.