From: Jason Dillaman Date: Tue, 9 Aug 2016 00:57:45 +0000 (-0400) Subject: rbd-mirror: include tag tid in bootstrap debug log messages X-Git-Tag: v11.0.1~446^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=47d1e625006d554164f020e496a847735240ec95;p=ceph-ci.git rbd-mirror: include tag tid in bootstrap debug log messages Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index 71743c14107..571f3d77daa 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -624,6 +624,11 @@ bool Journal::is_tag_owner() const { return (m_tag_data.mirror_uuid == LOCAL_MIRROR_UUID); } +template +uint64_t Journal::get_tag_tid() const { + return m_tag_tid; +} + template journal::TagData Journal::get_tag_data() const { return m_tag_data; diff --git a/src/librbd/Journal.h b/src/librbd/Journal.h index 7777e8090a8..e5099d92e63 100644 --- a/src/librbd/Journal.h +++ b/src/librbd/Journal.h @@ -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(); diff --git a/src/test/librbd/mock/MockJournal.h b/src/test/librbd/mock/MockJournal.h index 48447c3b8b4..8532004f8eb 100644 --- a/src/test/librbd/mock/MockJournal.h +++ b/src/test/librbd/mock/MockJournal.h @@ -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()); diff --git a/src/tools/rbd_mirror/ImageReplayer.cc b/src/tools/rbd_mirror/ImageReplayer.cc index d44e347dcd3..d79b205b796 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -982,6 +982,10 @@ void ImageReplayer::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::handle_allocate_local_tag>(this); m_local_journal->allocate_tag( diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index e6f6da28102..e9cccd13928 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -481,13 +481,15 @@ void BootstrapRequest::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::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) {