From 4c94da8e6d8b54ad9884875165bfad9972e29323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Aug 2020 18:12:19 +0300 Subject: MDEV-23475 InnoDB performance regression for write-heavy workloads In commit fe39d02f51b96536dccca7ff89faf05e13548877 (MDEV-20638) we removed some wake-up signaling of the master thread that should have been there, to ensure a steady log checkpointing workload. trx_flush_log_if_needed_low(): Invoke srv_inc_activity_count(). This covers both COMMIT and ROLLBACK, which should also be executed as part of DDL operations. innobase_active_small(): Reinstate the function. This appears to be necessary in order to avoid a performance regression at low concurrency when sync_binlog=1. --- extra/mariabackup/xtrabackup.cc | 3 --- storage/innobase/handler/ha_innodb.cc | 13 +++++++++++++ storage/innobase/trx/trx0trx.cc | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 9b3d9f9ea39..52958e0abe7 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -254,9 +254,6 @@ my_bool innobase_locks_unsafe_for_binlog; my_bool innobase_rollback_on_timeout; my_bool innobase_create_status_file; -ulong innobase_active_counter = 0; - - static char *xtrabackup_debug_sync = NULL; my_bool xtrabackup_incremental_force_scan = FALSE; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 8b58ca57a74..06a8f4ed264 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -446,6 +446,14 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = { NULL }; +/** Notify the master thread that there may be work to do */ +inline void innobase_active_small() +{ + static size_t count; + if (!(++count & 31)) + srv_inc_activity_count(); +} + /** Allowed values of innodb_change_buffering */ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ @@ -8321,6 +8329,8 @@ report_error: } func_exit: + innobase_active_small(); + DBUG_RETURN(error_result); } @@ -8991,6 +9001,8 @@ func_exit: error, m_prebuilt->table->flags, m_user_thd); } + innobase_active_small(); + #ifdef WITH_WSREP if (error == DB_SUCCESS && trx->is_wsrep() && wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE && @@ -9045,6 +9057,7 @@ ha_innobase::delete_row( error = row_update_for_mysql(m_prebuilt); innobase_srv_conc_exit_innodb(m_prebuilt); + innobase_active_small(); #ifdef WITH_WSREP if (error == DB_SUCCESS && trx->is_wsrep() diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 0dbd985b6c3..117ff64761c 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1537,6 +1537,7 @@ trx_flush_log_if_needed_low( case 1: /* Write the log and optionally flush it to disk */ log_write_up_to(lsn, flush); + srv_inc_activity_count(); return; case 0: /* Do nothing */ -- cgit v1.2.1