private void addBloomFilter(final BloomFilterWriter bfw, final BlockType blockType) { if (bfw.getKeyCount() <= 0) return; if (blockType != BlockType.GENERAL_BLOOM_META && blockType != BlockType.DELETE_FAMILY_BLOOM_META) { throw new RuntimeException("Block Type: " + blockType.toString() + "is not supported"); } additionalLoadOnOpenData.add(new BlockWritable() { @Override public BlockType getBlockType() { return blockType; } @Override public void writeToBlock(DataOutput out) throws IOException { bfw.getMetaWriter().write(out); Writable dataWriter = bfw.getDataWriter(); if (dataWriter != null) dataWriter.write(out); } }); }
@Override public void addBloomFilter(final BloomFilterWriter bfw) { if (bfw.getKeyCount() <= 0) return; additionalLoadOnOpenData.add(new BlockWritable() { @Override public BlockType getBlockType() { return BlockType.BLOOM_META; } @Override public void writeToBlock(DataOutput out) throws IOException { bfw.getMetaWriter().write(out); Writable dataWriter = bfw.getDataWriter(); if (dataWriter != null) dataWriter.write(out); } }); }
private boolean closeBloomFilter(BloomFilterWriter bfw) throws IOException { boolean haveBloom = (bfw != null && bfw.getKeyCount() > 0); if (haveBloom) { bfw.compactBloom(); } return haveBloom; }
/** * Version 1 general Bloom filters are stored in two meta blocks with two different * keys. */ @Override public void addGeneralBloomFilter(BloomFilterWriter bfw) { appendMetaBlock(BLOOM_FILTER_META_KEY, bfw.getMetaWriter()); Writable dataWriter = bfw.getDataWriter(); if (dataWriter != null) { appendMetaBlock(BLOOM_FILTER_DATA_KEY, dataWriter); } }
/** * Version 1 Bloom filters are stored in two meta blocks with two different * keys. */ @Override public void addBloomFilter(BloomFilterWriter bfw) { appendMetaBlock(BLOOM_FILTER_META_KEY, bfw.getMetaWriter()); Writable dataWriter = bfw.getDataWriter(); if (dataWriter != null) { appendMetaBlock(BLOOM_FILTER_DATA_KEY, dataWriter); } }
@Override public void addGeneralBloomFilter(final BloomFilterWriter bfw) { this.addBloomFilter(bfw, BlockType.GENERAL_BLOOM_META); }
@Override public void addDeleteFamilyBloomFilter(final BloomFilterWriter bfw) { this.addBloomFilter(bfw, BlockType.DELETE_FAMILY_BLOOM_META); }
@Override public void addDeleteFamilyBloomFilter(BloomFilterWriter bfw) throws IOException { throw new IOException("Delete Bloom filter is not supported in HFile V1"); }