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


Java TableNotFoundException类代码示例

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


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

示例1: waitTableEnabled

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
private void waitTableEnabled(final long deadlineTs)
    throws IOException, TimeoutException {
  waitForState(deadlineTs, new WaitForStateCallable() {
    @Override
    public boolean checkState(int tries) throws IOException {
      boolean enabled;
      try {
        enabled = getAdmin().isTableEnabled(tableName);
      } catch (TableNotFoundException tnfe) {
        return false;
      }
      return enabled && getAdmin().isTableAvailable(tableName);
    }

    @Override
    public void throwInterruptedException() throws InterruptedIOException {
      throw new InterruptedIOException("Interrupted when waiting for table to be enabled");
    }

    @Override
    public void throwTimeoutException(long elapsedTime) throws TimeoutException {
      throw new TimeoutException("Table " + tableName + " not yet enabled after " +
          elapsedTime + "msec");
    }
  });
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:HBaseAdmin.java

示例2: sniff

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
private static List<Future<Void>> sniff(final Admin admin, final Sink sink,
    HTableDescriptor tableDesc, ExecutorService executor, TaskType taskType) throws Exception {
  Table table = null;
  try {
    table = admin.getConnection().getTable(tableDesc.getTableName());
  } catch (TableNotFoundException e) {
    return new ArrayList<Future<Void>>();
  }
  List<RegionTask> tasks = new ArrayList<RegionTask>();
  try {
    for (HRegionInfo region : admin.getTableRegions(tableDesc.getTableName())) {
      tasks.add(new RegionTask(admin.getConnection(), region, sink, taskType));
    }
  } finally {
    table.close();
  }
  return executor.invokeAll(tasks);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:Canary.java

示例3: recoverTableInEnablingState

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Recover the tables that are not fully moved to ENABLED state. These tables
 * are in ENABLING state when the master restarted/switched
 *
 * @throws KeeperException
 * @throws org.apache.hadoop.hbase.TableNotFoundException
 * @throws IOException
 */
private void recoverTableInEnablingState()
    throws KeeperException, IOException, CoordinatedStateException {
  Set<TableName> enablingTables = tableStateManager.
    getTablesInStates(ZooKeeperProtos.Table.State.ENABLING);
  if (enablingTables.size() != 0) {
    for (TableName tableName : enablingTables) {
      // Recover by calling EnableTableHandler
      LOG.info("The table " + tableName
          + " is in ENABLING state.  Hence recovering by moving the table"
          + " to ENABLED state.");
      // enableTable in sync way during master startup,
      // no need to invoke coprocessor
      EnableTableHandler eth = new EnableTableHandler(this.server, tableName,
        this, tableLockManager, true);
      try {
        eth.prepare();
      } catch (TableNotFoundException e) {
        LOG.warn("Table " + tableName + " not found in hbase:meta to recover.");
        continue;
      }
      eth.process();
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:AssignmentManager.java

示例4: testFlushSecondary

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
@Test
public void testFlushSecondary() throws Exception {
  openRegion(hriSecondary);
  try {
    flushRegion(hriSecondary);

    Put p = new Put(row);
    p.add(f, row, row);
    table.put(p);

    flushRegion(hriSecondary);
  } catch (TableNotFoundException expected) {
  } finally {
    Delete d = new Delete(row);
    table.delete(d);
    closeRegion(hriSecondary);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestReplicasClient.java

示例5: enableTable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Enable a table, if existed.
 *
 * @param tableName name of table to enable
 * @throws IOException-if a remote or network exception occurs
 */
public void enableTable(TableName tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(tableName);
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);
  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        admin.enableTable(indexSpec.getIndexTableName());
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }
  admin.enableTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:CCIndexAdmin.java

示例6: disableTable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Disable a table, if existed.
 *
 * @param tableName name of table to disable
 * @throws IOException-if a remote or network exception occurs
 */
public void disableTable(TableName tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(tableName);
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);

  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        admin.disableTable(indexSpec.getIndexTableName());
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }
  admin.disableTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:CCIndexAdmin.java

示例7: isTableEnabled

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * @param tableName name of table to check
 * @return true if table is enabled
 * @throws IOException-if a remote or network exception occurs
 */
public boolean isTableEnabled(TableName tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(tableName);
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);

  boolean isenable = admin.isTableEnabled(tableName);

  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        if (isenable && admin.isTableDisabled(indexSpec.getIndexTableName())) {
          admin.enableTable(indexSpec.getIndexTableName());
        } else if (!isenable && admin.isTableEnabled(indexSpec.getIndexTableName())) {
          admin.disableTable(indexSpec.getIndexTableName());
        }
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }

  return isenable;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:CCIndexAdmin.java

示例8: isTableAvailable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * @param tableName name of table to check
 * @return true if table and indexes are all available
 * @throws IOException-if a remote or network exception occurs
 */
public boolean isTableAvailable(TableName tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(tableName);
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);

  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        if (!admin.isTableAvailable(indexSpec.getIndexTableName())) {
          return false;
        }
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }

  if (!admin.isTableAvailable(tableName)) {
    return false;
  }
  return true;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:CCIndexAdmin.java

示例9: getTableDescriptor

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
static HTableDescriptor getTableDescriptor(final TableName tableName, HConnection connection,
    RpcRetryingCallerFactory rpcCallerFactory, final RpcControllerFactory rpcControllerFactory,
       int operationTimeout) throws TableNotFoundException, IOException {

    if (tableName == null) return null;
    HTableDescriptor htd = executeCallable(new MasterCallable<HTableDescriptor>(connection) {
      @Override
      public HTableDescriptor call(int callTimeout) throws ServiceException {
        PayloadCarryingRpcController controller = rpcControllerFactory.newController();
        controller.setCallTimeout(callTimeout);
        GetTableDescriptorsResponse htds;
        GetTableDescriptorsRequest req =
                RequestConverter.buildGetTableDescriptorsRequest(tableName);
        htds = master.getTableDescriptors(controller, req);

        if (!htds.getTableSchemaList().isEmpty()) {
          return HTableDescriptor.convert(htds.getTableSchemaList().get(0));
        }
        return null;
      }
    }, rpcCallerFactory, operationTimeout);
    if (htd != null) {
      return htd;
    }
    throw new TableNotFoundException(tableName.getNameAsString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:HBaseAdmin.java

示例10: getHTableDescriptor

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Connects to the master to get the table descriptor.
 * @param tableName table name
 * @throws IOException if the connection to master fails or if the table
 *  is not found.
 * @deprecated Use {@link Admin#getTableDescriptor(TableName)} instead
 */
@Deprecated
@Override
public HTableDescriptor getHTableDescriptor(final TableName tableName)
throws IOException {
  if (tableName == null) return null;
  MasterKeepAliveConnection master = getKeepAliveMasterService();
  GetTableDescriptorsResponse htds;
  try {
    GetTableDescriptorsRequest req =
      RequestConverter.buildGetTableDescriptorsRequest(tableName);
    htds = master.getTableDescriptors(null, req);
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  } finally {
    master.close();
  }
  if (!htds.getTableSchemaList().isEmpty()) {
    return HTableDescriptor.convert(htds.getTableSchemaList().get(0));
  }
  throw new TableNotFoundException(tableName.getNameAsString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:ConnectionManager.java

示例11: connectToTable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
private void connectToTable() {

		if (this.conf == null) {
			this.conf = HBaseConfiguration.create();
		}

		try {
			Connection conn = ConnectionFactory.createConnection(conf);
			super.table = (HTable) conn.getTable(TableName.valueOf(tableName));
		} catch (TableNotFoundException tnfe) {
			LOG.error("The table " + tableName + " not found ", tnfe);
			throw new RuntimeException("HBase table '" + tableName + "' not found.", tnfe);
		} catch (IOException ioe) {
			LOG.error("Exception while creating connection to HBase.", ioe);
			throw new RuntimeException("Cannot create connection to HBase.", ioe);
		}
	}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:HBaseRowInputFormat.java

示例12: getHTableDescriptor

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
public HTableDescriptor getHTableDescriptor(final byte[] tableName)
throws IOException {
  if (tableName == null || tableName.length == 0) return null;
  if (Bytes.equals(tableName, HConstants.ROOT_TABLE_NAME)) {
    return new UnmodifyableHTableDescriptor(HTableDescriptor.ROOT_TABLEDESC);
  }
  if (Bytes.equals(tableName, HConstants.META_TABLE_NAME)) {
    return HTableDescriptor.META_TABLEDESC;
  }
  List<String> tableNameList = new ArrayList<String>(1);
  tableNameList.add(Bytes.toString(tableName));
  HTableDescriptor[] htds = getHTableDescriptors(tableNameList);
  if (htds != null && htds.length > 0) {
    return htds[0];
  }
  throw new TableNotFoundException(Bytes.toString(tableName));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:HConnectionManager.java

示例13: recoverTableInDisablingState

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Recover the tables that were not fully moved to DISABLED state. These
 * tables are in DISABLING state when the master restarted/switched.
 * 
 * @param disablingTables
 * @return
 * @throws KeeperException
 * @throws TableNotFoundException
 * @throws IOException
 */
private boolean recoverTableInDisablingState(Set<String> disablingTables)
    throws KeeperException, TableNotFoundException, IOException {
  boolean isWatcherCreated = false;
  if (disablingTables.size() != 0) {
    // Create a watcher on the zookeeper node
    ZKUtil.listChildrenAndWatchForNewChildren(watcher,
        watcher.assignmentZNode);
    isWatcherCreated = true;
    for (String tableName : disablingTables) {
      // Recover by calling DisableTableHandler
      LOG.info("The table " + tableName
          + " is in DISABLING state.  Hence recovering by moving the table"
          + " to DISABLED state.");
      new DisableTableHandler(this.master, tableName.getBytes(),
          catalogTracker, this, true).process();
    }
  }
  return isWatcherCreated;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:30,代码来源:AssignmentManager.java

示例14: enableTable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Enable a table, if existed.
 * @param tableName name of table to enable
 * @throws IOException-if a remote or network exception occurs
 */
public void enableTable(byte[] tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(Bytes.toString(tableName));
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);

  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        admin.enableTable(indexSpec.getIndexTableName());
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }
  admin.enableTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:CCIndexAdmin.java

示例15: disableTable

import org.apache.hadoop.hbase.TableNotFoundException; //导入依赖的package包/类
/**
 * Disable a table, if existed.
 * @param tableName name of table to disable
 * @throws IOException-if a remote or network exception occurs
 */
public void disableTable(byte[] tableName) throws IOException {
  HTableDescriptor desc = admin.getTableDescriptor(tableName);
  if (isIndexTable(desc)) {
    throw new TableNotFoundException(Bytes.toString(tableName));
  }
  IndexTableDescriptor indexDesc = new IndexTableDescriptor(desc);

  if (indexDesc.hasIndex()) {
    for (IndexSpecification indexSpec : indexDesc.getIndexSpecifications()) {
      if (admin.tableExists(indexSpec.getIndexTableName())) {
        admin.disableTable(indexSpec.getIndexTableName());
      } else {
        throw new IndexMissingException(tableName, indexSpec);
      }
    }
  }
  admin.disableTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:24,代码来源:CCIndexAdmin.java


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