summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-09-24 11:23:37 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-09-24 11:23:37 +0300
commit4bfdba2e89ce825a9f89b2e6ed7eca3e0ce2c128 (patch)
tree2d0b208d497d8f849ba6192d1f915b10c4a52873 /mysql-test/suite/innodb
parentb46cf33ab8ce869af0f51c35026965d237d722c7 (diff)
downloadmariadb-git-4bfdba2e89ce825a9f89b2e6ed7eca3e0ce2c128.tar.gz
MDEV-26672 innodb_undo_log_truncate may reset transaction ID sequence
trx_rseg_header_create(): Add a parameter for the value that is to be written to TRX_RSEG_MAX_TRX_ID. If we omit this write, then the updated test innodb.undo_truncate will fail for the 4k, 8k, 16k page sizes. This was broken ever since commit 947efe17ed8188ca4feef6deb0c2831a246b5c8f (MDEV-15158) removed the writes of transaction identifiers to the TRX_SYS page. srv_do_purge(): Truncate undo tablespaces also during slow shutdown (innodb_fast_shutdown=0). Thanks to Krunal Bauskar for noticing this problem.
Diffstat (limited to 'mysql-test/suite/innodb')
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate.result9
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate.test39
2 files changed, 16 insertions, 32 deletions
diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result
index 25fd07cf930..4b185a58d2c 100644
--- a/mysql-test/suite/innodb/r/undo_truncate.result
+++ b/mysql-test/suite/innodb/r/undo_truncate.result
@@ -2,11 +2,7 @@ SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0;
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
-SET @trunc_start=
-(SELECT variable_value FROM information_schema.global_status
-WHERE variable_name = 'innodb_undo_truncations');
create table t1(keyc int primary key, c char(100)) engine = innodb;
create table t2(keyc int primary key, c char(100)) engine = innodb;
connect con1,localhost,root,,;
@@ -35,8 +31,5 @@ connection con2;
commit;
disconnect con2;
connection default;
+set global innodb_fast_shutdown=0;
drop table t1, t2;
-InnoDB 0 transactions not purged
-SET GLOBAL innodb_undo_logs = @save_undo_logs;
-SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
-SET GLOBAL innodb_undo_log_truncate = @save_truncate;
diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test
index bc2e6a3a119..32697e59c91 100644
--- a/mysql-test/suite/innodb/t/undo_truncate.test
+++ b/mysql-test/suite/innodb/t/undo_truncate.test
@@ -1,23 +1,15 @@
--source include/have_innodb.inc
-# With 32k, truncation could happen on shutdown after the test,
-# and the mtr.add_suppression() would not filter out the warning.
-# With 64k, no truncation seems to happen.
-# --source include/innodb_page_size.inc
---source include/innodb_page_size_small.inc
+--source include/innodb_page_size.inc
--source include/have_undo_tablespaces.inc
+--source include/not_embedded.inc
--source include/have_sequence.inc
SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
SET GLOBAL innodb_undo_log_truncate = 0;
-SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
-SET @trunc_start=
-(SELECT variable_value FROM information_schema.global_status
-WHERE variable_name = 'innodb_undo_truncations');
-
#-----------------------------------------------------------------------------
#
# Perform DML action using multiple clients and multiple undo tablespace.
@@ -48,21 +40,20 @@ commit; disconnect con1;
connection con2; commit; disconnect con2;
connection default;
-drop table t1, t2;
---source include/wait_all_purged.inc
+--replace_regex /.*Trx id counter ([0-9]+).*/\1/
+let $trx_before= `SHOW ENGINE INNODB STATUS`;
+let $trx_before= `select substr('$trx_before',9)+2`;
+
+set global innodb_fast_shutdown=0;
+--source include/restart_mysqld.inc
+--replace_regex /.*Trx id counter ([0-9]+).*/\1/
+let $trx_after= `SHOW ENGINE INNODB STATUS`;
+let $trx_after= `select substr('$trx_after',9)`;
-# Truncation will normally not occur with innodb_page_size=64k,
-# and occasionally not with innodb_page_size=32k,
-# because the undo log will not grow enough.
-if (`select @@innodb_page_size IN (4096,8192,16384)`)
+drop table t1, t2;
+
+if ($trx_before != $trx_after)
{
- let $wait_condition = (SELECT variable_value!=@trunc_start
- FROM information_schema.global_status
- WHERE variable_name = 'innodb_undo_truncations');
- source include/wait_condition.inc;
+ echo Transaction sequence mismatch: $trx_before != $trx_after;
}
-
-SET GLOBAL innodb_undo_logs = @save_undo_logs;
-SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
-SET GLOBAL innodb_undo_log_truncate = @save_truncate;