From 60f5ba13049d9482b33e17ad31d65820c477fce1 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Fri, 17 May 2024 14:17:44 +0800 Subject: [PATCH] session: reset CTEStorageMap before txn conflict and retry() #49399 --- session/session.go | 1 + 1 file changed, 1 insertion(+) diff --git a/session/session.go b/session/session.go index 25a3f05441352..338a3ed822e48 100644 --- a/session/session.go +++ b/session/session.go @@ -1075,6 +1075,7 @@ func (s *session) retry(ctx context.Context, maxCnt uint) (err error) { for i, sr := range nh.history { st := sr.st s.sessionVars.StmtCtx = sr.stmtCtx + s.sessionVars.StmtCtx.CTEStorageMap = map[int]*executor.CTEStorages{} s.sessionVars.StmtCtx.ResetForRetry() s.sessionVars.PreparedParams = s.sessionVars.PreparedParams[:0] schemaVersion, err = st.RebuildPlan(ctx)