replication & pruning: ditch replicated-property, use bookmark as cursor instead

A bookmark with a well-known name is used to track which version was
last successfully received by the receiver.
The createtxg that can be retrieved from the bookmark using `zfs get` is
used to set the Replicated attribute of each snap on the sender:
If the snap's CreateTXG > the cursor's, it is not yet replicated,
otherwise it has been.

There is an optional config option to change the behvior to
`CreateTXG >= the cursor's`, and the implementation defaults to that.

The reason: While things work just fine with `CreateTXG > the cursor's`,
ZFS does not provide size estimates in a `zfs send` dry run
(see acd2418).
However, to enable the use case of keeping the snapshot only around for
the replication, the config flag exists.
This commit is contained in:
Christian Schwarz
2018-09-05 18:24:15 -07:00
parent acd2418803
commit 975fdee217
9 changed files with 559 additions and 294 deletions
+12 -12
View File
@@ -98,21 +98,21 @@ message DestroySnapshotsRes {
repeated DestroySnapshotRes Results = 1;
}
message SnapshotReplicationStatusReq {
message ReplicationCursorReq {
string Filesystem = 1;
string Snapshot = 2;
enum Op {
Get = 0;
SetReplicated = 1;
message GetOp {}
message SetOp {
string Snapshot = 2;
}
oneof op {
GetOp get = 2;
SetOp set = 3;
}
Op op = 3;
}
message SnapshotReplicationStatusRes {
enum Status {
Nonexistent = 0;
NotReplicated = 1;
Replicated = 2;
message ReplicationCursorRes {
oneof Result {
uint64 Guid = 1;
string Error = 2;
}
Status status = 1;
}