From: Samuel Just Date: Mon, 2 Feb 2015 17:07:27 +0000 (-0800) Subject: PGLog: improve PGLog::check() debugging X-Git-Tag: v0.94~33^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c656bcec2441c90b084ca50a17c37625d69942a1;p=ceph.git PGLog: improve PGLog::check() debugging Related: 10718 Signed-off-by: Samuel Just --- diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index 4052c00073f1..4b0d7db545f5 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -681,6 +681,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 coll_t& coll, const ghobject_t &log_oid) { diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 0c8db5f2ea24..a62642313d80 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -330,17 +330,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();