summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_fts
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-02-08 12:48:25 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-02-08 12:48:25 +0200
commit3c411e3ad66d0b4ddee2563deb621db249b94432 (patch)
treeaeb77a255e338cab39f40e463d7825fc22055592 /mysql-test/suite/innodb_fts
parent9fa20716b6dc47e28a8c99c5ecd5795c9088d811 (diff)
downloadmariadb-git-3c411e3ad66d0b4ddee2563deb621db249b94432.tar.gz
Test fix for MDEV-6076 Persistent AUTO_INCREMENT for InnoDB
Before killing the server, ensure that the redo log for the incomplete transaction is flushed, so that the AUTO_INCREMENT sequence will always be updated. Usually the INSERT transaction would not have persisted the sequence before the server was killed, but sometimes it could happen, causing result mismatch. Note: This test used to be called innodb_fts.innodb_fts_misc_debug.
Diffstat (limited to 'mysql-test/suite/innodb_fts')
-rw-r--r--mysql-test/suite/innodb_fts/r/crash_recovery.result24
-rw-r--r--mysql-test/suite/innodb_fts/t/crash_recovery.test20
2 files changed, 40 insertions, 4 deletions
diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result
index e21631471d2..2ff867b70fe 100644
--- a/mysql-test/suite/innodb_fts/r/crash_recovery.result
+++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result
@@ -15,6 +15,14 @@ INSERT INTO articles (title,body) VALUES
BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+# Make durable the AUTO_INCREMENT in the above incomplete transaction.
+connect flush_redo_log,localhost,root,,;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+BEGIN;
+DELETE FROM articles LIMIT 1;
+ROLLBACK;
+disconnect flush_redo_log;
+connection default;
# Kill and restart
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
@@ -25,7 +33,7 @@ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
id title body
1 MySQL Tutorial DBMS stands for DataBase ...
5 MySQL vs. YourSQL In the following database comparison ...
-7 MySQL Tutorial DBMS stands for DataBase ...
+8 MySQL Tutorial DBMS stands for DataBase ...
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...') ,
('How To Use MySQL Well','After you went through a ...'),
@@ -36,6 +44,14 @@ INSERT INTO articles (title,body) VALUES
BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+# Make durable the AUTO_INCREMENT in the above incomplete transaction.
+connect flush_redo_log,localhost,root,,;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+BEGIN;
+DELETE FROM articles LIMIT 1;
+ROLLBACK;
+disconnect flush_redo_log;
+connection default;
# Kill and restart
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
@@ -45,10 +61,10 @@ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
id title body
1 MySQL Tutorial DBMS stands for DataBase ...
5 MySQL vs. YourSQL In the following database comparison ...
-7 MySQL Tutorial DBMS stands for DataBase ...
8 MySQL Tutorial DBMS stands for DataBase ...
-12 MySQL vs. YourSQL In the following database comparison ...
-14 MySQL Tutorial DBMS stands for DataBase ...
+9 MySQL Tutorial DBMS stands for DataBase ...
+13 MySQL vs. YourSQL In the following database comparison ...
+16 MySQL Tutorial DBMS stands for DataBase ...
DROP TABLE articles;
CREATE TABLE articles (
id int PRIMARY KEY,
diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test
index ec055930672..63c920a91ec 100644
--- a/mysql-test/suite/innodb_fts/t/crash_recovery.test
+++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test
@@ -38,6 +38,15 @@ BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+--echo # Make durable the AUTO_INCREMENT in the above incomplete transaction.
+--connect (flush_redo_log,localhost,root,,)
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+BEGIN;
+DELETE FROM articles LIMIT 1;
+ROLLBACK;
+--disconnect flush_redo_log
+--connection default
+
--source include/kill_and_restart_mysqld.inc
# This insert will re-initialize the Doc ID counter, it should not crash
@@ -67,6 +76,15 @@ BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+--echo # Make durable the AUTO_INCREMENT in the above incomplete transaction.
+--connect (flush_redo_log,localhost,root,,)
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+BEGIN;
+DELETE FROM articles LIMIT 1;
+ROLLBACK;
+--disconnect flush_redo_log
+--connection default
+
--source include/kill_and_restart_mysqld.inc
# This insert will re-initialize the Doc ID counter, it should not crash
@@ -103,6 +121,8 @@ INSERT INTO articles VALUES
BEGIN;
+# Below we do not depend on the durability of the AUTO_INCREMENT sequence,
+# so we can skip the above flush_redo_log trick.
INSERT INTO articles VALUES
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');