File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ func RebuildPlan4CachedPlan(p Plan) (ok bool) {
351
351
sc .InPreparedPlanBuilding = true
352
352
defer func () { sc .InPreparedPlanBuilding = false }()
353
353
if err := rebuildRange (p ); err != nil {
354
- // TODO: log or warn this error.
354
+ sc . AppendWarning ( errors . Errorf ( "skip plan-cache: plan rebuild failed, %s" , err . Error ()))
355
355
return false // fail to rebuild ranges
356
356
}
357
357
if ! sc .UseCache {
Original file line number Diff line number Diff line change @@ -2446,6 +2446,18 @@ func TestIssue45378(t *testing.T) {
2446
2446
tk .MustQuery (`select @@last_plan_from_cache` ).Check (testkit .Rows ("1" ))
2447
2447
}
2448
2448
2449
+ func TestIssue46159 (t * testing.T ) {
2450
+ store := testkit .CreateMockStore (t )
2451
+ tk := testkit .NewTestKit (t , store )
2452
+ tk .MustExec ("use test" )
2453
+ tk .MustExec (`create table t (a varchar(10), key(a(5)))` )
2454
+ tk .MustExec (`prepare st from 'select a from t use index(a) where a=?'` )
2455
+ tk .MustExec (`set @a='a'` )
2456
+ tk .MustQuery (`execute st using @a` ).Check (testkit .Rows ())
2457
+ tk .MustQuery (`execute st using @a` ).Check (testkit .Rows ())
2458
+ tk .MustQuery (`show warnings` ).Check (testkit .Rows ("Warning 1105 skip plan-cache: plan rebuild failed, rebuild to get an unsafe range" ))
2459
+ }
2460
+
2449
2461
func TestBuiltinFuncFlen (t * testing.T ) {
2450
2462
// same as TestIssue45378 and TestIssue45253
2451
2463
store := testkit .CreateMockStore (t )
You can’t perform that action at this time.
0 commit comments