Skip to content

rbd-mirror: prune obsolete primary mirror snapshots after relocation - #68161

Merged
idryomov merged 2 commits into
ceph:mainfrom
abitdrag:wip-miki-image-prim-snap-removal
Jun 19, 2026
Merged

idryomov merged 2 commits into
ceph:mainfrom
abitdrag:wip-miki-image-prim-snap-removal

Conversation

@abitdrag

@abitdrag abitdrag commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

rbd-mirror: prune obsolete primary mirror snapshots after relocation
Previously, obsolete primary and demoted primary snapshots on the
secondary cluster were not cleaned up immediately after relocation.
Instead, old primary snapshots remained until a subsequent promote
operation triggered their cleanup, while old demoted primary snapshots
persisted until a later demote operation removed them.

Adding changes for proactive cleanup of obsolete primary and demoted
primary snapshots that are no longer required after relocation.

Also adding test coverage to validate the cleanup behavior.

Fixes: https://tracker.ceph.com/issues/76154

Signed-off-by: Miki Patel [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@abitdrag
abitdrag requested a review from a team as a code owner April 1, 2026 11:50
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 3 times, most recently from a2b5c84 to 7aecd83 Compare April 2, 2026 11:54
@abitdrag

abitdrag commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Current behavior of image replayer, without changes:

Initially: pool1/img3 is primary on cluster1 and secondary on cluster2

root:build# bin/rbd --cluster cluster2 mirror image status pool1/img3
img3:
  global_id:   31b4038d-d17d-4f3b-afaf-6c81bd565f2d
  state:       up+replaying
  description: replaying, {"bytes_per_second":0.0,"bytes_per_snapshot":0.0,"last_snapshot_bytes":0,"last_snapshot_sync_seconds":0,"local_snapshot_timestamp":1777434349,"remote_snapshot_timestamp":1777434349,"replay_state":"idle"}
  service:     admin on li-4c4c4544-0051-4710-8053-c6c04f423534.ibm.com
  last_update: 2026-04-29 09:16:40
  peer_sites:
    name: d763f5d4-2235-4823-a49e-7676dc599853
    state: up+stopped
    description: local image is primary
    last_update: 2026-04-29 09:16:40

root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                       SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                         
     3  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.d65ac22b-c862-4ead-9ca8-722c59164a18  128 MiB             Wed Apr 29 09:15:49 2026  mirror (primary peer_uuids:[7d5fe45a-f591-4cdc-8327-64547f359433])
root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                       
     3  .mirror.non_primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.c8e27247-9c0c-4d0a-89ef-44301dbc9e55  128 MiB             Wed Apr 29 09:16:13 2026  mirror (non-primary peer_uuids:[] 31f8794f-ceb1-410d-a7c6-4ff15aac0ecd:3 copied)

root:build# bin/rbd --cluster cluster1 mirror image demote pool1/img3
Image demoted to non-primary

root:build# bin/rbd --cluster cluster2 mirror image promote pool1/img3
Image promoted to primary

root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                       
     3  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.d65ac22b-c862-4ead-9ca8-722c59164a18      128 MiB             Wed Apr 29 09:15:49 2026  mirror (primary peer_uuids:[])                                                  
     4  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.b180032c-6efe-4347-9175-0ef6ba54554c      128 MiB             Wed Apr 29 09:17:30 2026  mirror (demoted peer_uuids:[7d5fe45a-f591-4cdc-8327-64547f359433])              
     5  .mirror.non_primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.ed7bfbdd-8080-4436-95c4-c2c3f14bf467  128 MiB             Wed Apr 29 09:20:40 2026  mirror (non-primary peer_uuids:[] 854ba614-c4ac-49fe-a6aa-f188b492308c:5 copied)

root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                   
     4  .mirror.non_primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.bba0dc26-b2df-4b4c-b11b-94c9768deab1  128 MiB             Wed Apr 29 09:17:31 2026  mirror (demoted peer_uuids:[] 31f8794f-ceb1-410d-a7c6-4ff15aac0ecd:4 copied)
     5  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.d9880732-4fa2-44f7-9fbc-5f158a16490d      128 MiB             Wed Apr 29 09:20:11 2026  mirror (primary peer_uuids:[61aea86a-700a-4683-b74e-07b9818e4b2e])      

Here, cluster1 have 3 snapshots: primary, demote primary and non-primary. First two snapshots (primary and demote primary) are not useful once relocation happens and new non-primary snapshot is added.

This PR addresses removal of primary and demote primary snapshots post relocation.

root:build# bin/rbd --cluster cluster2 mirror image demote pool1/img3
Image demoted to non-primary
root:build# bin/rbd --cluster cluster1 mirror image promote pool1/img3
Image promoted to primary
root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                   
     4  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.b180032c-6efe-4347-9175-0ef6ba54554c      128 MiB             Wed Apr 29 09:17:30 2026  mirror (demoted peer_uuids:[])                                              
     6  .mirror.non_primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.48d317f6-4161-45c2-8c71-56fe39ca6add  128 MiB             Wed Apr 29 09:26:32 2026  mirror (demoted peer_uuids:[] 854ba614-c4ac-49fe-a6aa-f188b492308c:6 copied)
     7  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.3c399201-6a40-4574-9f5f-ec8680891206      128 MiB             Wed Apr 29 09:27:45 2026  mirror (primary peer_uuids:[7d5fe45a-f591-4cdc-8327-64547f359433])          
root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                       
     5  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.d9880732-4fa2-44f7-9fbc-5f158a16490d      128 MiB             Wed Apr 29 09:20:11 2026  mirror (primary peer_uuids:[])                                                  
     6  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.feea570d-e280-4f18-a018-7fd53a33f0d0      128 MiB             Wed Apr 29 09:26:32 2026  mirror (demoted peer_uuids:[61aea86a-700a-4683-b74e-07b9818e4b2e])              
     7  .mirror.non_primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.3d3369be-3b11-4b06-b25a-92220fb92efa  128 MiB             Wed Apr 29 09:28:10 2026  mirror (non-primary peer_uuids:[] 31f8794f-ceb1-410d-a7c6-4ff15aac0ecd:7 copied)
root:build# bin/rbd --cluster cluster1 mirror image demote pool1/img3
Image demoted to non-primary
root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                       SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                         
     8  .mirror.primary.31b4038d-d17d-4f3b-afaf-6c81bd565f2d.194e15c7-a09d-4ee3-9f81-dce4cdec767d  128 MiB             Wed Apr 29 09:28:43 2026  mirror (demoted peer_uuids:[7d5fe45a-f591-4cdc-8327-64547f359433])

Currently this primary snapshot gets removed on next promote call of img3 on cluster1, demote primary snapshot gets removed on next demote call of img3 on cluster1. Till then they occupy space, hence this PR targets to remove them early when they are not required.

Behavior of image replayer with proposed changes:

Initially: pool1/img3 is primary on cluster1 and secondary on cluster2

root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                       SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                         
     3  .mirror.primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.e5e88ae3-eaad-4844-b3d7-06f70d6aeab4  128 MiB             Thu Apr  2 16:03:51 2026  mirror (primary peer_uuids:[042d1b91-1897-4e06-8c25-e73bf9e9b7ff])
root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                       
     3  .mirror.non_primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.8dab9c7b-1414-4961-b55c-2a423ec2deee  128 MiB             Thu Apr  2 16:04:14 2026  mirror (non-primary peer_uuids:[] 9111d3af-f188-4dd1-8972-2098582b0aa6:3 copied)

Relocating:

root:build# bin/rbd --cluster cluster1 mirror image demote pool1/img3
Image demoted to non-primary
root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                       SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                         
     3  .mirror.primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.e5e88ae3-eaad-4844-b3d7-06f70d6aeab4  128 MiB             Thu Apr  2 16:03:51 2026  mirror (primary peer_uuids:[])                                    
     4  .mirror.primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.cf1be919-f84d-4782-984e-af342bee986b  128 MiB             Thu Apr  2 17:05:03 2026  mirror (demoted peer_uuids:[042d1b91-1897-4e06-8c25-e73bf9e9b7ff])
root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                                                       
     4  .mirror.non_primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.b04b26e0-5f75-4b79-bf00-fb6ef53e5d76  128 MiB             Thu Apr  2 17:05:03 2026  mirror (demoted peer_uuids:[4146ac7c-2a02-4b88-8e2f-bfd39bdbc259] 9111d3af-f188-4dd1-8972-2098582b0aa6:4 copied)
root:build# bin/rbd --cluster cluster2 mirror image promote pool1/img3
Image promoted to primary
root:build# bin/rbd --cluster cluster1 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                       
     5  .mirror.non_primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.97092caf-a5d0-46c2-92c3-1c9aad151ec1  128 MiB             Thu Apr  2 17:05:43 2026  mirror (non-primary peer_uuids:[] 6e02d2c6-3e31-4eb7-b3a9-c5a386eed1a7:5 copied)
root:build# bin/rbd --cluster cluster2 snap list --all pool1/img3
SNAPID  NAME                                                                                           SIZE     PROTECTED  TIMESTAMP                 NAMESPACE                                                                   
     4  .mirror.non_primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.b04b26e0-5f75-4b79-bf00-fb6ef53e5d76  128 MiB             Thu Apr  2 17:05:03 2026  mirror (demoted peer_uuids:[] 9111d3af-f188-4dd1-8972-2098582b0aa6:4 copied)
     5  .mirror.primary.af528f57-288e-4ae9-81ea-ba7bd026abc1.699b30a4-4f2f-4c2a-a887-f7cb199b28cc      128 MiB             Thu Apr  2 17:05:38 2026  mirror (primary peer_uuids:[4146ac7c-2a02-4b88-8e2f-bfd39bdbc259]) 

As per the expectation, the image replayer removed old primary snapshots that are no longer needed.

@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 4 times, most recently from dc4d75e to bba032a Compare April 14, 2026 11:27
Comment on lines +542 to +546
if (mirror_ns->mirror_peer_uuids.empty() ||
mirror_ns->mirror_peer_uuids.count(m_primary_peer_uuid) == 1) {
// old primary snapshots can be removed when remote becomes primary
prune_snap_ids.insert(local_snap_id);
}

@pkalever pkalever Apr 14, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not be editing get_peer_uuids() logic and the interface IMHO, it is intended.

This is what we want right?

A snapshot is marked for deletion if:

  • No peer is associated (uuids.empty()), OR
  • It belongs to the same peer
Suggested change
if (mirror_ns->mirror_peer_uuids.empty() ||
mirror_ns->mirror_peer_uuids.count(m_primary_peer_uuid) == 1) {
// old primary snapshots can be removed when remote becomes primary
prune_snap_ids.insert(local_snap_id);
}
const auto& uuids = mirror_ns->mirror_peer_uuids;
bool is_same_peer =
(uuids.size() == 1 &&
std::find(m_peer_uuids.begin(), m_peer_uuids.end(), uuids.front()) != m_peer_uuids.end());
if (uuids.empty() || is_same_peer) {
prune_snap_ids.insert(local_snap_id);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! Sorry, The above won't work. It is like even if the uuids.size() == 1 what is the guaranty that that uuid in the snapshot belongs to primary peer uuid, the above condition can only say like "this UUID is one of the known peers", it doesn't guaranty of the its primary's peer uuid.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like what we pass to bootstap code today is also a TODO :-)

template <typename I>                            
void ImageReplayer<I>::bootstrap() {             
  dout(10) << dendl;                             
                                                 
  std::unique_lock locker{m_lock};               
  if (m_peers.empty()) {                         
  ┆ locker.unlock();                             
                                                 
  ┆ dout(5) << "no peer clusters" << dendl;      
  ┆ on_start_fail(-ENOENT, "no peer clusters");  
  ┆ return;                                      
  }                                              
                                                 
  // TODO need to support multiple remote images 
  ceph_assert(!m_peers.empty());                 
  m_remote_image_peer = *m_peers.begin();        

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree @pkalever. For now I have used m_remote_image_peer to get uuid for comparison. PTAL.

Comment thread src/tools/rbd_mirror/ImageReplayer.h Outdated
}

return uuids;
return uuid;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned this filtering doesn't work when we have multiple peers. And the intention of get_peer_uuids() is to get all the peer uuids and what the Replayer is doing with them is up to it. You shouldn't be changing get_peer_uuids(), its intentionally returning all the peer uuids associated with it.

@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch from bba032a to 12e6452 Compare April 15, 2026 11:04
Comment thread src/tools/rbd_mirror/ImageReplayer.cc Outdated
@@ -431,13 +427,17 @@ template <typename I>
void ImageReplayer<I>::start_replay() {
dout(10) << dendl;

std::string peer_uuid = m_remote_image_peer.uuid;

@pkalever pkalever Apr 15, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than supporting multiple peers which we discussed, you are just using the m_remote_image_peer which is a TODO as mentioned before:

12e6452#r3080702733

// TODO need to support multiple remote images 
  ceph_assert(!m_peers.empty());                 
  m_remote_image_peer = *m_peers.begin();        

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. It is already a TODO but my recent change will reduce dependencies. Currently trying to find a way to know about primary cluster to remove existing TODO.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to clear an another conceptual ideology, We had a hope that we could fetch it from a object header otherwise, I looked from that lens too the fact is that only rbd_mirroring object header holds it but I expect it to have the peer list again, where you cannot differentiate b/w primary and others.

@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 2 times, most recently from 88388bd to 221a0e2 Compare April 20, 2026 09:34
@abitdrag

Copy link
Copy Markdown
Contributor Author

Old primary snapshots are safe to prune when their mirror_peer_uuids is empty.
Old primary demote snapshots are safe to prune when their mirror_peer_uuids list have only one element, i.e. peer UUID of current primary.

It is unsafe to combine these two conditions for below multi-peer scenario (theoretical):
Initially: img1 is primary on cluster1 and non-primary on cluster2 and cluster3.
Snapshot list of img1 on cluster1:
s1 (primary snapshot)
s2 (demote primary snapshot) -> demoted on cluster1 here.
Snapshot list of img1 on cluster2:
s2 (demote non-primary snapshot)
s3 (primary snapshot) -> promoted on cluster2
Snapshot list of img1 on cluster3:
s1 (incomplete non-primary snapshot) --> still syncing

Here, it is unsafe to remove s1 from cluster1 using below diff:

diff --git a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
index 14a2113bea5..0957d062f8d 100644
--- a/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
+++ b/src/tools/rbd_mirror/image_replayer/snapshot/Replayer.cc
@@ -539,6 +539,9 @@ void Replayer<I>::scan_local_mirror_snapshots(
       }
     } else if (mirror_ns->is_primary()) {
       if (mirror_ns->complete) {
+        if (mirror_ns->mirror_peer_uuids.size() <= 1) {
+          prune_snap_ids.insert(local_snap_id);
+        }
         m_local_snap_id_start = local_snap_id;
         ceph_assert(m_local_snap_id_end == CEPH_NOSNAP);
       } else {

@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch from 221a0e2 to b945a89 Compare April 20, 2026 10:23

@ajarr ajarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a tracker ticket for this bug, if one does not already exist. And the link to the tracker needs to be in the Fixes tag of the commit message.

Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
mirror_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY_DEMOTED)) {
// old primary snapshots are safe to prune when mirror_peer_uuids is empty
// old demote primary snapshots are safe to prune when mirror_peer_uuids has
// only one entry of current primary

@ajarr ajarr Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abitdrag I think we should be able to verify that the value of the demote peer uuid.

a) list the local peer sites

    std::vector<cls::rbd::MirrorPeer> mirror_peers;
    r = librbd::cls_client::mirror_peer_list(local_image_ctx->md_ctx, &mirror_peers);

b) pick the peer site whose mirror_uuid field matches m_state_builder->remote_mirror_uuid

auto it = std::find_if(mirror_peers.begin(), mirror_peers.end(),
                       [&](const auto& peer) {
                         return peer.mirror_uuid == m_state_builder->remote_mirror_uuid;
                       });

if (it == mirror_peers.end()) {
  // handle peer not found
}

const auto& matched_peer = *it;

c) this chosen peer site's uuid field should match the demote peer uuid

if (*mirror_ns->mirror_peer_uuids.begin() == match_peer.uuid) {
  // match
}

I have not tested this code. I think this should work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this, @pkalever have created PR to include peer UUID 68267

But, the issue is:
m_state_builder->remote_mirror_uuid is assigned in
PrepareRemoteImageRequest<I>::finalize_snapshot_state_builder() from m_remote_image_peer.remote_pool_meta of ImageReplayer in ImageReplayer<I>::bootstrap()

currently we assign m_remote_image_peer as:

// TODO need to support multiple remote images
  ceph_assert(!m_peers.empty());
  m_remote_image_peer = *m_peers.begin();

Here, we have made assumption that first element in m_peers is remote and primary (for two peers scenario). This is not valid for multi-peer scenario.

So, we wanted to reduce dependency on this TODO. As it can be done using @idryomov's suggested approach without identifying current primary.

@idryomov idryomov Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in a single peer scenario it can be assumed that m_remote_image_peer corresponds to the primary, right? In case there is only one element in the primary demote snapshot's mirror_peer_uuids set, can it be cross-checked against m_remote_image_peer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for single peer it can be used. Currently m_remote_image_peer doesn't have UUID, we can use @pkalever's PR to bring UUID to or the way @ajarr mentioned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abitdrag if we can include this commit 951665c,
then m_remote_image_peer.uuid would be the value we want, right? I don't think we need the second commit in his PR 66c5233

As discussed, we don't have to worry about m_remote_image_peer being incorrect for multi-peers. It'd have to be fixed eventually to correspond to primary peer from which the image replayer is syncing.

Considering this, I would close #68267 . And just include Prasanna's initial commit in this PR. It'd hasten the PR review process.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'm fine with dropping the second commit for now. We'll likely need to revisit it once we settle on a way to determine primary peer details, and extend ReplayerListener with appropriate get_*_uuid() so the Replayer can retrieve that information cleanly. Thanks.

@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 2 times, most recently from 63e72bc to e95b85a Compare April 23, 2026 11:50

@ajarr ajarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see unit test failure in the logs of the make check job

/ceph/src/tools/rbd_mirror/ImageReplayer.cc:432:20: error: no member named 'remote_image_peer' in 'rbd::mirror::image_replayer::StateBuilder<librbd::MockTestImageCtx>'

Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 3 times, most recently from b52e04f to 4f3a0ab Compare April 24, 2026 12:47
@abitdrag

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@abitdrag

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Initialize the uuid member in the Peer constructor and include it in
stream output operator to ensure correct peer identification in logs.

Signed-off-by: Prasanna Kumar Kalever <[email protected]>
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 4 times, most recently from ab290bf to 623eec1 Compare June 11, 2026 12:15
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch 4 times, most recently from 2c28957 to 9233b44 Compare June 12, 2026 12:01
@abitdrag

Copy link
Copy Markdown
Contributor Author

Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch from 9233b44 to e8ae8d8 Compare June 16, 2026 09:50

@idryomov idryomov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM!

Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Comment thread qa/workunits/rbd/rbd_mirror.sh Resolved
Previously, obsolete primary and demoted primary snapshots on the
secondary cluster were not cleaned up immediately after relocation.
Instead, old primary snapshots remained until a subsequent promote
operation triggered their cleanup, while old demoted primary snapshots
persisted until a later demote operation removed them.

Adding changes for proactive cleanup of obsolete primary and demoted
primary snapshots that are no longer required after relocation.

Also adding test coverage to validate the cleanup behavior.

Fixes: https://tracker.ceph.com/issues/76154

Signed-off-by: Miki Patel <[email protected]>
@abitdrag
abitdrag force-pushed the wip-miki-image-prim-snap-removal branch from e8ae8d8 to a10f58d Compare June 17, 2026 10:47
@abitdrag
abitdrag requested a review from idryomov June 17, 2026 12:28
@idryomov

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@idryomov

Copy link
Copy Markdown
Contributor

jenkins test windows

1 similar comment
@abitdrag

Copy link
Copy Markdown
Contributor Author

jenkins test windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants