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
Modifier and TypeClassDescriptionprotected class
Independently control the roll of each wal.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionprotected final T
private final long
static final long
private static final org.slf4j.Logger
private final int
private final long
private final long
private boolean
private final int
protected static final String
protected static final String
Configure for the max count of log rolling retry.static final String
Configure 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
ModifierConstructorDescriptionprotected
AbstractWALRoller
(String name, org.apache.hadoop.conf.Configuration conf, T abortable) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
void
protected void
afterWALArchive
(org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) private void
checkLowReplication
(long now) we need to check low replication in period, see HBASE-18132void
close()
private boolean
void
void
run()
protected abstract void
scheduleFlush
(String encodedRegionName, List<byte[]> families) void
Wait until all wals have been rolled after callingrequestRollAll()
.boolean
Returns true if all WAL roll finishedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-