Package org.apache.hadoop.hbase.util
Class BloomFilterFactory
java.lang.Object
org.apache.hadoop.hbase.util.BloomFilterFactory
Handles Bloom filter initialization based on configuration and serialized metadata in the reader
and writer of
HStoreFile
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Target Bloom block size.static final String
Master switch to enable Bloom filtersstatic final String
Specifies the target error rate to use when selecting the number of keys per Bloom filter.static final String
Maximum folding factor allowed.static final String
For default (single-block) Bloom filters this specifies the maximum number of keys.static final String
Master switch to enable Delete Family Bloom filtersprivate static final org.slf4j.Logger
private static final int
Maximum number of times a Bloom filter can be "folded" if oversized -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
This class should not be instantiated. -
Method Summary
Modifier and TypeMethodDescriptionstatic BloomFilterWriter
createDeleteBloomAtWrite
(org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, int maxKeys, HFile.Writer writer) Creates a new Delete Family Bloom filter at the time ofHStoreFile
writing.static BloomFilter
createFromMeta
(DataInput meta, HFile.Reader reader) Instantiates the correct Bloom filter class based on the version provided in the meta block data.static BloomFilter
createFromMeta
(DataInput meta, HFile.Reader reader, BloomFilterMetrics metrics) static BloomFilterWriter
createGeneralBloomAtWrite
(org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, int maxKeys, HFile.Writer writer) Creates a new general (Row or RowCol) Bloom filter at the time ofHStoreFile
writing.static int
getBloomBlockSize
(org.apache.hadoop.conf.Configuration conf) Returns the compound Bloom filter block size from the configurationstatic float
getErrorRate
(org.apache.hadoop.conf.Configuration conf) Returns the Bloom filter error rate in the given configurationstatic int
getMaxFold
(org.apache.hadoop.conf.Configuration conf) Returns the value for Bloom filter max fold in the given configurationstatic int
getMaxKeys
(org.apache.hadoop.conf.Configuration conf) Returns max key for the Bloom filter from the configurationstatic boolean
isDeleteFamilyBloomEnabled
(org.apache.hadoop.conf.Configuration conf) Returns true if Delete Family Bloom filters are enabled in the given configurationstatic boolean
isGeneralBloomEnabled
(org.apache.hadoop.conf.Configuration conf) Returns true if general Bloom (Row or RowCol) filters are enabled in the given configuration
-
Field Details
-
LOG
-
IO_STOREFILE_BLOOM_ERROR_RATE
Specifies the target error rate to use when selecting the number of keys per Bloom filter.- See Also:
-
IO_STOREFILE_BLOOM_MAX_FOLD
Maximum folding factor allowed. The Bloom filter will be shrunk by the factor of up to 2 ** this times if we oversize it initially.- See Also:
-
IO_STOREFILE_BLOOM_MAX_KEYS
For default (single-block) Bloom filters this specifies the maximum number of keys.- See Also:
-
IO_STOREFILE_BLOOM_ENABLED
Master switch to enable Bloom filters- See Also:
-
IO_STOREFILE_DELETEFAMILY_BLOOM_ENABLED
Master switch to enable Delete Family Bloom filters- See Also:
-
IO_STOREFILE_BLOOM_BLOCK_SIZE
Target Bloom block size. Bloom filter blocks of approximately this size are interleaved with data blocks.- See Also:
-
MAX_ALLOWED_FOLD_FACTOR
Maximum number of times a Bloom filter can be "folded" if oversized- See Also:
-
-
Constructor Details
-
BloomFilterFactory
private BloomFilterFactory()This class should not be instantiated.
-
-
Method Details
-
createFromMeta
public static BloomFilter createFromMeta(DataInput meta, HFile.Reader reader) throws IllegalArgumentException, IOException Instantiates the correct Bloom filter class based on the version provided in the meta block data.- Parameters:
meta
- the byte array holding the Bloom filter's metadata, including version informationreader
- theHFile
reader to use to lazily load Bloom filter blocks- Returns:
- an instance of the correct type of Bloom filter
- Throws:
IllegalArgumentException
IOException
-
createFromMeta
public static BloomFilter createFromMeta(DataInput meta, HFile.Reader reader, BloomFilterMetrics metrics) throws IllegalArgumentException, IOException - Throws:
IllegalArgumentException
IOException
-
isGeneralBloomEnabled
Returns true if general Bloom (Row or RowCol) filters are enabled in the given configuration -
isDeleteFamilyBloomEnabled
Returns true if Delete Family Bloom filters are enabled in the given configuration -
getErrorRate
Returns the Bloom filter error rate in the given configuration -
getMaxFold
Returns the value for Bloom filter max fold in the given configuration -
getBloomBlockSize
Returns the compound Bloom filter block size from the configuration -
getMaxKeys
Returns max key for the Bloom filter from the configuration -
createGeneralBloomAtWrite
public static BloomFilterWriter createGeneralBloomAtWrite(org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType bloomType, int maxKeys, HFile.Writer writer) Creates a new general (Row or RowCol) Bloom filter at the time ofHStoreFile
writing.- Parameters:
maxKeys
- an estimate of the number of keys we expect to insert. Irrelevant if compound Bloom filters are enabled.writer
- the HFile writer- Returns:
- the new Bloom filter, or null in case Bloom filters are disabled or when failed to create one.
-
createDeleteBloomAtWrite
public static BloomFilterWriter createDeleteBloomAtWrite(org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, int maxKeys, HFile.Writer writer) Creates a new Delete Family Bloom filter at the time ofHStoreFile
writing.- Parameters:
maxKeys
- an estimate of the number of keys we expect to insert. Irrelevant if compound Bloom filters are enabled.writer
- the HFile writer- Returns:
- the new Bloom filter, or null in case Bloom filters are disabled or when failed to create one.
-