From c3c13db346749c3dfe45e167db2129c645377e9e Mon Sep 17 00:00:00 2001 From: Haobo Xu Date: Mon, 20 May 2013 21:28:09 -0700 Subject: [PATCH] [RocksDB] [Performance Bug] MemTable::Get Slow Summary: The merge operator diff introduced a performance problem in MemTable::Get. An exit condition is missed when the current key does not match the user key. This could lead to full memtable scan if the user key is not found. Test Plan: make check; db_bench Reviewers: dhruba Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D10851 --- db/memtable.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/memtable.cc b/db/memtable.cc index 097b60ff5..7a7c6bb7a 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -185,6 +185,9 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s, return true; } } + } else { + // exit loop if user key does not match + break; } }