Repository navigation
rbd-mirror: Remove old non-primary demoted image snapshots on the local cluster - #68500
Conversation
|
test case changes in rbd_mirror.sh passing with test case changes in rbd_mirror.sh failing without |
Behavior without changes:Initially: demoting and promoting on same cluster: Repeating similar step for 4 more times: Snapshots pile up on cluster2: demoted primary snapshots get piled up on Behavior with changes:Initially: demoting and promoting on same cluster: After applying changes from this PR, when old demoted non-primary snapshots are found, |
| @@ -514,7 +514,8 @@ void Replayer<I>::scan_local_mirror_snapshots( | |||
| m_local_snap_id_start = local_snap_id; | |||
| ceph_assert(m_local_snap_id_end == CEPH_NOSNAP); | |||
|
|
|||
| if (mirror_ns->mirror_peer_uuids.empty()) { | |||
| if (mirror_ns->mirror_peer_uuids.empty() || | |||
| mirror_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_NON_PRIMARY_DEMOTED) { | |||
There was a problem hiding this comment.
I think this if condition covers all types of non-primary snapshots i.e both normal non-primary snapshots (contains no mirror_peer_uuids) and non_primary_demoted snapshots.
So i think we can just completely remove this if condition and just call m_prune_snap_ids.insert(local_snap_id); unless i am missing something.
| return 1 | ||
| } | ||
|
|
||
| wait_for_non_prim_snap_with_primary_id_present() |
There was a problem hiding this comment.
I think this helper is not needed/used, so we can remove it.
| @@ -227,6 +233,9 @@ wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${image} | |||
| wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped' | |||
| wait_for_replaying_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} | |||
| compare_images ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${image} | |||
| if [ "${RBD_MIRROR_MODE}" = "snapshot" ]; then | |||
| wait_for_non_prim_snap_with_primary_id_not_present ${CLUSTER1} ${POOL}/${image} ${demote_snap_id} | |||
There was a problem hiding this comment.
i think instead of this it's better to have a separate test case that promotes and demotes same image 20 times in a loop and at the end checks the snapshot count similar to "TEST: failover / failback loop".
We can discuss this with the team
28d908c to
de63c83
Compare
| wait_for_status_in_pool_dir ${CLUSTER2} ${POOL} ${image} 'up+stopped' | ||
| wait_for_replaying_status_in_pool_dir ${CLUSTER1} ${POOL} ${image} | ||
| compare_images ${CLUSTER1} ${CLUSTER2} ${POOL} ${POOL} ${image} | ||
| wait_for_non_primary_snap_not_present ${CLUSTER1} ${POOL} ${image} ${demote_snap_id} |
There was a problem hiding this comment.
I think here no need to check this this every time, we are directly checking the final count that implies that these non-primary demoted snapshots are getting deleted. So basically no need to add any new helpers and no need to get non-primary snapshot id and check whether it is removed or not.
There was a problem hiding this comment.
We need to have specific checks because when test "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3 fails for any future changes, author needs to know which snapshot is not removed correctly. I have one upcoming PR, which not only checks removal of specific snapshot but also checks for unlinking.
There was a problem hiding this comment.
Sorry, i am not able to understand properly. This test case needs to checks whether non-primary demoted snapshots are getting deleted or not right. So if the test "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3 fails means that non-primary demoted snapshots are not getting deleted properly.
There was a problem hiding this comment.
No, if test "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3 or test "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3 fails, then it doesn't guarantee that non-primary demote snapshot is not removed. It could be any snapshot that is not cleaned up in between. It could be primary, non-primary, primary demoted or non-primary demoted.
In this PR, I have added test to check for removal of non-primary demoted only because that's what the code changes targets. In another PR, I have added test to check for removal of all other kind of snapshots as well. Will share this next PR shortly for review. But point is to have more specific checks for snapshots instead of checking on high level.
There was a problem hiding this comment.
The test case above this test case i.e "TEST: failover / failback loop" already checks remaining cases right.
There was a problem hiding this comment.
Yes, that is also not sufficient. I am creating a test that checks for removal of different kind of snapshots and unlinking, basically testing snapshot removal in more details.
There was a problem hiding this comment.
@abitdrag I agree with @VinayBhaskar-V comment here a7f3848#r3167617528
No, if
test "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3ortest "$(count_mirror_snaps ${CLUSTER1} ${POOL} ${image})" -le 3fails, then it doesn't guarantee that non-primary demote snapshot is not removed. It could be any snapshot that is not cleaned up in between. It could be primary, non-primary, primary demoted or non-primary demoted.
Yes, that’s true. However, the point is that testing the general case by checking whether the number of snapshots is less than three already covers the scenario where a non-primary demoted snapshot has been removed. Is it possible for the number of snapshots in CLUSTER1 to be fewer than three while a non-primary demoted snapshot is still present?
There was a problem hiding this comment.
@ajarr, No. With loop, there is no scenario where number of snapshots becomes fewer than 3 while non-primary demoted snapshot is still present. But PTAL these changes:
https://github.com/ceph/ceph/pull/67483/changes
I am still modifying this PR with respect to current changes, but the way I have put checks in this PR, I am planning to put checks for unlink and removal for all kind of snapshots in this scenario as well as relocation scenario. So, anyway this check will be added later, since we are making change related to non-primary demoted snaps here, I have put that check here.
There was a problem hiding this comment.
wait_for_non_primary_snap_not_present per loop is strict and doesn't hurt IMHO. I would keep it.
There was a problem hiding this comment.
I agree with you @pkalever, have kept the cheks stricter.
ajarr
left a comment
There was a problem hiding this comment.
In the commit message,
When a primary cluster is demoted and then promoted again,
a demoted non-primary snapshot is created on the secondary
cluster. These snapshots are not cleaned up until the secondary
cluster itself is demoted. Repeated demote/promote cycles on
the same cluster lead to accumulation of such non-primary
demoted snapshots on the secondary.
This change addresses the cleanup of these accumulated
non-primary demoted snapshots and adds test cases to verify the behavior.
I'm unable to follow this sentence, "These snapshots are not cleaned up until the secondary cluster itself is demoted". Can you explain what you mean by demoting a secondary cluster, and how would it clear up the non-primary demoted snapshot?
de63c83 to
d8ae96b
Compare
I have changed commit message with better explanation. Have also made changes in test case. @VinayBhaskar-V , @ajarr PTAL. |
d8ae96b to
a7f3848
Compare
|
With this changes on top of #68161 after the newly added test here are the list of snaps (as expected and fixed) So I recommend the order of merging the patches to go in the same fashion and adjust your tests accordingly, by cherry picking the commit from #68161 |
1153814 to
3d21990
Compare
3d21990 to
65a1d4f
Compare
|
Noting that the change |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
023641e to
21d152b
Compare
687f66a to
4a82124
Compare
063faa6 to
8508417
Compare
…al cluster When an image is demoted on primary cluster and later promoted again, a non-primary demoted image snapshot is created on the peer (secondary) cluster. Each such promote/demote cycle on same cluster results in an additional non-primary demoted snapshot being created on peer. As a result, repeated promote/demote cycles on the same cluster can lead to accumulation of stale non-primary demoted snapshots on the secondary cluster. These snapshots are not removed immediately because cleanup is only triggered when peer (secondary) is promoted and then demoted. The proposed changes ensures that such snapshots are proactively identified and removed, preventing unbounded buildup. Also added test coverage to verify cleanup behavior. Fixes: https://tracker.ceph.com/issues/76155 Signed-off-by: Miki Patel <[email protected]>
8508417 to
5a77c4f
Compare
Stale request for changes, there is a later comment: #68500 (review)
The commit messages has been adjusted.
When an image is demoted on primary cluster and later promoted again,
a non-primary demoted image snapshot is created on the peer (secondary)
cluster. Each such promote/demote cycle on same cluster results in an
additional non-primary demoted snapshot being created on peer.
As a result, repeated promote/demote cycles on the same cluster can
lead to accumulation of stale non-primary demoted snapshots on the
secondary cluster. These snapshots are not removed immediately because
cleanup is only triggered when peer (secondary) is promoted and then
demoted.
The proposed changes ensures that such snapshots are proactively identified
and removed, preventing unbounded buildup. Also added test coverage to
verify cleanup behavior.
Fixes: https://tracker.ceph.com/issues/76155
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.