Skip to content

Commit 2ba9702

Browse files
committed
MDEV-32050: Boost innodb_purge_batch_size on slow shutdown
A slow shutdown using the previous default innodb_purge_batch_size=300 could be extremely slow, employing at most a few CPU cores on the average. Let us use the maximum batch size in order to increase throughput. Reviewed by: Vladislav Lesin
1 parent aa719b5 commit 2ba9702

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18854,7 +18854,7 @@ static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
1885418854
NULL, NULL,
1885518855
1000, /* Default setting */
1885618856
1, /* Minimum value */
18857-
5000, 0); /* Maximum value */
18857+
innodb_purge_batch_size_MAX, 0);
1885818858

1885918859
static MYSQL_SYSVAR_UINT(purge_threads, srv_n_purge_threads,
1886018860
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,

storage/innobase/include/trx0types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static const ulint TRX_SYS_SPACE = 0;
4747
static const ulint TRX_MAGIC_N = 91118598;
4848

4949
constexpr uint innodb_purge_threads_MAX= 32;
50+
constexpr uint innodb_purge_batch_size_MAX= 5000;
5051

5152
/** Transaction states (trx_t::state) */
5253
enum trx_state_t {

storage/innobase/srv/srv0srv.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,10 @@ void srv_purge_shutdown()
17791779
if (purge_sys.enabled())
17801780
{
17811781
if (!srv_fast_shutdown && !opt_bootstrap)
1782+
{
1783+
srv_purge_batch_size= innodb_purge_batch_size_MAX;
17821784
srv_update_purge_thread_count(innodb_purge_threads_MAX);
1785+
}
17831786
size_t history_size= trx_sys.history_size();
17841787
while (!srv_purge_should_exit(history_size))
17851788
{

0 commit comments

Comments
 (0)