Class StoreFileWriter
java.lang.Object
org.apache.hadoop.hbase.regionserver.StoreFileWriter
- All Implemented Interfaces:
CellSink,ShipperListener
A StoreFile writer. Use this to read/write HBase Store Files. It is package local because it is
an implementation detail of the HBase regionserver.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BloomTypeprivate final CacheConfigprivate final Supplier<Collection<HStoreFile>>private final CellComparatorprivate final org.apache.hadoop.conf.Configurationprivate static final Patternstatic final booleanprivate ExtendedCellprivate List<ExtendedCell>private ExtendedCellprivate List<ExtendedCell>static final Stringprivate final InetSocketAddress[]private final HFileContextprivate final org.apache.hadoop.fs.FileSystemprivate final org.apache.hadoop.fs.Pathprivate ExtendedCellprivate intprivate static final org.slf4j.Loggerprivate final longprivate final intprivate final booleanprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStoreFileWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path liveFilePath, org.apache.hadoop.fs.Path historicalFilePath, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, long maxKeys, InetSocketAddress[] favoredNodes, HFileContext fileContext, boolean shouldDropCacheBehind, Supplier<Collection<HStoreFile>> compactedFilesSupplier, CellComparator comparator, int maxVersions, boolean newVersionBehavior) Creates an HFile.Writer that also write helpful meta data. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(ExtendedCell cell) Append the given cellvoidappendAll(List<ExtendedCell> cellList) Append the given (possibly partial) list of cells of a rowprivate voidappendCell(ExtendedCell cell) voidappendCustomCellTimestampsToMetadata(TimeRangeTracker timeRangeTracker) voidappendFileInfo(byte[] key, byte[] value) voidappendMetadata(long maxSequenceId, boolean majorCompaction) Writes meta data.voidappendMetadata(long maxSequenceId, boolean majorCompaction, long mobCellsCount) Writes meta data.voidappendMetadata(long maxSequenceId, boolean majorCompaction, Collection<HStoreFile> storeFiles) Writes meta data.voidappendMobMetadata(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefSet) Appends MOB - specific metadata (even if it is empty)voidAdd TimestampRange and earliest put timestamp to MetadatavoidThe action that needs to be performed beforeShipper.shipped()is performedvoidclose()For unit testing only.(package private) HFile.WriterFor use in testing.org.apache.hadoop.fs.PathgetPath()List<org.apache.hadoop.fs.Path>getPaths()longgetPos()static org.apache.hadoop.fs.PathgetUniqueFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) booleanprivate voidprivate voidprivate booleanisDeleted(ExtendedCell cell) private booleanprivate booleanprivate booleanprivate booleanstatic booleanshouldEnableHistoricalCompactionFiles(org.apache.hadoop.conf.Configuration conf)
-
Field Details
-
LOG
-
ENABLE_HISTORICAL_COMPACTION_FILES
- See Also:
-
DEFAULT_ENABLE_HISTORICAL_COMPACTION_FILES
- See Also:
-
dash
-
liveFileWriter
-
historicalFileWriter
-
fs
-
historicalFilePath
-
conf
-
cacheConf
-
bloomType
-
maxKeys
-
favoredNodes
-
fileContext
-
shouldDropCacheBehind
-
compactedFilesSupplier
-
comparator
-
lastCell
-
deleteFamily
-
deleteFamilyVersionList
-
deleteColumn
-
deleteColumnVersionList
-
livePutCellCount
-
maxVersions
-
newVersionBehavior
-
-
Constructor Details
-
StoreFileWriter
private StoreFileWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path liveFilePath, org.apache.hadoop.fs.Path historicalFilePath, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, long maxKeys, InetSocketAddress[] favoredNodes, HFileContext fileContext, boolean shouldDropCacheBehind, Supplier<Collection<HStoreFile>> compactedFilesSupplier, CellComparator comparator, int maxVersions, boolean newVersionBehavior) throws IOException Creates an HFile.Writer that also write helpful meta data.- Parameters:
fs- file system to write toliveFilePath- the name of the live file to createhistoricalFilePath- the name of the historical file name to createconf- user configurationbloomType- bloom filter settingmaxKeys- the expected maximum number of keys to be added. Was used for Bloom filter size inHFileformat version 1.favoredNodes- an array of favored nodes or possibly nullfileContext- The HFile contextshouldDropCacheBehind- Drop pages written to page cache after writing the store file.compactedFilesSupplier- Returns theHStorecompacted files which not archivedcomparator- Cell comparatormaxVersions- max cell versionsnewVersionBehavior- enable new version behavior- Throws:
IOException- problem writing to FS
-
-
Method Details
-
shouldEnableHistoricalCompactionFiles
public static boolean shouldEnableHistoricalCompactionFiles(org.apache.hadoop.conf.Configuration conf) -
getPos
- Throws:
IOException
-
appendMetadata
Writes meta data. Call beforeclose()since its written as meta data to this file.- Parameters:
maxSequenceId- Maximum sequence id.majorCompaction- True if this file is product of a major compaction- Throws:
IOException- problem writing to FS
-
appendMetadata
public void appendMetadata(long maxSequenceId, boolean majorCompaction, Collection<HStoreFile> storeFiles) throws IOException Writes meta data. Call beforeclose()since its written as meta data to this file.- Parameters:
maxSequenceId- Maximum sequence id.majorCompaction- True if this file is product of a major compactionstoreFiles- The compacted store files to generate this new file- Throws:
IOException- problem writing to FS
-
appendMetadata
public void appendMetadata(long maxSequenceId, boolean majorCompaction, long mobCellsCount) throws IOException Writes meta data. Call beforeclose()since its written as meta data to this file.- Parameters:
maxSequenceId- Maximum sequence id.majorCompaction- True if this file is product of a major compactionmobCellsCount- The number of mob cells.- Throws:
IOException- problem writing to FS
-
appendMobMetadata
public void appendMobMetadata(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefSet) throws IOExceptionAppends MOB - specific metadata (even if it is empty)- Parameters:
mobRefSet- - original table -> set of MOB file names- Throws:
IOException- problem writing to FS
-
appendTrackedTimestampsToMetadata
Add TimestampRange and earliest put timestamp to Metadata- Throws:
IOException
-
appendCustomCellTimestampsToMetadata
public void appendCustomCellTimestampsToMetadata(TimeRangeTracker timeRangeTracker) throws IOException - Throws:
IOException
-
beforeShipped
Description copied from interface:ShipperListenerThe action that needs to be performed beforeShipper.shipped()is performed- Specified by:
beforeShippedin interfaceShipperListener- Throws:
IOException
-
getPath
-
getPaths
-
hasGeneralBloom
-
getGeneralBloomWriter
For unit testing only.- Returns:
- the Bloom filter used by this writer.
-
close
- Throws:
IOException
-
appendFileInfo
- Throws:
IOException
-
getLiveFileWriter
For use in testing. -
getUniqueFile
public static org.apache.hadoop.fs.Path getUniqueFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException - Parameters:
dir- Directory to create file in.- Returns:
- random filename inside passed
dir - Throws:
IOException
-
getHistoricalFileWriter
- Throws:
IOException
-
initRowState
-
initColumnState
-
isDeletedByDeleteFamily
-
isDeletedByDeleteFamilyVersion
-
isDeletedByDeleteColumn
-
isDeletedByDeleteColumnVersion
-
isDeleted
-
appendCell
- Throws:
IOException
-
appendAll
Description copied from interface:CellSinkAppend the given (possibly partial) list of cells of a row- Specified by:
appendAllin interfaceCellSink- Parameters:
cellList- the cell list to be added- Throws:
IOException
-
append
Description copied from interface:CellSinkAppend the given cell- Specified by:
appendin interfaceCellSink- Parameters:
cell- the cell to be added- Throws:
IOException
-