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


Java TableNotEnabledException类代码示例

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


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

示例1: deleteTable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
public static void deleteTable(HBaseTestingUtility testUtil, Admin admin, TableName tableName)
    throws Exception {
  // NOTE: We need a latch because admin is not sync,
  // so the postOp coprocessor method may be called after the admin operation returned.
  MasterSyncObserver observer = (MasterSyncObserver)testUtil.getHBaseCluster().getMaster()
    .getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class.getName());
  observer.tableDeletionLatch = new CountDownLatch(1);
  try {
    admin.disableTable(tableName);
  } catch (TableNotEnabledException e) {
    LOG.debug("Table: " + tableName + " already disabled, so just deleting it.");
  }
  admin.deleteTable(tableName);
  observer.tableDeletionLatch.await();
  observer.tableDeletionLatch = null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:SecureTestUtil.java

示例2: createSnapshotAndValidate

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(Admin admin,
    TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:SnapshotTestingUtils.java

示例3: createSnapshotAndValidate

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(HBaseAdmin admin,
    String tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs, false,
    new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), null);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:SnapshotTestingUtils.java

示例4: testDisable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
@Test
@Category(KnownGap.class)
// TODO(sduskis): Disabled tables should throw TableNotEnabledException for gets.
public void testDisable() throws IOException {
  Admin admin = getConnection().getAdmin();
  TableName tableName = TableName.valueOf("test_table-" + UUID.randomUUID().toString());
  IntegrationTests.createTable(tableName);
  try (Table table = getConnection().getTable(tableName)) {
    Get get = new Get("row".getBytes());
    table.get(get);
    admin.disableTable(tableName);
    Assert.assertTrue(admin.isTableDisabled(tableName));
    try {
      table.get(get);
      Assert.fail("Expected TableNotEnabledException");
    } catch (TableNotEnabledException e) {
    }
    admin.enableTable(tableName);
    table.get(get);
  } finally {
    if (admin.isTableEnabled(tableName)) {
      admin.disableTable(tableName);
    }
    admin.deleteTable(tableName);
  }
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:27,代码来源:TestDisableTable.java

示例5: createSnapshotAndValidate

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(HBaseAdmin admin,
    TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs, false,
    new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), null);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:29,代码来源:SnapshotTestingUtils.java

示例6: deleteHBaseTable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
public static void deleteHBaseTable(String hbaseUrl, String tableName) throws Exception {
        final Configuration hbConfig = HBaseConfiguration.create();
        hbConfig.set("hbase.rootdir", hbaseUrl);
        HBaseAdmin hBaseAdmin = new HBaseAdmin(hbConfig);
        HTableDescriptor[] tables = hBaseAdmin.listTables();
        for (HTableDescriptor table : tables) {
            if (table.getNameAsString().equals(tableName)) {
                try {
                    hBaseAdmin.disableTable(tableName);
                } catch (TableNotEnabledException e) {
                    LOG.info(tableName + " failed to disable as it was never enabled", e);
                }
                hBaseAdmin.deleteTable(tableName);
            }
        }
}
 
开发者ID:Parth-Brahmbhatt,项目名称:storm-smoke-test,代码行数:17,代码来源:CleanupUtils.java

示例7: deleteTable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
public static void deleteTable(HBaseTestingUtility testUtil, Admin admin, TableName tableName)
    throws Exception {
  // NOTE: We need a latch because admin is not sync,
  // so the postOp coprocessor method may be called after the admin operation returned.
  MasterSyncObserver observer = testUtil.getHBaseCluster().getMaster()
    .getMasterCoprocessorHost().findCoprocessor(MasterSyncObserver.class);
  observer.tableDeletionLatch = new CountDownLatch(1);
  try {
    admin.disableTable(tableName);
  } catch (TableNotEnabledException e) {
    LOG.debug("Table: " + tableName + " already disabled, so just deleting it.");
  }
  admin.deleteTable(tableName);
  observer.tableDeletionLatch.await();
  observer.tableDeletionLatch = null;
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:SecureTestUtil.java

示例8: checkOutputSpecs

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Checks if the output table exists and is enabled.
 *
 * @param context  The current context.
 * @throws IOException When the check fails.
 * @throws InterruptedException When the job is aborted.
 * @see OutputFormat#checkOutputSpecs(JobContext)
 */
@Override
public void checkOutputSpecs(JobContext context) throws IOException,
    InterruptedException {

  try (Admin admin = ConnectionFactory.createConnection(getConf()).getAdmin()) {
    TableName tableName = TableName.valueOf(this.conf.get(OUTPUT_TABLE));
    if (!admin.tableExists(tableName)) {
      throw new TableNotFoundException("Can't write, table does not exist:" +
          tableName.getNameAsString());
    }

    if (!admin.isTableEnabled(tableName)) {
      throw new TableNotEnabledException("Can't write, table is not enabled: " +
          tableName.getNameAsString());
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:TableOutputFormat.java

示例9: prepare

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
@Override
public void prepare(final boolean reload) throws IOException {
  // check table state if this is a retry
  if (reload && tableName != null && !tableName.equals(TableName.META_TABLE_NAME)
      && getConnection().isTableDisabled(tableName)) {
    throw new TableNotEnabledException(tableName.getNameAsString() + " is disabled.");
  }
  try (RegionLocator regionLocator = connection.getRegionLocator(tableName)) {
    this.location = regionLocator.getRegionLocation(row);
  }
  if (this.location == null) {
    throw new IOException("Failed to find location, tableName=" + tableName +
        ", row=" + Bytes.toString(row) + ", reload=" + reload);
  }
  setStubByServiceName(this.location.getServerName());
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:RegionServerCallable.java

示例10: createSnapshotAndValidate

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(HBaseAdmin admin,
    TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:28,代码来源:SnapshotTestingUtils.java

示例11: causeIsPleaseHold

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的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

示例12: prepareDisable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Action before any real action of disabling table. Set the exception in the procedure instead
 * of throwing it.  This approach is to deal with backward compatible with 1.0.
 * @param env MasterProcedureEnv
 * @throws HBaseException
 * @throws IOException
 */
private boolean prepareDisable(final MasterProcedureEnv env) throws HBaseException, IOException {
  boolean canTableBeDisabled = true;
  if (tableName.equals(TableName.META_TABLE_NAME)) {
    setFailure("master-disable-table", new ConstraintException("Cannot disable catalog table"));
    canTableBeDisabled = false;
  } else if (!MetaTableAccessor.tableExists(env.getMasterServices().getConnection(), tableName)) {
    setFailure("master-disable-table", new TableNotFoundException(tableName));
    canTableBeDisabled = false;
  } else if (!skipTableStateCheck) {
    // There could be multiple client requests trying to disable or enable
    // the table at the same time. Ensure only the first request is honored
    // After that, no other requests can be accepted until the table reaches
    // DISABLED or ENABLED.
    //
    // Note: A quick state check should be enough for us to move forward. However, instead of
    // calling TableStateManager.isTableState() to just check the state, we called
    // TableStateManager.setTableStateIfInStates() to set the state to DISABLING from ENABLED.
    // This is because we treat empty state as enabled from 0.92-clusters. See
    // ZKTableStateManager.setTableStateIfInStates() that has a hack solution to work around
    // this issue.
    TableStateManager tsm =
      env.getMasterServices().getAssignmentManager().getTableStateManager();
    if (!tsm.setTableStateIfInStates(tableName, ZooKeeperProtos.Table.State.DISABLING,
          ZooKeeperProtos.Table.State.DISABLING, ZooKeeperProtos.Table.State.ENABLED)) {
      LOG.info("Table " + tableName + " isn't enabled; skipping disable");
      setFailure("master-disable-table", new TableNotEnabledException(tableName));
      canTableBeDisabled = false;
    }
  }

  // We are done the check. Future actions in this procedure could be done asynchronously.
  ProcedurePrepareLatch.releaseLatch(syncLatch, this);

  return canTableBeDisabled;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:43,代码来源:DisableTableProcedure.java

示例13: testTableNotEnabledExceptionWithATable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
/**
 * Can't disable a table if the table isn't in enabled state
 * @throws IOException
 */
@Test (expected=TableNotEnabledException.class, timeout=300000)
public void testTableNotEnabledExceptionWithATable() throws IOException {
  final TableName name = TableName.valueOf("testTableNotEnabledExceptionWithATable");
  TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY).close();
  this.admin.disableTable(name);
  this.admin.disableTable(name);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestAdmin2.java

示例14: relocateRegion

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
@Override
public RegionLocations relocateRegion(final TableName tableName,
    final byte [] row, int replicaId) throws IOException{
  // Since this is an explicit request not to use any caching, finding
  // disabled tables should not be desirable.  This will ensure that an exception is thrown when
  // the first time a disabled table is interacted with.
  if (!tableName.equals(TableName.META_TABLE_NAME) && isTableDisabled(tableName)) {
    throw new TableNotEnabledException(tableName.getNameAsString() + " is disabled.");
  }

  return locateRegion(tableName, row, false, true, replicaId);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:ConnectionManager.java

示例15: DisableTableHandler

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
public DisableTableHandler(Server server, byte [] tableName,
    CatalogTracker catalogTracker, AssignmentManager assignmentManager,
    boolean skipTableStateCheck)
throws TableNotFoundException, TableNotEnabledException, IOException {
  super(server, EventType.C_M_DISABLE_TABLE);
  this.tableName = tableName;
  this.tableNameStr = Bytes.toString(this.tableName);
  this.assignmentManager = assignmentManager;
  // Check if table exists
  // TODO: do we want to keep this in-memory as well?  i guess this is
  //       part of old master rewrite, schema to zk to check for table
  //       existence and such
  if (!MetaReader.tableExists(catalogTracker, this.tableNameStr)) {
    throw new TableNotFoundException(this.tableNameStr);
  }

  // There could be multiple client requests trying to disable or enable
  // the table at the same time. Ensure only the first request is honored
  // After that, no other requests can be accepted until the table reaches
  // DISABLED or ENABLED.
  if (!skipTableStateCheck)
  {
    try {
      if (!this.assignmentManager.getZKTable().checkEnabledAndSetDisablingTable
        (this.tableNameStr)) {
        LOG.info("Table " + tableNameStr + " isn't enabled; skipping disable");
        throw new TableNotEnabledException(this.tableNameStr);
      }
    } catch (KeeperException e) {
      throw new IOException("Unable to ensure that the table will be" +
        " disabling because of a ZooKeeper issue", e);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:35,代码来源:DisableTableHandler.java


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