call: becoming dmaster in VACUUM_MIGRATION, set the VACUUM_MIGRATED record flag
authorMichael Adam <obnox@samba.org>
Fri, 10 Dec 2010 13:11:38 +0000 (14:11 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Mar 2011 23:01:53 +0000 (00:01 +0100)
This temporary flag is used for the local record storage function to
decide whether to delete an empty record which has never been migrated
with data as part of the fast-path vacuuming process or, or to store
the record.

server/ctdb_call.c

index cb49a1d92a4991808eccee33202b46cc774b2b66..c8729ce1c11d39782807da45c81f3c82535cf266 100644 (file)
@@ -261,6 +261,20 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
        header.dmaster = ctdb->pnn;
        header.flags = record_flags;
 
+       state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
+
+       if (state) {
+               if (state->call->flags & CTDB_CALL_FLAG_VACUUM_MIGRATION) {
+                       /*
+                        * We temporarily add the VACUUM_MIGRATED flag to
+                        * the record flags, so that ctdb_ltdb_store can
+                        * decide whether the record should be stored or
+                        * deleted.
+                        */
+                       header.flags |= CTDB_REC_FLAG_VACUUM_MIGRATED;
+               }
+       }
+
        if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
                ctdb_fatal(ctdb, "ctdb_reply_dmaster store failed\n");
 
@@ -271,7 +285,6 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
                return;
        }
 
-       state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
 
        if (state == NULL) {
                DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",