Class DefaultStoreFileManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.DefaultStoreFileManager
- All Implemented Interfaces:
StoreFileManager
Default implementation of StoreFileManager. Not thread-safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final CellComparatorprivate final CompactionConfigurationprivate 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 static final org.slf4j.Loggerprivate final Comparator<HStoreFile>private org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile>List of store files inside this store. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultStoreFileManager(CellComparator cellComparator, Comparator<HStoreFile> storeFileComparator, org.apache.hadoop.conf.Configuration conf, CompactionConfiguration comConf) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompactionResults(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 intReturns the number of compacted files.doublefinal Collection<HStoreFile>getFilesForScan(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow) Gets the store files to scan for a Scan or Get request.final Optional<byte[]>Gets the split point for the split of this set of store files (approx.intReturns The store compaction priority.final intReturns 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) voidAdds new files, either for from MemStore flush or bulk insert, into the structure.voidloadFiles(List<HStoreFile> storeFiles) Loads the initial store files into empty StoreFileManager.voidremoveCompactedFiles(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
private volatile org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile> storefilesList of store files inside this store. This is an immutable list that is atomically replaced when its contents change. -
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.
-
-
Constructor Details
-
DefaultStoreFileManager
public DefaultStoreFileManager(CellComparator cellComparator, Comparator<HStoreFile> storeFileComparator, org.apache.hadoop.conf.Configuration conf, CompactionConfiguration comConf)
-
-
Method Details
-
loadFiles
Description copied from interface:StoreFileManagerLoads the initial store files into empty StoreFileManager.- Specified by:
loadFilesin interfaceStoreFileManager- Parameters:
storeFiles- The files to load.
-
getStorefiles
Description copied from interface:StoreFileManagerGets 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:
getStorefilesin interfaceStoreFileManager- Returns:
- The list of StoreFiles.
-
getCompactedfiles
Description copied from interface:StoreFileManagerList 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:
getCompactedfilesin interfaceStoreFileManager- Returns:
- the list of compacted files
-
insertNewFiles
Description copied from interface:StoreFileManagerAdds new files, either for from MemStore flush or bulk insert, into the structure.- Specified by:
insertNewFilesin interfaceStoreFileManager- Parameters:
sfs- New store files.
-
clearFiles
public org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> clearFiles()Description copied from interface:StoreFileManagerClears all the files currently in use and returns them.- Specified by:
clearFilesin interfaceStoreFileManager- Returns:
- The files previously in use.
-
clearCompactedFiles
Description copied from interface:StoreFileManagerClears all the compacted files and returns them. This method is expected to be accessed single threaded.- Specified by:
clearCompactedFilesin interfaceStoreFileManager- Returns:
- The files compacted previously.
-
getStorefileCount
Description copied from interface:StoreFileManagerReturns the number of files currently in use.- Specified by:
getStorefileCountin interfaceStoreFileManager- Returns:
- The number of files.
-
getCompactedFilesCount
Description copied from interface:StoreFileManagerReturns the number of compacted files.- Specified by:
getCompactedFilesCountin interfaceStoreFileManager- Returns:
- The number of files.
-
addCompactionResults
public void addCompactionResults(Collection<HStoreFile> newCompactedfiles, Collection<HStoreFile> results) Description copied from interface:StoreFileManagerAdds only the new compaction results into the structure.- Specified by:
addCompactionResultsin interfaceStoreFileManager- Parameters:
newCompactedfiles- The input files for the compaction.results- The resulting files for the compaction.
-
removeCompactedFiles
Description copied from interface:StoreFileManagerRemove the compacted files- Specified by:
removeCompactedFilesin interfaceStoreFileManager- Parameters:
removedCompactedfiles- the list of compacted files
-
getCandidateFilesForRowKeyBefore
Description copied from interface:StoreFileManagerGets initial, full list of candidate store files to check for row-key-before.- Specified by:
getCandidateFilesForRowKeyBeforein 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:StoreFileManagerUpdates 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:
updateCandidateFilesForRowKeyBeforein 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:StoreFileManagerGets the split point for the split of this set of store files (approx. middle).- Specified by:
getSplitPointin interfaceStoreFileManager- Returns:
- The mid-point if possible.
- Throws:
IOException
-
getFilesForScan
public final Collection<HStoreFile> getFilesForScan(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow) Description copied from interface:StoreFileManagerGets the store files to scan for a Scan or Get request.- Specified by:
getFilesForScanin interfaceStoreFileManager- Parameters:
startRow- Start row of the request.stopRow- Stop row of the request.- Returns:
- The list of files that are to be read for this request.
-
getStoreCompactionPriority
Description copied from interface:StoreFileManagerReturns The store compaction priority.- Specified by:
getStoreCompactionPriorityin interfaceStoreFileManager
-
getUnneededFiles
- Specified by:
getUnneededFilesin 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:
getCompactionPressurein interfaceStoreFileManager- Returns:
- the compaction pressure used for compaction throughput tuning.
- See Also:
-
getStoreFileComparator
- Specified by:
getStoreFileComparatorin interfaceStoreFileManager- Returns:
- the comparator used to sort storefiles. Usually, the
HStoreFile.getMaxSequenceId()is the first priority.
-