]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: update mirror peer sync state after completion
authorJason Dillaman <dillaman@redhat.com>
Mon, 28 Mar 2016 14:48:02 +0000 (10:48 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 29 Mar 2016 19:19:25 +0000 (15:19 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/image_sync/test_mock_SyncPointPruneRequest.cc
src/tools/rbd_mirror/image_sync/SyncPointPruneRequest.cc

index 4558d6c55ffe1f8ca3c3f5398d6e33538aac3564..e45bf7839584484b1b8aab71814f3cabf73e967e 100644 (file)
@@ -109,6 +109,7 @@ TEST_F(TestMockImageSyncSyncPointPruneRequest, SyncCompleteSuccess) {
   librbd::journal::MirrorPeerClientMeta client_meta;
   client_meta.sync_points.emplace_front("snap1", boost::none);
   m_client_meta = client_meta;
+  ASSERT_EQ(librbd::journal::MIRROR_PEER_STATE_SYNCING, m_client_meta.state);
 
   librbd::MockImageCtx mock_remote_image_ctx(*m_remote_image_ctx);
   journal::MockJournaler mock_journaler;
@@ -124,6 +125,7 @@ TEST_F(TestMockImageSyncSyncPointPruneRequest, SyncCompleteSuccess) {
   req->send();
   ASSERT_EQ(0, ctx.wait());
   ASSERT_TRUE(m_client_meta.sync_points.empty());
+  ASSERT_EQ(librbd::journal::MIRROR_PEER_STATE_REPLAYING, m_client_meta.state);
 }
 
 TEST_F(TestMockImageSyncSyncPointPruneRequest, RestartedSyncCompleteSuccess) {
index 4b72bc26ee8f3f07cb665fb15ce067e479796b22..332cb00e083423c5272bf429352e8c41d3fe00db 100644 (file)
@@ -154,6 +154,9 @@ void SyncPointPruneRequest<I>::send_update_client() {
 
   if (m_sync_complete) {
     m_client_meta_copy.sync_points.pop_front();
+    if (m_client_meta_copy.sync_points.empty()) {
+      m_client_meta_copy.state = librbd::journal::MIRROR_PEER_STATE_REPLAYING;
+    }
   } else {
     while (m_client_meta_copy.sync_points.size() > 1) {
       m_client_meta_copy.sync_points.pop_back();