| 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_max_16k.inc |
| 8 |
|
| 9 |
CREATE TABLE t (a INT) ENGINE=INNODB; |
| 10 |
|
| 11 |
ANALYZE TABLE t; |
| 12 |
SELECT update_time FROM information_schema.tables WHERE table_name = 't'; |
| 13 |
|
| 14 |
INSERT INTO t VALUES (1); |
| 15 |
|
| 16 |
ANALYZE TABLE t; |
| 17 |
# Remove workaround of "OR FALSE" from the end of WHERE clause after fix |
| 18 |
# of Bug#26389402 for I_S views definitions. |
| 19 |
SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' |
| 20 |
AND update_time IS NOT NULL OR FALSE; |
| 21 |
|
| 22 |
-- echo # We cant deterministically check that the saved value is correct, but |
| 23 |
-- echo # at least we check that it is a timestamp not older than 2 minutes. |
| 24 |
-- echo # Usually update_time and NOW() are equal below, but on heavily loaded |
| 25 |
-- echo # machines NOW() could be younger. |
| 26 |
# Remove workaround of "OR FALSE" from the end of WHERE clause after fix |
| 27 |
# of Bug#26389402 for I_S views definitions. |
| 28 |
SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' |
| 29 |
AND TIMESTAMPDIFF(SECOND, update_time, NOW()) < 120 OR FALSE; |
| 30 |
|
| 31 |
SELECT COUNT(*) FROM information_schema.innodb_buffer_page |
| 32 |
WHERE table_name = '`test`.`t`'; |
| 33 |
|
| 34 |
-- source suite/innodb/include/evict_everything_from_buffer_pool.inc |
| 35 |
|
| 36 |
# confirm that table 't' has been evicted |
| 37 |
SELECT COUNT(*) FROM information_schema.innodb_buffer_page |
| 38 |
WHERE table_name = '`test`.`t`'; |
| 39 |
|
| 40 |
# The result from this query will change once update_time becomes persistent |
| 41 |
# (WL#6917). |
| 42 |
ANALYZE TABLE t; |
| 43 |
# Remove workaround of "OR FALSE" from the end of WHERE clause after fix |
| 44 |
# of Bug#26389402 for I_S views definitions. |
| 45 |
SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' |
| 46 |
AND update_time IS NOT NULL OR FALSE; |
| 47 |
|
| 48 |
-- echo # Test the behavior after restart with a prepared XA transaction |
| 49 |
|
| 50 |
XA START 'xatrx'; |
| 51 |
INSERT INTO t VALUES (5); |
| 52 |
XA END 'xatrx'; |
| 53 |
XA PREPARE 'xatrx'; |
| 54 |
|
| 55 |
CONNECT (con1,localhost,root,,); |
| 56 |
CONNECTION con1; |
| 57 |
|
| 58 |
call mtr.add_suppression("Found 1 prepared XA transactions"); |
| 59 |
|
| 60 |
--source include/kill_and_restart_mysqld.inc |
| 61 |
|
| 62 |
ANALYZE TABLE t; |
| 63 |
SELECT update_time FROM information_schema.tables WHERE table_name = 't'; |
| 64 |
|
| 65 |
XA COMMIT 'xatrx'; |
| 66 |
|
| 67 |
# Table reset after XA commit, so update time should be NULL |
| 68 |
ANALYZE TABLE t; |
| 69 |
# Remove workaround of "OR FALSE" from the end of WHERE clause after fix |
| 70 |
# of Bug#26389402 for I_S views definitions. |
| 71 |
SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 't' |
| 72 |
AND update_time IS NOT NULL OR FALSE; |
| 73 |
|
| 74 |
DROP TABLE t; |