|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.zookeeper.ZooKeeperListener
org.apache.hadoop.hbase.master.AssignmentManager
public class AssignmentManager
Manages and performs region assignment.
Monitors ZooKeeper for events related to regions in transition.
Handles existing regions in transition during master failover.
Nested Class Summary | |
---|---|
static class |
AssignmentManager.RegionState
State of a Region while undergoing transitions. |
class |
AssignmentManager.TimeoutMonitor
Monitor to check for time outs on region transition operations |
Field Summary | |
---|---|
protected Server |
master
|
Fields inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener |
---|
watcher |
Constructor Summary | |
---|---|
AssignmentManager(Server master,
ServerManager serverManager,
CatalogTracker catalogTracker,
ExecutorService service)
Constructs a new assignment manager. |
Method Summary | |
---|---|
void |
assign(HRegionInfo region,
boolean setOfflineInZK)
Assigns the specified region. |
void |
assign(HRegionInfo region,
boolean setOfflineInZK,
boolean forceNewPlan)
|
void |
assignAllUserRegions()
Assigns all user regions, if any. |
void |
assignMeta()
Assigns the META region. |
void |
assignRoot()
Assigns the ROOT region. |
void |
clearRegionFromTransition(HRegionInfo hri)
Clears the specified region from being in transition. |
NavigableMap<String,AssignmentManager.RegionState> |
getRegionsInTransition()
|
List<HRegionInfo> |
getRegionsOfTable(byte[] tableName)
Gets the online regions of the specified table. |
ZKTable |
getZKTable()
|
void |
handleSplitReport(HServerInfo hsi,
HRegionInfo parent,
HRegionInfo a,
HRegionInfo b)
Update inmemory structures. |
AssignmentManager.RegionState |
isRegionInTransition(HRegionInfo hri)
|
boolean |
isRegionsInTransition()
|
boolean |
isServerOnline(String serverName)
Check whether the RegionServer is online. |
void |
nodeChildrenChanged(String path)
New unassigned node has been created. |
void |
nodeCreated(String path)
New unassigned node has been created. |
void |
nodeDataChanged(String path)
Existing unassigned node has had data changed. |
void |
offlineDisabledRegion(HRegionInfo regionInfo)
|
List<AssignmentManager.RegionState> |
processServerShutdown(HServerInfo hsi)
Process shutdown server removing any assignments. |
void |
regionOffline(HRegionInfo regionInfo)
Marks the region as offline. |
void |
regionOnline(HRegionInfo regionInfo,
HServerInfo serverInfo)
Marks the region as online. |
void |
setOffline(HRegionInfo regionInfo)
Sets the region as offline by removing in-memory assignment information but retaining transition information. |
void |
stop()
|
void |
unassign(HRegionInfo region)
Unassigns the specified region. |
void |
unassign(HRegionInfo region,
boolean force)
Unassigns the specified region. |
void |
waitForAssignment(HRegionInfo regionInfo)
Waits until the specified region has completed assignment. |
void |
waitOnRegionToClearRegionsInTransition(HRegionInfo hri)
Wait on region to clear regions-in-transition. |
Methods inherited from class org.apache.hadoop.hbase.zookeeper.ZooKeeperListener |
---|
nodeDeleted |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Server master
Constructor Detail |
---|
public AssignmentManager(Server master, ServerManager serverManager, CatalogTracker catalogTracker, ExecutorService service) throws org.apache.zookeeper.KeeperException
master
- serverManager
- catalogTracker
- service
-
org.apache.zookeeper.KeeperException
Method Detail |
---|
public ZKTable getZKTable()
public void nodeCreated(String path)
This happens when an RS begins the OPENING or CLOSING of a region by creating an unassigned node.
When this happens we must:
nodeCreated
in class ZooKeeperListener
path
- full path of the new nodepublic void nodeDataChanged(String path)
This happens when an RS transitions from OFFLINE to OPENING, or between OPENING/OPENED and CLOSING/CLOSED.
When this happens we must:
nodeDataChanged
in class ZooKeeperListener
path
- full path of the updated nodepublic void nodeChildrenChanged(String path)
This happens when an RS begins the OPENING or CLOSING of a region by creating an unassigned node.
When this happens we must:
nodeChildrenChanged
in class ZooKeeperListener
path
- full path of the node whose children have changedpublic void regionOnline(HRegionInfo regionInfo, HServerInfo serverInfo)
Used when a region has been successfully opened on a region server.
regionInfo
- serverInfo
- public void regionOffline(HRegionInfo regionInfo)
Used when a region has been closed and should remain closed.
regionInfo
- public void setOffline(HRegionInfo regionInfo)
Used when a region has been closed but should be reassigned.
regionInfo
- public void offlineDisabledRegion(HRegionInfo regionInfo)
public void assign(HRegionInfo region, boolean setOfflineInZK)
If a RegionPlan is available with a valid destination then it will be used to determine what server region is assigned to. If no RegionPlan is available, region will be assigned to a random available server.
Updates the RegionState and sends the OPEN RPC.
This will only succeed if the region is in transition and in a CLOSED or OFFLINE state or not in transition (in-memory not zk), and of course, the chosen server is up and running (It may have just crashed!). If the in-memory checks pass, the zk node is forced to OFFLINE before assigning.
region
- server to be assignedsetOfflineInZK
- whether ZK node should be created/transitioned to an
OFFLINE state before assigning the regionpublic void assign(HRegionInfo region, boolean setOfflineInZK, boolean forceNewPlan)
public void unassign(HRegionInfo region)
Updates the RegionState and sends the CLOSE RPC.
If a RegionPlan is already set, it will remain.
region
- server to be unassignedpublic void unassign(HRegionInfo region, boolean force)
Updates the RegionState and sends the CLOSE RPC.
If a RegionPlan is already set, it will remain.
region
- server to be unassignedforce
- if region should be closed even if already closingpublic void waitForAssignment(HRegionInfo regionInfo) throws InterruptedException
If the region is already assigned, returns immediately. Otherwise, method blocks until the region is assigned.
regionInfo
- region to wait on assignment for
InterruptedException
public void assignRoot() throws org.apache.zookeeper.KeeperException
Assumes that ROOT is currently closed and is not being actively served by any RegionServer.
Forcibly unsets the current root region location in ZooKeeper and assigns ROOT to a random RegionServer.
org.apache.zookeeper.KeeperException
public void assignMeta()
Assumes that META is currently closed and is not being actively served by any RegionServer.
Forcibly assigns META to a random RegionServer.
public void assignAllUserRegions() throws IOException, InterruptedException
This is a synchronous call and will return once every region has been assigned. If anything fails, an exception is thrown and the cluster should be shutdown.
InterruptedException
IOException
public NavigableMap<String,AssignmentManager.RegionState> getRegionsInTransition()
public boolean isRegionsInTransition()
public AssignmentManager.RegionState isRegionInTransition(HRegionInfo hri)
hri
- Region to check.
public void clearRegionFromTransition(HRegionInfo hri)
Used only by HBCK tool.
hri
- public void waitOnRegionToClearRegionsInTransition(HRegionInfo hri) throws IOException
hri
- Region to wait on.
IOException
public List<HRegionInfo> getRegionsOfTable(byte[] tableName)
.META.
.
Only returns online regions. If a region on this table has been
closed during a disable, etc., it will be included in the returned list.
So, the returned list may not necessarily be ALL regions in this table, its
all the ONLINE regions in the table.
tableName
-
tableName
public List<AssignmentManager.RegionState> processServerShutdown(HServerInfo hsi)
hsi
- Server that went down.
public void handleSplitReport(HServerInfo hsi, HRegionInfo parent, HRegionInfo a, HRegionInfo b)
hsi
- Server that reported the splitparent
- Parent region that was splita
- Daughter region Ab
- Daughter region Bpublic void stop()
public boolean isServerOnline(String serverName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |