public class Checkpointer extends DaemonThread implements EnvConfigObserver
Modifier and Type | Class and Description |
---|---|
static class |
Checkpointer.CheckpointReference |
static class |
Checkpointer.FlushStats
A struct to hold log flushing stats for checkpoint and database sync.
|
Modifier and Type | Field and Description |
---|---|
static TestHook |
beforeFlushHook |
static TestHook |
maxFlushLevelHook
For unit testing only.
|
name, nWakeupRequests, stifleExceptionChatter
Constructor and Description |
---|
Checkpointer(EnvironmentImpl envImpl,
long waitTime,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
clearEnv() |
void |
doCheckpoint(CheckpointConfig config,
boolean flushAll,
java.lang.String invokingSource)
The real work to do a checkpoint.
|
void |
envConfigUpdate(DbConfigManager cm,
EnvironmentMutableConfig ignore)
Process notifications of mutable property changes.
|
int |
getHighestFlushLevel(DatabaseImpl db)
Returns the highest flush level for a database that is part of a
checkpoint currently in progress.
|
static long |
getWakeupPeriod(DbConfigManager configManager)
Figure out the wakeup period.
|
void |
initIntervals(long lastCheckpointEnd,
long lastCheckpointMillis)
Initializes the checkpoint intervals when no checkpoint is performed
while opening the environment.
|
void |
loadStats(StatsConfig config,
EnvironmentStats stat)
Load stats.
|
protected long |
nDeadlockRetries()
Return the number of retries when a deadlock exception occurs.
|
protected void |
onWakeup()
Called whenever the DaemonThread wakes up from a sleep.
|
static void |
setBeforeFlushHook(TestHook hook) |
void |
setCheckpointId(long lastCheckpointId)
Set checkpoint id -- can only be done after recovery.
|
static void |
setMaxFlushLevelHook(TestHook hook) |
static void |
syncDatabase(EnvironmentImpl envImpl,
DatabaseImpl dbImpl,
boolean flushLog)
Flush a given database to disk.
|
void |
wakeupAfterWrite()
Wakes up the checkpointer if a checkpoint log interval is configured and
the number of bytes written since the last checkpoint exeeds the size
of the interval.
|
checkErrorListener, getExceptionListener, getNWakeupRequests, getThread, isPaused, isRunning, isShutdownRequested, requestShutdown, run, runOrPause, setExceptionListener, shutdown, toString, wakeup
public static TestHook maxFlushLevelHook
public static TestHook beforeFlushHook
public Checkpointer(EnvironmentImpl envImpl, long waitTime, java.lang.String name) throws DatabaseException
DatabaseException
public void envConfigUpdate(DbConfigManager cm, EnvironmentMutableConfig ignore) throws DatabaseException
envConfigUpdate
in interface EnvConfigObserver
DatabaseException
public void initIntervals(long lastCheckpointEnd, long lastCheckpointMillis)
public int getHighestFlushLevel(DatabaseImpl db)
public static long getWakeupPeriod(DbConfigManager configManager) throws java.lang.IllegalArgumentException, DatabaseException
java.lang.IllegalArgumentException
DatabaseException
public void setCheckpointId(long lastCheckpointId)
public void loadStats(StatsConfig config, EnvironmentStats stat) throws DatabaseException
DatabaseException
public void clearEnv()
protected long nDeadlockRetries() throws DatabaseException
nDeadlockRetries
in class DaemonThread
DatabaseException
protected void onWakeup() throws DatabaseException
onWakeup
in class DaemonThread
DatabaseException
public void wakeupAfterWrite()
public void doCheckpoint(CheckpointConfig config, boolean flushAll, java.lang.String invokingSource) throws DatabaseException
flushAll
- if true, this checkpoint must flush all the way to
the top of the dbtree, instead of stopping at the highest level
last modified.invokingSource
- a debug aid, to indicate who invoked this
checkpoint. (i.e. recovery, the checkpointer daemon, the cleaner,
programatically)DatabaseException
public static void syncDatabase(EnvironmentImpl envImpl, DatabaseImpl dbImpl, boolean flushLog) throws DatabaseException
DatabaseException
public static void setMaxFlushLevelHook(TestHook hook)
public static void setBeforeFlushHook(TestHook hook)