]> git.apps.os.sepia.ceph.com Git - ceph-ci.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, 16 Aug 2016 13:09:52 +0000 (09:09 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
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 71743c14107019edfa24bf9f1d980eff6f529252..571f3d77daa6082c41de089c7aefb0bfb7eebec2 100644 (file)
@@ -624,6 +624,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 7777e8090a851601dbc0d13c7eac6eb7543764ad..e5099d92e632402b6b334a4e9b78703b76eac6c5 100644 (file)
@@ -118,6 +118,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 d44e347dcd331559cf9cb9f98be2fa2a6de5b99c..d79b205b79629e076309b936de03edd2d1b79aba 100644 (file)
@@ -982,6 +982,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 e6f6da28102d6add0c5fda8b5a0d7f098ee511b4..e9cccd13928cf6736ee437d60d1ecb6176b5faf1 100644 (file)
@@ -481,13 +481,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
@@ -508,15 +510,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) {