From 0c4f2f34b78b634efe7f4d56694e2edeeda5a130 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Mon, 19 Aug 2013 00:02:24 -0700 Subject: PGLog: add a config to disable PGLog::check() This is a debug check which may be causing excessive cpu usage. Signed-off-by: Samuel Just --- src/common/config_opts.h | 3 +++ src/osd/PG.cc | 2 +- src/osd/PGLog.h | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index d933250f282..df206c007f4 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -483,6 +483,9 @@ OPTION(osd_leveldb_compression, OPT_BOOL, true) // OSD's leveldb uses compressio OPTION(osd_leveldb_paranoid, OPT_BOOL, false) // OSD's leveldb paranoid flag OPTION(osd_leveldb_log, OPT_STR, "") // enable OSD leveldb log file +// determines whether PGLog::check() compares written out log to stored log +OPTION(osd_debug_pg_log_writeout, OPT_BOOL, true) + /** * osd_client_op_priority and osd_recovery_op_priority adjust the relative * priority of client io vs recovery io. diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 8e78eaa7a16..00c0c15d557 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -158,7 +158,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, deleting(false), dirty_info(false), dirty_big_info(false), info(p), info_struct_v(0), - coll(p), log_oid(loid), biginfo_oid(ioid), + coll(p), pg_log(g_ceph_context), log_oid(loid), biginfo_oid(ioid), recovery_item(this), scrub_item(this), scrub_finalize_item(this), snap_trim_item(this), stat_queue_item(this), recovery_ops_active(0), waiting_on_backfill(0), diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 68317750332..955b9c18937 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -21,6 +21,7 @@ #include "include/assert.h" #include "osd_types.h" #include "os/ObjectStore.h" +#include "common/ceph_context.h" #include using namespace std; @@ -159,6 +160,7 @@ protected: eversion_t dirty_to; eversion_t dirty_from; bool dirty_divergent_priors; + CephContext *cct; bool is_dirty() const { return !touched_log || @@ -197,6 +199,10 @@ protected: } void check() { assert(log.log.size() == log_keys_debug.size()); + if (cct && + !(cct->_conf->osd_debug_pg_log_writeout)) { + return; + } for (list::iterator i = log.log.begin(); i != log.log.end(); ++i) { @@ -212,9 +218,9 @@ protected: check(); } public: - PGLog() : + PGLog(CephContext *cct = 0) : touched_log(false), dirty_from(eversion_t::max()), - dirty_divergent_priors(false) {} + dirty_divergent_priors(false), cct(cct) {} void reset_backfill(); -- cgit v1.2.1