HAMMER 60J/Many: Mirroring
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 10 Jul 2008 04:44:33 +0000 (04:44 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 10 Jul 2008 04:44:33 +0000 (04:44 +0000)
commit4c038e17e82a6872cbdb900534ec0628c8d7fbe2
tree7e3af686ad7d09dcd150da8513f8c42344c792e5
parent80818344573e3f97727db221df01fd72c0602a9a
HAMMER 60J/Many: Mirroring

Finish implementing the core mirroring algorithm.  The last bit was to add
support for no-history deletions on the master.  The same support also covers
masters which have pruned records away prior to the mirroring operation.
As with the work done previously, the algorithm is 100% queue-less and
has no age limitations.  You could wait a month, and then do a mirroring
update from master to slave, and the algorithm will efficiently handle it.

The basic issue that this commit tackles is what to do when records are
physically deleted from the master.  When this occurs the mirror master
cannot provide a list of records to delete to its slaves.

The solution is to use the mirror TID propagation to physically identify
swaths of the B-Tree in which a deletion MAY have taken place.  The
mirroring code uses this information to generate PASS and SKIP mrecords.

A PASS identifies a record (sans its data payload) that remains within
the identified swath and should already exist on the target.  The
mirroring target does a simultanious iteration of the same swath on the
target B-Tree and deletes records not identified by the master.

A SKIP is the heart of the algorithm's efficiency.  The same mirror TID
stored in the B-Tree can also identify large swaths of the B-Tree for which
*NO* deletions have taken place (which will be most of the B-Tree).  One
SKIP Record can identify an arbitrarily large swath.  The target uses
the SKIP record to skip that swath on the target.  No scan takes place.
SKIP records can be generated from any internal node of the B-Tree and cover
that node's entire sub-tree.

This also provides us with the feature where the retention policy can be
completely different between a master and a mirror, or between mirrors.
When the slave identifies a record that must be deleted through the above
algorithm it only needs to mark it as historically deleted, it does not
have to physically delete the record.
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_cursor.h
sys/vfs/hammer/hammer_disk.h
sys/vfs/hammer/hammer_inode.c
sys/vfs/hammer/hammer_ioctl.h
sys/vfs/hammer/hammer_mirror.c
sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_subs.c
sys/vfs/hammer/hammer_vnops.c