Skip to content

Commit

Permalink
statistics: copy stats when to update it for avoiding data race (#58106)
Browse files Browse the repository at this point in the history
close #58074
  • Loading branch information
hawkingrei authored Dec 10, 2024
1 parent b416484 commit 9eddc07
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/statistics/handle/storage/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ func loadNeededColumnHistograms(sctx sessionctx.Context, statsHandle statstypes.
// Otherwise, it will trigger the sync/async load again, even if the column has not been analyzed.
if loadNeeded && !analyzed {
fakeCol := statistics.EmptyColumn(tblInfo.ID, tblInfo.PKIsHandle, colInfo)
statsTbl = statsTbl.Copy()
statsTbl.SetCol(col.ID, fakeCol)
statsHandle.UpdateStatsCache(statstypes.CacheUpdate{
Updated: []*statistics.Table{statsTbl},
Expand Down

0 comments on commit 9eddc07

Please sign in to comment.