]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog: improve PGLog::check() debugging 4243/head 4382/head
authorSamuel Just <sjust@redhat.com>
Mon, 2 Feb 2015 17:07:27 +0000 (09:07 -0800)
committerxinxin shu <xinxin.shu@intel.com>
Wed, 1 Apr 2015 02:01:42 +0000 (10:01 +0800)
Related: 10718
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit c656bcec2441c90b084ca50a17c37625d69942a1)

src/osd/PGLog.cc
src/osd/PGLog.h

index a6b2cb534270e5a7966bdb63efdf056b8d851a03..f08105513549cb4cfac2d2b6c782da209331e1f5 100644 (file)
@@ -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<pg_log_entry_t>::iterator i = log.log.begin();
+        i != log.log.end();
+        ++i) {
+      derr << "    " << *i << dendl;
+    }
+    derr << "log_keys_debug:" << dendl;
+    for (set<string>::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<pg_log_entry_t>::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)
 {
index 1744cc8f49cca67c6f8cc132ab1b819a5db1a2ec..c1563f8d91431ae1ac34fb94c05a36b68bf8e685 100644 (file)
@@ -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<pg_log_entry_t>::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();