Class DefaultStoreFileManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.DefaultStoreFileManager
- All Implemented Interfaces:
StoreFileManager
Default implementation of StoreFileManager. Not thread-safe.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private final CellComparator
private final CompactionConfiguration
private org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile>
List of compacted files inside this store that needs to be excluded in reads because further new reads will be using only the newly created files out of compaction.private final boolean
private static final org.slf4j.Logger
private final Comparator<HStoreFile>
-
Constructor Summary
ConstructorDescriptionDefaultStoreFileManager
(CellComparator cellComparator, Comparator<HStoreFile> storeFileComparator, org.apache.hadoop.conf.Configuration conf, CompactionConfiguration comConf) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCompactionResults
(Collection<HStoreFile> newCompactedfiles, Collection<HStoreFile> results) Adds only the new compaction results into the structure.Clears all the compacted files and returns them.org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile>
Clears all the files currently in use and returns them.final Iterator<HStoreFile>
getCandidateFilesForRowKeyBefore
(KeyValue targetKey) Gets initial, full list of candidate store files to check for row-key-before.List of compacted files inside this store that needs to be excluded in reads because further new reads will be using only the newly created files out of compaction.final int
Returns the number of compacted files.double
getFilesForScan
(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow, boolean onlyLatestVersion) Gets the store files to scan for a Scan or Get request.private List<HStoreFile>
getLiveFiles
(Collection<HStoreFile> storeFiles) final Optional<byte[]>
Gets the split point for the split of this set of store files (approx.int
Returns The store compaction priority.final int
Returns the number of files currently in use.final Collection<HStoreFile>
Gets the snapshot of the store files currently in use.getUnneededFiles
(long maxTs, List<HStoreFile> filesCompacting) void
Adds new files, either for from MemStore flush or bulk insert, into the structure.void
loadFiles
(List<HStoreFile> storeFiles) Loads the initial store files into empty StoreFileManager.void
removeCompactedFiles
(Collection<HStoreFile> removedCompactedfiles) Remove the compacted filesupdateCandidateFilesForRowKeyBefore
(Iterator<HStoreFile> candidateFiles, KeyValue targetKey, Cell candidate) Updates the candidate list for finding row key before.
-
Field Details
-
LOG
-
cellComparator
-
comConf
-
blockingFileCount
-
storeFileComparator
-
storeFiles
-
compactedfiles
private volatile org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile> compactedfilesList of compacted files inside this store that needs to be excluded in reads because further new reads will be using only the newly created files out of compaction. These compacted files will be deleted/cleared once all the existing readers on these compacted files are done. -
enableLiveFileTracking
-
-
Constructor Details
-
DefaultStoreFileManager
public DefaultStoreFileManager(CellComparator cellComparator, Comparator<HStoreFile> storeFileComparator, org.apache.hadoop.conf.Configuration conf, CompactionConfiguration comConf)
-
-
Method Details
-
getLiveFiles
- Throws:
IOException
-
loadFiles
Description copied from interface:StoreFileManager
Loads the initial store files into empty StoreFileManager.- Specified by:
loadFiles
in interfaceStoreFileManager
- Parameters:
storeFiles
- The files to load.- Throws:
IOException
-
getStoreFiles
Description copied from interface:StoreFileManager
Gets the snapshot of the store files currently in use. Can be used for things like metrics and checks; should not assume anything about relations between store files in the list.- Specified by:
getStoreFiles
in interfaceStoreFileManager
- Returns:
- The list of StoreFiles.
-
getCompactedfiles
Description copied from interface:StoreFileManager
List of compacted files inside this store that needs to be excluded in reads because further new reads will be using only the newly created files out of compaction. These compacted files will be deleted/cleared once all the existing readers on these compacted files are done.- Specified by:
getCompactedfiles
in interfaceStoreFileManager
- Returns:
- the list of compacted files
-
insertNewFiles
Description copied from interface:StoreFileManager
Adds new files, either for from MemStore flush or bulk insert, into the structure.- Specified by:
insertNewFiles
in interfaceStoreFileManager
- Parameters:
sfs
- New store files.- Throws:
IOException
-
clearFiles
public org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> clearFiles()Description copied from interface:StoreFileManager
Clears all the files currently in use and returns them.- Specified by:
clearFiles
in interfaceStoreFileManager
- Returns:
- The files previously in use.
-
clearCompactedFiles
Description copied from interface:StoreFileManager
Clears all the compacted files and returns them. This method is expected to be accessed single threaded.- Specified by:
clearCompactedFiles
in interfaceStoreFileManager
- Returns:
- The files compacted previously.
-
getStorefileCount
Description copied from interface:StoreFileManager
Returns the number of files currently in use.- Specified by:
getStorefileCount
in interfaceStoreFileManager
- Returns:
- The number of files.
-
getCompactedFilesCount
Description copied from interface:StoreFileManager
Returns the number of compacted files.- Specified by:
getCompactedFilesCount
in interfaceStoreFileManager
- Returns:
- The number of files.
-
addCompactionResults
public void addCompactionResults(Collection<HStoreFile> newCompactedfiles, Collection<HStoreFile> results) throws IOException Description copied from interface:StoreFileManager
Adds only the new compaction results into the structure.- Specified by:
addCompactionResults
in interfaceStoreFileManager
- Parameters:
newCompactedfiles
- The input files for the compaction.results
- The resulting files for the compaction.- Throws:
IOException
-
removeCompactedFiles
Description copied from interface:StoreFileManager
Remove the compacted files- Specified by:
removeCompactedFiles
in interfaceStoreFileManager
- Parameters:
removedCompactedfiles
- the list of compacted files
-
getCandidateFilesForRowKeyBefore
Description copied from interface:StoreFileManager
Gets initial, full list of candidate store files to check for row-key-before.- Specified by:
getCandidateFilesForRowKeyBefore
in interfaceStoreFileManager
- Parameters:
targetKey
- The key that is the basis of the search.- Returns:
- The files that may have the key less than or equal to targetKey, in reverse order of new-ness, and preference for target key.
-
updateCandidateFilesForRowKeyBefore
public Iterator<HStoreFile> updateCandidateFilesForRowKeyBefore(Iterator<HStoreFile> candidateFiles, KeyValue targetKey, Cell candidate) Description copied from interface:StoreFileManager
Updates the candidate list for finding row key before. Based on the list of candidates remaining to check from getCandidateFilesForRowKeyBefore, targetKey and current candidate, may trim and reorder the list to remove the files where a better candidate cannot be found.- Specified by:
updateCandidateFilesForRowKeyBefore
in interfaceStoreFileManager
- Parameters:
candidateFiles
- The candidate files not yet checked for better candidates - return value fromStoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue)
, with some files already removed.targetKey
- The key to search for.candidate
- The current best candidate found.- Returns:
- The list to replace candidateFiles.
-
getSplitPoint
Description copied from interface:StoreFileManager
Gets the split point for the split of this set of store files (approx. middle).- Specified by:
getSplitPoint
in interfaceStoreFileManager
- Returns:
- The mid-point if possible.
- Throws:
IOException
-
getFilesForScan
public Collection<HStoreFile> getFilesForScan(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow, boolean onlyLatestVersion) Description copied from interface:StoreFileManager
Gets the store files to scan for a Scan or Get request.- Specified by:
getFilesForScan
in interfaceStoreFileManager
- Parameters:
startRow
- Start row of the request.stopRow
- Stop row of the request.onlyLatestVersion
- Scan only latest live version cells.- Returns:
- The list of files that are to be read for this request.
-
getStoreCompactionPriority
Description copied from interface:StoreFileManager
Returns The store compaction priority.- Specified by:
getStoreCompactionPriority
in interfaceStoreFileManager
-
getUnneededFiles
- Specified by:
getUnneededFiles
in interfaceStoreFileManager
- Parameters:
maxTs
- Maximum expired timestamp.filesCompacting
- Files that are currently compacting.- Returns:
- The files which don't have any necessary data according to TTL and other criteria.
-
getCompactionPressure
- Specified by:
getCompactionPressure
in interfaceStoreFileManager
- Returns:
- the compaction pressure used for compaction throughput tuning.
- See Also:
-
getStoreFileComparator
- Specified by:
getStoreFileComparator
in interfaceStoreFileManager
- Returns:
- the comparator used to sort storefiles. Usually, the
HStoreFile.getMaxSequenceId()
is the first priority.
-