vacuum: turn the vacuuming on lmaster into a three-phase process.
authorMichael Adam <obnox@samba.org>
Sat, 5 Jan 2013 00:20:18 +0000 (01:20 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 5 Apr 2013 15:18:36 +0000 (17:18 +0200)
commit4fb86aa8410fb56f36462aa8ea9dfcddad1f53bf
treec8623afebd57a9f345877fe389289626ea3078d3
parent10a64568105757d046d6a91ce387a77ecd2182f1
vacuum: turn the vacuuming on lmaster into a three-phase process.

More precisely, before locally deleting an empty record, that has been
migrated with data and that we are dmaster and laster for, we now perform
the deletion on the other nodes in two steps instead of a single step.

- First send out the list of records to be deleted to all
  other nodes with the new RECEIVE_RECORDS control to store
  the lmaster's current empty copy.
- Then send those records that could be deleted on all nodes
  to all nodes again with the TRY_DELETE_RECORDS control
  as before for deletion.
- Finally delete those records locally that were successfully
  deleted remotely in the previous step.

This fixes and old race where a recovery that hits the vacuum process
square between the eyes can create gaps in the record's history and
hence let the records resurrect. In the case of the locking.tdb,
that could mean that a file that was already closed, was recorded as
being open and locked again, so samba clients were locked out of that
file until samba was restarted.

Signed-off-by: Michael Adam <obnox@samba.org>
server/ctdb_vacuum.c