vacuum: reduce indentation of the loop sending VACUUM_FETCH controls
authorMichael Adam <obnox@samba.org>
Thu, 3 Feb 2011 16:47:36 +0000 (17:47 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Mar 2011 22:21:24 +0000 (23:21 +0100)
This slightly improves the code structure in that loop.

server/ctdb_vacuum.c

index 2c643f72cc3e9e319dba02f2d4e69ced96d6c967..aa7908fe0e7585ad1d63ddadc2a3679cf37395af 100644 (file)
@@ -261,28 +261,33 @@ static int ctdb_vacuum_db(struct ctdb_db_context *ctdb_db, struct vacuum_data *v
                return -1;              
        }
 
+       /*
+        * For records where we are not the lmaster,
+        * tell the lmaster to fetch the record.
+        */
        for (i = 0; i < ctdb->num_nodes; i++) {
-               if (vdata->list[i]->count == 0) {
+               TDB_DATA data;
+
+               if (ctdb->nodes[i]->pnn == ctdb->pnn) {
                        continue;
                }
 
-               /* for records where we are not the lmaster, tell the lmaster to fetch the record */
-               if (ctdb->nodes[i]->pnn != ctdb->pnn) {
-                       TDB_DATA data;
-                       DEBUG(DEBUG_INFO,
-                             ("Found %u records for lmaster %u in '%s'\n",
-                              vdata->list[i]->count, ctdb->nodes[i]->pnn,
-                              name));
-
-                       data.dsize = talloc_get_size(vdata->list[i]);
-                       data.dptr  = (void *)vdata->list[i];
-                       if (ctdb_client_send_message(ctdb, ctdb->nodes[i]->pnn, CTDB_SRVID_VACUUM_FETCH, data) != 0) {
-                               DEBUG(DEBUG_ERR,(__location__ " Failed to send vacuum fetch message to %u\n",
-                                        ctdb->nodes[i]->pnn));
-                               return -1;              
-                       }
+               if (vdata->list[i]->count == 0) {
                        continue;
                }
+
+               DEBUG(DEBUG_INFO, ("Found %u records for lmaster %u in '%s'\n",
+                                  vdata->list[i]->count, ctdb->nodes[i]->pnn,
+                                  name));
+
+               data.dsize = talloc_get_size(vdata->list[i]);
+               data.dptr  = (void *)vdata->list[i];
+               if (ctdb_client_send_message(ctdb, ctdb->nodes[i]->pnn, CTDB_SRVID_VACUUM_FETCH, data) != 0) {
+                       DEBUG(DEBUG_ERR, (__location__ " Failed to send vacuum "
+                                         "fetch message to %u\n",
+                                         ctdb->nodes[i]->pnn));
+                       return -1;
+               }
        }       
 
        /* Process all records we can delete (if any) */