|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.regionserver.HRegionServer
public class HRegionServer
HRegionServer makes a set of HRegions available to clients. It checks in with the HMaster. There are many HRegionServers in a single HBase deployment.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.HConstants |
---|
HConstants.Modify |
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher |
---|
org.apache.zookeeper.Watcher.Event |
Field Summary | |
---|---|
protected boolean |
abortRequested
|
protected HBaseConfiguration |
conf
|
protected boolean |
fsOk
|
protected AtomicBoolean |
haveRootRegion
|
protected HLog |
hlog
|
protected boolean |
isOnline
|
protected ReentrantReadWriteLock |
lock
|
protected int |
numRegionsToReport
|
protected Map<Integer,HRegion> |
onlineRegions
|
protected AtomicBoolean |
quiesced
|
static String |
REGIONSERVER
region server process name |
protected AtomicBoolean |
safeMode
|
protected HServerInfo |
serverInfo
|
protected AtomicBoolean |
stopRequested
|
protected int |
threadWakeFrequency
|
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion |
---|
versionID |
Constructor Summary | |
---|---|
HRegionServer(HBaseConfiguration conf)
Starts a HRegionServer at the default location |
Method Summary | |
---|---|
void |
abort()
Cause the server to exit without closing the regions it is serving, the log it is using and without notifying the master. |
void |
addProcessingMessage(HRegionInfo hri)
Add a MSG_REPORT_PROCESS_OPEN to the outbound queue. |
protected long |
addRowLock(Integer r,
HRegion region)
|
protected long |
addScanner(InternalScanner s)
|
boolean |
checkAndPut(byte[] regionName,
byte[] row,
byte[] family,
byte[] qualifier,
byte[] value,
Put put)
Atomically checks if a row/family/qualifier value match the expectedValue. |
protected boolean |
checkFileSystem()
Checks to see if the file system is still accessible. |
boolean |
checkOOME(Throwable e)
Take actions on the event of an OutOfMemoryError. |
protected void |
checkOpen()
Called to verify that this server is up and running. |
void |
close(long scannerId)
Close a scanner |
protected void |
closeRegion(HRegionInfo hri,
boolean reportWhenCompleted)
|
HServerLoad.RegionLoad |
createRegionLoad(byte[] regionName)
|
void |
delete(byte[] regionName,
Delete delete)
Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete. |
int |
delete(byte[] regionName,
Delete[] deletes)
Put an array of deletes into the specified region |
protected static void |
doMain(String[] args,
Class<? extends HRegionServer> regionServerClass)
Do class main. |
protected void |
doMetrics()
|
boolean |
exists(byte[] regionName,
Get get)
Perform exists operation. |
Result |
get(byte[] regionName,
Get get)
Perform Get operation. |
Result |
getClosestRowBefore(byte[] regionName,
byte[] row,
byte[] family)
Return all the data for the row that matches row exactly, or the one that immediately preceeds it. |
HBaseConfiguration |
getConfiguration()
|
SortedMap<Long,HRegion> |
getCopyOfOnlineRegionsSortedBySize()
|
protected org.apache.hadoop.fs.FileSystem |
getFileSystem()
|
FlushRequester |
getFlushRequester()
|
long |
getGlobalMemStoreSize()
Return the total size of all memstores in every region. |
HServerInfo |
getHServerInfo()
Method used when a master is taking the place of another failed one. |
InfoServer |
getInfoServer()
|
protected Leases |
getLeases()
|
protected org.apache.hadoop.hbase.regionserver.LogRoller |
getLogRoller()
|
RegionServerMetrics |
getMetrics()
|
protected HRegionInfo[] |
getMostLoadedRegions()
Get the top N most loaded regions this server is serving so we can tell the master which regions it can reallocate if we're overloaded. |
HRegion |
getOnlineRegion(byte[] regionName)
|
Collection<HRegion> |
getOnlineRegions()
|
HRegion[] |
getOnlineRegionsAsArray()
|
protected LinkedBlockingQueue<HMsg> |
getOutboundMsgs()
|
long |
getProtocolVersion(String protocol,
long clientVersion)
|
protected HRegion |
getRegion(byte[] regionName)
Protected utility method for safely obtaining an HRegion handle. |
HRegionInfo |
getRegionInfo(byte[] regionName)
Get metainfo about an HRegion |
HRegionInfo[] |
getRegionsAssignment()
Method used when a master is taking the place of another failed one. |
protected Set<HRegion> |
getRegionsToCheck()
|
AtomicInteger |
getRequestCount()
|
protected org.apache.hadoop.fs.Path |
getRootDir()
|
SortedSet<HRegionInfo> |
getSortedOnlineRegionInfos()
|
ZooKeeperWrapper |
getZooKeeperWrapper()
|
long |
incrementColumnValue(byte[] regionName,
byte[] row,
byte[] family,
byte[] qualifier,
long amount,
boolean writeToWAL)
Atomically increments a column value. |
protected void |
init(org.apache.hadoop.io.MapWritable c)
|
protected HLog |
instantiateHLog(org.apache.hadoop.fs.Path logdir)
|
protected HRegion |
instantiateRegion(HRegionInfo regionInfo)
|
boolean |
isInSafeMode()
|
boolean |
isOnline()
Report the status of the server. |
boolean |
isStopRequested()
|
long |
lockRow(byte[] regionName,
byte[] row)
Opens a remote row lock. |
static void |
main(String[] args)
|
protected void |
metrics()
|
Result |
next(long scannerId)
Get the next set of values |
Result[] |
next(long scannerId,
int nbRows)
Get the next set of values |
long |
openScanner(byte[] regionName,
Scan scan)
Opens a remote scanner with a RowFilter. |
void |
process(org.apache.zookeeper.WatchedEvent event)
We register ourselves as a watcher on the master address ZNode. |
void |
put(byte[] regionName,
Put put)
Put data into the specified region |
int |
put(byte[] regionName,
Put[] puts)
Put an array of puts into the specified region |
void |
run()
The HRegionServer sticks in this loop until closed. |
void |
runThread(Thread t,
long dfsShutdownWait)
Run and wait on passed thread in HRS context. |
Thread |
setHDFSShutdownThreadOnExit(Thread t)
Set the hdfs shutdown thread to run on exit. |
void |
stop()
Sets a flag that will cause all the HRegionServer threads to shut down in an orderly fashion. |
void |
unlockRow(byte[] regionName,
long lockId)
Releases a remote row lock. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final AtomicBoolean stopRequested
protected final AtomicBoolean quiesced
protected final AtomicBoolean safeMode
protected volatile boolean abortRequested
protected volatile boolean fsOk
protected HServerInfo serverInfo
protected final HBaseConfiguration conf
protected final AtomicBoolean haveRootRegion
protected final Map<Integer,HRegion> onlineRegions
protected final ReentrantReadWriteLock lock
protected final int threadWakeFrequency
protected final int numRegionsToReport
public static final String REGIONSERVER
protected volatile HLog hlog
protected volatile boolean isOnline
Constructor Detail |
---|
public HRegionServer(HBaseConfiguration conf) throws IOException
conf
-
IOException
Method Detail |
---|
public void process(org.apache.zookeeper.WatchedEvent event)
process
in interface org.apache.zookeeper.Watcher
event
- WatchedEvent from ZooKeeper.public ZooKeeperWrapper getZooKeeperWrapper()
public void run()
run
in interface Runnable
public void runThread(Thread t, long dfsShutdownWait)
t
- dfsShutdownWait
- public Thread setHDFSShutdownThreadOnExit(Thread t)
t
- Thread to run. Pass null to disable tests.
protected void init(org.apache.hadoop.io.MapWritable c) throws IOException
IOException
public HServerLoad.RegionLoad createRegionLoad(byte[] regionName)
regionName
-
IOException
public boolean checkOOME(Throwable e)
HBaseRPCErrorHandler
checkOOME
in interface HBaseRPCErrorHandler
e
- the throwable
protected boolean checkFileSystem()
public boolean isOnline()
protected HLog instantiateHLog(org.apache.hadoop.fs.Path logdir) throws IOException
IOException
protected org.apache.hadoop.hbase.regionserver.LogRoller getLogRoller()
protected void doMetrics()
protected void metrics()
public RegionServerMetrics getMetrics()
public void stop()
public void abort()
protected HRegion instantiateRegion(HRegionInfo regionInfo) throws IOException
IOException
public void addProcessingMessage(HRegionInfo hri)
hri
- Region to add the message forprotected void closeRegion(HRegionInfo hri, boolean reportWhenCompleted) throws IOException
IOException
public HRegionInfo getRegionInfo(byte[] regionName) throws NotServingRegionException
HRegionInterface
getRegionInfo
in interface HRegionInterface
regionName
- name of the region
NotServingRegionException
public Result getClosestRowBefore(byte[] regionName, byte[] row, byte[] family) throws IOException
HRegionInterface
getClosestRowBefore
in interface HRegionInterface
regionName
- region namerow
- row keyfamily
- Column family to look for row in.
IOException
public Result get(byte[] regionName, Get get) throws IOException
get
in interface HRegionInterface
regionName
- name of region to get fromget
- Get operation
IOException
public boolean exists(byte[] regionName, Get get) throws IOException
HRegionInterface
exists
in interface HRegionInterface
regionName
- name of region to get fromget
- Get operation describing cell to test
IOException
public void put(byte[] regionName, Put put) throws IOException
HRegionInterface
put
in interface HRegionInterface
put
- the data to be put
IOException
public int put(byte[] regionName, Put[] puts) throws IOException
HRegionInterface
put
in interface HRegionInterface
IOException
public boolean checkAndPut(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException
HRegionInterface
checkAndPut
in interface HRegionInterface
regionName
- row
- family
- qualifier
- value
- the expected valueput
-
IOException
public long openScanner(byte[] regionName, Scan scan) throws IOException
HRegionInterface
openScanner
in interface HRegionInterface
regionName
- name of region to scanscan
- configured scan object
IOException
protected long addScanner(InternalScanner s) throws Leases.LeaseStillHeldException
Leases.LeaseStillHeldException
public Result next(long scannerId) throws IOException
HRegionInterface
next
in interface HRegionInterface
scannerId
- clientId passed to openScanner
IOException
public Result[] next(long scannerId, int nbRows) throws IOException
HRegionInterface
next
in interface HRegionInterface
scannerId
- clientId passed to openScannernbRows
- the number of rows to fetch
IOException
public void close(long scannerId) throws IOException
HRegionInterface
close
in interface HRegionInterface
scannerId
- the scanner id returned by openScanner
IOException
public void delete(byte[] regionName, Delete delete) throws IOException
HRegionInterface
delete
in interface HRegionInterface
IOException
public int delete(byte[] regionName, Delete[] deletes) throws IOException
HRegionInterface
delete
in interface HRegionInterface
IOException
public long lockRow(byte[] regionName, byte[] row) throws IOException
HRegionInterface
lockRow
in interface HRegionInterface
regionName
- name of regionrow
- row to lock
IOException
protected long addRowLock(Integer r, HRegion region) throws Leases.LeaseStillHeldException
Leases.LeaseStillHeldException
public void unlockRow(byte[] regionName, long lockId) throws IOException
HRegionInterface
unlockRow
in interface HRegionInterface
lockId
- the lock id returned by lockRow
IOException
public InfoServer getInfoServer()
public boolean isStopRequested()
public boolean isInSafeMode()
public HBaseConfiguration getConfiguration()
public Collection<HRegion> getOnlineRegions()
public HRegion[] getOnlineRegionsAsArray()
getOnlineRegionsAsArray
in interface HRegionInterface
public SortedSet<HRegionInfo> getSortedOnlineRegionInfos()
public SortedMap<Long,HRegion> getCopyOfOnlineRegionsSortedBySize()
public HRegion getOnlineRegion(byte[] regionName)
regionName
-
regionName
or null if named
region is not member of the online regions.public AtomicInteger getRequestCount()
public FlushRequester getFlushRequester()
protected HRegion getRegion(byte[] regionName) throws NotServingRegionException
regionName
- Name of online HRegion
to return
HRegion
for regionName
NotServingRegionException
protected HRegionInfo[] getMostLoadedRegions()
protected void checkOpen() throws IOException
IOException
protected Set<HRegion> getRegionsToCheck()
public long getProtocolVersion(String protocol, long clientVersion) throws IOException
getProtocolVersion
in interface org.apache.hadoop.ipc.VersionedProtocol
IOException
protected LinkedBlockingQueue<HMsg> getOutboundMsgs()
public long getGlobalMemStoreSize()
protected Leases getLeases()
protected org.apache.hadoop.fs.Path getRootDir()
protected org.apache.hadoop.fs.FileSystem getFileSystem()
protected static void doMain(String[] args, Class<? extends HRegionServer> regionServerClass)
args
- regionServerClass
- HRegionServer to instantiate.public long incrementColumnValue(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL) throws IOException
incrementColumnValue
in interface HRegionInterface
writeToWAL
- whether to write the increment to the WAL
IOException
public HRegionInfo[] getRegionsAssignment() throws IOException
getRegionsAssignment
in interface HRegionInterface
IOException
public HServerInfo getHServerInfo() throws IOException
getHServerInfo
in interface HRegionInterface
IOException
public static void main(String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |