HBASE-21422 NPE in TestMergeTableRegionsProcedure.testMergeWithoutPONR
This commit is contained in:
parent
ee55b558c0
commit
e7f6c2972d
|
@ -92,29 +92,29 @@ public class ProcedureExecutor<TEnvironment> {
|
||||||
* break PE having it fail at various junctures. When non-null, testing is set to an instance of
|
* break PE having it fail at various junctures. When non-null, testing is set to an instance of
|
||||||
* the below internal {@link Testing} class with flags set for the particular test.
|
* the below internal {@link Testing} class with flags set for the particular test.
|
||||||
*/
|
*/
|
||||||
Testing testing = null;
|
volatile Testing testing = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class with parameters describing how to fail/die when in testing-context.
|
* Class with parameters describing how to fail/die when in testing-context.
|
||||||
*/
|
*/
|
||||||
public static class Testing {
|
public static class Testing {
|
||||||
protected boolean killIfHasParent = true;
|
protected volatile boolean killIfHasParent = true;
|
||||||
protected boolean killIfSuspended = false;
|
protected volatile boolean killIfSuspended = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kill the PE BEFORE we store state to the WAL. Good for figuring out if a Procedure is
|
* Kill the PE BEFORE we store state to the WAL. Good for figuring out if a Procedure is
|
||||||
* persisting all the state it needs to recover after a crash.
|
* persisting all the state it needs to recover after a crash.
|
||||||
*/
|
*/
|
||||||
protected boolean killBeforeStoreUpdate = false;
|
protected volatile boolean killBeforeStoreUpdate = false;
|
||||||
protected boolean toggleKillBeforeStoreUpdate = false;
|
protected volatile boolean toggleKillBeforeStoreUpdate = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set when we want to fail AFTER state has been stored into the WAL. Rarely used. HBASE-20978
|
* Set when we want to fail AFTER state has been stored into the WAL. Rarely used. HBASE-20978
|
||||||
* is about a case where memory-state was being set after store to WAL where a crash could
|
* is about a case where memory-state was being set after store to WAL where a crash could
|
||||||
* cause us to get stuck. This flag allows killing at what was a vulnerable time.
|
* cause us to get stuck. This flag allows killing at what was a vulnerable time.
|
||||||
*/
|
*/
|
||||||
protected boolean killAfterStoreUpdate = false;
|
protected volatile boolean killAfterStoreUpdate = false;
|
||||||
protected boolean toggleKillAfterStoreUpdate = false;
|
protected volatile boolean toggleKillAfterStoreUpdate = false;
|
||||||
|
|
||||||
protected boolean shouldKillBeforeStoreUpdate() {
|
protected boolean shouldKillBeforeStoreUpdate() {
|
||||||
final boolean kill = this.killBeforeStoreUpdate;
|
final boolean kill = this.killBeforeStoreUpdate;
|
||||||
|
|
|
@ -133,16 +133,15 @@ public class ProcedureTestingUtility {
|
||||||
if (actionBeforeStartWorker != null) {
|
if (actionBeforeStartWorker != null) {
|
||||||
actionBeforeStartWorker.call();
|
actionBeforeStartWorker.call();
|
||||||
}
|
}
|
||||||
|
if (avoidTestKillDuringRestart) {
|
||||||
|
procExecutor.testing = testing;
|
||||||
|
}
|
||||||
if (startWorkers) {
|
if (startWorkers) {
|
||||||
procExecutor.startWorkers();
|
procExecutor.startWorkers();
|
||||||
}
|
}
|
||||||
if (startAction != null) {
|
if (startAction != null) {
|
||||||
startAction.call();
|
startAction.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avoidTestKillDuringRestart) {
|
|
||||||
procExecutor.testing = testing;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void storeRestart(ProcedureStore procStore, ProcedureStore.ProcedureLoader loader)
|
public static void storeRestart(ProcedureStore procStore, ProcedureStore.ProcedureLoader loader)
|
||||||
|
|
|
@ -275,7 +275,6 @@ public class TestMergeTableRegionsProcedure {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMergeWithoutPONR() throws Exception {
|
public void testMergeWithoutPONR() throws Exception {
|
||||||
try {
|
|
||||||
final TableName tableName = TableName.valueOf("testMergeWithoutPONR");
|
final TableName tableName = TableName.valueOf("testMergeWithoutPONR");
|
||||||
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
|
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
|
||||||
|
|
||||||
|
@ -301,10 +300,6 @@ public class TestMergeTableRegionsProcedure {
|
||||||
ProcedureTestingUtility.waitProcedure(procExec, procId);
|
ProcedureTestingUtility.waitProcedure(procExec, procId);
|
||||||
|
|
||||||
assertRegionCount(tableName, initialRegionCount - 1);
|
assertRegionCount(tableName, initialRegionCount - 1);
|
||||||
} catch (Throwable t) {
|
|
||||||
LOG.error("error!", t);
|
|
||||||
throw t;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RegionInfo> createTable(final TableName tableName) throws Exception {
|
private List<RegionInfo> createTable(final TableName tableName) throws Exception {
|
||||||
|
|
|
@ -110,8 +110,12 @@ public class MasterProcedureTestingUtility {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
AssignmentManager am = env.getAssignmentManager();
|
AssignmentManager am = env.getAssignmentManager();
|
||||||
|
try {
|
||||||
am.joinCluster();
|
am.joinCluster();
|
||||||
master.setInitialized(true);
|
master.setInitialized(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Failed to load meta", e);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
|
@ -63,7 +64,8 @@ public class TestServerCrashProcedure {
|
||||||
private void setupConf(Configuration conf) {
|
private void setupConf(Configuration conf) {
|
||||||
conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
|
conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
|
||||||
conf.set("hbase.balancer.tablesOnMaster", "none");
|
conf.set("hbase.balancer.tablesOnMaster", "none");
|
||||||
conf.setInt("hbase.client.retries.number", 3);
|
conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3);
|
||||||
|
conf.setInt(HConstants.HBASE_CLIENT_SERVERSIDE_RETRIES_MULTIPLIER, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
Loading…
Reference in New Issue