List:Commits« Previous MessageNext Message »
From:msvensson Date:March 23 2007 6:00pm
Subject:bk commit into 5.0 tree (msvensson:1.2415) BUG#26837
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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-23 19:00:34+01:00, msvensson@stripped +1 -0
  Bug#26837 Return value ignored for packet->append() call within Log_event::read_log_event
   - Improve error handling for "out of memory" problems when master is
     sending logs to slave. If memory allocation fails the log should
     now  report error "memory allocation failed reading log event"  

  sql/log_event.cc@stripped, 2007-03-23 19:00:33+01:00, msvensson@stripped +21 -6
    Return LOG_READ_MEM from "Log_event::read_log_event" if memory
    allocation  fails.

# 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:	msvensson
# Host:	pilot.blaudden
# Root:	/home/msvensson/mysql/bug26837/my50-bug26837

--- 1.229/sql/log_event.cc	2007-03-09 06:05:05 +01:00
+++ 1.230/sql/log_event.cc	2007-03-23 19:00:33 +01:00
@@ -669,19 +669,34 @@ int Log_event::read_log_event(IO_CACHE* 
 	     LOG_READ_TOO_LARGE);
     goto end;
   }
-  packet->append(buf, sizeof(buf));
+
+  /* Append the log event header to packet */
+  if (packet->append(buf, sizeof(buf)))
+  {
+    /* Failed to allocate packet */
+    result= LOG_READ_MEM;
+    goto end;
+  }
   data_len-= LOG_EVENT_MINIMAL_HEADER_LEN;
   if (data_len)
   {
+    /* Append rest of event, read directly from file into packet */
     if (packet->append(file, data_len))
     {
       /*
-	Here if we hit EOF it's really an error: as data_len is >=0
-        there's supposed to be more bytes available. 
-	EOF means we are reading the event partially, which should
-	never happen: either we read badly or the binlog is truncated.
+        Fatal error occured when appending rest of the event
+        to packet, possible failures:
+	1. EOF occured when reading from file, it's really an error
+           as data_len is >=0 there's supposed to be more bytes available.
+           file->error will have been set to number of bytes left to read
+        2. Read was interrupted, file->error would normally be set to -1
+        3. Failed to allocate memory for packet, my_errno
+           will be ENOMEM(file->error shuold be 0, but since the
+           memory allocation occurs before the call to read it might
+           be uninitialized)
       */
-      result= file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
+      result= (my_errno == ENOMEM ? LOG_READ_MEM :
+               (file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO));
       /* Implicit goto end; */
     }
   }
Thread
bk commit into 5.0 tree (msvensson:1.2415) BUG#26837msvensson23 Mar