This prevents the use bookmarks when trying to find the latest common
snapshot. This forces a rollback when the latest snapshot on the source
was deleted but a common and older snapshot was found.
Signed-off-by: Felix Matouschek <felix@matouschek.org>
This commit changes syncoid's behavior so it is always looking for
a matching snapshot and a matching bookmark. If the bookmark was created
after the snapshot it is used instead. This allows replication when the
latest snapshot replicated was deleted on the source, a common snapshot
was found but rollback on the target is not allowed. The matching bookmark
is used instead for replication.
This fixes https://github.com/jimsalterjrs/sanoid/issues/602
Signed-off-by: Felix Matouschek <felix@matouschek.org>
When creating bookmarks compare the GUID of existing bookmarks before
failing the creation of a duplicate bookmark.
Signed-off-by: Felix Matouschek <felix@matouschek.org>
This commit adds a regression test for the out-of-order snapshot
replication issue.
The new test case manipulates the system clock with `setdate` to create
snapshots with non-monotonic `creation` timestamps but a correct,
sequential `createtxg`. It then runs `syncoid` and verifies that all
snapshots were replicated, which is only possible if they are ordered
correctly by `createtxg`.
See #815 for the original test.
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
The sort before tended to be alphabetical, which put test
`8_force_delete_snapshot` after `815_sync_out-of-order_snapshots`, but
`8` should come before `815`.
Before:
```
root@demo:~/sanoid/tests/syncoid# ./run-tests.sh
Running test 1_bookmark_replication_intermediate ... [PASS]
Running test 2_bookmark_replication_no_intermediate ... [PASS]
Running test 3_force_delete ... [PASS]
Running test 4_bookmark_replication_edge_case ... [PASS]
Running test 5_reset_resume_state ... mbuffer: error: outputThread: error writing to <stdout> at offset 0x90000: Broken pipe
mbuffer: warning: error during output to <stdout>: Broken pipe
[PASS]
Running test 6_reset_resume_state2 ... [PASS]
Running test 7_preserve_recordsize ... [PASS]
Running test 815_sync_out-of-order_snapshots ... [PASS]
Running test 8_force_delete_snapshot ... [PASS]
```
After:
```
root@demo:~/sanoid/tests/syncoid# ./run-tests.sh
Running test 1_bookmark_replication_intermediate ... [PASS]
Running test 2_bookmark_replication_no_intermediate ... [PASS]
Running test 3_force_delete ... [PASS]
Running test 4_bookmark_replication_edge_case ... [PASS]
Running test 5_reset_resume_state ... mbuffer: error: outputThread: error writing to <stdout> at offset 0xf0000: Broken pipe
mbuffer: warning: error during output to <stdout>: Broken pipe
[PASS]
Running test 6_reset_resume_state2 ... [PASS]
Running test 7_preserve_recordsize ... [PASS]
Running test 8_force_delete_snapshot ... [PASS]
Running test 815_sync_out-of-order_snapshots ... [PASS]
```