kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [kafka] Diff for: [GitHub] mjsax closed pull request #3048: KAFKA-4850:RocksDb cannot use Bloom Filters
Date Tue, 15 Jan 2019 04:03:08 GMT
diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle
index cdd8c235d44..7aa3a7e05e1 100644
--- a/gradle/dependencies.gradle
+++ b/gradle/dependencies.gradle
@@ -62,7 +62,7 @@ versions += [
   metrics: "2.2.0",
   powermock: "1.6.4",
   reflections: "0.9.11",
-  rocksDB: "5.0.1",
+  rocksDB: "5.2.1",
   scalaTest: "3.0.2",
   scalaParserCombinators: "1.0.4",
   scoverage: "1.3.0",
diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
index da582b4ab81..a419a3ec809 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
@@ -33,6 +33,7 @@
 import org.apache.kafka.streams.state.RocksDBConfigSetter;
 import org.apache.kafka.streams.state.StateSerdes;
 import org.rocksdb.BlockBasedTableConfig;
+import org.rocksdb.BloomFilter;
 import org.rocksdb.CompactionStyle;
 import org.rocksdb.CompressionType;
 import org.rocksdb.FlushOptions;
@@ -79,6 +80,7 @@
     private static final int TTL_SECONDS = TTL_NOT_USED;
     private static final int MAX_WRITE_BUFFERS = 3;
     private static final String DB_FILE_DIR = "rocksdb";
+    private static final int BITS_PER_KEY = 10;
 
     private final String name;
     private final String parentDir;
@@ -112,11 +114,14 @@
     @SuppressWarnings("unchecked")
     public void openDB(ProcessorContext context) {
         // initialize the default rocksdb options
+
+        options = new Options();
+
         final BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
         tableConfig.setBlockCacheSize(BLOCK_CACHE_SIZE);
         tableConfig.setBlockSize(BLOCK_SIZE);
+        tableConfig.setFilter(new BloomFilter(BITS_PER_KEY));
 
-        options = new Options();
         options.setTableFormatConfig(tableConfig);
         options.setWriteBufferSize(WRITE_BUFFER_SIZE);
         options.setCompressionType(COMPRESSION_TYPE);


With regards,
Apache Git Services

Mime
View raw message