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>
Mon, 14 Mar 2011 12:35:45 +0000 (13:35 +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 44c633daef4468c5c4f7b83abb9141f140ed5b12..73072c3f758529b45bc2c0adf2bd6434927a66df 100644 (file)
@@ -282,6 +282,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");
 
@@ -292,7 +306,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",