com.sleepycat.je.recovery
Class Checkpointer

java.lang.Object
  extended by com.sleepycat.je.utilint.DaemonThread
      extended by com.sleepycat.je.recovery.Checkpointer
All Implemented Interfaces:
Runnable

public class Checkpointer
extends DaemonThread

The Checkpointer looks through the tree for internal nodes that must be flushed to the log. Checkpoint flushes must be done in ascending order from the bottom of the tree up.


Nested Class Summary
(package private) static class Checkpointer.CheckpointReference
           
 
Field Summary
 
Fields inherited from class com.sleepycat.je.utilint.DaemonThread
name, nWakeupRequests, workQueue, workQueueLatch
 
Constructor Summary
Checkpointer(EnvironmentImpl envImpl, long waitTime, String name)
           
 
Method Summary
 void clearEnv()
           
 void doCheckpoint(CheckpointConfig config, boolean flushAll, String invokingSource)
          The real work to do a checkpoint.
 long getFirstActiveLsn()
           
 int getHighestFlushLevel()
           
static long getWakeupPeriod(DbConfigManager configManager)
          Figure out the wakeup period.
 void loadStats(StatsConfig config, EnvironmentStats stat)
          Load stats.
protected  int nDeadlockRetries()
          Return the number of retries when a deadlock exception occurs.
protected  void onWakeup()
          Called whenever the DaemonThread wakes up from a sleep.
 void setCheckpointId(long lastCheckpointId)
          Set checkpoint id -- can only be done after recovery.
 void setFirstActiveLsn(long lastFirstActiveLsn)
          Initialize the FirstActiveLsn during recovery.
 String toString()
           
 
Methods inherited from class com.sleepycat.je.utilint.DaemonThread
addToQueue, addToQueueAlreadyLatched, getNWakeupRequests, getQueueSize, getThread, isRunning, isShutdownRequested, requestShutdown, run, runOrPause, shutdown, wakeup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Checkpointer

public Checkpointer(EnvironmentImpl envImpl,
                    long waitTime,
                    String name)
             throws DatabaseException
Throws:
DatabaseException
Method Detail

getHighestFlushLevel

public int getHighestFlushLevel()

getWakeupPeriod

public static long getWakeupPeriod(DbConfigManager configManager)
                            throws IllegalArgumentException,
                                   DatabaseException
Figure out the wakeup period. Supplied through this static method because we need to pass wakeup period to the superclass and need to do the calcuation outside this constructor.

Throws:
IllegalArgumentException
DatabaseException

setCheckpointId

public void setCheckpointId(long lastCheckpointId)
Set checkpoint id -- can only be done after recovery.


toString

public String toString()
Overrides:
toString in class DaemonThread

loadStats

public void loadStats(StatsConfig config,
                      EnvironmentStats stat)
               throws DatabaseException
Load stats.

Throws:
DatabaseException

getFirstActiveLsn

public long getFirstActiveLsn()
Returns:
the first active LSN point of the last completed checkpoint. If no checkpoint has run, return null.

setFirstActiveLsn

public void setFirstActiveLsn(long lastFirstActiveLsn)
Initialize the FirstActiveLsn during recovery. The cleaner needs this.


clearEnv

public void clearEnv()

nDeadlockRetries

protected int nDeadlockRetries()
                        throws DatabaseException
Return the number of retries when a deadlock exception occurs.

Overrides:
nDeadlockRetries in class DaemonThread
Throws:
DatabaseException

onWakeup

protected void onWakeup()
                 throws DatabaseException
Called whenever the DaemonThread wakes up from a sleep.

Specified by:
onWakeup in class DaemonThread
Throws:
DatabaseException

doCheckpoint

public void doCheckpoint(CheckpointConfig config,
                         boolean flushAll,
                         String invokingSource)
                  throws DatabaseException
The real work to do a checkpoint. This may be called by the checkpoint thread when waking up, or it may be invoked programatically through the api.

Parameters:
allowDeltas - if true, this checkpoint may opt to log BIN deltas instead of the full node.
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)
Throws:
DatabaseException


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.