Skip to content

Commit

Permalink
Add option to ignore failed bookmark creation
Browse files Browse the repository at this point in the history
When replicating to multiple targets (>2) bookmark and bookmark with
suffix will already have been created. This option can be used to ignore
creation failure of further bookmarks.
  • Loading branch information
0xFelix committed Apr 23, 2023
1 parent 86fffca commit 7e76de6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions syncoid
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ GetOptions(\%args, "no-command-checks", "monitor-version", "compress=s", "dumpsn
"source-bwlimit=s", "target-bwlimit=s", "sshconfig=s", "sshkey=s", "sshport=i", "sshcipher|c=s", "sshoption|o=s@",
"debug", "quiet", "no-stream", "no-sync-snap", "no-resume", "exclude=s@", "skip-parent", "identifier=s",
"no-clone-handling", "no-privilege-elevation", "force-delete", "no-rollback", "create-bookmark",
"pv-options=s" => \$pvoptions, "keep-sync-snap", "preserve-recordsize", "mbuffer-size=s" => \$mbuffer_size)
or pod2usage(2);
"ignore-failed-create-bookmark", "pv-options=s" => \$pvoptions, "keep-sync-snap", "preserve-recordsize",
"mbuffer-size=s" => \$mbuffer_size) or pod2usage(2);

my %compressargs = %{compressargset($args{'compress'} || 'default')}; # Can't be done with GetOptions arg, as default still needs to be set

Expand Down Expand Up @@ -874,9 +874,13 @@ sub syncdataset {
}
if ($debug) { print "DEBUG: $bookmarkcmd\n"; }
system($bookmarkcmd) == 0 or do {
warn "CRITICAL ERROR: $bookmarkcmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }
return 0;
if (!defined $args{'ignore-failed-create-bookmark'}) {
warn "CRITICAL ERROR: $bookmarkcmd failed: $?";
if ($exitcode < 2) { $exitcode = 2; }
return 0;
} else {
if (!$quiet) { print "INFO: bookmark with guid based suffix creation failed, ignoring...\n"; }
}
}
};
}
Expand Down Expand Up @@ -1997,6 +2001,7 @@ Options:
--no-sync-snap Does not create new snapshot, only transfers existing
--keep-sync-snap Don't destroy created sync snapshots
--create-bookmark Creates a zfs bookmark for the newest snapshot on the source after replication succeeds (only works with --no-sync-snap)
--ignore-failed-create-bookmark Ignore failure when creating a zfs bookmark (bookmark and bookmark with guid suffix already exist, only works with --no-sync-snap)
--preserve-recordsize Preserves the recordsize on initial sends to the target
--no-rollback Does not rollback snapshots on target (it probably requires a readonly target)
--exclude=REGEX Exclude specific datasets which match the given regular expression. Can be specified multiple times
Expand Down

0 comments on commit 7e76de6

Please sign in to comment.