List:Commits« Previous MessageNext Message »
From:tim Date:September 15 2006 2:51am
Subject:bk commit into 4.0 tree (tsmith:1.2186) BUG#4053
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of tim. When tim 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, 2006-09-14 20:51:50-06:00, tsmith@stripped +6 -0
  Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"
  
  - Fix my_read(), my_write() and my_read_charset_file() to handle return values from read/write correctly
  - Add debugging 'deprecated function' warning to my_lread/my_lwrite
  - Add debugging 'error, read/write interupt not handled' warning to my_quick_read/my_quick_write

  mysys/my_lread.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +2 -0
    Handle interrupted read() (EINTR) better

  mysys/my_lwrite.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +2 -0
    Handle interrupted read() (EINTR) better

  mysys/my_pread.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +8 -4
    Handle interrupted read() (EINTR) better

  mysys/my_quick.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +25 -1
    Handle interrupted read() (EINTR) better

  mysys/my_read.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +6 -2
    Handle interrupted read() (EINTR) better

  mysys/my_write.c@stripped, 2006-09-14 20:46:49-06:00, tsmith@stripped +13 -7
    Handle interrupted read() (EINTR) better

# 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:	tsmith
# Host:	siva.hindu.god
# Root:	/usr/home/tim/m/bk/tmp/40

--- 1.5/mysys/my_lread.c	2006-09-14 20:51:52 -06:00
+++ 1.6/mysys/my_lread.c	2006-09-14 20:51:52 -06:00
@@ -30,6 +30,8 @@ uint32 my_lread(int Filedes, byte *Buffe
   DBUG_PRINT("my",("Fd: %d  Buffer: %ld  Count: %ld  MyFlags: %d",
 		   Filedes, Buffer, Count, MyFlags));
 
+  DBUG_PRINT("error", ("Deprecated my_lread() function should not be used."));
+
   /* Temp hack to get count to int32 while read wants int */
   if ((readbytes = (uint32) read(Filedes, Buffer, (uint) Count)) != Count)
   {

--- 1.5/mysys/my_lwrite.c	2006-09-14 20:51:52 -06:00
+++ 1.6/mysys/my_lwrite.c	2006-09-14 20:51:52 -06:00
@@ -26,6 +26,8 @@ uint32 my_lwrite(int Filedes, const byte
   DBUG_PRINT("my",("Fd: %d  Buffer: %lx  Count: %ld  MyFlags: %d",
 		   Filedes, Buffer, Count, MyFlags));
 
+  DBUG_PRINT("error", ("Deprecated my_lwrite() function should not be used."));
+
   /* Temp hack to get count to int32 while write wants int */
   if ((writenbytes = (uint32) write(Filedes, Buffer, (uint) Count)) != Count)
   {

--- 1.9/mysys/my_pread.c	2006-09-14 20:51:52 -06:00
+++ 1.10/mysys/my_pread.c	2006-09-14 20:51:52 -06:00
@@ -52,8 +52,12 @@ uint my_pread(File Filedes, byte *Buffer
       DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
 			    readbytes,Count,Filedes,my_errno));
 #ifdef THREAD
-      if (readbytes == 0 && errno == EINTR)
-	continue;				/* Interrupted */
+      if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+      {
+        DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
+                             (int) readbytes));
+        continue;                              /* Interrupted */
+      }
 #endif
       if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
       {
@@ -124,8 +128,8 @@ uint my_pwrite(int Filedes, const byte *
       VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
       continue;
     }
-    if ((writenbytes == 0 && my_errno == EINTR) ||
-	(writenbytes > 0 && (uint) writenbytes != (uint) -1))
+    if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) ||
+        my_errno == EINTR)
       continue;					/* Retry */
 #endif
     if (MyFlags & (MY_NABP | MY_FNABP))

--- 1.4/mysys/my_quick.c	2006-09-14 20:51:52 -06:00
+++ 1.5/mysys/my_quick.c	2006-09-14 20:51:52 -06:00
@@ -26,6 +26,14 @@ uint my_quick_read(File Filedes,byte *Bu
 
   if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
   {
+#ifndef DBUG_OFF
+    if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+    {  
+      DBUG_PRINT("error", ("my_quick_read() was interrupted and returned %d"
+                           ".  This function does not retry the read!",
+                           (int) readbytes));
+    }
+#endif
     my_errno=errno;
     return readbytes;
   }
@@ -35,8 +43,24 @@ uint my_quick_read(File Filedes,byte *Bu
 
 uint my_quick_write(File Filedes,const byte *Buffer,uint Count)
 {
-  if ((uint) write(Filedes,Buffer,Count) != Count)
+#ifndef DBUG_OFF
+  uint writtenbytes;
+#endif
+
+  if ((
+#ifndef DBUG_OFF
+       writtenbytes =
+#endif
+       (uint) write(Filedes,Buffer,Count)) != Count)
   {
+#ifndef DBUG_OFF
+    if ((writtenbytes == 0 || (int) writtenbytes == -1) && errno == EINTR)
+    {  
+      DBUG_PRINT("error", ("my_quick_write() was interrupted and returned %d"
+                           ".  This function does not retry the write!",
+                           (int) readbytes));
+    }
+#endif
     my_errno=errno;
     return (uint) -1;
   }

--- 1.6/mysys/my_read.c	2006-09-14 20:51:52 -06:00
+++ 1.7/mysys/my_read.c	2006-09-14 20:51:52 -06:00
@@ -51,8 +51,12 @@ uint my_read(File Filedes, byte *Buffer,
       DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
 			    readbytes,Count,Filedes,my_errno));
 #ifdef THREAD
-      if (readbytes == 0 && errno == EINTR)
-	continue;				/* Interrupted */
+      if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR)
+      {  
+        DBUG_PRINT("debug", ("my_read() was interrupted and returned %d",
+                             (int) readbytes));
+        continue;                              /* Interrupted */
+      }
 #endif
       if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
       {

--- 1.10/mysys/my_write.c	2006-09-14 20:51:52 -06:00
+++ 1.11/mysys/my_write.c	2006-09-14 20:51:52 -06:00
@@ -57,18 +57,24 @@ uint my_write(int Filedes, const byte *B
       VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
       continue;
     }
-    if (!writenbytes)
+
+    if ((writenbytes == 0 || (int) writenbytes == -1))
     {
-      /* We may come here on an interrupt or if the file quote is exeeded */
       if (my_errno == EINTR)
-	continue;
-      if (!errors++)				/* Retry once */
       {
-	errno=EFBIG;				/* Assume this is the error */
-	continue;
+        DBUG_PRINT("debug", ("my_write() was interrupted and returned %d",
+                             (int) writenbytes));
+        continue;                               /* Interrupted */
+      }
+
+      if (!writenbytes && !errors++)		/* Retry once */
+      {
+        /* We may come here if the file quota is exeeded */
+        errno=EFBIG;				/* Assume this is the error */
+        continue;
       }
     }
-    else if ((uint) writenbytes != (uint) -1)
+    else
       continue;					/* Retry */
 #endif
     if (MyFlags & (MY_NABP | MY_FNABP))
Thread
bk commit into 4.0 tree (tsmith:1.2186) BUG#4053tim15 Sep