HBASE-14802 Replaying server crash recovery procedure after a failover causes incorrect handling of deadservers; ADDENDUM

This commit is contained in:
stack 2015-11-15 15:00:15 -08:00
parent aaa2294126
commit b7a4c5f5dc
1 changed files with 16 additions and 5 deletions

View File

@ -23,11 +23,12 @@ import org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor; import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility; import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility;
import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.hbase.util.Pair;
import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
@ -37,13 +38,25 @@ import java.util.Set;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@Category(MediumTests.class) @Category({MediumTests.class})
public class TestDeadServer { public class TestDeadServer {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
final ServerName hostname123 = ServerName.valueOf("127.0.0.1", 123, 3L); final ServerName hostname123 = ServerName.valueOf("127.0.0.1", 123, 3L);
final ServerName hostname123_2 = ServerName.valueOf("127.0.0.1", 123, 4L); final ServerName hostname123_2 = ServerName.valueOf("127.0.0.1", 123, 4L);
final ServerName hostname1234 = ServerName.valueOf("127.0.0.2", 1234, 4L); final ServerName hostname1234 = ServerName.valueOf("127.0.0.2", 1234, 4L);
final ServerName hostname12345 = ServerName.valueOf("127.0.0.2", 12345, 4L); final ServerName hostname12345 = ServerName.valueOf("127.0.0.2", 12345, 4L);
@BeforeClass
public static void setupBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@Test public void testIsDead() { @Test public void testIsDead() {
DeadServer ds = new DeadServer(); DeadServer ds = new DeadServer();
ds.add(hostname123); ds.add(hostname123);
@ -83,9 +96,7 @@ public class TestDeadServer {
} }
@Test(timeout = 15000) @Test(timeout = 15000)
public void testCrashProcedureReplay() throws Exception { public void testCrashProcedureReplay() {
HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.startMiniCluster();
HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
ProcedureExecutor pExecutor = master.getMasterProcedureExecutor(); ProcedureExecutor pExecutor = master.getMasterProcedureExecutor();
ServerCrashProcedure proc = new ServerCrashProcedure(hostname123, false, false); ServerCrashProcedure proc = new ServerCrashProcedure(hostname123, false, false);