HBASE-24338 [Flakey Tests] NPE in TestRaceBetweenSCPAndDTP

This commit is contained in:
stack 2020-05-06 09:39:26 -07:00
parent c28555c683
commit 618dca5782
1 changed files with 10 additions and 7 deletions

View File

@ -21,11 +21,7 @@ import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.MasterServices;
@ -43,12 +39,16 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Testcase for HBASE-23636.
*/
@Category({ MasterTests.class, MediumTests.class })
public class TestRaceBetweenSCPAndDTP {
private static final Logger LOG = LoggerFactory.getLogger(TestRaceBetweenSCPAndDTP.class);
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRaceBetweenSCPAndDTP.class);
@ -115,12 +115,15 @@ public class TestRaceBetweenSCPAndDTP {
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_REGIONS_ON_TABLE = new CountDownLatch(1);
RESUME_GET_REGIONS_ON_SERVER = 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_REGIONS_ON_TABLE;
UTIL.getAdmin().disableTableAsync(NAME);
ARRIVE_GET_REGIONS_ON_TABLE.await();
cdl.await();
ProcedureExecutor<?> procExec =
UTIL.getMiniHBaseCluster().getMaster().getMasterProcedureExecutor();