• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TableNotEnabledException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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)
public void testTableNotEnabledExceptionWithATable() throws IOException {
  final byte [] name = Bytes.toBytes(
    "testTableNotEnabledExceptionWithATable");
  TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY).close();
  this.admin.disableTable(name);
  this.admin.disableTable(name);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestAdmin.java


示例17: deleteTable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
private void deleteTable(String name) throws IOException {
    try {
        this.admin.disableTable(name);
    } catch(TableNotEnabledException ignored) {

    }
    this.admin.deleteTable(name);
}
 
开发者ID:notaql,项目名称:notaql,代码行数:9,代码来源:NotaQLCSVTest.java


示例18: disableTable

import org.apache.hadoop.hbase.TableNotEnabledException; //导入依赖的package包/类
@Override
public void disableTable(TableName tableName) throws IOException {
  TableName.isLegalFullyQualifiedTableName(tableName.getName());
  if (!this.tableExists(tableName)) {
    throw new TableNotFoundException(tableName);
  }
  if (this.isTableDisabled(tableName)) {
    throw new TableNotEnabledException(tableName);
  }
  disabledTables.add(tableName);
  LOG.warn("Table " + tableName + " was disabled in memory only.");
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:13,代码来源:BigtableAdmin.java


示例19: 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:grokcoder,项目名称:pbase,代码行数:13,代码来源:ConnectionManager.java


示例20: 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 byte [] name = Bytes.toBytes(
    "testTableNotEnabledExceptionWithATable");
  TEST_UTIL.createTable(name, HConstants.CATALOG_FAMILY).close();
  this.admin.disableTable(name);
  this.admin.disableTable(name);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:13,代码来源:TestAdmin.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnCompletionListener类代码示例发布时间:2022-05-21
下一篇:
Java OutputUtilities类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap