version 1.2.200
[sahlberg/ctdb.git] / server / ctdb_traverse.c
index 3549007cfa91c51b015d4e98bb38a08f53baebb1..5ad374f098da6a8a498c7bfe3ec0640ebe2c7f45 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
 #include "system/filesys.h"
 #include "system/wait.h"
 #include "db_wrap.h"
@@ -153,7 +153,7 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
                return NULL;
        }
 
-       h->child = fork();
+       h->child = ctdb_fork(ctdb_db->ctdb);
 
        if (h->child == (pid_t)-1) {
                close(h->fd[0]);
@@ -171,6 +171,8 @@ static struct ctdb_traverse_local_handle *ctdb_traverse_local(struct ctdb_db_con
        if (h->child == 0) {
                /* start the traverse in the child */
                close(h->fd[0]);
+               debug_extra = talloc_asprintf(NULL, "traverse_local-%s:",
+                                             ctdb_db->db_name);
                tdb_traverse_read(ctdb_db->ltdb->tdb, ctdb_traverse_local_fn, h);
                _exit(0);
        }
@@ -234,7 +236,7 @@ static void ctdb_traverse_all_timeout(struct event_context *ev, struct timed_eve
        struct ctdb_traverse_all_handle *state = talloc_get_type(private_data, struct ctdb_traverse_all_handle);
 
        DEBUG(DEBUG_ERR,(__location__ " Traverse all timeout on database:%s\n", state->ctdb_db->db_name));
-       state->ctdb->statistics.timeouts.traverse++;
+       CTDB_INCREMENT_STAT(state->ctdb, timeouts.traverse);
 
        state->callback(state->private_data, tdb_null, tdb_null);
 }