Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Aug 21, 2023
1 parent 533998e commit a8e5a4f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planner/core/plan_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func RebuildPlan4CachedPlan(p Plan) (ok bool) {
sc.InPreparedPlanBuilding = true
defer func() { sc.InPreparedPlanBuilding = false }()
if err := rebuildRange(p); err != nil {
// TODO: log or warn this error.
sc.AppendWarning(errors.Errorf("skip plan-cache: plan rebuild failed, %s", err.Error()))

Check warning on line 354 in planner/core/plan_cache.go

View check run for this annotation

Codecov / codecov/patch

planner/core/plan_cache.go#L354

Added line #L354 was not covered by tests
return false // fail to rebuild ranges
}
if !sc.UseCache {
Expand Down
12 changes: 12 additions & 0 deletions planner/core/plan_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,18 @@ func TestIssue45378(t *testing.T) {
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1"))
}

func TestIssue46159(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec(`create table t (a varchar(10), key(a(5)))`)
tk.MustExec(`prepare st from 'select a from t use index(a) where a=?'`)
tk.MustExec(`set @a='a'`)
tk.MustQuery(`execute st using @a`).Check(testkit.Rows())
tk.MustQuery(`execute st using @a`).Check(testkit.Rows())
tk.MustQuery(`show warnings`).Check(testkit.Rows("Warning 1105 skip plan-cache: plan rebuild failed, rebuild to get an unsafe range"))
}

func TestBuiltinFuncFlen(t *testing.T) {
// same as TestIssue45378 and TestIssue45253
store := testkit.CreateMockStore(t)
Expand Down

0 comments on commit a8e5a4f

Please sign in to comment.