Repository navigation
librbd: remove previous incomplete primary snapshot after successfully creating a new one - #50324
Conversation
idryomov
left a comment
There was a problem hiding this comment.
I have pointed out some implementation issues mostly for educational purposes -- I think this is better approached differently. If you look at CreatePrimaryRequest::unlink_peer, it already has logic for removing snapshots when rbd_mirroring_max_mirroring_snapshots limit is reached. It also removes snapshots that aren't linked to any peer unconditionally (i.e. even if rbd_mirroring_max_mirroring_snapshots limit isn't reached). It seems like we could piggy-back on that just by adding an extra provision for incomplete snapshots.
It may not be apparent that CreatePrimaryRequest::unlink_peer can remove snapshots because it invokes a fairly nondescript UnlinkPeerRequest to do the work, but UnlinkPeerRequest actually ends up calling snap_remove if certain conditions are met. I suspect that an incomplete snapshot would meet those conditions.
d5183bd to
0aca92f
Compare
idryomov
left a comment
There was a problem hiding this comment.
Did you verify that UnlinkPeerRequest would actually remove the snapshot in this case?
|
Please drop this from the PR description and the commit message. |
I had added some additional debug logs like: And it worked actually: |
8654f47 to
ad3d667
Compare
idryomov
left a comment
There was a problem hiding this comment.
Also please squash the test commit and drop the BZ link.
ad3d667 to
55ba94f
Compare
a25e640 to
ae5dcf7
Compare
|
@idryomov Please help review this PR. Thanks! |
This is still pending for the original fix. While at it, change the commit title to match the title of the PR. The follow-up fix clearly needs more investigation. |
ae5dcf7 to
b057e6f
Compare
b057e6f to
5b2e862
Compare
5b2e862 to
43f4391
Compare
This is still outstanding -- only the test commit got squashed. |
…y creating a new one Problem: ------- At a high level, creating a primary snapshot consists of three steps: 1. actually creating a snapshot in the mirror namespace 2. generating a set of image state objects with additional metadata for the snapshot 3. marking the snapshot as complete after the image state objects are written out Depending on the circumstances, a request to create a primary snapshot can be forwarded to rbd-mirror daemon. If that happens and rbd-mirror daemon gets axed for some practical reason after completing steps (1) and/or (2) but before completing step (3), we are left with a permanently incomplete primary snapshot because upon retrying that primary snapshot creation request, librbd notices that such snapshot already exists. It does not check whether this "pre-existing" snapshot is complete. Solution: -------- As part of the next mirror snapshot create (say triggered by the scheduler) the unlink_peer() is called, it checks if there exists any incomplete snapshot and delete them accordingly. Fixes: https://tracker.ceph.com/issues/58887 Signed-off-by: Prasanna Kumar Kalever <[email protected]>
43f4391 to
2287dbf
Compare
|
@idryomov cleaned now. Thanks! |
Up until now this was conditioned on whether the caller expressed interest in the ID of the created snapshot and happened to work only because CreatePrimaryRequest wasn't actually consulting any mirror snapshot metadata. This has just changed with unlink_peer() needing to see an up-to-date complete flag which is set in SetImageStateRequest following the write out of image state object(s). Signed-off-by: Ilya Dryomov <[email protected]>
2287dbf to
df2bb13
Compare
|
Pushed a fixup for |
|
jenkins test windows |
|
jenkins test api |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
librbd: remove previous incomplete primary snapshot after successfully creating a new one Reviewed-by: Ilya Dryomov <[email protected]>
Problem:
At a high level, creating a primary snapshot consists of three steps:
Depending on the circumstances, a request to a create a primary snapshot can be forwarded to rbd-mirror daemon. If that happens and rbd-mirror daemon gets axed for some practical reason after completing steps (1) and/or (2) but before completing step (3), we are left with a permanently incomplete primary snapshot because upon retrying that primary snapshot creation request, librbd notices that such snapshot already exists. It does not check whether this "pre-existing" snapshot is complete.
Solution:
As part of the next mirror snapshot create (say triggered by the scheduler) the unlink_peer() is called, it checks if there exists any incomplete snapshot and delete them accordingly.
Fixes: https://tracker.ceph.com/issues/58887
Signed-off-by: Prasanna Kumar Kalever <[email protected]>
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows