summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-23 07:47:19 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-23 08:55:51 +0200
commitf8bc799a89b97e278c08822e71b74043c0c578d5 (patch)
tree699fc119288995c02de28cd63d35478bf4ba7fab /mysql-test
parent0055e1a57f7f3c4ea1a071575eeee8e5f4da19e2 (diff)
downloadmariadb-git-f8bc799a89b97e278c08822e71b74043c0c578d5.tar.gz
Import WL#6658 update_time tests from MySQL 5.7
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/update_time.result53
-rw-r--r--mysql-test/suite/innodb/r/update_time_wl6658.result301
-rw-r--r--mysql-test/suite/innodb/t/update_time-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/update_time.test79
-rw-r--r--mysql-test/suite/innodb/t/update_time_wl6658.test330
5 files changed, 764 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/update_time.result b/mysql-test/suite/innodb/r/update_time.result
new file mode 100644
index 00000000000..0c6fc672dae
--- /dev/null
+++ b/mysql-test/suite/innodb/r/update_time.result
@@ -0,0 +1,53 @@
+#
+# Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
+# correctly for InnoDB tables.
+#
+CREATE TABLE t (a INT) ENGINE=INNODB;
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+update_time
+NULL
+INSERT INTO t VALUES (1);
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
+# We cant deterministically check that the saved value is correct, but
+# at least we check that it is a timestamp not older than 2 minutes.
+# Usually update_time and NOW() are equal below, but on heavily loaded
+# machines NOW() could be younger.
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120;
+COUNT(*)
+1
+CREATE TABLE big (a TEXT) ENGINE=INNODB;
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+COUNT(*)
+1
+# INSERT lots of data in table 'big': begin
+# INSERT lots of data in table 'big': end
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+COUNT(*)
+0
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
+DROP TABLE big;
+# Test the behavior after restart with a prepared XA transaction
+XA START 'xatrx';
+INSERT INTO t VALUES (5);
+XA END 'xatrx';
+XA PREPARE 'xatrx';
+call mtr.add_suppression("Found 1 prepared XA transactions");
+# Kill and restart
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+update_time
+NULL
+XA COMMIT 'xatrx';
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+COUNT(*)
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/update_time_wl6658.result b/mysql-test/suite/innodb/r/update_time_wl6658.result
new file mode 100644
index 00000000000..ae02e7b487c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/update_time_wl6658.result
@@ -0,0 +1,301 @@
+#create base table
+CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB;
+CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+#insert some base records
+INSERT INTO tab4 VALUES(1,'Test for Update');
+INSERT INTO tab5 VALUES(1,'Test for Delete');
+#create a trigger
+CREATE TRIGGER test_trig BEFORE INSERT ON tab1
+FOR EACH ROW BEGIN
+INSERT INTO tab3 VALUES(1,'Inserted From Trigger');
+UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1;
+DELETE FROM tab5;
+END |
+#restart the server
+# restart
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables
+WHERE table_name IN ('tab1','tab3','tab4','tab5');
+table_name update_time
+tab1 NULL
+tab3 NULL
+tab4 NULL
+tab5 NULL
+SET AUTOCOMMIT=OFF;
+#case1:
+BEGIN WORK;
+INSERT INTO tab1
+VALUES(1,'Testing the wl6658', 'Testing the wl6658');
+check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+COMMIT;
+#check the record is inserted
+SELECT * FROM tab1;
+c1 c2 c3
+1 Testing the wl6658 Testing the wl6658
+#check the record is inserted
+SELECT * FROM tab3;
+c1 c2
+1 Inserted From Trigger
+#check the record is updated
+SELECT * FROM tab4;
+c1 c2
+1 Updated from Trigger
+#check no record exists
+SELECT * FROM tab5;
+c1 c2
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables
+WHERE table_name IN ('tab1','tab3','tab4','tab5')
+GROUP BY table_name;
+table_name COUNT(update_time)
+tab1 1
+tab3 1
+tab4 1
+tab5 1
+#restart the server
+# restart
+Testcase with UPDATE stmt and transaction
+#check the record is existing
+SELECT * FROM tab1;
+c1 c2 c3
+1 Testing the wl6658 Testing the wl6658
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+SET AUTOCOMMIT=OFF;
+#case2:
+START TRANSACTION;
+UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1;
+check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+COMMIT;
+#check the record is updated
+SELECT * FROM tab1;
+c1 c2 c3
+1 Updated Updated
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab1';
+table_name COUNT(update_time)
+tab1 1
+#restart the server
+# restart
+#check the record is existing
+SELECT * FROM tab1;
+c1 c2 c3
+1 Updated Updated
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+SET AUTOCOMMIT=OFF;
+#case3:
+START TRANSACTION;
+DELETE FROM tab1;
+check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+COMMIT;
+#check the record is deleted
+SELECT * FROM tab1;
+c1 c2 c3
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab1';
+table_name COUNT(update_time)
+tab1 1
+#restart the server
+# restart
+#check no records are existing
+SELECT * FROM tab1;
+c1 c2 c3
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+SET AUTOCOMMIT=OFF;
+#case4:
+START TRANSACTION;
+INSERT INTO tab1
+VALUES(1,'Testing the wl6658', 'Testing the wl6658');
+check the update_time Before Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+ROLLBACK;
+#check no record is inserted.
+SELECT * FROM tab1;
+c1 c2 c3
+check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+table_name update_time
+tab1 NULL
+CREATE TABLE tab2(
+id INT NOT NULL,
+store_name VARCHAR(30),
+parts VARCHAR(30),
+store_id INT
+) ENGINE=InnoDB
+PARTITION BY LIST(store_id) (
+PARTITION pNorth VALUES IN (10,20,30),
+PARTITION pEast VALUES IN (40,50,60),
+PARTITION pWest VALUES IN (70,80,100)
+);
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab2';
+table_name update_time
+tab2 NULL
+#case5:
+#create proc with DML
+CREATE PROCEDURE proc_wl6658()
+BEGIN
+INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10);
+INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40);
+COMMIT;
+END |
+CALL proc_wl6658;
+#check the records are inserted
+SELECT * FROM tab2 ORDER BY id,store_id;
+id store_name parts store_id
+1 ORACLE NUTT 10
+2 HUAWEI BOLT 40
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab2';
+table_name COUNT(update_time)
+tab2 1
+#delete all records
+TRUNCATE TABLE tab2;
+#restart the server
+# restart
+#case6:
+SET AUTOCOMMIT=off;
+BEGIN WORK;
+INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10);
+SAVEPOINT A;
+INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40);
+SAVEPOINT B;
+INSERT INTO tab2 VALUES(3,'IBM','NAIL',70);
+SAVEPOINT C;
+ROLLBACK to A;
+#check 1 record is inserted
+SELECT * FROM tab2;
+id store_name parts store_id
+1 Oracle NUTT 10
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab2';
+table_name update_time
+tab2 NULL
+#execute DDL instead of commit
+create table tab6(c1 int);
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab2';
+table_name COUNT(update_time)
+tab2 1
+#case7:
+#create some base tables
+set the flag to default
+SET AUTOCOMMIT=Default;
+CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB;
+CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT,
+FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE )
+ENGINE=INNODB;
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab7';
+table_name update_time
+tab7 NULL
+check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab8';
+table_name update_time
+tab8 NULL
+INSERT INTO tab7 VALUES(1);
+INSERT INTO tab8 VALUES(1,1);
+#check the record is inserted
+SELECT * FROM tab7;
+c1
+1
+#check the record is inserted
+SELECT * FROM tab8;
+c1 c2
+1 1
+check the update_time After Autocommit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab7';
+table_name COUNT(update_time)
+tab7 1
+check the update_time After Autocommit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab8';
+table_name COUNT(update_time)
+tab8 1
+#restart the server
+# restart
+SET AUTOCOMMIT=off;
+START TRANSACTION;
+DELETE FROM tab7;
+ROLLBACK;
+#check record exist
+SELECT * FROM tab7;
+c1
+1
+#check record exist
+SELECT * FROM tab8;
+c1 c2
+1 1
+check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab7';
+table_name update_time
+tab7 NULL
+check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab8';
+table_name update_time
+tab8 NULL
+START TRANSACTION;
+DELETE FROM tab7;
+COMMIT;
+#check no record exist
+SELECT * FROM tab7;
+c1
+#check no record exist
+SELECT * FROM tab8;
+c1 c2
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab7';
+table_name COUNT(update_time)
+tab7 1
+check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab8';
+table_name COUNT(update_time)
+tab8 1
+#cleanup
+DROP TRIGGER test_trig;
+DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7;
+DROP PROCEDURE proc_wl6658;
diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt
new file mode 100644
index 00000000000..9f283a9503f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update_time-master.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-size=10M
diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test
new file mode 100644
index 00000000000..922fd40325f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update_time.test
@@ -0,0 +1,79 @@
+###################################################################
+-- echo #
+-- echo # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
+-- echo # correctly for InnoDB tables.
+-- echo #
+
+-- source include/have_innodb.inc
+-- source include/have_innodb_max_16k.inc
+# restart does not work with embedded
+-- source include/not_embedded.inc
+
+CREATE TABLE t (a INT) ENGINE=INNODB;
+
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+
+INSERT INTO t VALUES (1);
+
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+
+-- echo # We cant deterministically check that the saved value is correct, but
+-- echo # at least we check that it is a timestamp not older than 2 minutes.
+-- echo # Usually update_time and NOW() are equal below, but on heavily loaded
+-- echo # machines NOW() could be younger.
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120;
+
+CREATE TABLE big (a TEXT) ENGINE=INNODB;
+
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+
+# evict table 't' by inserting as much data as the BP size itself
+-- echo # INSERT lots of data in table 'big': begin
+-- disable_query_log
+BEGIN;
+-- let $i = 10240
+while ($i)
+{
+ INSERT INTO big VALUES (REPEAT('a', 1024));
+ dec $i;
+}
+COMMIT;
+-- enable_query_log
+-- echo # INSERT lots of data in table 'big': end
+
+# confirm that table 't' has been evicted
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page
+WHERE table_name = '`test`.`t`';
+
+# The result from this query will change once update_time becomes persistent
+# (WL#6917).
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+
+DROP TABLE big;
+
+-- echo # Test the behavior after restart with a prepared XA transaction
+
+XA START 'xatrx';
+INSERT INTO t VALUES (5);
+XA END 'xatrx';
+XA PREPARE 'xatrx';
+
+CONNECT (con1,localhost,root,,);
+CONNECTION con1;
+
+call mtr.add_suppression("Found 1 prepared XA transactions");
+
+--source include/kill_and_restart_mysqld.inc
+
+SELECT update_time FROM information_schema.tables WHERE table_name = 't';
+
+XA COMMIT 'xatrx';
+
+SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
+AND update_time IS NOT NULL;
+
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/update_time_wl6658.test b/mysql-test/suite/innodb/t/update_time_wl6658.test
new file mode 100644
index 00000000000..e796b6aabe5
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update_time_wl6658.test
@@ -0,0 +1,330 @@
+###################################################################
+#Testing functionality of the WL6658
+#case1: when autocommit off begin work with INSERT with Triggers
+#case2: when autocommit off begin transaction with UPDATE
+#case3: when autocommit off begin transaction with DELETE
+#case4: when autocommit off Rollback & INSERT
+#case5: when autocommit off with partition table and procedures
+#case6: when autocommit off with SAVEPOINTs & DDL
+#case7: when autocommit off pk-fk with ON DELETE CASCADE
+###################################################################
+--source include/no_valgrind_without_big.inc
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+
+--echo #create base table
+CREATE TABLE tab1(c1 int,c2 varchar(30), c3 BLOB) ENGINE=InnoDB;
+CREATE TABLE tab3(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+CREATE TABLE tab4(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+CREATE TABLE tab5(c1 int,c2 varchar(30)) ENGINE=InnoDB;
+
+--echo #insert some base records
+INSERT INTO tab4 VALUES(1,'Test for Update');
+INSERT INTO tab5 VALUES(1,'Test for Delete');
+
+delimiter |;
+
+--echo #create a trigger
+CREATE TRIGGER test_trig BEFORE INSERT ON tab1
+FOR EACH ROW BEGIN
+ INSERT INTO tab3 VALUES(1,'Inserted From Trigger');
+ UPDATE tab4 SET c2='Updated from Trigger' WHERE c1=1;
+ DELETE FROM tab5;
+END |
+
+delimiter ;|
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables
+WHERE table_name IN ('tab1','tab3','tab4','tab5');
+
+SET AUTOCOMMIT=OFF;
+
+--echo #case1:
+
+BEGIN WORK;
+
+INSERT INTO tab1
+VALUES(1,'Testing the wl6658', 'Testing the wl6658');
+
+--echo check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+COMMIT;
+
+--echo #check the record is inserted
+SELECT * FROM tab1;
+
+--echo #check the record is inserted
+SELECT * FROM tab3;
+
+--echo #check the record is updated
+SELECT * FROM tab4;
+
+--echo #check no record exists
+SELECT * FROM tab5;
+
+--echo check the update_time After Commit, whether it is not NULL
+--sorted_result
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables
+WHERE table_name IN ('tab1','tab3','tab4','tab5')
+GROUP BY table_name;
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+--echo Testcase with UPDATE stmt and transaction
+
+--echo #check the record is existing
+SELECT * FROM tab1;
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+SET AUTOCOMMIT=OFF;
+
+--echo #case2:
+START TRANSACTION;
+
+UPDATE tab1 SET c2='Updated',c3='Updated' WHERE c1=1;
+
+--echo check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+COMMIT;
+
+--echo #check the record is updated
+SELECT * FROM tab1;
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab1';
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+--echo #check the record is existing
+SELECT * FROM tab1;
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+SET AUTOCOMMIT=OFF;
+
+--echo #case3:
+START TRANSACTION;
+
+DELETE FROM tab1;
+
+--echo check the update_time Before commit, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+COMMIT;
+
+--echo #check the record is deleted
+SELECT * FROM tab1;
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab1';
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+--echo #check no records are existing
+SELECT * FROM tab1;
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+SET AUTOCOMMIT=OFF;
+
+--echo #case4:
+START TRANSACTION;
+
+INSERT INTO tab1
+VALUES(1,'Testing the wl6658', 'Testing the wl6658');
+
+--echo check the update_time Before Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+ROLLBACK;
+
+--echo #check no record is inserted.
+SELECT * FROM tab1;
+
+--echo check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab1';
+
+CREATE TABLE tab2(
+ id INT NOT NULL,
+ store_name VARCHAR(30),
+ parts VARCHAR(30),
+ store_id INT
+) ENGINE=InnoDB
+PARTITION BY LIST(store_id) (
+ PARTITION pNorth VALUES IN (10,20,30),
+ PARTITION pEast VALUES IN (40,50,60),
+ PARTITION pWest VALUES IN (70,80,100)
+);
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab2';
+
+--echo #case5:
+
+delimiter |;
+
+--echo #create proc with DML
+CREATE PROCEDURE proc_wl6658()
+BEGIN
+INSERT INTO tab2 VALUES(1,'ORACLE','NUTT',10);
+INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40);
+COMMIT;
+END |
+
+delimiter ;|
+
+CALL proc_wl6658;
+
+--echo #check the records are inserted
+SELECT * FROM tab2 ORDER BY id,store_id;
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab2';
+
+--echo #delete all records
+TRUNCATE TABLE tab2;
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+--echo #case6:
+
+SET AUTOCOMMIT=off;
+
+BEGIN WORK;
+INSERT INTO tab2 VALUES(1,'Oracle','NUTT',10);
+SAVEPOINT A;
+INSERT INTO tab2 VALUES(2,'HUAWEI','BOLT',40);
+SAVEPOINT B;
+INSERT INTO tab2 VALUES(3,'IBM','NAIL',70);
+SAVEPOINT C;
+ROLLBACK to A;
+
+--echo #check 1 record is inserted
+SELECT * FROM tab2;
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab2';
+
+--echo #execute DDL instead of commit
+create table tab6(c1 int);
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab2';
+
+--echo #case7:
+--echo #create some base tables
+
+--echo set the flag to default
+SET AUTOCOMMIT=Default;
+
+CREATE TABLE tab7(c1 INT NOT NULL, PRIMARY KEY (c1)) ENGINE=INNODB;
+
+CREATE TABLE tab8(c1 INT PRIMARY KEY,c2 INT,
+FOREIGN KEY (c2) REFERENCES tab7(c1) ON DELETE CASCADE )
+ENGINE=INNODB;
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab7';
+
+--echo check the update_time Before DML, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab8';
+
+INSERT INTO tab7 VALUES(1);
+
+INSERT INTO tab8 VALUES(1,1);
+
+--echo #check the record is inserted
+SELECT * FROM tab7;
+
+--echo #check the record is inserted
+SELECT * FROM tab8;
+
+--echo check the update_time After Autocommit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab7';
+
+--echo check the update_time After Autocommit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab8';
+
+--echo #restart the server
+--source include/restart_mysqld.inc
+
+SET AUTOCOMMIT=off;
+
+START TRANSACTION;
+
+DELETE FROM tab7;
+
+ROLLBACK;
+
+--echo #check record exist
+SELECT * FROM tab7;
+
+--echo #check record exist
+SELECT * FROM tab8;
+
+--echo check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab7';
+
+--echo check the update_time After Rollback, whether it is NULL
+SELECT table_name,update_time
+FROM information_schema.tables WHERE table_name='tab8';
+
+START TRANSACTION;
+
+DELETE FROM tab7;
+
+COMMIT;
+
+--echo #check no record exist
+SELECT * FROM tab7;
+
+--echo #check no record exist
+SELECT * FROM tab8;
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab7';
+
+--echo check the update_time After Commit, whether it is not NULL
+SELECT table_name,COUNT(update_time)
+FROM information_schema.tables WHERE table_name='tab8';
+
+--echo #cleanup
+DROP TRIGGER test_trig;
+DROP TABLE tab1,tab2,tab3,tab4,tab5,tab6,tab8,tab7;
+DROP PROCEDURE proc_wl6658;