本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
}