diff -ru mysql-5.0.41_orig/innobase/include/srv0srv.h mysql-5.0.41/innobase/include/srv0srv.h --- mysql-5.0.41_orig/innobase/include/srv0srv.h 2007-05-02 23:40:38.000000000 +0900 +++ mysql-5.0.41/innobase/include/srv0srv.h 2007-05-23 15:05:11.000000000 +0900 @@ -131,6 +131,11 @@ extern ulong srv_max_purge_lag; extern ibool srv_use_awe; extern ibool srv_use_adaptive_hash_indexes; + +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 -ru mysql-5.0.41_orig/innobase/srv/srv0srv.c mysql-5.0.41/innobase/srv/srv0srv.c --- mysql-5.0.41_orig/innobase/srv/srv0srv.c 2007-05-02 23:39:48.000000000 +0900 +++ mysql-5.0.41/innobase/srv/srv0srv.c 2007-05-23 15:05:11.000000000 +0900 @@ -322,6 +322,10 @@ ibool srv_use_awe = FALSE; ibool srv_use_adaptive_hash_indexes = TRUE; +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; @@ -2282,7 +2286,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"; @@ -2295,7 +2299,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 @@ -2333,7 +2337,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(); @@ -2343,7 +2347,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(); @@ -2385,14 +2389,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); } @@ -2481,7 +2485,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"; @@ -2498,7 +2502,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 -ru mysql-5.0.41_orig/sql/ha_innodb.h mysql-5.0.41/sql/ha_innodb.h --- mysql-5.0.41_orig/sql/ha_innodb.h 2007-05-02 23:40:53.000000000 +0900 +++ mysql-5.0.41/sql/ha_innodb.h 2007-05-23 15:05:11.000000000 +0900 @@ -232,6 +232,10 @@ extern ulong srv_thread_concurrency; extern ulong srv_commit_concurrency; extern ulong srv_flush_log_at_trx_commit; +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 -ru mysql-5.0.41_orig/sql/mysqld.cc mysql-5.0.41/sql/mysqld.cc --- mysql-5.0.41_orig/sql/mysqld.cc 2007-05-02 23:39:46.000000000 +0900 +++ mysql-5.0.41/sql/mysqld.cc 2007-05-23 15:05:11.000000000 +0900 @@ -4773,7 +4773,9 @@ OPT_MERGE, OPT_PROFILING, OPT_INNODB_ROLLBACK_ON_TIMEOUT, - OPT_SECURE_FILE_PRIV + OPT_SECURE_FILE_PRIV, + OPT_INNODB_IBUF_CONTRACT_CONST, OPT_INNODB_IBUF_CONTRACT_BURST, + OPT_INNODB_BUF_FLUSH_CONST, OPT_INNODB_BUF_FLUSH_BURST }; @@ -5071,6 +5073,22 @@ (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_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, 10000, 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, 10000, 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 -ru mysql-5.0.41_orig/sql/set_var.cc mysql-5.0.41/sql/set_var.cc --- mysql-5.0.41_orig/sql/set_var.cc 2007-05-02 23:40:28.000000000 +0900 +++ mysql-5.0.41/sql/set_var.cc 2007-05-23 15:05:11.000000000 +0900 @@ -455,6 +455,14 @@ 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_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 */ @@ -795,6 +803,10 @@ &sys_innodb_thread_concurrency, &sys_innodb_commit_concurrency, &sys_innodb_flush_log_at_trx_commit, + &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, @@ -927,6 +939,10 @@ {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_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},