@InterfaceAudience.LimitedPrivate(value="Configuration") public class AsyncFSWAL extends AbstractFSWAL<WALProvider.AsyncWriter>
Here 'waitingConsumePayloads' acts as the RingBuffer in FSHLog.
For append, we process it as follow:
shouldScheduleConsumer()
for more details.
waitingConsumePayloads
and insert it into
toWriteAppends
toWriteAppends
, append it to the AsyncWriter, and insert it into
unackedAppends
batchSize
, or there is a sync request, then we call
sync on the AsyncWriter.unackedAppends
and drop it.unackedAppends
back to toWriteAppends
and
wait for writing them again.
Here we only describe the logic of doReplaceWriter. The main logic of rollWriter is same with
FSHLog.
For a normal roll request(for example, we have reached the log roll size):
waitingRoll(int)
to true and
readyForRolling
to false, and then wait on readyForRolling
(see
waitForSafePoint()
).waitingConsumePayloads
if
waitingRoll(int)
is true, and also stop writing the entries in toWriteAppends
out.
unackedAppends
is empty,
signal the readyForRollingCond
.writerBroken(int)
and waitingRoll(int)
to false.WAL.Entry, WAL.Reader
Modifier and Type | Field and Description |
---|---|
static String |
ASYNC_WAL_USE_SHARED_EVENT_LOOP |
static String |
ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS |
static boolean |
DEFAULT_ASYNC_WAL_USE_SHARED_EVENT_LOOP |
static int |
DEFAULT_ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS |
static long |
DEFAULT_WAL_BATCH_SIZE |
static String |
WAL_BATCH_SIZE |
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
Constructor and Description |
---|
AsyncFSWAL(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,
org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup eventLoopGroup,
Class<? extends org.apache.hbase.thirdparty.io.netty.channel.Channel> channelClass) |
Modifier and Type | Method and Description |
---|---|
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 WALProvider.AsyncWriter |
createWriterInstance(org.apache.hadoop.fs.Path path) |
protected void |
doAppend(WALProvider.AsyncWriter 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.AsyncWriter nextWriter) |
protected void |
doShutdown() |
void |
sync()
Sync what we have in the WAL.
|
void |
sync(long txid)
Sync the WAL if the txId was not already sync'd.
|
abortCacheFlush, append, atHeadOfRingBufferEventHandlerAppend, 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, updateStore
public static final String WAL_BATCH_SIZE
public static final long DEFAULT_WAL_BATCH_SIZE
public static final String ASYNC_WAL_USE_SHARED_EVENT_LOOP
public static final boolean DEFAULT_ASYNC_WAL_USE_SHARED_EVENT_LOOP
public static final String ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS
public static final int DEFAULT_ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS
public AsyncFSWAL(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, org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup eventLoopGroup, Class<? extends org.apache.hbase.thirdparty.io.netty.channel.Channel> channelClass) throws FailedLogCloseException, IOException
FailedLogCloseException
IOException
public long append(RegionInfo hri, WALKeyImpl key, WALEdit edits, boolean inMemstore) throws IOException
AbstractFSWAL
walKey
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
in interface WAL
append
in class AbstractFSWAL<WALProvider.AsyncWriter>
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.IOException
public void sync() throws IOException
WAL
IOException
public void sync(long txid) throws IOException
WAL
txid
- Transaction id to sync to.IOException
protected WALProvider.AsyncWriter createWriterInstance(org.apache.hadoop.fs.Path path) throws IOException
createWriterInstance
in class AbstractFSWAL<WALProvider.AsyncWriter>
IOException
protected void doReplaceWriter(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath, WALProvider.AsyncWriter nextWriter) throws IOException
doReplaceWriter
in class AbstractFSWAL<WALProvider.AsyncWriter>
IOException
protected void doShutdown() throws IOException
doShutdown
in class AbstractFSWAL<WALProvider.AsyncWriter>
IOException
protected void doAppend(WALProvider.AsyncWriter writer, org.apache.hadoop.hbase.regionserver.wal.FSWALEntry entry)
doAppend
in class AbstractFSWAL<WALProvider.AsyncWriter>
protected boolean doCheckLogLowReplication()
doCheckLogLowReplication
in class AbstractFSWAL<WALProvider.AsyncWriter>
Copyright © 2007–2019 Cloudera. All rights reserved.