|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.HRegion
public class HRegion
HRegion stores data for a certain region of a table. It stores all columns for each row. A given table consists of one or more HRegions.
We maintain multiple HStores for a single HRegion.
An HStore is a set of rows with some column data; together, they make up all the data for the rows.
Each HRegion has a 'startKey' and 'endKey'.
The first is inclusive, the second is exclusive (except for the final region) The endKey of region 0 is the same as startKey for region 1 (if it exists). The startKey for the first region is null. The endKey for the final region is null.
The HStores have no locking built-in. All row-level locking and row-level atomicity is provided by the HRegion.
An HRegion is defined by its table and its key extent.
It consists of at least one HStore. The number of HStores should be configurable, so that data which is accessed together is stored in the same HStore. Right now, we approximate that by building a single HStore for each column family. (This config info will be communicated via the tabledesc.) The HTableDescriptor contains metainfo about the HRegion's table. regionName is a unique identifier for this HRegion. (startKey, endKey] defines the keyspace for this HRegion.
Field Summary |
---|
Constructor Summary | |
---|---|
HRegion(Path rootDir,
HLog log,
FileSystem fs,
Configuration conf,
HRegionInfo regionInfo,
Path initialFiles)
HRegion constructor. |
Method Summary | |
---|---|
void |
abort(long lockid)
Abort a pending set of writes. |
Vector<HStoreFile> |
close()
Close down this HRegion. |
void |
commit(long lockid,
long timestamp)
Commit a pending set of writes to the memcache. |
void |
delete(long lockid,
Text targetCol)
Delete a value or write a value. |
Configuration |
getConf()
|
Text |
getEndKey()
|
FileSystem |
getFilesystem()
|
HLog |
getLog()
|
Path |
getRegionDir()
|
long |
getRegionId()
|
Text |
getRegionName()
|
Path |
getRootDir()
|
HInternalScannerInterface |
getScanner(Text[] cols,
Text firstRow,
long timestamp,
RowFilterInterface filter)
Return an iterator that scans over the HRegion, returning the indicated columns for only the rows that match the data filter. |
Text |
getStartKey()
|
HTableDescriptor |
getTableDesc()
|
void |
put(long lockid,
Text targetCol,
byte[] val)
Put a cell value into the locked row. |
long |
startUpdate(Text row)
The caller wants to apply a series of writes to a single row in the HRegion. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HRegion(Path rootDir, HLog log, FileSystem fs, Configuration conf, HRegionInfo regionInfo, Path initialFiles) throws IOException
log
- The HLog is the outbound log for any updates to the HRegion
(There's a single HLog for all the HRegions on a single HRegionServer.)
The log file is a logfile from the previous execution that's
custom-computed for this HRegion. The HRegionServer computes and sorts the
appropriate log info for this HRegion. If there is a previous log file
(implying that the HRegion has been written-to before), then read it from
the supplied path.rootDir
- root directory for HBase instancefs
- is the filesystem.conf
- is global configuration settings.regionInfo
- - HRegionInfo that describes the regioninitialFiles
- If there are initial files (implying that the HRegion
is new), then read them from the supplied path.
IOException
Method Detail |
---|
public Vector<HStoreFile> close() throws IOException
IOException
public Text getStartKey()
public Text getEndKey()
public long getRegionId()
public Text getRegionName()
public Path getRootDir()
public HTableDescriptor getTableDesc()
public HLog getLog()
public Configuration getConf()
public Path getRegionDir()
public FileSystem getFilesystem()
public HInternalScannerInterface getScanner(Text[] cols, Text firstRow, long timestamp, RowFilterInterface filter) throws IOException
cols
- columns desired in result setfirstRow
- row which is the starting point of the scantimestamp
- only return rows whose timestamp is <= this valuefilter
- row filter
IOException
public long startUpdate(Text row) throws IOException
Note that we rely on the external caller to properly abort() or commit() every transaction. If the caller is a network client, there should be a lease-system in place that automatically aborts() transactions after a specified quiet period.
row
- Row to update
IOException
put(long, Text, byte[])
public void put(long lockid, Text targetCol, byte[] val) throws IOException
lockid
- lock id obtained from startUpdatetargetCol
- name of column to be updatedval
- new value for column
IOException
public void delete(long lockid, Text targetCol) throws IOException
lockid
- lock id obtained from startUpdatetargetCol
- name of column to be deleted
IOException
public void abort(long lockid) throws IOException
lockid
- lock id obtained from startUpdate
IOException
public void commit(long lockid, long timestamp) throws IOException
lockid
- Lock for row we're to commit.timestamp
- the time to associate with this change
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |