tableCfg.setCacheIndexAndFilterBlocks(true); tableCfg.setPinL0FilterAndIndexBlocksInCache(true); tableCfg.setFilter(new BloomFilter(10, false));
public void close() { readOptions.close(); writeOptions.close(); column.close(); colFamilyOptions.close(); bloomFilter.close(); db = null; }
/** * BloomFilter constructor * * <p> * bits_per_key: bits per key in bloom filter. A good value for bits_per_key * is 10, which yields a filter with ~ 1% false positive rate. * <p><strong>default bits_per_key</strong>: 10</p> * * <p>use_block_based_builder: use block based filter rather than full filter. * If you want to builder full filter, it needs to be set to false. * </p> * <p><strong>default mode: block based filter</strong></p> * <p> * Callers must delete the result after any database that is using the * result has been closed.</p> * * @param bitsPerKey number of bits to use * @param useBlockBasedMode use block based mode or full filter mode */ public BloomFilter(final int bitsPerKey, final boolean useBlockBasedMode) { super(createNewBloomFilter(bitsPerKey, useBlockBasedMode)); }
public void close() { readOptions.close(); writeOptions.close(); column.close(); bloomFilter.close(); colFamilyOptions.close(); db = null; }
@Override public ColumnFamilyOptions createColumnOptions() { final long blockCacheSize = 256 * 1024 * 1024; final long blockSize = 128 * 1024; final long targetFileSize = 256 * 1024 * 1024; final long writeBufferSize = 64 * 1024 * 1024; return new ColumnFamilyOptions() .setCompactionStyle(CompactionStyle.LEVEL) .setLevelCompactionDynamicLevelBytes(true) .setTargetFileSizeBase(targetFileSize) .setMaxBytesForLevelBase(4 * targetFileSize) .setWriteBufferSize(writeBufferSize) .setMinWriteBufferNumberToMerge(3) .setMaxWriteBufferNumber(4) .setTableFormatConfig( new BlockBasedTableConfig() .setBlockCacheSize(blockCacheSize) .setBlockSize(blockSize) .setFilter(new BloomFilter()) ); } },
tableOptions.setFilter(new BloomFilter(DEFAULT_BLOOM_FILTER_BITS, false));
@Override protected void init() throws FailStoreException { try { options = new Options(); options.setCreateIfMissing(true) .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) .setCompressionType(CompressionType.SNAPPY_COMPRESSION) .setCompactionStyle(CompactionStyle.UNIVERSAL); Filter bloomFilter = new BloomFilter(10); BlockBasedTableConfig tableConfig = new BlockBasedTableConfig(); tableConfig.setBlockCacheSize(64 * SizeUnit.KB) .setFilter(bloomFilter) .setCacheNumShardBits(6) .setBlockSizeDeviation(5) .setBlockRestartInterval(10) .setCacheIndexAndFilterBlocks(true) .setHashIndexAllowCollision(false) .setBlockCacheCompressedSize(64 * SizeUnit.KB) .setBlockCacheCompressedNumShardBits(10); options.setTableFormatConfig(tableConfig); } catch (Exception e) { throw new FailStoreException(e); } }
@Override protected void init() throws FailStoreException { try { options = new Options(); options.setCreateIfMissing(true) .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) .setCompressionType(CompressionType.SNAPPY_COMPRESSION) .setCompactionStyle(CompactionStyle.UNIVERSAL); Filter bloomFilter = new BloomFilter(10); BlockBasedTableConfig tableConfig = new BlockBasedTableConfig(); tableConfig.setBlockCacheSize(64 * SizeUnit.KB) .setFilter(bloomFilter) .setCacheNumShardBits(6) .setBlockSizeDeviation(5) .setBlockRestartInterval(10) .setCacheIndexAndFilterBlocks(true) .setHashIndexAllowCollision(false) .setBlockCacheCompressedSize(64 * SizeUnit.KB) .setBlockCacheCompressedNumShardBits(10); options.setTableFormatConfig(tableConfig); } catch (Exception e) { throw new FailStoreException(e); } }
tableOptions.setFilter(new BloomFilter(DEFAULT_BLOOM_FILTER_BITS, false));
private ColumnFamilyOptions newColFamilyOptions() { ColumnFamilyOptions colFamilyOptions = new ColumnFamilyOptions(); // enable bloom filter to speed up RocksDB.get() calls BlockBasedTableConfig tableFormatConfig = new BlockBasedTableConfig(); BloomFilter bloomFilter = new BloomFilter(); tableFormatConfig.setFilter(bloomFilter); colFamilyOptions.setTableFormatConfig(tableFormatConfig); // cause the Windows jar doesn't come with // snappy and hence fails colFamilyOptions.setCompressionType(CompressionType.NO_COMPRESSION); return colFamilyOptions; }
private ColumnFamilyOptions newColFamilyOptions() { ColumnFamilyOptions colFamilyOptions = new ColumnFamilyOptions(); // enable bloom filter to speed up RocksDB.get() calls BlockBasedTableConfig tableFormatConfig = new BlockBasedTableConfig(); BloomFilter bloomFilter = new BloomFilter(); tableFormatConfig.setFilter(bloomFilter); colFamilyOptions.setTableFormatConfig(tableFormatConfig); // cause the Windows jar doesn't come with // snappy and hence fails colFamilyOptions.setCompressionType(CompressionType.NO_COMPRESSION); return colFamilyOptions; }
blockConfig.setFilter(new BloomFilter(16, false));
public RocksdbDAGStore(RocksDB db) { this.db = db; try { // enable bloom filter to speed up RocksDB.get() calls BlockBasedTableConfig tableFormatConfig = new BlockBasedTableConfig(); bloomFilter = new BloomFilter(); tableFormatConfig.setFilter(bloomFilter); colFamilyOptions = new ColumnFamilyOptions(); colFamilyOptions.setTableFormatConfig(tableFormatConfig); byte[] tableNameKey = "trees".getBytes(Charsets.UTF_8); ColumnFamilyDescriptor columnDescriptor = new ColumnFamilyDescriptor(tableNameKey, colFamilyOptions); column = db.createColumnFamily(columnDescriptor); } catch (RocksDBException e) { throw Throwables.propagate(e); } writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); writeOptions.setSync(false); readOptions = new ReadOptions(); readOptions.setFillCache(false).setVerifyChecksums(false); }
public RocksdbNodeStore(RocksDB db) { this.db = db; try { // enable bloom filter to speed up RocksDB.get() calls BlockBasedTableConfig tableFormatConfig = new BlockBasedTableConfig(); bloomFilter = new BloomFilter(); tableFormatConfig.setFilter(bloomFilter); colFamilyOptions = new ColumnFamilyOptions(); colFamilyOptions.setTableFormatConfig(tableFormatConfig); byte[] tableNameKey = "nodes".getBytes(Charsets.UTF_8); ColumnFamilyDescriptor columnDescriptor = new ColumnFamilyDescriptor(tableNameKey, colFamilyOptions); column = db.createColumnFamily(columnDescriptor); } catch (RocksDBException e) { throw Throwables.propagate(e); } this.writeOptions = new WriteOptions(); writeOptions.setDisableWAL(true); writeOptions.setSync(false); readOptions = new ReadOptions(); readOptions.setFillCache(false).setVerifyChecksums(false); }
@Override public ColumnFamilyOptions createColumnOptions() { final long blockCacheSize = 256 * 1024 * 1024; final long blockSize = 128 * 1024; final long targetFileSize = 256 * 1024 * 1024; final long writeBufferSize = 64 * 1024 * 1024; return new ColumnFamilyOptions() .setCompactionStyle(CompactionStyle.LEVEL) .setLevelCompactionDynamicLevelBytes(true) .setTargetFileSizeBase(targetFileSize) .setMaxBytesForLevelBase(4 * targetFileSize) .setWriteBufferSize(writeBufferSize) .setMinWriteBufferNumberToMerge(3) .setMaxWriteBufferNumber(4) .setTableFormatConfig( new BlockBasedTableConfig() .setBlockCacheSize(blockCacheSize) .setBlockSize(blockSize) .setFilter(new BloomFilter()) ); } },
@Override public ColumnFamilyOptions createColumnOptions() { final long blockCacheSize = 256 * 1024 * 1024; final long blockSize = 128 * 1024; final long targetFileSize = 256 * 1024 * 1024; final long writeBufferSize = 64 * 1024 * 1024; return new ColumnFamilyOptions() .setCompactionStyle(CompactionStyle.LEVEL) .setLevelCompactionDynamicLevelBytes(true) .setTargetFileSizeBase(targetFileSize) .setMaxBytesForLevelBase(4 * targetFileSize) .setWriteBufferSize(writeBufferSize) .setMinWriteBufferNumberToMerge(3) .setMaxWriteBufferNumber(4) .setTableFormatConfig( new BlockBasedTableConfig() .setBlockCacheSize(blockCacheSize) .setBlockSize(blockSize) .setFilter(new BloomFilter()) ); } },
blockConfig.setFilter(new BloomFilter(16, false));
@Override protected void init() throws FailStoreException { try { options = new Options(); options.setCreateIfMissing(true) .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) .setCompressionType(CompressionType.SNAPPY_COMPRESSION) .setCompactionStyle(CompactionStyle.UNIVERSAL); Filter bloomFilter = new BloomFilter(10); BlockBasedTableConfig tableConfig = new BlockBasedTableConfig(); tableConfig.setBlockCacheSize(64 * SizeUnit.KB) .setFilter(bloomFilter) .setCacheNumShardBits(6) .setBlockSizeDeviation(5) .setBlockRestartInterval(10) .setCacheIndexAndFilterBlocks(true) .setHashIndexAllowCollision(false) .setBlockCacheCompressedSize(64 * SizeUnit.KB) .setBlockCacheCompressedNumShardBits(10); options.setTableFormatConfig(tableConfig); } catch (Exception e) { throw new FailStoreException(e); } }
tableOptions.setChecksumType(ChecksumType.kxxHash); if (bloomFilterBitsPerKey > 0) { tableOptions.setFilter(new BloomFilter(bloomFilterBitsPerKey, false));