~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysql-test/suite/innodb_plugin/t/innodb_bug57252.test

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Bug#57252 disabling innobase_stats_on_metadata disables ANALYZE
 
3
# http://bugs.mysql.com/57252
 
4
#
 
5
 
 
6
-- source include/have_innodb_plugin.inc
 
7
 
 
8
-- disable_query_log
 
9
-- disable_result_log
 
10
 
 
11
SET @innodb_stats_on_metadata_orig = @@innodb_stats_on_metadata;
 
12
 
 
13
CREATE TABLE bug57252 (a INT, KEY akey (a)) ENGINE=INNODB;
 
14
 
 
15
BEGIN;
 
16
let $i = 10;
 
17
while ($i) {
 
18
        eval INSERT INTO bug57252 VALUES ($i);
 
19
        dec $i;
 
20
}
 
21
COMMIT;
 
22
 
 
23
-- enable_result_log
 
24
 
 
25
SET GLOBAL innodb_stats_on_metadata=0;
 
26
 
 
27
# this calls ::info() without HA_STATUS_CONST and so
 
28
# index->stat_n_diff_key_vals[] is not copied to the mysql-visible
 
29
# rec_per_key
 
30
SELECT cardinality FROM information_schema.statistics
 
31
WHERE table_name='bug57252' AND index_name='akey';
 
32
 
 
33
# this calls ::info() with HA_STATUS_CONST and so
 
34
# index->stat_n_diff_key_vals[] is copied to the mysql-visible
 
35
# rec_per_key at the end; when the bug is present dict_update_statistics()
 
36
# is not called beforehand and so index->stat_n_diff_key_vals[] contains
 
37
# an outdated data and thus we get an outdated data in the result when the
 
38
# bug is present
 
39
ANALYZE TABLE bug57252;
 
40
 
 
41
SELECT cardinality FROM information_schema.statistics
 
42
WHERE table_name='bug57252' AND index_name='akey';
 
43
 
 
44
DROP TABLE bug57252;
 
45
 
 
46
SET GLOBAL innodb_stats_on_metadata = @innodb_stats_on_metadata_orig;