|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.regionserver.StripeStoreFileManager
@InterfaceAudience.Private public class StripeStoreFileManager
Stripe implementation of 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 StripeCompationPolicy 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.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
StripeStoreFileManager(KeyValue.KVComparator kvComparator,
org.apache.hadoop.conf.Configuration conf,
StripeStoreConfig config)
|
|
| Method Summary | |
|---|---|
void |
addCompactionResults(Collection<StoreFile> compactedFiles,
Collection<StoreFile> results)
Adds compaction results into the structure. |
com.google.common.collect.ImmutableCollection<StoreFile> |
clearFiles()
Clears all the files currently in use and returns them. |
Iterator<StoreFile> |
getCandidateFilesForRowKeyBefore(KeyValue targetKey)
See StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue)
for details on this methods. |
double |
getCompactionPressure()
|
byte[] |
getEndRow(int stripeIndex)
Gets the end row for a given stripe. |
Collection<StoreFile> |
getFilesForScanOrGet(boolean isGet,
byte[] startRow,
byte[] stopRow)
Gets the store files to scan for a Scan or Get request. |
List<StoreFile> |
getLevel0Files()
|
byte[] |
getSplitPoint()
Gets the split point for the split of this set of store files (approx. |
byte[] |
getStartRow(int stripeIndex)
Gets the start row for a given stripe. |
int |
getStoreCompactionPriority()
|
int |
getStorefileCount()
Returns the number of files currently in use. |
Collection<StoreFile> |
getStorefiles()
Gets the snapshot of the store files currently in use. |
List<byte[]> |
getStripeBoundaries()
|
int |
getStripeCount()
|
ArrayList<com.google.common.collect.ImmutableList<StoreFile>> |
getStripes()
|
Collection<StoreFile> |
getUnneededFiles(long maxTs,
List<StoreFile> filesCompacting)
|
void |
insertNewFiles(Collection<StoreFile> sfs)
Adds new files, either for from MemStore flush or bulk insert, into the structure. |
void |
loadFiles(List<StoreFile> storeFiles)
Loads the initial store files into empty StoreFileManager. |
Iterator<StoreFile> |
updateCandidateFilesForRowKeyBefore(Iterator<StoreFile> candidateFiles,
KeyValue targetKey,
KeyValue candidate)
See StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) and
StoreFileManager.updateCandidateFilesForRowKeyBefore(Iterator, KeyValue, KeyValue)
for details on this methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte[] STRIPE_START_KEY
public static final byte[] STRIPE_END_KEY
public static final byte[] OPEN_KEY
| Constructor Detail |
|---|
public StripeStoreFileManager(KeyValue.KVComparator kvComparator,
org.apache.hadoop.conf.Configuration conf,
StripeStoreConfig config)
| Method Detail |
|---|
public void loadFiles(List<StoreFile> storeFiles)
StoreFileManager
loadFiles in interface StoreFileManagerstoreFiles - The files to load.public Collection<StoreFile> getStorefiles()
StoreFileManager
getStorefiles in interface StripeCompactionPolicy.StripeInformationProvidergetStorefiles in interface StoreFileManager
public void insertNewFiles(Collection<StoreFile> sfs)
throws IOException
StoreFileManager
insertNewFiles in interface StoreFileManagersfs - New store files.
IOExceptionpublic com.google.common.collect.ImmutableCollection<StoreFile> clearFiles()
StoreFileManager
clearFiles in interface StoreFileManagerpublic int getStorefileCount()
StoreFileManager
getStorefileCount in interface StoreFileManagerpublic Iterator<StoreFile> 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<StoreFile> updateCandidateFilesForRowKeyBefore(Iterator<StoreFile> candidateFiles,
KeyValue targetKey,
KeyValue candidate)
StoreFileManager.getCandidateFilesForRowKeyBefore(KeyValue) and
StoreFileManager.updateCandidateFilesForRowKeyBefore(Iterator, KeyValue, KeyValue)
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 byte[] getSplitPoint()
throws IOException
StoreFileManager
getSplitPoint in interface StoreFileManagerIOException
public Collection<StoreFile> getFilesForScanOrGet(boolean isGet,
byte[] startRow,
byte[] stopRow)
StoreFileManager
getFilesForScanOrGet in interface StoreFileManagerisGet - Whether it's a get.startRow - Start row of the request.stopRow - Stop row of the request.
public void addCompactionResults(Collection<StoreFile> compactedFiles,
Collection<StoreFile> results)
throws IOException
StoreFileManager
addCompactionResults in interface StoreFileManagercompactedFiles - The input files for the compaction.results - The resulting files for the compaction.
IOExceptionpublic int getStoreCompactionPriority()
getStoreCompactionPriority in interface StoreFileManagerpublic final byte[] getStartRow(int stripeIndex)
StripeCompactionPolicy.StripeInformationProvider
getStartRow in interface StripeCompactionPolicy.StripeInformationProviderstripeIndex - Stripe index.
public final byte[] getEndRow(int stripeIndex)
StripeCompactionPolicy.StripeInformationProvider
getEndRow in interface StripeCompactionPolicy.StripeInformationProviderstripeIndex - Stripe index.
public List<StoreFile> getLevel0Files()
getLevel0Files in interface StripeCompactionPolicy.StripeInformationProviderpublic List<byte[]> getStripeBoundaries()
getStripeBoundaries in interface StripeCompactionPolicy.StripeInformationProviderpublic ArrayList<com.google.common.collect.ImmutableList<StoreFile>> getStripes()
getStripes in interface StripeCompactionPolicy.StripeInformationProviderpublic int getStripeCount()
getStripeCount in interface StripeCompactionPolicy.StripeInformationProvider
public Collection<StoreFile> getUnneededFiles(long maxTs,
List<StoreFile> filesCompacting)
getUnneededFiles in interface StoreFileManagermaxTs - Maximum expired timestamp.filesCompacting - Files that are currently compacting.
public double getCompactionPressure()
getCompactionPressure in interface StoreFileManagerStore.getCompactionPressure()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||