]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: improved debugging for journal client / tag processing
authorJason Dillaman <dillaman@redhat.com>
Fri, 26 Feb 2016 17:32:25 +0000 (12:32 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 8 Mar 2016 14:03:43 +0000 (09:03 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/Journal.cc
src/librbd/journal/Types.cc
src/librbd/journal/Types.h

index f9aff5bf23c1c6a84b778d82c6f43ccbb6db078a..871abcf0a2444e6f9f6e33e960debda1479cad64 100644 (file)
@@ -59,6 +59,10 @@ struct C_DecodeTag : public Context {
       lderr(cct) << "failed to decode allocated tag" << dendl;
       return r;
     }
+
+    ldout(cct, 20) << "allocated journal tag: "
+                   << "tid=" << tag.tid << ", "
+                   << "data=" << *tag_data << dendl;
     return 0;
   }
 
@@ -117,6 +121,10 @@ struct C_DecodeTags : public Context {
       lderr(cct) << "failed to decode journal tag" << dendl;
       return r;
     }
+
+    ldout(cct, 20) << "most recent journal tag: "
+                   << "tid=" << *tag_tid << ", "
+                   << "data=" << *tag_data << dendl;
     return 0;
   }
 };
@@ -771,7 +779,7 @@ void Journal<I>::handle_initialized(int r) {
   assert(m_state == STATE_INITIALIZING);
 
   if (r < 0) {
-    lderr(cct) << this << " " << __func__
+    lderr(cct) << this << " " << __func__ << ": "
                << "failed to initialize journal: " << cpp_strerror(r)
                << dendl;
     destroy_journaler(r);
@@ -808,6 +816,9 @@ void Journal<I>::handle_initialized(int r) {
   }
 
   m_tag_class = image_client_meta->tag_class;
+  ldout(cct, 20) << "client: " << client << ", "
+                 << "image meta: " << *image_client_meta << dendl;
+
   C_DecodeTags *tags_ctx = new C_DecodeTags(
     cct, &m_lock, &m_tag_tid, &m_tag_data, create_async_context_callback(
       m_image_ctx, create_context_callback<
index 2be074d267a28533f4de0820ee1491be073939fc..8da835eaf5fdf949d612c1ecc85bf1587b17133a 100644 (file)
@@ -478,11 +478,7 @@ void TagData::generate_test_instances(std::list<TagData *> &o) {
   o.push_back(new TagData("mirror-uuid", "remote-mirror-uuid", true, 123, 234));
 }
 
-} // namespace journal
-} // namespace librbd
-
-std::ostream &operator<<(std::ostream &out,
-                         const librbd::journal::EventType &type) {
+std::ostream &operator<<(std::ostream &out, const EventType &type) {
   using namespace librbd::journal;
 
   switch (type) {
@@ -532,8 +528,7 @@ std::ostream &operator<<(std::ostream &out,
   return out;
 }
 
-std::ostream &operator<<(std::ostream &out,
-                         const librbd::journal::ClientMetaType &type) {
+std::ostream &operator<<(std::ostream &out, const ClientMetaType &type) {
   using namespace librbd::journal;
 
   switch (type) {
@@ -551,5 +546,26 @@ std::ostream &operator<<(std::ostream &out,
     break;
   }
   return out;
+}
 
+std::ostream &operator<<(std::ostream &out, const ImageClientMeta &meta) {
+  out << "[tag_class=" << meta.tag_class << "]";
+  return out;
 }
+
+std::ostream &operator<<(std::ostream &out, const TagData &tag_data) {
+  out << "["
+      << "mirror_uuid=" << tag_data.mirror_uuid << ", "
+      << "predecessor_mirror_uuid=" << tag_data.predecessor_mirror_uuid;
+  if (tag_data.predecessor_commit_valid) {
+    out << ", "
+        << "predecessor_tag_tid=" << tag_data.predecessor_tag_tid << ", "
+        << "predecessor_entry_tid=" << tag_data.predecessor_entry_tid;
+  }
+  out << "]";
+  return out;
+}
+
+} // namespace journal
+} // namespace librbd
+
index e355060065b89bfa7b2a6527c17b9661607beda7..252ab7767590a528772d178eb6e8e9ea7bd74809 100644 (file)
@@ -429,14 +429,14 @@ struct TagData {
   static void generate_test_instances(std::list<TagData *> &o);
 };
 
+std::ostream &operator<<(std::ostream &out, const EventType &type);
+std::ostream &operator<<(std::ostream &out, const ClientMetaType &type);
+std::ostream &operator<<(std::ostream &out, const ImageClientMeta &meta);
+std::ostream &operator<<(std::ostream &out, const TagData &tag_data);
+
 } // namespace journal
 } // namespace librbd
 
-std::ostream &operator<<(std::ostream &out,
-                         const librbd::journal::EventType &type);
-std::ostream &operator<<(std::ostream &out,
-                         const librbd::journal::ClientMetaType &type);
-
 WRITE_CLASS_ENCODER(librbd::journal::EventEntry);
 WRITE_CLASS_ENCODER(librbd::journal::ClientData);
 WRITE_CLASS_ENCODER(librbd::journal::TagData);