1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-37672: Remove innodb_trx_rseg_n_slots_debug

The debug parameter innodb_trx_rseg_n_slots_debug is not compatible
with the bug fix that was implemented in MDEV-30671 and last revised
in MDEV-33213, which leads to bogus assertion failures in
trx_assign_rseg_low(), regarding look_for_rollover. When needed,
this parameter can be better simulated by adding a DBUG_EXECUTE_IF to
trx_undo_seg_create() or one of its callers.
This commit is contained in:
Marko Mäkelä
2025-10-22 09:33:53 +03:00
parent 315b60e885
commit c083f191b4
12 changed files with 0 additions and 279 deletions

View File

@@ -1,18 +0,0 @@
call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too");
drop database if exists mysqltest;
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
connection default;
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
ERROR HY000: Can't create table `mysqltest`.`testtable` (errno: 177 "Too many active concurrent transactions")
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
connection default;
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
drop database mysqltest;

View File

@@ -1,102 +0,0 @@
# Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
# Don't test under valgrind, undo slots of the previous test might exist still
# and cause unstable result.
--source include/not_valgrind.inc
# undo slots of the previous test might exist still
--source include/not_windows.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too");
--disable_query_log
set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
set global innodb_trx_rseg_n_slots_debug = 32;
--enable_query_log
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
--disable_query_log
#
# Insert in 1 transaction which needs over 1 page undo record to avoid the insert_undo cached,
# because the cached insert_undo can be reused at "CREATE TABLE" statement later.
#
START TRANSACTION;
let $c = 1024;
while ($c)
{
eval INSERT INTO mysqltest.transtable (id) VALUES ($c);
dec $c;
}
COMMIT;
let $c = 32;
while ($c)
{
# if failed at here, it might be shortage of file descriptors limit.
connect (con$c,localhost,root,,);
dec $c;
}
--enable_query_log
select count(*) from information_schema.processlist where command != 'Daemon';
#
# fill the all undo slots
#
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
START TRANSACTION;
eval UPDATE mysqltest.transtable SET val = 1 WHERE id = 33 - $c;
dec $c;
}
--enable_query_log
connection default;
--error ER_CANT_CREATE_TABLE
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
select count(*) from information_schema.processlist where command != 'Daemon';
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
ROLLBACK;
dec $c;
}
--enable_query_log
connection default;
select count(*) from information_schema.processlist where command != 'Daemon';
--disable_query_log
let $c = 32;
while ($c)
{
disconnect con$c;
dec $c;
}
--enable_query_log
#
# If the isolated .ibd file remained, the drop database should fail.
#
drop database mysqltest;
--disable_query_log
set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
--enable_query_log

View File

@@ -491,7 +491,6 @@ insert into test.sanity values
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_SYNC_SPIN_LOOPS"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TEMP_DATA_FILE_PATH"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TRX_RSEG_N_SLOTS_DEBUG"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_DIRECTORY"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_LOG_TRUNCATE"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_TABLESPACES"),

View File

@@ -1,65 +0,0 @@
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
@start_global_value
0
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
@@global.innodb_trx_rseg_n_slots_debug between 0 and 1024
1
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select @@session.innodb_trx_rseg_n_slots_debug;
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable
show global variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
show session variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
1
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set session innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_trx_rseg_n_slots_debug=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug='foo';
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=-2;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '-2'
set global innodb_trx_rseg_n_slots_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '1025'
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0

View File

@@ -1663,18 +1663,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INNODB_TRX_RSEG_N_SLOTS_DEBUG
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INNODB_UNDO_DIRECTORY
SESSION_VALUE NULL
DEFAULT_VALUE

View File

@@ -1,59 +0,0 @@
--source include/have_innodb.inc
--source include/have_debug.inc
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
#
# exists as global only
#
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
select @@global.innodb_trx_rseg_n_slots_debug;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_trx_rseg_n_slots_debug;
show global variables like 'innodb_trx_rseg_n_slots_debug';
show session variables like 'innodb_trx_rseg_n_slots_debug';
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
#
# show that it's writable
#
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
--error ER_GLOBAL_VARIABLE
set session innodb_trx_rseg_n_slots_debug='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_trx_rseg_n_slots_debug='some';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug='foo';
set global innodb_trx_rseg_n_slots_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1e1;
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
#
# Cleanup
#
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;

View File

@@ -19623,11 +19623,6 @@ static MYSQL_SYSVAR_ENUM(default_row_format, innodb_default_row_format,
&innodb_default_row_format_typelib);
#ifdef UNIV_DEBUG
static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT,
"Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()",
NULL, NULL, 0, 0, 1024, 0);
static MYSQL_SYSVAR_UINT(limit_optimistic_insert_debug,
btr_cur_limit_optimistic_insert_debug, PLUGIN_VAR_RQCMDARG,
"Artificially limit the number of records per B-tree page (0=unlimited).",
@@ -19900,7 +19895,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_pad_pct_max),
MYSQL_SYSVAR(default_row_format),
#ifdef UNIV_DEBUG
MYSQL_SYSVAR(trx_rseg_n_slots_debug),
MYSQL_SYSVAR(limit_optimistic_insert_debug),
MYSQL_SYSVAR(trx_purge_view_update_only_debug),
MYSQL_SYSVAR(evict_tables_on_commit_debug),

View File

@@ -70,11 +70,6 @@ inline buf_block_t *trx_sysf_get(mtr_t* mtr, bool rw= true)
0, rw ? RW_X_LATCH : RW_S_LATCH, mtr);
}
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
extern uint trx_rseg_n_slots_debug;
#endif
/** Write DB_TRX_ID.
@param[out] db_trx_id the DB_TRX_ID field to be written to
@param[in] id transaction ID */

View File

@@ -437,7 +437,6 @@ loop:
rollback segment. */
if (!(rseg.SKIP & rseg_ref) && !freed &&
ut_d(!trx_rseg_n_slots_debug &&)
&rseg == &trx_sys.rseg_array[purge_sys.skipped_rseg])
/* If rseg.space == purge_sys.truncate_undo_space.current
the following will be a no-op. A possible conflict

View File

@@ -45,9 +45,6 @@ Created 3/26/1996 Heikki Tuuri
trx_sys_t trx_sys;
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
uint trx_rseg_n_slots_debug = 0;
void rw_trx_hash_t::validate_element(trx_t *trx)
{
ut_ad(!trx->read_only || !trx->rsegs.m_redo.rseg);

View File

@@ -802,7 +802,6 @@ static void trx_assign_rseg_low(trx_t *trx)
undo tablespaces that are scheduled for truncation. */
static Atomic_counter<unsigned> rseg_slot;
unsigned slot = rseg_slot++ % TRX_SYS_N_RSEGS;
ut_d(if (trx_rseg_n_slots_debug) slot = 0);
ut_d(const auto start_scan_slot = slot);
ut_d(bool look_for_rollover = false);
trx_rseg_t* rseg;
@@ -814,7 +813,6 @@ static void trx_assign_rseg_low(trx_t *trx)
rseg = &trx_sys.rseg_array[slot];
ut_ad(!look_for_rollover || start_scan_slot != slot);
ut_d(look_for_rollover = true);
ut_d(if (!trx_rseg_n_slots_debug))
slot = (slot + 1) % TRX_SYS_N_RSEGS;
if (!rseg->space) {

View File

@@ -434,11 +434,6 @@ static ulint trx_rsegf_undo_find_free(const buf_block_t *rseg_header)
{
ulint max_slots= TRX_RSEG_N_SLOTS;
#ifdef UNIV_DEBUG
if (trx_rseg_n_slots_debug)
max_slots= std::min<ulint>(trx_rseg_n_slots_debug, TRX_RSEG_N_SLOTS);
#endif
for (ulint i= 0; i < max_slots; i++)
if (trx_rsegf_get_nth_undo(rseg_header, i) == FIL_NULL)
return i;