From 3e2db68bb838db0628c1fa2aa2d8dce14612e3b6 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Thu, 25 May 2023 15:07:38 +0800 Subject: [PATCH] planner: fix unstable test TestAggPushToCopForCachedTable (#44168) close pingcap/tidb#44166 --- planner/core/integration_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 458a7e3328..b6dfdd7b06 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -3807,15 +3807,10 @@ func TestAggPushToCopForCachedTable(t *testing.T) { "[ └─Selection 10.00 cop[tikv] eq(test.t32157.process_code, \"GDEP0071\")]\n" + "[ └─TableFullScan 10000.00 cop[tikv] table:t32157 keep order:false, stats:pseudo")) - var readFromCacheNoPanic bool - for i := 0; i < 10; i++ { + require.Eventually(t, func() bool { tk.MustQuery("select /*+AGG_TO_COP()*/ count(*) from t32157 ignore index(primary) where process_code = 'GDEP0071'").Check(testkit.Rows("2")) - if tk.Session().GetSessionVars().StmtCtx.ReadFromTableCache { - readFromCacheNoPanic = true - break - } - } - require.True(t, readFromCacheNoPanic) + return tk.Session().GetSessionVars().StmtCtx.ReadFromTableCache + }, 10*time.Second, 500*time.Millisecond) tk.MustExec("drop table if exists t31202") }