@Test
  public void testRace() throws Exception {
    RegionInfo region = UTIL.getMiniHBaseCluster().getRegions(NAME).get(0).getRegionInfo();
    AssignmentManager am = UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager();
    ServerName sn = am.getRegionStates().getRegionState(region).getServerName();
    LOG.info("ServerName={}, region={}", sn, region);

    ARRIVE_GET_REPLICATION_PEER_MANAGER = new CountDownLatch(1);
    RESUME_GET_REPLICATION_PEER_MANAGER = new CountDownLatch(1);
    // Assign to local variable because this static gets set to null in above running thread and
    // so NPE.
    CountDownLatch cdl = ARRIVE_GET_REPLICATION_PEER_MANAGER;
    UTIL.getMiniHBaseCluster().stopRegionServer(sn);
    cdl.await();

    Future<?> future = UTIL.getAdmin().disableTableAsync(NAME);
    ProcedureExecutor<?> procExec =
      UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor();
    // make sure the DTP has been executed
    UTIL.waitFor(60000,
      () -> procExec.getProcedures().stream().filter(p -> p instanceof DisableTableProcedure)
        .map(p -> (DisableTableProcedure) p).filter(p -> p.getTableName().equals(NAME))
        .anyMatch(this::wasExecuted));
    RESUME_GET_REPLICATION_PEER_MANAGER.countDown();

    // make sure the DTP can finish
    future.get();

    // also make sure all SCPs are finished
    UTIL.waitFor(60000, () -> procExec.getProcedures().stream()
      .filter(p -> p instanceof ServerCrashProcedure).allMatch(Procedure::isFinished));
  }
Testcase for HBASE-28522.
<p>
We used to have test with the same name but in different package for HBASE-23636, where DTP will
hold the exclusive lock all the time, and it will reset TRSPs which has been attached to
RegionStateNodes, so we need special logic in SCP to deal with it.
<p>
After HBASE-28522, DTP will not reset TRSPs any more, so SCP does not need to take care of this
special case, thues we removed the special logic in SCP and also the UT for HBASE-22636 is not
valid any more, so we just removed the old one and introduce a new one with the same name here.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestRaceBetweenSCPAndDTP.java