-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pseudo Snapshots #16749
Comments
I think now each snapshot is always created pointing at the current transaction group. So unless you create several snapshots in one command, I think they will point to different txgs and won't be identical. I wonder what is the actual difference between them other than txg number and is it avoidable? I wonder what would happen if we always point snapshots not to the current txg, but to a txg of the last change. One effect I can see is that we would not be able to tell that recursive snapshots were actually synchronous, they would look like they are not, but can't guess others. But I haven't been in that area deep lately, so just don't remember details. |
If it's possible to create duplicate snapshots on an unchanged dataset without the new snapshot itself appearing as a new transaction then that would be even better. Only issue could be if any code assumes snapshots must have different txgs, such as in |
How does creating a snapshot affect the dataset to which the snapshot belongs to? I've never seen such a behavior as you're describing, seems like a bug. If the problem is that when you create a snapshot, you then have take that snapshot's existence into account when doing an incremental send, that's by design, I for one wouldn't want a snapshot functionality that sometimes snapshots, but sometimes ~kinda ~doesn't. |
Sorry, I should really have given an example. Let's say we have two datasets, Now consider that
(or similar) The problem with this is that creating the recursive snapshot ( I guess it could be considered a bug that these are considered changes (a snapshot of a dataset that hasn't changed since its last snapshot), but it depends how exactly the snapshots are accounted for and if that can be changed. Removing the snapshots solves the problem but you can't really do that if you're in the midst of a migration that might need a second (or third etc.) send to complete it before you switchover. While doing pretty much exactly this recently I had to write a script to convert to using |
This is just an user error. Not a bug. If you make a snapshot, then you have to work with it, if you've made a snapshot while nothing changed, it's still a new snapshot with a new timestamp, this behavior is valid. |
Then it's not a bug then – you're the one that suggested it might be FFS. I proposed the issue because what are essentially duplicate snapshots shouldn't affect the state of a dataset – they don't actually represent anything, but are still be useful for organisational purposes such as during replication. |
@Haravikk because you said I quote
which is just not true, but if it somehow were, that'd definitely be a bug - but it isn't since creating a new snapshot is not registered as any kind of change to the dataset it belongs to, it just isn't. |
And btw, while you're swinging at others accusing them of attacking you, keep those "FFS" to yourself, could you. |
I literally just told you how it's true – if you create a new snapshot on a dataset, you can no longer send to it, even though the new snapshot doesn't contain any new data – If it's a bug then it should be fixed, if it's not then an alternative is useful for avoiding this problem – feel free to decided for yourself which it is, I've identified a problem and set out my proposed solution. |
User. Error. If you've made a snapshot, work with it, don't act like it's not there. |
I'm not acting like it's not there, I'm pointing out that them registering as changes causes Bizarrely you're accusing me of both being a liar and that this isn't true, or an idiot who's just causing problems for himself, despite the fact that I'm well aware that creating the snapshot is causing the problem as that's the basis for my feature request, so it'd be nice if you'd pick a damned lane. Literally the entire point is to make it possible to non-disruptively create organisational snapshots with |
Snapshots don't alter the data of the dataset. But they are like a chain. If you take one piece out, you broke the chain. |
I didn't say they did – I said they register as a change to the dataset for the purposes of I created this issue on the assumption that the reason this happens is that the snapshot itself is presumably created as its own new transaction (so the dataset has in fact changed, its data just hasn't), but bookmarks don't have that problem, they just reference a txg that exists at the time (the reference snapshot).
The use case where I ran into the problem is on a backup pool (snapshots are sent to it) that I wanted to replicate – the problem is that doing this the easy way (creating a recursive snapshot with So the very breaking the chain you mention is why I created the issue – it breaks the chain of incremental sends to the target pool (or and its replicated copy). But really if the snapshots don't represent anything that's actually new there's no real reason it should be a problem. Such a use-case should be stable, since the target only has snapshots (no datasets in separate use), and the goal is to wait for a moment when nothing is being received, take the recursive snapshot (since it's atomic) then send, as any activity thereafter can be replicated later. But this doesn't work if it stops zfs receive from working.
The entire idea behind my feature request is that this shouldn't be necessary, because the goal isn't to "fix" duplicate snapshots (which I assumed may not even be possible, though if it is I'd be more than happy with that as a solution). Bookmarks do not have the same problem, which is why the goal of the issue is to invisibly create bookmarks in place of snapshot duplicates, but allow them to be used anywhere a regular snapshot could be (since the bookmarks can be swapped for their reference snapshot). I can do this using a script as a pre-processing step on |
I must admit I misunderstood your post. Had to read it again 3 times. The example then made it clear. Maybe a possible future change in code would need to remember the current and the last change txg and then some comparison logic in the receive code to allow for the requested feature. I wonder if you thought of some snap -r -> clone them -> promote them -> destroy the snaps - procedure on your backup pool, which should be easily script-able and should avoid the need to fiddle on the senders side, as you said in your initial post. |
FWIW, a tool like bzfs would help replicate the pool without requiring to take any additional snapshots (and thus avoids breaking the chain). https://github.com/whoschek/bzfs |
Describe the feature would like to see added to OpenZFS
Currently if a dataset has a snapshot, and has not been changed since that snapshot was created, creating a new snapshot is registered as a change to that dataset, which interferes with incremental send operations.
However these snapshots don't really represent any actual changes, so it may make more sense to have them instead become a "pseudo snapshot" – essentially a bookmark that looks and behaves like a snapshot for ZFS commands.
In essence, any command given a pseudo-snapshot will either use at as a bookmark as normal (if it supports them), or swap it for the "root" snapshot that it is identical to/was created from.
When a snapshot is to be destroyed, ZFS will check to see if it has any corresponding "pseudo snapshots" – if it does, instead of destroying the snapshot it will instead be renamed to replace the first pseudo snapshot, whose internal bookmark is then removed. If there are multiple "pseudo snapshots" they will continue to be proxies/aliases of the "root" snapshot as normal.
Example
tank/foo@current
, the dataset has not been changed since.zfs snapshot tank/foo@new
is created as a "pseudo snapshot" (a bookmark referencingtank/foo@current
).@new
for@current
.zfs destroy tank/foo@current
will not destroy the snapshot, instead it will be renamed to@new
and the internal bookmark for@new
is discarded.At any time an incremental send can be performed to
tank/foo
without encountering issues, as it is still effectively unchanged throughout.Compatability
Internally the "pseudo snapshot" should just be a bookmark with the same
createtxg
andguid
as its "parent" snapshot, plus a means of identifying it as a pseudo snapshot, such as a naming convention or flag that is safe for older versions of ZFS to ignore.For compatibility reasons, "pseudo snapshots" should always be checked for a "parent" snapshot – if none is found, the pseudo snapshot is treated in all respects as an ordinary bookmark (no special behaviours).
This is because to earlier versions a "pseudo snapshot" will simply appear as a regular bookmark, and the "parent" snapshot can be destroyed separately, resulting in orphaned "pseudo snapshots".
How will this feature improve OpenZFS?
It will make it possible to create recursive snapshots on a pool without having to worry about how its snapshots are normally handled, or if creating a snapshot will break incremental sends to that pool.
As a result, it should make it a lot easier to replicate pools that are currently in use by doing the following:
Without having to worry about what the existing snapshot scheme looks like, since the recursive snapshot(s) will either be true snapshots or pseudo snapshots as necessary, avoiding any disruption to consistency for sending to the same pool.
Additional Context
I'm not happy with the term "pseudo snapshot" but it's the best I could come up with. I considered "cloned snapshots" but I think that could get confusing.
The text was updated successfully, but these errors were encountered: