From: Ronnie Sahlberg Date: Mon, 6 Dec 2010 02:08:53 +0000 (+1100) Subject: Add two new flags for the ltdb header. X-Git-Url: http://git.samba.org/?p=sahlberg%2Fctdb.git;a=commitdiff_plain;h=b8847a665d2fc56d8f8c8a7d5110d7aafa85bb47 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 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 Date: Tue Nov 30 17:00:54 2010 +0100 add a DEFAULT record flag and a MIGRATED_WITH_DATA record flag. --- diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h index 52290e89..d297af42 100644 --- a/include/ctdb_protocol.h +++ b/include/ctdb_protocol.h @@ -477,6 +477,8 @@ struct ctdb_ltdb_header { uint64_t rsn; uint32_t dmaster; uint32_t reserved1; +#define CTDB_REC_FLAG_DEFAULT 0x00000000 +#define CTDB_REC_FLAG_MIGRATED_WITH_DATA 0x00010000 uint32_t flags; };