当前位置: 首页>>代码示例>>Java>>正文


Java PleaseHoldException类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.PleaseHoldException的典型用法代码示例。如果您正苦于以下问题:Java PleaseHoldException类的具体用法?Java PleaseHoldException怎么用?Java PleaseHoldException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PleaseHoldException类属于org.apache.hadoop.hbase包,在下文中一共展示了PleaseHoldException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: regionServerReport

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
void regionServerReport(ServerName sn, HServerLoad hsl)
throws YouAreDeadException, PleaseHoldException {
  checkIsDead(sn, "REPORT");
  if (!this.onlineServers.containsKey(sn)) {
    // Already have this host+port combo and its just different start code?
    checkAlreadySameHostPort(sn);
    // Just let the server in. Presume master joining a running cluster.
    // recordNewServer is what happens at the end of reportServerStartup.
    // The only thing we are skipping is passing back to the regionserver
    // the ServerName to use. Here we presume a master has already done
    // that so we'll press on with whatever it gave us for ServerName.
    recordNewServer(sn, hsl);
  } else {
    this.onlineServers.put(sn, hsl);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:ServerManager.java

示例2: checkAlreadySameHostPort

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Test to see if we have a server of same host and port already.
 * @param serverName
 * @throws PleaseHoldException
 */
void checkAlreadySameHostPort(final ServerName serverName)
throws PleaseHoldException {
  ServerName existingServer =
    ServerName.findServerWithSameHostnamePort(getOnlineServersList(), serverName);
  if (existingServer != null) {
    String message = "Server serverName=" + serverName +
      " rejected; we already have " + existingServer.toString() +
      " registered with same hostname and port";
    LOG.info(message);
    if (existingServer.getStartcode() < serverName.getStartcode()) {
      LOG.info("Triggering server recovery; existingServer " +
        existingServer + " looks stale, new server:" + serverName);
      expireServer(existingServer);
    }
    if (services.isServerShutdownHandlerEnabled()) {
      // master has completed the initialization
      throw new PleaseHoldException(message);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:ServerManager.java

示例3: updateRegionTransition

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
private void updateRegionTransition(final ServerName serverName, final TransitionCode state,
    final RegionInfo regionInfo, final long seqId)
    throws PleaseHoldException, UnexpectedStateException {
  checkFailoverCleanupCompleted(regionInfo);

  final RegionStateNode regionNode = regionStates.getRegionStateNode(regionInfo);
  if (regionNode == null) {
    // the table/region is gone. maybe a delete, split, merge
    throw new UnexpectedStateException(String.format(
      "Server %s was trying to transition region %s to %s. but the region was removed.",
      serverName, regionInfo, state));
  }

  if (LOG.isTraceEnabled()) {
    LOG.trace(String.format("Update region transition serverName=%s region=%s regionState=%s",
      serverName, regionNode, state));
  }

  final ServerStateNode serverNode = regionStates.getOrCreateServer(serverName);
  if (!reportTransition(regionNode, serverNode, state, seqId)) {
    LOG.warn(String.format(
      "No procedure for %s. server=%s to transition to %s", regionNode, serverName, state));
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:AssignmentManager.java

示例4: checkAlreadySameHostPort

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Test to see if we have a server of same host and port already.
 * @param serverName
 * @throws PleaseHoldException
 */
void checkAlreadySameHostPort(final ServerName serverName)
throws PleaseHoldException {
  ServerName existingServer =
    ServerName.findServerWithSameHostnamePort(getOnlineServersList(), serverName);
  if (existingServer != null) {
    String message = "Server serverName=" + serverName +
      " rejected; we already have " + existingServer.toString() +
      " registered with same hostname and port";
    LOG.info(message);
    if (existingServer.getStartcode() < serverName.getStartcode()) {
      LOG.info("Triggering server recovery; existingServer " +
        existingServer + " looks stale, new server:" + serverName);
      expireServer(existingServer);
    }
    throw new PleaseHoldException(message);
  }
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:23,代码来源:ServerManager.java

示例5: regionServerReport

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
void regionServerReport(ServerName sn, ServerLoad sl)
throws YouAreDeadException, PleaseHoldException {
  checkIsDead(sn, "REPORT");
  if (!this.onlineServers.containsKey(sn)) {
    // Already have this host+port combo and its just different start code?
    checkAlreadySameHostPort(sn);
    // Just let the server in. Presume master joining a running cluster.
    // recordNewServer is what happens at the end of reportServerStartup.
    // The only thing we are skipping is passing back to the regionserver
    // the ServerName to use. Here we presume a master has already done
    // that so we'll press on with whatever it gave us for ServerName.
    recordNewServer(sn, sl);
  } else {
    this.onlineServers.put(sn, sl);
  }
  updateLastFlushedSequenceIds(sn, sl);
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:18,代码来源:ServerManager.java

示例6: causeIsPleaseHold

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
private boolean causeIsPleaseHold(Throwable e) {
    if (e instanceof PleaseHoldException)
        return true;
    if (e instanceof TableNotEnabledException)
        return true;
    if (e instanceof RegionOfflineException)
        return true;
    if (e instanceof RetriesExhaustedException || e instanceof SocketTimeoutException) {
        if (e.getCause() instanceof RemoteException) {
            RemoteException re = (RemoteException) e.getCause();
            if (PleaseHoldException.class.getName().equals(re.getClassName()))
                return true;
        }
    }
    return false;
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:17,代码来源:RegionServerLifecycle.java

示例7: preCreateTable

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
    try {
        SpliceLogUtils.info(LOG, "preCreateTable %s", Bytes.toString(desc.getTableName().getName()));
        if (Bytes.equals(desc.getTableName().getName(), INIT_TABLE)) {
            switch(manager.getState()){
                case NOT_STARTED:
                	boot(ctx.getEnvironment().getMasterServices().getServerName());
                case BOOTING_ENGINE:
                case BOOTING_GENERAL_SERVICES:
                case BOOTING_SERVER:
                    throw new PleaseHoldException("Please Hold - Starting");
                case RUNNING:
                    throw new InitializationCompleted("Success");
                case STARTUP_FAILED:
                case SHUTTING_DOWN:
                case SHUTDOWN:
                    throw new IllegalStateException("Startup failed");
            }
        }
    } catch (Throwable t) {
        throw CoprocessorUtils.getIOException(t);
    }
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:25,代码来源:SpliceMasterObserver.java

示例8: reportRegionStateTransition

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
@Override
public ReportRegionStateTransitionResponse reportRegionStateTransition(RpcController c,
    ReportRegionStateTransitionRequest req) throws ServiceException {
  try {
    master.checkServiceStarted();
    RegionStateTransition rt = req.getTransition(0);
    TableName tableName = ProtobufUtil.toTableName(
      rt.getRegionInfo(0).getTableName());
    RegionStates regionStates = master.assignmentManager.getRegionStates();
    if (!(TableName.META_TABLE_NAME.equals(tableName)
        && regionStates.getRegionState(HRegionInfo.FIRST_META_REGIONINFO) != null)
          && !master.assignmentManager.isFailoverCleanupDone()) {
      // Meta region is assigned before master finishes the
      // failover cleanup. So no need this check for it
      throw new PleaseHoldException("Master is rebuilding user regions");
    }
    ServerName sn = ProtobufUtil.toServerName(req.getServer());
    String error = master.assignmentManager.onRegionTransition(sn, rt);
    ReportRegionStateTransitionResponse.Builder rrtr =
      ReportRegionStateTransitionResponse.newBuilder();
    if (error != null) {
      rrtr.setErrorMessage(error);
    }
    return rrtr.build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:MasterRpcServices.java

示例9: testMoveRegionWhenNotInitialized

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
@Test
public void testMoveRegionWhenNotInitialized() {
  MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
  HMaster m = cluster.getMaster();
  try {
    m.setInitialized(false); // fake it, set back later
    HRegionInfo meta = HRegionInfo.FIRST_META_REGIONINFO;
    m.move(meta.getEncodedNameAsBytes(), null);
    fail("Region should not be moved since master is not initialized");
  } catch (IOException ioe) {
    assertTrue(ioe instanceof PleaseHoldException);
  } finally {
    m.setInitialized(true);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestMaster.java

示例10: testMasterMonitorCallableRetries

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Verify that PleaseHoldException gets retried.
 * HBASE-8764
 * @throws IOException
 * @throws ZooKeeperConnectionException
 * @throws MasterNotRunningException
 * @throws ServiceException
 */
@Test
public void testMasterMonitorCallableRetries()
throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ServiceException {
  Configuration configuration = HBaseConfiguration.create();
  // Set the pause and retry count way down.
  configuration.setLong(HConstants.HBASE_CLIENT_PAUSE, 1);
  final int count = 10;
  configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, count);
  // Get mocked connection.   Getting the connection will register it so when HBaseAdmin is
  // constructed with same configuration, it will find this mocked connection.
  ClusterConnection connection = HConnectionTestingUtility.getMockedConnection(configuration);
  // Mock so we get back the master interface.  Make it so when createTable is called, we throw
  // the PleaseHoldException.
  MasterKeepAliveConnection masterAdmin = Mockito.mock(MasterKeepAliveConnection.class);
  Mockito.when(masterAdmin.createTable((RpcController)Mockito.any(),
    (CreateTableRequest)Mockito.any())).
      thenThrow(new ServiceException("Test fail").initCause(new PleaseHoldException("test")));
  Mockito.when(connection.getKeepAliveMasterService()).thenReturn(masterAdmin);
  Admin admin = new HBaseAdmin(connection);
  try {
    HTableDescriptor htd =
      new HTableDescriptor(TableName.valueOf("testMasterMonitorCollableRetries"));
    // Pass any old htable descriptor; not important
    try {
      admin.createTable(htd, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
      fail();
    } catch (RetriesExhaustedException e) {
      Log.info("Expected fail", e);
    }
    // Assert we were called 'count' times.
    Mockito.verify(masterAdmin, Mockito.atLeast(count)).createTable((RpcController)Mockito.any(),
      (CreateTableRequest)Mockito.any());
  } finally {
    admin.close();
    if (connection != null) connection.close();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:46,代码来源:TestHBaseAdminNoCluster.java

示例11: testMoveRegionWhenNotInitialized

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
@Test
public void testMoveRegionWhenNotInitialized() {
  MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
  HMaster m = cluster.getMaster();
  try {
    m.initialized = false; // fake it, set back later
    HRegionInfo meta = HRegionInfo.FIRST_META_REGIONINFO;
    m.move(meta.getEncodedNameAsBytes(), null);
    fail("Region should not be moved since master is not initialized");
  } catch (IOException ioe) {
    assertTrue(ioe instanceof PleaseHoldException);
  } finally {
    m.initialized = true;
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:16,代码来源:TestMaster.java

示例12: testMasterMonitorCollableRetries

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Verify that PleaseHoldException gets retried.
 * HBASE-8764
 * @throws IOException 
 * @throws ZooKeeperConnectionException 
 * @throws MasterNotRunningException 
 * @throws ServiceException 
 */
@Test
public void testMasterMonitorCollableRetries()
throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ServiceException {
  Configuration configuration = HBaseConfiguration.create();
  // Set the pause and retry count way down.
  configuration.setLong(HConstants.HBASE_CLIENT_PAUSE, 1);
  final int count = 10;
  configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, count);
  // Get mocked connection.   Getting the connection will register it so when HBaseAdmin is
  // constructed with same configuration, it will find this mocked connection.
  HConnection connection = HConnectionTestingUtility.getMockedConnection(configuration);
  // Mock so we get back the master interface.  Make it so when createTable is called, we throw
  // the PleaseHoldException.
  MasterKeepAliveConnection masterAdmin =
    Mockito.mock(MasterKeepAliveConnection.class);
  Mockito.when(masterAdmin.createTable((RpcController)Mockito.any(),
    (CreateTableRequest)Mockito.any())).
      thenThrow(new ServiceException("Test fail").initCause(new PleaseHoldException("test")));
  Mockito.when(connection.getKeepAliveMasterService()).thenReturn(masterAdmin);
  // Mock up our admin Interfaces
  HBaseAdmin admin = new HBaseAdmin(configuration);
  try {
    HTableDescriptor htd =
        new HTableDescriptor(TableName.valueOf("testMasterMonitorCollableRetries"));
    // Pass any old htable descriptor; not important
    try {
      admin.createTable(htd, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
      fail();
    } catch (RetriesExhaustedException e) {
      Log.info("Expected fail", e);
    }
    // Assert we were called 'count' times.
    Mockito.verify(masterAdmin, Mockito.atLeast(count)).createTable((RpcController)Mockito.any(),
      (CreateTableRequest)Mockito.any());
  } finally {
    admin.close();
    if (connection != null)HConnectionManager.deleteConnection(configuration);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:48,代码来源:TestHBaseAdminNoCluster.java

示例13: checkFailoverCleanupCompleted

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Used to check if the failover cleanup is done.
 * if not we throw PleaseHoldException since we are rebuilding the RegionStates
 * @param hri region to check if it is already rebuild
 * @throws PleaseHoldException if the failover cleanup is not completed
 */
private void checkFailoverCleanupCompleted(final RegionInfo hri) throws PleaseHoldException {
  if (!isRunning()) {
    throw new PleaseHoldException("AssignmentManager not running");
  }

  // TODO: can we avoid throwing an exception if hri is already loaded?
  //       at the moment we bypass only meta
  boolean meta = isMetaRegion(hri);
  boolean cleanup = isFailoverCleanupDone();
  if (!isMetaRegion(hri) && !isFailoverCleanupDone()) {
    String msg = "Master not fully online; hbase:meta=" + meta + ", failoverCleanup=" + cleanup;
    throw new PleaseHoldException(msg);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:AssignmentManager.java

示例14: reportRegionSizesForQuotas

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
/**
 * Reports the given map of Regions and their size on the filesystem to the active Master.
 *
 * @param onlineRegionSizes A map of region info to size in bytes
 * @return false if FileSystemUtilizationChore should pause reporting to master. true otherwise
 */
public boolean reportRegionSizesForQuotas(final Map<RegionInfo, Long> onlineRegionSizes) {
  RegionServerStatusService.BlockingInterface rss = rssStub;
  if (rss == null) {
    // the current server could be stopping.
    LOG.trace("Skipping Region size report to HMaster as stub is null");
    return true;
  }
  try {
    RegionSpaceUseReportRequest request = buildRegionSpaceUseReportRequest(
        Objects.requireNonNull(onlineRegionSizes));
    rss.reportRegionSpaceUse(null, request);
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof PleaseHoldException) {
      LOG.trace("Failed to report region sizes to Master because it is initializing."
          + " This will be retried.", ioe);
      // The Master is coming up. Will retry the report later. Avoid re-creating the stub.
      return true;
    }
    if (rssStub == rss) {
      rssStub = null;
    }
    createRegionServerStatusStub(true);
    if (ioe instanceof DoNotRetryIOException) {
      DoNotRetryIOException doNotRetryEx = (DoNotRetryIOException) ioe;
      if (doNotRetryEx.getCause() != null) {
        Throwable t = doNotRetryEx.getCause();
        if (t instanceof UnsupportedOperationException) {
          LOG.debug("master doesn't support ReportRegionSpaceUse, pause before retrying");
          return false;
        }
      }
    }
    LOG.debug("Failed to report region sizes to Master. This will be retried.", ioe);
  }
  return true;
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:HRegionServer.java

示例15: testMoveRegionWhenNotInitialized

import org.apache.hadoop.hbase.PleaseHoldException; //导入依赖的package包/类
@Test
public void testMoveRegionWhenNotInitialized() {
  MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
  HMaster m = cluster.getMaster();
  try {
    m.setInitialized(false); // fake it, set back later
    RegionInfo meta = RegionInfoBuilder.FIRST_META_REGIONINFO;
    m.move(meta.getEncodedNameAsBytes(), null);
    fail("Region should not be moved since master is not initialized");
  } catch (IOException ioe) {
    assertTrue(ioe instanceof PleaseHoldException);
  } finally {
    m.setInitialized(true);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:TestMaster.java


注:本文中的org.apache.hadoop.hbase.PleaseHoldException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。