| java.lang.Object com.sleepycat.je.cleaner.Cleaner
Cleaner | public class Cleaner implements DaemonRunner,EnvConfigObserver(Code) | | The Cleaner is responsible for effectively garbage collecting the JE log.
It looks through log files and locates log records (IN's and LN's of all
flavors) that are superceded by later versions. Those that are "current"
are propagated to a newer log file so that older log files can be deleted.
|
Method Summary | |
void | addPendingDB(DatabaseImpl db) Adds the DB ID to the pending DB set if it is being deleted but deletion
is not yet complete. | public void | clearDeleteProhibited() | void | deleteSafeToDeleteFiles() Deletes all files that are safe-to-delete, if there are no read/only
processes and concurrent backups.
Deletion is coordinated by the synchronization variable deleteFileLock
AND by the deleteProhibited state variable. | public int | doClean(boolean cleanMultipleFiles, boolean forceCleaning) Cleans selected files and returns the number of files cleaned. | public void | envConfigUpdate(DbConfigManager cm) Process notifications of mutable property changes. | public boolean | getFetchObsoleteSize() | public CheckpointStartCleanerState | getFilesAtCheckpointStart() Returns a copy of the cleaned and processed files at the time a
checkpoint starts. | public int | getNWakeupRequests() | public UtilizationProfile | getUtilizationProfile() | public UtilizationTracker | getUtilizationTracker() | void | injectFileForCleaning(Long fileNum) For unit testing. | public boolean | isEvictable(BIN bin, int index) Returns whether the given BIN entry may be stripped by the evictor.
True is always returned if the BIN is not dirty. | public void | lazyMigrateDupCountLN(DIN din, ChildReference dclRef, boolean proactiveMigration) This method should be called just before logging a root DIN. | public void | lazyMigrateLNs(BIN bin, boolean proactiveMigration, boolean backgroundIO) This method should be called just before logging a BIN. | public void | loadStats(StatsConfig config, EnvironmentStats stat) Load stats. | void | processPending() If any LNs are pending, process them. | public void | requestShutdown() | public void | runOrPause(boolean run) | public void | setDeleteProhibited() | public void | shutdown() | void | trace(Level level, String action, Node node, long logLsn, boolean completed, boolean obsolete, boolean dirtiedMigrated) Send trace messages to the java.util.logger. | public void | updateFilesAtCheckpointEnd(CheckpointStartCleanerState info) When a checkpoint is complete, update the files that were returned at
the beginning of the checkpoint. | public void | updateReadOnlyFileCollections() Update the lowUtilizationFiles and mustBeCleanedFiles fields with new
read-only collections, and update the backlog file count. | public void | wakeup() |
DO_CRITICAL_EVICTION | final static boolean DO_CRITICAL_EVICTION(Code) | | Whether the cleaner should participate in critical eviction. Ideally
the cleaner would not participate in eviction, since that would reduce
the cost of cleaning. However, the cleaner can add large numbers of
nodes to the cache. By not participating in eviction, other threads
could be kept in a constant state of eviction and would effectively
starve. Therefore, this setting is currently enabled.
|
PROACTIVE_MIGRATION | final static boolean PROACTIVE_MIGRATION(Code) | | Whether to fetch LNs for files in the to-be-cleaned set during lazy
migration. This is currently enabled because we do not support the
dynamic addition of cleaner threads; that way, if the configured cleaner
threads cannot keep up, we use proactive migration to keep up.
|
UPDATE_GENERATION | final static boolean UPDATE_GENERATION(Code) | | Whether to update the IN generation count during searches. This is
currently disabled because 1) we update the generation of the BIN when
we set a MIGRATE flag and 2) if the BIN is not evicted its parents will
not be, so not updating the generation during the search has no benefit.
By not updating the generation during searches for which we do NOT set
the MIGRATE flag, we avoid holding INs in the cache that are not needed
for lazy migration. However, we do very few searches for obsolete LNs
because the obsolete tracking info prevents this, so the benefit of not
updating the generation during searches is questionable. In other
words, changing this setting will have little effect.
|
cleanerBytesInterval | long cleanerBytesInterval(Code) | | |
clusterAll | boolean clusterAll(Code) | | |
clusterResident | boolean clusterResident(Code) | | |
fetchObsoleteSize | boolean fetchObsoleteSize(Code) | | |
lockTimeout | long lockTimeout(Code) | | |
lookAheadCacheSize | int lookAheadCacheSize(Code) | | |
lowUtilizationFiles | Set lowUtilizationFiles(Code) | | All files that are below the minUtilization threshold. Used to perform
clustering migration. Is read-only after assignment, so no
synchronization is needed.
|
maxBatchFiles | int maxBatchFiles(Code) | | |
mustBeCleanedFiles | Set mustBeCleanedFiles(Code) | | All files that are to-be-cleaning or being-cleaned. Used to perform
proactive migration. Is read-only after assignment, so no
synchronization is needed.
|
nBacklogFiles | int nBacklogFiles(Code) | | |
nCleanerDeletions | int nCleanerDeletions(Code) | | |
nCleanerRuns | int nCleanerRuns(Code) | | |
nClusterLNsProcessed | int nClusterLNsProcessed(Code) | | |
nDeadlockRetries | int nDeadlockRetries(Code) | | |
nEntriesRead | int nEntriesRead(Code) | | |
nINsCleaned | int nINsCleaned(Code) | | |
nINsMigrated | int nINsMigrated(Code) | | |
nINsObsolete | int nINsObsolete(Code) | | |
nLNQueueHits | int nLNQueueHits(Code) | | |
nLNsCleaned | int nLNsCleaned(Code) | | |
nLNsLocked | int nLNsLocked(Code) | | |
nLNsMarked | int nLNsMarked(Code) | | |
nLNsMigrated | int nLNsMigrated(Code) | | |
nLNsObsolete | int nLNsObsolete(Code) | | |
nMarkedLNsProcessed | int nMarkedLNsProcessed(Code) | | |
nPendingLNsLocked | int nPendingLNsLocked(Code) | | |
nPendingLNsProcessed | int nPendingLNsProcessed(Code) | | |
nRepeatIteratorReads | long nRepeatIteratorReads(Code) | | |
nToBeCleanedLNsProcessed | int nToBeCleanedLNsProcessed(Code) | | |
readBufferSize | int readBufferSize(Code) | | |
trackDetail | boolean trackDetail(Code) | | |
addPendingDB | void addPendingDB(DatabaseImpl db)(Code) | | Adds the DB ID to the pending DB set if it is being deleted but deletion
is not yet complete.
|
clearDeleteProhibited | public void clearDeleteProhibited()(Code) | | |
deleteSafeToDeleteFiles | void deleteSafeToDeleteFiles() throws DatabaseException(Code) | | Deletes all files that are safe-to-delete, if there are no read/only
processes and concurrent backups.
Deletion is coordinated by the synchronization variable deleteFileLock
AND by the deleteProhibited state variable. The reason that two
different mechanisms are use is because file deletion must be prevented
both inter and intra-process. File locks must be used for inter-process,
and the state bit for intra-process.
To guard against read/only processes, the would-be deleter tries to get
an exclusive lock on the environment. This will not be possible if a
read/only process exists.
To guard against backup mode, the would-be deleter checks the
deleteProhibited state. Backup and file deletion can only be carried out
by a read/write process, so both activities are working in the same
process. Note that file locks are not supported intra-process. The
deleteProhibited state is used rather than a simple synchronization on
deleteFileLock because the start/endBackup is controlled by the
application, and the copying of log files can take an arbitrarily long
time. Using synchronization on deleteFileLock would make it possible to
lock out a cleaner thread for an unacceptable amount of time.
|
doClean | public int doClean(boolean cleanMultipleFiles, boolean forceCleaning) throws DatabaseException(Code) | | Cleans selected files and returns the number of files cleaned. This
method is not invoked by a deamon thread, it is programatically.
Parameters: cleanMultipleFiles - is true to clean until we're under budget,or false to clean at most one file. Parameters: forceCleaning - is true to clean even if we're not under theutilization threshold. the number of files cleaned, not including files cleanedunsuccessfully. |
getFetchObsoleteSize | public boolean getFetchObsoleteSize()(Code) | | |
getFilesAtCheckpointStart | public CheckpointStartCleanerState getFilesAtCheckpointStart() throws DatabaseException(Code) | | Returns a copy of the cleaned and processed files at the time a
checkpoint starts.
If non-null is returned, the checkpoint should flush an extra level,
and addCheckpointedFiles() should be called when the checkpoint is
complete.
|
getNWakeupRequests | public int getNWakeupRequests()(Code) | | |
injectFileForCleaning | void injectFileForCleaning(Long fileNum)(Code) | | For unit testing.
|
isEvictable | public boolean isEvictable(BIN bin, int index)(Code) | | Returns whether the given BIN entry may be stripped by the evictor.
True is always returned if the BIN is not dirty. False is returned if
the BIN is dirty and the entry will be migrated soon.
|
lazyMigrateDupCountLN | public void lazyMigrateDupCountLN(DIN din, ChildReference dclRef, boolean proactiveMigration) throws DatabaseException(Code) | | This method should be called just before logging a root DIN. The
DupCountLN will be migrated if the MIGRATE flag is set, or if it is in a
file to be cleaned, or if the LN qualifies according to the rules for
cluster and clusterAll.
On return this method guarantees that the MIGRATE flag will not be
set on the child entry. If this method is *not* called before logging a
root DIN, then the addPendingDupCountLN method must be called.
Parameters: din - is the latched DIN. The latch will not be released by thismethod. Parameters: dclRef - is the reference to the DupCountLN. Parameters: proactiveMigration - perform proactive migration if needed; this isfalse during a split, to reduce the delay in the user operation. |
lazyMigrateLNs | public void lazyMigrateLNs(BIN bin, boolean proactiveMigration, boolean backgroundIO) throws DatabaseException(Code) | | This method should be called just before logging a BIN. LNs will be
migrated if the MIGRATE flag is set, or if they are in a file to be
cleaned, or if the LNs qualify according to the rules for cluster and
clusterAll.
On return this method guarantees that no MIGRATE flag will be set on
any child entry. If this method is *not* called before logging a BIN,
then the addPendingLNs method must be called.
Parameters: bin - is the latched BIN. The latch will not be released by thismethod. Parameters: proactiveMigration - perform proactive migration if needed; this isfalse during a split, to reduce the delay in the user operation. |
processPending | void processPending() throws DatabaseException(Code) | | If any LNs are pending, process them. This method should be called
often enough to prevent the pending LN set from growing too large.
|
requestShutdown | public void requestShutdown()(Code) | | |
runOrPause | public void runOrPause(boolean run)(Code) | | |
setDeleteProhibited | public void setDeleteProhibited()(Code) | | |
shutdown | public void shutdown()(Code) | | |
trace | void trace(Level level, String action, Node node, long logLsn, boolean completed, boolean obsolete, boolean dirtiedMigrated)(Code) | | Send trace messages to the java.util.logger. Don't rely on the logger
alone to conditionalize whether we send this message, we don't even want
to construct the message if the level is not enabled.
|
updateFilesAtCheckpointEnd | public void updateFilesAtCheckpointEnd(CheckpointStartCleanerState info) throws DatabaseException(Code) | | When a checkpoint is complete, update the files that were returned at
the beginning of the checkpoint.
|
updateReadOnlyFileCollections | public void updateReadOnlyFileCollections()(Code) | | Update the lowUtilizationFiles and mustBeCleanedFiles fields with new
read-only collections, and update the backlog file count.
|
wakeup | public void wakeup()(Code) | | |
|
|