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 #31096.
Fixes #31149.
Fixes #31160.
Fixes #31167.

Release note: None
  • Loading branch information
benesch committed Oct 10, 2018
1 parent f837f9f commit 1c7b427
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 1c7b427

Please sign in to comment.