|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.recovery.DirtyINMap
class DirtyINMap
Manages the by-level map of checkpoint references that are to be flushed by a checkpoint or Database.sync, the MapLNs to be flushed, the highest level by database to be flushed, and the state of the checkpoint. An single instance of this class is used for checkpoints and has the same lifetime as the checkpointer and environment. An instance per Database.sync is created as needed. Only one checkpoint can occur at a time, but multiple syncs may occur concurrently with each other and with the checkpoint. The methods in this class are synchronized to protect internal state from concurrent access by the checkpointer and eviction, and to coordinate state changes between the two. Eviction must participate in the checkpoint so that INs cascade up properly; see coordinateEvictionWithCheckpoint. When INs are latched along with synchronization on a DirtyINMap, the order must be: 1) IN latches and 2) synchronize on DirtyINMap. For example, the evictor latches the parent and child IN before calling the synchronized method coordinateEvictionWithCheckpoint, and selectDirtyINsForCheckpoint latches the IN before calling the synchronized method selectForCheckpoint.
Nested Class Summary | |
---|---|
(package private) static class |
DirtyINMap.CkptState
|
Constructor Summary | |
---|---|
DirtyINMap(EnvironmentImpl envImpl)
|
Method Summary | |
---|---|
(package private) Integer |
addIN(IN in,
boolean updateMemoryBudget)
Add a node unconditionally to the dirty map. |
(package private) void |
beginCheckpoint(boolean flushAll,
boolean flushExtraLevel)
Must be called before starting a checkpoint, and must not be called for Database.sync. |
(package private) boolean |
containsNode(Integer level,
Long nodeId)
|
(package private) boolean |
coordinateEvictionWithCheckpoint(IN target,
IN parent)
Coordinates an eviction with an in-progress checkpoint and returns whether or not provisional logging is needed. |
(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) int |
getHighestFlushLevel(DatabaseImpl db)
|
(package private) Integer |
getLowestLevelSet()
Get the lowest level currently stored in the map. |
(package private) int |
getNumEntries()
|
(package private) int |
getNumLevels()
|
(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) void |
reset()
Must be called after a checkpoint or Database.sync is complete. |
(package private) void |
selectDirtyINsForCheckpoint()
Scan the INList for all dirty INs, excluding temp DB INs. |
(package private) void |
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(EnvironmentImpl envImpl)
Method Detail |
---|
boolean coordinateEvictionWithCheckpoint(IN target, IN parent)
void beginCheckpoint(boolean flushAll, boolean flushExtraLevel)
void reset()
void selectDirtyINsForCheckpoint() throws DatabaseException
DatabaseException
void selectDirtyINsForDbSync(DatabaseImpl dbImpl) throws DatabaseException
DatabaseException
int getHighestFlushLevel(DatabaseImpl db)
int getNumLevels()
Integer addIN(IN in, boolean updateMemoryBudget)
updateMemoryBudget
- if true then update the memory budget as the
map is changed; if false then addCostToMemoryBudget must be called
later.
Integer getLowestLevelSet()
void removeLevel(Integer level)
boolean containsNode(Integer level, Long nodeId)
Checkpointer.CheckpointReference removeNode(Integer level, Long nodeId)
Checkpointer.CheckpointReference removeNextNode(Integer level)
void flushMapLNs(long checkpointStart) throws DatabaseException
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.
This method is not synchronized because it takes the Btree root latch, and we must never latch something in the Btree after synchronizing on DirtyINMap; see class comments. Special synchronization is performed for accessing internal state; see below.
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.
DatabaseException
void flushRoot(long checkpointStart) throws DatabaseException
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.
DatabaseException
int getNumEntries()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |