@InterfaceAudience.Private public class StripeStoreFileManager extends Object implements StoreFileManager, StripeCompactionPolicy.StripeInformationProvider
StoreFileManager. Not thread safe - relies on external locking
(in HStore). Collections that this class returns are immutable or unique to the call, so they
should be safe. Stripe store splits the key space of the region into non-overlapping stripes, as
well as some recent files that have all the keys (level 0). Each stripe contains a set of files.
When L0 is compacted, it's split into the files corresponding to existing stripe boundaries, that
can thus be added to stripes. When scan or get happens, it only has to read the files from the
corresponding stripes. See StripeCompactionPolicy on how the stripes are determined; this
class doesn't care. This class should work together with StripeCompactionPolicy and
StripeCompactor. With regard to how they
work, we make at least the following (reasonable) assumptions: - Compaction produces one file per
new stripe (if any); that is easy to change. - Compaction has one contiguous set of stripes both
in and out, except if L0 is involved.| Modifier and Type | Field and Description |
|---|---|
static byte[] |
OPEN_KEY
The key value used for range boundary, indicating that the boundary is open (i.e.
|
static byte[] |
STRIPE_END_KEY |
static byte[] |
STRIPE_START_KEY
The file metadata fields that contain the stripe information.
|
| Constructor and Description |
|---|
StripeStoreFileManager(CellComparator kvComparator,
org.apache.hadoop.conf.Configuration conf,
StripeStoreConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompactionResults(Collection<HStoreFile> compactedFiles,
Collection<HStoreFile> results)
Adds only the new compaction results into the structure.
|
org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> |
clearCompactedFiles()
Clears all the compacted files and returns them.
|
org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> |
clearFiles()
Clears all the files currently in use and returns them.
|
Iterator<HStoreFile> |
getCandidateFilesForRowKeyBefore(KeyValue targetKey)
See
StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) for details on this
methods. |
Collection<HStoreFile> |
getCompactedfiles()
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.
|
int |
getCompactedFilesCount()
Returns the number of compacted files.
|
double |
getCompactionPressure() |
byte[] |
getEndRow(int stripeIndex)
Gets the end row for a given stripe.
|
Collection<HStoreFile> |
getFilesForScan(byte[] startRow,
boolean includeStartRow,
byte[] stopRow,
boolean includeStopRow)
Gets the store files to scan for a Scan or Get request.
|
List<HStoreFile> |
getLevel0Files() |
Optional<byte[]> |
getSplitPoint()
Override of getSplitPoint that determines the split point as the boundary between two stripes,
unless it causes significant imbalance between split sides' sizes.
|
byte[] |
getStartRow(int stripeIndex)
Gets the start row for a given stripe.
|
int |
getStoreCompactionPriority() |
Comparator<HStoreFile> |
getStoreFileComparator() |
int |
getStorefileCount()
Returns the number of files currently in use.
|
Collection<HStoreFile> |
getStorefiles()
Gets the snapshot of the store files currently in use.
|
List<byte[]> |
getStripeBoundaries() |
int |
getStripeCount() |
ArrayList<org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile>> |
getStripes() |
Collection<HStoreFile> |
getUnneededFiles(long maxTs,
List<HStoreFile> filesCompacting) |
void |
insertNewFiles(Collection<HStoreFile> sfs)
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> compactedFiles)
Remove the compacted files
|
Iterator<HStoreFile> |
updateCandidateFilesForRowKeyBefore(Iterator<HStoreFile> candidateFiles,
KeyValue targetKey,
Cell candidate)
See
StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) and
StoreFileManager.updateCandidateFilesForRowKeyBefore(Iterator, KeyValue, Cell) for
details on this methods. |
public static final byte[] STRIPE_START_KEY
public static final byte[] STRIPE_END_KEY
public static final byte[] OPEN_KEY
public StripeStoreFileManager(CellComparator kvComparator, org.apache.hadoop.conf.Configuration conf, StripeStoreConfig config)
public void loadFiles(List<HStoreFile> storeFiles)
StoreFileManagerloadFiles in interface StoreFileManagerstoreFiles - The files to load.public Collection<HStoreFile> getStorefiles()
StoreFileManagergetStorefiles in interface StripeCompactionPolicy.StripeInformationProvidergetStorefiles in interface StoreFileManagerpublic Collection<HStoreFile> getCompactedfiles()
StoreFileManagergetCompactedfiles in interface StoreFileManagerpublic int getCompactedFilesCount()
StoreFileManagergetCompactedFilesCount in interface StoreFileManagerpublic void insertNewFiles(Collection<HStoreFile> sfs)
StoreFileManagerinsertNewFiles in interface StoreFileManagersfs - New store files.public org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> clearFiles()
StoreFileManagerclearFiles in interface StoreFileManagerpublic org.apache.hbase.thirdparty.com.google.common.collect.ImmutableCollection<HStoreFile> clearCompactedFiles()
StoreFileManagerclearCompactedFiles in interface StoreFileManagerpublic int getStorefileCount()
StoreFileManagergetStorefileCount in interface StoreFileManagerpublic Iterator<HStoreFile> getCandidateFilesForRowKeyBefore(KeyValue targetKey)
StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) for details on this
methods.getCandidateFilesForRowKeyBefore in interface StoreFileManagertargetKey - The key that is the basis of the search.public Iterator<HStoreFile> updateCandidateFilesForRowKeyBefore(Iterator<HStoreFile> candidateFiles, KeyValue targetKey, Cell candidate)
StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) and
StoreFileManager.updateCandidateFilesForRowKeyBefore(Iterator, KeyValue, Cell) for
details on this methods.updateCandidateFilesForRowKeyBefore in interface StoreFileManagercandidateFiles - The candidate files not yet checked for better candidates - return value
from StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue), with some files
already removed.targetKey - The key to search for.candidate - The current best candidate found.public Optional<byte[]> getSplitPoint() throws IOException
getSplitPoint in interface StoreFileManagerIOExceptionpublic Collection<HStoreFile> getFilesForScan(byte[] startRow, boolean includeStartRow, byte[] stopRow, boolean includeStopRow)
StoreFileManagergetFilesForScan in interface StoreFileManagerstartRow - Start row of the request.stopRow - Stop row of the request.public void addCompactionResults(Collection<HStoreFile> compactedFiles, Collection<HStoreFile> results)
StoreFileManageraddCompactionResults in interface StoreFileManagercompactedFiles - The input files for the compaction.results - The resulting files for the compaction.public void removeCompactedFiles(Collection<HStoreFile> compactedFiles)
StoreFileManagerremoveCompactedFiles in interface StoreFileManagercompactedFiles - the list of compacted filespublic int getStoreCompactionPriority()
getStoreCompactionPriority in interface StoreFileManagerpublic final byte[] getStartRow(int stripeIndex)
StripeCompactionPolicy.StripeInformationProvidergetStartRow in interface StripeCompactionPolicy.StripeInformationProviderstripeIndex - Stripe index.public final byte[] getEndRow(int stripeIndex)
StripeCompactionPolicy.StripeInformationProvidergetEndRow in interface StripeCompactionPolicy.StripeInformationProviderstripeIndex - Stripe index.public List<HStoreFile> getLevel0Files()
getLevel0Files in interface StripeCompactionPolicy.StripeInformationProviderpublic List<byte[]> getStripeBoundaries()
getStripeBoundaries in interface StripeCompactionPolicy.StripeInformationProviderpublic ArrayList<org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList<HStoreFile>> getStripes()
getStripes in interface StripeCompactionPolicy.StripeInformationProviderpublic int getStripeCount()
getStripeCount in interface StripeCompactionPolicy.StripeInformationProviderpublic Collection<HStoreFile> getUnneededFiles(long maxTs, List<HStoreFile> filesCompacting)
getUnneededFiles in interface StoreFileManagermaxTs - Maximum expired timestamp.filesCompacting - Files that are currently compacting.public double getCompactionPressure()
getCompactionPressure in interface StoreFileManagerHStore.getCompactionPressure()public Comparator<HStoreFile> getStoreFileComparator()
getStoreFileComparator in interface StoreFileManagerHStoreFile.getMaxSequenceId() is the first priority.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.