Skip to content

Commit

Permalink
planner: Updated failing test after pingcap#33098 (pingcap#33299)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjonss authored Mar 22, 2022
1 parent 768ce5f commit b7a2d62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 10 additions & 4 deletions planner/core/prepare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2630,10 +2630,16 @@ func TestPartitionWithVariedDataSources(t *testing.T) {
tk.MustExec(fmt.Sprintf(`set @a0=%v, @a1=%v, @a2=%v`, rand.Intn(40000), rand.Intn(40000), rand.Intn(40000)))

var rscan, rlookup, rpoint, rbatch [][]interface{}
var expectedFromPlanCache string
for id, tbl := range []string{"trangeIdx", "thashIdx", "tnormalIdx"} {
scan := tk.MustQuery(fmt.Sprintf(`execute stmt%v_indexscan using @mina, @maxa`, tbl)).Sort()
if id == 2 {
expectedFromPlanCache = "1"
} else {
expectedFromPlanCache = "0"
}
if i > 0 {
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1"))
tk.MustQuery(`select @@last_plan_from_cache /* table: ` + tbl + " */").Check(testkit.Rows(expectedFromPlanCache))
}
if id == 0 {
rscan = scan.Rows()
Expand All @@ -2643,7 +2649,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) {

lookup := tk.MustQuery(fmt.Sprintf(`execute stmt%v_indexlookup using @mina, @maxa`, tbl)).Sort()
if i > 0 {
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1"))
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache))
}
if id == 0 {
rlookup = lookup.Rows()
Expand All @@ -2655,7 +2661,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) {
if tbl == `tnormalPK` && i > 0 {
// PlanCache cannot support PointGet now since we haven't relocated partition after rebuilding range.
// Please see Execute.rebuildRange for more details.
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("0"))
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache))
}
if id == 0 {
rpoint = point.Rows()
Expand All @@ -2665,7 +2671,7 @@ func TestPartitionWithVariedDataSources(t *testing.T) {

batch := tk.MustQuery(fmt.Sprintf(`execute stmt%v_batchget_idx using @a0, @a1, @a2`, tbl)).Sort()
if i > 0 {
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1"))
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows(expectedFromPlanCache))
}
if id == 0 {
rbatch = batch.Rows()
Expand Down
3 changes: 1 addition & 2 deletions unstable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ planner/core TestPrepareCacheNow
planner/core TestDAGPlanBuilderSplitAvg
planner/core TestIndexMerge
planner/core TestUnmatchedTableInHint
planner/core TestPartitionWithVariedDataSources
planner/core TestCopPaging
planner/core TestPlanCachePointGetAndTableDual
planner/core TestSimplifyOuterJoinWithCast
executor/seqtest TestShow
executor/seqtest TestShow

0 comments on commit b7a2d62

Please sign in to comment.