srv_force_recovery = (ulint) innobase_force_recovery;
srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
-@@ -10992,9 +11012,9 @@
-
- static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
+@@ -11001,7 +11021,7 @@
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
-- "Purge threads can be either 0 or 1. Default is 0.",
-+ "Purge threads can be either 0 or 1. Default is 1.",
+ "Purge threads can be either 0 or 1.",
NULL, NULL,
- 0, /* Default setting */
+ 1, /* Default setting */
0, /* Minimum value */
1, 0); /* Maximum value */
-@@ -11036,12 +11056,18 @@
+@@ -11043,12 +11063,18 @@
innodb_file_format_max_validate,
innodb_file_format_max_update, "Antelope");
static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11136,7 +11162,7 @@
+@@ -11143,7 +11169,7 @@
static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-@@ -11288,6 +11314,95 @@
+@@ -11295,6 +11321,95 @@
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
-@@ -11308,6 +11423,7 @@
+@@ -11315,6 +11430,7 @@
MYSQL_SYSVAR(file_format_check),
MYSQL_SYSVAR(file_format_max),
MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
MYSQL_SYSVAR(locks_unsafe_for_binlog),
-@@ -11345,6 +11461,13 @@
+@@ -11352,6 +11468,13 @@
MYSQL_SYSVAR(show_verbose_locks),
MYSQL_SYSVAR(show_locks_held),
MYSQL_SYSVAR(version),
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
-@@ -394,8 +405,9 @@
+@@ -397,8 +408,9 @@
when writing data files, but do flush
after writing to log files */
SRV_UNIX_NOSYNC, /*!< do not flush after writing */
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
-@@ -406,6 +407,17 @@
+@@ -409,6 +410,17 @@
UNIV_INTERN ulong srv_replication_delay = 0;
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
-@@ -2742,6 +2754,7 @@
+@@ -2745,6 +2757,7 @@
ulint n_pages_purged = 0;
ulint n_bytes_merged;
ulint n_pages_flushed;
ulint n_bytes_archived;
ulint n_tables_to_drop;
ulint n_ios;
-@@ -2749,7 +2762,20 @@
+@@ -2752,7 +2765,20 @@
ulint n_ios_very_old;
ulint n_pend_ios;
ulint next_itr_time;
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Master thread starts, id %lu\n",
-@@ -2771,6 +2797,9 @@
+@@ -2774,6 +2800,9 @@
mutex_exit(&kernel_mutex);
loop:
/*****************************************************************/
/* ---- When there is database activity by users, we cycle in this
-@@ -2801,9 +2830,13 @@
+@@ -2804,9 +2833,13 @@
/* Sleep for 1 second on entrying the for loop below the first time. */
next_itr_time = ut_time_ms() + 1000;
/* ALTER TABLE in MySQL requires on Unix that the table handler
can drop tables lazily after there no longer are SELECT
queries to them. */
-@@ -2827,6 +2860,7 @@
+@@ -2830,6 +2863,7 @@
srv_main_thread_op_info = "sleeping";
srv_main_1_second_loops++;
if (next_itr_time > cur_time
&& srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-@@ -2837,10 +2871,26 @@
+@@ -2840,10 +2874,26 @@
(next_itr_time - cur_time)
* 1000));
srv_main_sleeps++;
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -2860,7 +2910,7 @@
+@@ -2863,7 +2913,7 @@
if (n_pend_ios < SRV_PEND_IO_THRESHOLD
&& (n_ios - n_ios_old < SRV_RECENT_IO_ACTIVITY)) {
srv_main_thread_op_info = "doing insert buffer merge";
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -2877,7 +2927,11 @@
+@@ -2880,7 +2930,11 @@
n_pages_flushed = buf_flush_list(
PCT_IO(100), IB_ULONGLONG_MAX);
/* Try to keep the rate of flushing of dirty
pages such that redo log generation does not
-@@ -2893,6 +2947,224 @@
+@@ -2896,6 +2950,224 @@
n_flush,
IB_ULONGLONG_MAX);
}
}
if (srv_activity_count == old_activity_count) {
-@@ -2941,7 +3213,7 @@
+@@ -2944,7 +3216,7 @@
even if the server were active */
srv_main_thread_op_info = "doing insert buffer merge";
/* Flush logs if needed */
srv_sync_log_buffer_in_background();
-@@ -3049,7 +3321,7 @@
+@@ -3052,7 +3324,7 @@
buf_flush_list below. Otherwise, the system favors
clean pages over cleanup throughput. */
n_bytes_merged = ibuf_contract_for_n_pages(FALSE,
}
srv_main_thread_op_info = "reserving kernel mutex";
-@@ -3195,6 +3467,7 @@
- srv_slot_t* slot;
+@@ -3199,6 +3471,7 @@
+ ulint retries = 0;
ulint slot_no = ULINT_UNDEFINED;
ulint n_total_purged = ULINT_UNDEFINED;
+ ulint next_itr_time;
ut_a(srv_n_purge_threads == 1);
-@@ -3217,9 +3490,12 @@
+@@ -3221,9 +3494,12 @@
mutex_exit(&kernel_mutex);
+
while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
- ulint n_pages_purged;
+ ulint n_pages_purged = 0;
+ ulint cur_time;
/* If there are very few records to purge or the last
purge didn't purge any records then wait for activity.
-@@ -3260,6 +3536,16 @@
+@@ -3272,6 +3548,16 @@
} while (n_pages_purged > 0 && !srv_fast_shutdown);
srv_sync_log_buffer_in_background();
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
--- a/storage/innobase/srv/srv0start.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/srv/srv0start.c 2010-12-03 15:10:09.103023543 +0900
-@@ -1212,6 +1212,9 @@
+@@ -1218,6 +1218,9 @@
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
+diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
+--- a/storage/innobase/trx/trx0purge.c 2011-04-12 14:14:14.000000000 +0900
++++ b/storage/innobase/trx/trx0purge.c 2011-04-12 14:15:44.000000000 +0900
+@@ -392,10 +392,10 @@
+ trx_sys->rseg_history_len++;
+ mutex_exit(&kernel_mutex);
+
+- if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) {
++// if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) { /*should wake up always*/
+ /* Inform the purge thread that there is work to do. */
+ srv_wake_purge_thread_if_not_active();
+- }
++// }
+ }
+
+ /**********************************************************************//**
diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
--- a/storage/innobase/trx/trx0trx.c 2010-11-03 07:01:13.000000000 +0900
+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 15:10:09.106023937 +0900
-@@ -865,6 +865,7 @@
+@@ -925,6 +925,7 @@
trx->read_view = NULL;
if (lsn) {
mutex_exit(&kernel_mutex);
-@@ -873,6 +874,12 @@
+@@ -933,6 +934,12 @@
trx_undo_insert_cleanup(trx);
}
/* NOTE that we could possibly make a group commit more
efficient here: call os_thread_yield here to allow also other
trxs to come to commit! */
-@@ -904,9 +911,9 @@
+@@ -964,9 +971,9 @@
if (trx->flush_log_later) {
/* Do nothing yet */
trx->must_flush_log_later = TRUE;
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
-@@ -918,7 +925,7 @@
+@@ -978,7 +985,7 @@
log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
}
/* Write the log but do not flush it to disk */
-@@ -1582,16 +1589,23 @@
+@@ -1642,16 +1649,23 @@
trx_t* trx) /*!< in: trx handle */
{
ib_uint64_t lsn = trx->commit_lsn;
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
-@@ -1602,7 +1616,7 @@
+@@ -1662,7 +1676,7 @@
log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
}
/* Write the log but do not flush it to disk */
-@@ -1855,6 +1869,8 @@
+@@ -1915,6 +1929,8 @@
/*--------------------------------------*/
if (lsn) {
/* Depending on the my.cnf options, we may now write the log
buffer to the log files, making the prepared state of the
transaction durable if the OS does not crash. We may also
-@@ -1874,9 +1890,15 @@
+@@ -1934,9 +1950,15 @@
mutex_exit(&kernel_mutex);
if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
/* Write the log but do not flush it to disk */
-@@ -1888,7 +1910,7 @@
+@@ -1948,7 +1970,7 @@
log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
}