/** * Verify <code>hbase:meta</code> is deployed and accessible. * * @param hConnection the connection to use * @param zkw reference to the {@link ZKWatcher} which also contains configuration and operation * @param timeout How long to wait on zk for meta address (passed through to * the internal call to {@link #getMetaServerConnection}. * @return True if the <code>hbase:meta</code> location is healthy. * @throws IOException if the number of retries for getting the connection is exceeded * @throws InterruptedException if waiting for the socket operation fails */ public boolean verifyMetaRegionLocation(ClusterConnection hConnection, ZKWatcher zkw, final long timeout) throws InterruptedException, IOException { return verifyMetaRegionLocation(hConnection, zkw, timeout, RegionInfo.DEFAULT_REPLICA_ID); }
/** * Verify <code>hbase:meta</code> is deployed and accessible. * @param hConnection * @param zkw * @param timeout How long to wait on zk for meta address (passed through to * the internal call to {@link #getMetaServerConnection}. * @return True if the <code>hbase:meta</code> location is healthy. * @throws java.io.IOException * @throws InterruptedException */ public boolean verifyMetaRegionLocation(HConnection hConnection, ZooKeeperWatcher zkw, final long timeout) throws InterruptedException, IOException { return verifyMetaRegionLocation(hConnection, zkw, timeout, HRegionInfo.DEFAULT_REPLICA_ID); }
conn.getTable(RSGROUP_TABLE_NAME); boolean rootMetaFound = masterServices.getMetaTableLocator().verifyMetaRegionLocation( conn, masterServices.getZooKeeper(), 1); final AtomicBoolean nsFound = new AtomicBoolean(false);
conn.getTable(RSGROUP_TABLE_NAME); boolean rootMetaFound = masterServices.getMetaTableLocator().verifyMetaRegionLocation( conn, masterServices.getZooKeeper(), 1); final AtomicBoolean nsFound = new AtomicBoolean(false);
private void testVerifyMetaRegionLocationWithException(Exception ex) throws IOException, InterruptedException, KeeperException, ServiceException { // Mock an ClientProtocol. final ClientProtos.ClientService.BlockingInterface implementation = Mockito.mock(ClientProtos.ClientService.BlockingInterface.class); ClusterConnection connection = mockConnection(null, implementation); // If a 'get' is called on mocked interface, throw connection refused. Mockito.when(implementation.get((RpcController) Mockito.any(), (GetRequest) Mockito.any())). thenThrow(new ServiceException(ex)); long timeout = UTIL.getConfiguration(). getLong("hbase.catalog.verification.timeout", 1000); MetaTableLocator.setMetaLocation(this.watcher, SN, RegionState.State.OPENING); assertFalse(new MetaTableLocator().verifyMetaRegionLocation( connection, watcher, timeout)); MetaTableLocator.setMetaLocation(this.watcher, SN, RegionState.State.OPEN); assertFalse(new MetaTableLocator().verifyMetaRegionLocation( connection, watcher, timeout)); }
sn, RegionState.State.OPENING); assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100)); MetaTableLocator.setMetaLocation(this.watcher, sn, RegionState.State.OPEN); assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
/** * A quick test that hbase:meta is assigned; blocks for short time only. * @return True if hbase:meta location is available and verified as good. * @throws InterruptedException * @throws IOException */ private boolean isMetaAssignedQuickTest(final MasterProcedureEnv env) throws InterruptedException, IOException { ZooKeeperWatcher zkw = env.getMasterServices().getZooKeeper(); MetaTableLocator mtl = env.getMasterServices().getMetaTableLocator(); boolean metaAssigned = false; // Is hbase:meta location available yet? if (mtl.isLocationAvailable(zkw)) { ClusterConnection connection = env.getMasterServices().getConnection(); // Is hbase:meta location good yet? long timeout = env.getMasterConfiguration().getLong(KEY_SHORT_WAIT_ON_META, DEFAULT_SHORT_WAIT_ON_META); if (mtl.verifyMetaRegionLocation(connection, zkw, timeout)) { metaAssigned = true; } } return metaAssigned; }
boolean metaRegionLocation = metaTableLocator.verifyMetaRegionLocation( this.getConnection(), this.getZooKeeper(), timeout, replicaId); if (!metaRegionLocation || !metaState.isOpened()) {