@InterfaceAudience.Private public class FSHLog extends AbstractFSWAL<WALProvider.Writer>
WAL.Entry, WAL.Reader| 限定符和类型 | 字段和说明 |
|---|---|
static long |
FIXED_OVERHEAD |
blocksize, closed, conf, coprocessorHost, DEFAULT_SLOW_SYNC_TIME_MS, filenum, fs, highestSyncedTxid, highestUnsyncedTxid, implClassName, listeners, logrollsize, maxLogs, numEntries, ourFiles, prefixPathStr, rollWriterLock, sequenceIdAccounting, shutdown, slowSyncNs, totalLogSize, walArchiveDir, walDir, walFile2Props, walFilePrefix, walFileSuffix| 构造器和说明 |
|---|
FSHLog(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path root,
String logDir,
org.apache.hadoop.conf.Configuration conf)
Constructor.
|
FSHLog(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir,
String logDir,
String archiveDir,
org.apache.hadoop.conf.Configuration conf,
List<WALActionsListener> listeners,
boolean failIfWALExists,
String prefix,
String suffix)
Create an edit log at the given
dir location. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterCreatingZigZagLatch()
Used to manufacture race condition reliably.
|
long |
append(RegionInfo hri,
WALKeyImpl key,
WALEdit edits,
boolean inMemstore)
NOTE: This append, at a time that is usually after this call returns, starts an mvcc
transaction by calling 'begin' wherein which we assign this update a sequenceid.
|
protected void |
beforeWaitOnSafePoint() |
protected WALProvider.Writer |
createWriterInstance(org.apache.hadoop.fs.Path path)
This method allows subclasses to inject different writers without having to extend other
methods like rollWriter().
|
protected void |
doAppend(WALProvider.Writer writer,
org.apache.hadoop.hbase.regionserver.wal.FSWALEntry entry) |
protected boolean |
doCheckLogLowReplication() |
protected void |
doReplaceWriter(org.apache.hadoop.fs.Path oldPath,
org.apache.hadoop.fs.Path newPath,
WALProvider.Writer nextWriter) |
protected void |
doShutdown() |
protected long |
getSequenceOnRingBuffer() |
protected org.apache.hadoop.hbase.regionserver.wal.SyncFuture |
publishSyncOnRingBuffer(long sequence,
boolean forceSync) |
void |
sync()
Sync what we have in the WAL.
|
void |
sync(boolean forceSync) |
void |
sync(long txid)
Sync the WAL if the txId was not already sync'd.
|
void |
sync(long txid,
boolean forceSync) |
abortCacheFlush, append, blockOnSync, checkLogLowReplication, close, completeCacheFlush, computeFilename, getCoprocessorHost, getCurrentFileName, getEarliestMemStoreSeqNum, getEarliestMemStoreSeqNum, getFilenum, getFileNumFromFileName, getLogFileSize, getLogFileSizeIfBeingWritten, getNumLogFiles, getNumRolledLogFiles, getPreallocatedEventCount, getSyncFuture, getWALArchivePath, logRollAndSetupWalProps, main, postSync, registerWALActionsListener, requestLogRoll, requestLogRoll, rollWriter, rollWriter, shutdown, stampSequenceIdAndPublishToRingBuffer, startCacheFlush, startCacheFlush, toString, unregisterWALActionsListener, updateStorepublic FSHLog(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path root,
String logDir,
org.apache.hadoop.conf.Configuration conf)
throws IOException
fs - filesystem handleroot - path for stored and archived walslogDir - dir where wals are storedconf - configuration to useIOExceptionpublic FSHLog(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path rootDir,
String logDir,
String archiveDir,
org.apache.hadoop.conf.Configuration conf,
List<WALActionsListener> listeners,
boolean failIfWALExists,
String prefix,
String suffix)
throws IOException
dir location. You should never have to load an
existing log. If there is a log at startup, it should have already been processed and deleted
by the time the WAL object is started up.fs - filesystem handlerootDir - path to where logs and oldlogslogDir - dir where wals are storedarchiveDir - dir where wals are archivedconf - configuration to uselisteners - Listeners on WAL events. Listeners passed here will be registered before we do
anything else; e.g. the Constructor AbstractFSWAL.rollWriter().failIfWALExists - If true IOException will be thrown if files related to this wal already
exist.prefix - should always be hostname and port in distributed env and it will be URL encoded
before being used. If prefix is null, "wal" will be usedsuffix - will be url encoded. null is treated as empty. non-empty must start with
AbstractFSWALProvider.WAL_FILE_NAME_DELIMITERIOExceptionprotected WALProvider.Writer createWriterInstance(org.apache.hadoop.fs.Path path) throws IOException
createWriterInstance 在类中 AbstractFSWAL<WALProvider.Writer>IOExceptionprotected void afterCreatingZigZagLatch()
beforeWaitOnSafePoint()protected void beforeWaitOnSafePoint()
protected void doAppend(WALProvider.Writer writer, org.apache.hadoop.hbase.regionserver.wal.FSWALEntry entry) throws IOException
doAppend 在类中 AbstractFSWAL<WALProvider.Writer>IOExceptionprotected void doReplaceWriter(org.apache.hadoop.fs.Path oldPath,
org.apache.hadoop.fs.Path newPath,
WALProvider.Writer nextWriter)
throws IOException
doReplaceWriter 在类中 AbstractFSWAL<WALProvider.Writer>IOExceptionprotected void doShutdown()
throws IOException
doShutdown 在类中 AbstractFSWAL<WALProvider.Writer>IOExceptionpublic long append(RegionInfo hri, WALKeyImpl key, WALEdit edits, boolean inMemstore) throws IOException
AbstractFSWALwalKey parameter. Be warned that the WriteEntry is not
immediately available on return from this method. It WILL be available subsequent to a sync of
this append; otherwise, you will just have to wait on the WriteEntry to get filled in.append 在接口中 WALappend 在类中 AbstractFSWAL<WALProvider.Writer>hri - the regioninfo associated with appendkey - Modified by this call; we add to it this edits region edit/sequence id.edits - Edits to append. MAY CONTAIN NO EDITS for case where we want to get an edit
sequence id that is after all currently appended edits.inMemstore - Always true except for case where we are writing a compaction completion
record into the WAL; in this case the entry is just so we can finish an unfinished compaction
-- it is not an edit for memstore.key will have the region edit/sequence id
in it.IOExceptionprotected boolean doCheckLogLowReplication()
doCheckLogLowReplication 在类中 AbstractFSWAL<WALProvider.Writer>protected long getSequenceOnRingBuffer()
protected org.apache.hadoop.hbase.regionserver.wal.SyncFuture publishSyncOnRingBuffer(long sequence, boolean forceSync)
public void sync()
throws IOException
WALIOExceptionpublic void sync(boolean forceSync)
throws IOException
forceSync - Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush
vs hsync.IOExceptionpublic void sync(long txid)
throws IOException
WALtxid - Transaction id to sync to.IOExceptionpublic void sync(long txid,
boolean forceSync)
throws IOException
txid - Transaction id to sync to.forceSync - Flag to force sync rather than flushing to the buffer. Example - Hadoop hflush
vs hsync.IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.