]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix OptimizeForPointLookup()
authorSiying Dong <siying.d@fb.com>
Fri, 20 Jan 2017 18:43:59 +0000 (10:43 -0800)
committerYi Wu <yiwu@fb.com>
Fri, 20 Jan 2017 19:15:38 +0000 (11:15 -0800)
Summary:
If users directly call OptimizeForPointLookup(), it is broken as the option isn't compatible with parallel memtable insert. Fix it by using memtable bloomo filter instead.
Closes https://github.com/facebook/rocksdb/pull/1791

Differential Revision: D4442836

Pulled By: siying

fbshipit-source-id: bf6c9cd

db/db_test2.cc
util/options.cc

index 8fdcfda2c0ffa8abd9c5bebc2bd5b500e2c2d48f..ccbed049795f23a7c17260f66a89a85bf418f5a7 100644 (file)
@@ -2216,6 +2216,18 @@ TEST_F(DBTest2, ManualCompactionOverlapManualCompaction) {
 
   rocksdb::SyncPoint::GetInstance()->DisableProcessing();
 }
+
+TEST_F(DBTest2, OptimizeForPointLookup) {
+  Options options = CurrentOptions();
+  Close();
+  options.OptimizeForPointLookup(2);
+  ASSERT_OK(DB::Open(options, dbname_, &db_));
+
+  ASSERT_OK(Put("foo", "v1"));
+  ASSERT_EQ("v1", Get("foo"));
+  Flush();
+  ASSERT_EQ("v1", Get("foo"));
+}
 #endif  // ROCKSDB_LITE
 
 }  // namespace rocksdb
index 34df0ca891309c8fae8ac0c7ee6b0c5820c96003..839fc191647db3f8b5c242f190b83d94f5b20d75 100644 (file)
@@ -700,7 +700,7 @@ ColumnFamilyOptions* ColumnFamilyOptions::OptimizeForPointLookup(
   block_based_options.block_cache =
       NewLRUCache(static_cast<size_t>(block_cache_size_mb * 1024 * 1024));
   table_factory.reset(new BlockBasedTableFactory(block_based_options));
-  memtable_factory.reset(NewHashLinkListRepFactory());
+  memtable_prefix_bloom_size_ratio = 0.02;
   return this;
 }