]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog: improve PGLog::check() debugging
authorSamuel Just <sjust@redhat.com>
Mon, 2 Feb 2015 17:07:27 +0000 (09:07 -0800)
committerSamuel Just <sjust@redhat.com>
Mon, 2 Feb 2015 17:07:33 +0000 (09:07 -0800)
Related: 10718
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PGLog.cc
src/osd/PGLog.h

index 4052c00073f127f6f0f220da373f7a0ba5ba2d22..4b0d7db545f576490f75126841dc57f12d70dae4 100644 (file)
@@ -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<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 coll_t& coll, const ghobject_t &log_oid)
 {
index 0c8db5f2ea2450af2c912ea90ed17655747546aa..a62642313d80dbd7a6170ede45b8e0631502ef09 100644 (file)
@@ -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<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();