Skip to content
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

Sending "empty" snapshots allows inserting snapshots out of order #16767

Open
manfromafar opened this issue Nov 15, 2024 · 0 comments
Open

Sending "empty" snapshots allows inserting snapshots out of order #16767

manfromafar opened this issue Nov 15, 2024 · 0 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@manfromafar
Copy link
Contributor

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 24.04.1
Kernel Version 6.8.0-48-generic
Architecture amd64
OpenZFS Version zfs-2.2.6-1

Describe the problem you're observing

When creating empty snapshots with 0 used space you can send snapshots out of order.
For example if you can send snapshots 1 and 3 to a new dataset.
Once the send is complete you can then send snapshot 2 to the new dataset and it'll be inserted without issue by zfs.

Unfortunately this only works if the snapshots are empty once actual data is written zfs with throw a error about changes on the remote dataset.

Describe how to reproduce the problem

  1. Create a dataset lets called test on a pool called tank
  2. snapshot tank/test multiple times without making changes
    a. for x in {1..3}; do zfs snapshot tank/test@$x; done
  3. Send an initial replication of snapshot 1 from tank/test to tank/test2
    a. zfs send tank/test@1 | zfs recv tank/test2
  4. Send a incremental of snapshots 1 and 3 from tank/test to tank/test2.
    a. zfs send -i tank/test@1 tank/test@3 |zfs recv tank/test2
  5. On tank/test2 we should see snapshots 1 and 3
    a. zfs list -t snapshot tank/test2
    tank/test2@1 0B - 24K - tank/test2@3 0B - 24K -
    b. Both snapshots are 0 used as nothing has changed between them.
  6. Now do another incremental send of snapshots 1 and 2 from tank/test
    a. zfs send -I tank/test@1 tank/test@2 |zfs recv tank/test2
  7. We should now see that snapshots 1,2,3 all exist for tank/test2 even though they were sent out of order. Which would normally require a rollback.
    a. zfs list -t snapshot tank/test2
    tank/test2@1 0B - 24K - tank/test2@3 0B - 24K - tank/test2@2 0B - 24K -
  8. Even though the snapshots are empty we've effectively backfilled a snapshot.

Include any warning/errors/backtraces from the system logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

1 participant