Skip to content

Commit

Permalink
executor: fix data race on the IndexMergeReaderExecutor
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Dec 1, 2022
1 parent d3f7ec0 commit 5a05980
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions executor/index_merge_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ var (
type IndexMergeReaderExecutor struct {
baseExecutor

table table.Table
indexes []*model.IndexInfo
descs []bool
ranges [][]*ranger.Range
dagPBs []*tipb.DAGRequest
startTS uint64
tableRequest *tipb.DAGRequest
table table.Table
indexes []*model.IndexInfo
descs []bool
ranges [][]*ranger.Range
dagPBs []*tipb.DAGRequest
startTS uint64
tableRequestMu sync.Mutex
tableRequest *tipb.DAGRequest
// columns are only required by union scan.
columns []*model.ColumnInfo
*dataReaderBuilder
Expand Down Expand Up @@ -631,9 +632,12 @@ func (e *IndexMergeReaderExecutor) buildFinalTableReader(ctx context.Context, tb
netDataSize: e.dataAvgRowSize * float64(len(handles)),
}
if e.isCorColInTableFilter {
e.tableRequestMu.Lock()
if tableReaderExec.dagPB.Executors, err = constructDistExec(e.ctx, e.tblPlans); err != nil {
e.tableRequestMu.Unlock()
return nil, err
}
e.tableRequestMu.Unlock()
}
tableReaderExec.buildVirtualColumnInfo()
// Reorder handles because SplitKeyRangesByLocations() requires startKey of kvRanges is ordered.
Expand Down

0 comments on commit 5a05980

Please sign in to comment.