List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 1 2009 5:40pm
Subject:bzr push into mysql-6.0-perf branch (marc.alff:2846 to 2847) Bug#44013
View as plain text  
 2847 Marc Alff	2009-04-01
      Bug#44013 dfile I/O size instrumentation missing for MyISAM
      
      The file instrumentation for MyISAM was incomplete, causing the performance
      schema to return incomplete results.
      
      Implemented the missing instrumented calls,
      added a test case to verify that file io on the key and data file is as
      expected.
added:
  mysql-test/suite/perfschema/r/myisam_file_io.result
  mysql-test/suite/perfschema/t/myisam_file_io.test
modified:
  storage/myisam/mi_cache.c
  storage/myisam/mi_check.c
  storage/myisam/mi_close.c
  storage/myisam/mi_create.c
  storage/myisam/mi_delete_all.c
  storage/myisam/mi_dynrec.c
  storage/myisam/mi_examine_log.c
  storage/myisam/mi_extra.c
  storage/myisam/mi_info.c
  storage/myisam/mi_locking.c
  storage/myisam/mi_log.c
  storage/myisam/mi_open.c
  storage/myisam/mi_packrec.c
  storage/myisam/mi_preload.c
  storage/myisam/mi_static.c
  storage/myisam/myisam_backup_engine.cc
  storage/myisam/myisamdef.h
  storage/myisam/sort.c

 2846 Marc Alff	2009-03-31
      Fixed the tests to have the same output for:
      - unix platforms (using UPPERCASE)
      - Mac OX and Windows platforms (printing the table names in lowercase).
      
      This is to work around the server behavior, which is not consistent.
modified:
  mysql-test/suite/perfschema/t/ddl_cond_instances.test
  mysql-test/suite/perfschema/t/ddl_file_instances.test
  mysql-test/suite/perfschema/t/ddl_mutex_instances.test
  mysql-test/suite/perfschema/t/ddl_performance_timers.test
  mysql-test/suite/perfschema/t/ddl_processlist.test
  mysql-test/suite/perfschema/t/ddl_rwlock_instances.test
  mysql-test/suite/perfschema/t/ddl_setup_consumers.test
  mysql-test/suite/perfschema/t/ddl_setup_instruments.test
  mysql-test/suite/perfschema/t/ddl_setup_objects.test
  mysql-test/suite/perfschema/t/ddl_setup_timers.test
  mysql-test/suite/perfschema/t/dml_setup_consumers.test
  mysql-test/suite/perfschema/t/dml_setup_instruments.test
  mysql-test/suite/perfschema/t/dml_setup_objects.test
  mysql-test/suite/perfschema/t/dml_setup_timers.test

=== added file 'mysql-test/suite/perfschema/r/myisam_file_io.result'
--- a/mysql-test/suite/perfschema/r/myisam_file_io.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/myisam_file_io.result	2009-04-01 17:39:57 +0000
@@ -0,0 +1,26 @@
+update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
+update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+  where name like "wait/io/file/myisam/%";
+truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+drop table if exists test.no_index_tab;
+create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+select event_name, source, operation, number_of_bytes, object_instance_begin
+from performance_schema.EVENTS_WAITS_HISTORY_LONG
+order by thread_id, event_id;
+event_name	source	operation	number_of_bytes	object_instance_begin
+wait/io/file/myisam/kfile	mi_open.c:150	open	NULL	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/kfile	mi_open.c:161	read	24	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/kfile	mi_open.c:212	seek	NULL	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/kfile	mi_open.c:222	read	297	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/dfile	mi_open.c:1374	open	NULL	./test/no_index_tab.MYD
+wait/io/file/myisam/kfile	mi_locking.c:556	write	3	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/dfile	mi_dynrec.c:236	write	20	./test/no_index_tab.MYD
+wait/io/file/myisam/kfile	mi_open.c:1007	write	124	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/dfile	mi_dynrec.c:236	write	20	./test/no_index_tab.MYD
+wait/io/file/myisam/kfile	mi_open.c:1007	write	124	DATADIR/test/no_index_tab.MYI
+wait/io/file/myisam/dfile	mi_dynrec.c:236	write	20	./test/no_index_tab.MYD
+wait/io/file/myisam/kfile	mi_open.c:1007	write	124	DATADIR/test/no_index_tab.MYI
+drop table test.no_index_tab;

=== added file 'mysql-test/suite/perfschema/t/myisam_file_io.test'
--- a/mysql-test/suite/perfschema/t/myisam_file_io.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/myisam_file_io.test	2009-04-01 17:39:57 +0000
@@ -0,0 +1,49 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+
+# Setup
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+update performance_schema.SETUP_INSTRUMENTS set enabled='NO';
+update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
+  where name like "wait/io/file/myisam/%";
+
+truncate table performance_schema.EVENTS_WAITS_HISTORY_LONG;
+
+# Code to test
+
+--disable_warnings
+drop table if exists test.no_index_tab;
+--enable_warnings
+
+create table test.no_index_tab ( a varchar(255), b int ) engine=myisam;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+insert into no_index_tab set a = 'foo', b = 1;
+
+# Verification
+
+--replace_result $MYSQLD_DATADIR DATADIR/
+select event_name, source, operation, number_of_bytes, object_instance_begin
+  from performance_schema.EVENTS_WAITS_HISTORY_LONG
+  order by thread_id, event_id;
+
+drop table test.no_index_tab;
+

=== modified file 'storage/myisam/mi_cache.c'
--- a/storage/myisam/mi_cache.c	2007-12-04 21:23:42 +0000
+++ b/storage/myisam/mi_cache.c	2009-04-01 17:39:57 +0000
@@ -29,7 +29,7 @@
   is set) - unread part is bzero'ed
 
   Note: out-of-cache reads are enabled for shared IO_CACHE's too,
-  as these reads will be cached by OS cache (and my_pread is always atomic)
+  as these reads will be cached by OS cache (and MYSQL_PREAD is always atomic)
 */
 
 
@@ -49,7 +49,7 @@ int _mi_read_cache(IO_CACHE *info, uchar
     if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
       read_length=(uint) (info->pos_in_file-pos);
     info->seek_not_done=1;
-    if (my_pread(info->file,buff,read_length,pos,MYF(MY_NABP)))
+    if (MYSQL_PREAD(info->file,buff,read_length,pos,MYF(MY_NABP)))
       DBUG_RETURN(1);
     if (!(length-=read_length))
       DBUG_RETURN(0);
@@ -88,7 +88,7 @@ int _mi_read_cache(IO_CACHE *info, uchar
   else
   {
     info->seek_not_done=1;
-    if ((read_length=my_pread(info->file,buff,length,pos,MYF(0))) == length)
+    if ((read_length=MYSQL_PREAD(info->file,buff,length,pos,MYF(0))) == length)
       DBUG_RETURN(0);
   }
   if (!(flag & READING_HEADER) || (int) read_length == -1 ||

=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c	2009-03-24 01:20:04 +0000
+++ b/storage/myisam/mi_check.c	2009-04-01 17:39:57 +0000
@@ -53,7 +53,7 @@
 #include "rt_index.h"
 
 #ifndef USE_RAID
-#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
+#define my_raid_create(K,A,B,C,D,E,F,G) MYSQL_CREATE(K,A,B,C,G)
 #define my_raid_delete(A,B,C) my_delete(A,B)
 #endif
 
@@ -174,7 +174,7 @@ int chk_del(HA_CHECK *param, register MI
 	printf(" %9s",llstr(next_link,buff));
       if (next_link >= info->state->data_file_length)
 	goto wrong;
-      if (my_pread(info->dfile, (uchar*) buff,delete_link_length,
+      if (MYSQL_PREAD(info->dfile, (uchar*) buff,delete_link_length,
 		   next_link,MYF(MY_NABP)))
       {
 	if (test_flag & T_VERBOSE) puts("");
@@ -337,7 +337,7 @@ int chk_size(HA_CHECK *param, register M
   flush_key_blocks(info->s->key_cache,
 		   info->s->kfile, FLUSH_FORCE_WRITE);
 
-  size= my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE));
+  size= MYSQL_SEEK(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE));
   if ((skr=(my_off_t) info->state->key_file_length) != size)
   {
     /* Don't give error if file generated by myisampack */
@@ -361,7 +361,7 @@ int chk_size(HA_CHECK *param, register M
 			   llstr(info->state->key_file_length,buff),
 			   llstr(info->s->base.max_key_file_length-1,buff));
 
-  size=my_seek(info->dfile,0L,MY_SEEK_END,MYF(0));
+  size= MYSQL_SEEK(info->dfile,0L,MY_SEEK_END,MYF(0));
   skr=(my_off_t) info->state->data_file_length;
   if (info->s->options & HA_OPTION_COMPRESS_RECORD)
     skr+= MEMMAP_EXTRA_MARGIN;
@@ -597,7 +597,7 @@ static int chk_index_down(HA_CHECK *para
   {
     /* purecov: begin tested */
     /* Give it a chance to fit in the real file size. */
-    my_off_t max_length= my_seek(info->s->kfile, 0L, MY_SEEK_END,
+    my_off_t max_length= MYSQL_SEEK(info->s->kfile, 0L, MY_SEEK_END,
                                  MYF(MY_THREADSAFE));
     mi_check_print_error(param, "Invalid key block position: %s  "
                          "key block size: %u  file_length: %s",
@@ -1577,7 +1577,8 @@ int mi_repair(HA_CHECK *param, register
   if (!rep_quick)
   {
     /* Get real path for data file */
-    if ((new_file=my_raid_create(fn_format(param->temp_filename,
+    if ((new_file=my_raid_create(mi_key_file_datatmp,
+                                 fn_format(param->temp_filename,
 					   share->data_file_name, "",
 					   DATA_TMP_EXT, 2+4),
 				 0,param->tmpfile_createflag,
@@ -1608,7 +1609,7 @@ int mi_repair(HA_CHECK *param, register
   sort_param.pos=sort_param.max_pos=share->pack.header_length;
   sort_param.filepos=new_header_length;
   param->read_cache.end_of_file=sort_info.filelength=
-    my_seek(info->dfile,0L,MY_SEEK_END,MYF(0));
+    MYSQL_SEEK(info->dfile,0L,MY_SEEK_END,MYF(0));
   sort_info.dupp=0;
   sort_param.fix_datafile= (my_bool) (! rep_quick);
   sort_param.master=1;
@@ -1700,7 +1701,7 @@ int mi_repair(HA_CHECK *param, register
 
   if (!rep_quick)
   {
-    my_close(info->dfile,MYF(0));
+    MYSQL_CLOSE(info->dfile,MYF(0));
     info->dfile=new_file;
     info->state->data_file_length=sort_param.filepos;
     share->state.version=(ulong) time((time_t*) 0);	/* Force reopen */
@@ -1733,7 +1734,7 @@ err:
     /* Replace the actual file with the temporary file */
     if (new_file >= 0)
     {
-      my_close(new_file,MYF(0));
+      MYSQL_CLOSE(new_file,MYF(0));
       info->dfile=new_file= -1;
       /*
         File change like this is not handled in physical log. filecopy() above
@@ -1755,7 +1756,7 @@ err:
 		  llstr(sort_param.start_recpos,llbuff));
     if (new_file >= 0)
     {
-      (void) my_close(new_file,MYF(0));
+      (void) MYSQL_CLOSE(new_file,MYF(0));
       (void) my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
 			  MYF(MY_WME));
       info->rec_cache.file=-1; /* don't flush data to new_file, it's closed */
@@ -1996,9 +1997,9 @@ int mi_sort_index(HA_CHECK *param, regis
 	/* Put same locks as old file */
   share->r_locks= share->w_locks= share->tot_locks= 0;
   (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
-  (void) my_close(share->kfile,MYF(MY_WME));
+  (void) MYSQL_CLOSE(share->kfile,MYF(MY_WME));
   share->kfile = -1;
-  (void) my_close(new_file,MYF(MY_WME));
+  (void) MYSQL_CLOSE(new_file,MYF(MY_WME));
   DBUG_ASSERT(!share->physical_logging);
   if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0,
 			MYF(0)) ||
@@ -2023,7 +2024,7 @@ int mi_sort_index(HA_CHECK *param, regis
   DBUG_RETURN(0);
 
 err:
-  (void) my_close(new_file,MYF(MY_WME));
+  (void) MYSQL_CLOSE(new_file,MYF(MY_WME));
 err2:
   (void) my_delete(param->temp_filename,MYF(MY_WME));
   DBUG_RETURN(-1);
@@ -2106,7 +2107,7 @@ static int sort_one_index(HA_CHECK *para
   length=mi_getint(buff);
   bzero((uchar*) buff+length,keyinfo->block_length-length);
   DBUG_ASSERT(!info->s->physical_logging);
-  if (my_pwrite(new_file,(uchar*) buff,(uint) keyinfo->block_length,
+  if (MYSQL_PWRITE(new_file,(uchar*) buff,(uint) keyinfo->block_length,
 		new_page_pos,MYF(MY_NABP | MY_WAIT_IF_FULL)))
   {
     mi_check_print_error(param,"Can't write indexblock, error: %d",my_errno);
@@ -2183,16 +2184,16 @@ int filecopy(HA_CHECK *param, File to,Fi
     buff=tmp_buff; buff_length=IO_SIZE;
   }
 
-  my_seek(from,start,MY_SEEK_SET,MYF(0));
+  MYSQL_SEEK(from,start,MY_SEEK_SET,MYF(0));
   while (length > buff_length)
   {
-    if (my_read(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
-	my_write(to,(uchar*) buff,buff_length,param->myf_rw))
+    if (MYSQL_READ(from,(uchar*) buff,buff_length,MYF(MY_NABP)) ||
+	MYSQL_WRITE(to,(uchar*) buff,buff_length,param->myf_rw))
       goto err;
     length-= buff_length;
   }
-  if (my_read(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
-      my_write(to,(uchar*) buff,(uint) length,param->myf_rw))
+  if (MYSQL_READ(from,(uchar*) buff,(uint) length,MYF(MY_NABP)) ||
+      MYSQL_WRITE(to,(uchar*) buff,(uint) length,param->myf_rw))
     goto err;
   if (buff != tmp_buff)
     my_free(buff,MYF(0));
@@ -2283,7 +2284,8 @@ int mi_repair_by_sort(HA_CHECK *param, r
   if (!rep_quick)
   {
     /* Get real path for data file */
-    if ((new_file=my_raid_create(fn_format(param->temp_filename,
+    if ((new_file=my_raid_create(mi_key_file_datatmp,
+                                 fn_format(param->temp_filename,
 					   share->data_file_name, "",
 					   DATA_TMP_EXT, 2+4),
 				 0,param->tmpfile_createflag,
@@ -2328,7 +2330,7 @@ int mi_repair_by_sort(HA_CHECK *param, r
   sort_info.dupp=0;
   sort_info.buff=0;
   param->read_cache.end_of_file=sort_info.filelength=
-    my_seek(param->read_cache.file,0L,MY_SEEK_END,MYF(0));
+    MYSQL_SEEK(param->read_cache.file,0L,MY_SEEK_END,MYF(0));
 
   sort_param.wordlist=NULL;
   init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0);
@@ -2478,7 +2480,7 @@ int mi_repair_by_sort(HA_CHECK *param, r
 	sort_param.filepos;
       /* Only whole records */
       share->state.version=(ulong) time((time_t*) 0);
-      my_close(info->dfile,MYF(0));
+      MYSQL_CLOSE(info->dfile,MYF(0));
       info->dfile=new_file;
       share->data_file_type=sort_info.new_data_file_type;
       share->pack.header_length=(ulong) new_header_length;
@@ -2520,7 +2522,7 @@ int mi_repair_by_sort(HA_CHECK *param, r
     if (skr != sort_info.filelength && !info->s->base.raid_type)
     {
       DBUG_ASSERT(!share->physical_logging);
-      if (my_chsize(info->dfile,skr,0,MYF(0)))
+      if (MYSQL_CHSIZE(info->dfile,skr,0,MYF(0)))
 	mi_check_print_warning(param,
 			       "Can't change size of datafile,  error: %d",
 			       my_errno);
@@ -2556,7 +2558,7 @@ err:
     /* Replace the actual file with the temporary file */
     if (new_file >= 0)
     {
-      my_close(new_file,MYF(0));
+      MYSQL_CLOSE(new_file,MYF(0));
       info->dfile=new_file= -1;
       DBUG_ASSERT(!share->physical_logging);
       if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
@@ -2573,7 +2575,7 @@ err:
       mi_check_print_error(param,"%d when fixing table",my_errno);
     if (new_file >= 0)
     {
-      (void) my_close(new_file,MYF(0));
+      (void) MYSQL_CLOSE(new_file,MYF(0));
       (void) my_raid_delete(param->temp_filename,share->base.raid_chunks,
 			  MYF(MY_WME));
       if (info->dfile == new_file)
@@ -2742,7 +2744,8 @@ int mi_repair_parallel(HA_CHECK *param,
   if (!rep_quick)
   {
     /* Get real path for data file */
-    if ((new_file=my_raid_create(fn_format(param->temp_filename,
+    if ((new_file=my_raid_create(mi_key_file_datatmp,
+                                 fn_format(param->temp_filename,
 					   share->data_file_name, "",
 					   DATA_TMP_EXT,
 					   2+4),
@@ -2787,7 +2790,7 @@ int mi_repair_parallel(HA_CHECK *param,
   sort_info.dupp=0;
   sort_info.buff=0;
   param->read_cache.end_of_file=sort_info.filelength=
-    my_seek(param->read_cache.file,0L,MY_SEEK_END,MYF(0));
+    MYSQL_SEEK(param->read_cache.file,0L,MY_SEEK_END,MYF(0));
 
   if (share->data_file_type == DYNAMIC_RECORD)
     rec_length=max(share->base.min_pack_length+1,share->base.min_block_length);
@@ -3016,7 +3019,7 @@ int mi_repair_parallel(HA_CHECK *param,
       Exchange the data file descriptor of the table, so that we use the
       new file from now on.
      */
-    my_close(info->dfile,MYF(0));
+    MYSQL_CLOSE(info->dfile,MYF(0));
     info->dfile=new_file;
 
     share->data_file_type=sort_info.new_data_file_type;
@@ -3047,7 +3050,7 @@ int mi_repair_parallel(HA_CHECK *param,
     if (skr != sort_info.filelength && !info->s->base.raid_type)
     {
       DBUG_ASSERT(!share->physical_logging);
-      if (my_chsize(info->dfile,skr,0,MYF(0)))
+      if (MYSQL_CHSIZE(info->dfile,skr,0,MYF(0)))
 	mi_check_print_warning(param,
 			       "Can't change size of datafile,  error: %d",
 			       my_errno);
@@ -3095,7 +3098,7 @@ err:
     /* Replace the actual file with the temporary file */
     if (new_file >= 0)
     {
-      my_close(new_file,MYF(0));
+      MYSQL_CLOSE(new_file,MYF(0));
       info->dfile=new_file= -1;
       DBUG_ASSERT(!share->physical_logging);
       if (change_to_newfile(share->data_file_name,MI_NAME_DEXT,
@@ -3112,7 +3115,7 @@ err:
       mi_check_print_error(param,"%d when fixing table",my_errno);
     if (new_file >= 0)
     {
-      (void) my_close(new_file,MYF(0));
+      (void) MYSQL_CLOSE(new_file,MYF(0));
       (void) my_raid_delete(param->temp_filename,share->base.raid_chunks,
 			  MYF(MY_WME));
       if (info->dfile == new_file)
@@ -4087,7 +4090,7 @@ static int sort_insert_key(MI_SORT_PARAM
   }
   else
   {
-    if (my_pwrite(info->s->kfile, anc_buff,
+    if (MYSQL_PWRITE(info->s->kfile, anc_buff,
                   keyinfo->block_length, filepos, param->myf_rw))
       DBUG_RETURN(1);
     if (unlikely(mi_log_index_pages_physical &&
@@ -4200,7 +4203,7 @@ int flush_pending_blocks(MI_SORT_PARAM *
     }
     else
     {
-      if (my_pwrite(info->s->kfile, key_block->buff,
+      if (MYSQL_PWRITE(info->s->kfile, key_block->buff,
                     keyinfo->block_length,filepos, myf_rw))
         DBUG_RETURN(1);
       if (unlikely(mi_log_index_pages_physical &&
@@ -4247,9 +4250,9 @@ int test_if_almost_full(MI_INFO *info)
 {
   if (info->s->options & HA_OPTION_COMPRESS_RECORD)
     return 0;
-  return my_seek(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)) / 10 * 9 >
+  return MYSQL_SEEK(info->s->kfile, 0L, MY_SEEK_END, MYF(MY_THREADSAFE)) / 10 * 9 >
          (my_off_t) info->s->base.max_key_file_length ||
-         my_seek(info->dfile, 0L, MY_SEEK_END, MYF(0)) / 10 * 9 >
+         MYSQL_SEEK(info->dfile, 0L, MY_SEEK_END, MYF(0)) / 10 * 9 >
          (my_off_t) info->s->base.max_data_file_length;
 }
 
@@ -4347,7 +4350,7 @@ int recreate_table(HA_CHECK *param, MI_I
   if (share.options & HA_OPTION_COMPRESS_RECORD)
     share.base.records=max_records=info.state->records;
   else if (share.base.min_pack_length)
-    max_records=(ha_rows) (my_seek(info.dfile,0L,MY_SEEK_END,MYF(0)) /
+    max_records=(ha_rows) (MYSQL_SEEK(info.dfile,0L,MY_SEEK_END,MYF(0)) /
 			   (ulong) share.base.min_pack_length);
   else
     max_records=0;
@@ -4355,7 +4358,7 @@ int recreate_table(HA_CHECK *param, MI_I
     (param->testflag & T_UNPACK);
   share.options&= ~HA_OPTION_TEMP_COMPRESS_RECORD;
 
-  file_length=(ulonglong) my_seek(info.dfile,0L,MY_SEEK_END,MYF(0));
+  file_length=(ulonglong) MYSQL_SEEK(info.dfile,0L,MY_SEEK_END,MYF(0));
   tmp_length= file_length+file_length/10;
   set_if_bigger(file_length,param->max_data_file_length);
   set_if_bigger(file_length,tmp_length);
@@ -4777,10 +4780,10 @@ set_data_file_type(MI_SORT_INFO *sort_in
   Changes the size of an index file, and logs the operation to the physical
   log if needed.
 
-  The only known case when my_chsize(kfile) can happen on a table doing
+  The only known case when MYSQL_CHSIZE(kfile) can happen on a table doing
   physical logging, is when the table was empty, bulk insert on it has been
   done, it's the end of bulk insert: we re-enable indices (mi_repair*()): thus
-  my_chsize() is in fact a void operation (file already has grown, starting
+  MYSQL_CHSIZE() is in fact a void operation (file already has grown, starting
   from empty, info->state->key_file_length is up-to-date and so file already
   has the requested size). We however log the operation, in case there are
   unknown cases.
@@ -4799,10 +4802,10 @@ static int chsize_kfile(MI_INFO *info)
   int ret;
 #ifndef DBUG_OFF
   my_bool no_length_change=
-    (my_seek(share->kfile, 0L, MY_SEEK_END, MYF(0)) == new_length);
+    (MYSQL_SEEK(share->kfile, 0L, MY_SEEK_END, MYF(0)) == new_length);
 #endif
 
-  ret= my_chsize(share->kfile, new_length, 0, MYF(0));
+  ret= MYSQL_CHSIZE(share->kfile, new_length, 0, MYF(0));
 
   if (unlikely(mi_log_index_pages_physical &&
                mi_get_physical_logging_state(share)))

=== modified file 'storage/myisam/mi_close.c'
--- a/storage/myisam/mi_close.c	2009-03-26 15:35:49 +0000
+++ b/storage/myisam/mi_close.c	2009-04-01 17:39:57 +0000
@@ -90,7 +90,7 @@ int mi_close(register MI_INFO *info)
       if (share->MI_LOG_OPEN_stored_in_physical_log)
         _myisam_log_command(&myisam_physical_log, MI_LOG_CLOSE, share,
                             NULL, 0, error);
-      if (my_close(share->kfile,MYF(0)))
+      if (MYSQL_CLOSE(share->kfile,MYF(0)))
         error = my_errno;
     }
 #ifdef HAVE_MMAP
@@ -126,7 +126,7 @@ int mi_close(register MI_INFO *info)
     my_free((uchar*)info->ftparser_param, MYF(0));
     info->ftparser_param= 0;
   }
-  if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
+  if (info->dfile >= 0 && MYSQL_CLOSE(info->dfile,MYF(0)))
     error = my_errno;
 
   myisam_log_command_logical(MI_LOG_CLOSE, info, NULL, 0, error);

=== modified file 'storage/myisam/mi_create.c'
--- a/storage/myisam/mi_create.c	2009-02-20 00:15:08 +0000
+++ b/storage/myisam/mi_create.c	2009-04-01 17:39:57 +0000
@@ -723,9 +723,9 @@ int mi_create(const char *name,uint keys
       mi_base_info_write(file, &share.base))
     goto err;
 #ifndef DBUG_OFF
-  if ((uint) my_tell(file,MYF(0)) != base_pos+ MI_BASE_INFO_SIZE)
+  if ((uint) MYSQL_TELL(file,MYF(0)) != base_pos+ MI_BASE_INFO_SIZE)
   {
-    uint pos=(uint) my_tell(file,MYF(0));
+    uint pos=(uint) MYSQL_TELL(file,MYF(0));
     DBUG_PRINT("warning",("base_length: %d  != used_length: %d",
 			  base_pos+ MI_BASE_INFO_SIZE, pos));
   }
@@ -820,9 +820,9 @@ int mi_create(const char *name,uint keys
       goto err;
 
 #ifndef DBUG_OFF
-  if ((uint) my_tell(file,MYF(0)) != info_length)
+  if ((uint) MYSQL_TELL(file,MYF(0)) != info_length)
   {
-    uint pos= (uint) my_tell(file,MYF(0));
+    uint pos= (uint) MYSQL_TELL(file,MYF(0));
     DBUG_PRINT("warning",("info_length: %d  != used_length: %d",
 			  info_length, pos));
   }
@@ -830,23 +830,23 @@ int mi_create(const char *name,uint keys
 
 	/* Enlarge files */
   DBUG_PRINT("info", ("enlarge to keystart: %lu", (ulong) share.base.keystart));
-  if (my_chsize(file,(ulong) share.base.keystart,0,MYF(0)))
+  if (MYSQL_CHSIZE(file,(ulong) share.base.keystart,0,MYF(0)))
     goto err;
 
   if (! (flags & HA_DONT_TOUCH_DATA))
   {
 #ifdef USE_RELOC
-    if (my_chsize(dfile,share.base.min_pack_length*ci->reloc_rows,0,MYF(0)))
+    if (MYSQL_CHSIZE(dfile,share.base.min_pack_length*ci->reloc_rows,0,MYF(0)))
       goto err;
 #endif
     errpos=2;
-    if (my_close(dfile,MYF(0)))
+    if (MYSQL_CLOSE(dfile,MYF(0)))
       goto err;
   }
   errpos=0;
   MYSQL_MUTEX_UNLOCK(&THR_LOCK_myisam);
   res= 0;
-  if (my_close(file,MYF(0)))
+  if (MYSQL_CLOSE(file,MYF(0)))
     res= my_errno;
 #ifdef THREAD
   my_atomic_rwlock_destroy(&share.physical_logging_rwlock);
@@ -865,7 +865,7 @@ err_no_lock:
   save_errno=my_errno;
   switch (errpos) {
   case 3:
-    (void) my_close(dfile,MYF(0));
+    (void) MYSQL_CLOSE(dfile,MYF(0));
     /* fall through */
   case 2:
     /* QQ: T�nu should add a call to my_raid_delete() here */
@@ -875,7 +875,7 @@ err_no_lock:
 			   MYF(0));
     /* fall through */
   case 1:
-    (void) my_close(file,MYF(0));
+    (void) MYSQL_CLOSE(file,MYF(0));
     if (! (flags & HA_DONT_TOUCH_DATA))
       my_delete_with_symlink(fn_format(filename,name,"",MI_NAME_IEXT,
                                        MY_UNPACK_FILENAME | MY_APPEND_EXT),

=== modified file 'storage/myisam/mi_delete_all.c'
--- a/storage/myisam/mi_delete_all.c	2008-07-09 07:12:43 +0000
+++ b/storage/myisam/mi_delete_all.c	2009-04-01 17:39:57 +0000
@@ -57,8 +57,8 @@ int mi_delete_all_rows(MI_INFO *info)
   if (share->file_map)
     _mi_unmap_file(info);
 #endif
-  if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
-      my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME))  )
+  if (MYSQL_CHSIZE(info->dfile, 0, 0, MYF(MY_WME)) ||
+      MYSQL_CHSIZE(share->kfile, share->base.keystart, 0, MYF(MY_WME))  )
     goto err;
   if (unlikely(mi_get_physical_logging_state(info->s)))
     _myisam_log_command(&myisam_physical_log, MI_LOG_DELETE_ALL, share,

=== modified file 'storage/myisam/mi_dynrec.c'
--- a/storage/myisam/mi_dynrec.c	2009-02-06 01:23:03 +0000
+++ b/storage/myisam/mi_dynrec.c	2009-04-01 17:39:57 +0000
@@ -160,17 +160,17 @@ size_t mi_mmap_pread(MI_INFO *info, ucha
   {
     if (info->s->concurrent_insert)
       MYSQL_RWLOCK_UNLOCK(&info->s->mmap_lock);
-    return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
+    return MYSQL_PREAD(info->dfile, Buffer, Count, offset, MyFlags);
   }
 }
 
 
-        /* wrapper for my_pread in case if mmap isn't used */
+        /* wrapper for MYSQL_PREAD in case if mmap isn't used */
 
 size_t mi_nommap_pread(MI_INFO *info, uchar *Buffer,
                        size_t Count, my_off_t offset, myf MyFlags)
 {
-  return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
+  return MYSQL_PREAD(info->dfile, Buffer, Count, offset, MyFlags);
 }
 
 
@@ -218,7 +218,7 @@ size_t mi_mmap_pwrite(MI_INFO *info, con
     share->nonmmaped_inserts++;
     if (share->concurrent_insert)
       MYSQL_RWLOCK_UNLOCK(&share->mmap_lock);
-    ret= my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
+    ret= MYSQL_PWRITE(info->dfile, Buffer, Count, offset, MyFlags);
   }
   if (unlikely(mi_get_physical_logging_state(share)))
     myisam_log_pwrite_physical(MI_LOG_WRITE_BYTES_MYD,
@@ -227,13 +227,13 @@ size_t mi_mmap_pwrite(MI_INFO *info, con
 }
 
 
-        /* wrapper for my_pwrite in case if mmap isn't used */
+        /* wrapper for MYSQL_PWRITE in case if mmap isn't used */
 
 size_t mi_nommap_pwrite(MI_INFO *info, const uchar *Buffer,
                       size_t Count, my_off_t offset, myf MyFlags)
 {
   MYISAM_SHARE *share= info->s;
-  uint ret= my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
+  uint ret= MYSQL_PWRITE(info->dfile, Buffer, Count, offset, MyFlags);
   if (unlikely(mi_get_physical_logging_state(share)))
     myisam_log_pwrite_physical(MI_LOG_WRITE_BYTES_MYD,
                                share, Buffer, Count, offset);
@@ -1651,7 +1651,7 @@ static int _mi_cmp_buffer(File file, con
 
   while (length > IO_SIZE*2)
   {
-    if (my_pread(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
+    if (MYSQL_PREAD(file,temp_buff,next_length,filepos, MYF(MY_NABP)) ||
 	memcmp(buff, temp_buff, next_length))
       goto err;
     filepos+=next_length;
@@ -1659,7 +1659,7 @@ static int _mi_cmp_buffer(File file, con
     length-= next_length;
     next_length=IO_SIZE*2;
   }
-  if (my_pread(file,temp_buff,length,filepos,MYF(MY_NABP)))
+  if (MYSQL_PREAD(file,temp_buff,length,filepos,MYF(MY_NABP)))
     goto err;
   DBUG_RETURN(memcmp(buff,temp_buff,length));
 err:
@@ -1841,8 +1841,8 @@ int _mi_read_rnd_dynamic_record(MI_INFO
             block_info.filepos + block_info.data_len &&
             flush_io_cache(&info->rec_cache))
           goto err;
-	/* my_seek(info->dfile,filepos,MY_SEEK_SET,MYF(0)); */
-	if (my_read(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP)))
+	/* MYSQL_SEEK(info->dfile,filepos,MY_SEEK_SET,MYF(0)); */
+	if (MYSQL_READ(info->dfile,(uchar*) to,block_info.data_len,MYF(MY_NABP)))
 	{
 	  if (my_errno == HA_ERR_FILE_TOO_SHORT)
 	    my_errno= HA_ERR_WRONG_IN_RECORD;	/* Unexpected end of file */
@@ -1890,12 +1890,12 @@ uint _mi_get_block_info(MI_BLOCK_INFO *i
   if (file >= 0)
   {
     /*
-      We do not use my_pread() here because we want to have the file
+      We do not use MYSQL_PREAD() here because we want to have the file
       pointer set to the end of the header after this function.
-      my_pread() may leave the file pointer untouched.
+      MYSQL_PREAD() may leave the file pointer untouched.
     */
-    my_seek(file,filepos,MY_SEEK_SET,MYF(0));
-    if (my_read(file, header, sizeof(info->header),MYF(0)) !=
+    MYSQL_SEEK(file,filepos,MY_SEEK_SET,MYF(0));
+    if (MYSQL_READ(file, header, sizeof(info->header),MYF(0)) !=
 	sizeof(info->header))
       goto err;
   }

=== modified file 'storage/myisam/mi_examine_log.c'
--- a/storage/myisam/mi_examine_log.c	2009-02-22 18:02:16 +0000
+++ b/storage/myisam/mi_examine_log.c	2009-04-01 17:39:57 +0000
@@ -167,7 +167,7 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
   struct test_if_open_param open_param;
   IO_CACHE cache;
   File log_file;
-  FILE *write_file;
+  MYSQL_FILE *write_file;
   enum ha_extra_function extra_command;
   TREE tree;
   struct file_info file_info,*curr_file_info;
@@ -192,14 +192,16 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
                        (MI_LOG_END_SENTINEL <= MI_LOG_BIG_NUMBERS) &&
                       (sizeof(mi_exl->com_count) /
                        sizeof(mi_exl->com_count[0]) == MI_LOG_END_SENTINEL));
-  if ((log_file=my_open(mi_exl->log_filename,O_RDONLY,MYF(MY_WME))) < 0)
+  if ((log_file= MYSQL_OPEN(mi_key_file_examinelog, mi_exl->log_filename,
+                            O_RDONLY, MYF(MY_WME))) < 0)
     DBUG_RETURN(1);
   write_file=0;
   if (mi_exl->write_filename)
   {
-    if (!(write_file=my_fopen(mi_exl->write_filename,O_WRONLY,MYF(MY_WME))))
+    if (!(write_file= MYSQL_FOPEN(mi_key_file_examinelog, mi_exl->write_filename,
+                                  O_WRONLY, MYF(MY_WME))))
     {
-      my_close(log_file,MYF(0));
+      MYSQL_CLOSE(log_file,MYF(0));
       DBUG_RETURN(1);
     }
   }
@@ -579,7 +581,7 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
            (curr_file_info && curr_file_info->used)))
       {
 	if (write_file &&
-	    (my_fwrite(write_file,buff,length,MYF(MY_WAIT_IF_FULL | MY_NABP))))
+	    (MYSQL_FWRITE(write_file,buff,length,MYF(MY_WAIT_IF_FULL | MY_NABP))))
 	  goto end;
 	if (mi_exl->verbose)
 	  printf_log(mi_exl->verbose, isamlog_process, isamlog_filepos,
@@ -676,7 +678,7 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
            (curr_file_info && curr_file_info->used)))
       {
         if (write_file &&
-            (my_fwrite(write_file, buff, length,
+            (MYSQL_FWRITE(write_file, buff, length,
                        MYF(MY_WAIT_IF_FULL | MY_NABP))))
           goto end;
         if (mi_exl->verbose)
@@ -689,7 +691,7 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
       if (mi_exl->update && curr_file_info && !curr_file_info->closed)
       {
         update_index_on_close= FALSE;
-        if (my_pwrite((command == MI_LOG_WRITE_BYTES_MYI) ?
+        if (MYSQL_PWRITE((command == MI_LOG_WRITE_BYTES_MYI) ?
                       curr_file_info->isam->s->kfile :
                       curr_file_info->isam->dfile,
                       buff,length,filepos,MYF(MY_NABP)))
@@ -721,7 +723,7 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
       if (mi_exl->update && curr_file_info && !curr_file_info->closed)
       {
         update_index_on_close= FALSE;
-        if (my_chsize(curr_file_info->isam->s->kfile, filepos,
+        if (MYSQL_CHSIZE(curr_file_info->isam->s->kfile, filepos,
                       0, MYF(MY_WME)))
           goto com_err;
       }
@@ -781,8 +783,8 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
   end_key_cache(dflt_key_cache,1);
   delete_tree(&tree);
   (void) end_io_cache(&cache);
-  (void) my_close(log_file,MYF(0));
-  if (write_file && my_fclose(write_file,MYF(MY_WME)))
+  (void) MYSQL_CLOSE(log_file,MYF(0));
+  if (write_file && MYSQL_FCLOSE(write_file,MYF(MY_WME)))
     DBUG_RETURN(1);
   DBUG_RETURN(0);
 
@@ -806,9 +808,9 @@ int mi_examine_log(MI_EXAMINE_LOG_PARAM
   end_key_cache(dflt_key_cache, 1);
   delete_tree(&tree);
   (void) end_io_cache(&cache);
-  (void) my_close(log_file,MYF(0));
+  (void) MYSQL_CLOSE(log_file,MYF(0));
   if (write_file)
-    (void) my_fclose(write_file,MYF(MY_WME));
+    (void) MYSQL_FCLOSE(write_file,MYF(MY_WME));
   my_free(file_info.name, MYF(MY_ALLOW_ZERO_PTR));
   my_free(file_info.show_name, MYF(MY_ALLOW_ZERO_PTR));
   my_free(file_info.record, MYF(MY_ALLOW_ZERO_PTR));

=== modified file 'storage/myisam/mi_extra.c'
--- a/storage/myisam/mi_extra.c	2009-03-24 22:49:23 +0000
+++ b/storage/myisam/mi_extra.c	2009-04-01 17:39:57 +0000
@@ -301,7 +301,7 @@ int mi_extra(MI_INFO *info, enum ha_extr
     }
     if (share->kfile >= 0)
       _mi_decrement_open_count(info);
-    if (share->kfile >= 0 && my_close(share->kfile,MYF(0)))
+    if (share->kfile >= 0 && MYSQL_CLOSE(share->kfile,MYF(0)))
       error=my_errno;
     {
       LIST *list_element ;
@@ -312,7 +312,7 @@ int mi_extra(MI_INFO *info, enum ha_extr
 	MI_INFO *tmpinfo=(MI_INFO*) list_element->data;
 	if (tmpinfo->s == info->s)
 	{
-	  if (tmpinfo->dfile >= 0 && my_close(tmpinfo->dfile,MYF(0)))
+	  if (tmpinfo->dfile >= 0 && MYSQL_CLOSE(tmpinfo->dfile,MYF(0)))
 	    error = my_errno;
 	  tmpinfo->dfile= -1;
 	}

=== modified file 'storage/myisam/mi_info.c'
--- a/storage/myisam/mi_info.c	2008-10-10 20:34:55 +0000
+++ b/storage/myisam/mi_info.c	2009-04-01 17:39:57 +0000
@@ -85,7 +85,7 @@ int mi_status(MI_INFO *info, register MI
     x->data_file_name   = share->data_file_name;
     x->index_file_name  = share->index_file_name;
   }
-  if ((flag & HA_STATUS_TIME) && !my_fstat(info->dfile,&state,MYF(0)))
+  if ((flag & HA_STATUS_TIME) && !MYSQL_FSTAT(info->dfile,&state,MYF(0)))
     x->update_time=state.st_mtime;
   else
     x->update_time=0;

=== modified file 'storage/myisam/mi_locking.c'
--- a/storage/myisam/mi_locking.c	2009-03-26 15:35:49 +0000
+++ b/storage/myisam/mi_locking.c	2009-04-01 17:39:57 +0000
@@ -551,7 +551,7 @@ int _mi_mark_file_changed(MI_INFO *info)
         Don't need to log it to physical log, as online backup does dirty
         copies anyway.
       */
-      DBUG_RETURN(my_pwrite(share->kfile,buff,sizeof(buff),
+      DBUG_RETURN(MYSQL_PWRITE(share->kfile,buff,sizeof(buff),
                             sizeof(share->state.header),
                             MYF(MY_NABP)));
     }
@@ -584,7 +584,7 @@ int _mi_decrement_open_count(MI_INFO *in
         Don't need to log it to physical log, as online backup does dirty
         copies anyway.
       */
-      write_error=my_pwrite(share->kfile,buff,sizeof(buff),
+      write_error= MYSQL_PWRITE(share->kfile,buff,sizeof(buff),
 			    sizeof(share->state.header),
 			    MYF(MY_NABP));
     }

=== modified file 'storage/myisam/mi_log.c'
--- a/storage/myisam/mi_log.c	2009-03-26 15:35:49 +0000
+++ b/storage/myisam/mi_log.c	2009-04-01 17:39:57 +0000
@@ -164,7 +164,7 @@ int mi_log(enum enum_mi_log_action actio
   another process may want to write to this log as soon as we unlock its
   file. Also, as this log is used for debugging it must contain as much
   information as possible in case of crash. For this log, using IO_CACHE
-  still makes sense as it decreases the number of my_write() calls.
+  still makes sense as it decreases the number of MYSQL_WRITE() calls.
 
   @param  type             physical or logical
   @param  log_filename     only for physical log (logical log has a static
@@ -222,17 +222,17 @@ static int mi_log_open_cache(enum enum_m
   {
     DBUG_ASSERT(log_filename);
     fn_format(buff, log_filename, "", "", MY_UNPACK_FILENAME);
-    if ((file= my_create(buff,
+    if ((file= MYSQL_CREATE(mi_key_file_log, buff,
                          0, access_flags,
                          MYF(MY_WME | ME_WAITTANG))) < 0)
       error= my_errno;
     else if (init_io_cache(log, file,
                            cache_size, WRITE_CACHE,
-                           my_tell(file,MYF(MY_WME)), 0,
+                           MYSQL_TELL(file,MYF(MY_WME)), 0,
                            MYF(MY_WME | MY_NABP)))
     {
       error= my_errno;
-      my_close(file, MYF(MY_WME));
+      MYSQL_CLOSE(file, MYF(MY_WME));
     }
   }
   MYSQL_MUTEX_UNLOCK(&THR_LOCK_myisam_log);
@@ -266,7 +266,7 @@ static int mi_log_close_cache(enum enum_
   if (my_b_inited(log))
   {
     if (end_io_cache(log) ||
-        my_close(log->file,MYF(MY_WME)))
+        MYSQL_CLOSE(log->file,MYF(MY_WME)))
       error= my_errno;
     log->file= -1;
   }
@@ -529,7 +529,7 @@ void _myisam_log_record_logical(enum myi
 /* THE FOLLOWING FUNCTIONS SERVE ONLY FOR PHYSICAL LOGGING */
 
 /**
-  Logs a my_pwrite() (done to data or index file) to the physical log.
+  Logs a MYSQL_PWRITE() (done to data or index file) to the physical log.
 
   Also logs MI_LOG_OPEN if first time. Thus, a MI_INFO will write MI_LOG_OPEN
   to the log only if it is doing a write to the table: a table which does
@@ -598,7 +598,7 @@ retry:
 
 
 /**
-  Logs a my_chsize() done to the index file to the physical log.
+  Logs a MYSQL_CHSIZE() done to the index file to the physical log.
 
   Also logs MI_LOG_OPEN if first time.
 
@@ -658,7 +658,7 @@ retry:
   terminated), any update done to a table-to-back-up must be present in the
   log. This guides the algorithm below.
 
-  All writes (my_write, my_pwrite, memcpy to mmap'ed area, my_chsize) to the
+  All writes (MYSQL_WRITE, MYSQL_PWRITE, memcpy to mmap'ed area, MYSQL_CHSIZE) to the
   data or index file are done this way:
   @code
   {
@@ -860,9 +860,9 @@ static int mi_log_stop_physical(enum enu
   } /* ... if (action == MI_LOG_ACTION_CLOSE_CONSISTENT) */
 
   /*
-    Online backup wants to pick this log with my_read() calls, to send it to
+    Online backup wants to pick this log with MYSQL_READ() calls, to send it to
     the backup stream. So we don't delete log but close it now, so that its
-    IO_CACHE goes to disk (so that all log is visible to the my_read()
+    IO_CACHE goes to disk (so that all log is visible to the MYSQL_READ()
     calls). Another reason related to concurrency is mentioned below.
   */
   if (mi_log_close_cache(MI_LOG_PHYSICAL))

=== modified file 'storage/myisam/mi_open.c'
--- a/storage/myisam/mi_open.c	2009-03-24 01:20:04 +0000
+++ b/storage/myisam/mi_open.c	2009-04-01 17:39:57 +0000
@@ -209,7 +209,7 @@ MI_INFO *mi_open(const char *name, int m
     end_pos=disk_cache+info_length;
     errpos=2;
 
-    my_seek(kfile,0L,MY_SEEK_SET,MYF(0));
+    MYSQL_SEEK(kfile,0L,MY_SEEK_SET,MYF(0));
     if (!(open_flags & HA_OPEN_TMP_TABLE))
     {
       if ((lock_error=my_lock(kfile,F_RDLCK,0L,F_TO_EOF,

=== modified file 'storage/myisam/mi_packrec.c'
--- a/storage/myisam/mi_packrec.c	2008-05-29 15:44:11 +0000
+++ b/storage/myisam/mi_packrec.c	2009-04-01 17:39:57 +0000
@@ -151,7 +151,7 @@ my_bool _mi_read_pack_info(MI_INFO *info
 
   file=info->dfile;
   my_errno=0;
-  if (my_read(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
+  if (MYSQL_READ(file,(uchar*) header,sizeof(header),MYF(MY_NABP)))
   {
     if (!my_errno)
       my_errno=HA_ERR_END_OF_FILE;
@@ -218,7 +218,7 @@ my_bool _mi_read_pack_info(MI_INFO *info
   tmp_buff=share->decode_tables+length;
   disk_cache= (uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
 
-  if (my_read(file,disk_cache,
+  if (MYSQL_READ(file,disk_cache,
 	      (uint) (share->pack.header_length-sizeof(header)),
 	      MYF(MY_NABP)))
     goto err2;
@@ -711,7 +711,7 @@ int _mi_read_pack_record(MI_INFO *info,
   if (_mi_pack_get_block_info(info, &info->bit_buff, &block_info,
                               &info->rec_buff, file, filepos))
     goto err;
-  if (my_read(file,(uchar*) info->rec_buff + block_info.offset ,
+  if (MYSQL_READ(file,(uchar*) info->rec_buff + block_info.offset ,
 	      block_info.rec_len - block_info.offset, MYF(MY_NABP)))
     goto panic;
   info->update|= HA_STATE_AKTIV;
@@ -1333,7 +1333,7 @@ int _mi_read_rnd_pack_record(MI_INFO *in
   }
   else
   {
-    if (my_read(info->dfile,(uchar*) info->rec_buff + block_info.offset,
+    if (MYSQL_READ(info->dfile,(uchar*) info->rec_buff + block_info.offset,
 		block_info.rec_len-block_info.offset,
 		MYF(MY_NABP)))
       goto err;
@@ -1364,11 +1364,11 @@ uint _mi_pack_get_block_info(MI_INFO *my
   {
     ref_length=myisam->s->pack.ref_length;
     /*
-      We can't use my_pread() here because mi_read_rnd_pack_record assumes
+      We can't use MYSQL_PREAD() here because mi_read_rnd_pack_record assumes
       position is ok
     */
-    my_seek(file,filepos,MY_SEEK_SET,MYF(0));
-    if (my_read(file, header,ref_length,MYF(MY_NABP)))
+    MYSQL_SEEK(file,filepos,MY_SEEK_SET,MYF(0));
+    if (MYSQL_READ(file, header,ref_length,MYF(MY_NABP)))
       return BLOCK_FATAL_ERROR;
     DBUG_DUMP("header",(uchar*) header,ref_length);
   }
@@ -1489,7 +1489,7 @@ my_bool _mi_memmap_file(MI_INFO *info)
 
   if (!info->s->file_map)
   {
-    if (my_seek(info->dfile,0L,MY_SEEK_END,MYF(0)) <
+    if (MYSQL_SEEK(info->dfile,0L,MY_SEEK_END,MYF(0)) <
         share->state.state.data_file_length+MEMMAP_EXTRA_MARGIN)
     {
       DBUG_PRINT("warning",("File isn't extended for memmap"));

=== modified file 'storage/myisam/mi_preload.c'
--- a/storage/myisam/mi_preload.c	2007-05-24 12:26:10 +0000
+++ b/storage/myisam/mi_preload.c	2009-04-01 17:39:57 +0000
@@ -81,7 +81,7 @@ int mi_preload(MI_INFO *info, ulonglong
     /* Read the next block of index file into the preload buffer */
     if ((my_off_t) length > (key_file_length-pos))
       length= (ulong) (key_file_length-pos);
-    if (my_pread(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
+    if (MYSQL_PREAD(share->kfile, (uchar*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
       goto err;
 
     if (ignore_leaves)

=== modified file 'storage/myisam/mi_static.c'
--- a/storage/myisam/mi_static.c	2009-03-27 20:06:50 +0000
+++ b/storage/myisam/mi_static.c	2009-04-01 17:39:57 +0000
@@ -137,6 +137,9 @@ static PSI_cond_info all_myisam_conds[]=
 PSI_file_key mi_key_file_backuplog;
 PSI_file_key mi_key_file_dfile;
 PSI_file_key mi_key_file_kfile;
+PSI_file_key mi_key_file_examinelog;
+PSI_file_key mi_key_file_datatmp;
+PSI_file_key mi_key_file_log;
 
 static PSI_file_info all_myisam_files[]=
 {
@@ -145,7 +148,13 @@ static PSI_file_info all_myisam_files[]=
   { & mi_key_file_dfile,
     "dfile", 0},
   { & mi_key_file_kfile,
-    "kfile", 0}
+    "kfile", 0},
+  { & mi_key_file_examinelog,
+    "examine_log", 0},
+  { & mi_key_file_datatmp,
+    "data_tmp", 0},
+  { & mi_key_file_log,
+    "log", 0}
 };
 
 PSI_thread_key mi_key_thread_backup;

=== modified file 'storage/myisam/myisam_backup_engine.cc'
--- a/storage/myisam/myisam_backup_engine.cc	2009-03-27 10:12:29 +0000
+++ b/storage/myisam/myisam_backup_engine.cc	2009-04-01 17:39:57 +0000
@@ -979,7 +979,7 @@ Log_backup::Log_backup(const char *log_n
                                                    log_deleted(FALSE)
 {
   DBUG_ENTER("myisam_backup::Log_backup::Log_backup");
-  int fd= MYSQL_OPEN(key_file_backuplog, log_name, O_RDONLY, MYF(MY_WME));
+  int fd= MYSQL_OPEN(mi_key_file_backuplog, log_name, O_RDONLY, MYF(MY_WME));
   if (fd < 0)
     SET_STATE_TO_ERROR_AND_DBUG_VOID_RETURN;
   /*
@@ -1009,7 +1009,7 @@ result_t Log_backup::end()
     anymore.
   */
   if (log_file_backup.close_file() != backup::OK ||
-      (!log_deleted && my_delete(log_name, MYF(MY_WME))))
+      (!log_deleted && MYSQL_DELETE(mi_key_file_backuplog, log_name, MYF(MY_WME))))
     SET_STATE_TO_ERROR_AND_DBUG_RETURN;
   log_deleted= TRUE;
   DBUG_RETURN(backup::OK);
@@ -1588,7 +1588,7 @@ result_t Restore::send_data(Buffer &buf)
 Log_restore::Log_restore(const char *log_name_arg) : log_name(log_name_arg)
 {
   DBUG_ENTER("myisam_backup::Log_restore::Log_restore");
-  int fd= MYSQL_CREATE(key_file_backuplog, log_name, 0, O_WRONLY, MYF(MY_WME));
+  int fd= MYSQL_CREATE(mi_key_file_backuplog, log_name, 0, O_WRONLY, MYF(MY_WME));
   if (fd < 0)
   {
     log_deleted= TRUE;
@@ -1658,7 +1658,7 @@ result_t Log_restore::end()
   DBUG_ENTER("myisam_backup::Log_restore::end");
   /* log is applied so we don't need it anymore */
   if (close() != backup::OK ||
-      (!log_deleted && my_delete(log_name, MYF(MY_WME))))
+      (!log_deleted && MYSQL_DELETE(mi_key_file_backuplog, log_name, MYF(MY_WME))))
     SET_STATE_TO_ERROR_AND_DBUG_RETURN;
   log_deleted= TRUE;
   DBUG_RETURN(backup::OK);

=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2009-03-27 10:12:29 +0000
+++ b/storage/myisam/myisamdef.h	2009-04-01 17:39:57 +0000
@@ -884,6 +884,9 @@ extern PSI_rwlock_key mi_key_rwlock_MYIS
 extern PSI_file_key mi_key_file_backuplog;
 extern PSI_file_key mi_key_file_dfile;
 extern PSI_file_key mi_key_file_kfile;
+extern PSI_file_key mi_key_file_examinelog;
+extern PSI_file_key mi_key_file_datatmp;
+extern PSI_file_key mi_key_file_log;
 
 extern PSI_thread_key mi_key_thread_backup;
 

=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c	2008-10-10 20:34:55 +0000
+++ b/storage/myisam/sort.c	2009-04-01 17:39:57 +0000
@@ -815,7 +815,7 @@ static uint NEAR_F read_to_buffer(IO_CAC
 
   if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
   {
-    if (my_pread(fromfile->file,(uchar*) buffpek->base,
+    if (MYSQL_PREAD(fromfile->file,(uchar*) buffpek->base,
                  (length= sort_length*count),buffpek->file_pos,MYF_RW))
       return((uint) -1);                        /* purecov: inspected */
     buffpek->key=buffpek->base;
@@ -840,11 +840,11 @@ static uint NEAR_F read_to_buffer_varlen
 
     for (idx=1;idx<=count;idx++)
     {
-      if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
+      if (MYSQL_PREAD(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
                    buffpek->file_pos,MYF_RW))
         return((uint) -1);
       buffpek->file_pos+=sizeof(length_of_key);
-      if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
+      if (MYSQL_PREAD(fromfile->file,(uchar*) buffp,length_of_key,
                    buffpek->file_pos,MYF_RW))
         return((uint) -1);
       buffpek->file_pos+=length_of_key;

Thread
bzr push into mysql-6.0-perf branch (marc.alff:2846 to 2847) Bug#44013Marc Alff1 Apr