]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd-mirror: avoid deleting image snapshots that are part of a group snapshot
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Tue, 16 Dec 2025 13:47:26 +0000 (19:17 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Tue, 27 Jan 2026 06:15:21 +0000 (11:45 +0530)
On daemon restart, the image replayer currently deletes and recreates image
snapshots if object copying has not yet started, in order to avoid missing
image state such as object-map or metadata.

This logic is unnecessary for image snapshot part of mirror group snapshots. By
the time a group snapshot reaches GROUP_SNAPSHOT_STATE_CREATED, all member
image snapshots are already guaranteed to be in the CREATED state. Deleting
such image snapshots provides no benefit and can cause group snapshots to
become stuck (in current case) waiting for such image snapshots.

Skip image snapshot deletion when the snapshot is part of a group snapshot.
A follow-up commit will address handling group snapshots that remain in
GROUP_SNAPSHOT_STATE_CREATING across a daemon restart by deleting and
allowing the syncing recreating the group snapshot as a whole.

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

index f951f88b56e0f634f22b1b1e9ecd4fe18f324a5b..e81d5b7df0c9219e1e8047ef2c837cc669bdacfa 100644 (file)
@@ -518,9 +518,11 @@ void Replayer<I>::scan_local_mirror_snapshots(
         // the first non-primary snapshot since we know its snapshot is
         // well-formed because otherwise the mirror-image-state would have
         // forced an image deletion.
-        m_prune_snap_ids.clear();
-        m_prune_snap_ids.insert(local_snap_id);
-        break;
+        if (!mirror_ns->group_spec.is_valid()) {
+          m_prune_snap_ids.clear();
+          m_prune_snap_ids.insert(local_snap_id);
+          break;
+        }
       } else {
         // start snap will be last complete mirror snapshot or initial
         // image revision