Class StoreFileWriter.SingleStoreFileWriter
java.lang.Object
org.apache.hadoop.hbase.regionserver.StoreFileWriter.SingleStoreFileWriter
- Enclosing class:
- StoreFileWriter
-
Field Summary
Modifier and TypeFieldDescriptionprivate BloomContext
private byte[]
private final BloomType
private final Supplier<Collection<HStoreFile>>
private BloomContext
private final BloomFilterWriter
private long
private long
private final BloomFilterWriter
private final TimeRangeTracker
private HFile.Writer
-
Constructor Summary
ModifierConstructorDescriptionprivate
SingleStoreFileWriter
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, long maxKeys, InetSocketAddress[] favoredNodes, HFileContext fileContext, boolean shouldDropCacheBehind, Supplier<Collection<HStoreFile>> compactedFilesSupplier) Creates an HFile.Writer that also write helpful meta data. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
append
(ExtendedCell cell) private void
private void
appendFileInfo
(byte[] key, byte[] value) private void
private void
appendMetadata
(long maxSequenceId, boolean majorCompaction) Writes meta data.private void
appendMetadata
(long maxSequenceId, boolean majorCompaction, long mobCellsCount) Writes meta data.private void
appendMetadata
(long maxSequenceId, boolean majorCompaction, Collection<HStoreFile> storeFiles) Writes meta data.private void
appendMobMetadata
(org.apache.hbase.thirdparty.com.google.common.collect.SetMultimap<TableName, String> mobRefSet) Appends MOB - specific metadata (even if it is empty)private void
Add TimestampRange and earliest put timestamp to Metadataprivate void
private void
close()
private boolean
private boolean
private boolean
(package private) BloomFilterWriter
For unit testing only.private HFile.Writer
For use in testing.private org.apache.hadoop.fs.Path
getPath()
private long
getPos()
private boolean
private byte[]
toCompactionEventTrackerBytes
(Collection<HStoreFile> storeFiles) Used when writeHStoreFile.COMPACTION_EVENT_KEY
to new file's file info.private void
trackTimestamps
(ExtendedCell cell) Record the earlest Put timestamp.
-
Field Details
-
generalBloomFilterWriter
-
deleteFamilyBloomFilterWriter
-
bloomType
-
bloomParam
-
earliestPutTs
-
deleteFamilyCnt
-
bloomContext
-
deleteFamilyBloomContext
-
timeRangeTracker
-
compactedFilesSupplier
-
writer
-
-
Constructor Details
-
SingleStoreFileWriter
private SingleStoreFileWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, long maxKeys, InetSocketAddress[] favoredNodes, HFileContext fileContext, boolean shouldDropCacheBehind, Supplier<Collection<HStoreFile>> compactedFilesSupplier) throws IOException Creates an HFile.Writer that also write helpful meta data.- Parameters:
fs
- file system to write topath
- 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 archived- Throws:
IOException
- problem writing to FS
-
-
Method Details
-
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
private 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
-
toCompactionEventTrackerBytes
Used when writeHStoreFile.COMPACTION_EVENT_KEY
to new file's file info. The compacted store files's name is needed. But if the compacted store file is a result of compaction, it's compacted files which still not archived is needed, too. And don't need to add compacted files recursively. If file A, B, C compacted to new file D, and file D compacted to new file E, will write A, B, C, D to file E's compacted files. So if file E compacted to new file F, will add E to F's compacted files first, then add E's compacted files: A, B, C, D to it. And no need to add D's compacted file, as D's compacted files has been in E's compacted files, too. See HBASE-20724 for more details.- Parameters:
storeFiles
- The compacted store files to generate this new file- Returns:
- bytes of CompactionEventTracker
-
appendMetadata
private 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
private 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
-
trackTimestamps
Record the earlest Put timestamp. If the timeRangeTracker is not set, update TimeRangeTracker to include the timestamp of this key -
appendGeneralBloomfilter
- Throws:
IOException
-
appendDeleteFamilyBloomFilter
- Throws:
IOException
-
append
- Throws:
IOException
-
beforeShipped
- Throws:
IOException
-
getPath
-
hasGeneralBloom
-
getGeneralBloomWriter
For unit testing only.- Returns:
- the Bloom filter used by this writer.
-
closeBloomFilter
- Throws:
IOException
-
closeGeneralBloomFilter
- Throws:
IOException
-
closeDeleteFamilyBloomFilter
- Throws:
IOException
-
close
- Throws:
IOException
-
appendFileInfo
- Throws:
IOException
-
getHFileWriter
For use in testing.
-