]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd_mirror: fix resync failure
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Wed, 12 Feb 2025 14:24:44 +0000 (19:54 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 24 Apr 2025 15:56:30 +0000 (21:26 +0530)
Steps to reproduce:
$ rbd --cluster site-b mirror group promote test_pool/test_group --force
$ rbd --cluster site-a mirror group demote test_pool/test_group
$ rbd --cluster site-a mirror group resync test_pool/test_group

$ rbd --cluster site-b mirror group status test_pool/test_group

The group snapshots are are not re-syncing. And the group status shows image
snap as syncing always.

fixes: issue#11

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
src/tools/rbd_mirror/group_replayer/BootstrapRequest.cc
src/tools/rbd_mirror/group_replayer/Replayer.cc

index 2a430c0f44025c85ca0d8bfb72f10d68ae31c00e..84ef18b54cb9657b3617bf117942393e07bd4144 100644 (file)
@@ -123,6 +123,7 @@ void BootstrapRequest<I>::send() {
     if (r < 0 && r != -ENOENT) {
       derr << "failed reading metadata: " << cpp_strerror(r) << dendl;
     } else if (r == 0) {
+      dout(10) << "local group resync requested" << dendl;
       *m_resync_requested = true;
     }
   }
index b9a3084e97680ebcfb23a16df483639065e9b837..3c45a83d8cf9775af275882ce1b8f1a558c8c22c 100644 (file)
@@ -538,7 +538,9 @@ void Replayer<I>::scan_for_unsynced_group_snapshots() {
       }
       auto prev_remote_snap_ns = std::get_if<cls::rbd::GroupSnapshotNamespaceMirror>(
           &prev_remote_snap->snapshot_namespace);
-      if (prev_remote_snap_ns && prev_remote_snap_ns->is_demoted()) {
+      if (prev_remote_snap_ns &&
+          (prev_remote_snap_ns->state != cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY ||
+           prev_remote_snap_ns->state != cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY_DEMOTED)) {
         break;
       }
     }