Skip to content

Commit

Permalink
planner/core: fix a data race when building plan for cached table (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored Dec 2, 2021
1 parent dae711c commit cec4acb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4204,12 +4204,14 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName, as
result = us
} else {
if !b.inUpdateStmt && !b.inDeleteStmt && !sessionVars.StmtCtx.InExplainStmt {
startTS := txn.StartTS()
store := b.ctx.GetStore()
go func() {
defer func() {
if r := recover(); r != nil {
}
}()
err := cachedTable.UpdateLockForRead(b.ctx.GetStore(), txn.StartTS())
err := cachedTable.UpdateLockForRead(store, startTS)
if err != nil {
log.Warn("Update Lock Info Error")
}
Expand Down

0 comments on commit cec4acb

Please sign in to comment.