public class UtilizationProfile extends Object
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 and Description |
|---|
UtilizationProfile(EnvironmentImpl env,
UtilizationTracker tracker)
Creates an empty UP.
|
| Modifier and Type | Method and Description |
|---|---|
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
info.
|
int |
getFileSize(Long file)
Gets the size of the file.
|
SortedMap<Long,Integer> |
getFileSizeSummaryMap()
Returns a simplified copy of the current file summary map, i.e.
|
FileSummary |
getFileSummary(Long file)
Gets the base summary from the cached map.
|
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.
|
long[] |
getObsoleteDetailSorted(Long fileNum)
Returns the sorted obsolete offsets for the given file.
|
boolean |
hasFileSummaryLN(long fileNum)
Returns whether an LN exists in the file summary DB for the given file.
|
boolean |
hasReservedFileLN(long fileNum)
Returns whether an LN exists in the reserved file DB for the given file.
|
void |
populateCache(StartupTracker.Counter counter,
RecoveryInfo recoveryInfo)
Populate the profile for file selection.
|
static void |
setIncompleteReactivateHook(TestHook hook) |
public UtilizationProfile(EnvironmentImpl env, UtilizationTracker tracker)
public FileSummary getFileSummary(Long file)
public void flushLocalTracker(LocalUtilizationTracker localTracker) throws DatabaseException
DatabaseExceptionpublic void flushFileUtilization(Collection<TrackedFileSummary> activeFiles) throws DatabaseException
DatabaseExceptionpublic SortedMap<Long,FileSummary> getFileSummaryMap(boolean includeTrackedFiles)
public int getFileSize(Long file)
public SortedMap<Long,Integer> getFileSizeSummaryMap()
public long[] getObsoleteDetailSorted(Long fileNum) throws DatabaseException
DatabaseExceptionpublic void populateCache(StartupTracker.Counter counter, RecoveryInfo recoveryInfo) throws DatabaseException
DatabaseExceptionpublic boolean hasReservedFileLN(long fileNum)
public boolean hasFileSummaryLN(long fileNum)
public static void setIncompleteReactivateHook(TestHook hook)
Copyright © 2024. All rights reserved.