HBASE-4470 ServerNotRunningException coming out of assignRootAndMeta kills the Master (Gregory Chanan)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1364532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
889e1136d4
commit
2144415141
@ -62,6 +62,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKUtil;
|
|||||||
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
|
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
|
||||||
import org.apache.hadoop.util.Progressable;
|
import org.apache.hadoop.util.Progressable;
|
||||||
import org.apache.zookeeper.KeeperException;
|
import org.apache.zookeeper.KeeperException;
|
||||||
|
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -265,15 +266,7 @@ public class TestCatalogTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void testVerifyMetaRegionLocationWithException(Exception ex)
|
||||||
* Test we survive a connection refused {@link ConnectException}
|
|
||||||
* @throws IOException
|
|
||||||
* @throws InterruptedException
|
|
||||||
* @throws KeeperException
|
|
||||||
* @throws ServiceException
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testGetMetaServerConnectionFails()
|
|
||||||
throws IOException, InterruptedException, KeeperException, ServiceException {
|
throws IOException, InterruptedException, KeeperException, ServiceException {
|
||||||
// Mock an ClientProtocol.
|
// Mock an ClientProtocol.
|
||||||
final ClientProtocol implementation = Mockito.mock(ClientProtocol.class);
|
final ClientProtocol implementation = Mockito.mock(ClientProtocol.class);
|
||||||
@ -281,7 +274,7 @@ public class TestCatalogTracker {
|
|||||||
try {
|
try {
|
||||||
// If a 'get' is called on mocked interface, throw connection refused.
|
// If a 'get' is called on mocked interface, throw connection refused.
|
||||||
Mockito.when(implementation.get((RpcController) Mockito.any(), (GetRequest) Mockito.any())).
|
Mockito.when(implementation.get((RpcController) Mockito.any(), (GetRequest) Mockito.any())).
|
||||||
thenThrow(new ServiceException(new ConnectException("Connection refused")));
|
thenThrow(new ServiceException(ex));
|
||||||
// Now start up the catalogtracker with our doctored Connection.
|
// Now start up the catalogtracker with our doctored Connection.
|
||||||
final CatalogTracker ct = constructAndStartCatalogTracker(connection);
|
final CatalogTracker ct = constructAndStartCatalogTracker(connection);
|
||||||
try {
|
try {
|
||||||
@ -300,6 +293,39 @@ public class TestCatalogTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test we survive a connection refused {@link ConnectException}
|
||||||
|
* @throws IOException
|
||||||
|
* @throws InterruptedException
|
||||||
|
* @throws KeeperException
|
||||||
|
* @throws ServiceException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetMetaServerConnectionFails()
|
||||||
|
throws IOException, InterruptedException, KeeperException, ServiceException {
|
||||||
|
testVerifyMetaRegionLocationWithException(new ConnectException("Connection refused"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that verifyMetaRegionLocation properly handles getting a
|
||||||
|
* ServerNotRunningException. See HBASE-4470.
|
||||||
|
* Note this doesn't check the exact exception thrown in the
|
||||||
|
* HBASE-4470 as there it is thrown from getHConnection() and
|
||||||
|
* here it is thrown from get() -- but those are both called
|
||||||
|
* from the same function anyway, and this way is less invasive than
|
||||||
|
* throwing from getHConnection would be.
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* @throws InterruptedException
|
||||||
|
* @throws KeeperException
|
||||||
|
* @throws ServiceException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testVerifyMetaRegionServerNotRunning()
|
||||||
|
throws IOException, InterruptedException, KeeperException, ServiceException {
|
||||||
|
testVerifyMetaRegionLocationWithException(new ServerNotRunningYetException("mock"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test get of root region fails properly if nothing to connect to.
|
* Test get of root region fails properly if nothing to connect to.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
Loading…
x
Reference in New Issue
Block a user