oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
608 stars 138 forks source link

Runonce with manually provided snapname (--forcedSnapshotSuffix=X) #457

Closed jimklimov closed 4 years ago

jimklimov commented 4 years ago

Somewhat a follow-up on discussion from #455 - if sysadmins intend to make a specially-named snapshot for their unscheduled backup, let znapzend help them do it more easily.

CC @lotheac and @oetiker

jimklimov commented 4 years ago

Note: so far the idea was coded only, not tested IRL :)

In particular, not sure initially if this snapshot name that does not match the patterns configured in the backup plan would actually get picked up for sending, more so if/after #455 is merged to jump over some snaps and do fewer incremental operations.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.05%) to 91.609% when pulling b0c9b92d9875ce24c8283bdc8fef38f15ab0c0aa on jimklimov:runonce-snapname into 1a55c7331cf29a549fd154572a452c9dd1dacd29 on oetiker:master.

jimklimov commented 4 years ago

The extended test was not in vain - our t/zfs mock in fact does not get properties for all datasets as was expected of it.

jimklimov commented 4 years ago

And we have green results with not ok tests in the middle :\

oetiker commented 4 years ago

tere is a conflict it seems

jimklimov commented 4 years ago

Split out the commits for arg-less runonce into another PR (#458) leaving only the work on forced snapname in this branch.

jimklimov commented 4 years ago

Marking as "WIP" to figure out the test fails...

jimklimov commented 4 years ago

Back to drawing board after some local tests. Seems this needs two filters, for sends and for cleanups (to not kill manually made snapname). And with manually specified snapnames, maybe needs a pattern variable option too...

jimklimov commented 4 years ago

Houston, we have a... subject for discussion.

As I experimented with this code in a practical system, I got it to work for passing both just-created "forced" snapshot names as well as automatically generated ones, but only if the "last common" snapshot on dest and src exists and is newer than anything not included by the timestamp filter. Otherwise, zfs recv suggests that offending snapshots on destination should be destroyed first and so denies the replication.

I see a few ways out of this:

oetiker commented 4 years ago

can you state the usecase for this feature, then it might be easier to figure the right way of implementing it ... my first impression is that we should avoid trying to make znapzend behavior more complex to understand than it already is.

afaik the latest date-time stapshot will never get cleaned

jimklimov commented 4 years ago

Sorry for falling out of the loop a bit. I think original post still holds here:

if sysadmins intend to make a specially-named snapshot for their unscheduled backup, let znapzend help them do it more easily.