fix handling of tenative cursor presence if protection strategy doesn't use it #714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR, we would panic in the
check
phase ofendpoint.Send()
'sTryBatchDestroy
call in the following cases: the current protection strategy does NOT produce a tentative replication cursor ANDFromVersion
is a tentative cursor bookmarkFromVersion
is a snapshot, and there exists a tentative cursor bookmark for that snapshotFromVersion
is a bookmark != tentative cursor bookmark, but there exists a tentative cursor bookmark for the same snapshot as theFromVersion
bookmarkIn those cases, the
check
concluded that we would deleteFromVersion
.It came to that conclusion because the tentative cursor isn't part of
obsoleteAbs
if the protection strategy doesn't produce a tentative replication cursor.The scenarios above can happen if the user changes the protection strategy from "with tentative cursor" to one "without tentative replication cursor", while there is a tentative replication cursor on disk.
The workaround was to rename the tentative cursor.
In all cases above,
TryBatchDestroy
would have destroyed the tentative cursor.In case 1, that would fail the
Send
step and potentially break replication if the cursor is the last common bookmark. Thecheck
conclusion was correct.In cases 2 and 3, deleting the tentative cursor would have been fine because
FromVersion
was a different entity than the tentative cursor. So, destroying the tentative cursor would be the right call.The solution in this PR is as follows:
FromVersion
to theliveAbs
set of live abstractionscheck
closure to use the full dataset path (fullpath
) to identify the concrete ZFS object instead of thezfs.FilesystemVersionEqualIdentity
, which is only identified by matching GUID.FromVersion
in any case, so disregard them.fixes #666