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

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

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

org::apache::hadoop::hbase::HConstants org::apache::hadoop::hbase::regionserver::transactional::THLog

List of all members.

Detailed Description

HLog stores all the edits to the HStore.

It performs logfile-rolling, so external callers are not aware that the underlying file is being rolled.

A single HLog is used by several HRegions simultaneously.

Each HRegion is identified by a unique long int. HRegions do not need to declare themselves before using the HLog; they simply include their HRegion-id in the append or completeCacheFlush calls.

An HLog consists of multiple on-disk files, which have a chronological order. As data is flushed to other (better) on-disk structures, the log becomes obsolete. We can destroy all the log messages for a given HRegion-id up to the most-recent CACHEFLUSH message from that HRegion.

It's only practical to delete entire files. Thus, we delete an entire on-disk file F when all of the messages in F have a log-sequence-id that's older (smaller) than the most-recent CACHEFLUSH message for every HRegion that has a message in F.

Synchronized methods can never execute in parallel. However, between the start of a cache flush and the completion point, appends are allowed but log rolling is not. To prevent log rolling taking place during this period, a separate reentrant lock is used.

Definition at line 103 of file HLog.java.

Public Types

enum  Modify {

Public Member Functions

void append (byte[] regionName, byte[] tableName, List< KeyValue > edits, boolean sync, final long now) throws IOException
void append (HRegionInfo regionInfo, HLogKey logKey, KeyValue logEdit) throws IOException
void append (HRegionInfo regionInfo, KeyValue logEdit, final long now) throws IOException
void close () throws IOException
void closeAndDelete () throws IOException
Path computeFilename (final long fn)
long getFilenum ()
long getSequenceNumber ()
 HLog (final FileSystem fs, final Path dir, final HBaseConfiguration conf, final LogRollListener listener) throws IOException
byte[][] rollWriter () throws FailedLogCloseException, IOException
void sync () throws IOException

Static Public Member Functions

static String getHLogDirectoryName (String serverName)
static String getHLogDirectoryName (String serverAddress, long startCode)
static String getHLogDirectoryName (HServerInfo info)
static long getSyncOps ()
static long getSyncTime ()
static long getWriteOps ()
static long getWriteTime ()
static boolean isMetaFamily (byte[] family)
static void main (String[] args) throws IOException
static List< Path > splitLog (final Path rootDir, final Path srcDir, final FileSystem fs, final HBaseConfiguration conf) throws IOException

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

SequenceFile.Writer createWriter (Path path, Class<?extends HLogKey > keyClass, Class<?extends KeyValue > valueClass) throws IOException
SequenceFile.Writer createWriter (Path path) throws IOException
HLogKey makeKey (byte[] regionName, byte[] tableName, long seqnum, long now)

Package Functions

void abortCacheFlush ()
void completeCacheFlush (final byte[] regionName, final byte[] tableName, final long logSeqId) throws IOException
int getNumEntries ()
int getNumLogFiles ()
void optionalSync ()
void setSequenceNumber (final long newvalue)
long startCacheFlush ()

Static Package Functions

 [static initializer]
static byte[][] findMemstoresWithEditsOlderThan (final long oldestWALseqid, final Map< byte[], Long > regionsToSeqids)
static CompressionType getCompressionType (final Configuration c)
static Class<?extends HLogKeygetKeyClass (HBaseConfiguration conf)
static HLogKey newKey (HBaseConfiguration conf) throws IOException

Package Attributes

final SortedMap< Long, Path > outputfiles
SequenceFile.Writer writer

Static Package Attributes

static final Log LOG = LogFactory.getLog(HLog.class)
static final byte[] METAFAMILY = Bytes.toBytes("METAFAMILY")
static final byte[] METAROW = Bytes.toBytes("METAROW")
static final Long ZERO_L = Long.valueOf(0L)

Private Member Functions

byte[][] cleanOldLogs () throws IOException
Path cleanupCurrentWriter (final long currentfilenum) throws IOException
KeyValue completeCacheFlushLogEdit ()
void deleteLogFile (final Path p, final Long seqno) throws IOException
void doWrite (HLogKey logKey, KeyValue logEdit, boolean sync) throws IOException
Long getOldestOutstandingSeqNum ()
byte[] getOldestRegion (final Long oldestOutstandingSeqNum)
long[] obtainSeqNum (int num)
long obtainSeqNum ()
void requestLogRoll ()

Static Private Member Functions

static boolean isAppend (final HBaseConfiguration conf)
static void recoverLog (final FileSystem fs, final Path p, final boolean append)
static List< Path > splitLog (final Path rootDir, final FileStatus[] logfiles, final FileSystem fs, final HBaseConfiguration conf) throws IOException
static void usage ()

Private Attributes

final boolean append
final long blocksize
final Lock cacheFlushLock = new ReentrantLock()
volatile boolean closed = false
final Configuration conf
final Path dir
final AtomicLong editsSize = new AtomicLong(0)
final boolean enabled
volatile long filenum = -1
final int flushlogentries
final FileSystem fs
volatile long lastLogFlushTime
final ConcurrentSkipListMap
< byte[], Long > 
final LogRollListener listener
final long logrollsize
final AtomicLong logSeqNum = new AtomicLong(0)
final int maxLogs
final AtomicInteger numEntries = new AtomicInteger(0)
final long optionalFlushInterval
final Method syncfs
final AtomicInteger unflushedEntries = new AtomicInteger(0)
final Object updateLock = new Object()

Static Private Attributes

static final String HLOG_DATFILE = "hlog.dat."
static final Object[] NO_ARGS = new Object []{}
static volatile long syncOps
static volatile long syncTime
static volatile long writeOps
static volatile long writeTime


class  HLogEntry
class  WriterAndPath

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

Generated by  Doxygen 1.6.0   Back to index