Skip to content

Commit

Permalink
planner: fix DATA RACE caused by initializing PointGet stats (#53676) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jul 31, 2024
1 parent 92e1809 commit 0937d37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/planner/core/point_get_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,8 @@ func (*PointGetPlan) StatsCount() float64 {
// StatsInfo will return the RowCount of property.StatsInfo for this plan.
func (p *PointGetPlan) StatsInfo() *property.StatsInfo {
if p.Plan.StatsInfo() == nil {
p.Plan.SetStats(&property.StatsInfo{})
p.Plan.SetStats(&property.StatsInfo{RowCount: 1})
}
p.Plan.StatsInfo().RowCount = 1
return p.Plan.StatsInfo()
}

Expand Down Expand Up @@ -1485,6 +1484,7 @@ func newPointGetPlan(ctx PlanContext, dbName string, schema *expression.Schema,
outputNames: names,
LockWaitTime: ctx.GetSessionVars().LockWaitTimeout,
}
p.Plan.SetStats(&property.StatsInfo{RowCount: 1})
ctx.GetSessionVars().StmtCtx.Tables = []stmtctx.TableEntry{{DB: dbName, Table: tbl.Name.L}}
return p
}
Expand Down

0 comments on commit 0937d37

Please sign in to comment.