HBASE-24338 [Flakey Tests] NPE in TestRaceBetweenSCPAndDTP

Addendum: make same fix for TestRaceBetweenSCPAndTRSP which does same
thing.
This commit is contained in:
stack 2020-05-11 14:06:56 -07:00
parent 60035721ca
commit cf786a2dfb
1 changed files with 4 additions and 1 deletions

View File

@ -135,14 +135,17 @@ public class TestRaceBetweenSCPAndTRSP {
ARRIVE_REGION_OPENING = new CountDownLatch(1); ARRIVE_REGION_OPENING = new CountDownLatch(1);
RESUME_REGION_OPENING = new CountDownLatch(1); RESUME_REGION_OPENING = new CountDownLatch(1);
// Assign to local variable because this static gets set to null in above running thread and
// so can NPE when we check await later below.
ARRIVE_GET_REGIONS_ON_SERVER = new CountDownLatch(1); ARRIVE_GET_REGIONS_ON_SERVER = new CountDownLatch(1);
CountDownLatch cdl = ARRIVE_GET_REGIONS_ON_SERVER;
RESUME_GET_REGIONS_ON_SERVER = new CountDownLatch(1); RESUME_GET_REGIONS_ON_SERVER = new CountDownLatch(1);
Future<byte[]> moveFuture = am.moveAsync(new RegionPlan(region, sn, sn)); Future<byte[]> moveFuture = am.moveAsync(new RegionPlan(region, sn, sn));
ARRIVE_REGION_OPENING.await(); ARRIVE_REGION_OPENING.await();
UTIL.getMiniHBaseCluster().killRegionServer(sn); UTIL.getMiniHBaseCluster().killRegionServer(sn);
ARRIVE_GET_REGIONS_ON_SERVER.await(); cdl.await();
RESUME_REGION_OPENING.countDown(); RESUME_REGION_OPENING.countDown();
moveFuture.get(); moveFuture.get();