vacuum: skip adding records to list of records to send to lmaster on lmaster
authorMichael Adam <obnox@samba.org>
Mon, 20 Dec 2010 15:41:13 +0000 (16:41 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Mar 2011 23:37:01 +0000 (00:37 +0100)
This list is skipped afterwards when the lists are processed.

server/ctdb_vacuum.c

index 964eeabe74ab49136d8903b1d190ee252cc38247..215811560c2933a57c2b187b3181ba54babae436 100644 (file)
@@ -145,7 +145,7 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        struct ctdb_db_context *ctdb_db = vdata->ctdb_db;
        uint32_t lmaster;
        struct ctdb_ltdb_header *hdr;
-       int res;
+       int res = 0;
 
        lmaster = ctdb_lmaster(ctdb, &key);
        if (lmaster >= ctdb->num_nodes) {
@@ -204,11 +204,14 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
 
                        vdata->delete_count++;
                }
+       } else {
+               /*
+                * We are not lmaster.
+                * Add the record to the blob ready to send to the nodes.
+                */
+               res = add_record_to_vacuum_fetch_list(vdata, key);
        }
 
-       /* add the record to the blob ready to send to the nodes */
-       res = add_record_to_vacuum_fetch_list(vdata, key);
-
        return res;
 }