In control_ipreallocate() we wait at most 5 tries before aborting the command
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 20 May 2010 02:35:57 +0000 (12:35 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 20 May 2010 02:35:57 +0000 (12:35 +1000)
and returning an error.
This might not be sufficient if there are several recoveries in a row.

Instead loop as long as it takes for the recovery master to finish the recoveries and re
spond to the ipreallocate call.

Increase the log level of the error message when the recovery master was busy and could
not perform the ipreallocation promptly

BZ61783

tools/ctdb.c

index dc8860215982dff98f5d80b2b6f0cb2183d1557d..fa4568617ea31b039c5e939d6ebb1cc9de4b5443 100644 (file)
@@ -2007,15 +2007,10 @@ static int control_ipreallocate(struct ctdb_context *ctdb, int argc, const char
        data.dsize = sizeof(rd);
 
 again:
-       if (retries>5) {
-               DEBUG(DEBUG_ERR,("Failed waiting for cluster convergense\n"));
-               exit(10);
-       }
-
        /* check that there are valid nodes available */
        if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap) != 0) {
                DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
-               exit(10);
+               return -1;
        }
        for (i=0; i<nodemap->num;i++) {
                if ((nodemap->nodes[i].flags & (NODE_FLAGS_DELETED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)) == 0) {
@@ -2037,7 +2032,7 @@ again:
        /* verify the node exists */
        if (ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), recmaster, ctdb, &nodemap) != 0) {
                DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
-               exit(10);
+               return -1;
        }
 
 
@@ -2079,14 +2074,14 @@ again:
 
        tv = timeval_current();
        /* this loop will terminate when we have received the reply */
-       while (timeval_elapsed(&tv) < 3.0) {    
+       while (timeval_elapsed(&tv) < 3.0) {
                event_loop_once(ctdb->ev);
        }
        if (ipreallocate_finished == 1) {
                return 0;
        }
 
-       DEBUG(DEBUG_INFO,("Timed out waiting for recmaster ipreallocate. Trying again\n"));
+       DEBUG(DEBUG_ERR,("Timed out waiting for recmaster ipreallocate. Trying again\n"));
        retries++;
        sleep(1);
        goto again;