@InterfaceAudience.Private public class CompoundBloomFilterWriter extends CompoundBloomFilterBase implements BloomFilterWriter, InlineBlockWriter
HFile
to the CompoundBloomFilter
class.Modifier and Type | Class and Description |
---|---|
private class |
CompoundBloomFilterWriter.MetaWriter |
private static class |
CompoundBloomFilterWriter.ReadyChunk
A Bloom filter chunk enqueued for writing
|
Modifier and Type | Field and Description |
---|---|
private HFileBlockIndex.BlockIndexWriter |
bloomBlockIndexWriter |
private BloomType |
bloomType |
private boolean |
cacheOnWrite
Whether to cache-on-write compound Bloom filter chunks
|
private BloomFilterChunk |
chunk
The current chunk being written to
|
private int |
chunkByteSize
The size of individual Bloom filter chunks to create
|
private byte[] |
firstKeyInChunk
The first key in the current Bloom filter chunk.
|
private static org.slf4j.Logger |
LOG |
private int |
maxFold
Maximum fold factor
|
private Cell |
prevCell
The prev Cell that was processed
|
private BloomFilterChunk |
prevChunk
Previous chunk, so that we can create another similar chunk
|
private Queue<CompoundBloomFilterWriter.ReadyChunk> |
readyChunks |
comparator, errorRate, hashType, numChunks, totalByteSize, totalKeyCount, totalMaxKeys, VERSION
Constructor and Description |
---|
CompoundBloomFilterWriter(int chunkByteSizeHint,
float errorRate,
int hashType,
int maxFold,
boolean cacheOnWrite,
CellComparator comparator,
BloomType bloomType)
each chunk's size in bytes.
|
Modifier and Type | Method and Description |
---|---|
private void |
allocateNewChunk() |
void |
append(Cell cell)
Append the given cell
|
void |
beforeShipped()
The action that needs to be performed before
Shipper.shipped() is performed |
void |
blockWritten(long offset,
int onDiskSize,
int uncompressedSize)
Called after a block has been written, and its offset, raw size, and compressed size have been
determined.
|
void |
compactBloom()
Compact the Bloom filter before writing metadata & data to disk.
|
private void |
enqueueReadyChunk(boolean closing)
Enqueue the current chunk if it is ready to be written out.
|
boolean |
getCacheOnWrite()
Returns true if inline blocks produced by this writer should be cached
|
org.apache.hadoop.io.Writable |
getDataWriter()
Get a writable interface into bloom filter data (the actual Bloom bits).
|
BlockType |
getInlineBlockType()
The type of blocks this block writer produces.
|
org.apache.hadoop.io.Writable |
getMetaWriter()
Get a writable interface into bloom filter meta data.
|
Cell |
getPrevCell()
Returns the previous cell written by this writer
|
boolean |
shouldWriteBlock(boolean closing)
Determines whether there is a new block to be written out.
|
void |
writeInlineBlock(DataOutput out)
Writes the block to the provided stream.
|
getByteSize, getKeyCount, getMaxKeys
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getByteSize, getKeyCount, getMaxKeys
private static final org.slf4j.Logger LOG
private BloomFilterChunk chunk
private BloomFilterChunk prevChunk
private int maxFold
private int chunkByteSize
private Queue<CompoundBloomFilterWriter.ReadyChunk> readyChunks
private byte[] firstKeyInChunk
private HFileBlockIndex.BlockIndexWriter bloomBlockIndexWriter
private boolean cacheOnWrite
public CompoundBloomFilterWriter(int chunkByteSizeHint, float errorRate, int hashType, int maxFold, boolean cacheOnWrite, CellComparator comparator, BloomType bloomType)
public boolean shouldWriteBlock(boolean closing)
InlineBlockWriter
shouldWriteBlock
in interface InlineBlockWriter
private void enqueueReadyChunk(boolean closing)
closing
- true if we are closing the file, so we do not expect new keys to show uppublic void append(Cell cell) throws IOException
CellSink
append
in interface CellSink
cell
- the cell to be addedIOException
public void beforeShipped() throws IOException
ShipperListener
Shipper.shipped()
is performedbeforeShipped
in interface ShipperListener
IOException
public Cell getPrevCell()
BloomFilterWriter
getPrevCell
in interface BloomFilterWriter
private void allocateNewChunk()
public void writeInlineBlock(DataOutput out) throws IOException
InlineBlockWriter
InlineBlockWriter.shouldWriteBlock(boolean)
returned true. a stream (usually a compressing stream) to
write the block towriteInlineBlock
in interface InlineBlockWriter
IOException
public void blockWritten(long offset, int onDiskSize, int uncompressedSize)
InlineBlockWriter
blockWritten
in interface InlineBlockWriter
offset
- the offset of the block in the streamonDiskSize
- the on-disk size of the blockuncompressedSize
- the uncompressed size of the blockpublic BlockType getInlineBlockType()
InlineBlockWriter
getInlineBlockType
in interface InlineBlockWriter
public void compactBloom()
BloomFilterWriter
compactBloom
in interface BloomFilterWriter
public org.apache.hadoop.io.Writable getMetaWriter()
BloomFilterWriter
getMetaWriter
in interface BloomFilterWriter
public org.apache.hadoop.io.Writable getDataWriter()
BloomFilterWriter
getDataWriter
in interface BloomFilterWriter
public boolean getCacheOnWrite()
InlineBlockWriter
getCacheOnWrite
in interface InlineBlockWriter
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.