Skip to content

Commit

Permalink
fix: data race in load test
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Liu <[email protected]>
  • Loading branch information
weiliu1031 committed Feb 13, 2025
1 parent cb1bf6d commit 73936e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/integration/replicas/load/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"path"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -988,8 +989,11 @@ func (s *LoadTestSuite) TestLoadWithCompact() {
s.releaseCollection(dbName, collName)

stopInsertCh := make(chan struct{}, 1)
wg := &sync.WaitGroup{}
wg.Add(1)
// Start a goroutine to continuously insert data and trigger compaction
go func() {
defer wg.Done()
for {
select {
case <-stopInsertCh:
Expand Down Expand Up @@ -1023,6 +1027,7 @@ func (s *LoadTestSuite) TestLoadWithCompact() {

// Clean up
close(stopInsertCh)
wg.Wait()
s.releaseCollection(dbName, collName)
}

Expand Down

0 comments on commit 73936e1

Please sign in to comment.