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


Java TableState类代码示例

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


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

示例1: loadDisabledTables

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * Load the list of disabled tables in ZK into local set.
 * @throws ZooKeeperConnectionException
 * @throws IOException
 */
private void loadDisabledTables()
throws ZooKeeperConnectionException, IOException {
  HConnectionManager.execute(new HConnectable<Void>(getConf()) {
    @Override
    public Void connect(HConnection connection) throws IOException {
      ZooKeeperWatcher zkw = connection.getZooKeeperWatcher();
      try {
        for (Entry<TableState, Set<String>> e : ZKTableReadOnly.getDisabledOrDisablingTables(zkw)
            .entrySet()) {
          for (String tableName : e.getValue()) {
            disabledTables.add(Bytes.toBytes(tableName));
          }
        }
      } catch (KeeperException ke) {
        throw new IOException(ke);
      }
      return null;
    }
  });
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:26,代码来源:HBaseFsck.java

示例2: isEnabledTable

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * 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,代码行数:15,代码来源:ZKTableReadOnly.java

示例3: getDisabledTables

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * 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,代码行数:17,代码来源:ZKTableReadOnly.java

示例4: getDisabledOrDisablingTables

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * 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,代码行数:18,代码来源:ZKTableReadOnly.java

示例5: getTableState

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * @deprecated Only for 0.92/0.94 compatibility.  Use getTableState(zkw, child) instead.
 */
static TableState getTableState(final ZooKeeperWatcher zkw,
  final String parent, final String child) throws KeeperException {
  String znode = ZKUtil.joinZNode(parent, child);
  byte [] data = ZKUtil.getData(zkw, znode);
  if (data == null || data.length <= 0) {
    return null;
  }
  String str = Bytes.toString(data);
  try {
    return TableState.valueOf(str);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(str);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:ZKTableReadOnly.java

示例6: runTest9294CompatibilityTest

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
private void runTest9294CompatibilityTest(String tableName, Configuration conf)
throws Exception {
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(conf,
    tableName, abortable, true);
  ZKTable zkt = new ZKTable(zkw);
  zkt.setEnabledTable(tableName);
  // check that current/0.94 format table has proper ENABLED format
  assertTrue(
    ZKTableReadOnly.getTableState(zkw, zkw.masterTableZNode,  tableName) == TableState.ENABLED);
  // check that 0.92 format table is null, as expected by 0.92.0/0.92.1 clients
  assertTrue(ZKTableReadOnly.getTableState(zkw, zkw.masterTableZNode92, tableName) == null);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestZKTable.java

示例7: testSSHWhenDisableTableInProgress

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
/**
 * To test closed region handler to remove rit and delete corresponding znode if region in pending
 * close or closing while processing shutdown of a region server.(HBASE-5927).
 * @throws KeeperException
 * @throws IOException
 */
@Test
public void testSSHWhenDisableTableInProgress()
    throws KeeperException, IOException {
  testCaseWithPartiallyDisabledState(TableState.DISABLING, false);
  testCaseWithPartiallyDisabledState(TableState.DISABLED, false);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestAssignmentManager.java

示例8: setTablesInZK

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
private void setTablesInZK() throws IOException {
  if (tablesToBeSetInZK != null && !tablesToBeSetInZK.isEmpty()) {
    for (Pair<String, TableState> p : tablesToBeSetInZK) {
      setStateInZK(p.getFirst(), p.getSecond());
    }
  }
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:8,代码来源:SecondaryIndexColocator.java

示例9: setStateInZK

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
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,代码行数:9,代码来源:SecondaryIndexColocator.java

示例10: isTableState

import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState; //导入依赖的package包/类
static boolean isTableState(final TableState expectedState,
  final TableState currentState) {
  return currentState != null && currentState.equals(expectedState);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:5,代码来源:ZKTableReadOnly.java


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