]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb:vacuum: move retrieval of freelist to after vacuum run
authorMichael Adam <obnox@samba.org>
Mon, 10 Feb 2014 01:44:56 +0000 (02:44 +0100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 14 Feb 2014 02:15:30 +0000 (03:15 +0100)
The fast vacuum run may have increased the freelist size.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Feb 14 03:15:30 CET 2014 on sn-devel-104

ctdb/server/ctdb_vacuum.c

index f6900aaf5487e9ce84351a6d4086f5dff06529bb..22603b833d89c85a55a4e171dfe1d41539ec2983 100644 (file)
@@ -1431,12 +1431,6 @@ static int ctdb_vacuum_and_repack_db(struct ctdb_db_context *ctdb_db,
        int freelist_size;
        struct vacuum_data *vdata;
 
-       freelist_size = tdb_freelist_size(ctdb_db->ltdb->tdb);
-       if (freelist_size == -1) {
-               DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
-               return -1;
-       }
-
        vdata = talloc_zero(mem_ctx, struct vacuum_data);
        if (vdata == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Out of memory\n"));
@@ -1463,6 +1457,13 @@ static int ctdb_vacuum_and_repack_db(struct ctdb_db_context *ctdb_db,
                DEBUG(DEBUG_ERR,(__location__ " Failed to vacuum '%s'\n", name));
        }
 
+       freelist_size = tdb_freelist_size(ctdb_db->ltdb->tdb);
+       if (freelist_size == -1) {
+               DEBUG(DEBUG_ERR,(__location__ " Failed to get freelist size for '%s'\n", name));
+               talloc_free(vdata);
+               return -1;
+       }
+
        /*
         * decide if a repack is necessary
         */