Skip to content

Commit

Permalink
variable: fix data race in GetTemporaryTable (#55338) (#55341)
Browse files Browse the repository at this point in the history
close #55337
  • Loading branch information
ti-chi-bot authored Aug 12, 2024
1 parent 5d5a2be commit 0ff1860
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,8 @@ func (s *SessionVars) LazyCheckKeyNotExists() bool {
// GetTemporaryTable returns a TempTable by tableInfo.
func (s *SessionVars) GetTemporaryTable(tblInfo *model.TableInfo) tableutil.TempTable {
if tblInfo.TempTableType != model.TempTableNone {
s.TxnCtxMu.Lock()
defer s.TxnCtxMu.Unlock()
if s.TxnCtx.TemporaryTables == nil {
s.TxnCtx.TemporaryTables = make(map[int64]tableutil.TempTable)
}
Expand Down

0 comments on commit 0ff1860

Please sign in to comment.