From 89e08311c85beb51109e8273e54fb6cd54de5b69 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Sat, 11 Apr 2020 00:18:19 +0530 Subject: [PATCH] do not cache plan with nil instructions Signed-off-by: Harshit Gangal --- go/vt/vtgate/executor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index 62a74c0bf3e..27ec0ff978a 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -1359,7 +1359,7 @@ func (e *Executor) getPlan(vcursor *vcursorImpl, sql string, comments sqlparser. if err != nil { return nil, err } - if !skipQueryPlanCache && !sqlparser.SkipQueryPlanCacheDirective(stmt) { + if !skipQueryPlanCache && !sqlparser.SkipQueryPlanCacheDirective(stmt) && plan.Instructions != nil { e.plans.Set(planKey, plan) } return plan, nil @@ -1386,7 +1386,7 @@ func (e *Executor) getPlan(vcursor *vcursorImpl, sql string, comments sqlparser. if err != nil { return nil, err } - if !skipQueryPlanCache && !sqlparser.SkipQueryPlanCacheDirective(rewrittenStatement) { + if !skipQueryPlanCache && !sqlparser.SkipQueryPlanCacheDirective(rewrittenStatement) && plan.Instructions != nil { e.plans.Set(planKey, plan) } return plan, nil