public class FileSelector
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileSelector.CheckpointStartCleanerState
Holds copy of all checkpoint-dependent cleaner state.
|
Constructor and Description |
---|
FileSelector() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addCleanedFile(java.lang.Long fileNum,
java.util.Set<DatabaseId> databases,
VLSN lastVlsn,
MemoryBudget budget)
When cleaning is complete, move the file from the BEING_CLEANED to
CLEANED.
|
(package private) boolean |
addPendingDB(DatabaseId dbId)
Adds the given DatabaseId to the pending DB set.
|
(package private) boolean |
addPendingLN(long originalLsn,
LN ln,
DatabaseId dbId,
byte[] key)
Adds the given LN info to the pending LN set.
|
(package private) void |
close(MemoryBudget budget)
Update memory budgets when the environment is closed and will never be
accessed again.
|
(package private) java.util.SortedSet<java.lang.Long> |
copySafeToDeleteFiles()
Returns a copy of the SAFE_TO_DELETE files, or null if there are none.
|
(package private) int |
getBacklog()
Returns the number of files waiting TO_BE_CLEANED.
|
(package private) java.util.Set<DatabaseId> |
getCleanedDatabases(java.util.Collection<java.lang.Long> fileNums)
Returns a copy of the databases for a collection of cleaned files, or
null if there are none.
|
(package private) FileSelector.CheckpointStartCleanerState |
getFilesAtCheckpointStart()
Returns a copy of the CLEANED and FULLY_PROCESSED files at the time a
checkpoint starts.
|
(package private) VLSN |
getLastVLSN(java.lang.Long fileNum)
Returns the last VLSN for a cleaned file.
|
(package private) java.util.Set<java.lang.Long> |
getLowUtilizationFiles()
Returns a read-only set of low utilization files that can be accessed
without synchronization.
|
(package private) DatabaseId[] |
getPendingDBs()
Returns an array of DatabaseIds for DBs that were pending deletion in a
prior cleaning attempt, or null if no DBs are pending.
|
(package private) java.util.Map<java.lang.Long,LNInfo> |
getPendingLNs()
Returns a map of LNInfo for LNs that could not be migrated in a prior
cleaning attempt, or null if no LNs are pending.
|
(package private) java.util.Set<java.lang.Long> |
getToBeCleanedFiles()
Returns a read-only copy of TO_BE_CLEANED files that can be accessed
without synchronization.
|
void |
injectFileForCleaning(java.lang.Long fileNum)
For unit testing.
|
(package private) boolean |
isFileCleaningInProgress(java.lang.Long fileNum)
Returns whether the file is in any stage of the cleaning process.
|
(package private) StatGroup |
loadStats()
Loads file selection stats.
|
(package private) void |
putBackFileForCleaning(java.lang.Long fileNum)
When file cleaning is aborted, move the file back from BEING_CLEANED to
TO_BE_CLEANED.
|
(package private) void |
removeAllFileReferences(java.lang.Long fileNum,
MemoryBudget budget)
Removes all references to a file.
|
(package private) void |
removeDeletedFile(java.lang.Long fileNum,
MemoryBudget budget)
Removes file information after the log file itself has finally been
deleted.
|
(package private) void |
removePendingDB(DatabaseId dbId)
Removes the DatabaseId from the pending DB set.
|
(package private) void |
removePendingLN(long originalLsn)
Removes the LN for the given LSN from the pending LN set.
|
(package private) java.lang.Long |
selectFileForCleaning(UtilizationCalculator calculator,
java.util.SortedMap<java.lang.Long,FileSummary> fileSummaryMap,
boolean forceCleaning,
boolean calcLowUtilizationFiles,
int maxBatchFiles)
Returns the best file that qualifies for cleaning, or null if no file
qualifies.
|
(package private) java.lang.Long |
selectFileForCorrection(UtilizationCalculator calculator,
java.util.SortedMap<java.lang.Long,FileSummary> fileSummaryMap)
Returns the best file for correcting utilization, or null if correction
is not needed.
|
java.lang.String |
toString() |
(package private) void |
updateFilesAtCheckpointEnd(FileSelector.CheckpointStartCleanerState info)
When a checkpoint is complete, move the previously CLEANED and
FULLY_PROCESSED files to the CHECKPOINTED and SAFE_TO_DELETE status.
|
java.lang.Long selectFileForCleaning(UtilizationCalculator calculator, java.util.SortedMap<java.lang.Long,FileSummary> fileSummaryMap, boolean forceCleaning, boolean calcLowUtilizationFiles, int maxBatchFiles)
forceCleaning
- is true to always select a file, even if its
utilization is above the minimum utilization threshold.calcLowUtilizationFiles
- whether to recalculate the set of files
that are below the minimum utilization threshold.maxBatchFiles
- is the maximum number of files to be selected at
one time, or zero if there is no limit.java.lang.Long selectFileForCorrection(UtilizationCalculator calculator, java.util.SortedMap<java.lang.Long,FileSummary> fileSummaryMap)
boolean isFileCleaningInProgress(java.lang.Long fileNum)
void removeAllFileReferences(java.lang.Long fileNum, MemoryBudget budget)
void putBackFileForCleaning(java.lang.Long fileNum)
public void injectFileForCleaning(java.lang.Long fileNum)
void addCleanedFile(java.lang.Long fileNum, java.util.Set<DatabaseId> databases, VLSN lastVlsn, MemoryBudget budget)
java.util.Set<java.lang.Long> getLowUtilizationFiles()
java.util.Set<java.lang.Long> getToBeCleanedFiles()
int getBacklog()
FileSelector.CheckpointStartCleanerState getFilesAtCheckpointStart()
void updateFilesAtCheckpointEnd(FileSelector.CheckpointStartCleanerState info)
boolean addPendingLN(long originalLsn, LN ln, DatabaseId dbId, byte[] key)
java.util.Map<java.lang.Long,LNInfo> getPendingLNs()
void removePendingLN(long originalLsn)
boolean addPendingDB(DatabaseId dbId)
DatabaseId[] getPendingDBs()
void removePendingDB(DatabaseId dbId)
java.util.SortedSet<java.lang.Long> copySafeToDeleteFiles()
java.util.Set<DatabaseId> getCleanedDatabases(java.util.Collection<java.lang.Long> fileNums)
VLSN getLastVLSN(java.lang.Long fileNum)
void removeDeletedFile(java.lang.Long fileNum, MemoryBudget budget)
void close(MemoryBudget budget)
StatGroup loadStats()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2012 Oracle. All rights reserved.