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
Modifier and TypeClassDescriptionstatic class
private static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final BloomType
private final CacheConfig
private final Supplier<Collection<HStoreFile>>
private final CellComparator
private final org.apache.hadoop.conf.Configuration
private static final Pattern
static final boolean
private ExtendedCell
private List<ExtendedCell>
private ExtendedCell
private List<ExtendedCell>
static final String
private final InetSocketAddress[]
private final HFileContext
private final org.apache.hadoop.fs.FileSystem
private final org.apache.hadoop.fs.Path
private ExtendedCell
private int
private static final org.slf4j.Logger
private final long
private final int
private final boolean
private final boolean
-
Constructor Summary
ModifierConstructorDescriptionprivate
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) Creates an HFile.Writer that also write helpful meta data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(ExtendedCell cell) Append the given cellvoid
appendAll
(List<ExtendedCell> cellList) Append the given (possibly partial) list of cells of a rowprivate void
appendCell
(ExtendedCell cell) void
appendFileInfo
(byte[] key, byte[] value) void
appendMetadata
(long maxSequenceId, boolean majorCompaction) Writes meta data.void
appendMetadata
(long maxSequenceId, boolean majorCompaction, long mobCellsCount) Writes meta data.void
appendMetadata
(long maxSequenceId, boolean majorCompaction, Collection<HStoreFile> storeFiles) Writes meta data.void
appendMobMetadata
(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefSet) Appends MOB - specific metadata (even if it is empty)void
Add TimestampRange and earliest put timestamp to Metadatavoid
The action that needs to be performed beforeShipper.shipped()
is performedvoid
close()
(package private) BloomFilterWriter
For unit testing only.(package private) HFile.Writer
For use in testing.org.apache.hadoop.fs.Path
getPath()
List<org.apache.hadoop.fs.Path>
getPaths()
long
getPos()
static org.apache.hadoop.fs.Path
getUniqueFile
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) boolean
private void
private void
private boolean
isDeleted
(ExtendedCell cell) private boolean
private boolean
private boolean
private boolean
static boolean
shouldEnableHistoricalCompactionFiles
(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 inHFile
format 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 theHStore
compacted 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
-
beforeShipped
Description copied from interface:ShipperListener
The action that needs to be performed beforeShipper.shipped()
is performed- Specified by:
beforeShipped
in 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:CellSink
Append the given (possibly partial) list of cells of a row- Specified by:
appendAll
in interfaceCellSink
- Parameters:
cellList
- the cell list to be added- Throws:
IOException
-
append
Description copied from interface:CellSink
Append the given cell- Specified by:
append
in interfaceCellSink
- Parameters:
cell
- the cell to be added- Throws:
IOException
-