The `runsynccmd` subroutine was not matching the `$sendsource` when a
receive resume token is passed in. All usages that pass in the receive
resume token do not begin with a space; instead, they start with `-t `.
Fixes: https://github.com/jimsalterjrs/sanoid/issues/918
Add the zstdmt-fast and zstdmt-slow compress options to allow use of
multithreading when using zstd compression.
Signed-off-by: 0xFelix <felix@matouschek.org>
This is a continuation of a previous commit to sort snapshots by
`createtxg` if possible. Now, we have to match the behavior when
selecting an appropriate snapshot based on the transaction group of the
relevant bookmark in `syncdataset()`.
Supersedes: https://github.com/jimsalterjrs/sanoid/pull/667
It is possible for `creation` of a subsequent snapshot to be in the past
compared to the current snapshot due to system clock discrepancies,
which leads to earlier snapshots not being replicated in the initial
syncoid sync.
Also, `syncoid --no-sync-snap` might not pick up the most recently taken
snapshot if the clock moved backwards before taking that snapshot.
Sorting snapshots by the `createtxg` value is reliable and documented
in `man 8 zfsprops` as the proper way to order snapshots, but it was not
available in ZFS versions before 0.7. To maintain backwards
compatibility, the sorting falls back to sorting by the `creation`
property, which was the old behavior.
Fixes: https://github.com/jimsalterjrs/sanoid/issues/815
The `getsnaps` subroutine now retrieves the "createtxg" property of the
snapshot.
This is necessary to support the fix for
https://github.com/jimsalterjrs/sanoid/issues/815 (Syncoid: Data loss
because getoldestsnapshot() might not choose the first snapshot).
* The part that was "a little obnoxious" has been rewritten to extract
the desired properties in a single loop after importing each line into
a hash rather than processing line by line with a state tracking flag.
* The `getsnapsfallback` subroutine had duplicated logic that has been
absorbed into `getsnaps` with a recursion argument to enable the
fallback mode.
If there was an obsolete remote syncoid_hostname_* snapshot that did not
get removed at the correct time, for some reason, like, maybe, network
problems, it would have been cleaned up in pruneoldsyncsnaps just before
this code, and we would get a strange error message saying:
could not find any snapshots to destroy; check snapshot names.
Also, when using --quiet, do not output anything, as failing to remove
an obsolete snapshot is not really a big problem.