From: Mykola Golub Date: Wed, 4 May 2016 12:30:05 +0000 (+0300) Subject: rbd-mirror: don't return split-brain error if we still in MIRROR_PEER_STATE_SYNCING X-Git-Tag: v10.2.2~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=03466f096adcfe3322cad49c959fec976d887860;p=ceph.git rbd-mirror: don't return split-brain error if we still in MIRROR_PEER_STATE_SYNCING Signed-off-by: Mykola Golub (cherry picked from commit 3ac620c5d66d8516e68264fcdb5e97b0e803d0ec) --- diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc index 6aec1dd016d8..c2753bae4ef5 100644 --- a/src/test/rbd_mirror/test_ImageReplayer.cc +++ b/src/test/rbd_mirror/test_ImageReplayer.cc @@ -400,15 +400,12 @@ TEST_F(TestImageReplayer, StartInterrupted) ASSERT_EQ(0, stop_cond.wait()); } -TEST_F(TestImageReplayer, ErrorJournalReset) +TEST_F(TestImageReplayer, JournalReset) { bootstrap(); - ASSERT_EQ(0, librbd::Journal<>::reset(m_remote_ioctx, m_remote_image_id)); - - C_SaferCond cond; - m_replayer->start(&cond); - ASSERT_EQ(-EEXIST, cond.wait()); + // try to recover + bootstrap(); } TEST_F(TestImageReplayer, ErrorNoJournal) diff --git a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc index 4c1278401a60..a3ab50d93280 100644 --- a/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc +++ b/src/tools/rbd_mirror/image_replayer/BootstrapRequest.cc @@ -516,6 +516,8 @@ void BootstrapRequest::handle_get_remote_tags(int r) { } else if (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) { + dout(20) << ": previous sync was canceled" << dendl; } else { derr << ": split-brain detected -- skipping image replay" << dendl; m_ret_val = -EEXIST;