Skip to content

Commit

Permalink
Merge pull request #124608 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-23.2-119650

release-23.2: roachtest: make failure recovery independent
  • Loading branch information
andrewbaptist authored May 31, 2024
2 parents b38abad + e51a4c4 commit 24ce7f6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/cmd/roachtest/tests/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
gosql "database/sql"
"fmt"
"math/rand"
"sync"
"time"

"github.com/cockroachdb/cockroach/pkg/base"
Expand Down Expand Up @@ -340,10 +341,23 @@ func runFailoverChaos(ctx context.Context, t test.Test, c cluster.Cluster, readO

sleepFor(ctx, t, time.Minute)

// Recover the failers on different goroutines. Otherwise, they
// might interact as certain failures can prevent other failures
// from recovering.
var wg sync.WaitGroup
for node, failer := range nodeFailers {
t.L().Printf("recovering n%d (%s)", node, failer)
failer.Recover(ctx, node)
wg.Add(1)
node := node
failer := failer
m.Go(func(ctx context.Context) error {
defer wg.Done()
t.L().Printf("recovering n%d (%s)", node, failer)
failer.Recover(ctx, node)

return nil
})
}
wg.Wait()
}

sleepFor(ctx, t, time.Minute) // let cluster recover
Expand Down

0 comments on commit 24ce7f6

Please sign in to comment.