From 1c7b42781c07db4bd8dfc9c87ee4d591d98ad59b Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Wed, 10 Oct 2018 16:05:50 -0400 Subject: [PATCH] storage: deflake TestStoreRangeMergeWatcher 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 --- pkg/storage/client_merge_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/storage/client_merge_test.go b/pkg/storage/client_merge_test.go index a2aaefd32d77..ee0df61ddcfa 100644 --- a/pkg/storage/client_merge_test.go +++ b/pkg/storage/client_merge_test.go @@ -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())