com.sleepycat.je.cleaner
Class BaseUtilizationTracker

java.lang.Object
  extended by com.sleepycat.je.cleaner.BaseUtilizationTracker
Direct Known Subclasses:
LocalUtilizationTracker, RecoveryUtilizationTracker, UtilizationTracker

public abstract class BaseUtilizationTracker
extends java.lang.Object

Shared implementation for all utilization trackers. The base implementation keeps track of per-file utilization info only. Subclasses keep track of per-database info.


Method Summary
 void countObsoleteDb(DbFileSummaryMap dbFileSummaries, long mapLnLsn)
          Counts all active LSNs in a database as obsolete in the per-file utilization summaries.
 EnvironmentImpl getEnvironment()
           
 TrackedFileSummary getTrackedFile(long fileNum)
          Returns one file from the snapshot of tracked files, or null if the given file number is not in the snapshot array.
 java.util.Collection<TrackedFileSummary> getTrackedFiles()
          Returns a snapshot of the files being tracked as of the last time a log entry was added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEnvironment

public EnvironmentImpl getEnvironment()

getTrackedFiles

public java.util.Collection<TrackedFileSummary> getTrackedFiles()
Returns a snapshot of the files being tracked as of the last time a log entry was added. The summary info returned is the delta since the last checkpoint, not the grand totals, and is approximate since it is changing in real time. This method may be called without holding the log write latch.

If files are added or removed from the collection of tracked files in real time, the returned collection will not be changed since it is a snapshot. But the objects contained in the collection are live and will be updated in real time under the log write latch. The collection and the objects in the collection should not be modified by the caller.


getTrackedFile

public TrackedFileSummary getTrackedFile(long fileNum)
Returns one file from the snapshot of tracked files, or null if the given file number is not in the snapshot array.

See Also:
getTrackedFiles()

countObsoleteDb

public void countObsoleteDb(DbFileSummaryMap dbFileSummaries,
                            long mapLnLsn)
Counts all active LSNs in a database as obsolete in the per-file utilization summaries. This method is called during database remove/truncate or when replaying those operations during recovery.

For the global tracker, must be called under the log write latch.

Parameters:
dbFileSummaries - the map of Long file number to DbFileSummary for a database that is being deleted.
mapLnLsn - is the LSN of the MapLN when recovery is replaying the truncate/remove, or NULL_LSN when called outside of recovery; obsolete totals should only be counted when this LSN is prior to the LSN of the FileSummaryLN for the file being counted.