cout << std::endl;
}
+TEST_P(StoreTest, KVDBStatsTest) {
+ if (string(GetParam()) != "bluestore")
+ return;
+
+ g_conf->set_val("rocksdb_perf", "true");
+ g_conf->set_val("rocksdb_collect_compaction_stats", "true");
+ g_conf->set_val("rocksdb_collect_extended_stats","true");
+ g_conf->set_val("rocksdb_collect_memory_stats","true");
+ g_ceph_context->_conf->apply_changes(NULL);
+ int r = store->umount();
+ ASSERT_EQ(r, 0);
+ r = store->mount(); //to force rocksdb stats
+ ASSERT_EQ(r, 0);
+
+ ObjectStore::Sequencer osr("test");
+ int NUM_OBJS = 200;
+ coll_t cid;
+ string base("testobj.");
+ bufferlist a;
+ bufferptr ap(0x1000);
+ memset(ap.c_str(), 'a', 0x1000);
+ a.append(ap);
+ {
+ ObjectStore::Transaction t;
+ t.create_collection(cid, 0);
+ r = apply_transaction(store, &osr, std::move(t));
+ ASSERT_EQ(r, 0);
+ }
+ for (int i = 0; i < NUM_OBJS; ++i) {
+ ObjectStore::Transaction t;
+ char buf[100];
+ snprintf(buf, sizeof(buf), "%d", i);
+ ghobject_t hoid(hobject_t(sobject_t(base + string(buf), CEPH_NOSNAP)));
+ t.write(cid, hoid, 0, 0x1000, a);
+ r = apply_transaction(store, &osr, std::move(t));
+ ASSERT_EQ(r, 0);
+ }
+
+ Formatter *f = Formatter::create("store_test", "json-pretty", "json-pretty");
+ store->get_db_statistics(f);
+ f->flush(cout);
+ cout << std::endl;
+ g_conf->set_val("rocksdb_perf", "false");
+ g_conf->set_val("rocksdb_collect_compaction_stats", "false");
+ g_conf->set_val("rocksdb_collect_extended_stats","false");
+ g_conf->set_val("rocksdb_collect_memory_stats","false");
+}
+
int main(int argc, char **argv) {
vector<const char*> args;
argv_to_vec(argc, (const char **)argv, args);