Merge lp:~percona-dev/percona-server/5.1-bug757749 into lp:~percona-dev/percona-server/5.1.56

Proposed by Alexey Kopytov
Status: Merged
Merged at revision: 220
Proposed branch: lp:~percona-dev/percona-server/5.1-bug757749
Merge into: lp:~percona-dev/percona-server/5.1.56
Diff against target: 200 lines (+55/-24)
2 files modified
innodb_expand_fast_index_creation.patch (+46/-24)
mysql-test.diff (+9/-0)
To merge this branch: bzr merge lp:~percona-dev/percona-server/5.1-bug757749
Reviewer Review Type Date Requested Status
Percona developers Pending
Review via email: mp+57304@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_expand_fast_index_creation.patch'
2--- innodb_expand_fast_index_creation.patch 2011-03-31 11:16:54 +0000
3+++ innodb_expand_fast_index_creation.patch 2011-04-12 11:10:15 +0000
4@@ -4,8 +4,9 @@
5 # Expands the applicability of InnoDB fast index creation to mysqldump,
6 # ALTER TABLE and OPTIMIZE TABLE.
7 #
8---- a/client/client_priv.h 2011-03-31 12:04:39.000000000 +0400
9-+++ b/client/client_priv.h 2011-03-31 12:10:21.000000000 +0400
10+diff -ruN a/client/client_priv.h b/client/client_priv.h
11+--- a/client/client_priv.h 2011-04-11 23:22:54.000000000 +0400
12++++ b/client/client_priv.h 2011-04-11 23:22:55.000000000 +0400
13 @@ -96,5 +96,6 @@
14 OPT_FIRST_SLAVE,
15 OPT_ALL,
16@@ -13,8 +14,9 @@
17 + OPT_INNODB_OPTIMIZE_KEYS,
18 OPT_MAX_CLIENT_OPTION
19 };
20---- a/client/mysqldump.c 2011-03-31 12:04:37.000000000 +0400
21-+++ b/client/mysqldump.c 2011-03-31 12:05:39.000000000 +0400
22+diff -ruN a/client/mysqldump.c b/client/mysqldump.c
23+--- a/client/mysqldump.c 2011-04-11 23:22:49.000000000 +0400
24++++ b/client/mysqldump.c 2011-04-11 23:22:55.000000000 +0400
25 @@ -45,6 +45,7 @@
26 #include <m_ctype.h>
27 #include <hash.h>
28@@ -169,8 +171,9 @@
29 /* Moved enable keys to before unlock per bug 15977 */
30 if (opt_disable_keys)
31 {
32+diff -ruN /dev/null b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result
33 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
34-+++ b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result 2011-03-31 12:05:39.000000000 +0400
35++++ b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result 2011-04-11 23:22:55.000000000 +0400
36 @@ -0,0 +1,109 @@
37 +#
38 +# Test the --innodb-optimize-keys option.
39@@ -281,8 +284,9 @@
40 +
41 +######################################
42 +DROP TABLE t1, t2;
43---- a/mysql-test/suite/innodb_plugin/r/innodb.result 2011-03-31 12:04:33.000000000 +0400
44-+++ b/mysql-test/suite/innodb_plugin/r/innodb.result 2011-03-31 12:05:39.000000000 +0400
45+diff -ruN a/mysql-test/suite/innodb_plugin/r/innodb.result b/mysql-test/suite/innodb_plugin/r/innodb.result
46+--- a/mysql-test/suite/innodb_plugin/r/innodb.result 2011-02-11 22:49:37.000000000 +0300
47++++ b/mysql-test/suite/innodb_plugin/r/innodb.result 2011-04-11 23:22:55.000000000 +0400
48 @@ -1679,7 +1679,7 @@
49 71
50 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
51@@ -292,8 +296,9 @@
52 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
53 variable_value - @innodb_rows_updated_orig
54 866
55+diff -ruN a/mysql-test/suite/innodb_plugin/t/innodb-index.test b/mysql-test/suite/innodb_plugin/t/innodb-index.test
56 --- a/mysql-test/suite/innodb_plugin/t/innodb-index.test 2011-02-11 22:49:34.000000000 +0300
57-+++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test 2011-03-31 12:05:39.000000000 +0400
58++++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test 2011-04-11 23:22:55.000000000 +0400
59 @@ -38,6 +38,11 @@
60 show create table t1;
61 --error ER_MULTIPLE_PRI_KEY
62@@ -306,8 +311,9 @@
63 --error ER_DUP_ENTRY
64 alter table t1 drop primary key, add primary key (b);
65 create unique index c on t1 (c);
66+diff -ruN a/mysql-test/suite/innodb_plugin/t/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test
67 --- a/mysql-test/suite/innodb_plugin/t/innodb.test 2011-02-11 22:49:35.000000000 +0300
68-+++ b/mysql-test/suite/innodb_plugin/t/innodb.test 2011-03-31 12:05:39.000000000 +0400
69++++ b/mysql-test/suite/innodb_plugin/t/innodb.test 2011-04-11 23:22:55.000000000 +0400
70 @@ -15,6 +15,12 @@
71
72 -- source include/have_innodb_plugin.inc
73@@ -321,8 +327,9 @@
74 let $MYSQLD_DATADIR= `select @@datadir`;
75
76 # Save the original values of some variables in order to be able to
77+diff -ruN /dev/null b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test
78 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
79-+++ b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test 2011-03-31 12:05:39.000000000 +0400
80++++ b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test 2011-04-11 23:22:55.000000000 +0400
81 @@ -0,0 +1,62 @@
82 +# Embedded server doesn't support external clients
83 +--source include/not_embedded.inc
84@@ -386,8 +393,9 @@
85 +
86 +# Wait till we reached the initial number of concurrent sessions
87 +--source include/wait_until_count_sessions.inc
88---- a/sql/sql_lex.cc 2011-03-31 12:04:37.000000000 +0400
89-+++ b/sql/sql_lex.cc 2011-03-31 12:13:39.000000000 +0400
90+diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc
91+--- a/sql/sql_lex.cc 2011-04-11 23:22:49.000000000 +0400
92++++ b/sql/sql_lex.cc 2011-04-11 23:22:55.000000000 +0400
93 @@ -1494,6 +1494,9 @@
94 alter_list(rhs.alter_list, mem_root),
95 key_list(rhs.key_list, mem_root),
96@@ -406,8 +414,9 @@
97 /* partition_names are not deeply copied currently */
98 }
99
100---- a/sql/sql_lex.h 2011-03-31 12:04:38.000000000 +0400
101-+++ b/sql/sql_lex.h 2011-03-31 12:14:36.000000000 +0400
102+diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
103+--- a/sql/sql_lex.h 2011-04-11 23:22:50.000000000 +0400
104++++ b/sql/sql_lex.h 2011-04-11 23:22:55.000000000 +0400
105 @@ -896,6 +896,9 @@
106 List<Alter_column> alter_list;
107 List<Key> key_list;
108@@ -437,8 +446,9 @@
109 flags= 0;
110 keys_onoff= LEAVE_AS_IS;
111 tablespace_op= NO_TABLESPACE_OP;
112---- a/sql/sql_table.cc 2011-03-31 12:04:35.000000000 +0400
113-+++ b/sql/sql_table.cc 2011-03-31 12:05:39.000000000 +0400
114+diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
115+--- a/sql/sql_table.cc 2011-04-11 23:22:40.000000000 +0400
116++++ b/sql/sql_table.cc 2011-04-11 23:44:23.000000000 +0400
117 @@ -2558,7 +2558,7 @@
118 file The handler for the new table.
119 key_info_buffer OUT An array of KEY structs for the indexes.
120@@ -531,11 +541,12 @@
121 for which some fields exists.
122 - */
123 +
124-+ We also skip secondary keys for InnoDB tables and store them in
125-+ delayed_key_list to create them later after copying the data to make use of
126-+ the InnoDB fast index creation. The following conditions must be met:
127++ We also store secondary keys in delayed_key_list to make use of
128++ the InnoDB fast index creation. The following conditions must be
129++ met:
130 +
131-+ - we are going to create an InnoDB table;
132++ - we are going to create an InnoDB table (this is checked later when the
133++ target engine is known);
134 + - the key most be a non-UNIQUE one;
135 + - there are no foreign keys. This can be optimized later to exclude only
136 + those keys which are a part of foreign key constraints. Currently we
137@@ -544,7 +555,6 @@
138 + */
139 +
140 + skip_secondary=
141-+ !my_strcasecmp(system_charset_info, table->file->table_type(), "InnoDB") &&
142 + !table->file->get_foreign_key_list(thd, &f_key_list) &&
143 + f_key_list.elements == 0;
144
145@@ -696,12 +706,24 @@
146 DEBUG_SYNC(thd, "alter_table_before_create_table_no_lock");
147 /*
148 Create a table with a temporary name.
149-@@ -7277,12 +7434,21 @@
150+@@ -7274,15 +7431,33 @@
151+ */
152+ if (new_table && !(new_table->file->ha_table_flags() & HA_NO_COPY_ON_ALTER))
153+ {
154++ /*
155++ Check if we can temporarily remove secondary indexes from the table
156++ before copying the data and recreate them later to utilize InnoDB fast
157++ index creation.
158++ TODO: is there a better way to check for InnoDB?
159++ */
160++ bool optimize_keys= (alter_info->delayed_key_count > 0) &&
161++ !my_strcasecmp(system_charset_info,
162++ new_table->file->table_type(), "InnoDB");
163 /* We don't want update TIMESTAMP fields during ALTER TABLE. */
164 new_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
165 new_table->next_number_field=new_table->found_next_number_field;
166 +
167-+ if (alter_info->delayed_key_count > 0)
168++ if (optimize_keys)
169 + {
170 + /* ignore the error */
171 + error= remove_secondary_keys(thd, new_table, alter_info);
172@@ -713,7 +735,7 @@
173 order_num, order, &copied, &deleted,
174 alter_info->keys_onoff,
175 alter_info->error_if_not_empty);
176-+ if (!error && alter_info->delayed_key_count > 0)
177++ if (!error && optimize_keys)
178 + error= restore_secondary_keys(thd, new_table, alter_info);
179 }
180 else
181
182=== modified file 'mysql-test.diff'
183--- mysql-test.diff 2011-02-08 23:02:17 +0000
184+++ mysql-test.diff 2011-04-12 11:10:15 +0000
185@@ -712,6 +712,15 @@
186 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
187 variable_value
188 16384
189+@@ -1671,7 +1673,7 @@
190+ 71
191+ SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
192+ variable_value - @innodb_rows_inserted_orig
193+-1063
194++1102
195+ SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
196+ variable_value - @innodb_rows_updated_orig
197+ 865
198 @@ -1690,9 +1692,10 @@
199 SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
200 variable_value - @innodb_row_lock_time_avg_orig

Subscribers

People subscribed via source and target branches