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, 26 Apr 2013 14:52:02 +0000 (16:52 +0200)
commit8ff41568a0ea666744c72fd772db5c9f704ad61d
tree047a94c25bb330bc65be7ed51b2711f02dc6ae82
parent64d75afca94d0a59a8d112f2e8d7130c23e5487c
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 an 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>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit eee23d44b6427be8ab49bbfcee3abb62f37dfcc7)
server/ctdb_vacuum.c