]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/LevelDBStore:fix bug when compact_on_mount 4372/head
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Thu, 16 Apr 2015 05:42:42 +0000 (13:42 +0800)
committerXiaoxi Chen <xiaoxi.chen@intel.com>
Thu, 16 Apr 2015 05:43:23 +0000 (13:43 +0800)
Initialize the performance counter(l_rocksdb_compact)
before use it in compact().

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
src/os/LevelDBStore.cc

index aa58f4e27e333bb24cd8f70eabda2930cb15069e..65bb41be7ecb75d96a05a675668d739df70d9506 100644 (file)
@@ -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");
@@ -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;
 }