From 27012e562353743e5984f6256e77a7f75cc5126d Mon Sep 17 00:00:00 2001 From: Denis Shaposhnikov <993498+dsh2dsh@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:12:54 +0100 Subject: [PATCH] Allow same root_fs for different jobs: sinks and so on (#752) Because some jobs add client identity to root_fs and other jobs don't do that, we can't reliable detect overlapping of filesystems. And and the same time we need an ability to use equal or overlapped root_fs for different jobs. For instance see this config: ``` - name: "zdisk" type: "sink" root_fs: "zdisk/zrepl" serve: type: "local" listener_name: "zdisk" ``` and ``` - name: "remote-to-zdisk" type: "pull" connect: type: "tls" root_fs: "zdisk/zrepl/remote" ``` As you can see, two jobs have overlapped root_fs, but actually datasets are not overlapped, because job `zdisk` save everything under `zdisk/zrepl/localhost`, because it adds client identity. So they actually use two different filesystems: `zdisk/zrepl/localhost` and `zdisk/zrepl/remote`. And we can't detect this situation during config check. So let's just remove this check, because it's admin's duty to configure correct root_fs's. --------- Co-authored-by: Christian Schwarz --- daemon/job/build_jobs.go | 15 --------------- docs/configuration/overview.rst | 5 ++++- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/daemon/job/build_jobs.go b/daemon/job/build_jobs.go index be630e9..dc2de92 100644 --- a/daemon/job/build_jobs.go +++ b/daemon/job/build_jobs.go @@ -24,21 +24,6 @@ func JobsFromConfig(c *config.Config, parseFlags config.ParseFlags) ([]Job, erro js[i] = j } - // receiving-side root filesystems must not overlap - { - rfss := make([]string, 0, len(js)) - for _, j := range js { - jrfs, ok := j.OwnedDatasetSubtreeRoot() - if !ok { - continue - } - rfss = append(rfss, jrfs.ToString()) - } - if err := validateReceivingSidesDoNotOverlap(rfss); err != nil { - return nil, err - } - } - return js, nil } diff --git a/docs/configuration/overview.rst b/docs/configuration/overview.rst index 859491a..4b9de34 100644 --- a/docs/configuration/overview.rst +++ b/docs/configuration/overview.rst @@ -130,7 +130,7 @@ The following high-level steps take place during replication and can be monitore * Move the **replication cursor** bookmark on the sending side (see below). * Move the **last-received-hold** on the receiving side (see below). * Release the send-side step-holds. - + The idea behind the execution order of replication steps is that if the sender snapshots all filesystems simultaneously at fixed intervals, the receiver will have all filesystems snapshotted at time ``T1`` before the first snapshot at ``T2 = T1 + $interval`` is replicated. ZFS Background Knowledge @@ -258,6 +258,9 @@ On your setup, ensure that * all ``filesystems`` filter specifications are disjoint * no ``root_fs`` is a prefix or equal to another ``root_fs`` + + * For ``sink`` jobs, consider all possible ``root_fs/${client_identity}``. + * no ``filesystems`` filter matches any ``root_fs`` **Exceptions to the rule**: