Author: glen                         Date: Wed Sep 17 14:22:49 2008 GMT
Module: SOURCES                       Tag: MYSQL_5_0
---- Log message:
- from http://www.percona.com/mysql/5.0.68/patches/

---- Files affected:
SOURCES:
   mysql-acc-pslist.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-control_flush_and_merge_and_read.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-control_io-threads.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-microslow_innodb.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-mysqld_safe_syslog.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-show_patches.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-split_buf_pool_mutex_fixed_optimistic_safe.patch (NONE -> 1.1.2.1)  
(NEW), mysql-userstats-testsuite.patch (NONE -> 1.1.2.1)  (NEW), 
mysql-userstats.patch (NONE -> 1.1.2.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mysql-acc-pslist.patch
diff -u /dev/null SOURCES/mysql-acc-pslist.patch:1.1.2.1
--- /dev/null   Wed Sep 17 16:22:50 2008
+++ SOURCES/mysql-acc-pslist.patch      Wed Sep 17 16:22:39 2008
@@ -0,0 +1,115 @@
+diff -r 174803e7e869 mysql-test/r/create.result
+--- a/mysql-test/r/create.result       Thu Sep 04 12:17:56 2008 -0700
++++ b/mysql-test/r/create.result       Thu Sep 04 12:20:19 2008 -0700
+@@ -1720,7 +1720,8 @@
+   `COMMAND` varchar(16) NOT NULL DEFAULT '',
+   `TIME` bigint(7) NOT NULL DEFAULT '0',
+   `STATE` varchar(64) DEFAULT NULL,
+-  `INFO` longtext
++  `INFO` longtext,
++  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8
+ drop table t1;
+ create temporary table t1 like information_schema.processlist;
+@@ -1734,7 +1735,8 @@
+   `COMMAND` varchar(16) NOT NULL DEFAULT '',
+   `TIME` bigint(7) NOT NULL DEFAULT '0',
+   `STATE` varchar(64) DEFAULT NULL,
+-  `INFO` longtext
++  `INFO` longtext,
++  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8
+ drop table t1;
+ create table t1 like information_schema.character_sets;
+diff -r 174803e7e869 mysql-test/r/not_embedded_server.result
+--- a/mysql-test/r/not_embedded_server.result  Thu Sep 04 12:17:56 2008 -0700
++++ b/mysql-test/r/not_embedded_server.result  Thu Sep 04 12:20:19 2008 -0700
+@@ -1,7 +1,7 @@
+ prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE 
COMMAND!=\'Daemon\' ';
+ execute stmt1;
+-ID    USER    HOST    DB      COMMAND TIME    STATE   INFO
+-number        root    localhost       test    Query   time    executing       
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
++ID    USER    HOST    DB      COMMAND TIME    STATE   INFO    TIME_MS
++number        root    localhost       test    Query   time    executing       
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'    time_ms
+ deallocate prepare stmt1;
+ FLUSH STATUS;
+ SHOW GLOBAL STATUS LIKE 'com_select';
+diff -r 174803e7e869 mysql-test/t/not_embedded_server.test
+--- a/mysql-test/t/not_embedded_server.test    Thu Sep 04 12:17:56 2008 -0700
++++ b/mysql-test/t/not_embedded_server.test    Thu Sep 04 12:20:19 2008 -0700
+@@ -16,7 +16,7 @@
+ # End of 4.1 tests
+ 
+ prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE 
COMMAND!=\'Daemon\' ';
+---replace_column 1 number 6 time 3 localhost
++--replace_column 1 number 6 time 3 localhost 9 time_ms
+ execute stmt1;
+ deallocate prepare stmt1;
+ 
+diff -r 174803e7e869 patch_info/acc-pslist.info
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ b/patch_info/acc-pslist.info       Thu Sep 04 12:20:19 2008 -0700
+@@ -0,0 +1,6 @@
++File=acc-pslist.patch
++Name=Milliseconds in PROCESSLIST
++Version=1.0
++Author=Percona <[EMAIL PROTECTED]>
++License=GPL
++Comment=
+diff -r 174803e7e869 sql/sql_show.cc
+--- a/sql/sql_show.cc  Thu Sep 04 12:17:56 2008 -0700
++++ b/sql/sql_show.cc  Thu Sep 04 12:20:19 2008 -0700
+@@ -1803,7 +1803,7 @@
+   TABLE *table= tables->table;
+   CHARSET_INFO *cs= system_charset_info;
+   char *user;
+-  time_t now= my_time(0);
++  ulonglong unow= my_micro_time();
+   DBUG_ENTER("fill_process_list");
+ 
+   user= thd->security_ctx->master_access & PROCESS_ACL ?
+@@ -1861,8 +1861,8 @@
+         table->field[4]->store(command_name[tmp->command].str,
+                                command_name[tmp->command].length, cs);
+       /* MYSQL_TIME */
+-      table->field[5]->store((uint32)(tmp->start_time ?
+-                                      now - tmp->start_time : 0), TRUE);
++      const ulonglong utime= tmp->start_utime ? unow - tmp->start_utime : 0;
++      table->field[5]->store(utime / 1000000, TRUE);
+       /* STATE */
+ #ifndef EMBEDDED_LIBRARY
+       val= (char*) (tmp->locked ? "Locked" :
+@@ -1896,11 +1896,15 @@
+         table->field[7]->set_notnull();
+       }
+ 
++      /* TIME_MS */
++      table->field[8]->store((double)(utime / 1000.0));
++
+       if (schema_table_store_record(thd, table))
+       {
+         VOID(pthread_mutex_unlock(&LOCK_thread_count));
+         DBUG_RETURN(1);
+       }
++
+     }
+   }
+ 
+@@ -5532,7 +5536,7 @@
+     into it two numbers, based on modulus of base-10 numbers.  In the ones
+     position is the number of decimals.  Tens position is unused.  In the
+     hundreds and thousands position is a two-digit decimal number representing
+-    length.  Encode this value with  (decimals*100)+length  , where
++    length.  Encode this value with  (length*100)+decimals  , where
+     0<decimals<10 and 0<=length<100 .
+ 
+   @param
+@@ -6540,6 +6544,8 @@
+   {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
+   {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
+    SKIP_OPEN_TABLE},
++  {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
++    0, 0, "Time_ms", SKIP_OPEN_TABLE},
+   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
+ };
+ 

================================================================
Index: SOURCES/mysql-control_flush_and_merge_and_read.patch
diff -u /dev/null SOURCES/mysql-control_flush_and_merge_and_read.patch:1.1.2.1
--- /dev/null   Wed Sep 17 16:22:50 2008
+++ SOURCES/mysql-control_flush_and_merge_and_read.patch        Wed Sep 17 
16:22:39 2008
@@ -0,0 +1,238 @@
+diff -r 2fdaeb546d25 innobase/buf/buf0rea.c
+--- a/innobase/buf/buf0rea.c   Mon Sep 08 16:39:06 2008 -0700
++++ b/innobase/buf/buf0rea.c   Mon Sep 08 16:40:14 2008 -0700
+@@ -188,6 +188,10 @@
+       ulint           low, high;
+       ulint           err;
+       ulint           i;
++
++      if (!(srv_read_ahead & 1)) {
++              return(0);
++      }
+ 
+       if (srv_startup_is_before_trx_rollback_phase) {
+               /* No read-ahead to avoid thread deadlocks */
+@@ -396,6 +400,10 @@
+       ulint           err;
+       ulint           i;
+       
++      if (!(srv_read_ahead & 2)) {
++              return(0);
++      }
++
+       if (srv_startup_is_before_trx_rollback_phase) {
+               /* No read-ahead to avoid thread deadlocks */
+               return(0);
+diff -r 2fdaeb546d25 innobase/include/srv0srv.h
+--- a/innobase/include/srv0srv.h       Mon Sep 08 16:39:06 2008 -0700
++++ b/innobase/include/srv0srv.h       Mon Sep 08 16:40:14 2008 -0700
+@@ -131,6 +131,12 @@
+ extern ulong  srv_max_purge_lag;
+ extern ibool  srv_use_awe;
+ extern ibool  srv_use_adaptive_hash_indexes;
++
++extern ulint  srv_read_ahead;
++extern ulint  srv_ibuf_contract_const;
++extern ulint  srv_ibuf_contract_burst;
++extern ulint  srv_buf_flush_const;
++extern ulint  srv_buf_flush_burst;
+ /*-------------------------------------------*/
+ 
+ extern ulint  srv_n_rows_inserted;
+diff -r 2fdaeb546d25 innobase/srv/srv0srv.c
+--- a/innobase/srv/srv0srv.c   Mon Sep 08 16:39:06 2008 -0700
++++ b/innobase/srv/srv0srv.c   Mon Sep 08 16:40:14 2008 -0700
+@@ -322,6 +322,11 @@
+ ibool srv_use_awe                     = FALSE;
+ ibool srv_use_adaptive_hash_indexes   = TRUE;
+ 
++ulint srv_read_ahead = 3; /* 1: random  2: linear  3: Both */
++ulint srv_ibuf_contract_const = 5;
++ulint srv_ibuf_contract_burst = 20;
++ulint srv_buf_flush_const = 10;
++ulint srv_buf_flush_burst = 100;
+ /*-------------------------------------------*/
+ ulong srv_n_spin_wait_rounds  = 20;
+ ulong srv_n_free_tickets_to_enter = 500;
+@@ -2298,7 +2303,7 @@
+                                               + buf_pool->n_pages_written;
+               if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
+                       srv_main_thread_op_info = "doing insert buffer merge";
+-                      ibuf_contract_for_n_pages(TRUE, 5);
++                      ibuf_contract_for_n_pages(TRUE, 
srv_ibuf_contract_burst);
+ 
+                       srv_main_thread_op_info = "flushing log";
+ 
+@@ -2311,7 +2316,7 @@
+                       /* Try to keep the number of modified pages in the
+                       buffer pool under the limit wished by the user */
+                       
+-                      n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
++                      n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 
srv_buf_flush_burst,
+                                                         ut_dulint_max);
+ 
+                       /* If we had to do the flush, it may have taken
+@@ -2349,7 +2354,7 @@
+       if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
+ 
+               srv_main_thread_op_info = "flushing buffer pool pages";
+-              buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
++              buf_flush_batch(BUF_FLUSH_LIST, srv_buf_flush_burst, 
ut_dulint_max);
+ 
+               srv_main_thread_op_info = "flushing log";
+               log_buffer_flush_to_disk();
+@@ -2359,7 +2364,7 @@
+       even if the server were active */
+ 
+       srv_main_thread_op_info = "doing insert buffer merge";
+-      ibuf_contract_for_n_pages(TRUE, 5);
++      ibuf_contract_for_n_pages(TRUE, srv_ibuf_contract_const);
+ 
+       srv_main_thread_op_info = "flushing log";
+       log_buffer_flush_to_disk();
+@@ -2401,14 +2406,14 @@
+               (> 70 %), we assume we can afford reserving the disk(s) for
+               the time it requires to flush 100 pages */
+ 
+-              n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
++              n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 
srv_buf_flush_burst,
+                                                       ut_dulint_max);
+       } else {
+               /* Otherwise, we only flush a small number of pages so that
+               we do not unnecessarily use much disk i/o capacity from
+               other work */
+ 
+-              n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10,
++              n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 
srv_buf_flush_const,
+                                                       ut_dulint_max);
+       }
+ 
+@@ -2497,7 +2502,7 @@
+       if (srv_fast_shutdown && srv_shutdown_state > 0) {
+               n_bytes_merged = 0;
+       } else {
+-              n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
++              n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 
srv_ibuf_contract_burst);
+       }
+ 
+       srv_main_thread_op_info = "reserving kernel mutex";
+@@ -2514,7 +2519,7 @@
+ 
+       if (srv_fast_shutdown < 2) {
+               n_pages_flushed =
+-                      buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
++                      buf_flush_batch(BUF_FLUSH_LIST, srv_buf_flush_burst, 
ut_dulint_max);
+       } else {
+               /* In the fastest shutdown we do not flush the buffer pool
+               to data files: we set n_pages_flushed to 0 artificially. */
+diff -r 2fdaeb546d25 patch_info/control_flush_and_merge_and_read.info
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ b/patch_info/control_flush_and_merge_and_read.info Mon Sep 08 16:40:14 
2008 -0700
+@@ -0,0 +1,6 @@
++File=control_flush_and_merge_and_read.patch
++Name=InnoDB patch to control insert buffer and flushing
++Version=1.0
++Author=Yasufumi Kinoshita
++License=BSD
++Comment=
+diff -r 2fdaeb546d25 sql/ha_innodb.h
+--- a/sql/ha_innodb.h  Mon Sep 08 16:39:06 2008 -0700
++++ b/sql/ha_innodb.h  Mon Sep 08 16:40:14 2008 -0700
+@@ -234,6 +234,11 @@
+ extern ulong srv_thread_concurrency;
+ extern ulong srv_commit_concurrency;
+ extern ulong srv_flush_log_at_trx_commit;
++extern ulong srv_read_ahead;
++extern ulong srv_ibuf_contract_const;
++extern ulong srv_ibuf_contract_burst;
++extern ulong srv_buf_flush_const;
++extern ulong srv_buf_flush_burst;
+ }
+ 
+ bool innobase_init(void);
+diff -r 2fdaeb546d25 sql/mysqld.cc
+--- a/sql/mysqld.cc    Mon Sep 08 16:39:06 2008 -0700
++++ b/sql/mysqld.cc    Mon Sep 08 16:40:14 2008 -0700
+@@ -5014,7 +5014,10 @@
+   OPT_SECURE_FILE_PRIV,
+   OPT_KEEP_FILES_ON_CREATE,
+   OPT_INNODB_ADAPTIVE_HASH_INDEX,
+-  OPT_FEDERATED
++  OPT_FEDERATED,
++  OPT_INNODB_READ_AHEAD,
++  OPT_INNODB_IBUF_CONTRACT_CONST, OPT_INNODB_IBUF_CONTRACT_BURST,
++  OPT_INNODB_BUF_FLUSH_CONST, OPT_INNODB_BUF_FLUSH_BURST
+ };
+ 
+ 
+@@ -5321,6 +5324,26 @@
+    (gptr*) &global_system_variables.innodb_table_locks,
+    (gptr*) &global_system_variables.innodb_table_locks,
+    0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
++  {"innodb_read_ahead", OPT_INNODB_READ_AHEAD,
++   "Enable/Diasable read aheads bit0:random bit1:linear",
++   (gptr*) &srv_read_ahead, (gptr*) &srv_read_ahead,
++   0, GET_ULONG, REQUIRED_ARG, 3, 0, 3, 0, 0, 0},
++  {"innodb_ibuf_contract_const", OPT_INNODB_IBUF_CONTRACT_CONST,
++   "Const activity of merging insert buffer",
++   (gptr*) &srv_ibuf_contract_const, (gptr*) &srv_ibuf_contract_const,
++   0, GET_ULONG, REQUIRED_ARG, 5, 1, 50000, 0, 0, 0},
++  {"innodb_ibuf_contract_burst", OPT_INNODB_IBUF_CONTRACT_BURST,
++   "Burst activity of merging insert buffer",
++   (gptr*) &srv_ibuf_contract_burst, (gptr*) &srv_ibuf_contract_burst,
++   0, GET_ULONG, REQUIRED_ARG, 20, 1, 50000, 0, 0, 0},
++  {"innodb_buf_flush_const", OPT_INNODB_BUF_FLUSH_CONST,
++   "Const activity of flushing buffer pool",
++   (gptr*) &srv_buf_flush_const, (gptr*) &srv_buf_flush_const,
++   0, GET_ULONG, REQUIRED_ARG, 10, 1, 50000, 0, 0, 0},
++  {"innodb_buf_flush_burst", OPT_INNODB_BUF_FLUSH_BURST,
++   "Burst activity of flushing buffer pool",
++   (gptr*) &srv_buf_flush_burst, (gptr*) &srv_buf_flush_burst,
++   0, GET_ULONG, REQUIRED_ARG, 100, 1, 50000, 0, 0, 0},
+ #endif /* End HAVE_INNOBASE_DB */
+   {"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.",
+    (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+diff -r 2fdaeb546d25 sql/set_var.cc
+--- a/sql/set_var.cc   Mon Sep 08 16:39:06 2008 -0700
++++ b/sql/set_var.cc   Mon Sep 08 16:40:14 2008 -0700
+@@ -476,6 +476,16 @@
+ sys_var_long_ptr  sys_innodb_flush_log_at_trx_commit(
+                                         "innodb_flush_log_at_trx_commit",
+                                         &srv_flush_log_at_trx_commit);
++sys_var_long_ptr      sys_innodb_read_ahead("innodb_read_ahead",
++                                              &srv_read_ahead);
++sys_var_long_ptr      
sys_innodb_ibuf_contract_const("innodb_ibuf_contract_const",
++                                                       
&srv_ibuf_contract_const);
++sys_var_long_ptr      
sys_innodb_ibuf_contract_burst("innodb_ibuf_contract_burst",
++                                                       
&srv_ibuf_contract_burst);
++sys_var_long_ptr      sys_innodb_buf_flush_const("innodb_buf_flush_const",
++                                                   &srv_buf_flush_const);
++sys_var_long_ptr      sys_innodb_buf_flush_burst("innodb_buf_flush_burst",
++                                                   &srv_buf_flush_burst);
+ #endif
+ 
+ /* Condition pushdown to storage engine */
+@@ -818,6 +828,11 @@
+   &sys_innodb_thread_concurrency,
+   &sys_innodb_commit_concurrency,
+   &sys_innodb_flush_log_at_trx_commit,
++  &sys_innodb_read_ahead,
++  &sys_innodb_ibuf_contract_const,
++  &sys_innodb_ibuf_contract_burst,
++  &sys_innodb_buf_flush_const,
++  &sys_innodb_buf_flush_burst,
+ #endif
+   &sys_trust_routine_creators,
+   &sys_trust_function_creators,
+@@ -953,6 +968,11 @@
+   {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
+   {sys_innodb_thread_concurrency.name, (char*) 
&sys_innodb_thread_concurrency, SHOW_SYS},
+   {sys_innodb_thread_sleep_delay.name, (char*) 
&sys_innodb_thread_sleep_delay, SHOW_SYS},
++  {sys_innodb_read_ahead.name, (char*) &sys_innodb_read_ahead, SHOW_SYS},
++  {sys_innodb_ibuf_contract_const.name, (char*) 
&sys_innodb_ibuf_contract_const, SHOW_SYS},
++  {sys_innodb_ibuf_contract_burst.name, (char*) 
&sys_innodb_ibuf_contract_burst, SHOW_SYS},
++  {sys_innodb_buf_flush_const.name, (char*) &sys_innodb_buf_flush_const, 
SHOW_SYS},
++  {sys_innodb_buf_flush_burst.name, (char*) &sys_innodb_buf_flush_burst, 
SHOW_SYS},
+ #endif
+   {sys_interactive_timeout.name,(char*) &sys_interactive_timeout,   SHOW_SYS},
+   {sys_join_buffer_size.name,   (char*) &sys_join_buffer_size,            
SHOW_SYS},

================================================================
Index: SOURCES/mysql-control_io-threads.patch
diff -u /dev/null SOURCES/mysql-control_io-threads.patch:1.1.2.1
--- /dev/null   Wed Sep 17 16:22:51 2008
+++ SOURCES/mysql-control_io-threads.patch      Wed Sep 17 16:22:40 2008
@@ -0,0 +1,69 @@
+diff -r 4dca80df8ee3 innobase/os/os0file.c
+--- a/innobase/os/os0file.c    Mon Sep 08 16:40:14 2008 -0700
++++ b/innobase/os/os0file.c    Mon Sep 08 16:40:20 2008 -0700
+@@ -3180,6 +3180,13 @@
+       struct aiocb*   control;
+ #endif
+       ulint           i;
++      ulint           prim_segment;
++      ulint           n;
++
++      n = array->n_slots / array->n_segments;
++      /* 64 blocks' striping ( aligning max(BUF_READ_AHEAD_AREA) ) */
++      prim_segment = ( offset >> (UNIV_PAGE_SIZE_SHIFT + 6) ) % 
(array->n_segments);
++
+ loop:
+       os_mutex_enter(array->mutex);
+ 
+@@ -3198,11 +3205,22 @@
+               goto loop;
+       }
+ 
+-      for (i = 0;; i++) {
++      for (i = prim_segment * n; i < array->n_slots; i++) {
+               slot = os_aio_array_get_nth_slot(array, i);
+ 
+               if (slot->reserved == FALSE) {
+                       break;
++              }
++      }
++
++      if (slot->reserved == TRUE){
++              /* Not found after the intended segment. So we should search 
before. */
++              for (i = 0;; i++) {
++                      slot = os_aio_array_get_nth_slot(array, i);
++
++                      if (slot->reserved == FALSE) {
++                              break;
++                      }
+               }
+       }
+ 
+diff -r 4dca80df8ee3 innobase/srv/srv0start.c
+--- a/innobase/srv/srv0start.c Mon Sep 08 16:40:14 2008 -0700
++++ b/innobase/srv/srv0start.c Mon Sep 08 16:40:20 2008 -0700
+@@ -1213,12 +1213,12 @@
+ 
+       if (!os_aio_use_native_aio) {
+               /* In simulated aio we currently have use only for 4 threads */
+-              srv_n_file_io_threads = 4;
++              /*srv_n_file_io_threads = 4;*/
+ 
+               os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
+                                               * srv_n_file_io_threads,
+                                       srv_n_file_io_threads,
+-                                      SRV_MAX_N_PENDING_SYNC_IOS);
++                                      SRV_MAX_N_PENDING_SYNC_IOS * 
srv_n_file_io_threads / 4);
+       } else {
+               os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
+                                               * srv_n_file_io_threads,
+diff -r 4dca80df8ee3 patch_info/control_io-threads.info
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ b/patch_info/control_io-threads.info       Mon Sep 08 16:40:20 2008 -0700
+@@ -0,0 +1,6 @@
++File=control_io-threads.patch
++Name=InnoDB patch to control count of IO threads
++Version=1.0
++Author=Yasufumi Kinoshita
++License=BSD
++Comment=

================================================================
Index: SOURCES/mysql-microslow_innodb.patch
diff -u /dev/null SOURCES/mysql-microslow_innodb.patch:1.1.2.1
--- /dev/null   Wed Sep 17 16:22:52 2008
+++ SOURCES/mysql-microslow_innodb.patch        Wed Sep 17 16:22:40 2008
@@ -0,0 +1,2333 @@
+diff -r bb81fcdd7db2 include/my_time.h
+--- a/include/my_time.h        Mon Sep 08 16:38:33 2008 -0700
++++ b/include/my_time.h        Mon Sep 08 16:38:46 2008 -0700
+@@ -140,7 +140,7 @@
+ 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);
+-
++ulonglong my_timer(ulonglong *ltime, ulonglong frequency);
+ C_MODE_END
+ 
+ #endif /* _my_time_h_ */
+diff -r bb81fcdd7db2 innobase/buf/buf0buf.c
+--- a/innobase/buf/buf0buf.c   Mon Sep 08 16:38:33 2008 -0700
++++ b/innobase/buf/buf0buf.c   Mon Sep 08 16:38:46 2008 -0700
+@@ -37,6 +37,7 @@
+ #include "log0log.h"
+ #include "trx0undo.h"
+ #include "srv0srv.h"
++#include "thr0loc.h"
+ 
+ /*
+               IMPLEMENTATION OF THE BUFFER POOL
+@@ -1086,6 +1087,31 @@
+       return(block);
+ }
+ 
++inline void _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
++{
++      ulint           block_hash;
++      ulint           block_hash_byte;
++      byte            block_hash_offset;
++
++      ut_ad(block);
++
++      if (!trx || !trx->distinct_page_access_hash)
++              return;
++
++        block_hash = ut_hash_ulint((block->space << 20) + block->space +
++                                      block->offset, DPAH_SIZE << 3);
++      block_hash_byte = block_hash >> 3;
++      block_hash_offset = (byte) block_hash & 0x07;
++      if (block_hash_byte < 0 || block_hash_byte >= DPAH_SIZE)
++              fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = 
%lu !!!\n", block_hash_byte, block_hash_offset);
++      if (block_hash_offset < 0 || block_hash_offset > 7)
++              fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = 
%lu !!!\n", block_hash_byte, block_hash_offset);
++      if ((trx->distinct_page_access_hash[block_hash_byte] & ((byte) 0x01 << 
block_hash_offset)) == 0)
++              trx->distinct_page_access++;
++      trx->distinct_page_access_hash[block_hash_byte] |= (byte) 0x01 << 
block_hash_offset;
++      return;
++}
++
+ /************************************************************************
+ This is the general function used to get access to a database page. */
+ 
+@@ -1108,6 +1134,11 @@
+       ulint           fix_type;
+       ibool           success;
+       ibool           must_read;
++      trx_t*          trx;
++      ulint           sec;
++      ulint           ms;
++      ib_longlong     start_time;
++      ib_longlong     finish_time;
+       
+       ut_ad(mtr);
+       ut_ad((rw_latch == RW_S_LATCH)
+@@ -1119,6 +1150,7 @@
+ #ifndef UNIV_LOG_DEBUG
+       ut_ad(!ibuf_inside() || ibuf_page(space, offset));
+ #endif
++      trx = thr_local_get_trx(os_thread_get_curr_id());
+       buf_pool->n_page_gets++;
+ loop:
+       block = NULL;
+@@ -1148,7 +1180,7 @@
+                       return(NULL);
+               }
+ 
+-              buf_read_page(space, offset);
++              buf_read_page(space, offset, trx);
+ 
+ #ifdef UNIV_DEBUG
+               buf_dbg_counter++;
+@@ -1261,6 +1293,11 @@
+                       /* Let us wait until the read operation
+                       completes */
+ 
++                      if (trx)
++                      {
++                              ut_usectime(&sec, &ms);
++                              start_time = (ib_longlong)sec * 1000000 + ms;
++                      }
+                       for (;;) {
+                               mutex_enter(&block->mutex);
+ 
+@@ -1275,6 +1312,12 @@
+ 
+                                      break;
+                               }
++                      }
++                      if (trx)
++                      {
++                              ut_usectime(&sec, &ms);
++                              finish_time = (ib_longlong)sec * 1000000 + ms;
++                              trx->io_reads_wait_timer += (ulint)(finish_time 
- start_time);
+                       }
+               }
+ 
+@@ -1296,12 +1339,15 @@
+               /* In the case of a first access, try to apply linear
+               read-ahead */
+ 
+-              buf_read_ahead_linear(space, offset);
++              buf_read_ahead_linear(space, offset, trx);
+       }
+ 
+ #ifdef UNIV_IBUF_DEBUG
+       ut_a(ibuf_count_get(block->space, block->offset) == 0);
+ #endif
++
++      _increment_page_get_statistics(block, trx);
++      
+       return(block->frame);           
+ }
+ 
+@@ -1326,6 +1372,7 @@
+       ibool           accessed;
+       ibool           success;
+       ulint           fix_type;
++      trx_t*          trx;
+ 
+       ut_ad(mtr && block);
+       ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
+@@ -1440,13 +1487,16 @@
+               read-ahead */
+ 
+               buf_read_ahead_linear(buf_frame_get_space_id(guess),
+-                                      buf_frame_get_page_no(guess));
++                                      buf_frame_get_page_no(guess), trx);
+       }
+ 
+ #ifdef UNIV_IBUF_DEBUG
+       ut_a(ibuf_count_get(block->space, block->offset) == 0);
+ #endif
+       buf_pool->n_page_gets++;
++
++      trx = thr_local_get_trx(os_thread_get_curr_id());
++      _increment_page_get_statistics(block, trx);
+ 
+       return(TRUE);
<<Diff was trimmed, longer than 597 lines>>
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to