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: v10.2.4~61^2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=13daaffb451e7187d5492a82bb85488c1bfe55d2;p=ceph.git rbd-mirror: include tag tid in bootstrap debug log messages Signed-off-by: Jason Dillaman (cherry picked from commit 47d1e625006d554164f020e496a847735240ec95) --- diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index af44f00752cb..2a975ae9eb37 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -695,6 +695,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 ec3b328d88d4..fa88e401a7d4 100644 --- a/src/librbd/Journal.h +++ b/src/librbd/Journal.h @@ -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(); diff --git a/src/test/librbd/mock/MockJournal.h b/src/test/librbd/mock/MockJournal.h index 48447c3b8b47..8532004f8eb1 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 263eebc91b6b..fb8354083fb8 100644 --- a/src/tools/rbd_mirror/ImageReplayer.cc +++ b/src/tools/rbd_mirror/ImageReplayer.cc @@ -1023,6 +1023,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 db83a4a068a4..bb0ab6077c47 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -486,13 +486,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 @@ -513,15 +515,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) {