com.sleepycat.je.cleaner
Class LocalUtilizationTracker

java.lang.Object
  extended by com.sleepycat.je.cleaner.BaseUtilizationTracker
      extended by com.sleepycat.je.cleaner.BaseLocalUtilizationTracker
          extended by com.sleepycat.je.cleaner.LocalUtilizationTracker

public class LocalUtilizationTracker
extends BaseLocalUtilizationTracker

Accumulates changes to the utilization profile locally in a single thread.

Per-database information is keyed by DatabaseImpl so that no tree lookup of a database is required (as when a DatabaseId is used).

The countNewLogEntry, countObsoleteNode and countObsoleteNodeInexact methods may be called without taking the log write latch. Totals and offset are accumulated locally in this object only, not in DatabaseImpl objects.

When finished with this object, its information should be added to the Environment's UtilizationTracker and DatabaseImpl objects by calling transferToUtilizationTracker under the log write latch. This is done in the Checkpointer, Evictor and INCompressor by calling UtilizationProfile.flushLocalTracker which calls LogManager.transferToUtilizationTracker which calls BaseLocalUtilizationTracker.transferToUtilizationTracker.


Field Summary
 
Fields inherited from class com.sleepycat.je.cleaner.BaseUtilizationTracker
bytesSinceActivate, cleaner, env
 
Constructor Summary
LocalUtilizationTracker(EnvironmentImpl env)
           
 
Method Summary
 void countNewLogEntry(long lsn, LogEntryType type, int size, DatabaseImpl db)
          Counts the addition of all new log entries including LNs.
 void countObsoleteNode(long lsn, LogEntryType type, int size, DatabaseImpl db)
          Counts a node that has become obsolete and tracks the LSN offset, if non-zero, to avoid a lookup during cleaning.
 void countObsoleteNodeInexact(long lsn, LogEntryType type, int size, DatabaseImpl db)
          Counts as countObsoleteNode does, but since the LSN may be inexact, does not track the obsolete LSN offset.
(package private)  DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
          Returns the DatabaseImpl from the database key, which in this case is the DatabaseImpl.
 Set<Object> getTrackedDbs()
           
(package private)  void releaseDatabaseImpl(DatabaseImpl db)
          Do nothing, since DbTree.getDb was not called by databaseKeyToDatabaseImpl.
 
Methods inherited from class com.sleepycat.je.cleaner.BaseLocalUtilizationTracker
getDatabaseMap, getDbFileSummary, removeDbFileSummaries, transferToUtilizationTracker
 
Methods inherited from class com.sleepycat.je.cleaner.BaseUtilizationTracker
close, countNew, countObsolete, countObsoleteDb, getEnvironment, getFileSummary, getTrackedFile, getTrackedFiles, isFileUncounted, isLNType, isNodeType, resetFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalUtilizationTracker

public LocalUtilizationTracker(EnvironmentImpl env)
Method Detail

countNewLogEntry

public void countNewLogEntry(long lsn,
                             LogEntryType type,
                             int size,
                             DatabaseImpl db)
Counts the addition of all new log entries including LNs.


countObsoleteNode

public void countObsoleteNode(long lsn,
                              LogEntryType type,
                              int size,
                              DatabaseImpl db)
Counts a node that has become obsolete and tracks the LSN offset, if non-zero, to avoid a lookup during cleaning.

A zero LSN offset is used as a special value when obsolete offset tracking is not desired. [#15365] The file header entry (at offset zero) is never counted as obsolete, it is assumed to be obsolete by the cleaner.

This method should only be called for LNs and INs (i.e, only for nodes). If type is null we assume it is an LN.


countObsoleteNodeInexact

public void countObsoleteNodeInexact(long lsn,
                                     LogEntryType type,
                                     int size,
                                     DatabaseImpl db)
Counts as countObsoleteNode does, but since the LSN may be inexact, does not track the obsolete LSN offset.

This method should only be called for LNs and INs (i.e, only for nodes). If type is null we assume it is an LN.


getTrackedDbs

public Set<Object> getTrackedDbs()

databaseKeyToDatabaseImpl

DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
Returns the DatabaseImpl from the database key, which in this case is the DatabaseImpl.

Specified by:
databaseKeyToDatabaseImpl in class BaseLocalUtilizationTracker

releaseDatabaseImpl

void releaseDatabaseImpl(DatabaseImpl db)
Do nothing, since DbTree.getDb was not called by databaseKeyToDatabaseImpl.

Specified by:
releaseDatabaseImpl in class BaseLocalUtilizationTracker


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