-
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
Allow for "zfs receive" to skip existing snapshots #2668
Conversation
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
58d7d9d
to
a934751
Compare
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
a934751
to
e108a79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the addition on resumable send/recv we should decide if this is still an option which is needed. Part of the original motivation for this change doesn't apply any longer. Streams which were aborted after half a day can just be resumed. Is there any use case where it would make sense to skip existing snapshots?
Assuming that there is this patch needs to be.
- Rebased against the latest master
- Have a test case added for this new option
- Address any the inline review comments.
if (zfs_dataset_exists(hdl, zc.zc_value, ZFS_TYPE_SNAPSHOT) && | ||
flags->skip) { | ||
(void) printf("skipping snapshot %s - %s already exists\n", | ||
drrb->drr_toname, zc.zc_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally I'd say never to use printf()
in a library function like this. Unfortunately, it's already being done in this function so let's just make sure it's wrapped with an if (flags->verbose)
conditional like the other cases.
enabled. If the \fBlz4_compress\fR feature is active on the sending system, | ||
then the receiving system must have that feature enabled as well. See | ||
\fBzpool-features\fR(5) for details on ZFS feature flags and the | ||
\fBembedded_data\fR feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unrelated hunk can be dropped, it was added to master in another commit.
.ad | ||
.sp .6 | ||
.RS 4n | ||
Skip existing snapshots in a stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a little more explanation.
* be an incremental, or the stream specifies a new fs | ||
* (full stream or clone) and they want us to blow it | ||
* away (and have therefore specified -F and removed any | ||
* snapshots). | ||
*/ | ||
if (stream_wantsnewfs) { | ||
if (stream_wantsnewfs && !flags->skip) { | ||
if (!flags->force) { | ||
zcmd_free_nvlists(&zc); | ||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update this error message to reference the optional `-s' option. Something like "destination '%s' exists\nmust specify -F to overwrite it or -s to skip it"
@kpande, can you expand on the use case you are thinking of? |
Closing this issue until someone has the time to work on it. |
by adding the option "-s" to zfs receive.
Signed-off-by: Turbo Fredriksson [email protected]
Closes: #2666