]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: include tag tid in bootstrap debug log messages
authorJason Dillaman <dillaman@redhat.com>
Tue, 9 Aug 2016 00:57:45 +0000 (20:57 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 11 Oct 2016 16:44:06 +0000 (12:44 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 47d1e625006d554164f020e496a847735240ec95)

src/librbd/Journal.cc
src/librbd/Journal.h
src/test/librbd/mock/MockJournal.h
src/tools/rbd_mirror/ImageReplayer.cc
src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc

index af44f00752cb0696ea1a9aecd21b8b5d586aab0e..2a975ae9eb37c870f0373d85e8d618fb3d81a8e2 100644 (file)
@@ -695,6 +695,11 @@ bool Journal<I>::is_tag_owner() const {
   return (m_tag_data.mirror_uuid == LOCAL_MIRROR_UUID);
 }
 
+template <typename I>
+uint64_t Journal<I>::get_tag_tid() const {
+  return m_tag_tid;
+}
+
 template <typename I>
 journal::TagData Journal<I>::get_tag_data() const {
   return m_tag_data;
index ec3b328d88d40e32442d70fff139ca42541db137..fa88e401a7d41265393ba0ed8b03c067a44d4380 100644 (file)
@@ -119,6 +119,7 @@ public:
   void close(Context *on_finish);
 
   bool is_tag_owner() const;
+  uint64_t get_tag_tid() const;
   journal::TagData get_tag_data() const;
   int demote();
 
index 48447c3b8b4767b4f95db56fed156251ea34e92b..8532004f8eb13e97d1b2877e73f102fce87cccff 100644 (file)
@@ -50,6 +50,7 @@ struct MockJournal {
   MOCK_METHOD1(open, void(Context *));
   MOCK_METHOD1(close, void(Context *));
 
+  MOCK_CONST_METHOD0(get_tag_tid, uint64_t());
   MOCK_CONST_METHOD0(get_tag_data, journal::TagData());
 
   MOCK_METHOD0(allocate_op_tid, uint64_t());
index 263eebc91b6b2a85f5032c665cb5eaf562109831..fb8354083fb839ea706f1c36b82ae2127898279a 100644 (file)
@@ -1023,6 +1023,10 @@ void ImageReplayer<I>::allocate_local_tag() {
     predecessor_mirror_uuid = librbd::Journal<>::LOCAL_MIRROR_UUID;
   }
 
+  dout(20) << "mirror_uuid=" << mirror_uuid << ", "
+           << "predecessor_mirror_uuid=" << predecessor_mirror_uuid << ", "
+           << "replay_tag_tid=" << m_replay_tag_tid << ", "
+           << "replay_tag_data=" << m_replay_tag_data << dendl;
   Context *ctx = create_context_callback<
     ImageReplayer, &ImageReplayer<I>::handle_allocate_local_tag>(this);
   m_local_journal->allocate_tag(
index db83a4a068a437d4b8cf0dcc3408112ec4d52fb4..bb0ab6077c4737bb63b29d5e3d7c416ef776a024 100644 (file)
@@ -486,13 +486,15 @@ void BootstrapRequest<I>::handle_get_remote_tags(int r) {
       bufferlist::iterator it = tag.data.begin();
       ::decode(remote_tag_data, it);
     } catch (const buffer::error &err) {
-      derr << ": failed to decode remote tag: " << err.what() << dendl;
+      derr << ": failed to decode remote tag " << tag.tid << ": "
+           << err.what() << dendl;
       m_ret_val = -EBADMSG;
       close_local_image();
       return;
     }
 
-    dout(10) << ": decoded remote tag: " << remote_tag_data << dendl;
+    dout(10) << ": decoded remote tag " << tag.tid << ": "
+             << remote_tag_data << dendl;
     if (remote_tag_data.mirror_uuid == librbd::Journal<>::ORPHAN_MIRROR_UUID &&
         remote_tag_data.predecessor_mirror_uuid == m_local_mirror_uuid) {
       // remote tag is chained off a local tag demotion
@@ -513,15 +515,17 @@ void BootstrapRequest<I>::handle_get_remote_tags(int r) {
       return;
     }
 
-    librbd::journal::TagData tag_data =
+    uint64_t local_tag_tid = local_image_ctx->journal->get_tag_tid();
+    librbd::journal::TagData local_tag_data =
       local_image_ctx->journal->get_tag_data();
-    dout(20) << ": local tag data: " << tag_data << dendl;
+    dout(20) << ": local tag " << local_tag_tid << ": "
+             << local_tag_data << dendl;
 
-    if (tag_data.mirror_uuid == librbd::Journal<>::ORPHAN_MIRROR_UUID &&
+    if (local_tag_data.mirror_uuid == librbd::Journal<>::ORPHAN_MIRROR_UUID &&
        remote_tag_data.mirror_uuid == librbd::Journal<>::ORPHAN_MIRROR_UUID &&
        remote_tag_data.predecessor_mirror_uuid == m_local_mirror_uuid) {
       dout(20) << ": local image was demoted" << dendl;
-    } else if (tag_data.mirror_uuid == m_remote_mirror_uuid &&
+    } else if (local_tag_data.mirror_uuid == m_remote_mirror_uuid &&
               m_client_meta->state == librbd::journal::MIRROR_PEER_STATE_REPLAYING) {
       dout(20) << ": local image is in clean replay state" << dendl;
     } else if (m_client_meta->state == librbd::journal::MIRROR_PEER_STATE_SYNCING) {