public class AsyncFSWAL extends AbstractFSWAL<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
toWriteAppendstoWriteAppends, append it to the AsyncWriter, and insert it into
unackedAppendsbatchSize, 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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ASYNC_WAL_USE_SHARED_EVENT_LOOP |
static java.lang.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 java.lang.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(FileSystem fs,
Path rootDir,
java.lang.String logDir,
java.lang.String archiveDir,
Configuration conf,
java.util.List<WALActionsListener> listeners,
boolean failIfWALExists,
java.lang.String prefix,
java.lang.String suffix,
EventLoopGroup eventLoopGroup,
java.lang.Class<? extends 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 AsyncWriter |
createWriterInstance(Path path) |
protected void |
doAppend(AsyncWriter writer,
org.apache.hadoop.hbase.regionserver.wal.FSWALEntry entry) |
protected boolean |
doCheckLogLowReplication() |
protected void |
doReplaceWriter(Path oldPath,
Path newPath,
AsyncWriter nextWriter) |
protected void |
doShutdown() |
void |
sync() |
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 static final java.lang.String WAL_BATCH_SIZE
public static final long DEFAULT_WAL_BATCH_SIZE
public static final java.lang.String ASYNC_WAL_USE_SHARED_EVENT_LOOP
public static final boolean DEFAULT_ASYNC_WAL_USE_SHARED_EVENT_LOOP
public static final java.lang.String ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS
public static final int DEFAULT_ASYNC_WAL_WAIT_ON_SHUTDOWN_IN_SECONDS
public AsyncFSWAL(FileSystem fs,
Path rootDir,
java.lang.String logDir,
java.lang.String archiveDir,
Configuration conf,
java.util.List<WALActionsListener> listeners,
boolean failIfWALExists,
java.lang.String prefix,
java.lang.String suffix,
EventLoopGroup eventLoopGroup,
java.lang.Class<? extends Channel> channelClass)
throws FailedLogCloseException,
java.io.IOException
FailedLogCloseExceptionjava.io.IOExceptionpublic long append(RegionInfo hri,
WALKeyImpl key,
WALEdit edits,
boolean inMemstore)
throws java.io.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 in class AbstractFSWAL<AsyncWriter>java.io.IOExceptionpublic void sync()
throws java.io.IOException
java.io.IOExceptionprotected AsyncWriter createWriterInstance(Path path)
throws java.io.IOException
createWriterInstance in class AbstractFSWAL<AsyncWriter>java.io.IOExceptionprotected void doReplaceWriter(Path oldPath,
Path newPath,
AsyncWriter nextWriter)
throws java.io.IOException
doReplaceWriter in class AbstractFSWAL<AsyncWriter>java.io.IOExceptionprotected void doShutdown()
throws java.io.IOException
doShutdown in class AbstractFSWAL<AsyncWriter>java.io.IOExceptionprotected void doAppend(AsyncWriter writer,
org.apache.hadoop.hbase.regionserver.wal.FSWALEntry entry)
doAppend in class AbstractFSWAL<AsyncWriter>protected boolean doCheckLogLowReplication()
doCheckLogLowReplication in class AbstractFSWAL<AsyncWriter>