List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:August 30 2006 9:28pm
Subject:bk commit into 4.0 tree (cmiller:1.2183) BUG#4053
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of cmiller. When cmiller 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-08-30 17:28:34-04:00, cmiller@stripped +1 -0
  Bug#4053: too many of "error 1236: 'binlog truncated in the middle of \
  	event' from master"
  
  Since there is no repeatable test case, and this is obviously wrong, this is
  the most conservative change that might possibly work.  
  
  The syscall  read()  wasn't checked for a negative return value for an
  interrupted read.  The kernel  sys_read()  returns -EINTR, and the "library" 
  layer maps that to return value of -1 and sets  errno  to EINTR.  It's 
  impossible (on Linux) for  read()  to set errno EINTR without the return 
  value being -1 .
  
  So, if we're checking for EINTR behavior, we should not require that the
  return value be zero.

  mysys/my_read.c@stripped, 2006-08-30 17:28:34-04:00, cmiller@stripped +4 -1
    The read() syscall should check for negative one, since that (usually) signals
    errors (like being interrupted) and zero (usually) signals end-of-file .

  mysys/my_read.c@stripped, 2006-08-29 12:21:59-04:00, cmiller@stripped +21 -21
    Made styling conform to guidelines.

# 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:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/bug04053/my40-bug04053

--- 1.6/mysys/my_read.c	2006-08-30 17:28:36 -04:00
+++ 1.8/mysys/my_read.c	2006-08-30 17:28:36 -04:00
@@ -36,48 +36,51 @@
 
 uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
 {
-  uint readbytes,save_count;
+  uint readbytes, save_count;
   DBUG_ENTER("my_read");
   DBUG_PRINT("my",("Fd: %d  Buffer: %lx  Count: %u  MyFlags: %d",
-		   Filedes, Buffer, Count, MyFlags));
-  save_count=Count;
+                   Filedes, Buffer, Count, MyFlags));
+  save_count= Count;
 
   for (;;)
   {
-    errno=0;					/* Linux doesn't reset this */
-    if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
+    errno= 0;					/* Linux doesn't reset this */
+    if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
     {
-      my_errno=errno ? errno : -1;
+      my_errno= errno ? errno : -1;
       DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
-			    readbytes,Count,Filedes,my_errno));
+                            readbytes, Count, Filedes, my_errno));
 #ifdef THREAD
-      if (readbytes == 0 && errno == EINTR)
-	continue;				/* Interrupted */
+      if ((int) readbytes <= 0 && 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))
       {
-	if ((int) readbytes == -1)
-	  my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
-		   my_filename(Filedes),my_errno);
-	else if (MyFlags & (MY_NABP | MY_FNABP))
-	  my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
-		   my_filename(Filedes),my_errno);
+        if ((int) readbytes == -1)
+          my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
+                   my_filename(Filedes),my_errno);
+        else if (MyFlags & (MY_NABP | MY_FNABP))
+          my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
+                   my_filename(Filedes),my_errno);
       }
       if ((int) readbytes == -1 ||
-	  ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
-	DBUG_RETURN(MY_FILE_ERROR);	/* Return with error */
+          ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
+        DBUG_RETURN(MY_FILE_ERROR);	/* Return with error */
       if (readbytes > 0 && (MyFlags & MY_FULL_IO))
       {
-	Buffer+=readbytes;
-	Count-=readbytes;
-	continue;
+        Buffer+= readbytes;
+        Count-= readbytes;
+        continue;
       }
     }
 
     if (MyFlags & (MY_NABP | MY_FNABP))
-      readbytes=0;			/* Ok on read */
+      readbytes= 0;			/* Ok on read */
     else if (MyFlags & MY_FULL_IO)
-      readbytes=save_count;
+      readbytes= save_count;
     break;
   }
   DBUG_RETURN(readbytes);
Thread
bk commit into 4.0 tree (cmiller:1.2183) BUG#4053Chad MILLER30 Aug