Class StoreFileTrackerBase
java.lang.Object
org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerBase
- All Implemented Interfaces:
StoreFileTracker
- Direct Known Subclasses:
DefaultStoreFileTracker,FileBasedStoreFileTracker,MigrationStoreFileTracker
Base class for all store file tracker.
Mainly used to place the common logic to skip persistent for secondary replicas.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprotected final org.apache.hadoop.conf.Configurationprotected final StoreContextprotected final booleanprivate static final org.slf4j.Logger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStoreFileTrackerBase(org.apache.hadoop.conf.Configuration conf, boolean isPrimaryReplica, StoreContext ctx) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(Collection<StoreFileInfo> newFiles) Add new store files.protected voidarchiveStoreFiles(List<HStoreFile> storeFiles) private HFileContextcreateFileContext(Compression.Algorithm compression, boolean includeMVCCReadpoint, boolean includesTag, Encryption.Context encryptionContext) createFromHFileLink(String hfileLinkName, boolean createBackRef) Create a new HFileLink starting from a hfileLink namecreateHFileLink(TableName linkedTable, String linkedRegion, String hfileName, boolean createBackRef) Create a new HFileLinkcreateReference(Reference reference, org.apache.hadoop.fs.Path path) final StoreFileWriterCreate a writer for writing new store files.protected abstract voiddoAddCompactionResults(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) protected abstract voiddoAddNewStoreFiles(Collection<StoreFileInfo> newFiles) protected abstract 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 abstract voiddoSetStoreFiles(Collection<StoreFileInfo> files) getStoreFileInfo(org.apache.hadoop.fs.FileStatus fileStatus, org.apache.hadoop.fs.Path initialPath, boolean primaryReplica) getStoreFileInfo(org.apache.hadoop.fs.Path initialPath, boolean primaryReplica) protected final StringbooleanReturns true if the specified family has reference filesfinal List<StoreFileInfo>load()Load the store files list when opening a region.readReference(org.apache.hadoop.fs.Path p) Reads the reference file from the given path.voidremoveStoreFiles(List<HStoreFile> storeFiles) Closes and archives the specified store files from the specified family.final voidreplace(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) Add new store files and remove compacted store files after compaction.final voidset(List<StoreFileInfo> files) Set the store files.Adds StoreFileTracker implementations specific configurations into the table descriptor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTracker
requireWritingToTmpDirFirst
-
Field Details
-
LOG
-
conf
-
isPrimaryReplica
-
ctx
-
cacheOnWriteLogged
-
-
Constructor Details
-
StoreFileTrackerBase
protected StoreFileTrackerBase(org.apache.hadoop.conf.Configuration conf, boolean isPrimaryReplica, StoreContext ctx)
-
-
Method Details
-
load
Description copied from interface:StoreFileTrackerLoad the store files list when opening a region.- Specified by:
loadin interfaceStoreFileTracker- Throws:
IOException
-
add
Description copied from interface:StoreFileTrackerAdd new store files. Used for flush and bulk load.- Specified by:
addin interfaceStoreFileTracker- Throws:
IOException
-
replace
public final void replace(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) throws IOException Description copied from interface:StoreFileTrackerAdd new store files and remove compacted store files after compaction.- Specified by:
replacein interfaceStoreFileTracker- Throws:
IOException
-
set
Description copied from interface:StoreFileTrackerSet the store files.- Specified by:
setin interfaceStoreFileTracker- Throws:
IOException
-
updateWithTrackerConfigs
Description copied from interface:StoreFileTrackerAdds StoreFileTracker implementations specific configurations into the table descriptor. This is used to avoid accidentally data loss when changing the cluster level store file tracker implementation, and also possible misconfiguration between master and region servers. See HBASE-26246 for more details.- Specified by:
updateWithTrackerConfigsin interfaceStoreFileTracker- Parameters:
builder- The table descriptor builder for the given table.
-
getTrackerName
-
createFileContext
private HFileContext createFileContext(Compression.Algorithm compression, boolean includeMVCCReadpoint, boolean includesTag, Encryption.Context encryptionContext) -
createWriter
Description copied from interface:StoreFileTrackerCreate a writer for writing new store files.- Specified by:
createWriterin interfaceStoreFileTracker- Returns:
- Writer for a new StoreFile
- Throws:
IOException
-
createReference
public Reference createReference(Reference reference, org.apache.hadoop.fs.Path path) throws IOException - Specified by:
createReferencein interfaceStoreFileTracker- Throws:
IOException
-
hasReferences
Returns true if the specified family has reference files- Specified by:
hasReferencesin interfaceStoreFileTracker- Parameters:
familyName- Column Family Name- Returns:
- true if family contains reference files
- Throws:
IOException
-
readReference
Description copied from interface:StoreFileTrackerReads the reference file from the given path.- Specified by:
readReferencein interfaceStoreFileTracker- Parameters:
p- thePathto the reference file in the file system.- Returns:
- a
Referencethat points at top/bottom half of a an hfile - Throws:
IOException
-
getStoreFileInfo
public StoreFileInfo getStoreFileInfo(org.apache.hadoop.fs.Path initialPath, boolean primaryReplica) throws IOException - Specified by:
getStoreFileInfoin interfaceStoreFileTracker- Throws:
IOException
-
getStoreFileInfo
public StoreFileInfo getStoreFileInfo(org.apache.hadoop.fs.FileStatus fileStatus, org.apache.hadoop.fs.Path initialPath, boolean primaryReplica) throws IOException - Specified by:
getStoreFileInfoin interfaceStoreFileTracker- Throws:
IOException
-
createHFileLink
public String 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 interfaceStoreFileTrackercreateBackRef- - Whether back reference should be created. Defaults to true.- Returns:
- the file link name.
- Throws:
IOException- on file or parent directory creation failure.
-
createFromHFileLink
Description copied from interface:StoreFileTrackerCreate a new HFileLink starting from a hfileLink nameIt also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
- Specified by:
createFromHFileLinkin interfaceStoreFileTrackercreateBackRef- - Whether back reference should be created. Defaults to true.- Returns:
- the file link name.
- Throws:
IOException- on file or parent directory creation failure.
-
removeStoreFiles
Description copied from interface:StoreFileTrackerCloses and archives the specified store files from the specified family.- Specified by:
removeStoreFilesin interfaceStoreFileTracker- Parameters:
storeFiles- set of store files to remove- Throws:
IOException- if the archiving fails
-
archiveStoreFiles
- Throws:
IOException
-
doLoadStoreFiles
For 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.- Throws:
IOException
-
doAddNewStoreFiles
- Throws:
IOException
-
doAddCompactionResults
protected abstract void doAddCompactionResults(Collection<StoreFileInfo> compactedFiles, Collection<StoreFileInfo> newFiles) throws IOException - Throws:
IOException
-
doSetStoreFiles
- Throws:
IOException
-