Skip to content

Commit

Permalink
planner: fix a sporadic panic due to the PR pingcap#7684 when using t…
Browse files Browse the repository at this point in the history
…he prepared plan cache (pingcap#7956)
  • Loading branch information
dbjoa authored and XuHuaiyu committed Dec 26, 2018
1 parent c06df05 commit d85ad88
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 @@ -124,6 +124,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 @@ -393,7 +393,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 d85ad88

Please sign in to comment.