Debian Codegraph @

mysql-test/suite/innodb/t/update_time.test

raw
1 ###################################################################
2 -- echo #
3 -- echo # Test that INFORMATION_SCHEMA.TABLES.UPDATE_TIME is filled
4 -- echo # correctly for InnoDB tables.
5 -- echo #
6
7 -- source include/have_innodb.inc
8 # restart does not work with embedded
9 -- source include/not_embedded.inc
10
11 CREATE TABLE t (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
12
13 SELECT update_time FROM information_schema.tables WHERE table_name = 't';
14
15 INSERT INTO t VALUES (1);
16
17 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
18 AND update_time IS NOT NULL;
19
20 -- echo # We cant deterministically check that the saved value is correct, but
21 -- echo # at least we check that it is a timestamp not older than 2 minutes.
22 -- echo # Usually update_time and NOW() are equal below, but on heavily loaded
23 -- echo # machines NOW() could be younger.
24 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
25 AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120;
26
27 -- echo # Test the behavior after restart with a prepared XA transaction
28
29 XA START 'xatrx';
30 DELETE FROM t;
31 XA END 'xatrx';
32 XA PREPARE 'xatrx';
33
34 CONNECT (con1,localhost,root,,);
35
36 call mtr.add_suppression("Found 1 prepared XA transactions");
37 FLUSH TABLES;
38
39 --let $shutdown_timeout=0
40 --source include/restart_mysqld.inc
41
42 SELECT update_time FROM information_schema.tables WHERE table_name = 't';
43
44 XA COMMIT 'xatrx';
45
46 SELECT COUNT(update_time) FROM information_schema.tables WHERE table_name='t';
47
48 DROP TABLE t;