Skip to content

Commit

Permalink
storage: deflake TestStoreRangeMergeWatcher
Browse files Browse the repository at this point in the history
This test could deadlock if the LHS replica on store2 was shut down
before it processed the split at "b". Teach the test to wait for the LHS
replica on store2 to process the split before blocking Raft traffic to
it.

Fixes cockroachdb#31096.
Fixes cockroachdb#31149.
Fixes cockroachdb#31160.
Fixes cockroachdb#31167.

Release note: None
  • Loading branch information
benesch authored and tbg committed Oct 11, 2018
1 parent d0aef0c commit 5dad79a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/storage/client_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2032,12 +2032,19 @@ func testMergeWatcher(t *testing.T, injectFailures bool) {
}
mtc.transferLease(ctx, rhsDesc.RangeID, 0, 2)

// Block Raft traffic to the LHS replica on store2, by holding its raftMu, so
// that its LHS isn't aware there's a merge in progress.
// After the LHS replica on store2 processes the split, block Raft traffic to
// it by holding its raftMu, so that it isn't aware there's a merge in
// progress.
lhsRepl2, err := store2.GetReplica(lhsDesc.RangeID)
if err != nil {
t.Fatal(err)
}
testutils.SucceedsSoon(t, func() error {
if !lhsRepl2.Desc().Equal(lhsDesc) {
return errors.New("store2 has not processed split")
}
return nil
})
lhsRepl2.RaftLock()

args := adminMergeArgs(lhsDesc.StartKey.AsRawKey())
Expand Down

0 comments on commit 5dad79a

Please sign in to comment.