diff --git a/executor/prepared.go b/executor/prepared.go index bb886b9f26721..4cd28f1c7679d 100644 --- a/executor/prepared.go +++ b/executor/prepared.go @@ -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) diff --git a/tidb-server/main.go b/tidb-server/main.go index c03a10ad6fe72..02fe72c9740f2 100644 --- a/tidb-server/main.go +++ b/tidb-server/main.go @@ -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 }