MDEV-29166: reduce locking of innodb rseg for user exposure of innodb_history_list_length

SHOW ENGINE INNODB STATUS and SHOW GLOBAL VARIABLES were blocking on the locks used
to access the history length in MDEV-29141. While the reason for the blockage
was elsewhere, we should make these monitoring commands less blocking as there
is a trx_sys.history_size_approx function that can be used.

SHOW ENGINE INNODB STATUS and SHOW GLOBAL STATUS LIKE
'innodb_history_list_length' and Innodb Monitors can use
trx_sys.history_size_approx().
This commit is contained in:
Daniel Black 2022-07-25 21:00:47 +10:00 committed by Marko Mäkelä
parent b9eb63618e
commit 552919d041
3 changed files with 3 additions and 3 deletions

View file

@ -4368,7 +4368,7 @@ lock_print_info_summary(
? (purge_sys.running() ? "running"
: purge_sys.paused() ? "stopped" : "running but idle")
: "disabled",
trx_sys.history_size());
trx_sys.history_size_approx());
#ifdef PRINT_NUM_OF_LOCK_STRUCTS
fprintf(file,

View file

@ -1682,7 +1682,7 @@ srv_mon_process_existing_counter(
break;
case MONITOR_RSEG_HISTORY_LEN:
value = trx_sys.history_size();
value = trx_sys.history_size_approx();
break;
case MONITOR_RSEG_CUR_SIZE:

View file

@ -1085,7 +1085,7 @@ srv_export_innodb_status(void)
- UT_LIST_GET_LEN(buf_pool.free);
export_vars.innodb_max_trx_id = trx_sys.get_max_trx_id();
export_vars.innodb_history_list_length = trx_sys.history_size();
export_vars.innodb_history_list_length = trx_sys.history_size_approx();
export_vars.innodb_log_waits = srv_stats.log_waits;