recovery: add special pull-logic for persistent databases
authorMichael Adam <obnox@samba.org>
Fri, 4 Dec 2009 10:21:29 +0000 (11:21 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 4 Dec 2009 14:00:21 +0000 (15:00 +0100)
commit8aef46d2aab3efb322dda51eaa202653cefd5222
tree666dac86f35e6b2a2f18e09f23c67c8a5c00de1b
parente5496a83ef4a01604195b27c4b97f50d4979510e
recovery: add special pull-logic for persistent databases

The decision mechanism which records of a persistent db
are to be pulled into the recdb during recovery is now
as follows:

* Usually a record with the higher rsn than that already
  stored is taken. (Just as for normal tdbs.)

* If a transaction is running on some node, then those
  nodes copies of all records are taken and are not
  overwritten later by other nodes' copies.

In order to keep track of whether a record's copy was obtained
from a node with a transaction running, the recovery mechanism
misuses the ctdb tdb header field 'lacount' in the recdb.
It is cleared later when pushing out the recdb database to the
other nodes.

This way, an incomplete transaction is not spoiled when
a recovery interrupts and the replay should usually succeed
(possibly after a few retries).

Michael
server/ctdb_recoverd.c