Commit a6cff02a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-25687: Remove trx_active_transactions

MONITOR_TRX_ACTIVE: Remove. The count is not being updated consistently,
and it would also include read-only transactions that are otherwise
fully invisible to any other threads.

If it later turns out that a reliable count of active transactions
is needed, it can be exposed via a different interface.

trx_commit_for_mysql(): If the transaction was not started, return
immediately.
parent cdbd04dd
...@@ -167,7 +167,6 @@ trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N ...@@ -167,7 +167,6 @@ trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N
trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates
trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back
trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint
trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of active transactions
trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list
trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used
trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached
......
...@@ -133,7 +133,6 @@ trx_nl_ro_commits disabled ...@@ -133,7 +133,6 @@ trx_nl_ro_commits disabled
trx_commits_insert_update disabled trx_commits_insert_update disabled
trx_rollbacks disabled trx_rollbacks disabled
trx_rollbacks_savepoint disabled trx_rollbacks_savepoint disabled
trx_active_transactions disabled
trx_rseg_history_len disabled trx_rseg_history_len disabled
trx_undo_slots_used disabled trx_undo_slots_used disabled
trx_undo_slots_cached disabled trx_undo_slots_cached disabled
...@@ -426,10 +425,9 @@ select name, max_count, min_count, count, ...@@ -426,10 +425,9 @@ select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, max_count_reset, min_count_reset, count_reset,
if(enabled,'enabled','disabled') status if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics from information_schema.innodb_metrics
where name like "trx_rollbacks" or name like "trx_active_transactions"; where name='trx_rollbacks';
name max_count min_count count max_count_reset min_count_reset count_reset status name max_count min_count count max_count_reset min_count_reset count_reset status
trx_rollbacks 1 NULL 1 1 NULL 1 enabled trx_rollbacks 1 NULL 1 1 NULL 1 enabled
trx_active_transactions 1 0 0 1 0 0 enabled
set global innodb_monitor_disable = module_trx; set global innodb_monitor_disable = module_trx;
set global innodb_monitor_enable = module_dml; set global innodb_monitor_enable = module_dml;
insert into monitor_test values(9); insert into monitor_test values(9);
......
...@@ -268,7 +268,7 @@ select name, max_count, min_count, count, ...@@ -268,7 +268,7 @@ select name, max_count, min_count, count,
max_count_reset, min_count_reset, count_reset, max_count_reset, min_count_reset, count_reset,
if(enabled,'enabled','disabled') status if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics from information_schema.innodb_metrics
where name like "trx_rollbacks" or name like "trx_active_transactions"; where name='trx_rollbacks';
set global innodb_monitor_disable = module_trx; set global innodb_monitor_disable = module_trx;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2020, MariaDB Corporation. Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -285,7 +285,6 @@ enum monitor_id_t { ...@@ -285,7 +285,6 @@ enum monitor_id_t {
MONITOR_TRX_COMMIT_UNDO, MONITOR_TRX_COMMIT_UNDO,
MONITOR_TRX_ROLLBACK, MONITOR_TRX_ROLLBACK,
MONITOR_TRX_ROLLBACK_SAVEPOINT, MONITOR_TRX_ROLLBACK_SAVEPOINT,
MONITOR_TRX_ACTIVE,
MONITOR_RSEG_HISTORY_LEN, MONITOR_RSEG_HISTORY_LEN,
MONITOR_NUM_UNDO_SLOT_USED, MONITOR_NUM_UNDO_SLOT_USED,
MONITOR_NUM_UNDO_SLOT_CACHED, MONITOR_NUM_UNDO_SLOT_CACHED,
......
...@@ -723,11 +723,6 @@ static monitor_info_t innodb_counter_info[] = ...@@ -723,11 +723,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE, MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_SAVEPOINT}, MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_SAVEPOINT},
{"trx_active_transactions", "transaction",
"Number of active transactions",
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_TRX_ACTIVE},
{"trx_rseg_history_len", "transaction", {"trx_rseg_history_len", "transaction",
"Length of the TRX_RSEG_HISTORY list", "Length of the TRX_RSEG_HISTORY list",
static_cast<monitor_type_t>( static_cast<monitor_type_t>(
......
...@@ -141,8 +141,6 @@ inline void trx_t::rollback_low(trx_savept_t *savept) ...@@ -141,8 +141,6 @@ inline void trx_t::rollback_low(trx_savept_t *savept)
} }
mem_heap_free(heap); mem_heap_free(heap);
MONITOR_DEC(MONITOR_TRX_ACTIVE);
} }
/** Initiate rollback. /** Initiate rollback.
......
...@@ -993,8 +993,6 @@ trx_start_low( ...@@ -993,8 +993,6 @@ trx_start_low(
: microsecond_interval_timer(); : microsecond_interval_timer();
ut_a(trx->error_state == DB_SUCCESS); ut_a(trx->error_state == DB_SUCCESS);
MONITOR_INC(MONITOR_TRX_ACTIVE);
} }
/** Set the serialisation number for a persistent committed transaction. /** Set the serialisation number for a persistent committed transaction.
...@@ -1612,17 +1610,12 @@ trx_commit_for_mysql( ...@@ -1612,17 +1610,12 @@ trx_commit_for_mysql(
switch (trx->state) { switch (trx->state) {
case TRX_STATE_NOT_STARTED: case TRX_STATE_NOT_STARTED:
ut_d(trx->start_file = __FILE__); return DB_SUCCESS;
ut_d(trx->start_line = __LINE__);
trx_start_low(trx, true);
/* fall through */
case TRX_STATE_ACTIVE: case TRX_STATE_ACTIVE:
case TRX_STATE_PREPARED: case TRX_STATE_PREPARED:
case TRX_STATE_PREPARED_RECOVERED: case TRX_STATE_PREPARED_RECOVERED:
trx->op_info = "committing"; trx->op_info = "committing";
trx->commit(); trx->commit();
MONITOR_DEC(MONITOR_TRX_ACTIVE);
trx->op_info = ""; trx->op_info = "";
return(DB_SUCCESS); return(DB_SUCCESS);
case TRX_STATE_COMMITTED_IN_MEMORY: case TRX_STATE_COMMITTED_IN_MEMORY:
......
...@@ -149,7 +149,6 @@ trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N ...@@ -149,7 +149,6 @@ trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL N
trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions committed with inserts and updates
trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back
trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of transactions rolled back to savepoint
trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of active transactions
trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Length of the TRX_RSEG_HISTORY list
trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots used
trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of undo slots cached
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment