Add two new flags for the ltdb header.
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 6 Dec 2010 02:08:53 +0000 (13:08 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 6 Dec 2010 03:48:07 +0000 (14:48 +1100)
commitb8847a665d2fc56d8f8c8a7d5110d7aafa85bb47
tree7fa218ab2fb4c542971382a2b38aa9d12f882eac
parentcdaabf3cd3ce18e1cf63a256269ff06f9536313e
Add two new flags for the ltdb header.
One of which signals that the record has never been migrated to/from a node
while containing data.
This property "has never been migrated while non-zero" is important later
to provide heuristics on which records we might be able to purge
from the tdb files cheaply, i.e. without having to rely on the full-blown
database vacuum.

These records are belived to be very common and the pattern would look like
this :
1, no record exists at all.
2, client opens a file
3, samba requests the record for this file
4, an empty record is created on the LMASTER
5, the empty record is migrated to the DMASTER
6, samba writes a <sharemode> to the record locally and the record grows
7, client finishes working the file and closes the file
8, samba removes the sharemode and the record becomes empty again.
9, much later : vacuuming will delete the record

At stage 8, since the record has never been migrated onto a node wile being
non-zero it would be safe, and much more efficient to just delete the record
completely from the database and hand it back to the LMASTER.

The flags occupy the same uint32_t as was previously used for laccessor/lacount
in the header. For now, make sure the flags only define/use the top 16 bits
of this field so that we are sure we dont collide with bits set to one
from previous generations of the ctdb cluster database prior to this
change in semantics of this word.

This is a rework of Michaels patch :
commit 2af1a47cbe1a608496c8caf3eb0c990eb7259a0d
Author: Michael Adam <obnox@samba.org>
Date:   Tue Nov 30 17:00:54 2010 +0100

    add a DEFAULT record flag and a MIGRATED_WITH_DATA record flag.
include/ctdb_protocol.h