Logo Search packages:      
Sourcecode: hbase version File versions  Download package

org::apache::hadoop::hbase::regionserver::HRegion Class Reference

Inheritance diagram for org::apache::hadoop::hbase::regionserver::HRegion:

org::apache::hadoop::hbase::HConstants org::apache::hadoop::hbase::io::HeapSize org::apache::hadoop::hbase::regionserver::transactional::TransactionalRegion

List of all members.

Detailed Description

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 Store 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.

Locking at the HRegion level serves only one purpose: preventing the region from being closed (and consequently split) while other operations are ongoing. Each row level operation obtains both a row lock and a region read lock for the duration of the operation. While a scanner is being constructed, getScanner holds a read lock. If the scanner is successfully constructed, it holds a read lock until it is closed. A close takes out a write lock and consequently will block for ongoing operations and will block new operations from starting while the close is in progress.

An HRegion is defined by its table and its key extent.

It consists of at least one Store. The number of Stores should be configurable, so that data which is accessed together is stored in the same Store. Right now, we approximate that by building a single Store 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.

Definition at line 108 of file HRegion.java.

Public Types

enum  Modify {

Public Member Functions

boolean checkAndPut (byte[] row, byte[] family, byte[] qualifier, byte[] expectedValue, Put put, Integer lockId, boolean writeToWAL) throws IOException
List< StoreFileclose (final boolean abort) throws IOException
List< StoreFileclose () throws IOException
byte[] compactStores () throws IOException
void delete (Map< byte[], List< KeyValue >> familyMap, boolean writeToWAL) throws IOException
void delete (Delete delete, Integer lockid, boolean writeToWAL) throws IOException
boolean equals (Object o)
boolean flushcache () throws IOException
Result get (final Get get, final Integer ignoredLockId) throws IOException
Path getBaseDir ()
Result getClosestRowBefore (final byte[] row, final byte[] family) throws IOException
HBaseConfiguration getConf ()
byte[] getEndKey ()
FileSystem getFilesystem ()
long getLargestHStoreSize ()
long getLastFlushTime ()
HLog getLog ()
Path getRegionDir ()
long getRegionId ()
HRegionInfo getRegionInfo ()
byte[] getRegionName ()
String getRegionNameAsString ()
InternalScanner getScanner (Scan scan) throws IOException
byte[] getStartKey ()
Store getStore (final byte[] column)
HTableDescriptor getTableDesc ()
int hashCode ()
boolean hasTooManyStoreFiles ()
long heapSize ()
 HRegion (Path basedir, HLog log, FileSystem fs, HBaseConfiguration conf, HRegionInfo regionInfo, FlushRequester flushListener)
 HRegion ()
long incrementColumnValue (byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL) throws IOException
void initialize (Path initialFiles, final Progressable reporter) throws IOException
boolean isClosed ()
boolean isClosing ()
Integer obtainRowLock (final byte[] row) throws IOException
void put (Put put, Integer lockid, boolean writeToWAL) throws IOException
void put (Put put, Integer lockid) throws IOException
void put (Put put, boolean writeToWAL) throws IOException
void put (Put put) throws IOException
boolean shouldSplit (boolean b)
String toString ()

Static Public Member Functions

static void addRegionToMETA (HRegion meta, HRegion r) throws IOException
static void cleanRegionInMETA (final HRegionInterface srvr, final byte[] metaRegionName, final HRegionInfo info) throws IOException
static HRegion createHRegion (final HRegionInfo info, final Path rootDir, final HBaseConfiguration conf) throws IOException
static void deleteRegion (FileSystem fs, Path rootdir, HRegionInfo info) throws IOException
static Path getRegionDir (final Path rootdir, final HRegionInfo info)
static Path getRegionDir (final Path tabledir, final int name)
static void main (String[] args) throws IOException
static void makeColumnFamilyDirs (FileSystem fs, Path tabledir, final HRegionInfo hri, byte[] colFamily) throws IOException
static HRegion merge (HRegion a, HRegion b) throws IOException
static HRegion mergeAdjacent (final HRegion srcA, final HRegion srcB) throws IOException
static HRegion newHRegion (Path basedir, HLog log, FileSystem fs, HBaseConfiguration conf, HRegionInfo regionInfo, FlushRequester flushListener)
static void offlineRegionInMETA (final HRegionInterface srvr, final byte[] metaRegionName, final HRegionInfo info) throws IOException
static HRegion openHRegion (final HRegionInfo info, final Path rootDir, final HLog log, final HBaseConfiguration conf) throws IOException
static void removeRegionFromMETA (final HRegionInterface srvr, final byte[] metaRegionName, final byte[] regionName) throws IOException
static boolean rowIsInRange (HRegionInfo info, final byte[] row)

Static Public Attributes

static final int ALL_VERSIONS = Integer.MAX_VALUE
static final byte[] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR)
static final String CATALOG_FAMILY_STR = "info"
static final byte[] CATALOG_HISTORIAN_FAMILY = Bytes.toBytes("historian")
static final String CLUSTER_DISTRIBUTED = "hbase.cluster.distributed"
static final String CLUSTER_IS_DISTRIBUTED = "true"
static final String CLUSTER_IS_LOCAL = "false"
static final long DEEP_OVERHEAD
static final String DEFAULT_HOST = ""
static final int DEFAULT_MASTER_INFOPORT = 60010
static final int DEFAULT_MASTER_PORT = 60000
static final long DEFAULT_MAX_FILE_SIZE = 256 * 1024 * 1024
static final String DEFAULT_REGION_SERVER_CLASS = HRegionInterface.class.getName()
static final int DEFAULT_REGIONSERVER_INFOPORT = 60030
static final int DEFAULT_REGIONSERVER_PORT = 60020
static final int DEFAULT_SIZE_RESERVATION_BLOCK = 1024 * 1024 * 5
static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000
static final int DEFAULT_ZOOKEEPER_RETRIES = 5
static final byte[] EMPTY_BYTE_ARRAY = new byte [0]
static final byte[] EMPTY_END_ROW = EMPTY_START_ROW
static final byte[] EMPTY_START_ROW = EMPTY_BYTE_ARRAY
static final String FILE_SYSTEM_VERSION = "7"
static final long FIXED_OVERHEAD
static final int FOREVER = Integer.MAX_VALUE
static String HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY = "hbase.client.scanner.max.result.size"
static final String HBASE_DIR = "hbase.rootdir"
static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir"
static final String HREGION_LOGDIR_NAME = ".logs"
static final String HREGION_OLDLOGFILE_NAME = "oldlogfile.log"
static final String IN_MEMORY = "IN_MEMORY"
static final byte[] LAST_ROW = EMPTY_BYTE_ARRAY
static final long LATEST_TIMESTAMP = Long.MAX_VALUE
static final byte[] LATEST_TIMESTAMP_BYTES = Bytes.toBytes(LATEST_TIMESTAMP)
static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction"
static final String MASTER_PORT = "hbase.master.port"
static final int MAX_ROW_LENGTH = Short.MAX_VALUE
static final int MAXIMUM_VALUE_LENGTH = Integer.MAX_VALUE
static final int META_ROW_DELIMITER = ','
static final byte[] META_TABLE_NAME = Bytes.toBytes(".META.")
static final String NAME = "NAME"
static final String NINES = "99999999999999"
static final String REGION_IMPL = "hbase.hregion.impl"
static final String REGION_SERVER_CLASS = "hbase.regionserver.class"
static final String REGION_SERVER_IMPL = "hbase.regionserver.impl"
static final String REGIONINFO_FILE = ".regioninfo"
static final byte[] REGIONINFO_FILE_BYTES
static final byte[] REGIONINFO_QUALIFIER = Bytes.toBytes("regioninfo")
static final String REGIONSERVER_PORT = "hbase.regionserver.port"
static int RETRY_BACKOFF [] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32 }
static final byte[] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-")
static final byte[] SERVER_QUALIFIER = Bytes.toBytes("server")
static final byte[] SPLITA_QUALIFIER = Bytes.toBytes("splitA")
static final byte[] SPLITB_QUALIFIER = Bytes.toBytes("splitB")
static final byte[] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode")
static final String THREAD_WAKE_FREQUENCY = "hbase.server.thread.wakefrequency"
static final String UTF8_ENCODING = "UTF-8"
static final String VERSION_FILE_NAME = "hbase.version"
static final String VERSIONS = "VERSIONS"
static final int WEEK_IN_SECONDS = 7 * 24 * 3600
static final String ZEROES = "00000000000000"
static final String ZOOKEEPER_CONFIG_NAME = "zoo.cfg"
static final String ZOOKEEPER_PAUSE = "zookeeper.pause"
static final String ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum"
static final String ZOOKEEPER_RETRIES = "zookeeper.retries"

Protected Member Functions

void checkReadOnly () throws IOException
void doReconstructionLog (Path oldLogFile, long minSeqId, long maxSeqId, Progressable reporter) throws UnsupportedEncodingException, IOException
long getCompleteCacheFlushSequenceId (long currentSequenceId)
InternalScanner getScanner (Scan scan, List< KeyValueScanner > additionalScanners) throws IOException
Store instantiateHStore (Path baseDir, HColumnDescriptor c, Path oldLogFile, Progressable reporter) throws IOException
InternalScanner instantiateInternalScanner (Scan scan, List< KeyValueScanner > additionalScanners) throws IOException
boolean internalFlushcache () throws IOException
Callable< Void > internalPreFlushcacheCommit () throws IOException
void prepareToSplit ()

Protected Attributes

final ReadWriteConsistencyControl rwcc
final Map< byte[], Storestores

Package Functions

byte[] compactStores (final boolean majorCompaction) throws IOException
void delete (byte[] family, List< KeyValue > edits, boolean writeToWAL) throws IOException
Result getClosestRowBefore (final byte[] row) throws IOException
boolean getForceMajorCompaction ()
long getMinSequenceId ()
byte[] getRowFromLock (final Integer lockid)
ReadWriteConsistencyControl getRWCC ()
boolean hasReferences ()
boolean isMajorCompaction () throws IOException
void releaseRowLock (final Integer lockid)
void setForceMajorCompaction (final boolean b)
HRegion[] splitRegion (final byte[] splitRow) throws IOException

Static Package Functions

static Path getCompactionDir (final Path dir)

Package Attributes

final Path basedir
final AtomicBoolean closed = new AtomicBoolean(false)
final AtomicBoolean closing = new AtomicBoolean(false)
KeyValue.KVComparator comparator
final HBaseConfiguration conf
final FlushRequester flushListener
final FileSystem fs
final HLog log
final long memstoreFlushSize
final AtomicLong memstoreSize = new AtomicLong(0)
final Path regiondir
final HRegionInfo regionInfo
final long threadWakeFrequency

Static Package Attributes

static final Log LOG = LogFactory.getLog(HRegion.class)
static final String MERGEDIR = "merges"
static final String SPLITDIR = "splits"
static final Long ZERO_L = Long.valueOf(0L)

Private Member Functions

void checkFamily (final byte[] family) throws NoSuchColumnFamilyException
void checkRegioninfoOnFilesystem () throws IOException
void checkResources ()
void checkRow (final byte[] row) throws IOException
void doRegionCompactionCleanup () throws IOException
void doRegionCompactionPrep () throws IOException
List< KeyValueget (final Get get) throws IOException
Integer getLock (Integer lockid, byte[] row) throws IOException
Path getSplitDirForDaughter (final Path splits, final HRegionInfo hri) throws IOException
boolean isFlushSize (final long size)
boolean isRowLocked (final Integer lockid)
void put (final Map< byte[], List< KeyValue >> familyMap, boolean writeToWAL) throws IOException
void requestFlush ()
boolean updateKeys (List< KeyValue > keys, byte[] now)
void waitOnRowLocks ()
boolean worthPreFlushing ()

Static Private Member Functions

static void deleteRegion (FileSystem fs, Path regiondir) throws IOException
static Map< byte[], List
< StoreFile > > 
filesByFamily (Map< byte[], List< StoreFile >> byFamily, List< StoreFile > storeFiles)
static void listPaths (FileSystem fs, Path dir) throws IOException
static void moveInitialFilesIntoPlace (final FileSystem fs, final Path initialFiles, final Path regiondir) throws IOException
static void printUsageAndExit (final String message)
static void processTable (final FileSystem fs, final Path p, final HLog log, final HBaseConfiguration c, final boolean majorCompact) throws IOException

Private Attributes

final long blockingMemStoreSize
volatile boolean forceMajorCompaction = false
volatile long lastFlushTime
final Map< Integer, byte[]> locksToRows
long minSequenceId
final ReentrantReadWriteLock newScannerLock
final Path regionCompactionDir
final Object splitLock = new Object()
boolean splitRequest
final ReentrantReadWriteLock splitsAndClosesLock
final ReentrantReadWriteLock updatesLock
final WriteState writestate = new WriteState()

Static Private Attributes

static final List< KeyValueMOCKED_LIST


class  RegionScanner
class  WriteState

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index