vacuum: check lmaster against num_nodes instead of vnn_map->size
authorMichael Adam <obnox@samba.org>
Thu, 3 Feb 2011 11:15:41 +0000 (12:15 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Mar 2011 22:21:24 +0000 (23:21 +0100)
When lmaster is bigger than the biggest recorded node number,
then exit the traverse with error.

server/ctdb_vacuum.c

index aa7908fe0e7585ad1d63ddadc2a3679cf37395af..e5b3cd5e22788a199324048012da0775d1d99a5e 100644 (file)
@@ -109,8 +109,14 @@ static int vacuum_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data,
        size_t old_size;
               
        lmaster = ctdb_lmaster(ctdb, &key);
-       if (lmaster >= ctdb->vnn_map->size) {
-               return 0;
+       if (lmaster >= ctdb->num_nodes) {
+               DEBUG(DEBUG_CRIT, (__location__
+                                  " lmaster[%u] >= ctdb->num_nodes[%u] for key"
+                                  " with hash[%u]!\n",
+                                  (unsigned)lmaster,
+                                  (unsigned)ctdb->num_nodes,
+                                  (unsigned)ctdb_hash(&key)));
+               return -1;
        }
 
        if (data.dsize != sizeof(struct ctdb_ltdb_header)) {