jgoerzen / simplesnap

A simple and powerful way to send ZFS snapshots across a network
GNU General Public License v3.0
49 stars 15 forks source link

bookmark support conflicts with existing snapshot backups #24

Open tomhoover opened 5 years ago

tomhoover commented 5 years ago

My backup server is running Debian Stretch (with simplesnap 1.0.3), and has successfully been backing up other Linux servers for some time. I copied simplesnapwrap (from the Debian backup server) to my Macbook Pro laptop and made the appropriate modifications to enable simplesnapwrap to work on MacOS (see issue #22). In preparation of pull request #23, I cloned the simplesnap repository to my laptop, and noticed numerous commits since v1.0.3 (including 'Initial work to support bookmarks'). After applying my patches to HEAD, I attempted to perform an incremental backup of my laptop to the Debian backup host. This backup failed with the following errors:

"Found no existing snapshot, looking for a bookmark."
"Found no existing bookmark either; will send full stream."
"Sending non-incremental stream."

At this point, the "non-incremental" transfer fails due to previous snapshots (created when using my patched simplesnap v1.0.3) existing on the backup host. (i.e. the first error message above is false, as existing snapshots do exist).

A quick review of simplesnapwrap reveals the if-then-else, found at lines 101-106, does nothing except print a message to the log. It doesn't matter if a snapshot is found, or not, the execution flow always continues with lines 108-114. When no bookmarks are found (lines 108-109), the script will always attempt to send a non-incremental (which, of course, fails due to existing incrementals).

Due to the above error, I built my pull request #23 on commit 0337dda.

Recommendations:

  1. Create a separate branch to work on bookmark functionality (based on the current Master branch).
  2. Revert the Master branch HEAD to commit 0337dda -- this will restore previous functionality with the use of existing snapshots.

@jgoerzen, if you agree with this approach, I'd be happy to create a PR for recommendation 2. I'd also be happy to work on the corrections to the bookmark code in the newly created bookmarks branch.