Class FileBasedStoreFileTracker
java.lang.Object
org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerBase
org.apache.hadoop.hbase.regionserver.storefiletracker.FileBasedStoreFileTracker
- All Implemented Interfaces:
StoreFileTracker
A file based store file tracker.
For this tracking way, the store file list will be persistent into a file, so we can write the
new store files directly to the final data directory, as we will not load the broken files. This
will greatly reduce the time for flush and compaction on some object storages as a rename is
actual a copy on them. And it also avoid listing when loading store file list, which could also
speed up the loading of store files as listing is also not a fast operation on most object
storages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StoreFileListFileprivate static final org.slf4j.Loggerprivate final Map<String,StoreFileInfo> Fields inherited from class org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerBase
conf, ctx, isPrimaryReplica -
Constructor Summary
ConstructorsConstructorDescriptionFileBasedStoreFileTracker(org.apache.hadoop.conf.Configuration conf, boolean isPrimaryReplica, StoreContext ctx) -
Method Summary
Modifier and TypeMethodDescriptioncreateAndCommitReference(Reference reference, org.apache.hadoop.fs.Path path) createHFileLink(TableName linkedTable, String linkedRegion, String hfileName, boolean createBackRef) Create a new HFileLinkcreateReference(Reference reference, org.apache.hadoop.fs.Path path) protected voiddoAddCompactionResults(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) protected voiddoAddNewStoreFiles(Collection<StoreFileInfo> newFiles) protected List<StoreFileInfo>doLoadStoreFiles(boolean readOnly) For primary replica, we will call load once when opening a region, and the implementation could choose to do some cleanup work.protected voiddoSetStoreFiles(Collection<StoreFileInfo> files) booleanReturns true if the specified family has reference filesreadReference(org.apache.hadoop.fs.Path p) Reads the reference file from the given path.booleanWhether the implementation of this tracker requires you to write to temp directory first, i.e, does not allow broken store files under the actual data directory.private org.apache.hadoop.hbase.shaded.protobuf.generated.StoreFileTrackerProtos.StoreFileEntryMethods inherited from class org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerBase
add, archiveStoreFiles, createAndCommitHFileLink, createFromHFileLink, createWriter, getStoreContext, getStoreFileInfo, getStoreFileInfo, getTrackerName, load, removeStoreFiles, replace, set, updateWithTrackerConfigs
-
Field Details
-
backedFile
-
storefiles
-
LOG
-
-
Constructor Details
-
FileBasedStoreFileTracker
public FileBasedStoreFileTracker(org.apache.hadoop.conf.Configuration conf, boolean isPrimaryReplica, StoreContext ctx)
-
-
Method Details
-
doLoadStoreFiles
Description copied from class:StoreFileTrackerBaseFor primary replica, we will call load once when opening a region, and the implementation could choose to do some cleanup work. So here we usereadOnlyto indicate that whether you are allowed to do the cleanup work. For secondary replicas, we will setreadOnlytotrue.- Specified by:
doLoadStoreFilesin classStoreFileTrackerBase- Throws:
IOException
-
requireWritingToTmpDirFirst
Description copied from interface:StoreFileTrackerWhether the implementation of this tracker requires you to write to temp directory first, i.e, does not allow broken store files under the actual data directory. -
toStoreFileEntry
private org.apache.hadoop.hbase.shaded.protobuf.generated.StoreFileTrackerProtos.StoreFileEntry toStoreFileEntry(StoreFileInfo info) -
doAddNewStoreFiles
- Specified by:
doAddNewStoreFilesin classStoreFileTrackerBase- Throws:
IOException
-
doAddCompactionResults
protected void doAddCompactionResults(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) throws IOException - Specified by:
doAddCompactionResultsin classStoreFileTrackerBase- Throws:
IOException
-
doSetStoreFiles
- Specified by:
doSetStoreFilesin classStoreFileTrackerBase- Throws:
IOException
-
readReference
Description copied from interface:StoreFileTrackerReads the reference file from the given path.- Specified by:
readReferencein interfaceStoreFileTracker- Overrides:
readReferencein classStoreFileTrackerBase- Parameters:
p- thePathto the reference file in the file system.- Returns:
- a
Referencethat points at top/bottom half of a an hfile - Throws:
IOException
-
hasReferences
Description copied from class:StoreFileTrackerBaseReturns true if the specified family has reference files- Specified by:
hasReferencesin interfaceStoreFileTracker- Overrides:
hasReferencesin classStoreFileTrackerBase- Returns:
- true if family contains reference files
- Throws:
IOException
-
createHFileLink
public HFileLink createHFileLink(TableName linkedTable, String linkedRegion, String hfileName, boolean createBackRef) throws IOException Description copied from interface:StoreFileTrackerCreate a new HFileLinkIt also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
- Specified by:
createHFileLinkin interfaceStoreFileTracker- Overrides:
createHFileLinkin classStoreFileTrackerBasecreateBackRef- - Whether back reference should be created. Defaults to true.- Returns:
- the file link name.
- Throws:
IOException- on file or parent directory creation failure.
-
createReference
public Reference createReference(Reference reference, org.apache.hadoop.fs.Path path) throws IOException - Specified by:
createReferencein interfaceStoreFileTracker- Overrides:
createReferencein classStoreFileTrackerBase- Throws:
IOException
-
createAndCommitReference
public Reference createAndCommitReference(Reference reference, org.apache.hadoop.fs.Path path) throws IOException - Specified by:
createAndCommitReferencein interfaceStoreFileTracker- Overrides:
createAndCommitReferencein classStoreFileTrackerBase- Throws:
IOException
-