First, resilvering is done at the dataset and snapshot layer (DSL) and not the vdev layer. Each txg commit has a monotonically increasing counter. So the dataset knows what data is written when. The resilver begins temporally at the oldest common time (as determined by the txg commit in the vdev's label) and progresses to the present. This is commonly called "time based resilvering" and is a good optimization for providing increased reliability.
The source of the data (eg which vdev in a 3-way mirror) is determined by the normal spreading logic with the requirement that the blocks being resilvered have correct checksums. So, unlike some brain-dead RAID implementations (eg md-raid), there is no ambiguity about where the correct data lives. -- richard On Mon, Dec 20, 2021 at 3:23 AM openzfs via openzfs-developer < developer@lists.open-zfs.org> wrote: > I have a question regarding ZFS mirror resilvering. Consider a mirror with > two vdevs: disk A and B. Disk B is hot-removed. Data is written to mirror > (only written to disk A). The host is powered off. Disk B is cold-attached > to the host and booted again. Zpool is imported. What vdev of the mirror is > leading in the resilver process? i.e. what data will prevail? Is this > deterministic? ZFS version: zfs-0.8.3 (Ubuntu 20.04). > *openzfs <https://openzfs.topicbox.com/latest>* / openzfs-developer / see > discussions <https://openzfs.topicbox.com/groups/developer> + participants > <https://openzfs.topicbox.com/groups/developer/members> + delivery options > <https://openzfs.topicbox.com/groups/developer/subscription> Permalink > <https://openzfs.topicbox.com/groups/developer/T7209b2fe172e98f1-Me3fa6b1f1c4793e3c7e1de4f> > ------------------------------------------ openzfs: openzfs-developer Permalink: https://openzfs.topicbox.com/groups/developer/T7209b2fe172e98f1-M9287fdd0fc18a6b32792194e Delivery options: https://openzfs.topicbox.com/groups/developer/subscription