Merge commit 'origin/master' into martins
authorMartin Schwenke <martin@meltin.net>
Wed, 10 Dec 2008 00:42:02 +0000 (11:42 +1100)
committerMartin Schwenke <martin@meltin.net>
Wed, 10 Dec 2008 00:42:02 +0000 (11:42 +1100)
tools/ctdb.c

index a005001844b0ff9e63656ddb474ee9962d9c3a51..458331f6b98a5bf52375ff66db6e42e8a07cee4f 100644 (file)
@@ -1433,6 +1433,10 @@ static int control_shutdown(struct ctdb_context *ctdb, int argc, const char **ar
 static int control_recover(struct ctdb_context *ctdb, int argc, const char **argv)
 {
        int ret;
+       uint32_t generation, next_generation;
+
+       /* record the current generation number */
+       generation = get_generation(ctdb);
 
        ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
        if (ret != 0) {
@@ -1446,6 +1450,15 @@ static int control_recover(struct ctdb_context *ctdb, int argc, const char **arg
                return ret;
        }
 
+       /* wait until we are in a new generation */
+       while (1) {
+               next_generation = get_generation(ctdb);
+               if (next_generation != generation) {
+                       return 0;
+               }
+               sleep(1);
+       }
+
        return 0;
 }