oetiker / znapzend

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

Sending snapshots doesn't use the latest snapshot created by znapzend, but rather the latest available #561

Closed cserem closed 2 years ago

cserem commented 2 years ago

Hello!

I have a system with 2 pools: live_pool archive_pool

There is a znapzend schedule for live_pool to send snapshots to the archive_pool. But I also have another system pulling backups from live_pool, quite rapidly. Often znapzend uses this other snapshot for replication instead of its own.

Example: Znapzend wakes up and creates live_pool@2021-09-25-090000 In the background this other task is creating live_pool@whatever-created-just-after-2021-09-25-090000 The same Znapzend job, when transferring live_pool to archive_pool it is then using this snapshot instead of it's own: zfs send -i live/somedata@2021-09-25-084500 live/somedata@whatever-created-just-after-2021-09-25-090000 '|zfs recv -F archive/somedata

If znapzend is running with '-I', this is not a problem, since the snapshot created by znapzend would also be transferred (just have to have a cleanup job for the "alien" snapshots, generated by the other task.)

But this is a problem if it is running with '-i' since the SRC and DST might come out of sync in respect of snapshots managed by znapzend.

Would there be a way to force znapzend to use the snapshot created by itself for replication?

Thanks

jimklimov commented 2 years ago

Check the pattern your znapzendzetup defined to identify snapshots created by znapzend? On my systems it is quite an explicit znapzend-<timestamp> but by default IIRC it could be just <timestamp> so perhaps your other tool's snapshots also match?

jimklimov commented 2 years ago

From my side, I did post a number of PRs in the past to optionally allow a sort of opposite effect: to let znapzend replicate not only increments between its own snapshots (that matched the pattern) but also others, e.g. manually named points that would not be cleared away, such as before/after some significant reconfiguration or upgrade (the latter is usually a series of snapshots named by beadm and pkg on Solaris and descendants).

These were supposed to be non-default options, so now I worry if something misfired from my contributions? :)

cserem commented 2 years ago

Thank you for picking this up! In my case znapzend's snapshots are only named after creation (no "znapzend-" prefix like in your case): Example: 2021-11-07-121500

The other machine makes: syncoid_backup_2021-11-07:12:38:39-GMT01:00

..even if znapzend doesn't use exact pattern match (eg: ^<timestamp>$ vs <timestamp> ) it shouldn't match the other machine's snapshots because of the different hour:minute:seconds pattern. (That is why I am guessing it uses the most recent one.)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.