@InterfaceAudience.Private class NamespaceStateManager extends ZooKeeperListener
Modifier and Type | Field and Description |
---|---|
private boolean |
initialized |
private static org.apache.commons.logging.Log |
LOG |
private MasterServices |
master |
private ConcurrentMap<String,NamespaceTableAndRegionInfo> |
nsStateCache |
watcher
Constructor and Description |
---|
NamespaceStateManager(MasterServices masterServices,
ZooKeeperWatcher zkw) |
Modifier and Type | Method and Description |
---|---|
(package private) NamespaceTableAndRegionInfo |
addNamespace(String namespace) |
private void |
addTable(TableName tableName,
int regionCount) |
(package private) boolean |
checkAndUpdateNamespaceRegionCount(TableName name,
byte[] regionName,
int incr)
Check if adding a region violates namespace quota, if not update namespace cache.
|
(package private) void |
checkAndUpdateNamespaceRegionCount(TableName name,
int incr)
Check and update region count for an existing table.
|
(package private) void |
checkAndUpdateNamespaceTableCount(TableName table,
int numRegions) |
private void |
checkSplittingOrMergingNode(String path) |
(package private) void |
deleteNamespace(String namespace)
Delete the namespace state.
|
private NamespaceDescriptor |
getNamespaceDescriptor(String namespaceAsString) |
NamespaceTableAndRegionInfo |
getState(String name)
Gets an instance of NamespaceTableAndRegionInfo associated with namespace.
|
private void |
initialize()
Initialize namespace state cache by scanning meta table.
|
(package private) boolean |
isInitialized() |
void |
nodeChildrenChanged(String path)
Called when an existing node has a child node added or removed.
|
void |
nodeCreated(String path)
Called when a new node has been created.
|
void |
removeRegionFromTable(HRegionInfo hri) |
(package private) void |
removeTable(TableName tableName) |
void |
start()
Starts the NamespaceStateManager.
|
getWatcher, nodeDataChanged, nodeDeleted
private static final org.apache.commons.logging.Log LOG
private ConcurrentMap<String,NamespaceTableAndRegionInfo> nsStateCache
private MasterServices master
private volatile boolean initialized
public NamespaceStateManager(MasterServices masterServices, ZooKeeperWatcher zkw)
public void start() throws IOException
IOException
- Signals that an I/O exception has occurred.public NamespaceTableAndRegionInfo getState(String name)
The
- name of the namespaceboolean checkAndUpdateNamespaceRegionCount(TableName name, byte[] regionName, int incr) throws IOException
TableName
- regionName
- incr
- IOException
- Signals that an I/O exception has occurred.void checkAndUpdateNamespaceRegionCount(TableName name, int incr) throws IOException
TableName
- name of the table for region count needs to be checked and updatedincr
- count of regionsQuotaExceededException
- if quota exceeds for the number of regions allowed in a
namespaceIOException
- Signals that an I/O exception has occurred.private NamespaceDescriptor getNamespaceDescriptor(String namespaceAsString)
void checkAndUpdateNamespaceTableCount(TableName table, int numRegions) throws IOException
IOException
NamespaceTableAndRegionInfo addNamespace(String namespace)
void deleteNamespace(String namespace)
An
- instance of NamespaceTableAndRegionInfoprivate void addTable(TableName tableName, int regionCount) throws IOException
IOException
void removeTable(TableName tableName)
private void initialize() throws IOException
IOException
boolean isInitialized()
public void removeRegionFromTable(HRegionInfo hri) throws IOException
IOException
public void nodeCreated(String path)
ZooKeeperListener
nodeCreated
in class ZooKeeperListener
path
- full path of the new nodepublic void nodeChildrenChanged(String path)
ZooKeeperListener
nodeChildrenChanged
in class ZooKeeperListener
path
- full path of the node whose children have changedprivate void checkSplittingOrMergingNode(String path)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.