diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-22 17:46:49 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-22 18:12:44 +0200 |
commit | 0f8caadc96d1b34ac6bfe980fba660166ed65f9b (patch) | |
tree | 9e9923c2e46521a73ec0ffc8aecc7385dcf9acb7 | |
parent | 0e9657017189883d3fbe3604e96fad9fc558dc23 (diff) | |
download | mariadb-git-0f8caadc96d1b34ac6bfe980fba660166ed65f9b.tar.gz |
MDEV-22653: Remove the useless parameter innodb_simulate_comp_failures
The debug parameter innodb_simulate_comp_failures injected compression
failures for ROW_FORMAT=COMPRESSED tables, breaking the pre-existing
logic that I had implemented in the InnoDB Plugin for MySQL 5.1 to prevent
compressed page overflows. A much better check is already achieved by
defining UNIV_ZIP_COPY at the compilation time.
(Only UNIV_ZIP_DEBUG is part of cmake -DWITH_INNODB_EXTRA_DEBUG=ON.)
14 files changed, 0 insertions, 400 deletions
diff --git a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc b/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc deleted file mode 100644 index d9c0294faf5..00000000000 --- a/mysql-test/suite/innodb/include/innodb_simulate_comp_failures.inc +++ /dev/null @@ -1,152 +0,0 @@ ---echo # ---echo # Testing robustness against random compression failures ---echo # - ---source include/not_embedded.inc ---source include/have_innodb.inc - ---let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures` - ---disable_query_log -call mtr.add_suppression("InnoDB: Simulating a compression failure for table `test`\\.`t1`"); ---enable_query_log - -# create the table with compressed pages of size 8K. -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; - -SHOW CREATE TABLE t1; - -# percentage of compressions that will be forced to fail -SET GLOBAL innodb_simulate_comp_failures = 25; - ---disable_query_log ---disable_result_log - -let $num_inserts_ind = $num_inserts; -let $commit_iterations=50; - -while ($num_inserts_ind) -{ - let $repeat = `select floor(rand() * 10)`; - eval INSERT INTO t1(id, msg) - VALUES ($num_inserts_ind, REPEAT('abcdefghijklmnopqrstuvwxyz', $repeat)); - dec $num_inserts_ind; -} - ---enable_query_log ---enable_result_log - -COMMIT; -SELECT COUNT(id) FROM t1; - ---disable_query_log ---disable_result_log - -# do random ops, making sure that some pages will get fragmented and reorganized. -let $num_ops_ind = $num_ops; -let $commit_count= $commit_iterations; - -BEGIN; - -while($num_ops_ind) -{ - let $idx = `select floor(rand()*$num_inserts)`; - let $insert_or_update = `select floor(rand()*3)`; - - let $repeat = `select floor(rand() * 9) + 1`; - - let $msg = query_get_value(`select repeat('abcdefghijklmnopqrstuvwxyz', $repeat) as x`, x, 1); - - let $single_or_multi = `select floor(rand()*10)`; - - if ($insert_or_update) - { - let $cnt = query_get_value(SELECT COUNT(*) cnt FROM t1 WHERE id=$idx, cnt, 1); - - if ($cnt) - { - let $update = `select floor(rand()*2)`; - - if ($update) - { - if ($single_or_multi) - { - eval UPDATE t1 SET msg=\"$msg\" WHERE id=$idx; - } - - if (!$single_or_multi) - { - eval UPDATE t1 SET msg=\"$msg\" WHERE id >= $idx - 100 AND id <= $idx + 100; - } - - } - - if (!$update) - { - if ($single_or_multi) - { - eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id = VALUES(id); - } - - if (!$single_or_multi) - { - let $diff = 200; - - while ($diff) - { - eval INSERT INTO t1(msg, id) VALUES (\"$msg\", $idx + 100 - $diff) ON DUPLICATE KEY UPDATE msg=VALUES(msg), id=VALUES(id); - - dec $diff; - } - } - } - } - - if (!$cnt) - { - let $null_msg = `select floor(rand()*2)`; - - if ($null_msg) - { - eval INSERT INTO t1(id,msg) VALUES ($idx, NULL); - } - - if (!$null_msg) - { - eval INSERT INTO t1(id, msg) VALUES ($idx, \"$msg\"); - } - } - } - - if (!$insert_or_update) - { - if ($single_or_multi) - { - eval DELETE from t1 WHERE id=$idx; - } - - if (!$single_or_multi) - { - eval DELETE from t1 WHERE id >= $idx - 100 AND id <= $idx + 100; - } - } - - dec $commit_count; - if (!$commit_count) - { - let $commit_count= $commit_iterations; - COMMIT; - BEGIN; - } - - dec $num_ops_ind; -} - -COMMIT; - -# final cleanup -DROP TABLE t1; - -eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save; - ---enable_query_log diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result deleted file mode 100644 index f35e4159603..00000000000 --- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures.result +++ /dev/null @@ -1,17 +0,0 @@ -# -# Testing robustness against random compression failures -# -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `msg` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `msg_i` (`msg`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 -SET GLOBAL innodb_simulate_comp_failures = 25; -COMMIT; -SELECT COUNT(id) FROM t1; -COUNT(id) -1500 diff --git a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result b/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result deleted file mode 100644 index 099c673bca7..00000000000 --- a/mysql-test/suite/innodb/r/innodb_simulate_comp_failures_small.result +++ /dev/null @@ -1,17 +0,0 @@ -# -# Testing robustness against random compression failures -# -CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `msg` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `msg_i` (`msg`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 -SET GLOBAL innodb_simulate_comp_failures = 25; -COMMIT; -SELECT COUNT(id) FROM t1; -COUNT(id) -1000 diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt deleted file mode 100644 index 39b205c9b68..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-file-per-table ---skip-innodb-doublewrite diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test deleted file mode 100644 index 5a4978c9b37..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/big_test.inc -# test takes too long with valgrind ---source include/not_valgrind.inc ---source include/have_debug.inc ---let $num_inserts = 1500 ---let $num_ops = 3500 ---source suite/innodb/include/innodb_simulate_comp_failures.inc -# clean exit ---exit diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt deleted file mode 100644 index fae32059249..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-file-per-table - diff --git a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test b/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test deleted file mode 100644 index 79a16d36917..00000000000 --- a/mysql-test/suite/innodb/t/innodb_simulate_comp_failures_small.test +++ /dev/null @@ -1,8 +0,0 @@ ---source include/have_debug.inc ---source include/not_valgrind.inc - ---let $num_inserts = 1000 ---let $num_ops = 30 ---source suite/innodb/include/innodb_simulate_comp_failures.inc -# clean exit ---exit diff --git a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result b/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result deleted file mode 100644 index 7a6c9ca2db6..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_simulate_comp_failures_basic.result +++ /dev/null @@ -1,77 +0,0 @@ -SET @start_global_value = @@global.innodb_simulate_comp_failures; -SELECT @start_global_value; -@start_global_value -0 -Valid values are between 0 and 99 -select @@global.innodb_simulate_comp_failures between 0 and 99; -@@global.innodb_simulate_comp_failures between 0 and 99 -1 -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -select @@session.innodb_simulate_comp_failures; -ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable -show global variables like 'innodb_simulate_comp_failures'; -Variable_name Value -innodb_simulate_comp_failures 0 -show session variables like 'innodb_simulate_comp_failures'; -Variable_name Value -innodb_simulate_comp_failures 0 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -set global innodb_simulate_comp_failures=10; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -10 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 10 -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 10 -set session innodb_simulate_comp_failures=1; -ERROR HY000: Variable 'innodb_simulate_comp_failures' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_simulate_comp_failures=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures="foo"; -ERROR 42000: Incorrect argument type to variable 'innodb_simulate_comp_failures' -set global innodb_simulate_comp_failures=-7; -Warnings: -Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '-7' -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 0 -set global innodb_simulate_comp_failures=106; -Warnings: -Warning 1292 Truncated incorrect innodb_simulate_comp_failures value: '106' -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -99 -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_SIMULATE_COMP_FAILURES 99 -set global innodb_simulate_comp_failures=0; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -set global innodb_simulate_comp_failures=99; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -99 -set global innodb_simulate_comp_failures=DEFAULT; -select @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 -SET @@global.innodb_simulate_comp_failures = @start_global_value; -SELECT @@global.innodb_simulate_comp_failures; -@@global.innodb_simulate_comp_failures -0 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index e67a3d28fb6..5a845825c47 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2202,18 +2202,6 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES -SESSION_VALUE NULL -DEFAULT_VALUE 0 -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE INT UNSIGNED -VARIABLE_COMMENT Simulate compression failures. -NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 99 -NUMERIC_BLOCK_SIZE 0 -ENUM_VALUE_LIST NULL -READ_ONLY NO -COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_SORT_BUFFER_SIZE SESSION_VALUE NULL DEFAULT_VALUE 1048576 diff --git a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test b/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test deleted file mode 100644 index 07e70bf7343..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_simulate_comp_failures_basic.test +++ /dev/null @@ -1,65 +0,0 @@ ---source include/have_innodb.inc ---source include/have_debug.inc - -SET @start_global_value = @@global.innodb_simulate_comp_failures; -SELECT @start_global_value; - -# -# exists as global only -# - ---echo Valid values are between 0 and 99 -select @@global.innodb_simulate_comp_failures between 0 and 99; -select @@global.innodb_simulate_comp_failures; - ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_simulate_comp_failures; - -show global variables like 'innodb_simulate_comp_failures'; -show session variables like 'innodb_simulate_comp_failures'; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; - -# -# show that it's writable -# - -set global innodb_simulate_comp_failures=10; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -select * from information_schema.session_variables where variable_name='innodb_simulate_comp_failures'; - ---error ER_GLOBAL_VARIABLE -set session innodb_simulate_comp_failures=1; - -# -# incorrect types -# - ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures=1e1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_simulate_comp_failures="foo"; - -set global innodb_simulate_comp_failures=-7; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; -set global innodb_simulate_comp_failures=106; -select @@global.innodb_simulate_comp_failures; -select * from information_schema.global_variables where variable_name='innodb_simulate_comp_failures'; - -# -# min/max/DEFAULT values -# - -set global innodb_simulate_comp_failures=0; -select @@global.innodb_simulate_comp_failures; -set global innodb_simulate_comp_failures=99; -select @@global.innodb_simulate_comp_failures; -set global innodb_simulate_comp_failures=DEFAULT; -select @@global.innodb_simulate_comp_failures; - -SET @@global.innodb_simulate_comp_failures = @start_global_value; -SELECT @@global.innodb_simulate_comp_failures; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7478cdf4987..144f9951eb0 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -21044,11 +21044,6 @@ static MYSQL_SYSVAR_BOOL(master_thread_disabled_debug, PLUGIN_VAR_OPCMDARG, "Disable master thread", NULL, srv_master_thread_disabled_debug_update, FALSE); - -static MYSQL_SYSVAR_UINT(simulate_comp_failures, srv_simulate_comp_failures, - PLUGIN_VAR_NOCMDARG, - "Simulate compression failures.", - NULL, NULL, 0, 0, 99, 0); #endif /* UNIV_DEBUG */ static MYSQL_SYSVAR_BOOL(force_primary_key, @@ -21392,7 +21387,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(simulate_comp_failures), MYSQL_SYSVAR(trx_rseg_n_slots_debug), MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(trx_purge_view_update_only_debug), diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 684d8bbaf90..d196a4d6db6 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -619,9 +619,6 @@ extern struct export_var_t export_vars; /** Global counters */ extern srv_stats_t srv_stats; -/** Simulate compression failures. */ -extern uint srv_simulate_comp_failures; - /** Fatal semaphore wait threshold = maximum number of seconds that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 9664bda6fea..1acbfd2e230 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -1372,33 +1372,6 @@ page_zip_compress( MONITOR_INC(MONITOR_PAGE_COMPRESS); - /* Simulate a compression failure with a probability determined by - innodb_simulate_comp_failures, only if the page has 2 or more - records. */ - - if (srv_simulate_comp_failures - && !dict_index_is_ibuf(index) - && page_get_n_recs(page) >= 2 - && ((ulint)(rand() % 100) < srv_simulate_comp_failures) - && strcasecmp(index->table_name, "IBUF_DUMMY") != 0) { - -#ifdef UNIV_DEBUG - ib::error() - << "Simulating a compression failure" - << " for table " << index->table->name - << " index " - << index->name() - << " page " - << page_get_page_no(page) - << "(" - << (page_is_leaf(page) ? "leaf" : "non-leaf") - << ")"; - -#endif - - goto err_exit; - } - heap = mem_heap_create(page_zip_get_size(page_zip) + n_fields * (2 + sizeof(ulint)) + REC_OFFS_HEADER_SIZE diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 4974b50d6c6..44e0946f067 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -509,9 +509,6 @@ current_time % 5 != 0. */ #endif /* MEM_PERIODIC_CHECK */ # define SRV_MASTER_DICT_LRU_INTERVAL (47) -/** Simulate compression failures. */ -UNIV_INTERN uint srv_simulate_comp_failures; - /** Buffer pool dump status frequence in percentages */ UNIV_INTERN ulong srv_buf_dump_status_frequency; |