|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.cleaner.UtilizationProfile
public class UtilizationProfile
The UP tracks utilization summary information for all log files.
Unlike the UtilizationTracker, the UP is not accessed under the log write latch and is instead synchronized on itself for protecting the cache. It is not accessed during the primary data access path, except for when flushing (writing) file summary LNs. This occurs in the following cases:
The cache is populated by the RecoveryManager just before performing the initial checkpoint. The UP must be open and populated in order to respond to requests to flush summaries and to evict tracked detail, even if the cleaner is disabled.
WARNING: While synchronized on this object, eviction is not permitted. If it were, this could cause deadlocks because the order of locking would be the UP object and then the evictor. During normal eviction the order is to first lock the evictor and then the UP, when evicting tracked detail.
The methods in this class synchronize to protect the cached summary information. Some methods also access the UP database. However, because eviction must not occur while synchronized, UP database access is not performed while synchronized except in one case: when inserting a new summary record. In that case we disallow eviction during the database operation.
Constructor Summary | |
---|---|
UtilizationProfile(EnvironmentImpl env,
UtilizationTracker tracker)
Creates an empty UP. |
Method Summary | |
---|---|
(package private) void |
close()
Update memory budgets when this profile is closed and will never be accessed again. |
void |
flushFileSummary(TrackedFileSummary tfs)
Updates and stores the FileSummary for a given tracked file, if flushing of the summary is allowed. |
void |
flushFileUtilization(Collection<TrackedFileSummary> activeFiles)
Flush a FileSummaryLN node for each given TrackedFileSummary. |
void |
flushLocalTracker(LocalUtilizationTracker localTracker)
Count the given locally tracked info as obsolete and then log the file and database info. |
DatabaseImpl |
getFileSummaryDb()
For unit testing. |
SortedMap<Long,FileSummary> |
getFileSummaryMap(boolean includeTrackedFiles)
Returns a copy of the current file summary map, optionally including tracked summary information, for use by the DbSpace utility and by unit tests. |
(package private) int |
getNumberOfFiles()
Returns the number of files in the profile. |
(package private) PackedOffsets |
getObsoleteDetail(Long fileNum,
boolean logUpdate)
Returns the stored/packed obsolete offsets offsets for the given file. |
(package private) long |
getTotalLogSize()
Returns an approximation of the total log size. |
boolean |
insertFileSummary(FileSummaryLN ln,
long fileNum,
int sequence)
Insert the given LN with the given key values. |
boolean |
populateCache(StartupTracker.Counter counter)
Populate the profile for file selection. |
(package private) void |
removeFile(Long fileNum,
Set<DatabaseId> databases)
Removes a file from the MapLN utilization info, the utilization database and the profile, after it has been determined that the file does not exist. |
(package private) void |
removePerDbMetadata(Collection<Long> fileNums,
Set<DatabaseId> databases)
Updates all MapLNs to remove the DbFileSummary for the given set of file. |
(package private) void |
removePerFileMetadata(Long fileNum)
Removes a file from the utilization database and the profile. |
boolean |
verifyFileSummaryDatabase()
Checks that all FSLN offsets are indeed obsolete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UtilizationProfile(EnvironmentImpl env, UtilizationTracker tracker)
Method Detail |
---|
int getNumberOfFiles()
long getTotalLogSize()
public void flushLocalTracker(LocalUtilizationTracker localTracker) throws DatabaseException
DatabaseException
public void flushFileUtilization(Collection<TrackedFileSummary> activeFiles) throws DatabaseException
DatabaseException
public SortedMap<Long,FileSummary> getFileSummaryMap(boolean includeTrackedFiles)
void removeFile(Long fileNum, Set<DatabaseId> databases) throws DatabaseException
DatabaseException
void removePerFileMetadata(Long fileNum) throws DatabaseException
DatabaseException
void removePerDbMetadata(Collection<Long> fileNums, Set<DatabaseId> databases) throws DatabaseException
DatabaseException
public void flushFileSummary(TrackedFileSummary tfs) throws DatabaseException
DatabaseException
PackedOffsets getObsoleteDetail(Long fileNum, boolean logUpdate) throws DatabaseException
logUpdate
- if true, log any updates to the utilization profile. If
false, only retrieve the new information.
DatabaseException
public boolean populateCache(StartupTracker.Counter counter) throws DatabaseException
DatabaseException
public DatabaseImpl getFileSummaryDb()
public boolean insertFileSummary(FileSummaryLN ln, long fileNum, int sequence) throws DatabaseException
DatabaseException
public boolean verifyFileSummaryDatabase() throws DatabaseException
DatabaseException
void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |