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


Java TableState.DISABLED属性代码示例

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


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

示例1: getDisabledTables

/**
 * Gets a list of all the tables set as disabled in zookeeper.
 * @return Set of disabled tables, empty Set if none
 * @throws KeeperException
 */
public static Set<String> getDisabledTables(ZooKeeperWatcher zkw)
throws KeeperException {
  Set<String> disabledTables = new HashSet<String>();
  List<String> children =
    ZKUtil.listChildrenNoWatch(zkw, zkw.clientTableZNode);
  for (String child: children) {
    TableState state = getTableState(zkw, child);
    if (state == TableState.DISABLED) disabledTables.add(child);
  }
  return disabledTables;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:ZKTableReadOnly.java

示例2: getDisabledOrDisablingTables

/**
 * Gets a list of all the tables set as disabled in zookeeper.
 * @return Set of disabled tables, empty Set if none
 * @throws KeeperException
 */
public static Set<String> getDisabledOrDisablingTables(ZooKeeperWatcher zkw)
throws KeeperException {
  Set<String> disabledTables = new HashSet<String>();
  List<String> children =
    ZKUtil.listChildrenNoWatch(zkw, zkw.clientTableZNode);
  for (String child: children) {
    TableState state = getTableState(zkw, child);
    if (state == TableState.DISABLED || state == TableState.DISABLING)
      disabledTables.add(child);
  }
  return disabledTables;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:ZKTableReadOnly.java

示例3: 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

示例4: 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.DISABLED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。