File: innodb_bug12429573.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (42 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# Bug#12429573 TIMESTAMP COLUMN OF INNODB.INDEX_STATS ARE NOT UPDATED
# WHEN RE-RUNNING ANALYZE
#

-- source include/have_innodb.inc
-- source include/not_embedded.inc

CREATE TABLE bug12429573 (i INTEGER PRIMARY KEY, j INTEGER, KEY(j))
ENGINE=INNODB STATS_PERSISTENT=1;

ANALYZE TABLE bug12429573;

# Cannot check the exact timestamp here because it is always different
# but at least check that both timestamps in innodb_table_stats and in
# innodb_index_stats have been updated to the same value. If the bug is
# present this check will fail.

SELECT last_update FROM mysql.innodb_index_stats WHERE
table_name = 'bug12429573' AND
last_update NOT IN
(SELECT last_update FROM mysql.innodb_table_stats
 WHERE table_name = 'bug12429573');

# The first ANALYZE would insert timestamp e.g. 17:23:39 in both
# innodb_table_stats and innodb_index_stats. The bug is that the second
# ANALYZE only updates the timestamp in innodb_table_stats. In order to
# check if the timestamp in innodb_index_stats has really been updated we
# need it to be different from the previous one (17:23:39) with at least
# one second.
-- sleep 1

ANALYZE TABLE bug12429573;

# If the bug is present we get the timestamps different here.
SELECT last_update FROM mysql.innodb_index_stats WHERE
table_name = 'bug12429573' AND
last_update NOT IN
(SELECT last_update FROM mysql.innodb_table_stats
 WHERE table_name = 'bug12429573');

DROP TABLE bug12429573;