com.sleepycat.je.recovery
Class DirtyINMap

java.lang.Object
  extended by com.sleepycat.je.recovery.DirtyINMap

 class DirtyINMap
extends Object

Map of Integer->Set level->Set of checkpoint references


Constructor Summary
DirtyINMap(EnvironmentImpl envImpl)
           
 
Method Summary
(package private)  void addCostToMemoryBudget()
           
(package private)  Integer addIN(IN in, boolean updateMemoryBudget)
          Add a node unconditionally to the dirty map.
(package private)  boolean containsNode(Integer level, Long nodeId)
           
(package private)  void flushMapLNs(long checkpointStart)
          Flushes all saved dirty/temp MapLNs and clears the saved set.
(package private)  void flushRoot(long checkpointStart)
          Flushes the DB mapping tree root at the end of the checkpoint, if either mapping DB is dirty and the root was not flushed previously during the checkpoint.
(package private)  Iterator<Checkpointer.CheckpointReference> getIterator(Integer level)
          Get an iterator over the references corresponding to the given level.
(package private)  Integer getLowestLevelSet()
          Get the lowest level currently stored in the map.
(package private)  int getNumLevels()
           
(package private)  void removeCostFromMemoryBudget()
           
(package private)  void removeLevel(Integer level)
          Removes the set corresponding to the given level.
(package private)  Checkpointer.CheckpointReference removeNextNode(Integer level)
           
(package private)  Checkpointer.CheckpointReference removeNode(Integer level, Long nodeId)
           
(package private)  Map<DatabaseImpl,Integer> selectDirtyINsForCheckpoint(boolean flushAll, boolean flushExtraLevel)
          Scan the INList for all dirty INs, excluding temp DB INs.
(package private)  Map<DatabaseImpl,Integer> selectDirtyINsForDbSync(DatabaseImpl dbImpl)
          Scan the INList for all dirty INs for a given database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirtyINMap

DirtyINMap(EnvironmentImpl envImpl)
Method Detail

selectDirtyINsForCheckpoint

Map<DatabaseImpl,Integer> selectDirtyINsForCheckpoint(boolean flushAll,
                                                      boolean flushExtraLevel)
                                                throws DatabaseException
Scan the INList for all dirty INs, excluding temp DB INs. Save them in a tree-level ordered map for level ordered flushing. Take this opportunity to reset the memory budget tree value.

Returns:
highestFlushLevels, map of DatabaseImpl to Integer.
Throws:
DatabaseException

selectDirtyINsForDbSync

Map<DatabaseImpl,Integer> selectDirtyINsForDbSync(DatabaseImpl dbImpl)
                                            throws DatabaseException
Scan the INList for all dirty INs for a given database. Arrange them in level sorted map for level ordered flushing.

Returns:
highestFlushLevels, map of DatabaseImpl to Integer.
Throws:
DatabaseException

getNumLevels

int getNumLevels()

addCostToMemoryBudget

void addCostToMemoryBudget()

removeCostFromMemoryBudget

void removeCostFromMemoryBudget()

addIN

Integer addIN(IN in,
              boolean updateMemoryBudget)
Add a node unconditionally to the dirty map. The dirty map is keyed by level (Integers) and holds sets of IN references.

Parameters:
updateMemoryBudget - if true then update the memory budget as the map is changed; if false then addCostToMemoryBudget must be called later.
Returns:
level of IN added to the dirty map. The level is returned rather than a boolean simply to avoid allocating another Integer in the caller.

getLowestLevelSet

Integer getLowestLevelSet()
Get the lowest level currently stored in the map.


getIterator

Iterator<Checkpointer.CheckpointReference> getIterator(Integer level)
Get an iterator over the references corresponding to the given level.


removeLevel

void removeLevel(Integer level)
Removes the set corresponding to the given level.


containsNode

boolean containsNode(Integer level,
                     Long nodeId)

removeNode

Checkpointer.CheckpointReference removeNode(Integer level,
                                            Long nodeId)

removeNextNode

Checkpointer.CheckpointReference removeNextNode(Integer level)

flushMapLNs

void flushMapLNs(long checkpointStart)
           throws DatabaseException
Flushes all saved dirty/temp MapLNs and clears the saved set.

If dirty, a MapLN must be flushed at each checkpoint to record updated utilization info in the checkpoint interval. If it is a temporary DB, the MapLN must be flushed because all temp DBs must be encountered by recovery so they can be removed if they were not closed (and removed) by the user.

Parameters:
checkpointStart - start LSN of the checkpoint in progress. To reduce unnecessary logging, the MapLN is only flushed if it has not been written since that LSN.
Throws:
DatabaseException

flushRoot

void flushRoot(long checkpointStart)
         throws DatabaseException
Flushes the DB mapping tree root at the end of the checkpoint, if either mapping DB is dirty and the root was not flushed previously during the checkpoint.

Parameters:
checkpointStart - start LSN of the checkpoint in progress. To reduce unnecessary logging, the Root is only flushed if it has not been written since that LSN.
Throws:
DatabaseException


Copyright (c) 2004-2010 Oracle. All rights reserved.