List:Commits« Previous MessageNext Message »
From:tomas Date:March 19 2008 1:31pm
Subject:bk commit into 5.1 tree (tomas:1.2543) BUG#35435
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas.  When tomas does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-19 13:31:36+01:00, tomas@stripped +1 -0
  Bug #35435  	ndb_waiter timeout wrongly calculated

  storage/ndb/tools/waiter.cpp@stripped, 2008-03-19 13:31:33+01:00, tomas@stripped +14 -6
    Bug #35435  	ndb_waiter timeout wrongly calculated

diff -Nrup a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp
--- a/storage/ndb/tools/waiter.cpp	2008-02-07 08:14:15 +01:00
+++ b/storage/ndb/tools/waiter.cpp	2008-03-19 13:31:33 +01:00
@@ -213,9 +213,13 @@ waitClusterStatus(const char* _addr,
   int resetAttempts = 0;
   const int MAX_RESET_ATTEMPTS = 10;
   bool allInState = false;
-  int timeout_ms= _timeout * 10; /* In number of 100 milliseconds */
+
+  struct timeval time_now;
+  gettimeofday(&time_now, 0);
+  Int64 timeout_time = time_now.tv_sec + _timeout;
+
   while (allInState == false){
-    if (_timeout > 0 && attempts > _timeout){
+    if (_timeout > 0 && time_now.tv_sec > timeout_time){
       /**
        * Timeout has expired waiting for the nodes to enter
        * the state we want
@@ -243,19 +247,23 @@ waitClusterStatus(const char* _addr,
 	g_err << "waitNodeState("
 	      << ndb_mgm_get_node_status_string(_status)
 	      <<", "<<_startphase<<")"
-	      << " timeout after " << attempts <<" attemps" << endl;
+	      << " timeout after " << attempts << " attempts" << endl;
 	return -1;
       }
 
       g_err << "waitNodeState("
 	    << ndb_mgm_get_node_status_string(_status)
 	    <<", "<<_startphase<<")"
-	    << " resetting number of attempts "
+	    << " resetting timeout "
 	    << resetAttempts << endl;
-      attempts = 0;
+
+      timeout_time = time_now.tv_sec + _timeout;
+
       resetAttempts++;
     }
 
+    if (attempts > 0)
+      NdbSleep_MilliSleep(100);
     if (getStatus() != 0){
       return -1;
     }
@@ -279,10 +287,10 @@ waitClusterStatus(const char* _addr,
     if (!allInState) {
       g_info << "Waiting for cluster enter state "
              << ndb_mgm_get_node_status_string(_status)<< endl;
-      NdbSleep_MilliSleep(100);
     }
 
     attempts++;
+    gettimeofday(&time_now, 0);
   }
   return 0;
 }
Thread
bk commit into 5.1 tree (tomas:1.2543) BUG#35435tomas20 Mar