List:Internals« Previous MessageNext Message »
From:monty Date:January 15 2005 1:47am
Subject:bk commit into 4.0 tree (monty:1.2031)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of monty. When monty 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.2031 05/01/15 03:47:06 monty@stripped +3 -0
  Fixed possible access to unintialized memory in filesort when using many buffers

  sql/filesort.cc
    1.58 05/01/15 03:47:03 monty@stripped +2 -0
    Tell that io_cache is moved

  mysys/mf_iocache.c
    1.40 05/01/15 03:47:03 monty@stripped +35 -14
    Added function to call if IO_CACHE is moved

  include/my_sys.h
    1.110 05/01/15 03:47:03 monty@stripped +1 -0
    Added function to call if IO_CACHE is moved

# 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:	monty
# Host:	narttu.mysql.fi
# Root:	/home/my/mysql-4.0

--- 1.109/include/my_sys.h	2004-08-19 21:24:32 +03:00
+++ 1.110/include/my_sys.h	2005-01-15 03:47:03 +02:00
@@ -671,6 +671,7 @@
 extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
 			       my_off_t seek_offset,pbool use_async_io,
 			       pbool clear_cache);
+extern void setup_io_cache(IO_CACHE* info);
 extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
 #ifdef THREAD
 extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count);

--- 1.39/mysys/mf_iocache.c	2004-03-25 12:21:58 +02:00
+++ 1.40/mysys/mf_iocache.c	2005-01-15 03:47:03 +02:00
@@ -71,9 +71,40 @@
 #define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1))
 #define IO_ROUND_DN(X) ( (X)            & ~(IO_SIZE-1))
 
+
+/*
+  Setup internal pointers inside IO_CACHE
+
+  SYNOPSIS
+    setup_io_cache()
+    info		IO_CACHE handler
+
+  NOTES
+    This is called on automaticly on init or reinit of IO_CACHE
+    It must be called externally if one moves or copies an IO_CACHE
+    object.
+*/
+
+void setup_io_cache(IO_CACHE* info)
+{
+  /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
+  if (info->type == WRITE_CACHE)
+  {
+    info->current_pos= &info->write_pos;
+    info->current_end= &info->write_end;
+  }
+  else
+  {
+    info->current_pos= &info->read_pos;
+    info->current_end= &info->read_end;
+  }
+}
+
+
 static void
-init_functions(IO_CACHE* info, enum cache_type type)
+init_functions(IO_CACHE* info)
 {
+  enum cache_type type= info->type;
   switch (type) {
   case READ_NET:
     /*
@@ -97,17 +128,7 @@
     info->write_function = _my_b_write;
   }
 
-  /* Ensure that my_b_tell() and my_b_bytes_in_cache works */
-  if (type == WRITE_CACHE)
-  {
-    info->current_pos= &info->write_pos;
-    info->current_end= &info->write_end;
-  }
-  else
-  {
-    info->current_pos= &info->read_pos;
-    info->current_end= &info->read_end;
-  }
+  setup_io_cache(info);
 }
 
 	/*
@@ -211,7 +232,7 @@
   /* End_of_file may be changed by user later */
   info->end_of_file= end_of_file;
   info->error=0;
-  init_functions(info,type);
+  init_functions(info);
 #ifdef HAVE_AIOWAIT
   if (use_async_io && ! my_disable_async_io)
   {
@@ -333,7 +354,7 @@
   }
   info->type=type;
   info->error=0;
-  init_functions(info,type);
+  init_functions(info);
 
 #ifdef HAVE_AIOWAIT
   if (use_async_io && ! my_disable_async_io &&

--- 1.57/sql/filesort.cc	2003-12-30 13:14:18 +02:00
+++ 1.58/sql/filesort.cc	2005-01-15 03:47:03 +02:00
@@ -680,6 +680,8 @@
     if (flush_io_cache(to_file))
       break;					/* purecov: inspected */
     temp=from_file; from_file=to_file; to_file=temp;
+    setup_io_cache(from_file);
+    setup_io_cache(to_file);
     *maxbuffer= (uint) (lastbuff-buffpek)-1;
   }
   close_cached_file(to_file);			// This holds old result
Thread
bk commit into 4.0 tree (monty:1.2031)monty15 Jan