Debian Codegraph @

mysql-test/suite/innodb/r/update_time.result

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