Skip to content

Commit a9bc2ed

Browse files
committed
imporve 'scan' performance for #309
1 parent 5f3457d commit a9bc2ed

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/.kv_engine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lmdb
1+
rocksdb

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ else
223223
ifeq ($(storage_engine), rocksdb)
224224
STORAGE_ENGINE=$(ROCKSDB_LIBA)
225225
STORAGE_ENGINE_PATH=$(ROCKSDB_PATH)
226-
INCS+=-I${ROCKSDB_PATH}/include
226+
INCS+=-I${ROCKSDB_PATH}/include -I${ROCKSDB_PATH}
227227
LIBS:= ${ROCKSDB_LIBA} ${SNAPPY_LIBA} ${LIBS} -lz -lbz2
228228
CXXFLAGS+=-D__USE_ROCKSDB__ -std=c++11
229229
else

src/command/keys.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ OP_NAMESPACE_BEGIN
299299
{
300300
if (k.GetType() != KEY_META)
301301
{
302-
iter->Next();
302+
//iter->Next();
303+
KeyObject next(ctx.ns, KEY_END, k.GetKey());
304+
iter->Jump(next);
303305
continue;
304306
}
305307
k.GetKey().ToString(match_element);

src/db/rocksdb/rocksdb_engine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "thread/spin_mutex_lock.hpp"
3737
#include "db/db.hpp"
3838

39+
3940
OP_NAMESPACE_BEGIN
4041

4142
static inline rocksdb::Slice to_rocksdb_slice(const Slice& slice)
@@ -1309,6 +1310,7 @@ OP_NAMESPACE_BEGIN
13091310
std::map<rocksdb::MemoryUtil::UsageType, uint64_t> usage_by_type;
13101311
std::unordered_set<const rocksdb::Cache*> cache_set;
13111312
std::vector<rocksdb::DB*> dbs(1, m_db);
1313+
cache_set.insert(m_db->GetDBOptions().row_cache.get());
13121314
rocksdb::MemoryUtil::GetApproximateMemoryUsageByType(dbs, cache_set, &usage_by_type);
13131315
for (size_t i = 0; i < rocksdb::MemoryUtil::kNumUsageTypes; ++i)
13141316
{

0 commit comments

Comments
 (0)