vaccum: clear the fast-path vacuuming delete_queue after creating the vacuuming child.
authorMichael Adam <obnox@samba.org>
Fri, 17 Dec 2010 00:53:25 +0000 (01:53 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Apr 2011 15:20:49 +0000 (17:20 +0200)
Maybe we should keep a copy for the case that the vacuuming fails?
(cherry picked from commit f19fe5b45748a6998c6950a5b1db7ec2c4468c1c)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
server/ctdb_vacuum.c

index 0dfb2b3793c44e16c1dcaf1703fc191600c7365c..454d47e06f6dae85ea992335c650c5b8f5a0859f 100644 (file)
@@ -895,6 +895,17 @@ ctdb_vacuum_event(struct event_context *ev, struct timed_event *te,
 
        talloc_set_destructor(child_ctx, vacuum_child_destructor);
 
+       /*
+        * Clear the fastpath vacuuming list in the parent.
+        */
+       talloc_free(ctdb_db->delete_queue);
+       ctdb_db->delete_queue = trbt_create(ctdb_db, 0);
+       if (ctdb_db->delete_queue == NULL) {
+               /* fatal here? ... */
+               ctdb_fatal(ctdb, "Out of memory when re-creating vacuum tree "
+                                "in parent context. Shutting down\n");
+       }
+
        event_add_timed(ctdb->ev, child_ctx,
                timeval_current_ofs(ctdb->tunable.vacuum_max_run_time, 0),
                vacuum_child_timeout, child_ctx);