public class TestMasterFailover extends Object
Constructor and Description |
---|
TestMasterFailover() |
Modifier and Type | Method and Description |
---|---|
void |
testMasterFailoverWithMockedRIT()
Complex test of master failover that tests as many permutations of the
different possible states that regions in transition could be in within ZK.
|
void |
testMasterFailoverWithMockedRITOnDeadRS()
Complex test of master failover that tests as many permutations of the
different possible states that regions in transition could be in within ZK
pointing to an RS that has died while no master is around to process it.
|
void |
testMetaInTransitionWhenMasterFailover()
Test meta in transition when master failover
|
void |
testOfflineRegionReAssginedAfterMasterRestart()
This tests a RIT in offline state will get re-assigned after a master restart
|
void |
testPendingOpenOrCloseWhenMasterFailover()
Test region in pending_open/close and failed_open/close when master failover
|
void |
testShouldCheckMasterFailOverWhenMETAIsInOpenedState() |
void |
testSimpleMasterFailover()
Simple test of master failover.
|
public void testMasterFailoverWithMockedRIT() throws Exception
This tests the proper handling of these states by the failed-over master and includes a thorough testing of the timeout code as well.
Starts with a single master and three regionservers.
Creates two tables, enabledTable and disabledTable, each containing 5 regions. The disabledTable is then disabled.
After reaching steady-state, the master is killed. We then mock several states in ZK.
After mocking them, we will startup a new master which should become the active master and also detect that it is a failover. The primary test passing condition will be that all regions of the enabled table are assigned and all the regions of the disabled table are not assigned.
The different scenarios to be tested are below:
ZK State: OFFLINE
A node can get into OFFLINE state if
We will mock the scenarios
ZK State: CLOSING
A node can get into CLOSING state if
We will mock the scenarios
ZK State: CLOSED
A node can get into CLOSED state if
We will mock the scenarios
ZK State: OPENING
A node can get into OPENING state if
We will mock the scenarios
ZK State: OPENED
A node can get into OPENED state if
We will mock the scenarios
Exception
public void testMasterFailoverWithMockedRITOnDeadRS() throws Exception
This tests the proper handling of these states by the failed-over master and includes a thorough testing of the timeout code as well.
Starts with a single master and two regionservers.
Creates two tables, enabledTable and disabledTable, each containing 5 regions. The disabledTable is then disabled.
After reaching steady-state, the master is killed. We then mock several states in ZK. And one of the RS will be killed.
After mocking them and killing an RS, we will startup a new master which should become the active master and also detect that it is a failover. The primary test passing condition will be that all regions of the enabled table are assigned and all the regions of the disabled table are not assigned.
The different scenarios to be tested are below:
ZK State: CLOSING
A node can get into CLOSING state if
We will mock the scenarios
A node can get into OPENED state if
We will mock the scenarios
ZK State: NONE
A region could not have a transition node if
We will mock the scenarios
Exception
public void testShouldCheckMasterFailOverWhenMETAIsInOpenedState() throws Exception
Exception
public void testOfflineRegionReAssginedAfterMasterRestart() throws Exception
Exception
public void testSimpleMasterFailover() throws Exception
Starts with three masters. Kills a backup master. Then kills the active master. Ensures the final master becomes active and we can still contact the cluster.
Exception
public void testPendingOpenOrCloseWhenMasterFailover() throws Exception
Exception