@InterfaceAudience.Private public class ZKTableStateManager extends Object implements TableStateManager
ZKTableStateClientSideReader instead.
To save on trips to the zookeeper ensemble, internally we cache table state.
| Constructor and Description |
|---|
ZKTableStateManager(ZooKeeperWatcher zkw) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkAndRemoveTableState(TableName tableName,
ZooKeeperProtos.Table.State states,
boolean deletePermanentState)
If the table is found in the given state the in-memory state is removed.
|
Set<TableName> |
getTablesInStates(ZooKeeperProtos.Table.State... states)
Gets a list of all the tables set as disabling in zookeeper.
|
boolean |
isTablePresent(TableName tableName)
check if table is present.
|
boolean |
isTableState(TableName tableName,
boolean checkSource,
ZooKeeperProtos.Table.State... states)
Checks if table is marked in specified state in ZK.
|
boolean |
isTableState(TableName tableName,
ZooKeeperProtos.Table.State... states)
Checks if table is marked in specified state in ZK (using cache only).
|
void |
setDeletedTable(TableName tableName)
Deletes the table in zookeeper.
|
void |
setTableState(TableName tableName,
ZooKeeperProtos.Table.State state)
Sets table state in ZK.
|
boolean |
setTableStateIfInStates(TableName tableName,
ZooKeeperProtos.Table.State newState,
ZooKeeperProtos.Table.State... states)
Checks and sets table state in ZK.
|
boolean |
setTableStateIfNotInStates(TableName tableName,
ZooKeeperProtos.Table.State newState,
ZooKeeperProtos.Table.State... states)
Checks and sets table state in ZK.
|
public ZKTableStateManager(ZooKeeperWatcher zkw) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void setTableState(TableName tableName, ZooKeeperProtos.Table.State state) throws CoordinatedStateException
setTableState in interface TableStateManagertableName - table to processstate - new state of this tableCoordinatedStateException - if error happened when trying to set table statepublic boolean setTableStateIfInStates(TableName tableName, ZooKeeperProtos.Table.State newState, ZooKeeperProtos.Table.State... states) throws CoordinatedStateException
setTableStateIfInStates in interface TableStateManagertableName - table to processnewState - new state for the tablestates - table should be in one of these states for the operation
to be performedCoordinatedStateException - if error happened while performing operationpublic boolean setTableStateIfNotInStates(TableName tableName, ZooKeeperProtos.Table.State newState, ZooKeeperProtos.Table.State... states) throws CoordinatedStateException
setTableStateIfNotInStates in interface TableStateManagertableName - table to processnewState - new state for the tablestates - table should NOT be in one of these states for the operation
to be performedCoordinatedStateException - if error happened while performing operationpublic boolean isTableState(TableName tableName, ZooKeeperProtos.Table.State... states)
isTableState in interface TableStateManagerpublic boolean isTableState(TableName tableName, boolean checkSource, ZooKeeperProtos.Table.State... states)
isTableState in interface TableStateManagerpublic void setDeletedTable(TableName tableName) throws CoordinatedStateException
setDeletedTable in interface TableStateManagertableName - table to be deletedCoordinatedStateException - if error happened while performing operationpublic boolean isTablePresent(TableName tableName)
isTablePresent in interface TableStateManagertableName - table we're working onpublic Set<TableName> getTablesInStates(ZooKeeperProtos.Table.State... states) throws InterruptedIOException, CoordinatedStateException
getTablesInStates in interface TableStateManagerCoordinatedStateException - if error happened in underlying coordination engineInterruptedIOExceptionpublic void checkAndRemoveTableState(TableName tableName, ZooKeeperProtos.Table.State states, boolean deletePermanentState) throws CoordinatedStateException
checkAndRemoveTableState in interface TableStateManagertableName - table we're working onstates - if table isn't in any one of these states, operation abortsdeletePermanentState - if true, reset the permanent flagCoordinatedStateException - if error happened in underlying coordination engineCopyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.