Merge lp:~akopytov/percona-server/bug857590-5.5 into lp:percona-server/5.5

Proposed by Alexey Kopytov on 2011-09-23
Status: Merged
Approved by: Alexey Kopytov on 2011-09-27
Approved revision: 152
Merged at revision: 160
Proposed branch: lp:~akopytov/percona-server/bug857590-5.5
Merge into: lp:percona-server/5.5
Diff against target: 90 lines (+83/-0)
1 file modified
patches/innodb_expand_fast_index_creation.patch (+83/-0)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug857590-5.5
Reviewer Review Type Date Requested Status
Oleg Tsarev (community) 2011-09-26 Approve on 2011-09-27
Laurynas Biveinis 2011-09-23 Approve on 2011-09-26
Review via email: mp+76802@code.launchpad.net
To post a comment you must log in.
152. By Alexey Kopytov on 2011-09-23

Bug #857590: Fast index creation does not update index statistics

The problem was that index statistics was not updated by the fast index
creation code. This could break applications relying on the old behavior
when adding a key by copying rows into a temporary table would result in
a relatively up-to-day index stats.

Fixed by adding a dict_update_statistics() call to
row_merge_build_indexes() in case index creation has succeeded.

LGTM

review: Approve
Alexey Kopytov (akopytov) wrote :

As discussed with Laurynas, it would be good to have a second reviewer for this MP.

Oleg Tsarev (tsarev) wrote :

Fix looks fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/innodb_expand_fast_index_creation.patch'
2--- patches/innodb_expand_fast_index_creation.patch 2011-09-22 11:49:13 +0000
3+++ patches/innodb_expand_fast_index_creation.patch 2011-09-23 20:32:35 +0000
4@@ -1121,3 +1121,86 @@
5 }
6 else
7 {
8+--- /dev/null
9++++ b/mysql-test/r/percona_innodb_expand_fast_index_creation.result
10+@@ -0,0 +1,32 @@
11++CREATE TABLE t1(
12++id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
13++a CHAR(1) NOT NULL,
14++b CHAR(36) NOT NULL) ENGINE=InnoDB;
15++INSERT INTO t1(a,b) VALUES ('a','b');
16++INSERT INTO t1(a,b) SELECT a,b FROM t1;
17++INSERT INTO t1(a,b) SELECT a,b FROM t1;
18++INSERT INTO t1(a,b) SELECT a,b FROM t1;
19++INSERT INTO t1(a,b) SELECT a,b FROM t1;
20++ALTER TABLE t1 ADD KEY (a);
21++EXPLAIN SELECT COUNT(*) FROM t1, t1 t2 WHERE t1.a = t2.a AND t1.b = t2.b;
22++id 1
23++select_type SIMPLE
24++table t1
25++type ALL
26++possible_keys a
27++key NULL
28++key_len NULL
29++ref NULL
30++rows 16
31++Extra
32++id 1
33++select_type SIMPLE
34++table t2
35++type ALL
36++possible_keys a
37++key NULL
38++key_len NULL
39++ref NULL
40++rows 16
41++Extra Using where; Using join buffer
42++DROP TABLE t1;
43+--- /dev/null
44++++ b/mysql-test/t/percona_innodb_expand_fast_index_creation.test
45+@@ -0,0 +1,23 @@
46++--source include/have_innodb.inc
47++
48++########################################################################
49++# Bug #857590: Fast index creation does not update index statistics
50++########################################################################
51++
52++CREATE TABLE t1(
53++ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
54++ a CHAR(1) NOT NULL,
55++ b CHAR(36) NOT NULL) ENGINE=InnoDB;
56++
57++INSERT INTO t1(a,b) VALUES ('a','b');
58++INSERT INTO t1(a,b) SELECT a,b FROM t1;
59++INSERT INTO t1(a,b) SELECT a,b FROM t1;
60++INSERT INTO t1(a,b) SELECT a,b FROM t1;
61++INSERT INTO t1(a,b) SELECT a,b FROM t1;
62++
63++ALTER TABLE t1 ADD KEY (a);
64++
65++--vertical_results
66++EXPLAIN SELECT COUNT(*) FROM t1, t1 t2 WHERE t1.a = t2.a AND t1.b = t2.b;
67++
68++DROP TABLE t1;
69+--- a/storage/innobase/row/row0merge.c
70++++ b/storage/innobase/row/row0merge.c
71+@@ -2672,6 +2672,8 @@
72+ }
73+ }
74+
75++ dict_update_statistics(new_table, FALSE, TRUE);
76++
77+ func_exit:
78+ row_merge_file_destroy_low(tmpfd);
79+
80+--- a/mysql-test/suite/innodb/r/innodb-index.result
81++++ b/mysql-test/suite/innodb/r/innodb-index.result
82+@@ -877,7 +877,7 @@
83+ test.t1 check status OK
84+ explain select * from t1 where b like 'adfd%';
85+ id select_type table type possible_keys key key_len ref rows Extra
86+-1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
87++1 SIMPLE t1 range b b 769 NULL 11 Using where
88+ drop table t1;
89+ set global innodb_file_per_table=on;
90+ set global innodb_file_format='Barracuda';

Subscribers

People subscribed via source and target branches