← Back to team overview

percona-discussion team mailing list archive

lp:~d-launchpad-askneil-com/percona-patches/percona-fix-bug378834 into lp:percona-patches

 

Neil Katin has proposed merging lp:~d-launchpad-askneil-com/percona-patches/percona-fix-bug378834 into lp:percona-patches.

Requested reviews:
    Percona developers (percona-dev)

Fix for bug https://bugs.launchpad.net/percona-patches/+bug/378834

I took the simple way out and just changed the assertion, rather than making larger fixes to fully support double variables.

-- 
https://code.launchpad.net/~d-launchpad-askneil-com/percona-patches/percona-fix-bug378834/+merge/6723
Your team Percona developers is subscribed to branch lp:percona-patches.
=== modified file 'microslow_innodb.patch'
--- microslow_innodb.patch	2009-05-20 06:04:48 +0000
+++ microslow_innodb.patch	2009-05-21 03:16:13 +0000
@@ -1,7 +1,8 @@
-diff -r 04958490fc6d include/my_getopt.h
---- a/include/my_getopt.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/include/my_getopt.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -28,7 +28,8 @@
+Index: mysql-5.0.77/include/my_getopt.h
+===================================================================
+--- mysql-5.0.77.orig/include/my_getopt.h
++++ mysql-5.0.77/include/my_getopt.h
+@@ -28,7 +28,8 @@ C_MODE_START
  #define GET_ULL        8
  #define GET_STR        9
  #define GET_STR_ALLOC 10
@@ -11,10 +12,11 @@
  
  #define GET_ASK_ADDR	 128
  #define GET_TYPE_MASK	 127
-diff -r 04958490fc6d include/my_time.h
---- a/include/my_time.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/include/my_time.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -140,7 +140,7 @@
+Index: mysql-5.0.77/include/my_time.h
+===================================================================
+--- mysql-5.0.77.orig/include/my_time.h
++++ mysql-5.0.77/include/my_time.h
+@@ -140,7 +140,7 @@ int my_time_to_str(const MYSQL_TIME *l_t
  int my_date_to_str(const MYSQL_TIME *l_time, char *to);
  int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
  int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);
@@ -23,10 +25,11 @@
  C_MODE_END
  
  #endif /* _my_time_h_ */
-diff -r 04958490fc6d innobase/buf/buf0buf.c
---- a/innobase/buf/buf0buf.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/buf/buf0buf.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -37,6 +37,10 @@
+Index: mysql-5.0.77/innobase/buf/buf0buf.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/buf/buf0buf.c
++++ mysql-5.0.77/innobase/buf/buf0buf.c
+@@ -37,6 +37,10 @@ Created 11/5/1995 Heikki Tuuri
  #include "log0log.h"
  #include "trx0undo.h"
  #include "srv0srv.h"
@@ -37,7 +40,7 @@
  
  /*
  		IMPLEMENTATION OF THE BUFFER POOL
-@@ -1086,6 +1089,36 @@
+@@ -1086,6 +1090,36 @@ buf_page_reset_file_page_was_freed(
  	return(block);
  }
  
@@ -74,7 +77,7 @@
  /************************************************************************
  This is the general function used to get access to a database page. */
  
-@@ -1108,6 +1141,11 @@
+@@ -1108,6 +1142,11 @@ buf_page_get_gen(
  	ulint		fix_type;
  	ibool		success;
  	ibool		must_read;
@@ -86,7 +89,7 @@
  	
  	ut_ad(mtr);
  	ut_ad((rw_latch == RW_S_LATCH)
-@@ -1119,6 +1157,9 @@
+@@ -1119,6 +1158,9 @@ buf_page_get_gen(
  #ifndef UNIV_LOG_DEBUG
  	ut_ad(!ibuf_inside() || ibuf_page(space, offset));
  #endif
@@ -96,7 +99,7 @@
  	buf_pool->n_page_gets++;
  loop:
  	block = NULL;
-@@ -1148,7 +1189,7 @@
+@@ -1148,7 +1190,7 @@ loop:
  			return(NULL);
  		}
  
@@ -105,7 +108,7 @@
  
  #ifdef UNIV_DEBUG
  		buf_dbg_counter++;
-@@ -1261,6 +1302,11 @@
+@@ -1261,6 +1303,11 @@ loop:
  		        /* Let us wait until the read operation
  			completes */
  
@@ -117,20 +120,20 @@
  		        for (;;) {
  				mutex_enter(&block->mutex);
  
-@@ -1275,6 +1321,12 @@
- 
+@@ -1276,6 +1323,12 @@ loop:
  				       break;
  				}
-+			}
+ 			}
 +                	if (srv_slow_log && trx && trx->take_stats && start_time)
 +			{
 +				ut_usectime(&sec, &ms);
 +        	        	finish_time = (ib_longlong)sec * 1000000 + ms;
 +                		trx->io_reads_wait_timer += (ulint)(finish_time - start_time);
- 			}
++			}
  		}
  
-@@ -1296,12 +1348,17 @@
+ 		fix_type = MTR_MEMO_BUF_FIX;
+@@ -1296,12 +1349,17 @@ loop:
  		/* In the case of a first access, try to apply linear
  		read-ahead */
  
@@ -149,7 +152,7 @@
  	return(block->frame);		
  }
  
-@@ -1326,6 +1383,7 @@
+@@ -1326,6 +1384,7 @@ buf_page_optimistic_get_func(
  	ibool		accessed;
  	ibool		success;
  	ulint		fix_type;
@@ -157,7 +160,7 @@
  
  	ut_ad(mtr && block);
  	ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
-@@ -1440,13 +1498,18 @@
+@@ -1440,7 +1499,7 @@ buf_page_optimistic_get_func(
  		read-ahead */
  
  		buf_read_ahead_linear(buf_frame_get_space_id(guess),
@@ -166,18 +169,19 @@
  	}
  
  #ifdef UNIV_IBUF_DEBUG
- 	ut_a(ibuf_count_get(block->space, block->offset) == 0);
+@@ -1448,6 +1507,11 @@ buf_page_optimistic_get_func(
  #endif
  	buf_pool->n_page_gets++;
-+
+ 
 +	if (srv_slow_log) {
 +		trx = innobase_get_trx();
 +		_increment_page_get_statistics(block, trx);
 +	}
- 
++
  	return(TRUE);
  }
-@@ -1470,6 +1533,7 @@
+ 
+@@ -1470,6 +1534,7 @@ buf_page_get_known_nowait(
  	buf_block_t*	block;
  	ibool		success;
  	ulint		fix_type;
@@ -185,22 +189,23 @@
  
  	ut_ad(mtr);
  	ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
-@@ -1558,6 +1622,11 @@
- 		|| (ibuf_count_get(block->space, block->offset) == 0));
+@@ -1559,6 +1624,11 @@ buf_page_get_known_nowait(
  #endif
  	buf_pool->n_page_gets++;
-+
+ 
 +	if (srv_slow_log) {
 +		trx = innobase_get_trx();
 +		_increment_page_get_statistics(block, trx);
 +	}
- 
++
  	return(TRUE);
  }
-diff -r 04958490fc6d innobase/buf/buf0rea.c
---- a/innobase/buf/buf0rea.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/buf/buf0rea.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -70,7 +70,8 @@
+ 
+Index: mysql-5.0.77/innobase/buf/buf0rea.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/buf/buf0rea.c
++++ mysql-5.0.77/innobase/buf/buf0rea.c
+@@ -70,7 +70,8 @@ buf_read_page_low(
  			treat the tablespace as dropped; this is a timestamp we
  			use to stop dangling page reads from a tablespace
  			which we have DISCARDed + IMPORTed back */
@@ -210,7 +215,7 @@
  {
  	buf_block_t*	block;
  	ulint		wake_later;
-@@ -140,10 +141,10 @@
+@@ -140,10 +141,10 @@ buf_read_page_low(
  
  	ut_a(block->state == BUF_BLOCK_FILE_PAGE);
  
@@ -223,7 +228,7 @@
  	ut_a(*err == DB_SUCCESS);
  
  	if (sync) {
-@@ -174,8 +175,9 @@
+@@ -174,8 +175,9 @@ buf_read_ahead_random(
  			the page at the given page number does not get
  			read even if we return a value > 0! */
  	ulint	space,	/* in: space id */
@@ -234,7 +239,7 @@
  {
  	ib_longlong	tablespace_version;
  	buf_block_t*	block;
-@@ -270,7 +272,7 @@
+@@ -270,7 +272,7 @@ buf_read_ahead_random(
  		if (!ibuf_bitmap_page(i)) {
  			count += buf_read_page_low(&err, FALSE, ibuf_mode
  					| OS_AIO_SIMULATED_WAKE_LATER,
@@ -243,7 +248,7 @@
  			if (err == DB_TABLESPACE_DELETED) {
  				ut_print_timestamp(stderr);
  				fprintf(stderr,
-@@ -314,7 +316,8 @@
+@@ -314,7 +316,8 @@ buf_read_page(
  			/* out: number of page read requests issued: this can
  			be > 1 if read-ahead occurred */
  	ulint	space,	/* in: space id */
@@ -253,7 +258,7 @@
  {
  	ib_longlong	tablespace_version;
  	ulint		count;
-@@ -323,13 +326,13 @@
+@@ -323,13 +326,13 @@ buf_read_page(
  
  	tablespace_version = fil_space_get_version(space);
  
@@ -269,7 +274,7 @@
          srv_buf_pool_reads+= count2;
  	if (err == DB_TABLESPACE_DELETED) {
  	        ut_print_timestamp(stderr);
-@@ -374,8 +377,9 @@
+@@ -374,8 +377,9 @@ buf_read_ahead_linear(
  /*==================*/
  			/* out: number of page read requests issued */
  	ulint	space,	/* in: space id */
@@ -280,7 +285,7 @@
  {
  	ib_longlong	tablespace_version;
  	buf_block_t*	block;
-@@ -556,7 +560,7 @@
+@@ -556,7 +560,7 @@ buf_read_ahead_linear(
  		if (!ibuf_bitmap_page(i)) {
  			count += buf_read_page_low(&err, FALSE, ibuf_mode
  					| OS_AIO_SIMULATED_WAKE_LATER,
@@ -289,7 +294,7 @@
  			if (err == DB_TABLESPACE_DELETED) {
  				ut_print_timestamp(stderr);
  				fprintf(stderr,
-@@ -625,10 +629,10 @@
+@@ -625,10 +629,10 @@ buf_read_ibuf_merge_pages(
  	for (i = 0; i < n_stored; i++) {
  		if ((i + 1 == n_stored) && sync) {
  			buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
@@ -302,7 +307,7 @@
  		}
  
  		if (err == DB_TABLESPACE_DELETED) {
-@@ -704,11 +708,11 @@
+@@ -704,11 +708,11 @@ buf_read_recv_pages(
  
  		if ((i + 1 == n_stored) && sync) {
  			buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
@@ -316,10 +321,11 @@
  		}
  	}
  	
-diff -r 04958490fc6d innobase/fil/fil0fil.c
---- a/innobase/fil/fil0fil.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/fil/fil0fil.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -3527,7 +3527,7 @@
+Index: mysql-5.0.77/innobase/fil/fil0fil.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/fil/fil0fil.c
++++ mysql-5.0.77/innobase/fil/fil0fil.c
+@@ -3527,7 +3527,7 @@ fil_extend_space_to_desired_size(
  			node->name, node->handle, buf,
  			offset_low, offset_high,
  			UNIV_PAGE_SIZE * n_pages,
@@ -328,7 +334,7 @@
  #endif
  		if (success) {
  			node->size += n_pages;
-@@ -3851,7 +3851,7 @@
+@@ -3851,7 +3851,7 @@ fil_report_invalid_page_access(
  Reads or writes data. This operation is asynchronous (aio). */
  
  ulint
@@ -337,7 +343,7 @@
  /*===*/
  				/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
  				if we are trying to do i/o on a tablespace
-@@ -3877,8 +3877,9 @@
+@@ -3877,8 +3877,9 @@ fil_io(
  	void*	buf,		/* in/out: buffer where to store read data
  				or from where to write; in aio this must be
  				appropriately aligned */
@@ -348,7 +354,7 @@
  {
  	fil_system_t*	system		= fil_system;
  	ulint		mode;
-@@ -4018,7 +4019,7 @@
+@@ -4018,7 +4019,7 @@ fil_io(
  #else
  	/* Queue the aio request */
  	ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
@@ -357,10 +363,11 @@
  #endif
  	ut_a(ret);
  
-diff -r 04958490fc6d innobase/include/buf0rea.h
---- a/innobase/include/buf0rea.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/include/buf0rea.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -10,6 +10,7 @@
+Index: mysql-5.0.77/innobase/include/buf0rea.h
+===================================================================
+--- mysql-5.0.77.orig/innobase/include/buf0rea.h
++++ mysql-5.0.77/innobase/include/buf0rea.h
+@@ -10,6 +10,7 @@ Created 11/5/1995 Heikki Tuuri
  #define buf0rea_h
  
  #include "univ.i"
@@ -368,7 +375,7 @@
  #include "buf0types.h"
  
  /************************************************************************
-@@ -25,7 +26,8 @@
+@@ -25,7 +26,8 @@ buf_read_page(
  			/* out: number of page read requests issued: this can
  			be > 1 if read-ahead occurred */
  	ulint	space,	/* in: space id */
@@ -378,7 +385,7 @@
  /************************************************************************
  Applies linear read-ahead if in the buf_pool the page is a border page of
  a linear read-ahead area and all the pages in the area have been accessed.
-@@ -55,8 +57,9 @@
+@@ -55,8 +57,9 @@ buf_read_ahead_linear(
  /*==================*/
  			/* out: number of page read requests issued */
  	ulint	space,	/* in: space id */
@@ -389,10 +396,11 @@
  /************************************************************************
  Issues read requests for pages which the ibuf module wants to read in, in
  order to contract the insert buffer tree. Technically, this function is like
-diff -r 04958490fc6d innobase/include/fil0fil.h
---- a/innobase/include/fil0fil.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/include/fil0fil.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -534,8 +534,11 @@
+Index: mysql-5.0.77/innobase/include/fil0fil.h
+===================================================================
+--- mysql-5.0.77.orig/innobase/include/fil0fil.h
++++ mysql-5.0.77/innobase/include/fil0fil.h
+@@ -534,8 +534,11 @@ fil_space_get_n_reserved_extents(
  /************************************************************************
  Reads or writes data. This operation is asynchronous (aio). */
  
@@ -405,7 +413,7 @@
  /*===*/
  				/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
  				if we are trying to do i/o on a tablespace
-@@ -561,8 +564,9 @@
+@@ -561,8 +564,9 @@ fil_io(
  	void*	buf,		/* in/out: buffer where to store read data
  				or from where to write; in aio this must be
  				appropriately aligned */
@@ -416,19 +424,20 @@
  /************************************************************************
  Reads data from a space to a buffer. Remember that the possible incomplete
  blocks at the end of file are ignored: they are not taken into account when
-diff -r 04958490fc6d innobase/include/os0file.h
---- a/innobase/include/os0file.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/include/os0file.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -10,6 +10,8 @@
- #define os0file_h
+Index: mysql-5.0.77/innobase/include/os0file.h
+===================================================================
+--- mysql-5.0.77.orig/innobase/include/os0file.h
++++ mysql-5.0.77/innobase/include/os0file.h
+@@ -11,6 +11,8 @@ Created 10/21/1995 Heikki Tuuri
  
  #include "univ.i"
+ 
++#include "trx0types.h"
 +
-+#include "trx0types.h"
- 
  #ifndef __WIN__
  #include <dirent.h>
-@@ -421,8 +423,11 @@
+ #include <sys/stat.h>
+@@ -421,8 +423,11 @@ os_file_get_last_error(
  /***********************************************************************
  Requests a synchronous read operation. */
  
@@ -441,7 +450,7 @@
  /*=========*/
  				/* out: TRUE if request was
  				successful, FALSE if fail */
-@@ -432,7 +437,8 @@
+@@ -432,7 +437,8 @@ os_file_read(
  				offset where to read */
  	ulint		offset_high,/* in: most significant 32 bits of
  				offset */
@@ -451,7 +460,7 @@
  /***********************************************************************
  Rewind file to its start, read at most size - 1 bytes from it to str, and
  NUL-terminate str. All errors are silently ignored. This function is
-@@ -584,7 +590,8 @@
+@@ -584,7 +590,8 @@ os_aio(
  				can be used to identify a completed aio
  				operation); if mode is OS_AIO_SYNC, these
  				are ignored */
@@ -461,22 +470,24 @@
  /****************************************************************************
  Wakes up all async i/o threads so that they know to exit themselves in
  shutdown. */
-diff -r 04958490fc6d innobase/include/srv0srv.h
---- a/innobase/include/srv0srv.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/include/srv0srv.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -26,6 +26,8 @@
- at a time */
+Index: mysql-5.0.77/innobase/include/srv0srv.h
+===================================================================
+--- mysql-5.0.77.orig/innobase/include/srv0srv.h
++++ mysql-5.0.77/innobase/include/srv0srv.h
+@@ -27,6 +27,8 @@ at a time */
  #define SRV_AUTO_EXTEND_INCREMENT	\
  	(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
-+
+ 
 +extern ibool	srv_slow_log;
- 
++
  /* This is set to TRUE if the MySQL user has set it in MySQL */
  extern ibool	srv_lower_case_table_names;
-diff -r 04958490fc6d innobase/include/trx0trx.h
---- a/innobase/include/trx0trx.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/include/trx0trx.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -668,6 +668,17 @@
+ 
+Index: mysql-5.0.77/innobase/include/trx0trx.h
+===================================================================
+--- mysql-5.0.77.orig/innobase/include/trx0trx.h
++++ mysql-5.0.77/innobase/include/trx0trx.h
+@@ -668,6 +668,17 @@ struct trx_struct{
  	/*------------------------------*/
  	char detailed_error[256];	/* detailed error message for last
  					error, or empty. */
@@ -494,10 +505,11 @@
  };
  
  #define TRX_MAX_N_THREADS	32	/* maximum number of concurrent
-diff -r 04958490fc6d innobase/lock/lock0lock.c
---- a/innobase/lock/lock0lock.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/lock/lock0lock.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -1806,6 +1806,8 @@
+Index: mysql-5.0.77/innobase/lock/lock0lock.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/lock/lock0lock.c
++++ mysql-5.0.77/innobase/lock/lock0lock.c
+@@ -1806,6 +1806,8 @@ lock_rec_enqueue_waiting(
  {
  	lock_t*	lock;
  	trx_t*	trx;
@@ -506,7 +518,7 @@
  	
  #ifdef UNIV_SYNC_DEBUG
  	ut_ad(mutex_own(&kernel_mutex));
-@@ -1861,6 +1863,10 @@
+@@ -1861,6 +1863,10 @@ lock_rec_enqueue_waiting(
  	trx->que_state = TRX_QUE_LOCK_WAIT;
  	trx->was_chosen_as_deadlock_victim = FALSE;
  	trx->wait_started = time(NULL);
@@ -517,7 +529,7 @@
  
  	ut_a(que_thr_stop(thr));
  
-@@ -3514,7 +3520,9 @@
+@@ -3514,7 +3520,9 @@ lock_table_enqueue_waiting(
  {
  	lock_t*	lock;
  	trx_t*	trx;
@@ -528,7 +540,7 @@
  #ifdef UNIV_SYNC_DEBUG
  	ut_ad(mutex_own(&kernel_mutex));
  #endif /* UNIV_SYNC_DEBUG */
-@@ -3564,6 +3572,10 @@
+@@ -3564,6 +3572,10 @@ lock_table_enqueue_waiting(
  		return(DB_SUCCESS);
  	}
  	
@@ -539,10 +551,11 @@
  	trx->que_state = TRX_QUE_LOCK_WAIT;
  	trx->was_chosen_as_deadlock_victim = FALSE;
  	trx->wait_started = time(NULL);
-diff -r 04958490fc6d innobase/os/os0file.c
---- a/innobase/os/os0file.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/os/os0file.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -14,6 +14,8 @@
+Index: mysql-5.0.77/innobase/os/os0file.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/os/os0file.c
++++ mysql-5.0.77/innobase/os/os0file.c
+@@ -14,6 +14,8 @@ Created 10/21/1995 Heikki Tuuri
  #include "srv0start.h"
  #include "fil0fil.h"
  #include "buf0buf.h"
@@ -551,7 +564,7 @@
  
  #if defined(UNIV_HOTBACKUP) && defined(__WIN__)
  /* Add includes for the _stat() call to compile on Windows */
-@@ -1903,9 +1904,13 @@
+@@ -1903,9 +1905,13 @@ os_file_flush(
  #ifndef __WIN__
  /***********************************************************************
  Does a synchronous read operation in Posix. */
@@ -566,14 +579,13 @@
  /*==========*/
  				/* out: number of bytes read, -1 if error */
  	os_file_t	file,	/* in: handle to a file */
-@@ -1913,12 +1918,17 @@
+@@ -1913,12 +1919,17 @@ os_file_pread(
  	ulint		n,	/* in: number of bytes to read */	
  	ulint		offset,	/* in: least significant 32 bits of file
  				offset from where to read */
 -	ulint		offset_high) /* in: most significant 32 bits of
--				offset */
 +	ulint		offset_high, /* in: most significant 32 bits of
-+				offset */
+ 				offset */
 +        trx_t*		trx)
  {
          off_t	offs;
@@ -587,7 +599,7 @@
  	ut_a((offset & 0xFFFFFFFFUL) == offset);
          
          /* If off_t is > 4 bytes in size, then we assume we can pass a
-@@ -1937,7 +1947,13 @@
+@@ -1937,7 +1948,13 @@ os_file_pread(
          }
  
  	os_n_file_reads++;
@@ -602,7 +614,7 @@
  #if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
          os_mutex_enter(os_file_count_mutex);
  	os_file_n_pending_preads++;
-@@ -1951,6 +1967,13 @@
+@@ -1951,6 +1968,13 @@ os_file_pread(
  	os_n_pending_reads--;
          os_mutex_exit(os_file_count_mutex);
  
@@ -616,21 +628,21 @@
  	return(n_bytes);
  #else
  	{
-@@ -1980,6 +2003,13 @@
-         os_mutex_enter(os_file_count_mutex);
+@@ -1981,6 +2005,13 @@ os_file_pread(
  	os_n_pending_reads--;
          os_mutex_exit(os_file_count_mutex);
-+
+ 
 +        if (srv_slow_log && trx && trx->take_stats && start_time)
 +        {
 +		ut_usectime(&sec, &ms);
 +        	finish_time = (ib_longlong)sec * 1000000 + ms;
 +                trx->io_reads_wait_timer += (ulint)(finish_time - start_time);
 +	}
- 
++
  	return(ret);
  	}
-@@ -2103,7 +2133,7 @@
+ #endif
+@@ -2103,7 +2134,7 @@ func_exit:
  Requests a synchronous positioned read operation. */
  
  ibool
@@ -639,7 +651,7 @@
  /*=========*/
  				/* out: TRUE if request was
  				successful, FALSE if fail */
-@@ -2113,7 +2143,8 @@
+@@ -2113,7 +2144,8 @@ os_file_read(
  				offset where to read */
  	ulint		offset_high, /* in: most significant 32 bits of
  				offset */
@@ -649,7 +661,7 @@
  {
  #ifdef __WIN__
  	BOOL		ret;
-@@ -2177,7 +2208,7 @@
+@@ -2177,7 +2209,7 @@ try_again:	
  	os_bytes_read_since_printout += n;
  
  try_again:
@@ -658,7 +670,7 @@
  
  	if ((ulint)ret == n) {
  
-@@ -3137,7 +3168,8 @@
+@@ -3137,7 +3169,8 @@ os_aio_array_reserve_slot(
  				offset */
  	ulint		offset_high, /* in: most significant 32 bits of
  				offset */
@@ -668,7 +680,7 @@
  {
  	os_aio_slot_t*	slot;
  #ifdef WIN_ASYNC_IO
-@@ -3390,7 +3422,8 @@
+@@ -3390,7 +3423,8 @@ os_aio(
  				can be used to identify a completed aio
  				operation); if mode is OS_AIO_SYNC, these
  				are ignored */
@@ -678,7 +690,7 @@
  {
  	os_aio_array_t*	array;
  	os_aio_slot_t*	slot;
-@@ -3429,8 +3462,8 @@
+@@ -3429,8 +3463,8 @@ os_aio(
  		wait in the Windows case. */
  
  		if (type == OS_FILE_READ) {
@@ -689,7 +701,7 @@
  		}
  
  		ut_a(type == OS_FILE_WRITE);
-@@ -3463,8 +3496,13 @@
+@@ -3463,8 +3497,13 @@ try_again:
  		ut_error;
  	}
  	
@@ -704,19 +716,20 @@
  	if (type == OS_FILE_READ) {
  		if (os_aio_use_native_aio) {
  #ifdef WIN_ASYNC_IO
-diff -r 04958490fc6d innobase/srv/srv0srv.c
---- a/innobase/srv/srv0srv.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/srv/srv0srv.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -47,6 +47,8 @@
- #include "dict0boot.h"
+Index: mysql-5.0.77/innobase/srv/srv0srv.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/srv/srv0srv.c
++++ mysql-5.0.77/innobase/srv/srv0srv.c
+@@ -48,6 +48,8 @@ Created 10/8/1995 Heikki Tuuri
  #include "srv0start.h"
  #include "row0mysql.h"
-+
+ 
 +ibool	srv_slow_log = 0;
- 
++
  /* This is set to TRUE if the MySQL user has set it in MySQL; currently
  affects only FOREIGN KEY definition parsing */
-@@ -996,6 +998,10 @@
+ ibool	srv_lower_case_table_names	= FALSE;
+@@ -996,6 +998,10 @@ srv_conc_enter_innodb(
  	ibool			has_slept = FALSE;
  	srv_conc_slot_t*	slot	  = NULL;
  	ulint			i;
@@ -727,7 +740,7 @@
  
  	/* If trx has 'free tickets' to enter the engine left, then use one
  	such ticket */
-@@ -1054,6 +1060,7 @@
+@@ -1054,6 +1060,7 @@ retry:
      if (SRV_THREAD_SLEEP_DELAY > 0)
      {
        os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
@@ -735,7 +748,7 @@
      }
  
  		trx->op_info = "";
-@@ -1109,11 +1116,22 @@
+@@ -1109,12 +1116,23 @@ retry:
  	/* Go to wait for the event; when a thread leaves InnoDB it will
  	release this thread */
  
@@ -749,19 +762,21 @@
  	os_event_wait(slot->event);
  
  	trx->op_info = "";
-+
+ 
 +	if (srv_slow_log && trx->take_stats && start_time) {
 +		ut_usectime(&sec, &ms);
 +		finish_time = (ib_longlong)sec * 1000000 + ms;
 +		trx->innodb_que_wait_timer += (ulint)(finish_time - start_time);
 +	}
- 
++
  	os_fast_mutex_lock(&srv_conc_mutex);
  
-diff -r 04958490fc6d innobase/trx/trx0trx.c
---- a/innobase/trx/trx0trx.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/innobase/trx/trx0trx.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -190,6 +190,15 @@
+ 	srv_conc_n_waiting_threads--;
+Index: mysql-5.0.77/innobase/trx/trx0trx.c
+===================================================================
+--- mysql-5.0.77.orig/innobase/trx/trx0trx.c
++++ mysql-5.0.77/innobase/trx/trx0trx.c
+@@ -190,6 +190,15 @@ trx_create(
  	trx->global_read_view_heap = mem_heap_create(256);
  	trx->global_read_view = NULL;
  	trx->read_view = NULL;
@@ -777,7 +792,7 @@
  
  	/* Set X/Open XA transaction identification to NULL */
  	memset(&trx->xid, 0, sizeof(trx->xid));
-@@ -230,6 +239,11 @@
+@@ -230,6 +239,11 @@ trx_allocate_for_mysql(void)
  
  	trx->mysql_process_no = os_proc_get_number();
  	
@@ -789,7 +804,7 @@
  	return(trx);
  }
  
-@@ -366,6 +380,12 @@
+@@ -366,6 +380,12 @@ trx_free_for_mysql(
  /*===============*/
  	trx_t*	trx)	/* in, own: trx object */
  {
@@ -802,7 +817,7 @@
  	thr_local_free(trx->mysql_thread_id);
  
  	mutex_enter(&kernel_mutex);
-@@ -389,6 +409,12 @@
+@@ -389,6 +409,12 @@ trx_free_for_background(
  /*====================*/
  	trx_t*	trx)	/* in, own: trx object */
  {
@@ -815,7 +830,7 @@
  	mutex_enter(&kernel_mutex);
  	
  	trx_free(trx);
-@@ -1064,7 +1090,10 @@
+@@ -1064,7 +1090,10 @@ trx_end_lock_wait(
  	trx_t*	trx)	/* in: transaction */
  {
  	que_thr_t*	thr;
@@ -827,7 +842,7 @@
  #ifdef UNIV_SYNC_DEBUG
  	ut_ad(mutex_own(&kernel_mutex));
  #endif /* UNIV_SYNC_DEBUG */
-@@ -1080,6 +1109,11 @@
+@@ -1080,6 +1109,11 @@ trx_end_lock_wait(
  		thr = UT_LIST_GET_FIRST(trx->wait_thrs);
  	}
  
@@ -839,7 +854,7 @@
  	trx->que_state = TRX_QUE_RUNNING;
  }
  
-@@ -1093,6 +1127,9 @@
+@@ -1093,6 +1127,9 @@ trx_lock_wait_to_suspended(
  	trx_t*	trx)	/* in: transaction in the TRX_QUE_LOCK_WAIT state */
  {
  	que_thr_t*	thr;
@@ -849,7 +864,7 @@
  
  #ifdef UNIV_SYNC_DEBUG
  	ut_ad(mutex_own(&kernel_mutex));
-@@ -1109,6 +1146,11 @@
+@@ -1109,6 +1146,11 @@ trx_lock_wait_to_suspended(
  		thr = UT_LIST_GET_FIRST(trx->wait_thrs);
  	}
  
@@ -861,10 +876,21 @@
  	trx->que_state = TRX_QUE_RUNNING;
  }
  
-diff -r 04958490fc6d mysys/my_getopt.c
---- a/mysys/my_getopt.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/mysys/my_getopt.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -1061,6 +1061,9 @@
+Index: mysql-5.0.77/mysys/my_getopt.c
+===================================================================
+--- mysql-5.0.77.orig/mysys/my_getopt.c
++++ mysql-5.0.77/mysys/my_getopt.c
+@@ -827,7 +827,8 @@ ulonglong getopt_ull_limit_value(ulonglo
+ #endif
+     break;
+   default:
+-    DBUG_ASSERT((optp->var_type & GET_TYPE_MASK) == GET_ULL);
++    DBUG_ASSERT(((optp->var_type & GET_TYPE_MASK) == GET_ULL) ||
++	((optp->var_type & GET_TYPE_MASK) == GET_DOUBLE));
+     break;
+   }
+ 
+@@ -1061,6 +1062,9 @@ void my_print_variables(const struct my_
        case GET_ULONG:
  	printf("%lu\n", *((ulong*) value));
  	break;
@@ -874,9 +900,10 @@
        case GET_LL:
  	printf("%s\n", llstr(*((longlong*) value), buff));
  	break;
-diff -r 04958490fc6d patch_info/microslow_innodb.info
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/patch_info/microslow_innodb.info	Tue Feb 17 22:33:00 2009 -0800
+Index: mysql-5.0.77/patch_info/microslow_innodb.info
+===================================================================
+--- /dev/null
++++ mysql-5.0.77/patch_info/microslow_innodb.info
 @@ -0,0 +1,15 @@
 +File=microslow_innodb.patch
 +Name=Extended statistics in slow.log
@@ -893,10 +920,11 @@
 +
 +2008-11
 +Arjen Lentz: Fixups (backward compatibility) by Arjen Lentz <arjen@xxxxxxxxxxxxxxxx>
-diff -r 04958490fc6d scripts/mysqldumpslow.sh
---- a/scripts/mysqldumpslow.sh	Tue Feb 17 22:32:27 2009 -0800
-+++ b/scripts/mysqldumpslow.sh	Tue Feb 17 22:33:00 2009 -0800
-@@ -83,8 +83,8 @@
+Index: mysql-5.0.77/scripts/mysqldumpslow.sh
+===================================================================
+--- mysql-5.0.77.orig/scripts/mysqldumpslow.sh
++++ mysql-5.0.77/scripts/mysqldumpslow.sh
+@@ -83,8 +83,8 @@ while ( defined($_ = shift @pending) or 
      s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
      my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
  
@@ -907,10 +935,11 @@
      $t -= $l unless $opt{l};
  
      # remove fluff that mysqld writes to log when it (re)starts:
-diff -r 04958490fc6d sql-common/my_time.c
---- a/sql-common/my_time.c	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql-common/my_time.c	Tue Feb 17 22:33:00 2009 -0800
-@@ -1252,3 +1252,37 @@
+Index: mysql-5.0.77/sql-common/my_time.c
+===================================================================
+--- mysql-5.0.77.orig/sql-common/my_time.c
++++ mysql-5.0.77/sql-common/my_time.c
+@@ -1252,3 +1252,37 @@ ulonglong TIME_to_ulonglong(const MYSQL_
    return 0;
  }
  
@@ -948,10 +977,11 @@
 +    *ltime= newtime;
 +  return newtime;
 +}
-diff -r 04958490fc6d sql/filesort.cc
---- a/sql/filesort.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/filesort.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -180,6 +180,7 @@
+Index: mysql-5.0.77/sql/filesort.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/filesort.cc
++++ mysql-5.0.77/sql/filesort.cc
+@@ -180,6 +180,7 @@ ha_rows filesort(THD *thd, TABLE *table,
    {
      statistic_increment(thd->status_var.filesort_scan_count, &LOCK_status);
    }
@@ -959,7 +989,7 @@
  #ifdef CAN_TRUST_RANGE
    if (select && select->quick && select->quick->records > 0L)
    {
-@@ -245,6 +246,7 @@
+@@ -245,6 +246,7 @@ ha_rows filesort(THD *thd, TABLE *table,
    }
    else
    {
@@ -967,7 +997,7 @@
      if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
      {
        x_free(table_sort.buffpek);
-@@ -1116,6 +1118,7 @@
+@@ -1116,6 +1118,7 @@ int merge_buffers(SORTPARAM *param, IO_C
  
    statistic_increment(current_thd->status_var.filesort_merge_passes,
  		      &LOCK_status);
@@ -975,15 +1005,16 @@
    if (param->not_killable)
    {
      killed= &not_killable;
-diff -r 04958490fc6d sql/ha_innodb.cc
---- a/sql/ha_innodb.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/ha_innodb.cc	Tue Feb 17 22:33:00 2009 -0800
+Index: mysql-5.0.77/sql/ha_innodb.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/ha_innodb.cc
++++ mysql-5.0.77/sql/ha_innodb.cc
 @@ -1,3 +1,4 @@
 +
  /* Copyright (C) 2000-2005 MySQL AB & Innobase Oy
  
     This program is free software; you can redistribute it and/or modify
-@@ -805,9 +806,34 @@
+@@ -805,9 +806,34 @@ check_trx_exists(
  		trx->check_unique_secondary = TRUE;
  	}
  
@@ -1018,16 +1049,16 @@
  
  /*************************************************************************
  Construct ha_innobase handler. */
-@@ -1309,6 +1335,8 @@
- 	}
+@@ -1310,6 +1336,8 @@ innobase_init(void)
  
  	/* -------------- Log files ---------------------------*/
+ 
++	srv_slow_log = (ibool) opt_slow_log;
 +
-+	srv_slow_log = (ibool) opt_slow_log;
- 
  	/* The default dir for log files is the datadir of MySQL */
  
-@@ -4681,6 +4709,12 @@
+ 	if (!innobase_log_group_home_dir) {
+@@ -4681,6 +4709,12 @@ ha_innobase::create(
  		trx->check_unique_secondary = FALSE;
  	}
  
@@ -1040,7 +1071,7 @@
  	if (lower_case_table_names) {
  		srv_lower_case_table_names = TRUE;
  	} else {
-@@ -4946,6 +4980,12 @@
+@@ -4946,6 +4980,12 @@ ha_innobase::delete_table(
  		trx->check_unique_secondary = FALSE;
  	}
  
@@ -1053,7 +1084,7 @@
  	name_len = strlen(name);
  
  	assert(name_len < 1000);
-@@ -5033,6 +5073,12 @@
+@@ -5033,6 +5073,12 @@ innobase_drop_database(
  		trx->check_foreigns = FALSE;
  	}
  
@@ -1066,20 +1097,20 @@
    	error = row_drop_database_for_mysql(namebuf, trx);
  	my_free(namebuf, MYF(0));
  
-@@ -5097,6 +5143,12 @@
- 
- 	if (current_thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
+@@ -5099,6 +5145,12 @@ ha_innobase::rename_table(
  		trx->check_foreigns = FALSE;
-+	}
-+
+ 	}
+ 
 +	if (current_thd->variables.log_slow_verbosity & SLOG_V_INNODB) {
 +		trx->take_stats = TRUE;
 +	} else {
 +		trx->take_stats = FALSE;
- 	}
- 
++	}
++
  	name_len1 = strlen(from);
-@@ -6106,6 +6158,7 @@
+ 	name_len2 = strlen(to);
+ 
+@@ -6106,6 +6158,7 @@ ha_innobase::external_lock(
  {
  	row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
  	trx_t*		trx;
@@ -1087,7 +1118,7 @@
  
    	DBUG_ENTER("ha_innobase::external_lock");
  	DBUG_PRINT("enter",("lock_type: %d", lock_type));
-@@ -6229,7 +6282,24 @@
+@@ -6229,7 +6282,24 @@ ha_innobase::external_lock(
  
  	if (trx->n_mysql_tables_in_use == 0) {
  
@@ -1113,10 +1144,11 @@
  		prebuilt->used_in_HANDLER = FALSE;
  
  		if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
-diff -r 04958490fc6d sql/ha_innodb.h
---- a/sql/ha_innodb.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/ha_innodb.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -266,6 +266,8 @@
+Index: mysql-5.0.77/sql/ha_innodb.h
+===================================================================
+--- mysql-5.0.77.orig/sql/ha_innodb.h
++++ mysql-5.0.77/sql/ha_innodb.h
+@@ -266,6 +266,8 @@ void innobase_store_binlog_offset_and_fl
  
  int innobase_start_trx_and_assign_read_view(THD* thd);
  
@@ -1125,10 +1157,11 @@
  /***********************************************************************
  This function is used to prepare X/Open XA distributed transaction   */
  
-diff -r 04958490fc6d sql/log.cc
---- a/sql/log.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/log.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -2284,11 +2284,12 @@
+Index: mysql-5.0.77/sql/log.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/log.cc
++++ mysql-5.0.77/sql/log.cc
+@@ -2284,11 +2284,12 @@ err:
  */
  
  bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
@@ -1143,7 +1176,7 @@
      return 0;
    DBUG_ENTER("MYSQL_LOG::write");
  
-@@ -2298,7 +2299,8 @@
+@@ -2298,7 +2299,8 @@ bool MYSQL_LOG::write(THD *thd,const cha
      int tmp_errno=0;
      char buff[80],*end;
      end=buff;
@@ -1153,7 +1186,7 @@
      {
        VOID(pthread_mutex_unlock(&LOCK_log));
        DBUG_RETURN(0);
-@@ -2328,22 +2330,72 @@
+@@ -2328,22 +2330,72 @@ bool MYSQL_LOG::write(THD *thd,const cha
        if (my_b_printf(&log_file, "# User@Host: %s[%s] @ %s [%s]\n",
                        sctx->priv_user ?
                        sctx->priv_user : "",
@@ -1232,10 +1265,11 @@
      }
      if (thd->db && strcmp(thd->db,db))
      {						// Database changed
-diff -r 04958490fc6d sql/log_event.cc
---- a/sql/log_event.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/log_event.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -2039,6 +2039,7 @@
+Index: mysql-5.0.77/sql/log_event.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/log_event.cc
++++ mysql-5.0.77/sql/log_event.cc
+@@ -2039,6 +2039,7 @@ int Query_log_event::exec_event(struct s
        /* Execute the query (note that we bypass dispatch_command()) */
        const char* found_semicolon= NULL;
        mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
@@ -1243,14 +1277,14 @@
  
      }
      else
-diff -r 04958490fc6d sql/mysql_priv.h
---- a/sql/mysql_priv.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/mysql_priv.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -494,6 +494,78 @@
- #define WEEK_FIRST_WEEKDAY   4
+Index: mysql-5.0.77/sql/mysql_priv.h
+===================================================================
+--- mysql-5.0.77.orig/sql/mysql_priv.h
++++ mysql-5.0.77/sql/mysql_priv.h
+@@ -495,6 +495,78 @@ void view_store_options(THD *thd, TABLE_
  
  #define STRING_BUFFER_USUAL_SIZE 80
-+
+ 
 +/* Slow log */
 +
 +struct msl_opts
@@ -1322,10 +1356,11 @@
 +  { SLOG_F_FILESORT_DISK, "filesort_on_disk" },
 +  { SLOG_F_INVALID,       (char *)0 }
 +};
- 
++
  enum enum_parsing_place
  {
-@@ -1351,6 +1423,7 @@
+   NO_MATTER,
+@@ -1351,6 +1423,7 @@ extern bool opt_using_transactions, mysq
  extern bool using_update_log, opt_large_files, server_id_supplied;
  extern bool opt_update_log, opt_bin_log, opt_error_log;
  extern my_bool opt_log, opt_slow_log, opt_log_queries_not_using_indexes;
@@ -1333,7 +1368,7 @@
  extern bool opt_disable_networking, opt_skip_show_db;
  extern my_bool opt_character_set_client_handshake;
  extern bool volatile abort_loop, shutdown_in_progress, grant_option;
-@@ -1362,7 +1435,8 @@
+@@ -1362,7 +1435,8 @@ extern my_bool opt_readonly, lower_case_
  extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
  extern my_bool opt_secure_auth;
  extern char* opt_secure_file_priv;
@@ -1343,18 +1378,19 @@
  extern my_bool sp_automatic_privileges, opt_noacl;
  extern my_bool opt_old_style_user_limits, trust_function_creators;
  extern uint opt_crash_binlog_innodb;
-diff -r 04958490fc6d sql/mysqld.cc
---- a/sql/mysqld.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/mysqld.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -175,7 +175,6 @@
- static void getvolumename();
+Index: mysql-5.0.77/sql/mysqld.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/mysqld.cc
++++ mysql-5.0.77/sql/mysqld.cc
+@@ -176,7 +176,6 @@ static void getvolumename();
  static void getvolumeID(BYTE *volumeName);
  #endif /* __NETWARE__ */
+ 
 -
- 
  #ifdef _AIX41
  int initgroups(const char *,unsigned int);
-@@ -409,10 +408,13 @@
+ #endif
+@@ -409,10 +408,13 @@ my_bool opt_sync_frm, opt_allow_suspicio
  my_bool opt_secure_auth= 0;
  char* opt_secure_file_priv= 0;
  my_bool opt_log_slow_admin_statements= 0;
@@ -1368,7 +1404,7 @@
  /*
    True if there is at least one per-hour limit for some user, so we should
    check them before each query (and possibly reset counters when hour is
-@@ -507,6 +509,7 @@
+@@ -507,6 +509,7 @@ Lt_creator lt_creator;
  Ge_creator ge_creator;
  Le_creator le_creator;
  
@@ -1376,7 +1412,7 @@
  
  FILE *bootstrap_file;
  int bootstrap_error;
-@@ -584,7 +587,7 @@
+@@ -584,7 +587,7 @@ static my_bool opt_do_pstack, opt_bootst
  static int cleanup_done;
  static ulong opt_specialflag, opt_myisam_block_size;
  static char *opt_logname, *opt_update_logname, *opt_binlog_index_name;
@@ -1385,7 +1421,7 @@
  static char *mysql_home_ptr, *pidfile_name_ptr;
  static char **defaults_argv;
  static char *opt_bin_logname;
-@@ -3693,6 +3696,8 @@
+@@ -3693,6 +3696,8 @@ int main(int argc, char **argv)
        unireg_abort(1);
      }
    }
@@ -1394,7 +1430,7 @@
  #endif /* __WIN__ */
  
    if (init_common_variables(MYSQL_CONFIG_NAME,
-@@ -4943,7 +4948,7 @@
+@@ -4943,7 +4948,7 @@ enum options_mysqld
    OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
    OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
    OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
@@ -1403,7 +1439,7 @@
    OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
    OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
    OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
-@@ -5034,11 +5039,18 @@
+@@ -5034,11 +5039,18 @@ enum options_mysqld
    OPT_TIMED_MUTEXES,
    OPT_OLD_STYLE_USER_LIMITS,
    OPT_LOG_SLOW_ADMIN_STATEMENTS,
@@ -1422,7 +1458,7 @@
    OPT_INNODB_ROLLBACK_ON_TIMEOUT,
    OPT_SECURE_FILE_PRIV,
    OPT_KEEP_FILES_ON_CREATE,
-@@ -5428,8 +5440,17 @@
+@@ -5428,10 +5440,19 @@ Disable with --skip-innodb-doublewrite."
     (gptr*) &opt_log_slow_admin_statements,
     (gptr*) &opt_log_slow_admin_statements,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -1433,14 +1469,16 @@
 +   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
    {"log-slow-queries", OPT_SLOW_QUERY_LOG,
      "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.",
+    (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
+    0, 0, 0, 0, 0, 0},
++  {"slow_query_log_file", OPT_SLOW_QUERY_LOG_FILE,
++    "Log slow queries to given log file. Defaults logging to hostname-slow.log. Must be enabled to activate other slow log options.",
 +   (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
 +   0, 0, 0, 0, 0, 0},
-+  {"slow_query_log_file", OPT_SLOW_QUERY_LOG_FILE,
-+    "Log slow queries to given log file. Defaults logging to hostname-slow.log. Must be enabled to activate other slow log options.",
-    (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
-    0, 0, 0, 0, 0, 0},
    {"log-tc", OPT_LOG_TC,
-@@ -5795,6 +5816,9 @@
+    "Path to transaction coordinator log (used for transactions that affect "
+    "more than one storage engine, when binary log is disabled)",
+@@ -5795,6 +5816,9 @@ replicating a LOAD DATA INFILE command."
     "Tells the slave thread to continue replication when a query returns an error from the provided list.",
     0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
  #endif
@@ -1450,7 +1488,7 @@
    {"socket", OPT_SOCKET, "Socket file to use for connection.",
     (gptr*) &mysqld_unix_port, (gptr*) &mysqld_unix_port, 0, GET_STR,
     REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-@@ -6097,11 +6121,31 @@
+@@ -6097,11 +6121,31 @@ log and this option does nothing anymore
     (gptr*) 0,
     0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
     1, 100, 0, 1, 0},
@@ -1487,7 +1525,7 @@
    {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
     "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.  Should be set to 2 if you are using a case insensitive file system",
     (gptr*) &lower_case_table_names,
-@@ -6878,7 +6922,11 @@
+@@ -6878,7 +6922,11 @@ static void mysql_init_variables(void)
    global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
    max_system_variables.max_join_size=   (ulonglong) HA_POS_ERROR;
    global_system_variables.old_passwords= 0;
@@ -1500,7 +1538,7 @@
    /*
      Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
      when collecting index statistics for MyISAM tables.
-@@ -7339,6 +7387,35 @@
+@@ -7339,6 +7387,35 @@ get_one_option(int optid, const struct m
    case OPT_BOOTSTRAP:
      opt_noacl=opt_bootstrap=1;
      break;
@@ -1536,7 +1574,7 @@
    case OPT_STORAGE_ENGINE:
    {
      if ((enum db_type)((global_system_variables.table_type=
-@@ -7671,10 +7748,14 @@
+@@ -7671,10 +7748,14 @@ static void get_options(int argc,char **
    if (opt_bdb)
      sql_print_warning("this binary does not contain BDB storage engine");
  #endif
@@ -1554,10 +1592,11 @@
    if (argc > 0)
    {
      fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
-diff -r 04958490fc6d sql/set_var.cc
---- a/sql/set_var.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/set_var.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -217,9 +217,13 @@
+Index: mysql-5.0.77/sql/set_var.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/set_var.cc
++++ mysql-5.0.77/sql/set_var.cc
+@@ -217,9 +217,13 @@ sys_var_bool_ptr
    sys_log_queries_not_using_indexes("log_queries_not_using_indexes",
                                      &opt_log_queries_not_using_indexes);
  sys_var_thd_ulong	sys_log_warnings("log_warnings", &SV::log_warnings);
@@ -1572,7 +1611,7 @@
  sys_var_thd_bool	sys_low_priority_updates("low_priority_updates",
  						 &SV::low_priority_updates,
  						 fix_low_priority_updates);
-@@ -283,6 +287,8 @@
+@@ -283,6 +287,8 @@ sys_var_thd_ulong	sys_max_tmp_tables("ma
  					   &SV::max_tmp_tables);
  sys_var_long_ptr	sys_max_write_lock_count("max_write_lock_count",
  						 &max_write_lock_count);
@@ -1581,7 +1620,7 @@
  sys_var_thd_ulong       sys_multi_range_count("multi_range_count",
                                                &SV::multi_range_count);
  sys_var_long_ptr	sys_myisam_data_pointer_size("myisam_data_pointer_size",
-@@ -327,6 +333,20 @@
+@@ -327,6 +333,20 @@ sys_var_thd_ulong	sys_div_precincrement(
  sys_var_bool_ptr	sys_relay_log_purge("relay_log_purge",
                                              &relay_log_purge);
  #endif
@@ -1602,7 +1641,7 @@
  sys_var_long_ptr	sys_rpl_recovery_rank("rpl_recovery_rank",
  					      &rpl_recovery_rank);
  sys_var_long_ptr	sys_query_cache_size("query_cache_size",
-@@ -694,6 +714,10 @@
+@@ -694,6 +714,10 @@ sys_var *sys_variables[]=
    &sys_log_off,
    &sys_log_queries_not_using_indexes,
    &sys_log_slow,
@@ -1613,7 +1652,7 @@
    &sys_log_update,
    &sys_log_warnings,
    &sys_long_query_time,
-@@ -717,6 +741,7 @@
+@@ -717,6 +741,7 @@ sys_var *sys_variables[]=
    &sys_max_tmp_tables,
    &sys_max_user_connections,
    &sys_max_write_lock_count,
@@ -1621,7 +1660,7 @@
    &sys_multi_range_count,
    &sys_myisam_data_pointer_size,
    &sys_myisam_max_sort_file_size,
-@@ -770,6 +795,8 @@
+@@ -770,6 +795,8 @@ sys_var *sys_variables[]=
    &sys_slave_skip_counter,
  #endif
    &sys_slow_launch_time,
@@ -1630,7 +1669,7 @@
    &sys_sort_buffer,
    &sys_sql_big_tables,
    &sys_sql_low_priority_updates,
-@@ -986,8 +1013,11 @@
+@@ -986,8 +1013,11 @@ struct show_var_st init_vars[]= {
    {"log_slave_updates",       (char*) &opt_log_slave_updates,       SHOW_MY_BOOL},
  #endif
    {sys_log_slow.name,         (char*) &sys_log_slow,                SHOW_SYS},
@@ -1643,7 +1682,7 @@
    {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS},
    {"lower_case_file_system",  (char*) &lower_case_file_system,      SHOW_MY_BOOL},
    {"lower_case_table_names",  (char*) &lower_case_table_names,      SHOW_INT},
-@@ -1014,6 +1044,7 @@
+@@ -1014,6 +1044,7 @@ struct show_var_st init_vars[]= {
    {sys_max_tmp_tables.name,	(char*) &sys_max_tmp_tables,	    SHOW_SYS},
    {sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS},
    {sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS},
@@ -1651,7 +1690,7 @@
    {sys_multi_range_count.name,  (char*) &sys_multi_range_count,     SHOW_SYS},
    {sys_myisam_data_pointer_size.name, (char*) &sys_myisam_data_pointer_size, SHOW_SYS},
    {sys_myisam_max_sort_file_size.name, (char*) &sys_myisam_max_sort_file_size,
-@@ -1101,6 +1132,8 @@
+@@ -1101,6 +1132,8 @@ struct show_var_st init_vars[]= {
    {sys_slave_trans_retries.name,(char*) &sys_slave_trans_retries,   SHOW_SYS},
  #endif
    {sys_slow_launch_time.name, (char*) &sys_slow_launch_time,        SHOW_SYS},
@@ -1660,7 +1699,7 @@
  #ifdef HAVE_SYS_UN_H
    {"socket",                  (char*) &mysqld_unix_port,             SHOW_CHAR_PTR},
  #endif
-@@ -1141,6 +1174,7 @@
+@@ -1141,6 +1174,7 @@ struct show_var_st init_vars[]= {
    {sys_tx_isolation.name,     (char*) &sys_tx_isolation,	    SHOW_SYS},
    {sys_updatable_views_with_limit.name,
                                (char*) &sys_updatable_views_with_limit,SHOW_SYS},
@@ -1668,7 +1707,7 @@
    {sys_version.name,          (char*) &sys_version,                 SHOW_SYS},
  #ifdef HAVE_BERKELEY_DB
    {sys_version_bdb.name,      (char*) &sys_version_bdb,             SHOW_SYS},
-@@ -1769,6 +1803,17 @@
+@@ -1769,6 +1803,17 @@ byte *sys_var_thd_ulonglong::value_ptr(T
  }
  
  
@@ -1686,11 +1725,10 @@
  bool sys_var_thd_bool::update(THD *thd,  set_var *var)
  {
    if (var->type == OPT_GLOBAL)
-@@ -1924,6 +1969,19 @@
-     value= *(longlong*) value_ptr(thd, var_type, base);
+@@ -1925,6 +1970,19 @@ Item *sys_var::item(THD *thd, enum_var_t
      pthread_mutex_unlock(&LOCK_global_system_variables);
      return new Item_int(value);
-+  }
+   }
 +  case SHOW_MICROTIME:
 +  {
 +    longlong value;
@@ -1703,10 +1741,11 @@
 +
 +    len = snprintf(buff, 80, "%f", ((double) value) / 1000000.0);
 +    return new Item_float(buff,len);
-   }
++  }
    case SHOW_HA_ROWS:
    {
-@@ -2757,6 +2815,30 @@
+     ha_rows value;
+@@ -2757,6 +2815,30 @@ byte *sys_var_insert_id::value_ptr(THD *
  }
  
  
@@ -1737,7 +1776,7 @@
  #ifdef HAVE_REPLICATION
  bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
  {
-@@ -3526,6 +3608,191 @@
+@@ -3526,6 +3608,191 @@ int set_var_password::update(THD *thd)
  #endif
  }
  
@@ -1929,10 +1968,11 @@
  /****************************************************************************
   Functions to handle table_type
  ****************************************************************************/
-diff -r 04958490fc6d sql/set_var.h
---- a/sql/set_var.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/set_var.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -132,6 +132,7 @@
+Index: mysql-5.0.77/sql/set_var.h
+===================================================================
+--- mysql-5.0.77.orig/sql/set_var.h
++++ mysql-5.0.77/sql/set_var.h
+@@ -132,6 +132,7 @@ public:
  };
  
  
@@ -1940,7 +1980,7 @@
  class sys_var_ulonglong_ptr :public sys_var
  {
  public:
-@@ -168,6 +169,13 @@
+@@ -168,6 +169,13 @@ public:
    bool check_update_type(Item_result type) { return 0; }
  };
  
@@ -1954,7 +1994,7 @@
  
  class sys_var_bool_const_ptr : public sys_var
  {
-@@ -340,7 +348,6 @@
+@@ -340,7 +348,6 @@ public:
    }
  };
  
@@ -1962,7 +2002,7 @@
  class sys_var_thd_ulong :public sys_var_thd
  {
    sys_check_func check_func;
-@@ -360,7 +367,6 @@
+@@ -360,7 +367,6 @@ public:
    byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
  };
  
@@ -1970,15 +2010,15 @@
  class sys_var_thd_ha_rows :public sys_var_thd
  {
  public:
-@@ -377,7 +383,6 @@
-   SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
+@@ -378,7 +384,6 @@ public:
    byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
  };
+ 
 -
- 
  class sys_var_thd_ulonglong :public sys_var_thd
  {
-@@ -407,6 +412,19 @@
+ public:
+@@ -407,6 +412,19 @@ public:
    }
  };
  
@@ -1998,11 +2038,10 @@
  
  class sys_var_thd_bool :public sys_var_thd
  {
-@@ -477,6 +495,66 @@
-                                             ulong *length);
+@@ -478,6 +496,66 @@ public:
  };
  
-+
+ 
 +class sys_var_thd_msl_option :public sys_var_thd
 +{
 +protected:
@@ -2062,10 +2101,11 @@
 +  bool update(THD *thd, set_var *var);
 +  byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 +};
- 
++
  class sys_var_thd_storage_engine :public sys_var_thd
  {
-@@ -1087,3 +1165,11 @@
+ protected:
+@@ -1087,3 +1165,11 @@ void free_key_cache(const char *name, KE
  bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
  void delete_elements(I_List<NAMED_LIST> *list,
  		     void (*free_element)(const char*, gptr));
@@ -2077,10 +2117,11 @@
 +                               const ulong none_val, const ulong invalid_val);
 +const char *msl_option_get_name(const struct msl_opts *opts, ulong val);
 +char *msl_flag_get_name(const struct msl_opts *opts, char *buf, ulong val);
-diff -r 04958490fc6d sql/slave.cc
---- a/sql/slave.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/slave.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -2925,6 +2925,12 @@
+Index: mysql-5.0.77/sql/slave.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/slave.cc
++++ mysql-5.0.77/sql/slave.cc
+@@ -2925,6 +2925,12 @@ static int init_slave_thread(THD* thd, S
      + MAX_LOG_EVENT_HEADER;  /* note, incr over the global not session var */
    thd->slave_thread = 1;
    set_slave_thread_options(thd);
@@ -2093,10 +2134,11 @@
    thd->client_capabilities = CLIENT_LOCAL_FILES;
    thd->real_id=pthread_self();
    pthread_mutex_lock(&LOCK_thread_count);
-diff -r 04958490fc6d sql/sql_cache.cc
---- a/sql/sql_cache.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_cache.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -1341,6 +1341,7 @@
+Index: mysql-5.0.77/sql/sql_cache.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_cache.cc
++++ mysql-5.0.77/sql/sql_cache.cc
+@@ -1341,6 +1341,7 @@ def_week_frmt: %lu",                    
  
    thd->limit_found_rows = query->found_rows();
    thd->status_var.last_query_cost= 0.0;
@@ -2104,7 +2146,7 @@
  
    BLOCK_UNLOCK_RD(query_block);
    DBUG_RETURN(1);				// Result sent to client
-@@ -1348,6 +1349,7 @@
+@@ -1348,6 +1349,7 @@ def_week_frmt: %lu",                    
  err_unlock:
    STRUCT_UNLOCK(&structure_guard_mutex);
  err:
@@ -2112,10 +2154,11 @@
    DBUG_RETURN(0);				// Query was not cached
  }
  
-diff -r 04958490fc6d sql/sql_class.cc
---- a/sql/sql_class.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_class.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -188,7 +188,7 @@
+Index: mysql-5.0.77/sql/sql_class.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_class.cc
++++ mysql-5.0.77/sql/sql_class.cc
+@@ -188,7 +188,7 @@ THD::THD()
     lock_id(&main_lock_id),
     user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
     transaction_rollback_request(0), is_fatal_sub_stmt_error(0),
@@ -2124,7 +2167,7 @@
     last_insert_id_used(0), last_insert_id_used_bin_log(0), insert_id_used(0),
     clear_next_insert_id(0), in_lock_tables(0), bootstrap(0),
     derived_tables_processing(FALSE), spcont(NULL),
-@@ -2224,6 +2224,12 @@
+@@ -2224,6 +2224,12 @@ void THD::reset_sub_statement_state(Sub_
    backup->cuted_fields=     cuted_fields;
    backup->client_capabilities= client_capabilities;
    backup->savepoints= transaction.savepoints;
@@ -2137,7 +2180,7 @@
  
    if (!lex->requires_prelocking() || is_update_query(lex->sql_command))
      options&= ~OPTION_BIN_LOG;
-@@ -2240,7 +2246,13 @@
+@@ -2240,7 +2246,13 @@ void THD::reset_sub_statement_state(Sub_
    sent_row_count= 0;
    cuted_fields= 0;
    transaction.savepoints= 0;
@@ -2152,7 +2195,7 @@
    /* Surpress OK packets in case if we will execute statements */
    net.no_send_ok= TRUE;
  }
-@@ -2293,6 +2305,12 @@
+@@ -2293,6 +2305,12 @@ void THD::restore_sub_statement_state(Su
    */
    examined_row_count+= backup->examined_row_count;
    cuted_fields+=       backup->cuted_fields;
@@ -2165,10 +2208,11 @@
  }
  
  
-diff -r 04958490fc6d sql/sql_class.h
---- a/sql/sql_class.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_class.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -43,6 +43,7 @@
+Index: mysql-5.0.77/sql/sql_class.h
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_class.h
++++ mysql-5.0.77/sql/sql_class.h
+@@ -43,6 +43,7 @@ enum enum_check_fields { CHECK_FIELD_IGN
  extern char internal_table_name[2];
  extern char empty_c_string[1];
  extern const char **errmesg;
@@ -2176,7 +2220,7 @@
  
  #define TC_LOG_PAGE_SIZE   8192
  #define TC_LOG_MIN_SIZE    (3*TC_LOG_PAGE_SIZE)
-@@ -321,7 +322,7 @@
+@@ -321,7 +322,7 @@ public:
    bool write(THD *thd, enum enum_server_command command,
  	     const char *format, ...) ATTRIBUTE_FORMAT(printf, 4, 5);
    bool write(THD *thd, const char *query, uint query_length,
@@ -2185,7 +2229,7 @@
    bool write(Log_event* event_info); // binary log write
    bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
  
-@@ -527,13 +528,14 @@
+@@ -527,13 +528,14 @@ struct system_variables
    ulong auto_increment_increment, auto_increment_offset;
    ulong bulk_insert_buff_size;
    ulong join_buff_size;
@@ -2201,7 +2245,7 @@
    ulong multi_range_count;
    ulong myisam_repair_threads;
    ulong myisam_sort_buff_size;
-@@ -549,10 +551,13 @@
+@@ -549,10 +551,13 @@ struct system_variables
    ulong preload_buff_size;
    ulong profiling_history_size;
    ulong query_cache_type;
@@ -2215,7 +2259,7 @@
    ulong table_type;
    ulong tx_isolation;
    ulong completion_type;
-@@ -1128,6 +1133,12 @@
+@@ -1128,6 +1133,12 @@ public:
    uint in_sub_stmt;
    bool enable_slow_log, insert_id_used, clear_next_insert_id;
    bool last_insert_id_used;
@@ -2228,7 +2272,7 @@
    my_bool no_send_ok;
    SAVEPOINT *savepoints;
  };
-@@ -1184,6 +1195,11 @@
+@@ -1184,6 +1195,11 @@ public:
  class THD :public Statement,
             public Open_tables_state
  {
@@ -2240,7 +2284,7 @@
  public:
    /*
      Constant for THD::where initialization in the beginning of every query.
-@@ -1292,10 +1308,24 @@
+@@ -1292,10 +1308,24 @@ public:
    */
    const char *where;
    time_t     start_time,time_after_lock,user_time;
@@ -2265,7 +2309,7 @@
    /* <> 0 if we are inside of trigger or stored function. */
    uint in_sub_stmt;
  
-@@ -1685,11 +1715,11 @@
+@@ -1685,11 +1715,11 @@ public:
        sql_print_information("time() failed with %d", errno);
    }
  
@@ -2282,9 +2326,10 @@
    inline void	insert_id(ulonglong id_arg)
    {
      last_insert_id= id_arg;
-diff -r 04958490fc6d sql/sql_parse.cc
---- a/sql/sql_parse.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_parse.cc	Tue Feb 17 22:33:00 2009 -0800
+Index: mysql-5.0.77/sql/sql_parse.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_parse.cc
++++ mysql-5.0.77/sql/sql_parse.cc
 @@ -20,6 +20,7 @@
  #include <m_ctype.h>
  #include <myisam.h>
@@ -2293,7 +2338,7 @@
  
  #ifdef HAVE_INNOBASE_DB
  #include "ha_innodb.h"
-@@ -1227,6 +1228,15 @@
+@@ -1227,6 +1228,15 @@ pthread_handler_t handle_one_connection(
      my_net_set_read_timeout(net, thd->variables.net_read_timeout);
      my_net_set_write_timeout(net, thd->variables.net_write_timeout);
  
@@ -2309,13 +2354,13 @@
      while (!net->error && net->vio != 0 &&
             !(thd->killed == THD::KILL_CONNECTION))
      {
-@@ -2353,27 +2363,55 @@
+@@ -2353,27 +2363,55 @@ void log_slow_statement(THD *thd)
      return;                                     // Don't set time for sub stmt
  
    start_of_query= thd->start_time;
 +  ulonglong start_of_query_timer= thd->start_timer;
    thd->end_time();				// Set start time
-+
+ 
 +
 +  /* Follow the slow log filter configuration. */
 +  if (thd->variables.log_slow_filter != SLOG_F_NONE && 
@@ -2339,7 +2384,7 @@
 +  /* Do not log this thread's queries due to rate limiting. */
 +  if (thd->write_to_slow_log != TRUE)
 +    return;
- 
++
    /*
      Do not log administrative statements unless the appropriate option is
      set; do not log into slow log if reading from backup.
@@ -2374,7 +2419,7 @@
      }
    }
  }
-@@ -2664,6 +2702,8 @@
+@@ -2664,6 +2702,8 @@ mysql_execute_command(THD *thd)
      context.resolve_in_table_list_only((TABLE_LIST*)select_lex->
                                         table_list.first);
  
@@ -2383,7 +2428,7 @@
    /*
      Reset warning count for each query that uses tables
      A better approach would be to reset this for any commands
-@@ -6084,6 +6124,15 @@
+@@ -6084,6 +6124,15 @@ void mysql_reset_thd_for_next_command(TH
      thd->total_warn_count=0;			// Warnings for this query
      thd->rand_used= 0;
      thd->sent_row_count= thd->examined_row_count= 0;
@@ -2399,10 +2444,11 @@
    }
    DBUG_VOID_RETURN;
  }
-diff -r 04958490fc6d sql/sql_select.cc
---- a/sql/sql_select.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_select.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -6224,8 +6224,11 @@
+Index: mysql-5.0.77/sql/sql_select.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_select.cc
++++ mysql-5.0.77/sql/sql_select.cc
+@@ -6224,8 +6224,11 @@ make_join_readinfo(JOIN *join, ulonglong
  	  {
  	    join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
  	    if (statistics)
@@ -2414,7 +2460,7 @@
  	  }
  	}
  	else
-@@ -6240,8 +6243,11 @@
+@@ -6240,8 +6243,11 @@ make_join_readinfo(JOIN *join, ulonglong
  	  {
  	    join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
  	    if (statistics)
@@ -2426,7 +2472,7 @@
  	  }
  	}
  	if (!table->no_keyread)
-@@ -9305,6 +9311,7 @@
+@@ -9305,6 +9311,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARA
  		      (ulong) rows_limit,test(group)));
  
    statistic_increment(thd->status_var.created_tmp_tables, &LOCK_status);
@@ -2434,7 +2480,7 @@
  
    if (use_temp_pool && !(test_flags & TEST_KEEP_TMP_TABLES))
      temp_pool_slot = bitmap_set_next(&temp_pool);
-@@ -10165,6 +10172,7 @@
+@@ -10165,6 +10172,7 @@ static bool create_myisam_tmp_table(TABL
    }
    statistic_increment(table->in_use->status_var.created_tmp_disk_tables,
  		      &LOCK_status);
@@ -2442,26 +2488,28 @@
    table->s->db_record_offset= 1;
    DBUG_RETURN(0);
   err:
-diff -r 04958490fc6d sql/sql_show.cc
---- a/sql/sql_show.cc	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/sql_show.cc	Tue Feb 17 22:33:00 2009 -0800
-@@ -1544,6 +1544,12 @@
-           value= ((char *) status_var + (ulonglong) value);
+Index: mysql-5.0.77/sql/sql_show.cc
+===================================================================
+--- mysql-5.0.77.orig/sql/sql_show.cc
++++ mysql-5.0.77/sql/sql_show.cc
+@@ -1545,6 +1545,12 @@ static bool show_status_array(THD *thd, 
          case SHOW_LONGLONG:
            end= longlong10_to_str(*(longlong*) value, buff, 10);
-+          break;
+           break;
 +        case SHOW_MICROTIME:
 +          show_type= ((sys_var*) value)->show_type();
 +          value=     (char*) ((sys_var*) value)->value_ptr(thd, value_type,
 +                                                           &null_lex_str);
 +          end= buff + sprintf(buff, "%f", (((double) (*(ulonglong*)value))) / 1000000.0);
-           break;
++          break;
          case SHOW_HA_ROWS:
            end= longlong10_to_str((longlong) *(ha_rows*) value, buff, 10);
-diff -r 04958490fc6d sql/structs.h
---- a/sql/structs.h	Tue Feb 17 22:32:27 2009 -0800
-+++ b/sql/structs.h	Tue Feb 17 22:33:00 2009 -0800
-@@ -168,8 +168,8 @@
+           break;
+Index: mysql-5.0.77/sql/structs.h
+===================================================================
+--- mysql-5.0.77.orig/sql/structs.h
++++ mysql-5.0.77/sql/structs.h
+@@ -168,8 +168,8 @@ typedef struct st_known_date_time_format
  enum SHOW_TYPE
  {
    SHOW_UNDEF,