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;
6 ANALYZE TABLE t;
7 Table Op Msg_type Msg_text
8 test.t analyze status OK
9 SELECT update_time FROM information_schema.tables WHERE table_name = 't';
10 UPDATE_TIME
11 NULL
12 INSERT INTO t VALUES (1);
13 ANALYZE TABLE t;
14 Table Op Msg_type Msg_text
15 test.t analyze status OK
16 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
17 AND update_time IS NOT NULL OR FALSE;
18 COUNT(*)
19 1
20 # We cant deterministically check that the saved value is correct, but
21 # at least we check that it is a timestamp not older than 2 minutes.
22 # Usually update_time and NOW() are equal below, but on heavily loaded
23 # machines NOW() could be younger.
24 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
25 AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120 OR FALSE;
26 COUNT(*)
27 1
28 SELECT COUNT(*) FROM information_schema.innodb_buffer_page
29 WHERE table_name = '`test`.`t`';
30 COUNT(*)
31 1
32 # Emptying InnoDB buffer pool: begin
33 # Buffer pool size: 10485760 bytes
34 # Creating and dropping a table with size: 20971520 bytes
35 # Emptying InnoDB buffer pool: end
36 SELECT COUNT(*) FROM information_schema.innodb_buffer_page
37 WHERE table_name = '`test`.`t`';
38 COUNT(*)
39 0
40 ANALYZE TABLE t;
41 Table Op Msg_type Msg_text
42 test.t analyze status OK
43 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
44 AND update_time IS NOT NULL OR FALSE;
45 COUNT(*)
46 1
47 # Test the behavior after restart with a prepared XA transaction
48 XA START 'xatrx';
49 INSERT INTO t VALUES (5);
50 XA END 'xatrx';
51 XA PREPARE 'xatrx';
52 call mtr.add_suppression("Found 1 prepared XA transactions");
53 # Kill and restart
54 ANALYZE TABLE t;
55 Table Op Msg_type Msg_text
56 test.t analyze status OK
57 SELECT update_time FROM information_schema.tables WHERE table_name = 't';
58 UPDATE_TIME
59 NULL
60 XA COMMIT 'xatrx';
61 ANALYZE TABLE t;
62 Table Op Msg_type Msg_text
63 test.t analyze status OK
64 SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't'
65 AND update_time IS NOT NULL OR FALSE;
66 COUNT(*)
67 1
68 DROP TABLE t;