Skip to content

Commit

Permalink
executor: fix the data race in hash join tests (#58406)
Browse files Browse the repository at this point in the history
close #58286
  • Loading branch information
xzhangxian1008 authored Dec 20, 2024
1 parent 220d5cb commit acba0cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/executor/join/hash_join_spill_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type hashJoinSpillHelper struct {
spillTriggedInBuildingStageForTest bool
spillTriggeredBeforeBuildingHashTableForTest bool
allPartitionsSpilledForTest bool
skipProbeInRestoreForTest bool
skipProbeInRestoreForTest atomic.Bool
}

func newHashJoinSpillHelper(hashJoinExec *HashJoinV2Exec, partitionNum int, probeFieldTypes []*types.FieldType) *hashJoinSpillHelper {
Expand Down Expand Up @@ -554,7 +554,7 @@ func (h *hashJoinSpillHelper) initTmpSpillBuildSideChunks() {
}

func (h *hashJoinSpillHelper) isProbeSkippedInRestoreForTest() bool {
return h.skipProbeInRestoreForTest
return h.skipProbeInRestoreForTest.Load()
}

func (h *hashJoinSpillHelper) isRespillTriggeredForTest() bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/executor/join/hash_join_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ func (w *ProbeWorkerV2) processOneProbeChunk(probeChunk *chunk.Chunk, joinResult
func (w *ProbeWorkerV2) probeAndSendResult(joinResult *hashjoinWorkerResult) (bool, int64, *hashjoinWorkerResult) {
if w.HashJoinCtx.spillHelper.areAllPartitionsSpilled() {
if intest.InTest && w.HashJoinCtx.spillHelper.hashJoinExec.inRestore {
w.HashJoinCtx.spillHelper.skipProbeInRestoreForTest = true
w.HashJoinCtx.spillHelper.skipProbeInRestoreForTest.Store(true)
}
return true, 0, joinResult
}
Expand Down

0 comments on commit acba0cd

Please sign in to comment.