List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:February 13 2007 8:40pm
Subject:bk commit into 5.0 tree (cmiller:1.2413) BUG#25807
View as plain text  
Below is the list of changes that have just been committed into a local
5.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, 2007-02-13 14:40:39-05:00, cmiller@stripped +2 -0
  Bug#25807: LOAD DATA INFILE does not work with Pipes
  
  Showstopper and regression against 5.0.24.
  
  Previously, we ignored seek() errors (see Bug#22828) and let seek()s
  against pipes fail.  Now, since we check that a seek didn't fail,
  and return without reading, this bug popped up.
  
  This restores the behavior for file-ish objects that could never be 
  seek()ed.

  BitKeeper/etc/collapsed@stripped, 2007-02-13 13:17:52-05:00, cmiller@stripped +1
-0

  mysys/mf_iocache.c@stripped, 2007-02-13 14:40:38-05:00, cmiller@stripped +29 -6
    If we detect early that the file is not tell()able, then we should
    assume that it's also not seek()able and therefore we should never
    set the (poorly named) "seek_not_done" flag so that we don't immedi-
    ately try to seek() when reading later.
    
    The problem was that tell() was returning -1, so when we read later, 
    we needlessly tried to seek to position  (unsigned long) -1 . 

# 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/bug25807/my50-bug25807

--- 1.64/mysys/mf_iocache.c	2007-02-13 14:40:43 -05:00
+++ 1.65/mysys/mf_iocache.c	2007-02-13 14:40:43 -05:00
@@ -157,6 +157,7 @@ int init_io_cache(IO_CACHE *info, File f
 		  pbool use_async_io, myf cache_myflags)
 {
   uint min_cache;
+  unsigned long pos;
   my_off_t end_of_file= ~(my_off_t) 0;
   DBUG_ENTER("init_io_cache");
   DBUG_PRINT("enter",("cache: 0x%lx  type: %d  pos: %ld",
@@ -169,7 +170,19 @@ int init_io_cache(IO_CACHE *info, File f
   info->arg = 0;
   info->alloced_buffer = 0;
   info->buffer=0;
-  info->seek_not_done= test(file >= 0 && seek_offset != my_tell(file,
MYF(0)));
+
+  pos= my_tell(file, MYF(0));
+  if (((signed long) pos == -1) && (my_errno == ESPIPE))
+  {
+    /* 
+      This kind of object doesn't support seek() or tell().  Don't set a flag
+      that will make us again try to seek() later and fail.
+    */
+    info->seek_not_done= FALSE;
+  }
+  else
+    info->seek_not_done= test(file >= 0 && seek_offset != pos);
+
   info->disk_writes= 0;
 #ifdef THREAD
   info->share=0;
@@ -454,13 +467,23 @@ int _my_b_read(register IO_CACHE *info, 
   */
   if (info->seek_not_done)
   {
-    if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) 
-        == MY_FILEPOS_ERROR)
+    if ((my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) 
+        != MY_FILEPOS_ERROR))
     {
-        info->error= -1;
-        DBUG_RETURN(1);
+      /* No error, reset seek_not_done flag. */
+      info->seek_not_done=0;
+    }
+    else
+    {
+      /*
+        If the seek failed and the error number is ESPIPE, it is because
+        info->file is a pipe or socket or FIFO.  We never should have tried
+        to seek on that.  See Bugs#25807 and #22828 for more info.
+      */
+      DBUG_ASSERT(my_errno != ESPIPE);
+      info->error= -1;
+      DBUG_RETURN(1);
     }
-    info->seek_not_done=0;
   }
 
   diff_length=(uint) (pos_in_file & (IO_SIZE-1));

--- 1.24/BitKeeper/etc/collapsed	2007-02-13 14:40:43 -05:00
+++ 1.25/BitKeeper/etc/collapsed	2007-02-13 14:40:43 -05:00
@@ -39,3 +39,4 @@
 45ba4faf2oqu6eR8fqecR3LfSNcYUg
 45ba5238-NKl80QVXzdGo8hO9M75Xg
 45c0fdfb2mz6NdOIsLenJtf6_ZelTA
+45d1ffcd-r3v8A7uh92hQaMfQM9UPQ
Thread
bk commit into 5.0 tree (cmiller:1.2413) BUG#25807Chad MILLER13 Feb