Package org.apache.hadoop.hbase.wal
Class AbstractWALRoller<T extends Abortable>
java.lang.Object
java.lang.Thread
org.apache.hadoop.hbase.wal.AbstractWALRoller<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
- Direct Known Subclasses:
LogRoller,MasterRegionWALRoller
@Private
public abstract class AbstractWALRoller<T extends Abortable>
extends Thread
implements Closeable
Runs periodically to determine if the WAL should be rolled.
NOTE: This class extends Thread rather than Chore because the sleep time can be interrupted when
there is something to do, rather than the Chore sleep time which is invariant.
The
scheduleFlush(String, List) is abstract here, as sometimes we hold a region without
a region server but we still want to roll its WAL.
TODO: change to a pool of threads-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classIndependently control the roll of each wal.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Tprivate final longstatic final longprivate static final org.slf4j.Loggerprivate final intprivate final longprivate final longprivate booleanprivate final intprotected static final Stringstatic final StringConfigure for the max count of log rolling retry.static final StringConfigure for the timeout of log rolling retry.protected final ConcurrentMap<WAL,AbstractWALRoller<T>.RollController> Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWALRoller(String name, org.apache.hadoop.conf.Configuration conf, T abortable) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidprotected voidafterWALArchive(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) private voidcheckLowReplication(long now) we need to check low replication in period, see HBASE-18132voidclose()private booleanvoidvoidrun()protected abstract voidscheduleFlush(String encodedRegionName, List<byte[]> families) voidWait until all wals have been rolled after callingrequestRollAll().booleanReturns true if all WAL roll finishedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
LOG
-
WAL_ROLL_PERIOD_KEY
- See Also:
-
WAL_ROLL_WAIT_TIMEOUT
Configure for the timeout of log rolling retry.- See Also:
-
DEFAULT_WAL_ROLL_WAIT_TIMEOUT
- See Also:
-
WAL_ROLL_RETRIES
Configure for the max count of log rolling retry. The real retry count is also limited by the timeout of log rolling viaWAL_ROLL_WAIT_TIMEOUT- See Also:
-
wals
-
abortable
-
rollPeriod
-
threadWakeFrequency
-
checkLowReplicationInterval
-
rollWaitTimeout
-
maxRollRetry
-
running
-
-
Constructor Details
-
AbstractWALRoller
-
-
Method Details
-
addWAL
-
requestRollAll
-
checkLowReplication
we need to check low replication in period, see HBASE-18132 -
abort
-
run
-
afterWALArchive
protected void afterWALArchive(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) -
scheduleFlush
- Parameters:
encodedRegionName- Encoded name of region to flush.families- stores of region to flush.
-
isWaiting
-
walRollFinished
Returns true if all WAL roll finished -
waitUntilWalRollFinished
Wait until all wals have been rolled after callingrequestRollAll().- Throws:
InterruptedException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-