]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: ensure deterministic ordering of method calls 32274/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 16 Dec 2019 14:46:15 +0000 (09:46 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 16 Dec 2019 14:46:15 +0000 (09:46 -0500)
The mock tests will require method calls in a known order. Previously
different environments could evaluate the parameters in different
orders resulting in out-of-order method calls.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/test_mock_ImageReplayer.cc
src/tools/rbd_mirror/ImageReplayer.cc

index f627d752d2deaa7b4ac09189d1dc3ba31381a289..76a8eb3931940100a42493678e8c1157f95809cb 100644 (file)
@@ -965,10 +965,10 @@ TEST_F(TestMockImageReplayer, ReplayerInterrupted) {
     .WillOnce(Return(false));
   EXPECT_CALL(mock_journal_replayer, is_replaying())
     .WillOnce(Return(false));
-  EXPECT_CALL(mock_journal_replayer, get_error_description())
-    .WillOnce(Return("INVALID"));
   EXPECT_CALL(mock_journal_replayer, get_error_code())
     .WillOnce(Return(-EINVAL));
+  EXPECT_CALL(mock_journal_replayer, get_error_description())
+    .WillOnce(Return("INVALID"));
   expect_shut_down(mock_journal_replayer, 0);
   expect_mirror_image_status_exists(false);
   mock_journal_replayer.replayer_listener->handle_notification();
index efe2ba4e2372a9be70f2ae75e5c6a11c9e6691fa..27fbc4b73783d9c853d12f4256a4494b449e8c56 100644 (file)
@@ -1078,9 +1078,12 @@ void ImageReplayer<I>::handle_replayer_notification() {
   }
 
   if (!m_replayer->is_replaying()) {
-    dout(10) << "replay interrupted" << dendl;
-    on_stop_journal_replay(m_replayer->get_error_code(),
-                           m_replayer->get_error_description());
+    auto error_code = m_replayer->get_error_code();
+    auto error_description = m_replayer->get_error_description();
+    dout(10) << "replay interrupted: "
+             << "r=" << error_code << ", "
+             << "error=" << error_description << dendl;
+    on_stop_journal_replay(error_code, error_description);
     return;
   }