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


Java TableState.ENABLED属性代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.zookeeper.ZKTable.TableState.ENABLED属性的典型用法代码示例。如果您正苦于以下问题:Java TableState.ENABLED属性的具体用法?Java TableState.ENABLED怎么用?Java TableState.ENABLED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hbase.zookeeper.ZKTable.TableState的用法示例。


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

示例1: isEnabledTable

/**
 * Go to zookeeper and see if state of table is {@link TableState#ENABLED}.
 * @param zkw
 * @param tableName
 * @return True if table is enabled.
 * @throws KeeperException
 */
public static boolean isEnabledTable(final ZooKeeperWatcher zkw,
    final String tableName) throws KeeperException {
  TableState state = getTableState(zkw, tableName);
  // If a table is ENABLED then we are removing table state znode in 0.92
  // but in 0.94 we keep it in ENABLED state.
  return state == null || state == TableState.ENABLED;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:ZKTableReadOnly.java

示例2: setStateInZK

private void setStateInZK(String tableName, TableState state) throws IOException {
  if (state == TableState.ENABLED) {
    admin.setEnableTable(tableName);
  }
  if (state == TableState.DISABLED) {
    admin.setDisableTable(tableName);
  }
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:8,代码来源:SecondaryIndexColocator.java

示例3: checkDisabledAndEnabledTables

private void checkDisabledAndEnabledTables() throws IOException, KeeperException {
  if (disabledandDisablingTables != null && !disabledandDisablingTables.isEmpty()) {
    Map<byte[], TableState> disabledHere =
        new TreeMap<byte[], TableState>(Bytes.BYTES_COMPARATOR);
    Iterator<Entry<byte[], TableState>> itr = disabledandDisablingTables.entrySet().iterator();
    while (itr.hasNext()) {
      Entry<byte[], TableState> tableEntry = itr.next();
      if (!IndexUtils.isIndexTable(tableEntry.getKey())) {
        byte[] indexTableName = Bytes.toBytes(IndexUtils.getIndexTableName(tableEntry.getKey()));
        if (null == tableMap.get(Bytes.toString(indexTableName))) {
          continue;
        }
        boolean present = disabledandDisablingTables.containsKey(indexTableName);
        if (!present && (enabledOrEnablingTables.get(indexTableName) == TableState.ENABLED)) {
          // TODO How to handle ENABLING state(if it could happen). If try to disable ENABLING
          // table
          // it throws.
          if (LOG.isDebugEnabled()) {
            LOG.debug("Table " + Bytes.toString(tableEntry.getKey())
                + " is disabled but corresponding index table is " + "enabled. So disabling "
                + Bytes.toString(indexTableName));
          }
          this.admin.disableTable(indexTableName);
          disabledHere.put(indexTableName, TableState.DISABLED);
        }
      } else {
        if (tableEntry.getValue() != TableState.DISABLED) {
          continue;
        }
        byte[] userTableName =
            Bytes.toBytes(IndexUtils.getActualTableNameFromIndexTableName(Bytes
                .toString(tableEntry.getKey())));
        if (!disabledandDisablingTables.containsKey(userTableName)) {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Index Table " + Bytes.toString(tableEntry.getKey())
                + " is disabled but corresponding user table is enabled. So Enabling "
                + Bytes.toString(tableEntry.getKey()));
          }
          // Here we are not enabling the table. We will do it in the next step
          // checkMetaInfoCosistency().
          // Because if we do here, META will be updated and our in-memory map will have old
          // entries.
          // So it will surely cause unnecessary unassignments and assignments in the next step.
          // In the next
          // step anyway we are moving regions. So no problem doing it there.
          // this.admin.enableTable(tableName);
          itr.remove();
        }
      }
    }
    disabledandDisablingTables.putAll(disabledHere);
  }
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:53,代码来源:SecondaryIndexColocator.java


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