org.apache.hadoop.hbase.ipc
Interface HRegionInterface

All Superinterfaces:
Abortable, HBaseRPCProtocolVersion, Stoppable, org.apache.hadoop.ipc.VersionedProtocol
All Known Implementing Classes:
HRegionServer

public interface HRegionInterface
extends HBaseRPCProtocolVersion, Stoppable, Abortable

Clients interact with HRegionServers using a handle to the HRegionInterface.

NOTE: if you change the interface, you must change the RPC version number in HBaseRPCProtocolVersion


Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion
versionID
 
Method Summary
 void bulkLoadHFile(String hfilePath, byte[] regionName, byte[] familyName)
          Bulk load an HFile into an open region
 boolean checkAndDelete(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete)
          Atomically checks if a row/family/qualifier value match the expectedValue.
 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.
 void close(long scannerId)
          Close a scanner
 boolean closeRegion(HRegionInfo region)
          Closes the specified region.
 boolean closeRegion(HRegionInfo region, boolean zk)
          Closes the specified region and will use or not use ZK during the close according to the specified flag.
 void compactRegion(HRegionInfo regionInfo, boolean major)
          Compacts the specified region.
 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, List<Delete> deletes)
          Put an array of deletes into the specified region
 boolean exists(byte[] regionName, Get get)
          Perform exists operation.
 void flushRegion(HRegionInfo regionInfo)
          Flushes the MemStore of the specified region.
 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.
 HServerInfo getHServerInfo()
          Method used when a master is taking the place of another failed one.
 List<HRegionInfo> getOnlineRegions()
           
 HRegionInfo getRegionInfo(byte[] regionName)
          Get metainfo about an HRegion
 Result increment(byte[] regionName, Increment increment)
          Increments one or more columns values in a row.
 long incrementColumnValue(byte[] regionName, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL)
          Atomically increments a column value.
 long lockRow(byte[] regionName, byte[] row)
          Opens a remote row lock.
 MultiResponse multi(MultiAction multi)
          Method used for doing multiple actions(Deletes, Gets and Puts) in one call
 MultiPutResponse multiPut(MultiPut puts)
          Multi put for putting multiple regions worth of puts at once.
 Result next(long scannerId)
          Get the next set of values
 Result[] next(long scannerId, int numberOfRows)
          Get the next set of values
 void openRegion(HRegionInfo region)
          Opens the specified region.
 void openRegions(List<HRegionInfo> regions)
          Opens the specified regions.
 long openScanner(byte[] regionName, Scan scan)
          Opens a remote scanner with a RowFilter.
 int put(byte[] regionName, List<Put> puts)
          Put an array of puts into the specified region
 void put(byte[] regionName, Put put)
          Put data into the specified region
 void replicateLogEntries(HLog.Entry[] entries)
          Replicates the given entries.
 void splitRegion(HRegionInfo regionInfo)
          Splits the specified region.
 void splitRegion(HRegionInfo regionInfo, byte[] splitPoint)
          Splits the specified region.
 void unlockRow(byte[] regionName, long lockId)
          Releases a remote row lock.
 
Methods inherited from interface org.apache.hadoop.ipc.VersionedProtocol
getProtocolVersion
 
Methods inherited from interface org.apache.hadoop.hbase.Stoppable
isStopped, stop
 
Methods inherited from interface org.apache.hadoop.hbase.Abortable
abort
 

Method Detail

getRegionInfo

HRegionInfo getRegionInfo(byte[] regionName)
                          throws NotServingRegionException,
                                 ConnectException,
                                 IOException
Get metainfo about an HRegion

Parameters:
regionName - name of the region
Returns:
HRegionInfo object for region
Throws:
NotServingRegionException
ConnectException
IOException - This can manifest as an Hadoop ipc RemoteException

getClosestRowBefore

Result getClosestRowBefore(byte[] regionName,
                           byte[] row,
                           byte[] family)
                           throws IOException
Return all the data for the row that matches row exactly, or the one that immediately preceeds it.

Parameters:
regionName - region name
row - row key
family - Column family to look for row in.
Returns:
map of values
Throws:
IOException - e

get

Result get(byte[] regionName,
           Get get)
           throws IOException
Perform Get operation.

Parameters:
regionName - name of region to get from
get - Get operation
Returns:
Result
Throws:
IOException - e

exists

boolean exists(byte[] regionName,
               Get get)
               throws IOException
Perform exists operation.

Parameters:
regionName - name of region to get from
get - Get operation describing cell to test
Returns:
true if exists
Throws:
IOException - e

put

void put(byte[] regionName,
         Put put)
         throws IOException
Put data into the specified region

Parameters:
regionName - region name
put - the data to be put
Throws:
IOException - e

put

int put(byte[] regionName,
        List<Put> puts)
        throws IOException
Put an array of puts into the specified region

Parameters:
regionName - region name
puts - List of puts to execute
Returns:
The number of processed put's. Returns -1 if all Puts processed successfully.
Throws:
IOException - e

delete

void delete(byte[] regionName,
            Delete delete)
            throws IOException
Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete. In case of a delete with a specific ts it only deletes that specific KeyValue.

Parameters:
regionName - region name
delete - delete object
Throws:
IOException - e

delete

int delete(byte[] regionName,
           List<Delete> deletes)
           throws IOException
Put an array of deletes into the specified region

Parameters:
regionName - region name
deletes - delete List to execute
Returns:
The number of processed deletes. Returns -1 if all Deletes processed successfully.
Throws:
IOException - e

checkAndPut

boolean checkAndPut(byte[] regionName,
                    byte[] row,
                    byte[] family,
                    byte[] qualifier,
                    byte[] value,
                    Put put)
                    throws IOException
Atomically checks if a row/family/qualifier value match the expectedValue. If it does, it adds the put. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
value - the expected value
put - data to put if check succeeds
Returns:
true if the new put was execute, false otherwise
Throws:
IOException - e

checkAndDelete

boolean checkAndDelete(byte[] regionName,
                       byte[] row,
                       byte[] family,
                       byte[] qualifier,
                       byte[] value,
                       Delete delete)
                       throws IOException
Atomically checks if a row/family/qualifier value match the expectedValue. If it does, it adds the delete. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
value - the expected value
delete - data to delete if check succeeds
Returns:
true if the new delete was execute, false otherwise
Throws:
IOException - e

incrementColumnValue

long incrementColumnValue(byte[] regionName,
                          byte[] row,
                          byte[] family,
                          byte[] qualifier,
                          long amount,
                          boolean writeToWAL)
                          throws IOException
Atomically increments a column value. If the column value isn't long-like, this could throw an exception. If passed expected value is null, then the check is for non-existance of the row/column.

Parameters:
regionName - region name
row - row to check
family - column family
qualifier - column qualifier
amount - long amount to increment
writeToWAL - whether to write the increment to the WAL
Returns:
new incremented column value
Throws:
IOException - e

increment

Result increment(byte[] regionName,
                 Increment increment)
                 throws IOException
Increments one or more columns values in a row. Returns the updated keys after the increment.

This operation does not appear atomic to readers. Increments are done under a row lock but readers do not take row locks.

Parameters:
regionName - region name
increment - increment operation
Returns:
incremented cells
Throws:
IOException

openScanner

long openScanner(byte[] regionName,
                 Scan scan)
                 throws IOException
Opens a remote scanner with a RowFilter.

Parameters:
regionName - name of region to scan
scan - configured scan object
Returns:
scannerId scanner identifier used in other calls
Throws:
IOException - e

next

Result next(long scannerId)
            throws IOException
Get the next set of values

Parameters:
scannerId - clientId passed to openScanner
Returns:
map of values; returns null if no results.
Throws:
IOException - e

next

Result[] next(long scannerId,
              int numberOfRows)
              throws IOException
Get the next set of values

Parameters:
scannerId - clientId passed to openScanner
numberOfRows - the number of rows to fetch
Returns:
Array of Results (map of values); array is empty if done with this region and null if we are NOT to go to the next region (happens when a filter rules that the scan is done).
Throws:
IOException - e

close

void close(long scannerId)
           throws IOException
Close a scanner

Parameters:
scannerId - the scanner id returned by openScanner
Throws:
IOException - e

lockRow

long lockRow(byte[] regionName,
             byte[] row)
             throws IOException
Opens a remote row lock.

Parameters:
regionName - name of region
row - row to lock
Returns:
lockId lock identifier
Throws:
IOException - e

unlockRow

void unlockRow(byte[] regionName,
               long lockId)
               throws IOException
Releases a remote row lock.

Parameters:
regionName - region name
lockId - the lock id returned by lockRow
Throws:
IOException - e

getOnlineRegions

List<HRegionInfo> getOnlineRegions()
Returns:
All regions online on this region server
Throws:
IOException - e

getHServerInfo

HServerInfo getHServerInfo()
                           throws IOException
Method used when a master is taking the place of another failed one.

Returns:
The HSI
Throws:
IOException - e

multi

MultiResponse multi(MultiAction multi)
                    throws IOException
Method used for doing multiple actions(Deletes, Gets and Puts) in one call

Parameters:
multi -
Returns:
MultiResult
Throws:
IOException

multiPut

MultiPutResponse multiPut(MultiPut puts)
                          throws IOException
Multi put for putting multiple regions worth of puts at once.

Parameters:
puts - the request
Returns:
the reply
Throws:
IOException - e

bulkLoadHFile

void bulkLoadHFile(String hfilePath,
                   byte[] regionName,
                   byte[] familyName)
                   throws IOException
Bulk load an HFile into an open region

Throws:
IOException

openRegion

void openRegion(HRegionInfo region)
                throws IOException
Opens the specified region.

Parameters:
region - region to open
Throws:
IOException

openRegions

void openRegions(List<HRegionInfo> regions)
                 throws IOException
Opens the specified regions.

Parameters:
regions - regions to open
Throws:
IOException

closeRegion

boolean closeRegion(HRegionInfo region)
                    throws IOException
Closes the specified region.

Parameters:
region - region to close
Returns:
true if closing region, false if not
Throws:
IOException

closeRegion

boolean closeRegion(HRegionInfo region,
                    boolean zk)
                    throws IOException
Closes the specified region and will use or not use ZK during the close according to the specified flag.

Parameters:
region - region to close
zk - true if transitions should be done in ZK, false if not
Returns:
true if closing region, false if not
Throws:
IOException

flushRegion

void flushRegion(HRegionInfo regionInfo)
                 throws NotServingRegionException,
                        IOException
Flushes the MemStore of the specified region.

This method is synchronous.

Parameters:
regionInfo - region to flush
Throws:
NotServingRegionException
IOException

splitRegion

void splitRegion(HRegionInfo regionInfo)
                 throws NotServingRegionException,
                        IOException
Splits the specified region.

This method currently flushes the region and then forces a compaction which will then trigger a split. The flush is done synchronously but the compaction is asynchronous.

Parameters:
regionInfo - region to split
Throws:
NotServingRegionException
IOException

splitRegion

void splitRegion(HRegionInfo regionInfo,
                 byte[] splitPoint)
                 throws NotServingRegionException,
                        IOException
Splits the specified region.

This method currently flushes the region and then forces a compaction which will then trigger a split. The flush is done synchronously but the compaction is asynchronous.

Parameters:
regionInfo - region to split
splitPoint - the explicit row to split on
Throws:
NotServingRegionException
IOException

compactRegion

void compactRegion(HRegionInfo regionInfo,
                   boolean major)
                   throws NotServingRegionException,
                          IOException
Compacts the specified region. Performs a major compaction if specified.

This method is asynchronous.

Parameters:
regionInfo - region to compact
major - true to force major compaction
Throws:
NotServingRegionException
IOException

replicateLogEntries

void replicateLogEntries(HLog.Entry[] entries)
                         throws IOException
Replicates the given entries. The guarantee is that the given entries will be durable on the slave cluster if this method returns without any exception. hbase.replication has to be set to true for this to work.

Parameters:
entries - entries to replicate
Throws:
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.