Skip to content

Commit

Permalink
server/storage/mvcc: deflake TestHashKVWhenCompacting
Browse files Browse the repository at this point in the history
The HashByRev-goroutines exit since receive `donec` notification. The
Check-computed-hashes goroutine could not have chance to get the hash
result and be stuck forever. We should add case for donec when we wait
for hash result.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Sep 6, 2023
1 parent ea9ef76 commit a15fac6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/storage/mvcc/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@ func TestHashKVWhenCompacting(t *testing.T) {
defer wg.Done()
revHash := make(map[int64]uint32)
for {
r := <-hashCompactc
select {
case r := <-hashCompactc:
case <-donec:
return
}

if revHash[r.compactRev] == 0 {
revHash[r.compactRev] = r.hash
}
Expand Down

0 comments on commit a15fac6

Please sign in to comment.