Commit 3c411e3a authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 9fa20716
......@@ -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,
......
......@@ -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 ...');
......
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