Skip to content

Commit

Permalink
os/LevelDBStore:fix bug when compact_on_mount
Browse files Browse the repository at this point in the history
Initialize the performance counter(l_rocksdb_compact)
before use it in compact().

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
  • Loading branch information
xiaoxichen819 committed Apr 16, 2015
1 parent 36db6d2 commit 932d59d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/os/LevelDBStore.cc
Expand Up @@ -74,12 +74,6 @@ int LevelDBStore::do_open(ostream &out, bool create_if_missing)
return -EINVAL;
}

if (g_conf->leveldb_compact_on_mount) {
derr << "Compacting leveldb store..." << dendl;
compact();
derr << "Finished compacting leveldb store" << dendl;
}

PerfCountersBuilder plb(g_ceph_context, "leveldb", l_leveldb_first, l_leveldb_last);
plb.add_u64_counter(l_leveldb_gets, "leveldb_get", "Gets");
plb.add_u64_counter(l_leveldb_txns, "leveldb_transaction", "Transactions");
Expand All @@ -89,6 +83,12 @@ int LevelDBStore::do_open(ostream &out, bool create_if_missing)
plb.add_u64(l_leveldb_compact_queue_len, "leveldb_compact_queue_len", "Length of compaction queue");
logger = plb.create_perf_counters();
cct->get_perfcounters_collection()->add(logger);

if (g_conf->leveldb_compact_on_mount) {
derr << "Compacting leveldb store..." << dendl;
compact();
derr << "Finished compacting leveldb store" << dendl;
}
return 0;
}

Expand Down

0 comments on commit 932d59d

Please sign in to comment.