From: Samuel Just Date: Mon, 2 Feb 2015 17:07:27 +0000 (-0800) Subject: PGLog: improve PGLog::check() debugging X-Git-Tag: v0.80.10~24^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4243%2Fhead;p=ceph.git PGLog: improve PGLog::check() debugging Related: 10718 Signed-off-by: Samuel Just (cherry picked from commit c656bcec2441c90b084ca50a17c37625d69942a1) --- diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index a6b2cb534270e..f08105513549c 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -690,6 +690,32 @@ void PGLog::merge_log(ObjectStore::Transaction& t, } } +void PGLog::check() { + if (!pg_log_debug) + return; + if (log.log.size() != log_keys_debug.size()) { + derr << "log.log.size() != log_keys_debug.size()" << dendl; + derr << "actual log:" << dendl; + for (list::iterator i = log.log.begin(); + i != log.log.end(); + ++i) { + derr << " " << *i << dendl; + } + derr << "log_keys_debug:" << dendl; + for (set::const_iterator i = log_keys_debug.begin(); + i != log_keys_debug.end(); + ++i) { + derr << " " << *i << dendl; + } + } + assert(log.log.size() == log_keys_debug.size()); + for (list::iterator i = log.log.begin(); + i != log.log.end(); + ++i) { + assert(log_keys_debug.count(i->get_key_name())); + } +} + void PGLog::write_log( ObjectStore::Transaction& t, const hobject_t &log_oid) { diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 1744cc8f49cca..c1563f8d91431 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -267,17 +267,8 @@ protected: i != log_keys_debug->end() && *i < ub; log_keys_debug->erase(i++)); } - void check() { - if (!pg_log_debug) - return; - assert(log.log.size() == log_keys_debug.size()); - for (list::iterator i = log.log.begin(); - i != log.log.end(); - ++i) { - assert(log_keys_debug.count(i->get_key_name())); - } - } + void check(); void undirty() { dirty_to = eversion_t(); dirty_from = eversion_t::max();