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:43:10 +0000 (12:43 +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 7ae3974769a63d69424a453b8e1f00edf3cdc411..0976366bae6a3daba43966432546f34bf88c7e6f 100644 (file)
@@ -1759,15 +1759,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) {
@@ -1789,7 +1784,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;
        }
 
 
@@ -1830,11 +1825,11 @@ 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);
        }
 
-       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;