block and wait until the clustered has completed the recovery before returning.
this makes it easier to script since it avoids the common need for
ctdb recover
... complex loop to wait for recovery to complete ...
script continues
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) {
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;
}