Skip to content

Commit

Permalink
planner: fix a sporadic panic due to the PR #7684 when using the prep…
Browse files Browse the repository at this point in the history
…ared plan cache (#7956) (#8826)
  • Loading branch information
XuHuaiyu authored and zimulala committed Dec 26, 2018
1 parent d805e83 commit 8b970d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions executor/prepared.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func (e *PrepareExec) Next(ctx context.Context, chk *chunk.Chunk) error {
if _, ok := stmt.(ast.DDLNode); ok {
return ErrPrepareDDL
}
err = ResetContextOfStmt(e.ctx, stmt)
if err != nil {
return err
}
var extractor paramMarkerExtractor
stmt.Accept(&extractor)

Expand Down
3 changes: 2 additions & 1 deletion tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ func setGlobalVars() {
variable.SysVars[variable.TIDBMemQuotaQuery].Value = strconv.FormatInt(cfg.MemQuotaQuery, 10)
variable.SysVars["lower_case_table_names"].Value = strconv.Itoa(cfg.LowerCaseTableNames)

plannercore.SetPreparedPlanCache(cfg.PreparedPlanCache.Enabled)
// For CI environment we default enable prepare-plan-cache.
plannercore.SetPreparedPlanCache(config.CheckTableBeforeDrop || cfg.PreparedPlanCache.Enabled)
if plannercore.PreparedPlanCacheEnabled() {
plannercore.PreparedPlanCacheCapacity = cfg.PreparedPlanCache.Capacity
}
Expand Down

0 comments on commit 8b970d7

Please sign in to comment.