| 1 |
# |
| 2 |
# Bug#12429573 TIMESTAMP COLUMN OF INNODB.INDEX_STATS ARE NOT UPDATED |
| 3 |
# WHEN RE-RUNNING ANALYZE |
| 4 |
# |
| 5 |
|
| 6 |
|
| 7 |
CREATE TABLE bug12429573 (i INTEGER PRIMARY KEY, j INTEGER, KEY(j)) |
| 8 |
ENGINE=INNODB STATS_PERSISTENT=1; |
| 9 |
|
| 10 |
ANALYZE TABLE bug12429573; |
| 11 |
|
| 12 |
# Cannot check the exact timestamp here because it is always different |
| 13 |
# but at least check that both timestamps in innodb_table_stats and in |
| 14 |
# innodb_index_stats have been updated to the same value. If the bug is |
| 15 |
# present this check will fail. |
| 16 |
|
| 17 |
SELECT last_update FROM mysql.innodb_index_stats WHERE |
| 18 |
table_name = 'bug12429573' AND |
| 19 |
last_update NOT IN |
| 20 |
(SELECT last_update FROM mysql.innodb_table_stats |
| 21 |
WHERE table_name = 'bug12429573'); |
| 22 |
|
| 23 |
# The first ANALYZE would insert timestamp e.g. 17:23:39 in both |
| 24 |
# innodb_table_stats and innodb_index_stats. The bug is that the second |
| 25 |
# ANALYZE only updates the timestamp in innodb_table_stats. In order to |
| 26 |
# check if the timestamp in innodb_index_stats has really been updated we |
| 27 |
# need it to be different from the previous one (17:23:39) with at least |
| 28 |
# one second. |
| 29 |
-- sleep 1 |
| 30 |
|
| 31 |
ANALYZE TABLE bug12429573; |
| 32 |
|
| 33 |
# If the bug is present we get the timestamps different here. |
| 34 |
SELECT last_update FROM mysql.innodb_index_stats WHERE |
| 35 |
table_name = 'bug12429573' AND |
| 36 |
last_update NOT IN |
| 37 |
(SELECT last_update FROM mysql.innodb_table_stats |
| 38 |
WHERE table_name = 'bug12429573'); |
| 39 |
|
| 40 |
DROP TABLE bug12429573; |