Index: buf/buf0flu.cc =================================================================== --- buf/buf0flu.cc (revision 3873) +++ buf/buf0flu.cc (working copy) @@ -59,6 +59,7 @@ doing the shutdown */ UNIV_INTERN ibool buf_page_cleaner_is_active = FALSE; +UNIV_INTERN ullint srv_page_cleaner_sleep_max = 1000000; /** LRU flush batch is further divided into this chunk size to reduce the wait time for the threads waiting for a clean block */ #define PAGE_CLEANER_LRU_BATCH_CHUNK_SIZE 100 @@ -2336,10 +2337,15 @@ /* Get sleep interval in micro seconds. We use ut_min() to avoid long sleep in case of wrap around. */ - os_thread_sleep(ut_min(1000000, - (next_loop_time - cur_time) - * 1000)); - } + long long min_time = (ut_min(srv_page_cleaner_sleep_max, + (next_loop_time - cur_time)*1000)); + + export_vars.innodb_pc_sleep_sum+=min_time; + + export_vars.innodb_pc_sleep_num++; + + os_thread_sleep(min_time); + } } /******************************************************************//** Index: handler/ha_innodb.cc =================================================================== --- handler/ha_innodb.cc (revision 3873) +++ handler/ha_innodb.cc (working copy) @@ -639,6 +639,10 @@ {"purge_view_trx_id_age", (char*) &export_vars.innodb_purge_view_trx_id_age, SHOW_LONG}, #endif /* UNIV_DEBUG */ + {"pc_sleep_num", + (char*) &export_vars.innodb_pc_sleep_num, SHOW_LONG}, + {"pc_sleep_sum", + (char*) &export_vars.innodb_pc_sleep_sum, SHOW_LONGLONG}, {NullS, NullS, SHOW_LONG} }; @@ -15738,6 +15742,11 @@ NULL, NULL, 120, 1, 127, 0); #endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */ +static MYSQL_SYSVAR_ULONGLONG (page_cleaner_sleep_max, srv_page_cleaner_sleep_max, + PLUGIN_VAR_OPCMDARG, + "set the max sleep time of page clearner sleep if sleep is needed," + "default 1,000,000 millisecond", NULL, NULL, 1000000, 1, 2000000, 0); + static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Number of buffer pool instances, set to higher value on high-end machines to increase scalability", @@ -16327,6 +16336,7 @@ MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(trx_purge_view_update_only_debug), #endif /* UNIV_DEBUG */ + MYSQL_SYSVAR(page_cleaner_sleep_max), NULL }; Index: include/srv0srv.h =================================================================== --- include/srv0srv.h (revision 3873) +++ include/srv0srv.h (working copy) @@ -347,6 +347,7 @@ extern ibool srv_use_doublewrite_buf; extern ulong srv_doublewrite_batch_size; extern ulong srv_checksum_algorithm; +extern ullint srv_page_cleaner_sleep_max; extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; @@ -845,6 +846,8 @@ ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id - purged view's min trx_id */ #endif /* UNIV_DEBUG */ + ulint innodb_pc_sleep_num; + long long innodb_pc_sleep_sum; }; /** Thread slot in the thread table. */