List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:March 13 2007 11:00am
Subject:bk commit into 5.1 tree (stewart:1.2479)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart 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, 2007-03-13 12:00:08+01:00, stewart@stripped +1 -0
  [PATCH] Fix infinite (0) timeout for ndb_logevent_get_next
  
  Index: ndb-work/storage/ndb/src/mgmapi/ndb_logevent.cpp
  ===================================================================

  storage/ndb/src/mgmapi/ndb_logevent.cpp@stripped, 2007-03-13 11:57:39+01:00, stewart@stripped +12 -19
    Fix infinite (0) timeout for ndb_logevent_get_next

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.1/telco-wl3704

--- 1.11/storage/ndb/src/mgmapi/ndb_logevent.cpp	2006-12-23 20:20:21 +01:00
+++ 1.12/storage/ndb/src/mgmapi/ndb_logevent.cpp	2007-03-13 11:57:39 +01:00
@@ -389,14 +389,18 @@
 			  struct ndb_logevent *dst,
 			  unsigned timeout_in_milliseconds)
 {
+  if (timeout_in_milliseconds == 0)
+  {
+    int res;
+    while ((res = ndb_logevent_get_next(h, dst, 60000))==0);
+    return res;
+  }
+
   SocketInputStream in(h->socket, timeout_in_milliseconds);
 
   Properties p;
   char buf[256];
 
-  struct timeval start_time;
-  gettimeofday(&start_time, 0);
-
   /* header */
   while (1) {
     if (in.gets(buf,sizeof(buf)) == 0)
@@ -409,24 +413,15 @@
       // timed out
       return 0;
     }
+
     if ( strcmp("log event reply\n", buf) == 0 )
       break;
 
     if ( strcmp("<PING>\n", buf) )
       ndbout_c("skipped: %s", buf);
 
-    struct timeval now;
-    gettimeofday(&now, 0);
-    unsigned elapsed_ms= (now.tv_sec-start_time.tv_sec)*1000 +
-      ((signed int)now.tv_usec-(signed int)start_time.tv_usec)/1000;
-
-    if (elapsed_ms >= timeout_in_milliseconds)
-    {
-      // timed out
-      return 0;
-    }
-
-    new (&in) SocketInputStream(h->socket, timeout_in_milliseconds-elapsed_ms);
+    if(in.timedout())
+        return 0;
   }
 
   /* read name-value pairs into properties object */
@@ -437,11 +432,9 @@
       h->m_error= NDB_LEH_READ_ERROR;
       return -1;
     }
-    if ( buf[0] == 0 )
-    {
-      // timed out
+    if (in.timedout())
       return 0;
-    }
+
     if ( buf[0] == '\n' )
     {
       break;
Thread
bk commit into 5.1 tree (stewart:1.2479)Stewart Smith13 Mar