Merge lp:~stewart/percona-server/5.1.67 into lp:percona-server/5.1
- 5.1.67
- Merge into 5.1
Proposed by
Stewart Smith
Status: | Merged |
---|---|
Approved by: | Laurynas Biveinis |
Approved revision: | no longer in the source branch. |
Merged at revision: | 542 |
Proposed branch: | lp:~stewart/percona-server/5.1.67 |
Merge into: | lp:percona-server/5.1 |
Prerequisite: | lp:~percona-core/percona-server/release-5.1.66-14.2 |
Diff against target: |
3724 lines (+1320/-575) 69 files modified
Percona-Server/client/mysql.cc (+89/-2) Percona-Server/configure.in (+1/-1) Percona-Server/libmysql/libmysql.c (+1/-1) Percona-Server/mysql-test/r/ctype_ucs.result (+26/-0) Percona-Server/mysql-test/r/loaddata.result (+0/-29) Percona-Server/mysql-test/r/sp_notembedded.result (+1/-1) Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test (+1/-1) Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test (+1/-1) Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result (+53/-0) Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test (+95/-0) Percona-Server/mysql-test/t/ctype_ucs.test (+32/-0) Percona-Server/mysql-test/t/loaddata.test (+34/-30) Percona-Server/mysql-test/t/sp_notembedded.test (+10/-10) Percona-Server/scripts/mysql_install_db.pl.in (+18/-3) Percona-Server/scripts/mysqld_multi.sh (+22/-0) Percona-Server/scripts/mysqld_safe.sh (+34/-1) Percona-Server/sql/hostname.cc (+9/-0) Percona-Server/sql/item_cmpfunc.cc (+20/-1) Percona-Server/sql/item_func.cc (+2/-1) Percona-Server/sql/item_func.h (+1/-0) Percona-Server/sql/log.cc (+6/-0) Percona-Server/sql/log_event.cc (+55/-4) Percona-Server/sql/log_event.h (+3/-3) Percona-Server/sql/mysql_priv.h (+35/-0) Percona-Server/sql/mysqld.cc (+1/-1) Percona-Server/sql/sp_head.cc (+27/-21) Percona-Server/sql/sql_acl.cc (+169/-93) Percona-Server/sql/sql_connect.cc (+60/-8) Percona-Server/sql/sql_lex.cc (+1/-0) Percona-Server/sql/sql_list.h (+9/-2) Percona-Server/sql/sql_profile.cc (+19/-10) Percona-Server/sql/sql_profile.h (+4/-2) Percona-Server/sql/sql_select.cc (+13/-13) Percona-Server/storage/innobase/btr/btr0cur.c (+6/-5) Percona-Server/storage/innobase/dict/dict0dict.c (+15/-3) Percona-Server/storage/innobase/handler/ha_innodb.cc (+2/-2) Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c (+25/-3) Percona-Server/storage/innobase/include/btr0cur.h (+5/-4) Percona-Server/storage/innobase/include/dict0mem.h (+6/-1) Percona-Server/storage/innobase/include/row0undo.h (+2/-7) Percona-Server/storage/innobase/os/os0file.c (+15/-0) Percona-Server/storage/innobase/row/row0sel.c (+17/-8) Percona-Server/storage/innobase/row/row0umod.c (+0/-54) Percona-Server/storage/innobase/row/row0undo.c (+0/-19) Percona-Server/storage/innodb_plugin/ChangeLog (+37/-0) Percona-Server/storage/innodb_plugin/btr/btr0btr.c (+17/-15) Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+22/-18) Percona-Server/storage/innodb_plugin/buf/buf0buf.c (+4/-3) Percona-Server/storage/innodb_plugin/buf/buf0lru.c (+3/-1) Percona-Server/storage/innodb_plugin/dict/dict0dict.c (+60/-31) Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+2/-2) Percona-Server/storage/innodb_plugin/handler/handler0alter.cc (+6/-2) Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c (+26/-3) Percona-Server/storage/innodb_plugin/include/btr0cur.h (+6/-5) Percona-Server/storage/innodb_plugin/include/dict0dict.h (+12/-0) Percona-Server/storage/innodb_plugin/include/dict0mem.h (+6/-1) Percona-Server/storage/innodb_plugin/include/page0zip.h (+5/-3) Percona-Server/storage/innodb_plugin/include/row0undo.h (+0/-7) Percona-Server/storage/innodb_plugin/log/log0recv.c (+2/-3) Percona-Server/storage/innodb_plugin/os/os0file.c (+15/-0) Percona-Server/storage/innodb_plugin/page/page0cur.c (+3/-3) Percona-Server/storage/innodb_plugin/page/page0page.c (+8/-6) Percona-Server/storage/innodb_plugin/page/page0zip.c (+111/-46) Percona-Server/storage/innodb_plugin/row/row0mysql.c (+4/-1) Percona-Server/storage/innodb_plugin/row/row0sel.c (+17/-7) Percona-Server/storage/innodb_plugin/row/row0umod.c (+0/-53) Percona-Server/storage/innodb_plugin/row/row0undo.c (+0/-19) Percona-Server/storage/myisam/myisamchk.c (+8/-1) Percona-Server/tests/mysql_client_test.c (+1/-0) |
To merge this branch: | bzr merge lp:~stewart/percona-server/5.1.67 |
Related bugs: | |
Related blueprints: |
Rebase on MySQL 5.1.67
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Approve | ||
Review via email: mp+142635@code.launchpad.net |
Commit message
Description of the change
Merge MySQL 5.1.67.
This will seemingly have to wait for MySQL 5.5.30 to be properly merged in as there are (again) changesets in 5.1 that aren't in 5.5.
This was mostly auto merge, apart from binlog quoting (which I reverted in the MySQL branch before merging) and minor bit in sql/log_event.cc
http://
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) : | # |
review:
Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Percona-Server/client/mysql.cc' | |||
2 | --- Percona-Server/client/mysql.cc 2013-01-10 04:35:31 +0000 | |||
3 | +++ Percona-Server/client/mysql.cc 2013-01-10 04:35:33 +0000 | |||
4 | @@ -250,6 +250,8 @@ | |||
5 | 250 | static char *get_arg(char *line, my_bool get_next_arg); | 250 | static char *get_arg(char *line, my_bool get_next_arg); |
6 | 251 | static void init_username(); | 251 | static void init_username(); |
7 | 252 | static void add_int_to_prompt(int toadd); | 252 | static void add_int_to_prompt(int toadd); |
8 | 253 | static int normalize_dbname(const char *line, char *buff, uint buff_size); | ||
9 | 254 | static int get_quote_count(const char *line); | ||
10 | 253 | 255 | ||
11 | 254 | /* A structure which contains information on the commands this program | 256 | /* A structure which contains information on the commands this program |
12 | 255 | can understand. */ | 257 | can understand. */ |
13 | @@ -4172,8 +4174,23 @@ | |||
14 | 4172 | int select_db; | 4174 | int select_db; |
15 | 4173 | 4175 | ||
16 | 4174 | bzero(buff, sizeof(buff)); | 4176 | bzero(buff, sizeof(buff)); |
19 | 4175 | strmake(buff, line, sizeof(buff) - 1); | 4177 | |
20 | 4176 | tmp= get_arg(buff, 0); | 4178 | /* |
21 | 4179 | In case number of quotes exceed 2, we try to get | ||
22 | 4180 | the normalized db name. | ||
23 | 4181 | */ | ||
24 | 4182 | if (get_quote_count(line) > 2) | ||
25 | 4183 | { | ||
26 | 4184 | if (normalize_dbname(line, buff, sizeof(buff))) | ||
27 | 4185 | return put_error(&mysql); | ||
28 | 4186 | tmp= buff; | ||
29 | 4187 | } | ||
30 | 4188 | else | ||
31 | 4189 | { | ||
32 | 4190 | strmake(buff, line, sizeof(buff) - 1); | ||
33 | 4191 | tmp= get_arg(buff, 0); | ||
34 | 4192 | } | ||
35 | 4193 | |||
36 | 4177 | if (!tmp || !*tmp) | 4194 | if (!tmp || !*tmp) |
37 | 4178 | { | 4195 | { |
38 | 4179 | put_info("USE must be followed by a database name", INFO_ERROR); | 4196 | put_info("USE must be followed by a database name", INFO_ERROR); |
39 | @@ -4239,6 +4256,62 @@ | |||
40 | 4239 | return 0; | 4256 | return 0; |
41 | 4240 | } | 4257 | } |
42 | 4241 | 4258 | ||
43 | 4259 | /** | ||
44 | 4260 | Normalize database name. | ||
45 | 4261 | |||
46 | 4262 | @param line [IN] The command. | ||
47 | 4263 | @param buff [OUT] Normalized db name. | ||
48 | 4264 | @param buff_size [IN] Buffer size. | ||
49 | 4265 | |||
50 | 4266 | @return Operation status | ||
51 | 4267 | @retval 0 Success | ||
52 | 4268 | @retval 1 Failure | ||
53 | 4269 | |||
54 | 4270 | @note Sometimes server normilizes the database names | ||
55 | 4271 | & APIs like mysql_select_db() expect normalized | ||
56 | 4272 | database names. Since it is difficult to perform | ||
57 | 4273 | the name conversion/normalization on the client | ||
58 | 4274 | side, this function tries to get the normalized | ||
59 | 4275 | dbname (indirectly) from the server. | ||
60 | 4276 | */ | ||
61 | 4277 | |||
62 | 4278 | static int | ||
63 | 4279 | normalize_dbname(const char *line, char *buff, uint buff_size) | ||
64 | 4280 | { | ||
65 | 4281 | MYSQL_RES *res= NULL; | ||
66 | 4282 | |||
67 | 4283 | /* Send the "USE db" commmand to the server. */ | ||
68 | 4284 | if (mysql_query(&mysql, line)) | ||
69 | 4285 | return 1; | ||
70 | 4286 | |||
71 | 4287 | /* | ||
72 | 4288 | Now, get the normalized database name and store it | ||
73 | 4289 | into the buff. | ||
74 | 4290 | */ | ||
75 | 4291 | if (!mysql_query(&mysql, "SELECT DATABASE()") && | ||
76 | 4292 | (res= mysql_use_result(&mysql))) | ||
77 | 4293 | { | ||
78 | 4294 | MYSQL_ROW row= mysql_fetch_row(res); | ||
79 | 4295 | if (row && row[0]) | ||
80 | 4296 | { | ||
81 | 4297 | size_t len= strlen(row[0]); | ||
82 | 4298 | /* Make sure there is enough room to store the dbname. */ | ||
83 | 4299 | if ((len > buff_size) || ! memcpy(buff, row[0], len)) | ||
84 | 4300 | { | ||
85 | 4301 | mysql_free_result(res); | ||
86 | 4302 | return 1; | ||
87 | 4303 | } | ||
88 | 4304 | } | ||
89 | 4305 | mysql_free_result(res); | ||
90 | 4306 | } | ||
91 | 4307 | |||
92 | 4308 | /* Restore the original database. */ | ||
93 | 4309 | if (current_db && mysql_select_db(&mysql, current_db)) | ||
94 | 4310 | return 1; | ||
95 | 4311 | |||
96 | 4312 | return 0; | ||
97 | 4313 | } | ||
98 | 4314 | |||
99 | 4242 | static int | 4315 | static int |
100 | 4243 | com_warnings(String *buffer __attribute__((unused)), | 4316 | com_warnings(String *buffer __attribute__((unused)), |
101 | 4244 | char *line __attribute__((unused))) | 4317 | char *line __attribute__((unused))) |
102 | @@ -4318,6 +4391,20 @@ | |||
103 | 4318 | return valid_arg ? start : NullS; | 4391 | return valid_arg ? start : NullS; |
104 | 4319 | } | 4392 | } |
105 | 4320 | 4393 | ||
106 | 4394 | /* | ||
107 | 4395 | Number of quotes present in the command's argument. | ||
108 | 4396 | */ | ||
109 | 4397 | static int | ||
110 | 4398 | get_quote_count(const char *line) | ||
111 | 4399 | { | ||
112 | 4400 | int quote_count; | ||
113 | 4401 | const char *ptr= line; | ||
114 | 4402 | |||
115 | 4403 | for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`")) | ||
116 | 4404 | quote_count ++; | ||
117 | 4405 | |||
118 | 4406 | return quote_count; | ||
119 | 4407 | } | ||
120 | 4321 | 4408 | ||
121 | 4322 | static int | 4409 | static int |
122 | 4323 | sql_real_connect(char *host,char *database,char *user,char *password, | 4410 | sql_real_connect(char *host,char *database,char *user,char *password, |
123 | 4324 | 4411 | ||
124 | === modified file 'Percona-Server/configure.in' | |||
125 | --- Percona-Server/configure.in 2013-01-10 04:35:31 +0000 | |||
126 | +++ Percona-Server/configure.in 2013-01-10 04:35:33 +0000 | |||
127 | @@ -12,7 +12,7 @@ | |||
128 | 12 | dnl When changing the major version number please also check the switch | 12 | dnl When changing the major version number please also check the switch |
129 | 13 | dnl statement in mysqlbinlog::check_master_version(). You may also need | 13 | dnl statement in mysqlbinlog::check_master_version(). You may also need |
130 | 14 | dnl to update version.c in ndb. | 14 | dnl to update version.c in ndb. |
132 | 15 | AC_INIT([MySQL Server], [5.1.66], [], [mysql]) | 15 | AC_INIT([MySQL Server], [5.1.67], [], [mysql]) |
133 | 16 | 16 | ||
134 | 17 | AC_CONFIG_SRCDIR([sql/mysqld.cc]) | 17 | AC_CONFIG_SRCDIR([sql/mysqld.cc]) |
135 | 18 | AC_CANONICAL_SYSTEM | 18 | AC_CANONICAL_SYSTEM |
136 | 19 | 19 | ||
137 | === modified file 'Percona-Server/libmysql/libmysql.c' | |||
138 | --- Percona-Server/libmysql/libmysql.c 2012-08-20 00:29:22 +0000 | |||
139 | +++ Percona-Server/libmysql/libmysql.c 2013-01-10 04:35:33 +0000 | |||
140 | @@ -4653,7 +4653,7 @@ | |||
141 | 4653 | if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE) | 4653 | if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE) |
142 | 4654 | { | 4654 | { |
143 | 4655 | set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL); | 4655 | set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL); |
145 | 4656 | return 1; | 4656 | DBUG_RETURN(1); |
146 | 4657 | } | 4657 | } |
147 | 4658 | if (column >= stmt->field_count) | 4658 | if (column >= stmt->field_count) |
148 | 4659 | { | 4659 | { |
149 | 4660 | 4660 | ||
150 | === renamed file 'Percona-Server/mysql-test/include/mysqlbinlog_row_engine.inc' => 'Percona-Server/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc' | |||
151 | === modified file 'Percona-Server/mysql-test/r/ctype_ucs.result' | |||
152 | --- Percona-Server/mysql-test/r/ctype_ucs.result 2011-03-03 15:39:26 +0000 | |||
153 | +++ Percona-Server/mysql-test/r/ctype_ucs.result 2013-01-10 04:35:33 +0000 | |||
154 | @@ -191,6 +191,32 @@ | |||
155 | 191 | `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' | 191 | `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' |
156 | 192 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | 192 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
157 | 193 | DROP TABLE t1; | 193 | DROP TABLE t1; |
158 | 194 | # | ||
159 | 195 | # Bug #51876 : crash/memory underrun when loading data with ucs2 | ||
160 | 196 | # and reverse() function | ||
161 | 197 | # | ||
162 | 198 | # Problem # 1 (original report): wrong parsing of ucs2 data | ||
163 | 199 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; | ||
164 | 200 | CREATE TABLE t1(a INT); | ||
165 | 201 | LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
166 | 202 | (@b) SET a=REVERSE(@b); | ||
167 | 203 | # should return 2 zeroes (as the value is truncated) | ||
168 | 204 | SELECT * FROM t1; | ||
169 | 205 | a | ||
170 | 206 | 0 | ||
171 | 207 | 1 | ||
172 | 208 | DROP TABLE t1; | ||
173 | 209 | # Problem # 2 : if you write and read ucs2 data to a file they're lost | ||
174 | 210 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; | ||
175 | 211 | CREATE TABLE t1(a INT); | ||
176 | 212 | LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
177 | 213 | (@b) SET a=REVERSE(@b); | ||
178 | 214 | # should return 0 and 1 (10 reversed) | ||
179 | 215 | SELECT * FROM t1; | ||
180 | 216 | a | ||
181 | 217 | 0 | ||
182 | 218 | 1 | ||
183 | 219 | DROP TABLE t1; | ||
184 | 194 | create table t2(f1 Char(30)); | 220 | create table t2(f1 Char(30)); |
185 | 195 | insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000"); | 221 | insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000"); |
186 | 196 | select lpad(f1, 12, "-o-/") from t2; | 222 | select lpad(f1, 12, "-o-/") from t2; |
187 | 197 | 223 | ||
188 | === modified file 'Percona-Server/mysql-test/r/loaddata.result' | |||
189 | --- Percona-Server/mysql-test/r/loaddata.result 2011-05-10 13:57:40 +0000 | |||
190 | +++ Percona-Server/mysql-test/r/loaddata.result 2013-01-10 04:35:33 +0000 | |||
191 | @@ -504,35 +504,6 @@ | |||
192 | 504 | LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; | 504 | LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; |
193 | 505 | DROP TABLE t1; | 505 | DROP TABLE t1; |
194 | 506 | # | 506 | # |
195 | 507 | # Bug #51876 : crash/memory underrun when loading data with ucs2 | ||
196 | 508 | # and reverse() function | ||
197 | 509 | # | ||
198 | 510 | # Problem # 1 (original report): wrong parsing of ucs2 data | ||
199 | 511 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; | ||
200 | 512 | CREATE TABLE t1(a INT); | ||
201 | 513 | LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
202 | 514 | (@b) SET a=REVERSE(@b); | ||
203 | 515 | Warnings: | ||
204 | 516 | Warning 1366 Incorrect integer value: '00' for column 'a' at row 1 | ||
205 | 517 | Warning 1366 Incorrect integer value: '10' for column 'a' at row 2 | ||
206 | 518 | # should return 2 zeroes (as the value is truncated) | ||
207 | 519 | SELECT * FROM t1; | ||
208 | 520 | a | ||
209 | 521 | 0 | ||
210 | 522 | 0 | ||
211 | 523 | DROP TABLE t1; | ||
212 | 524 | # Problem # 2 : if you write and read ucs2 data to a file they're lost | ||
213 | 525 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; | ||
214 | 526 | CREATE TABLE t1(a INT); | ||
215 | 527 | LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
216 | 528 | (@b) SET a=REVERSE(@b); | ||
217 | 529 | # should return 0 and 1 (10 reversed) | ||
218 | 530 | SELECT * FROM t1; | ||
219 | 531 | a | ||
220 | 532 | 0 | ||
221 | 533 | 1 | ||
222 | 534 | DROP TABLE t1; | ||
223 | 535 | # | ||
224 | 536 | # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U | 507 | # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U |
225 | 537 | # | 508 | # |
226 | 538 | CREATE TABLE t1(f1 INT); | 509 | CREATE TABLE t1(f1 INT); |
227 | 539 | 510 | ||
228 | === modified file 'Percona-Server/mysql-test/r/sp_notembedded.result' | |||
229 | --- Percona-Server/mysql-test/r/sp_notembedded.result 2012-03-28 06:35:31 +0000 | |||
230 | +++ Percona-Server/mysql-test/r/sp_notembedded.result 2013-01-10 04:35:33 +0000 | |||
231 | @@ -248,7 +248,6 @@ | |||
232 | 248 | DROP PROCEDURE p1; | 248 | DROP PROCEDURE p1; |
233 | 249 | DELETE FROM mysql.user WHERE User='mysqltest_1'; | 249 | DELETE FROM mysql.user WHERE User='mysqltest_1'; |
234 | 250 | FLUSH PRIVILEGES; | 250 | FLUSH PRIVILEGES; |
235 | 251 | set @@global.concurrent_insert= @old_concurrent_insert; | ||
236 | 252 | # | 251 | # |
237 | 253 | # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. | 252 | # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. |
238 | 254 | # | 253 | # |
239 | @@ -302,3 +301,4 @@ | |||
240 | 302 | # ------------------------------------------------------------------ | 301 | # ------------------------------------------------------------------ |
241 | 303 | # -- End of 5.1 tests | 302 | # -- End of 5.1 tests |
242 | 304 | # ------------------------------------------------------------------ | 303 | # ------------------------------------------------------------------ |
243 | 304 | set @@global.concurrent_insert= @old_concurrent_insert; | ||
244 | 305 | 305 | ||
245 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog-cp932.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result' | |||
246 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog2.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result' | |||
247 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_base64.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result' | |||
248 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result' | |||
249 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result' | |||
250 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result' | |||
251 | === renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result' | |||
252 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932-master.opt' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt' | |||
253 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test' | |||
254 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog2.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test' | |||
255 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_base64.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test' | |||
256 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test' | |||
257 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test' | |||
258 | --- Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test 2008-08-20 14:06:31 +0000 | |||
259 | +++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test 2013-01-10 04:35:33 +0000 | |||
260 | @@ -20,5 +20,5 @@ | |||
261 | 20 | --source include/have_binlog_format_row.inc | 20 | --source include/have_binlog_format_row.inc |
262 | 21 | --source include/have_ucs2.inc | 21 | --source include/have_ucs2.inc |
263 | 22 | 22 | ||
265 | 23 | --source include/mysqlbinlog_row_engine.inc | 23 | --source extra/binlog_tests/mysqlbinlog_row_engine.inc |
266 | 24 | 24 | ||
267 | 25 | 25 | ||
268 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test' | |||
269 | --- Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test 2008-08-20 14:06:31 +0000 | |||
270 | +++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test 2013-01-10 04:35:33 +0000 | |||
271 | @@ -20,4 +20,4 @@ | |||
272 | 20 | --source include/have_binlog_format_row.inc | 20 | --source include/have_binlog_format_row.inc |
273 | 21 | --source include/have_ucs2.inc | 21 | --source include/have_ucs2.inc |
274 | 22 | 22 | ||
276 | 23 | --source include/mysqlbinlog_row_engine.inc | 23 | --source extra/binlog_tests/mysqlbinlog_row_engine.inc |
277 | 24 | 24 | ||
278 | === renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_trans.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test' | |||
279 | === added file 'Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result' | |||
280 | --- Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 1970-01-01 00:00:00 +0000 | |||
281 | +++ Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 2013-01-10 04:35:33 +0000 | |||
282 | @@ -0,0 +1,53 @@ | |||
283 | 1 | use test; | ||
284 | 2 | drop table if exists t1; | ||
285 | 3 | create table t1 (id int primary key, value int, value2 int, | ||
286 | 4 | value3 int, index(value,value2)) engine=innodb; | ||
287 | 5 | insert into t1 values | ||
288 | 6 | (10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), | ||
289 | 7 | (15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), | ||
290 | 8 | (20,20,20,20); | ||
291 | 9 | use test; | ||
292 | 10 | start transaction with consistent snapshot; | ||
293 | 11 | use test; | ||
294 | 12 | CREATE PROCEDURE update_t1() | ||
295 | 13 | BEGIN | ||
296 | 14 | DECLARE i INT DEFAULT 1; | ||
297 | 15 | while (i <= 5000) DO | ||
298 | 16 | update test.t1 set value2=value2+1, value3=value3+1 where id=12; | ||
299 | 17 | SET i = i + 1; | ||
300 | 18 | END WHILE; | ||
301 | 19 | END| | ||
302 | 20 | set autocommit=0; | ||
303 | 21 | CALL update_t1(); | ||
304 | 22 | select * from t1; | ||
305 | 23 | id value value2 value3 | ||
306 | 24 | 10 10 10 10 | ||
307 | 25 | 11 11 11 11 | ||
308 | 26 | 12 12 5012 5012 | ||
309 | 27 | 13 13 13 13 | ||
310 | 28 | 14 14 14 14 | ||
311 | 29 | 15 15 15 15 | ||
312 | 30 | 16 16 16 16 | ||
313 | 31 | 17 17 17 17 | ||
314 | 32 | 18 18 18 18 | ||
315 | 33 | 19 19 19 19 | ||
316 | 34 | 20 20 20 20 | ||
317 | 35 | set autocommit=1; | ||
318 | 36 | select * from t1; | ||
319 | 37 | id value value2 value3 | ||
320 | 38 | 10 10 10 10 | ||
321 | 39 | 11 11 11 11 | ||
322 | 40 | 12 12 5012 5012 | ||
323 | 41 | 13 13 13 13 | ||
324 | 42 | 14 14 14 14 | ||
325 | 43 | 15 15 15 15 | ||
326 | 44 | 16 16 16 16 | ||
327 | 45 | 17 17 17 17 | ||
328 | 46 | 18 18 18 18 | ||
329 | 47 | 19 19 19 19 | ||
330 | 48 | 20 20 20 20 | ||
331 | 49 | select * from t1 force index(value) where value=12; | ||
332 | 50 | kill query @id; | ||
333 | 51 | ERROR 70100: Query execution was interrupted | ||
334 | 52 | drop procedure if exists update_t1; | ||
335 | 53 | drop table if exists t1; | ||
336 | 0 | 54 | ||
337 | === added file 'Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test' | |||
338 | --- Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 1970-01-01 00:00:00 +0000 | |||
339 | +++ Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 2013-01-10 04:35:33 +0000 | |||
340 | @@ -0,0 +1,95 @@ | |||
341 | 1 | --source include/have_innodb.inc | ||
342 | 2 | |||
343 | 3 | # | ||
344 | 4 | # create test-bed to run test | ||
345 | 5 | # | ||
346 | 6 | use test; | ||
347 | 7 | --disable_warnings | ||
348 | 8 | drop table if exists t1; | ||
349 | 9 | --enable_warnings | ||
350 | 10 | create table t1 (id int primary key, value int, value2 int, | ||
351 | 11 | value3 int, index(value,value2)) engine=innodb; | ||
352 | 12 | |||
353 | 13 | insert into t1 values | ||
354 | 14 | (10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14), | ||
355 | 15 | (15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19), | ||
356 | 16 | (20,20,20,20); | ||
357 | 17 | let $ID= `SELECT @id := CONNECTION_ID()`; | ||
358 | 18 | |||
359 | 19 | # | ||
360 | 20 | # we need multiple connections as we need to keep one connection | ||
361 | 21 | # active with trx requesting consistent read. | ||
362 | 22 | # | ||
363 | 23 | connect (conn1, localhost, root,,); | ||
364 | 24 | connect (conn2, localhost, root,,); | ||
365 | 25 | connect (conn3, localhost, root,,); | ||
366 | 26 | |||
367 | 27 | # | ||
368 | 28 | # start trx with consistent read | ||
369 | 29 | # | ||
370 | 30 | connection conn1; | ||
371 | 31 | use test; | ||
372 | 32 | |||
373 | 33 | start transaction with consistent snapshot; | ||
374 | 34 | |||
375 | 35 | # | ||
376 | 36 | # update table such that secondary index is updated. | ||
377 | 37 | # | ||
378 | 38 | connection conn2; | ||
379 | 39 | use test; | ||
380 | 40 | delimiter |; | ||
381 | 41 | CREATE PROCEDURE update_t1() | ||
382 | 42 | BEGIN | ||
383 | 43 | DECLARE i INT DEFAULT 1; | ||
384 | 44 | while (i <= 5000) DO | ||
385 | 45 | update test.t1 set value2=value2+1, value3=value3+1 where id=12; | ||
386 | 46 | SET i = i + 1; | ||
387 | 47 | END WHILE; | ||
388 | 48 | END| | ||
389 | 49 | |||
390 | 50 | delimiter ;| | ||
391 | 51 | set autocommit=0; | ||
392 | 52 | CALL update_t1(); | ||
393 | 53 | select * from t1; | ||
394 | 54 | set autocommit=1; | ||
395 | 55 | select * from t1; | ||
396 | 56 | |||
397 | 57 | # | ||
398 | 58 | # Now try to fire select query from connection-1 enforcing | ||
399 | 59 | # use of secondary index. | ||
400 | 60 | # | ||
401 | 61 | connection conn1; | ||
402 | 62 | let $ID= `SELECT @id := CONNECTION_ID()`; | ||
403 | 63 | #--error ER_QUERY_INTERRUPTED | ||
404 | 64 | --send | ||
405 | 65 | select * from t1 force index(value) where value=12; | ||
406 | 66 | |||
407 | 67 | # | ||
408 | 68 | # select is going to take good time so let's kill query. | ||
409 | 69 | # | ||
410 | 70 | connection conn3; | ||
411 | 71 | let $wait_condition= | ||
412 | 72 | select * from information_schema.processlist where state = 'Sending data' and | ||
413 | 73 | info = 'select * from t1 force index(value) where value=12'; | ||
414 | 74 | --source include/wait_condition.inc | ||
415 | 75 | let $ignore= `SELECT @id := $ID`; | ||
416 | 76 | kill query @id; | ||
417 | 77 | |||
418 | 78 | # | ||
419 | 79 | # reap the value of connection-1 | ||
420 | 80 | # | ||
421 | 81 | connection conn1; | ||
422 | 82 | --error ER_QUERY_INTERRUPTED | ||
423 | 83 | reap; | ||
424 | 84 | |||
425 | 85 | # | ||
426 | 86 | # clean test-bed. | ||
427 | 87 | # | ||
428 | 88 | connection default; | ||
429 | 89 | disconnect conn1; | ||
430 | 90 | disconnect conn2; | ||
431 | 91 | disconnect conn3; | ||
432 | 92 | drop procedure if exists update_t1; | ||
433 | 93 | drop table if exists t1; | ||
434 | 94 | |||
435 | 95 | |||
436 | 0 | 96 | ||
437 | === modified file 'Percona-Server/mysql-test/t/ctype_ucs.test' | |||
438 | --- Percona-Server/mysql-test/t/ctype_ucs.test 2011-03-03 15:39:26 +0000 | |||
439 | +++ Percona-Server/mysql-test/t/ctype_ucs.test 2013-01-10 04:35:33 +0000 | |||
440 | @@ -68,6 +68,38 @@ | |||
441 | 68 | SHOW CREATE TABLE t1; | 68 | SHOW CREATE TABLE t1; |
442 | 69 | DROP TABLE t1; | 69 | DROP TABLE t1; |
443 | 70 | 70 | ||
444 | 71 | --echo # | ||
445 | 72 | --echo # Bug #51876 : crash/memory underrun when loading data with ucs2 | ||
446 | 73 | --echo # and reverse() function | ||
447 | 74 | --echo # | ||
448 | 75 | |||
449 | 76 | --echo # Problem # 1 (original report): wrong parsing of ucs2 data | ||
450 | 77 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; | ||
451 | 78 | CREATE TABLE t1(a INT); | ||
452 | 79 | LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
453 | 80 | (@b) SET a=REVERSE(@b); | ||
454 | 81 | --echo # should return 2 zeroes (as the value is truncated) | ||
455 | 82 | SELECT * FROM t1; | ||
456 | 83 | |||
457 | 84 | DROP TABLE t1; | ||
458 | 85 | let $MYSQLD_DATADIR= `select @@datadir`; | ||
459 | 86 | remove_file $MYSQLD_DATADIR/test/tmpp.txt; | ||
460 | 87 | |||
461 | 88 | |||
462 | 89 | --echo # Problem # 2 : if you write and read ucs2 data to a file they're lost | ||
463 | 90 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; | ||
464 | 91 | CREATE TABLE t1(a INT); | ||
465 | 92 | LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 | ||
466 | 93 | (@b) SET a=REVERSE(@b); | ||
467 | 94 | --echo # should return 0 and 1 (10 reversed) | ||
468 | 95 | SELECT * FROM t1; | ||
469 | 96 | |||
470 | 97 | DROP TABLE t1; | ||
471 | 98 | let $MYSQLD_DATADIR= `select @@datadir`; | ||
472 | 99 | remove_file $MYSQLD_DATADIR/test/tmpp2.txt; | ||
473 | 100 | |||
474 | 101 | |||
475 | 102 | |||
476 | 71 | # | 103 | # |
477 | 72 | # BUG3946 | 104 | # BUG3946 |
478 | 73 | # | 105 | # |
479 | 74 | 106 | ||
480 | === modified file 'Percona-Server/mysql-test/t/loaddata.test' | |||
481 | --- Percona-Server/mysql-test/t/loaddata.test 2011-11-24 02:00:56 +0000 | |||
482 | +++ Percona-Server/mysql-test/t/loaddata.test 2013-01-10 04:35:33 +0000 | |||
483 | @@ -580,36 +580,40 @@ | |||
484 | 580 | connection default; | 580 | connection default; |
485 | 581 | disconnect con1; | 581 | disconnect con1; |
486 | 582 | 582 | ||
517 | 583 | 583 | ############################################################################# | |
518 | 584 | --echo # | 584 | # The below protion is moved to ctype_ucs.test # |
519 | 585 | --echo # Bug #51876 : crash/memory underrun when loading data with ucs2 | 585 | ############################################################################# |
520 | 586 | --echo # and reverse() function | 586 | #--echo # |
521 | 587 | --echo # | 587 | #--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 |
522 | 588 | 588 | #--echo # and reverse() function | |
523 | 589 | --echo # Problem # 1 (original report): wrong parsing of ucs2 data | 589 | #--echo # |
524 | 590 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; | 590 | |
525 | 591 | CREATE TABLE t1(a INT); | 591 | #--echo # Problem # 1 (original report): wrong parsing of ucs2 data |
526 | 592 | LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 | 592 | #SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; |
527 | 593 | (@b) SET a=REVERSE(@b); | 593 | #CREATE TABLE t1(a INT); |
528 | 594 | --echo # should return 2 zeroes (as the value is truncated) | 594 | #LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 |
529 | 595 | SELECT * FROM t1; | 595 | #(@b) SET a=REVERSE(@b); |
530 | 596 | 596 | #--echo # should return 2 zeroes (as the value is truncated) | |
531 | 597 | DROP TABLE t1; | 597 | #SELECT * FROM t1; |
532 | 598 | let $MYSQLD_DATADIR= `select @@datadir`; | 598 | |
533 | 599 | remove_file $MYSQLD_DATADIR/test/tmpp.txt; | 599 | #DROP TABLE t1; |
534 | 600 | 600 | #let $MYSQLD_DATADIR= `select @@datadir`; | |
535 | 601 | 601 | #remove_file $MYSQLD_DATADIR/test/tmpp.txt; | |
536 | 602 | --echo # Problem # 2 : if you write and read ucs2 data to a file they're lost | 602 | |
537 | 603 | SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; | 603 | |
538 | 604 | CREATE TABLE t1(a INT); | 604 | #--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost |
539 | 605 | LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 | 605 | #SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; |
540 | 606 | (@b) SET a=REVERSE(@b); | 606 | #CREATE TABLE t1(a INT); |
541 | 607 | --echo # should return 0 and 1 (10 reversed) | 607 | #LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 |
542 | 608 | SELECT * FROM t1; | 608 | #(@b) SET a=REVERSE(@b); |
543 | 609 | 609 | #--echo # should return 0 and 1 (10 reversed) | |
544 | 610 | DROP TABLE t1; | 610 | #SELECT * FROM t1; |
545 | 611 | let $MYSQLD_DATADIR= `select @@datadir`; | 611 | |
546 | 612 | remove_file $MYSQLD_DATADIR/test/tmpp2.txt; | 612 | #DROP TABLE t1; |
547 | 613 | #let $MYSQLD_DATADIR= `select @@datadir`; | ||
548 | 614 | #remove_file $MYSQLD_DATADIR/test/tmpp2.txt; | ||
549 | 615 | ###################################################################################### | ||
550 | 616 | |||
551 | 613 | 617 | ||
552 | 614 | --echo # | 618 | --echo # |
553 | 615 | --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U | 619 | --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U |
554 | 616 | 620 | ||
555 | === modified file 'Percona-Server/mysql-test/t/sp_notembedded.test' | |||
556 | --- Percona-Server/mysql-test/t/sp_notembedded.test 2012-03-28 06:35:31 +0000 | |||
557 | +++ Percona-Server/mysql-test/t/sp_notembedded.test 2013-01-10 04:35:33 +0000 | |||
558 | @@ -371,16 +371,6 @@ | |||
559 | 371 | FLUSH PRIVILEGES; | 371 | FLUSH PRIVILEGES; |
560 | 372 | 372 | ||
561 | 373 | 373 | ||
562 | 374 | # | ||
563 | 375 | # Restore global concurrent_insert value. Keep in the end of the test file. | ||
564 | 376 | # | ||
565 | 377 | |||
566 | 378 | set @@global.concurrent_insert= @old_concurrent_insert; | ||
567 | 379 | |||
568 | 380 | # Wait till all disconnects are completed | ||
569 | 381 | --source include/wait_until_count_sessions.inc | ||
570 | 382 | |||
571 | 383 | |||
572 | 384 | --echo # | 374 | --echo # |
573 | 385 | --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. | 375 | --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. |
574 | 386 | --echo # | 376 | --echo # |
575 | @@ -476,3 +466,13 @@ | |||
576 | 476 | --echo # ------------------------------------------------------------------ | 466 | --echo # ------------------------------------------------------------------ |
577 | 477 | --echo # -- End of 5.1 tests | 467 | --echo # -- End of 5.1 tests |
578 | 478 | --echo # ------------------------------------------------------------------ | 468 | --echo # ------------------------------------------------------------------ |
579 | 469 | |||
580 | 470 | |||
581 | 471 | # | ||
582 | 472 | # Restore global concurrent_insert value. Keep in the end of the test file. | ||
583 | 473 | # | ||
584 | 474 | |||
585 | 475 | set @@global.concurrent_insert= @old_concurrent_insert; | ||
586 | 476 | |||
587 | 477 | # Wait till all disconnects are completed | ||
588 | 478 | --source include/wait_until_count_sessions.inc | ||
589 | 479 | 479 | ||
590 | === modified file 'Percona-Server/scripts/mysql_install_db.pl.in' | |||
591 | --- Percona-Server/scripts/mysql_install_db.pl.in 2012-02-15 16:21:38 +0000 | |||
592 | +++ Percona-Server/scripts/mysql_install_db.pl.in 2013-01-10 04:35:33 +0000 | |||
593 | @@ -423,10 +423,11 @@ | |||
594 | 423 | "--bootstrap", | 423 | "--bootstrap", |
595 | 424 | "--basedir=$opt->{basedir}", | 424 | "--basedir=$opt->{basedir}", |
596 | 425 | "--datadir=$opt->{ldata}", | 425 | "--datadir=$opt->{ldata}", |
600 | 426 | "--skip-innodb", | 426 | "--log-warnings=0", |
601 | 427 | "--skip-bdb", | 427 | "--loose-skip-innodb", |
602 | 428 | "--skip-ndbcluster", | 428 | "--loose-skip-ndbcluster", |
603 | 429 | "--max_allowed_packet=8M", | 429 | "--max_allowed_packet=8M", |
604 | 430 | "--default-storage-engine=MyISAM", | ||
605 | 430 | "--net_buffer_length=16K", | 431 | "--net_buffer_length=16K", |
606 | 431 | @args, | 432 | @args, |
607 | 432 | ); | 433 | ); |
608 | @@ -439,6 +440,8 @@ | |||
609 | 439 | 440 | ||
610 | 440 | open(SQL, $create_system_tables) | 441 | open(SQL, $create_system_tables) |
611 | 441 | or error($opt,"can't open $create_system_tables for reading: $!"); | 442 | or error($opt,"can't open $create_system_tables for reading: $!"); |
612 | 443 | open(SQL2, $fill_system_tables) | ||
613 | 444 | or error($opt,"can't open $fill_system_tables for reading: $!"); | ||
614 | 442 | # FIXME > /dev/null ? | 445 | # FIXME > /dev/null ? |
615 | 443 | if ( open(PIPE, "| $mysqld_install_cmd_line") ) | 446 | if ( open(PIPE, "| $mysqld_install_cmd_line") ) |
616 | 444 | { | 447 | { |
617 | @@ -452,8 +455,20 @@ | |||
618 | 452 | 455 | ||
619 | 453 | print PIPE $_; | 456 | print PIPE $_; |
620 | 454 | } | 457 | } |
621 | 458 | while ( <SQL2> ) | ||
622 | 459 | { | ||
623 | 460 | # TODO: make it similar to the above condition when we're sure | ||
624 | 461 | # @@hostname returns a fqdn | ||
625 | 462 | # When doing a "cross bootstrap" install, no reference to the current | ||
626 | 463 | # host should be added to the system tables. So we filter out any | ||
627 | 464 | # lines which contain the current host name. | ||
628 | 465 | next if /\@current_hostname/; | ||
629 | 466 | |||
630 | 467 | print PIPE $_; | ||
631 | 468 | } | ||
632 | 455 | close PIPE; | 469 | close PIPE; |
633 | 456 | close SQL; | 470 | close SQL; |
634 | 471 | close SQL2; | ||
635 | 457 | 472 | ||
636 | 458 | report_verbose($opt,"OK"); | 473 | report_verbose($opt,"OK"); |
637 | 459 | 474 | ||
638 | 460 | 475 | ||
639 | === modified file 'Percona-Server/scripts/mysqld_multi.sh' | |||
640 | --- Percona-Server/scripts/mysqld_multi.sh 2011-06-30 15:37:13 +0000 | |||
641 | +++ Percona-Server/scripts/mysqld_multi.sh 2013-01-10 04:35:33 +0000 | |||
642 | @@ -47,6 +47,28 @@ | |||
643 | 47 | $my_progname = $0; | 47 | $my_progname = $0; |
644 | 48 | $my_progname =~ s/.*[\/]//; | 48 | $my_progname =~ s/.*[\/]//; |
645 | 49 | 49 | ||
646 | 50 | |||
647 | 51 | if (defined($ENV{UMASK})) { | ||
648 | 52 | my $UMASK = $ENV{UMASK}; | ||
649 | 53 | my $m; | ||
650 | 54 | my $fmode = "0640"; | ||
651 | 55 | |||
652 | 56 | if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { | ||
653 | 57 | printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); | ||
654 | 58 | printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } | ||
655 | 59 | else { | ||
656 | 60 | $fmode= substr $UMASK, 2, 2; | ||
657 | 61 | $fmode= "06${fmode}"; } | ||
658 | 62 | |||
659 | 63 | if($fmode != $UMASK) { | ||
660 | 64 | printf("UMASK corrected from $UMASK to $fmode ...\n"); } | ||
661 | 65 | |||
662 | 66 | $fmode= oct($fmode); | ||
663 | 67 | |||
664 | 68 | umask($fmode); | ||
665 | 69 | } | ||
666 | 70 | |||
667 | 71 | |||
668 | 50 | main(); | 72 | main(); |
669 | 51 | 73 | ||
670 | 52 | #### | 74 | #### |
671 | 53 | 75 | ||
672 | === modified file 'Percona-Server/scripts/mysqld_safe.sh' | |||
673 | --- Percona-Server/scripts/mysqld_safe.sh 2010-04-09 11:47:18 +0000 | |||
674 | +++ Percona-Server/scripts/mysqld_safe.sh 2013-01-10 04:35:33 +0000 | |||
675 | @@ -27,7 +27,28 @@ | |||
676 | 27 | 27 | ||
677 | 28 | trap '' 1 2 3 15 # we shouldn't let anyone kill us | 28 | trap '' 1 2 3 15 # we shouldn't let anyone kill us |
678 | 29 | 29 | ||
680 | 30 | umask 007 | 30 | # MySQL-specific environment variable. First off, it's not really a umask, |
681 | 31 | # it's the desired mode. Second, it follows umask(2), not umask(3) in that | ||
682 | 32 | # octal needs to be explicit. Our shell might be a proper sh without printf, | ||
683 | 33 | # multiple-base arithmetic, and binary arithmetic, so this will get ugly. | ||
684 | 34 | # We reject decimal values to keep things at least half-sane. | ||
685 | 35 | umask 007 # fallback | ||
686 | 36 | UMASK="${UMASK-0640}" | ||
687 | 37 | fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'` | ||
688 | 38 | octalp=`echo "$fmode"|cut -c1` | ||
689 | 39 | fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'` | ||
690 | 40 | if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ] | ||
691 | 41 | then | ||
692 | 42 | fmode=0640 | ||
693 | 43 | echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2 | ||
694 | 44 | echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2 | ||
695 | 45 | fi | ||
696 | 46 | fmode=`echo "$fmode"|cut -c3-4` | ||
697 | 47 | fmode="6$fmode" | ||
698 | 48 | if [ "x$UMASK" != "x0$fmode" ] | ||
699 | 49 | then | ||
700 | 50 | echo "UMASK corrected from $UMASK to 0$fmode ..." | ||
701 | 51 | fi | ||
702 | 31 | 52 | ||
703 | 32 | defaults= | 53 | defaults= |
704 | 33 | case "$1" in | 54 | case "$1" in |
705 | @@ -371,6 +392,12 @@ | |||
706 | 371 | # Log to err_log file | 392 | # Log to err_log file |
707 | 372 | log_notice "Logging to '$err_log'." | 393 | log_notice "Logging to '$err_log'." |
708 | 373 | logging=file | 394 | logging=file |
709 | 395 | |||
710 | 396 | if [ ! -e "$err_log" ]; then # if error log already exists, | ||
711 | 397 | touch "$err_log" # we just append. otherwise, | ||
712 | 398 | chmod "$fmode" "$err_log" # fix the permissions here! | ||
713 | 399 | fi | ||
714 | 400 | |||
715 | 374 | else | 401 | else |
716 | 375 | if [ -n "$syslog_tag" ] | 402 | if [ -n "$syslog_tag" ] |
717 | 376 | then | 403 | then |
718 | @@ -572,6 +599,12 @@ | |||
719 | 572 | 599 | ||
720 | 573 | eval_log_error "$cmd" | 600 | eval_log_error "$cmd" |
721 | 574 | 601 | ||
722 | 602 | if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then | ||
723 | 603 | touch "$err_log" # hypothetical: log was renamed but not | ||
724 | 604 | chown $user "$err_log" # flushed yet. we'd recreate it with | ||
725 | 605 | chmod "$fmode" "$err_log" # wrong owner next time we log, so set | ||
726 | 606 | fi # it up correctly while we can! | ||
727 | 607 | |||
728 | 575 | if test ! -f "$pid_file" # This is removed if normal shutdown | 608 | if test ! -f "$pid_file" # This is removed if normal shutdown |
729 | 576 | then | 609 | then |
730 | 577 | break | 610 | break |
731 | 578 | 611 | ||
732 | === modified file 'Percona-Server/sql/hostname.cc' | |||
733 | --- Percona-Server/sql/hostname.cc 2012-06-19 07:26:40 +0000 | |||
734 | +++ Percona-Server/sql/hostname.cc 2013-01-10 04:35:33 +0000 | |||
735 | @@ -214,6 +214,15 @@ | |||
736 | 214 | } | 214 | } |
737 | 215 | my_gethostbyname_r_free(); | 215 | my_gethostbyname_r_free(); |
738 | 216 | #else | 216 | #else |
739 | 217 | |||
740 | 218 | DBUG_EXECUTE_IF("addr_fake_ipv4", | ||
741 | 219 | { | ||
742 | 220 | const char* fake_host= "santa.claus.ipv4.example.com"; | ||
743 | 221 | name=my_strdup(fake_host, MYF(0)); | ||
744 | 222 | add_hostname(in,name); | ||
745 | 223 | DBUG_RETURN(name); | ||
746 | 224 | };); | ||
747 | 225 | |||
748 | 217 | VOID(pthread_mutex_lock(&LOCK_hostname)); | 226 | VOID(pthread_mutex_lock(&LOCK_hostname)); |
749 | 218 | if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET))) | 227 | if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET))) |
750 | 219 | { | 228 | { |
751 | 220 | 229 | ||
752 | === modified file 'Percona-Server/sql/item_cmpfunc.cc' | |||
753 | --- Percona-Server/sql/item_cmpfunc.cc 2011-07-03 15:47:37 +0000 | |||
754 | +++ Percona-Server/sql/item_cmpfunc.cc 2013-01-10 04:35:33 +0000 | |||
755 | @@ -1,4 +1,4 @@ | |||
757 | 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. | 1 | /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
758 | 2 | 2 | ||
759 | 3 | This program is free software; you can redistribute it and/or modify | 3 | This program is free software; you can redistribute it and/or modify |
760 | 4 | it under the terms of the GNU General Public License as published by | 4 | it under the terms of the GNU General Public License as published by |
761 | @@ -3045,6 +3045,15 @@ | |||
762 | 3045 | return; | 3045 | return; |
763 | 3046 | } | 3046 | } |
764 | 3047 | } | 3047 | } |
765 | 3048 | /* | ||
766 | 3049 | Set cmp_context of all WHEN arguments. This prevents | ||
767 | 3050 | Item_field::equal_fields_propagator() from transforming a | ||
768 | 3051 | zerofill argument into a string constant. Such a change would | ||
769 | 3052 | require rebuilding cmp_items. | ||
770 | 3053 | */ | ||
771 | 3054 | for (i= 0; i < ncases; i+= 2) | ||
772 | 3055 | args[i]->cmp_context= item_cmp_type(left_result_type, | ||
773 | 3056 | args[i]->result_type()); | ||
774 | 3048 | } | 3057 | } |
775 | 3049 | 3058 | ||
776 | 3050 | if (else_expr_num == -1 || args[else_expr_num]->maybe_null) | 3059 | if (else_expr_num == -1 || args[else_expr_num]->maybe_null) |
777 | @@ -4032,6 +4041,16 @@ | |||
778 | 4032 | } | 4041 | } |
779 | 4033 | } | 4042 | } |
780 | 4034 | } | 4043 | } |
781 | 4044 | /* | ||
782 | 4045 | Set cmp_context of all arguments. This prevents | ||
783 | 4046 | Item_field::equal_fields_propagator() from transforming a zerofill integer | ||
784 | 4047 | argument into a string constant. Such a change would require rebuilding | ||
785 | 4048 | cmp_itmes. | ||
786 | 4049 | */ | ||
787 | 4050 | for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++) | ||
788 | 4051 | { | ||
789 | 4052 | arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type()); | ||
790 | 4053 | } | ||
791 | 4035 | max_length= 1; | 4054 | max_length= 1; |
792 | 4036 | } | 4055 | } |
793 | 4037 | 4056 | ||
794 | 4038 | 4057 | ||
795 | === modified file 'Percona-Server/sql/item_func.cc' | |||
796 | --- Percona-Server/sql/item_func.cc 2012-10-05 07:20:04 +0000 | |||
797 | +++ Percona-Server/sql/item_func.cc 2013-01-10 04:35:33 +0000 | |||
798 | @@ -3596,7 +3596,8 @@ | |||
799 | 3596 | thd->first_successful_insert_id_in_prev_stmt= value; | 3596 | thd->first_successful_insert_id_in_prev_stmt= value; |
800 | 3597 | return value; | 3597 | return value; |
801 | 3598 | } | 3598 | } |
803 | 3599 | return thd->read_first_successful_insert_id_in_prev_stmt(); | 3599 | return |
804 | 3600 | static_cast<longlong>(thd->read_first_successful_insert_id_in_prev_stmt()); | ||
805 | 3600 | } | 3601 | } |
806 | 3601 | 3602 | ||
807 | 3602 | 3603 | ||
808 | 3603 | 3604 | ||
809 | === modified file 'Percona-Server/sql/item_func.h' | |||
810 | --- Percona-Server/sql/item_func.h 2012-10-05 07:20:04 +0000 | |||
811 | +++ Percona-Server/sql/item_func.h 2013-01-10 04:35:33 +0000 | |||
812 | @@ -1043,6 +1043,7 @@ | |||
813 | 1043 | const char *func_name() const { return "last_insert_id"; } | 1043 | const char *func_name() const { return "last_insert_id"; } |
814 | 1044 | void fix_length_and_dec() | 1044 | void fix_length_and_dec() |
815 | 1045 | { | 1045 | { |
816 | 1046 | unsigned_flag= TRUE; | ||
817 | 1046 | if (arg_count) | 1047 | if (arg_count) |
818 | 1047 | max_length= args[0]->max_length; | 1048 | max_length= args[0]->max_length; |
819 | 1048 | } | 1049 | } |
820 | 1049 | 1050 | ||
821 | === modified file 'Percona-Server/sql/log.cc' | |||
822 | --- Percona-Server/sql/log.cc 2013-01-03 00:03:10 +0000 | |||
823 | +++ Percona-Server/sql/log.cc 2013-01-10 04:35:33 +0000 | |||
824 | @@ -4448,10 +4448,16 @@ | |||
825 | 4448 | /* | 4448 | /* |
826 | 4449 | Write pending event to log file or transaction cache | 4449 | Write pending event to log file or transaction cache |
827 | 4450 | */ | 4450 | */ |
828 | 4451 | DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending", | ||
829 | 4452 | {DBUG_SET("+d,simulate_file_write_error");}); | ||
830 | 4451 | if (pending->write(file)) | 4453 | if (pending->write(file)) |
831 | 4452 | { | 4454 | { |
832 | 4453 | pthread_mutex_unlock(&LOCK_log); | 4455 | pthread_mutex_unlock(&LOCK_log); |
833 | 4454 | set_write_error(thd); | 4456 | set_write_error(thd); |
834 | 4457 | delete pending; | ||
835 | 4458 | trx_data->set_pending(NULL); | ||
836 | 4459 | DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending", | ||
837 | 4460 | {DBUG_SET("-d,simulate_file_write_error");}); | ||
838 | 4455 | DBUG_RETURN(1); | 4461 | DBUG_RETURN(1); |
839 | 4456 | } | 4462 | } |
840 | 4457 | 4463 | ||
841 | 4458 | 4464 | ||
842 | === modified file 'Percona-Server/sql/log_event.cc' | |||
843 | --- Percona-Server/sql/log_event.cc 2012-12-30 12:35:56 +0000 | |||
844 | +++ Percona-Server/sql/log_event.cc 2013-01-10 04:35:33 +0000 | |||
845 | @@ -54,6 +54,22 @@ | |||
846 | 54 | */ | 54 | */ |
847 | 55 | #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1) | 55 | #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1) |
848 | 56 | 56 | ||
849 | 57 | /* | ||
850 | 58 | Explicit instantiation to unsigned int of template available_buffer | ||
851 | 59 | function. | ||
852 | 60 | */ | ||
853 | 61 | template unsigned int available_buffer<unsigned int>(const char*, | ||
854 | 62 | const char*, | ||
855 | 63 | unsigned int); | ||
856 | 64 | |||
857 | 65 | /* | ||
858 | 66 | Explicit instantiation to unsigned int of template valid_buffer_range | ||
859 | 67 | function. | ||
860 | 68 | */ | ||
861 | 69 | template bool valid_buffer_range<unsigned int>(unsigned int, | ||
862 | 70 | const char*, | ||
863 | 71 | const char*, | ||
864 | 72 | unsigned int); | ||
865 | 57 | 73 | ||
866 | 58 | #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) | 74 | #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) |
867 | 59 | static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd); | 75 | static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd); |
868 | @@ -1286,7 +1302,7 @@ | |||
869 | 1286 | ev = new Rand_log_event(buf, description_event); | 1302 | ev = new Rand_log_event(buf, description_event); |
870 | 1287 | break; | 1303 | break; |
871 | 1288 | case USER_VAR_EVENT: | 1304 | case USER_VAR_EVENT: |
873 | 1289 | ev = new User_var_log_event(buf, description_event); | 1305 | ev = new User_var_log_event(buf, event_len, description_event); |
874 | 1290 | break; | 1306 | break; |
875 | 1291 | case FORMAT_DESCRIPTION_EVENT: | 1307 | case FORMAT_DESCRIPTION_EVENT: |
876 | 1292 | ev = new Format_description_log_event(buf, event_len, description_event); | 1308 | ev = new Format_description_log_event(buf, event_len, description_event); |
877 | @@ -5755,18 +5771,34 @@ | |||
878 | 5755 | 5771 | ||
879 | 5756 | 5772 | ||
880 | 5757 | User_var_log_event:: | 5773 | User_var_log_event:: |
882 | 5758 | User_var_log_event(const char* buf, | 5774 | User_var_log_event(const char* buf, uint event_len, |
883 | 5759 | const Format_description_log_event* description_event) | 5775 | const Format_description_log_event* description_event) |
884 | 5760 | :Log_event(buf, description_event) | 5776 | :Log_event(buf, description_event) |
885 | 5761 | #ifndef MYSQL_CLIENT | 5777 | #ifndef MYSQL_CLIENT |
886 | 5762 | , deferred(false) | 5778 | , deferred(false) |
887 | 5763 | #endif | 5779 | #endif |
888 | 5764 | { | 5780 | { |
889 | 5781 | bool error= false; | ||
890 | 5782 | const char* buf_start= buf; | ||
891 | 5765 | /* The Post-Header is empty. The Variable Data part begins immediately. */ | 5783 | /* The Post-Header is empty. The Variable Data part begins immediately. */ |
892 | 5766 | buf+= description_event->common_header_len + | 5784 | buf+= description_event->common_header_len + |
893 | 5767 | description_event->post_header_len[USER_VAR_EVENT-1]; | 5785 | description_event->post_header_len[USER_VAR_EVENT-1]; |
894 | 5768 | name_len= uint4korr(buf); | 5786 | name_len= uint4korr(buf); |
895 | 5769 | name= (char *) buf + UV_NAME_LEN_SIZE; | 5787 | name= (char *) buf + UV_NAME_LEN_SIZE; |
896 | 5788 | |||
897 | 5789 | /* | ||
898 | 5790 | We don't know yet is_null value, so we must assume that name_len | ||
899 | 5791 | may have the bigger value possible, is_null= True and there is no | ||
900 | 5792 | payload for val. | ||
901 | 5793 | */ | ||
902 | 5794 | if (0 == name_len || | ||
903 | 5795 | !valid_buffer_range<uint>(name_len, buf_start, name, | ||
904 | 5796 | event_len - UV_VAL_IS_NULL)) | ||
905 | 5797 | { | ||
906 | 5798 | error= true; | ||
907 | 5799 | goto err; | ||
908 | 5800 | } | ||
909 | 5801 | |||
910 | 5770 | buf+= UV_NAME_LEN_SIZE + name_len; | 5802 | buf+= UV_NAME_LEN_SIZE + name_len; |
911 | 5771 | is_null= (bool) *buf; | 5803 | is_null= (bool) *buf; |
912 | 5772 | if (is_null) | 5804 | if (is_null) |
913 | @@ -5778,13 +5810,31 @@ | |||
914 | 5778 | } | 5810 | } |
915 | 5779 | else | 5811 | else |
916 | 5780 | { | 5812 | { |
917 | 5813 | if (!valid_buffer_range<uint>(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE | ||
918 | 5814 | + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE, | ||
919 | 5815 | buf_start, buf, event_len)) | ||
920 | 5816 | { | ||
921 | 5817 | error= true; | ||
922 | 5818 | goto err; | ||
923 | 5819 | } | ||
924 | 5820 | |||
925 | 5781 | type= (Item_result) buf[UV_VAL_IS_NULL]; | 5821 | type= (Item_result) buf[UV_VAL_IS_NULL]; |
926 | 5782 | charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE); | 5822 | charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE); |
927 | 5783 | val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + | 5823 | val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + |
928 | 5784 | UV_CHARSET_NUMBER_SIZE); | 5824 | UV_CHARSET_NUMBER_SIZE); |
929 | 5785 | val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + | 5825 | val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + |
930 | 5786 | UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); | 5826 | UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); |
931 | 5827 | |||
932 | 5828 | if (!valid_buffer_range<uint>(val_len, buf_start, val, event_len)) | ||
933 | 5829 | { | ||
934 | 5830 | error= true; | ||
935 | 5831 | goto err; | ||
936 | 5832 | } | ||
937 | 5787 | } | 5833 | } |
938 | 5834 | |||
939 | 5835 | err: | ||
940 | 5836 | if (error) | ||
941 | 5837 | name= 0; | ||
942 | 5788 | } | 5838 | } |
943 | 5789 | 5839 | ||
944 | 5790 | 5840 | ||
945 | @@ -5931,8 +5981,9 @@ | |||
946 | 5931 | char *hex_str; | 5981 | char *hex_str; |
947 | 5932 | CHARSET_INFO *cs; | 5982 | CHARSET_INFO *cs; |
948 | 5933 | 5983 | ||
951 | 5934 | if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte | 5984 | hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte |
952 | 5935 | break; // no error, as we are 'void' | 5985 | if (!hex_str) |
953 | 5986 | return; | ||
954 | 5936 | str_to_hex(hex_str, val, val_len); | 5987 | str_to_hex(hex_str, val, val_len); |
955 | 5937 | /* | 5988 | /* |
956 | 5938 | For proper behaviour when mysqlbinlog|mysql, we need to explicitely | 5989 | For proper behaviour when mysqlbinlog|mysql, we need to explicitely |
957 | 5939 | 5990 | ||
958 | === modified file 'Percona-Server/sql/log_event.h' | |||
959 | --- Percona-Server/sql/log_event.h 2013-01-10 04:35:31 +0000 | |||
960 | +++ Percona-Server/sql/log_event.h 2013-01-10 04:35:33 +0000 | |||
961 | @@ -2517,7 +2517,7 @@ | |||
962 | 2517 | void print(FILE* file, PRINT_EVENT_INFO* print_event_info); | 2517 | void print(FILE* file, PRINT_EVENT_INFO* print_event_info); |
963 | 2518 | #endif | 2518 | #endif |
964 | 2519 | 2519 | ||
966 | 2520 | User_var_log_event(const char* buf, | 2520 | User_var_log_event(const char* buf, uint event_len, |
967 | 2521 | const Format_description_log_event *description_event); | 2521 | const Format_description_log_event *description_event); |
968 | 2522 | ~User_var_log_event() {} | 2522 | ~User_var_log_event() {} |
969 | 2523 | Log_event_type get_type_code() { return USER_VAR_EVENT;} | 2523 | Log_event_type get_type_code() { return USER_VAR_EVENT;} |
970 | @@ -2529,9 +2529,9 @@ | |||
971 | 2529 | and which case the applier adjusts execution path. | 2529 | and which case the applier adjusts execution path. |
972 | 2530 | */ | 2530 | */ |
973 | 2531 | bool is_deferred() { return deferred; } | 2531 | bool is_deferred() { return deferred; } |
975 | 2532 | void set_deferred() { deferred= val; } | 2532 | void set_deferred() { deferred= true; } |
976 | 2533 | #endif | 2533 | #endif |
978 | 2534 | bool is_valid() const { return 1; } | 2534 | bool is_valid() const { return name != 0; } |
979 | 2535 | 2535 | ||
980 | 2536 | private: | 2536 | private: |
981 | 2537 | #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) | 2537 | #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) |
982 | 2538 | 2538 | ||
983 | === modified file 'Percona-Server/sql/mysql_priv.h' | |||
984 | --- Percona-Server/sql/mysql_priv.h 2012-10-05 07:20:04 +0000 | |||
985 | +++ Percona-Server/sql/mysql_priv.h 2013-01-10 04:35:33 +0000 | |||
986 | @@ -505,6 +505,41 @@ | |||
987 | 505 | */ | 505 | */ |
988 | 506 | #define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1) | 506 | #define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1) |
989 | 507 | 507 | ||
990 | 508 | /* | ||
991 | 509 | Check how many bytes are available on buffer. | ||
992 | 510 | |||
993 | 511 | @param buf_start Pointer to buffer start. | ||
994 | 512 | @param buf_current Pointer to the current position on buffer. | ||
995 | 513 | @param buf_len Buffer length. | ||
996 | 514 | |||
997 | 515 | @return Number of bytes available on event buffer. | ||
998 | 516 | */ | ||
999 | 517 | template <class T> T available_buffer(const char* buf_start, | ||
1000 | 518 | const char* buf_current, | ||
1001 | 519 | T buf_len) | ||
1002 | 520 | { | ||
1003 | 521 | return buf_len - (buf_current - buf_start); | ||
1004 | 522 | } | ||
1005 | 523 | |||
1006 | 524 | /* | ||
1007 | 525 | Check if jump value is within buffer limits. | ||
1008 | 526 | |||
1009 | 527 | @param jump Number of positions we want to advance. | ||
1010 | 528 | @param buf_start Pointer to buffer start | ||
1011 | 529 | @param buf_current Pointer to the current position on buffer. | ||
1012 | 530 | @param buf_len Buffer length. | ||
1013 | 531 | |||
1014 | 532 | @return True If jump value is within buffer limits. | ||
1015 | 533 | False Otherwise. | ||
1016 | 534 | */ | ||
1017 | 535 | template <class T> bool valid_buffer_range(T jump, | ||
1018 | 536 | const char* buf_start, | ||
1019 | 537 | const char* buf_current, | ||
1020 | 538 | T buf_len) | ||
1021 | 539 | { | ||
1022 | 540 | return (jump <= available_buffer(buf_start, buf_current, buf_len)); | ||
1023 | 541 | } | ||
1024 | 542 | |||
1025 | 508 | /* The rest of the file is included in the server only */ | 543 | /* The rest of the file is included in the server only */ |
1026 | 509 | #ifndef MYSQL_CLIENT | 544 | #ifndef MYSQL_CLIENT |
1027 | 510 | 545 | ||
1028 | 511 | 546 | ||
1029 | === modified file 'Percona-Server/sql/mysqld.cc' | |||
1030 | --- Percona-Server/sql/mysqld.cc 2013-01-10 04:35:31 +0000 | |||
1031 | +++ Percona-Server/sql/mysqld.cc 2013-01-10 04:35:33 +0000 | |||
1032 | @@ -4981,7 +4981,7 @@ | |||
1033 | 4981 | if (cached_thread_count > wake_thread) | 4981 | if (cached_thread_count > wake_thread) |
1034 | 4982 | { | 4982 | { |
1035 | 4983 | /* Get thread from cache */ | 4983 | /* Get thread from cache */ |
1037 | 4984 | thread_cache.append(thd); | 4984 | thread_cache.push_back(thd); |
1038 | 4985 | wake_thread++; | 4985 | wake_thread++; |
1039 | 4986 | pthread_cond_signal(&COND_thread_cache); | 4986 | pthread_cond_signal(&COND_thread_cache); |
1040 | 4987 | } | 4987 | } |
1041 | 4988 | 4988 | ||
1042 | === modified file 'Percona-Server/sql/sp_head.cc' | |||
1043 | --- Percona-Server/sql/sp_head.cc 2012-10-15 15:08:07 +0000 | |||
1044 | +++ Percona-Server/sql/sp_head.cc 2013-01-10 04:35:33 +0000 | |||
1045 | @@ -3860,8 +3860,6 @@ | |||
1046 | 3860 | Multi-set key: | 3860 | Multi-set key: |
1047 | 3861 | db_name\0table_name\0alias\0 - for normal tables | 3861 | db_name\0table_name\0alias\0 - for normal tables |
1048 | 3862 | db_name\0table_name\0 - for temporary tables | 3862 | db_name\0table_name\0 - for temporary tables |
1049 | 3863 | Note that in both cases we don't take last '\0' into account when | ||
1050 | 3864 | we count length of key. | ||
1051 | 3865 | */ | 3863 | */ |
1052 | 3866 | LEX_STRING qname; | 3864 | LEX_STRING qname; |
1053 | 3867 | uint db_length, table_name_length; | 3865 | uint db_length, table_name_length; |
1054 | @@ -3918,19 +3916,26 @@ | |||
1055 | 3918 | for (; table ; table= table->next_global) | 3916 | for (; table ; table= table->next_global) |
1056 | 3919 | if (!table->derived && !table->schema_table) | 3917 | if (!table->derived && !table->schema_table) |
1057 | 3920 | { | 3918 | { |
1060 | 3921 | char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\0 | 3919 | /* |
1061 | 3922 | uint tlen, alen; | 3920 | Structure of key for the multi-set is "db\0table\0alias\0". |
1062 | 3921 | Since "alias" part can have arbitrary length we use String | ||
1063 | 3922 | object to construct the key. By default String will use | ||
1064 | 3923 | buffer allocated on stack with NAME_LEN bytes reserved for | ||
1065 | 3924 | alias, since in most cases it is going to be smaller than | ||
1066 | 3925 | NAME_LEN bytes. | ||
1067 | 3926 | */ | ||
1068 | 3927 | char tname_buff[(NAME_LEN + 1) * 3]; | ||
1069 | 3928 | String tname(tname_buff, sizeof(tname_buff), &my_charset_bin); | ||
1070 | 3929 | uint temp_table_key_length; | ||
1071 | 3923 | 3930 | ||
1082 | 3924 | tlen= table->db_length; | 3931 | tname.length(0); |
1083 | 3925 | memcpy(tname, table->db, tlen); | 3932 | tname.append(table->db, table->db_length); |
1084 | 3926 | tname[tlen++]= '\0'; | 3933 | tname.append('\0'); |
1085 | 3927 | memcpy(tname+tlen, table->table_name, table->table_name_length); | 3934 | tname.append(table->table_name, table->table_name_length); |
1086 | 3928 | tlen+= table->table_name_length; | 3935 | tname.append('\0'); |
1087 | 3929 | tname[tlen++]= '\0'; | 3936 | temp_table_key_length= tname.length(); |
1088 | 3930 | alen= strlen(table->alias); | 3937 | tname.append(table->alias); |
1089 | 3931 | memcpy(tname+tlen, table->alias, alen); | 3938 | tname.append('\0'); |
1080 | 3932 | tlen+= alen; | ||
1081 | 3933 | tname[tlen]= '\0'; | ||
1090 | 3934 | 3939 | ||
1091 | 3935 | /* | 3940 | /* |
1092 | 3936 | Upgrade the lock type because this table list will be used | 3941 | Upgrade the lock type because this table list will be used |
1093 | @@ -3945,9 +3950,10 @@ | |||
1094 | 3945 | (and therefore should not be prelocked). Otherwise we will erroneously | 3950 | (and therefore should not be prelocked). Otherwise we will erroneously |
1095 | 3946 | treat table with same name but with different alias as non-temporary. | 3951 | treat table with same name but with different alias as non-temporary. |
1096 | 3947 | */ | 3952 | */ |
1100 | 3948 | if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) || | 3953 | if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(), |
1101 | 3949 | ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, | 3954 | tname.length())) || |
1102 | 3950 | tlen - alen - 1)) && | 3955 | ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(), |
1103 | 3956 | temp_table_key_length)) && | ||
1104 | 3951 | tab->temp)) | 3957 | tab->temp)) |
1105 | 3952 | { | 3958 | { |
1106 | 3953 | if (tab->lock_type < table->lock_type) | 3959 | if (tab->lock_type < table->lock_type) |
1107 | @@ -3966,11 +3972,11 @@ | |||
1108 | 3966 | lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE) | 3972 | lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE) |
1109 | 3967 | { | 3973 | { |
1110 | 3968 | tab->temp= TRUE; | 3974 | tab->temp= TRUE; |
1112 | 3969 | tab->qname.length= tlen - alen - 1; | 3975 | tab->qname.length= temp_table_key_length; |
1113 | 3970 | } | 3976 | } |
1114 | 3971 | else | 3977 | else |
1117 | 3972 | tab->qname.length= tlen; | 3978 | tab->qname.length= tname.length(); |
1118 | 3973 | tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1); | 3979 | tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length); |
1119 | 3974 | if (!tab->qname.str) | 3980 | if (!tab->qname.str) |
1120 | 3975 | return FALSE; | 3981 | return FALSE; |
1121 | 3976 | tab->table_name_length= table->table_name_length; | 3982 | tab->table_name_length= table->table_name_length; |
1122 | @@ -4039,7 +4045,7 @@ | |||
1123 | 4039 | if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * | 4045 | if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) * |
1124 | 4040 | stab->lock_count)) || | 4046 | stab->lock_count)) || |
1125 | 4041 | !(key_buff= (char*)thd->memdup(stab->qname.str, | 4047 | !(key_buff= (char*)thd->memdup(stab->qname.str, |
1127 | 4042 | stab->qname.length + 1))) | 4048 | stab->qname.length))) |
1128 | 4043 | DBUG_RETURN(FALSE); | 4049 | DBUG_RETURN(FALSE); |
1129 | 4044 | 4050 | ||
1130 | 4045 | for (uint j= 0; j < stab->lock_count; j++) | 4051 | for (uint j= 0; j < stab->lock_count; j++) |
1131 | 4046 | 4052 | ||
1132 | === modified file 'Percona-Server/sql/sql_acl.cc' | |||
1133 | --- Percona-Server/sql/sql_acl.cc 2012-11-28 22:39:45 +0000 | |||
1134 | +++ Percona-Server/sql/sql_acl.cc 2013-01-10 04:35:33 +0000 | |||
1135 | @@ -195,7 +195,17 @@ | |||
1136 | 195 | static my_bool acl_load(THD *thd, TABLE_LIST *tables); | 195 | static my_bool acl_load(THD *thd, TABLE_LIST *tables); |
1137 | 196 | static my_bool grant_load(THD *thd, TABLE_LIST *tables); | 196 | static my_bool grant_load(THD *thd, TABLE_LIST *tables); |
1138 | 197 | static inline void get_grantor(THD *thd, char* grantor); | 197 | static inline void get_grantor(THD *thd, char* grantor); |
1140 | 198 | 198 | /* | |
1141 | 199 | Enumeration of various ACL's and Hashes used in handle_grant_struct() | ||
1142 | 200 | */ | ||
1143 | 201 | enum enum_acl_lists | ||
1144 | 202 | { | ||
1145 | 203 | USER_ACL= 0, | ||
1146 | 204 | DB_ACL, | ||
1147 | 205 | COLUMN_PRIVILEGES_HASH, | ||
1148 | 206 | PROC_PRIVILEGES_HASH, | ||
1149 | 207 | FUNC_PRIVILEGES_HASH | ||
1150 | 208 | }; | ||
1151 | 199 | /* | 209 | /* |
1152 | 200 | Convert scrambled password to binary form, according to scramble type, | 210 | Convert scrambled password to binary form, according to scramble type, |
1153 | 201 | Binary form is stored in user.salt. | 211 | Binary form is stored in user.salt. |
1154 | @@ -1346,10 +1356,19 @@ | |||
1155 | 1346 | { | 1356 | { |
1156 | 1347 | ulong host_access= ~(ulong)0, db_access= 0; | 1357 | ulong host_access= ~(ulong)0, db_access= 0; |
1157 | 1348 | uint i; | 1358 | uint i; |
1159 | 1349 | size_t key_length; | 1359 | size_t key_length, copy_length; |
1160 | 1350 | char key[ACL_KEY_LENGTH],*tmp_db,*end; | 1360 | char key[ACL_KEY_LENGTH],*tmp_db,*end; |
1161 | 1351 | acl_entry *entry; | 1361 | acl_entry *entry; |
1162 | 1352 | DBUG_ENTER("acl_get"); | 1362 | DBUG_ENTER("acl_get"); |
1163 | 1363 | |||
1164 | 1364 | copy_length= (size_t) (strlen(ip ? ip : "") + | ||
1165 | 1365 | strlen(user ? user : "") + | ||
1166 | 1366 | strlen(db ? db : "")); | ||
1167 | 1367 | /* | ||
1168 | 1368 | Make sure that strmov() operations do not result in buffer overflow. | ||
1169 | 1369 | */ | ||
1170 | 1370 | if (copy_length >= ACL_KEY_LENGTH) | ||
1171 | 1371 | DBUG_RETURN(0); | ||
1172 | 1353 | 1372 | ||
1173 | 1354 | tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1; | 1373 | tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1; |
1174 | 1355 | end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db); | 1374 | end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db); |
1175 | @@ -4336,6 +4355,16 @@ | |||
1176 | 4336 | char helping [NAME_LEN+USERNAME_LENGTH+2], *end; | 4355 | char helping [NAME_LEN+USERNAME_LENGTH+2], *end; |
1177 | 4337 | uint len; | 4356 | uint len; |
1178 | 4338 | bool error= TRUE; | 4357 | bool error= TRUE; |
1179 | 4358 | size_t copy_length; | ||
1180 | 4359 | |||
1181 | 4360 | copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") + | ||
1182 | 4361 | strlen(db ? db : "")); | ||
1183 | 4362 | |||
1184 | 4363 | /* | ||
1185 | 4364 | Make sure that strmov() operations do not result in buffer overflow. | ||
1186 | 4365 | */ | ||
1187 | 4366 | if (copy_length >= (NAME_LEN+USERNAME_LENGTH+2)) | ||
1188 | 4367 | return 1; | ||
1189 | 4339 | 4368 | ||
1190 | 4340 | end= strmov(helping, sctx->priv_user) + 1; | 4369 | end= strmov(helping, sctx->priv_user) + 1; |
1191 | 4341 | end= strnmov(end, db, helping + sizeof(helping) - end); | 4370 | end= strnmov(end, db, helping + sizeof(helping) - end); |
1192 | @@ -5402,19 +5431,19 @@ | |||
1193 | 5402 | Delete from grant structure if drop is true. | 5431 | Delete from grant structure if drop is true. |
1194 | 5403 | Update in grant structure if drop is false and user_to is not NULL. | 5432 | Update in grant structure if drop is false and user_to is not NULL. |
1195 | 5404 | Search in grant structure if drop is false and user_to is NULL. | 5433 | Search in grant structure if drop is false and user_to is NULL. |
1202 | 5405 | Structures are numbered as follows: | 5434 | Structures are enumerated as follows: |
1203 | 5406 | 0 acl_users | 5435 | 0 ACL_USER |
1204 | 5407 | 1 acl_dbs | 5436 | 1 ACL_DB |
1205 | 5408 | 2 column_priv_hash | 5437 | 2 COLUMN_PRIVILEGES_HASH |
1206 | 5409 | 3 proc_priv_hash | 5438 | 3 PROC_PRIVILEGES_HASH |
1207 | 5410 | 4 func_priv_hash | 5439 | 4 FUNC_PRIVILEGES_HASH |
1208 | 5411 | 5440 | ||
1209 | 5412 | @retval > 0 At least one element matched. | 5441 | @retval > 0 At least one element matched. |
1210 | 5413 | @retval 0 OK, but no element matched. | 5442 | @retval 0 OK, but no element matched. |
1212 | 5414 | @retval -1 Wrong arguments to function. | 5443 | @retval -1 Wrong arguments to function or Out of Memory |
1213 | 5415 | */ | 5444 | */ |
1214 | 5416 | 5445 | ||
1216 | 5417 | static int handle_grant_struct(uint struct_no, bool drop, | 5446 | static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, |
1217 | 5418 | LEX_USER *user_from, LEX_USER *user_to) | 5447 | LEX_USER *user_from, LEX_USER *user_to) |
1218 | 5419 | { | 5448 | { |
1219 | 5420 | int result= 0; | 5449 | int result= 0; |
1220 | @@ -5425,6 +5454,11 @@ | |||
1221 | 5425 | ACL_USER *acl_user= NULL; | 5454 | ACL_USER *acl_user= NULL; |
1222 | 5426 | ACL_DB *acl_db= NULL; | 5455 | ACL_DB *acl_db= NULL; |
1223 | 5427 | GRANT_NAME *grant_name= NULL; | 5456 | GRANT_NAME *grant_name= NULL; |
1224 | 5457 | /* | ||
1225 | 5458 | Dynamic array acl_grant_name used to store pointers to all | ||
1226 | 5459 | GRANT_NAME objects | ||
1227 | 5460 | */ | ||
1228 | 5461 | Dynamic_array<GRANT_NAME *> acl_grant_name; | ||
1229 | 5428 | HASH *grant_name_hash= NULL; | 5462 | HASH *grant_name_hash= NULL; |
1230 | 5429 | DBUG_ENTER("handle_grant_struct"); | 5463 | DBUG_ENTER("handle_grant_struct"); |
1231 | 5430 | DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", | 5464 | DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", |
1232 | @@ -5437,21 +5471,21 @@ | |||
1233 | 5437 | 5471 | ||
1234 | 5438 | /* Get the number of elements in the in-memory structure. */ | 5472 | /* Get the number of elements in the in-memory structure. */ |
1235 | 5439 | switch (struct_no) { | 5473 | switch (struct_no) { |
1237 | 5440 | case 0: | 5474 | case USER_ACL: |
1238 | 5441 | elements= acl_users.elements; | 5475 | elements= acl_users.elements; |
1239 | 5442 | break; | 5476 | break; |
1241 | 5443 | case 1: | 5477 | case DB_ACL: |
1242 | 5444 | elements= acl_dbs.elements; | 5478 | elements= acl_dbs.elements; |
1243 | 5445 | break; | 5479 | break; |
1245 | 5446 | case 2: | 5480 | case COLUMN_PRIVILEGES_HASH: |
1246 | 5447 | elements= column_priv_hash.records; | 5481 | elements= column_priv_hash.records; |
1247 | 5448 | grant_name_hash= &column_priv_hash; | 5482 | grant_name_hash= &column_priv_hash; |
1248 | 5449 | break; | 5483 | break; |
1250 | 5450 | case 3: | 5484 | case PROC_PRIVILEGES_HASH: |
1251 | 5451 | elements= proc_priv_hash.records; | 5485 | elements= proc_priv_hash.records; |
1252 | 5452 | grant_name_hash= &proc_priv_hash; | 5486 | grant_name_hash= &proc_priv_hash; |
1253 | 5453 | break; | 5487 | break; |
1255 | 5454 | case 4: | 5488 | case FUNC_PRIVILEGES_HASH: |
1256 | 5455 | elements= func_priv_hash.records; | 5489 | elements= func_priv_hash.records; |
1257 | 5456 | grant_name_hash= &func_priv_hash; | 5490 | grant_name_hash= &func_priv_hash; |
1258 | 5457 | break; | 5491 | break; |
1259 | @@ -5470,21 +5504,21 @@ | |||
1260 | 5470 | Get a pointer to the element. | 5504 | Get a pointer to the element. |
1261 | 5471 | */ | 5505 | */ |
1262 | 5472 | switch (struct_no) { | 5506 | switch (struct_no) { |
1264 | 5473 | case 0: | 5507 | case USER_ACL: |
1265 | 5474 | acl_user= dynamic_element(&acl_users, idx, ACL_USER*); | 5508 | acl_user= dynamic_element(&acl_users, idx, ACL_USER*); |
1266 | 5475 | user= acl_user->user; | 5509 | user= acl_user->user; |
1267 | 5476 | host= acl_user->host.hostname; | 5510 | host= acl_user->host.hostname; |
1268 | 5477 | break; | 5511 | break; |
1269 | 5478 | 5512 | ||
1271 | 5479 | case 1: | 5513 | case DB_ACL: |
1272 | 5480 | acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*); | 5514 | acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*); |
1273 | 5481 | user= acl_db->user; | 5515 | user= acl_db->user; |
1274 | 5482 | host= acl_db->host.hostname; | 5516 | host= acl_db->host.hostname; |
1275 | 5483 | break; | 5517 | break; |
1276 | 5484 | 5518 | ||
1280 | 5485 | case 2: | 5519 | case COLUMN_PRIVILEGES_HASH: |
1281 | 5486 | case 3: | 5520 | case PROC_PRIVILEGES_HASH: |
1282 | 5487 | case 4: | 5521 | case FUNC_PRIVILEGES_HASH: |
1283 | 5488 | grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx); | 5522 | grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx); |
1284 | 5489 | user= grant_name->user; | 5523 | user= grant_name->user; |
1285 | 5490 | host= grant_name->host.hostname; | 5524 | host= grant_name->host.hostname; |
1286 | @@ -5510,86 +5544,60 @@ | |||
1287 | 5510 | if ( drop ) | 5544 | if ( drop ) |
1288 | 5511 | { | 5545 | { |
1289 | 5512 | switch ( struct_no ) { | 5546 | switch ( struct_no ) { |
1291 | 5513 | case 0: | 5547 | case USER_ACL: |
1292 | 5514 | delete_dynamic_element(&acl_users, idx); | 5548 | delete_dynamic_element(&acl_users, idx); |
1307 | 5515 | break; | 5549 | elements--; |
1308 | 5516 | 5550 | /* | |
1295 | 5517 | case 1: | ||
1296 | 5518 | delete_dynamic_element(&acl_dbs, idx); | ||
1297 | 5519 | break; | ||
1298 | 5520 | |||
1299 | 5521 | case 2: | ||
1300 | 5522 | case 3: | ||
1301 | 5523 | case 4: | ||
1302 | 5524 | hash_delete(grant_name_hash, (uchar*) grant_name); | ||
1303 | 5525 | break; | ||
1304 | 5526 | } | ||
1305 | 5527 | elements--; | ||
1306 | 5528 | /* | ||
1309 | 5529 | - If we are iterating through an array then we just have moved all | 5551 | - If we are iterating through an array then we just have moved all |
1310 | 5530 | elements after the current element one position closer to its head. | 5552 | elements after the current element one position closer to its head. |
1311 | 5531 | This means that we have to take another look at the element at | 5553 | This means that we have to take another look at the element at |
1312 | 5532 | current position as it is a new element from the array's tail. | 5554 | current position as it is a new element from the array's tail. |
1322 | 5533 | - If we are iterating through a hash the current element was replaced | 5555 | - This is valid for USER_ACL, DB_ACL. |
1323 | 5534 | with one of elements from the tail. So we also have to take a look | 5556 | */ |
1324 | 5535 | at the new element in current position. | 5557 | idx--; |
1325 | 5536 | Note that in our HASH implementation hash_delete() won't move any | 5558 | break; |
1326 | 5537 | elements with position after current one to position before the | 5559 | |
1327 | 5538 | current (i.e. from the tail to the head), so it is safe to continue | 5560 | case DB_ACL: |
1328 | 5539 | iteration without re-starting. | 5561 | delete_dynamic_element(&acl_dbs, idx); |
1329 | 5540 | */ | 5562 | elements--; |
1330 | 5541 | idx--; | 5563 | idx--; |
1331 | 5564 | break; | ||
1332 | 5565 | |||
1333 | 5566 | case COLUMN_PRIVILEGES_HASH: | ||
1334 | 5567 | case PROC_PRIVILEGES_HASH: | ||
1335 | 5568 | case FUNC_PRIVILEGES_HASH: | ||
1336 | 5569 | /* | ||
1337 | 5570 | Deleting while traversing a hash table is not valid procedure and | ||
1338 | 5571 | hence we save pointers to GRANT_NAME objects for later processing. | ||
1339 | 5572 | */ | ||
1340 | 5573 | if (acl_grant_name.append(grant_name)) | ||
1341 | 5574 | DBUG_RETURN(-1); | ||
1342 | 5575 | break; | ||
1343 | 5576 | } | ||
1344 | 5542 | } | 5577 | } |
1345 | 5543 | else if ( user_to ) | 5578 | else if ( user_to ) |
1346 | 5544 | { | 5579 | { |
1347 | 5545 | switch ( struct_no ) { | 5580 | switch ( struct_no ) { |
1349 | 5546 | case 0: | 5581 | case USER_ACL: |
1350 | 5547 | acl_user->user= strdup_root(&mem, user_to->user.str); | 5582 | acl_user->user= strdup_root(&mem, user_to->user.str); |
1351 | 5548 | acl_user->host.hostname= strdup_root(&mem, user_to->host.str); | 5583 | acl_user->host.hostname= strdup_root(&mem, user_to->host.str); |
1352 | 5549 | break; | 5584 | break; |
1353 | 5550 | 5585 | ||
1355 | 5551 | case 1: | 5586 | case DB_ACL: |
1356 | 5552 | acl_db->user= strdup_root(&mem, user_to->user.str); | 5587 | acl_db->user= strdup_root(&mem, user_to->user.str); |
1357 | 5553 | acl_db->host.hostname= strdup_root(&mem, user_to->host.str); | 5588 | acl_db->host.hostname= strdup_root(&mem, user_to->host.str); |
1358 | 5554 | break; | 5589 | break; |
1359 | 5555 | 5590 | ||
1397 | 5556 | case 2: | 5591 | case COLUMN_PRIVILEGES_HASH: |
1398 | 5557 | case 3: | 5592 | case PROC_PRIVILEGES_HASH: |
1399 | 5558 | case 4: | 5593 | case FUNC_PRIVILEGES_HASH: |
1400 | 5559 | { | 5594 | /* |
1401 | 5560 | /* | 5595 | Updating while traversing a hash table is not valid procedure and |
1402 | 5561 | Save old hash key and its length to be able properly update | 5596 | hence we save pointers to GRANT_NAME objects for later processing. |
1403 | 5562 | element position in hash. | 5597 | */ |
1404 | 5563 | */ | 5598 | if (acl_grant_name.append(grant_name)) |
1405 | 5564 | char *old_key= grant_name->hash_key; | 5599 | DBUG_RETURN(-1); |
1406 | 5565 | size_t old_key_length= grant_name->key_length; | 5600 | break; |
1370 | 5566 | |||
1371 | 5567 | /* | ||
1372 | 5568 | Update the grant structure with the new user name and host name. | ||
1373 | 5569 | */ | ||
1374 | 5570 | grant_name->set_user_details(user_to->host.str, grant_name->db, | ||
1375 | 5571 | user_to->user.str, grant_name->tname, | ||
1376 | 5572 | TRUE); | ||
1377 | 5573 | |||
1378 | 5574 | /* | ||
1379 | 5575 | Since username is part of the hash key, when the user name | ||
1380 | 5576 | is renamed, the hash key is changed. Update the hash to | ||
1381 | 5577 | ensure that the position matches the new hash key value | ||
1382 | 5578 | */ | ||
1383 | 5579 | hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key, | ||
1384 | 5580 | old_key_length); | ||
1385 | 5581 | /* | ||
1386 | 5582 | hash_update() operation could have moved element from the tail | ||
1387 | 5583 | of the hash to the current position. So we need to take a look | ||
1388 | 5584 | at the element in current position once again. | ||
1389 | 5585 | Thanks to the fact that hash_update() for our HASH implementation | ||
1390 | 5586 | won't move any elements from the tail of the hash to the positions | ||
1391 | 5587 | before the current one (a.k.a. head) it is safe to continue | ||
1392 | 5588 | iteration without restarting. | ||
1393 | 5589 | */ | ||
1394 | 5590 | idx--; | ||
1395 | 5591 | break; | ||
1396 | 5592 | } | ||
1407 | 5593 | } | 5601 | } |
1408 | 5594 | } | 5602 | } |
1409 | 5595 | else | 5603 | else |
1410 | @@ -5598,6 +5606,48 @@ | |||
1411 | 5598 | break; | 5606 | break; |
1412 | 5599 | } | 5607 | } |
1413 | 5600 | } | 5608 | } |
1414 | 5609 | |||
1415 | 5610 | if (drop || user_to) | ||
1416 | 5611 | { | ||
1417 | 5612 | /* | ||
1418 | 5613 | Traversing the elements stored in acl_grant_name dynamic array | ||
1419 | 5614 | to either delete or update them. | ||
1420 | 5615 | */ | ||
1421 | 5616 | for (int i= 0; i < acl_grant_name.elements(); ++i) | ||
1422 | 5617 | { | ||
1423 | 5618 | grant_name= acl_grant_name.at(i); | ||
1424 | 5619 | |||
1425 | 5620 | if (drop) | ||
1426 | 5621 | { | ||
1427 | 5622 | my_hash_delete(grant_name_hash, (uchar *) grant_name); | ||
1428 | 5623 | } | ||
1429 | 5624 | else | ||
1430 | 5625 | { | ||
1431 | 5626 | /* | ||
1432 | 5627 | Save old hash key and its length to be able properly update | ||
1433 | 5628 | element position in hash. | ||
1434 | 5629 | */ | ||
1435 | 5630 | char *old_key= grant_name->hash_key; | ||
1436 | 5631 | size_t old_key_length= grant_name->key_length; | ||
1437 | 5632 | |||
1438 | 5633 | /* | ||
1439 | 5634 | Update the grant structure with the new user name and host name. | ||
1440 | 5635 | */ | ||
1441 | 5636 | grant_name->set_user_details(user_to->host.str, grant_name->db, | ||
1442 | 5637 | user_to->user.str, grant_name->tname, | ||
1443 | 5638 | TRUE); | ||
1444 | 5639 | |||
1445 | 5640 | /* | ||
1446 | 5641 | Since username is part of the hash key, when the user name | ||
1447 | 5642 | is renamed, the hash key is changed. Update the hash to | ||
1448 | 5643 | ensure that the position matches the new hash key value | ||
1449 | 5644 | */ | ||
1450 | 5645 | my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key, | ||
1451 | 5646 | old_key_length); | ||
1452 | 5647 | } | ||
1453 | 5648 | } | ||
1454 | 5649 | } | ||
1455 | 5650 | |||
1456 | 5601 | #ifdef EXTRA_DEBUG | 5651 | #ifdef EXTRA_DEBUG |
1457 | 5602 | DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result)); | 5652 | DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result)); |
1458 | 5603 | #endif | 5653 | #endif |
1459 | @@ -5635,6 +5685,7 @@ | |||
1460 | 5635 | { | 5685 | { |
1461 | 5636 | int result= 0; | 5686 | int result= 0; |
1462 | 5637 | int found; | 5687 | int found; |
1463 | 5688 | int ret; | ||
1464 | 5638 | DBUG_ENTER("handle_grant_data"); | 5689 | DBUG_ENTER("handle_grant_data"); |
1465 | 5639 | 5690 | ||
1466 | 5640 | /* Handle user table. */ | 5691 | /* Handle user table. */ |
1467 | @@ -5646,14 +5697,19 @@ | |||
1468 | 5646 | else | 5697 | else |
1469 | 5647 | { | 5698 | { |
1470 | 5648 | /* Handle user array. */ | 5699 | /* Handle user array. */ |
1473 | 5649 | if ((handle_grant_struct(0, drop, user_from, user_to) && ! result) || | 5700 | if (((ret= handle_grant_struct(USER_ACL, drop, user_from, user_to) > 0) && |
1474 | 5650 | found) | 5701 | ! result) || found) |
1475 | 5651 | { | 5702 | { |
1476 | 5652 | result= 1; /* At least one record/element found. */ | 5703 | result= 1; /* At least one record/element found. */ |
1477 | 5653 | /* If search is requested, we do not need to search further. */ | 5704 | /* If search is requested, we do not need to search further. */ |
1478 | 5654 | if (! drop && ! user_to) | 5705 | if (! drop && ! user_to) |
1479 | 5655 | goto end; | 5706 | goto end; |
1480 | 5656 | } | 5707 | } |
1481 | 5708 | else if (ret < 0) | ||
1482 | 5709 | { | ||
1483 | 5710 | result= -1; | ||
1484 | 5711 | goto end; | ||
1485 | 5712 | } | ||
1486 | 5657 | } | 5713 | } |
1487 | 5658 | 5714 | ||
1488 | 5659 | /* Handle db table. */ | 5715 | /* Handle db table. */ |
1489 | @@ -5665,14 +5721,19 @@ | |||
1490 | 5665 | else | 5721 | else |
1491 | 5666 | { | 5722 | { |
1492 | 5667 | /* Handle db array. */ | 5723 | /* Handle db array. */ |
1495 | 5668 | if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) || | 5724 | if ((((ret= handle_grant_struct(DB_ACL, drop, user_from, user_to) > 0) && |
1496 | 5669 | found) && ! result) | 5725 | ! result) || found) && ! result) |
1497 | 5670 | { | 5726 | { |
1498 | 5671 | result= 1; /* At least one record/element found. */ | 5727 | result= 1; /* At least one record/element found. */ |
1499 | 5672 | /* If search is requested, we do not need to search further. */ | 5728 | /* If search is requested, we do not need to search further. */ |
1500 | 5673 | if (! drop && ! user_to) | 5729 | if (! drop && ! user_to) |
1501 | 5674 | goto end; | 5730 | goto end; |
1502 | 5675 | } | 5731 | } |
1503 | 5732 | else if (ret < 0) | ||
1504 | 5733 | { | ||
1505 | 5734 | result= -1; | ||
1506 | 5735 | goto end; | ||
1507 | 5736 | } | ||
1508 | 5676 | } | 5737 | } |
1509 | 5677 | 5738 | ||
1510 | 5678 | /* Handle stored routines table. */ | 5739 | /* Handle stored routines table. */ |
1511 | @@ -5684,23 +5745,35 @@ | |||
1512 | 5684 | else | 5745 | else |
1513 | 5685 | { | 5746 | { |
1514 | 5686 | /* Handle procs array. */ | 5747 | /* Handle procs array. */ |
1517 | 5687 | if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) || | 5748 | if ((((ret= handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from, |
1518 | 5688 | found) && ! result) | 5749 | user_to) > 0) && ! result) || found) && |
1519 | 5750 | ! result) | ||
1520 | 5689 | { | 5751 | { |
1521 | 5690 | result= 1; /* At least one record/element found. */ | 5752 | result= 1; /* At least one record/element found. */ |
1522 | 5691 | /* If search is requested, we do not need to search further. */ | 5753 | /* If search is requested, we do not need to search further. */ |
1523 | 5692 | if (! drop && ! user_to) | 5754 | if (! drop && ! user_to) |
1524 | 5693 | goto end; | 5755 | goto end; |
1525 | 5694 | } | 5756 | } |
1526 | 5757 | else if (ret < 0) | ||
1527 | 5758 | { | ||
1528 | 5759 | result= -1; | ||
1529 | 5760 | goto end; | ||
1530 | 5761 | } | ||
1531 | 5695 | /* Handle funcs array. */ | 5762 | /* Handle funcs array. */ |
1534 | 5696 | if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) || | 5763 | if ((((ret= handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from, |
1535 | 5697 | found) && ! result) | 5764 | user_to) > 0) && ! result) || found) && |
1536 | 5765 | ! result) | ||
1537 | 5698 | { | 5766 | { |
1538 | 5699 | result= 1; /* At least one record/element found. */ | 5767 | result= 1; /* At least one record/element found. */ |
1539 | 5700 | /* If search is requested, we do not need to search further. */ | 5768 | /* If search is requested, we do not need to search further. */ |
1540 | 5701 | if (! drop && ! user_to) | 5769 | if (! drop && ! user_to) |
1541 | 5702 | goto end; | 5770 | goto end; |
1542 | 5703 | } | 5771 | } |
1543 | 5772 | else if (ret < 0) | ||
1544 | 5773 | { | ||
1545 | 5774 | result= -1; | ||
1546 | 5775 | goto end; | ||
1547 | 5776 | } | ||
1548 | 5704 | } | 5777 | } |
1549 | 5705 | 5778 | ||
1550 | 5706 | /* Handle tables table. */ | 5779 | /* Handle tables table. */ |
1551 | @@ -5728,9 +5801,12 @@ | |||
1552 | 5728 | else | 5801 | else |
1553 | 5729 | { | 5802 | { |
1554 | 5730 | /* Handle columns hash. */ | 5803 | /* Handle columns hash. */ |
1557 | 5731 | if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) || | 5804 | if ((((ret= handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from, |
1558 | 5732 | found) && ! result) | 5805 | user_to) > 0) && ! result) || found) && |
1559 | 5806 | ! result) | ||
1560 | 5733 | result= 1; /* At least one record/element found. */ | 5807 | result= 1; /* At least one record/element found. */ |
1561 | 5808 | else if (ret < 0) | ||
1562 | 5809 | result= -1; | ||
1563 | 5734 | } | 5810 | } |
1564 | 5735 | } | 5811 | } |
1565 | 5736 | end: | 5812 | end: |
1566 | 5737 | 5813 | ||
1567 | === modified file 'Percona-Server/sql/sql_connect.cc' | |||
1568 | --- Percona-Server/sql/sql_connect.cc 2012-08-20 03:14:02 +0000 | |||
1569 | +++ Percona-Server/sql/sql_connect.cc 2013-01-10 04:35:33 +0000 | |||
1570 | @@ -914,6 +914,7 @@ | |||
1571 | 914 | 914 | ||
1572 | 915 | USER_RESOURCES ur; | 915 | USER_RESOURCES ur; |
1573 | 916 | int res= acl_getroot(thd, &ur, passwd, passwd_len); | 916 | int res= acl_getroot(thd, &ur, passwd, passwd_len); |
1574 | 917 | DBUG_EXECUTE_IF("password_format_mismatch",{res= -1;};); | ||
1575 | 917 | #ifndef EMBEDDED_LIBRARY | 918 | #ifndef EMBEDDED_LIBRARY |
1576 | 918 | if (res == -1) | 919 | if (res == -1) |
1577 | 919 | { | 920 | { |
1578 | @@ -924,6 +925,12 @@ | |||
1579 | 924 | in old format. | 925 | in old format. |
1580 | 925 | */ | 926 | */ |
1581 | 926 | NET *net= &thd->net; | 927 | NET *net= &thd->net; |
1582 | 928 | DBUG_EXECUTE_IF("password_format_mismatch", | ||
1583 | 929 | { | ||
1584 | 930 | inc_host_errors(&thd->remote.sin_addr); | ||
1585 | 931 | my_error(ER_HANDSHAKE_ERROR, MYF(0)); | ||
1586 | 932 | DBUG_RETURN(1); | ||
1587 | 933 | };); | ||
1588 | 927 | if (opt_secure_auth_local) | 934 | if (opt_secure_auth_local) |
1589 | 928 | { | 935 | { |
1590 | 929 | my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0), | 936 | my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0), |
1591 | @@ -1395,6 +1402,8 @@ | |||
1592 | 1395 | size_t passwd_len; | 1402 | size_t passwd_len; |
1593 | 1396 | char *user; | 1403 | char *user; |
1594 | 1397 | size_t user_len; | 1404 | size_t user_len; |
1595 | 1405 | uint charset_code= 0; | ||
1596 | 1406 | size_t bytes_remaining_in_packet= 0; | ||
1597 | 1398 | 1407 | ||
1598 | 1399 | DBUG_PRINT("info", | 1408 | DBUG_PRINT("info", |
1599 | 1400 | ("New connection received on %s", vio_description(net->vio))); | 1409 | ("New connection received on %s", vio_description(net->vio))); |
1600 | @@ -1411,6 +1420,19 @@ | |||
1601 | 1411 | my_error(ER_BAD_HOST_ERROR, MYF(0)); | 1420 | my_error(ER_BAD_HOST_ERROR, MYF(0)); |
1602 | 1412 | return 1; | 1421 | return 1; |
1603 | 1413 | } | 1422 | } |
1604 | 1423 | /* BEGIN : DEBUG */ | ||
1605 | 1424 | DBUG_EXECUTE_IF("addr_fake_ipv4", | ||
1606 | 1425 | { | ||
1607 | 1426 | struct sockaddr *sa= (sockaddr *) &net->vio->remote; | ||
1608 | 1427 | sa->sa_family= AF_INET; | ||
1609 | 1428 | struct in_addr *ip4= &((struct sockaddr_in *)sa)->sin_addr; | ||
1610 | 1429 | /* See RFC 5737, 192.0.2.0/23 is reserved */ | ||
1611 | 1430 | const char* fake= "192.0.2.4"; | ||
1612 | 1431 | ip4->s_addr= inet_addr(fake); | ||
1613 | 1432 | strcpy(ip, fake); | ||
1614 | 1433 | };); | ||
1615 | 1434 | /* END : DEBUG */ | ||
1616 | 1435 | |||
1617 | 1414 | if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME)))) | 1436 | if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME)))) |
1618 | 1415 | return 1; /* The error is set by my_strdup(). */ | 1437 | return 1; /* The error is set by my_strdup(). */ |
1619 | 1416 | thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip; | 1438 | thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip; |
1620 | @@ -1506,32 +1528,31 @@ | |||
1621 | 1506 | (uchar*) buff, (size_t) (end-buff)) || | 1528 | (uchar*) buff, (size_t) (end-buff)) || |
1622 | 1507 | (pkt_len= my_net_read(net)) == packet_error) | 1529 | (pkt_len= my_net_read(net)) == packet_error) |
1623 | 1508 | { | 1530 | { |
1627 | 1509 | inc_host_errors(&thd->remote.sin_addr); | 1531 | goto error; |
1625 | 1510 | my_error(ER_HANDSHAKE_ERROR, MYF(0)); | ||
1626 | 1511 | return 1; | ||
1628 | 1512 | } | 1532 | } |
1629 | 1513 | } | 1533 | } |
1630 | 1514 | #ifdef _CUSTOMCONFIG_ | 1534 | #ifdef _CUSTOMCONFIG_ |
1631 | 1515 | #include "_cust_sql_parse.h" | 1535 | #include "_cust_sql_parse.h" |
1632 | 1516 | #endif | 1536 | #endif |
1633 | 1517 | if (connect_errors) | ||
1634 | 1518 | reset_host_errors(&thd->remote.sin_addr); | ||
1635 | 1519 | if (thd->packet.alloc(thd->variables.net_buffer_length)) | 1537 | if (thd->packet.alloc(thd->variables.net_buffer_length)) |
1636 | 1520 | return 1; /* The error is set by alloc(). */ | 1538 | return 1; /* The error is set by alloc(). */ |
1637 | 1521 | 1539 | ||
1638 | 1522 | uint charset_code= 0; | ||
1639 | 1523 | end= (char *)net->read_pos; | 1540 | end= (char *)net->read_pos; |
1640 | 1524 | /* | 1541 | /* |
1641 | 1525 | In order to safely scan a head for '\0' string terminators | 1542 | In order to safely scan a head for '\0' string terminators |
1642 | 1526 | we must keep track of how many bytes remain in the allocated | 1543 | we must keep track of how many bytes remain in the allocated |
1643 | 1527 | buffer or we might read past the end of the buffer. | 1544 | buffer or we might read past the end of the buffer. |
1644 | 1528 | */ | 1545 | */ |
1646 | 1529 | size_t bytes_remaining_in_packet= pkt_len; | 1546 | bytes_remaining_in_packet= pkt_len; |
1647 | 1530 | 1547 | ||
1648 | 1531 | /* | 1548 | /* |
1649 | 1532 | Peek ahead on the client capability packet and determine which version of | 1549 | Peek ahead on the client capability packet and determine which version of |
1650 | 1533 | the protocol should be used. | 1550 | the protocol should be used. |
1651 | 1534 | */ | 1551 | */ |
1652 | 1552 | DBUG_EXECUTE_IF("host_error_packet_length", | ||
1653 | 1553 | { | ||
1654 | 1554 | bytes_remaining_in_packet= 0; | ||
1655 | 1555 | };); | ||
1656 | 1535 | if (bytes_remaining_in_packet < 2) | 1556 | if (bytes_remaining_in_packet < 2) |
1657 | 1536 | goto error; | 1557 | goto error; |
1658 | 1537 | 1558 | ||
1659 | @@ -1590,6 +1611,10 @@ | |||
1660 | 1590 | 1611 | ||
1661 | 1591 | skip_to_ssl: | 1612 | skip_to_ssl: |
1662 | 1592 | 1613 | ||
1663 | 1614 | DBUG_EXECUTE_IF("host_error_charset", | ||
1664 | 1615 | { | ||
1665 | 1616 | goto error; | ||
1666 | 1617 | };); | ||
1667 | 1593 | DBUG_PRINT("info", ("client_character_set: %u", charset_code)); | 1618 | DBUG_PRINT("info", ("client_character_set: %u", charset_code)); |
1668 | 1594 | if (thd_init_client_charset(thd, charset_code)) | 1619 | if (thd_init_client_charset(thd, charset_code)) |
1669 | 1595 | goto error; | 1620 | goto error; |
1670 | @@ -1658,6 +1683,10 @@ | |||
1671 | 1658 | bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40; | 1683 | bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40; |
1672 | 1659 | } | 1684 | } |
1673 | 1660 | 1685 | ||
1674 | 1686 | DBUG_EXECUTE_IF("host_error_SSL_layering", | ||
1675 | 1687 | { | ||
1676 | 1688 | packet_has_required_size= 0; | ||
1677 | 1689 | };); | ||
1678 | 1661 | if (!packet_has_required_size) | 1690 | if (!packet_has_required_size) |
1679 | 1662 | goto error; | 1691 | goto error; |
1680 | 1663 | } | 1692 | } |
1681 | @@ -1683,6 +1712,11 @@ | |||
1682 | 1683 | get_string= get_40_protocol_string; | 1712 | get_string= get_40_protocol_string; |
1683 | 1684 | 1713 | ||
1684 | 1685 | user= get_string(&end, &bytes_remaining_in_packet, &user_len); | 1714 | user= get_string(&end, &bytes_remaining_in_packet, &user_len); |
1685 | 1715 | DBUG_EXECUTE_IF("host_error_user", | ||
1686 | 1716 | { | ||
1687 | 1717 | user= NULL; | ||
1688 | 1718 | };); | ||
1689 | 1719 | |||
1690 | 1686 | if (user == NULL) | 1720 | if (user == NULL) |
1691 | 1687 | goto error; | 1721 | goto error; |
1692 | 1688 | 1722 | ||
1693 | @@ -1710,6 +1744,11 @@ | |||
1694 | 1710 | passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len); | 1744 | passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len); |
1695 | 1711 | } | 1745 | } |
1696 | 1712 | 1746 | ||
1697 | 1747 | DBUG_EXECUTE_IF("host_error_password", | ||
1698 | 1748 | { | ||
1699 | 1749 | passwd= NULL; | ||
1700 | 1750 | };); | ||
1701 | 1751 | |||
1702 | 1713 | if (passwd == NULL) | 1752 | if (passwd == NULL) |
1703 | 1714 | goto error; | 1753 | goto error; |
1704 | 1715 | 1754 | ||
1705 | @@ -1770,7 +1809,20 @@ | |||
1706 | 1770 | 1809 | ||
1707 | 1771 | if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME)))) | 1810 | if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME)))) |
1708 | 1772 | return 1; /* The error is set by my_strdup(). */ | 1811 | return 1; /* The error is set by my_strdup(). */ |
1710 | 1773 | return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE); | 1812 | |
1711 | 1813 | if (!check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE)) | ||
1712 | 1814 | { | ||
1713 | 1815 | /* | ||
1714 | 1816 | Call to reset_host_errors() should be made only when all sanity checks | ||
1715 | 1817 | are done and connection is going to be a successful. | ||
1716 | 1818 | */ | ||
1717 | 1819 | reset_host_errors(&thd->remote.sin_addr); | ||
1718 | 1820 | return 0; | ||
1719 | 1821 | } | ||
1720 | 1822 | else | ||
1721 | 1823 | { | ||
1722 | 1824 | return 1; | ||
1723 | 1825 | } | ||
1724 | 1774 | 1826 | ||
1725 | 1775 | error: | 1827 | error: |
1726 | 1776 | inc_host_errors(&thd->remote.sin_addr); | 1828 | inc_host_errors(&thd->remote.sin_addr); |
1727 | 1777 | 1829 | ||
1728 | === modified file 'Percona-Server/sql/sql_lex.cc' | |||
1729 | --- Percona-Server/sql/sql_lex.cc 2012-08-20 03:14:02 +0000 | |||
1730 | +++ Percona-Server/sql/sql_lex.cc 2013-01-10 04:35:33 +0000 | |||
1731 | @@ -1621,6 +1621,7 @@ | |||
1732 | 1621 | ref_pointer_array= 0; | 1621 | ref_pointer_array= 0; |
1733 | 1622 | select_n_where_fields= 0; | 1622 | select_n_where_fields= 0; |
1734 | 1623 | select_n_having_items= 0; | 1623 | select_n_having_items= 0; |
1735 | 1624 | n_child_sum_items= 0; | ||
1736 | 1624 | subquery_in_having= explicit_limit= 0; | 1625 | subquery_in_having= explicit_limit= 0; |
1737 | 1625 | is_item_list_lookup= 0; | 1626 | is_item_list_lookup= 0; |
1738 | 1626 | first_execution= 1; | 1627 | first_execution= 1; |
1739 | 1627 | 1628 | ||
1740 | === modified file 'Percona-Server/sql/sql_list.h' | |||
1741 | --- Percona-Server/sql/sql_list.h 2011-06-30 15:37:13 +0000 | |||
1742 | +++ Percona-Server/sql/sql_list.h 2013-01-10 04:35:33 +0000 | |||
1743 | @@ -1,7 +1,6 @@ | |||
1744 | 1 | #ifndef INCLUDES_MYSQL_SQL_LIST_H | 1 | #ifndef INCLUDES_MYSQL_SQL_LIST_H |
1745 | 2 | #define INCLUDES_MYSQL_SQL_LIST_H | 2 | #define INCLUDES_MYSQL_SQL_LIST_H |
1748 | 3 | /* | 3 | /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
1747 | 4 | Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. | ||
1749 | 5 | 4 | ||
1750 | 6 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
1751 | 7 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
1752 | @@ -165,6 +164,14 @@ | |||
1753 | 165 | public: | 164 | public: |
1754 | 166 | uint elements; | 165 | uint elements; |
1755 | 167 | 166 | ||
1756 | 167 | bool operator==(const base_list &rhs) const | ||
1757 | 168 | { | ||
1758 | 169 | return | ||
1759 | 170 | elements == rhs.elements && | ||
1760 | 171 | first == rhs.first && | ||
1761 | 172 | last == rhs.last; | ||
1762 | 173 | } | ||
1763 | 174 | |||
1764 | 168 | inline void empty() { elements=0; first= &end_of_list; last=&first;} | 175 | inline void empty() { elements=0; first= &end_of_list; last=&first;} |
1765 | 169 | inline base_list() { empty(); } | 176 | inline base_list() { empty(); } |
1766 | 170 | /** | 177 | /** |
1767 | 171 | 178 | ||
1768 | === modified file 'Percona-Server/sql/sql_profile.cc' | |||
1769 | --- Percona-Server/sql/sql_profile.cc 2012-08-20 03:14:02 +0000 | |||
1770 | +++ Percona-Server/sql/sql_profile.cc 2013-01-10 04:35:33 +0000 | |||
1771 | @@ -39,6 +39,7 @@ | |||
1772 | 39 | #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3) | 39 | #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3) |
1773 | 40 | 40 | ||
1774 | 41 | #define MAX_QUERY_LENGTH 300 | 41 | #define MAX_QUERY_LENGTH 300 |
1775 | 42 | #define MAX_QUERY_HISTORY 101 | ||
1776 | 42 | 43 | ||
1777 | 43 | /* Reserved for systems that can't record the function name in source. */ | 44 | /* Reserved for systems that can't record the function name in source. */ |
1778 | 44 | const char * const _unknown_func_ = "<unknown>"; | 45 | const char * const _unknown_func_ = "<unknown>"; |
1779 | @@ -247,9 +248,12 @@ | |||
1780 | 247 | QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg) | 248 | QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg) |
1781 | 248 | :profiling(profiling_arg), profiling_query_id(0), query_source(NULL) | 249 | :profiling(profiling_arg), profiling_query_id(0), query_source(NULL) |
1782 | 249 | { | 250 | { |
1786 | 250 | profile_start= new PROF_MEASUREMENT(this, status_arg); | 251 | m_seq_counter= 1; |
1787 | 251 | entries.push_back(profile_start); | 252 | PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg); |
1788 | 252 | profile_end= profile_start; | 253 | prof->m_seq= m_seq_counter++; |
1789 | 254 | m_start_time_usecs= prof->time_usecs; | ||
1790 | 255 | m_end_time_usecs= m_start_time_usecs; | ||
1791 | 256 | entries.push_back(prof); | ||
1792 | 253 | } | 257 | } |
1793 | 254 | 258 | ||
1794 | 255 | QUERY_PROFILE::~QUERY_PROFILE() | 259 | QUERY_PROFILE::~QUERY_PROFILE() |
1795 | @@ -289,9 +293,14 @@ | |||
1796 | 289 | else | 293 | else |
1797 | 290 | prof= new PROF_MEASUREMENT(this, status_arg); | 294 | prof= new PROF_MEASUREMENT(this, status_arg); |
1798 | 291 | 295 | ||
1800 | 292 | profile_end= prof; | 296 | prof->m_seq= m_seq_counter++; |
1801 | 297 | m_end_time_usecs= prof->time_usecs; | ||
1802 | 293 | entries.push_back(prof); | 298 | entries.push_back(prof); |
1803 | 294 | 299 | ||
1804 | 300 | /* Maintain the query history size. */ | ||
1805 | 301 | while (entries.elements > MAX_QUERY_HISTORY) | ||
1806 | 302 | delete entries.pop(); | ||
1807 | 303 | |||
1808 | 295 | DBUG_VOID_RETURN; | 304 | DBUG_VOID_RETURN; |
1809 | 296 | } | 305 | } |
1810 | 297 | 306 | ||
1811 | @@ -452,8 +461,7 @@ | |||
1812 | 452 | 461 | ||
1813 | 453 | String elapsed; | 462 | String elapsed; |
1814 | 454 | 463 | ||
1817 | 455 | PROF_MEASUREMENT *ps= prof->profile_start; | 464 | double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs; |
1816 | 456 | PROF_MEASUREMENT *pe= prof->profile_end; | ||
1818 | 457 | 465 | ||
1819 | 458 | if (++idx <= unit->offset_limit_cnt) | 466 | if (++idx <= unit->offset_limit_cnt) |
1820 | 459 | continue; | 467 | continue; |
1821 | @@ -462,7 +470,7 @@ | |||
1822 | 462 | 470 | ||
1823 | 463 | protocol->prepare_for_resend(); | 471 | protocol->prepare_for_resend(); |
1824 | 464 | protocol->store((uint32)(prof->profiling_query_id)); | 472 | protocol->store((uint32)(prof->profiling_query_id)); |
1826 | 465 | protocol->store((double)(pe->time_usecs - ps->time_usecs)/(1000.0*1000), | 473 | protocol->store((double)(query_time_usecs/(1000.0*1000)), |
1827 | 466 | (uint32) TIME_FLOAT_DIGITS-1, &elapsed); | 474 | (uint32) TIME_FLOAT_DIGITS-1, &elapsed); |
1828 | 467 | if (prof->query_source != NULL) | 475 | if (prof->query_source != NULL) |
1829 | 468 | protocol->store(prof->query_source, strlen(prof->query_source), | 476 | protocol->store(prof->query_source, strlen(prof->query_source), |
1830 | @@ -634,17 +642,18 @@ | |||
1831 | 634 | us also include a numbering of each state per query. The query_id and | 642 | us also include a numbering of each state per query. The query_id and |
1832 | 635 | the "seq" together are unique. | 643 | the "seq" together are unique. |
1833 | 636 | */ | 644 | */ |
1835 | 637 | ulonglong seq; | 645 | ulong seq; |
1836 | 638 | 646 | ||
1837 | 639 | void *entry_iterator; | 647 | void *entry_iterator; |
1838 | 640 | PROF_MEASUREMENT *entry, *previous= NULL; | 648 | PROF_MEASUREMENT *entry, *previous= NULL; |
1839 | 641 | /* ...and for each query, go through all its state-change steps. */ | 649 | /* ...and for each query, go through all its state-change steps. */ |
1841 | 642 | for (seq= 0, entry_iterator= query->entries.new_iterator(); | 650 | for (entry_iterator= query->entries.new_iterator(); |
1842 | 643 | entry_iterator != NULL; | 651 | entry_iterator != NULL; |
1843 | 644 | entry_iterator= query->entries.iterator_next(entry_iterator), | 652 | entry_iterator= query->entries.iterator_next(entry_iterator), |
1845 | 645 | seq++, previous=entry, row_number++) | 653 | previous=entry, row_number++) |
1846 | 646 | { | 654 | { |
1847 | 647 | entry= query->entries.iterator_value(entry_iterator); | 655 | entry= query->entries.iterator_value(entry_iterator); |
1848 | 656 | seq= entry->m_seq; | ||
1849 | 648 | 657 | ||
1850 | 649 | /* Skip the first. We count spans of fence, not fence-posts. */ | 658 | /* Skip the first. We count spans of fence, not fence-posts. */ |
1851 | 650 | if (previous == NULL) continue; | 659 | if (previous == NULL) continue; |
1852 | 651 | 660 | ||
1853 | === modified file 'Percona-Server/sql/sql_profile.h' | |||
1854 | --- Percona-Server/sql/sql_profile.h 2011-11-24 01:59:44 +0000 | |||
1855 | +++ Percona-Server/sql/sql_profile.h 2013-01-10 04:35:33 +0000 | |||
1856 | @@ -186,6 +186,7 @@ | |||
1857 | 186 | char *file; | 186 | char *file; |
1858 | 187 | unsigned int line; | 187 | unsigned int line; |
1859 | 188 | 188 | ||
1860 | 189 | ulong m_seq; | ||
1861 | 189 | double time_usecs; | 190 | double time_usecs; |
1862 | 190 | double cpu_time_usecs; | 191 | double cpu_time_usecs; |
1863 | 191 | PROF_MEASUREMENT(); | 192 | PROF_MEASUREMENT(); |
1864 | @@ -212,8 +213,9 @@ | |||
1865 | 212 | query_id_t profiling_query_id; /* Session-specific id. */ | 213 | query_id_t profiling_query_id; /* Session-specific id. */ |
1866 | 213 | char *query_source; | 214 | char *query_source; |
1867 | 214 | 215 | ||
1870 | 215 | PROF_MEASUREMENT *profile_start; | 216 | double m_start_time_usecs; |
1871 | 216 | PROF_MEASUREMENT *profile_end; | 217 | double m_end_time_usecs; |
1872 | 218 | ulong m_seq_counter; | ||
1873 | 217 | Queue<PROF_MEASUREMENT> entries; | 219 | Queue<PROF_MEASUREMENT> entries; |
1874 | 218 | 220 | ||
1875 | 219 | 221 | ||
1876 | 220 | 222 | ||
1877 | === modified file 'Percona-Server/sql/sql_select.cc' | |||
1878 | --- Percona-Server/sql/sql_select.cc 2013-01-10 04:35:31 +0000 | |||
1879 | +++ Percona-Server/sql/sql_select.cc 2013-01-10 04:35:33 +0000 | |||
1880 | @@ -1,4 +1,4 @@ | |||
1882 | 1 | /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. | 1 | /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
1883 | 2 | 2 | ||
1884 | 3 | This program is free software; you can redistribute it and/or modify | 3 | This program is free software; you can redistribute it and/or modify |
1885 | 4 | it under the terms of the GNU General Public License as published by | 4 | it under the terms of the GNU General Public License as published by |
1886 | @@ -1699,6 +1699,8 @@ | |||
1887 | 1699 | */ | 1699 | */ |
1888 | 1700 | void JOIN::restore_tmp() | 1700 | void JOIN::restore_tmp() |
1889 | 1701 | { | 1701 | { |
1890 | 1702 | DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join)); | ||
1891 | 1703 | DBUG_ASSERT(tmp_join != this); | ||
1892 | 1702 | memcpy(tmp_join, this, (size_t) sizeof(JOIN)); | 1704 | memcpy(tmp_join, this, (size_t) sizeof(JOIN)); |
1893 | 1703 | } | 1705 | } |
1894 | 1704 | 1706 | ||
1895 | @@ -7116,21 +7118,19 @@ | |||
1896 | 7116 | } | 7118 | } |
1897 | 7117 | } | 7119 | } |
1898 | 7118 | } | 7120 | } |
1899 | 7119 | /* | ||
1900 | 7120 | We are not using tables anymore | ||
1901 | 7121 | Unlock all tables. We may be in an INSERT .... SELECT statement. | ||
1902 | 7122 | */ | ||
1903 | 7123 | if (full) | 7121 | if (full) |
1904 | 7124 | { | 7122 | { |
1907 | 7125 | if (tmp_join) | 7123 | /* |
1908 | 7126 | tmp_table_param.copy_field= 0; | 7124 | Ensure that the following delete_elements() would not be called |
1909 | 7125 | twice for the same list. | ||
1910 | 7126 | */ | ||
1911 | 7127 | if (tmp_join && tmp_join != this && | ||
1912 | 7128 | tmp_join->group_fields == this->group_fields) | ||
1913 | 7129 | tmp_join->group_fields.empty(); | ||
1914 | 7130 | |||
1915 | 7131 | // Run Cached_item DTORs! | ||
1916 | 7127 | group_fields.delete_elements(); | 7132 | group_fields.delete_elements(); |
1923 | 7128 | /* | 7133 | |
1918 | 7129 | Ensure that the above delete_elements() would not be called | ||
1919 | 7130 | twice for the same list. | ||
1920 | 7131 | */ | ||
1921 | 7132 | if (tmp_join && tmp_join != this) | ||
1922 | 7133 | tmp_join->group_fields= group_fields; | ||
1924 | 7134 | /* | 7134 | /* |
1925 | 7135 | We can't call delete_elements() on copy_funcs as this will cause | 7135 | We can't call delete_elements() on copy_funcs as this will cause |
1926 | 7136 | problems in free_elements() as some of the elements are then deleted. | 7136 | problems in free_elements() as some of the elements are then deleted. |
1927 | 7137 | 7137 | ||
1928 | === modified file 'Percona-Server/storage/innobase/btr/btr0cur.c' | |||
1929 | --- Percona-Server/storage/innobase/btr/btr0cur.c 2012-08-20 00:29:22 +0000 | |||
1930 | +++ Percona-Server/storage/innobase/btr/btr0cur.c 2013-01-10 04:35:33 +0000 | |||
1931 | @@ -2377,21 +2377,22 @@ | |||
1932 | 2377 | } | 2377 | } |
1933 | 2378 | 2378 | ||
1934 | 2379 | /*************************************************************** | 2379 | /*************************************************************** |
1936 | 2380 | Sets a secondary index record delete mark to FALSE. This function is only | 2380 | Sets a secondary index record delete mark. This function is only |
1937 | 2381 | used by the insert buffer insert merge mechanism. */ | 2381 | used by the insert buffer insert merge mechanism. */ |
1938 | 2382 | 2382 | ||
1939 | 2383 | void | 2383 | void |
1942 | 2384 | btr_cur_del_unmark_for_ibuf( | 2384 | btr_cur_set_deleted_flag_for_ibuf( |
1943 | 2385 | /*========================*/ | 2385 | /*==============================*/ |
1944 | 2386 | rec_t* rec, /* in: record to delete unmark */ | 2386 | rec_t* rec, /* in: record to delete unmark */ |
1945 | 2387 | ibool val, /* in: value to set */ | ||
1946 | 2387 | mtr_t* mtr) /* in: mtr */ | 2388 | mtr_t* mtr) /* in: mtr */ |
1947 | 2388 | { | 2389 | { |
1948 | 2389 | /* We do not need to reserve btr_search_latch, as the page has just | 2390 | /* We do not need to reserve btr_search_latch, as the page has just |
1949 | 2390 | been read to the buffer pool and there cannot be a hash index to it. */ | 2391 | been read to the buffer pool and there cannot be a hash index to it. */ |
1950 | 2391 | 2392 | ||
1952 | 2392 | rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), FALSE); | 2393 | rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), val); |
1953 | 2393 | 2394 | ||
1955 | 2394 | btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr); | 2395 | btr_cur_del_mark_set_sec_rec_log(rec, val, mtr); |
1956 | 2395 | } | 2396 | } |
1957 | 2396 | 2397 | ||
1958 | 2397 | /*==================== B-TREE RECORD REMOVE =========================*/ | 2398 | /*==================== B-TREE RECORD REMOVE =========================*/ |
1959 | 2398 | 2399 | ||
1960 | === modified file 'Percona-Server/storage/innobase/dict/dict0dict.c' | |||
1961 | --- Percona-Server/storage/innobase/dict/dict0dict.c 2012-03-01 05:35:51 +0000 | |||
1962 | +++ Percona-Server/storage/innobase/dict/dict0dict.c 2013-01-10 04:35:33 +0000 | |||
1963 | @@ -1629,7 +1629,6 @@ | |||
1964 | 1629 | { | 1629 | { |
1965 | 1630 | dict_index_t* new_index; | 1630 | dict_index_t* new_index; |
1966 | 1631 | dict_field_t* field; | 1631 | dict_field_t* field; |
1967 | 1632 | ulint fixed_size; | ||
1968 | 1633 | ulint trx_id_pos; | 1632 | ulint trx_id_pos; |
1969 | 1634 | ulint i; | 1633 | ulint i; |
1970 | 1635 | ibool* indexed; | 1634 | ibool* indexed; |
1971 | @@ -1706,7 +1705,7 @@ | |||
1972 | 1706 | 1705 | ||
1973 | 1707 | for (i = 0; i < trx_id_pos; i++) { | 1706 | for (i = 0; i < trx_id_pos; i++) { |
1974 | 1708 | 1707 | ||
1976 | 1709 | fixed_size = dict_col_get_fixed_size( | 1708 | ulint fixed_size = dict_col_get_fixed_size( |
1977 | 1710 | dict_index_get_nth_col(new_index, i)); | 1709 | dict_index_get_nth_col(new_index, i)); |
1978 | 1711 | 1710 | ||
1979 | 1712 | if (fixed_size == 0) { | 1711 | if (fixed_size == 0) { |
1980 | @@ -1722,7 +1721,20 @@ | |||
1981 | 1722 | break; | 1721 | break; |
1982 | 1723 | } | 1722 | } |
1983 | 1724 | 1723 | ||
1985 | 1725 | new_index->trx_id_offset += (unsigned int) fixed_size; | 1724 | /* Add fixed_size to new_index->trx_id_offset. |
1986 | 1725 | Because the latter is a bit-field, an overflow | ||
1987 | 1726 | can theoretically occur. Check for it. */ | ||
1988 | 1727 | fixed_size += new_index->trx_id_offset; | ||
1989 | 1728 | |||
1990 | 1729 | new_index->trx_id_offset = fixed_size; | ||
1991 | 1730 | |||
1992 | 1731 | if (new_index->trx_id_offset != fixed_size) { | ||
1993 | 1732 | /* Overflow. Pretend that this is a | ||
1994 | 1733 | variable-length PRIMARY KEY. */ | ||
1995 | 1734 | ut_ad(0); | ||
1996 | 1735 | new_index->trx_id_offset = 0; | ||
1997 | 1736 | break; | ||
1998 | 1737 | } | ||
1999 | 1726 | } | 1738 | } |
2000 | 1727 | 1739 | ||
2001 | 1728 | } | 1740 | } |
2002 | 1729 | 1741 | ||
2003 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' | |||
2004 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-10 04:35:31 +0000 | |||
2005 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-10 04:35:33 +0000 | |||
2006 | @@ -9274,8 +9274,8 @@ | |||
2007 | 9274 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG | 9274 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG |
2008 | 9275 | static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, | 9275 | static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, |
2009 | 9276 | PLUGIN_VAR_RQCMDARG, | 9276 | PLUGIN_VAR_RQCMDARG, |
2012 | 9277 | "Debug flags for InnoDB change buffering (0=none)", | 9277 | "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", |
2013 | 9278 | NULL, NULL, 0, 0, 1, 0); | 9278 | NULL, NULL, 0, 0, 2, 0); |
2014 | 9279 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ | 9279 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ |
2015 | 9280 | 9280 | ||
2016 | 9281 | #ifdef UNIV_DEBUG | 9281 | #ifdef UNIV_DEBUG |
2017 | 9282 | 9282 | ||
2018 | === modified file 'Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c' | |||
2019 | --- Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2012-01-16 12:22:03 +0000 | |||
2020 | +++ Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2013-01-10 04:35:33 +0000 | |||
2021 | @@ -2978,7 +2978,7 @@ | |||
2022 | 2978 | /* The records only differ in the delete-mark. | 2978 | /* The records only differ in the delete-mark. |
2023 | 2979 | Clear the delete-mark, like we did before | 2979 | Clear the delete-mark, like we did before |
2024 | 2980 | Bug #56680 was fixed. */ | 2980 | Bug #56680 was fixed. */ |
2026 | 2981 | btr_cur_del_unmark_for_ibuf(rec, mtr); | 2981 | btr_cur_set_deleted_flag_for_ibuf(rec, FALSE, mtr); |
2027 | 2982 | updated_in_place: | 2982 | updated_in_place: |
2028 | 2983 | mem_heap_free(heap); | 2983 | mem_heap_free(heap); |
2029 | 2984 | return; | 2984 | return; |
2030 | @@ -3058,6 +3058,22 @@ | |||
2031 | 3058 | 3058 | ||
2032 | 3059 | ut_ad(ibuf_inside()); | 3059 | ut_ad(ibuf_inside()); |
2033 | 3060 | 3060 | ||
2034 | 3061 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG | ||
2035 | 3062 | if (ibuf_debug == 2) { | ||
2036 | 3063 | /* Inject a fault (crash). We do this before trying | ||
2037 | 3064 | optimistic delete, because a pessimistic delete in the | ||
2038 | 3065 | change buffer would require a larger test case. */ | ||
2039 | 3066 | |||
2040 | 3067 | /* Flag the buffered record as processed, to avoid | ||
2041 | 3068 | an assertion failure after crash recovery. */ | ||
2042 | 3069 | btr_cur_set_deleted_flag_for_ibuf( | ||
2043 | 3070 | btr_pcur_get_rec(pcur), TRUE, mtr); | ||
2044 | 3071 | mtr_commit(mtr); | ||
2045 | 3072 | log_make_checkpoint_at(ut_dulint_max, TRUE); | ||
2046 | 3073 | DBUG_SUICIDE(); | ||
2047 | 3074 | } | ||
2048 | 3075 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ | ||
2049 | 3076 | |||
2050 | 3061 | success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); | 3077 | success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); |
2051 | 3062 | 3078 | ||
2052 | 3063 | if (success) { | 3079 | if (success) { |
2053 | @@ -3072,7 +3088,13 @@ | |||
2054 | 3072 | return(FALSE); | 3088 | return(FALSE); |
2055 | 3073 | } | 3089 | } |
2056 | 3074 | 3090 | ||
2058 | 3075 | /* We have to resort to a pessimistic delete from ibuf */ | 3091 | /* We have to resort to a pessimistic delete from ibuf. |
2059 | 3092 | Delete-mark the record so that it will not be applied again, | ||
2060 | 3093 | in case the server crashes before the pessimistic delete is | ||
2061 | 3094 | made persistent. */ | ||
2062 | 3095 | btr_cur_set_deleted_flag_for_ibuf( | ||
2063 | 3096 | btr_pcur_get_rec(pcur), TRUE, mtr); | ||
2064 | 3097 | |||
2065 | 3076 | btr_pcur_store_position(pcur, mtr); | 3098 | btr_pcur_store_position(pcur, mtr); |
2066 | 3077 | 3099 | ||
2067 | 3078 | btr_pcur_commit_specify_mtr(pcur, mtr); | 3100 | btr_pcur_commit_specify_mtr(pcur, mtr); |
2068 | @@ -3343,7 +3365,7 @@ | |||
2069 | 3343 | fputs("InnoDB: Discarding record\n ", stderr); | 3365 | fputs("InnoDB: Discarding record\n ", stderr); |
2070 | 3344 | rec_print_old(stderr, ibuf_rec); | 3366 | rec_print_old(stderr, ibuf_rec); |
2071 | 3345 | fputs("\n from the insert buffer!\n\n", stderr); | 3367 | fputs("\n from the insert buffer!\n\n", stderr); |
2073 | 3346 | } else if (page) { | 3368 | } else if (page && !rec_get_deleted_flag(ibuf_rec, 0)) { |
2074 | 3347 | /* Now we have at pcur a record which should be | 3369 | /* Now we have at pcur a record which should be |
2075 | 3348 | inserted to the index page; NOTE that the call below | 3370 | inserted to the index page; NOTE that the call below |
2076 | 3349 | copies pointers to fields in ibuf_rec, and we must | 3371 | copies pointers to fields in ibuf_rec, and we must |
2077 | 3350 | 3372 | ||
2078 | === modified file 'Percona-Server/storage/innobase/include/btr0cur.h' | |||
2079 | --- Percona-Server/storage/innobase/include/btr0cur.h 2011-10-26 09:23:57 +0000 | |||
2080 | +++ Percona-Server/storage/innobase/include/btr0cur.h 2013-01-10 04:35:33 +0000 | |||
2081 | @@ -277,13 +277,14 @@ | |||
2082 | 277 | que_thr_t* thr, /* in: query thread */ | 277 | que_thr_t* thr, /* in: query thread */ |
2083 | 278 | mtr_t* mtr); /* in: mtr */ | 278 | mtr_t* mtr); /* in: mtr */ |
2084 | 279 | /*************************************************************** | 279 | /*************************************************************** |
2087 | 280 | Sets a secondary index record delete mark to FALSE. This function is | 280 | Sets a secondary index record delete mark. This function is only |
2088 | 281 | only used by the insert buffer insert merge mechanism. */ | 281 | used by the insert buffer insert merge mechanism. */ |
2089 | 282 | 282 | ||
2090 | 283 | void | 283 | void |
2093 | 284 | btr_cur_del_unmark_for_ibuf( | 284 | btr_cur_set_deleted_flag_for_ibuf( |
2094 | 285 | /*========================*/ | 285 | /*==============================*/ |
2095 | 286 | rec_t* rec, /* in: record to delete unmark */ | 286 | rec_t* rec, /* in: record to delete unmark */ |
2096 | 287 | ibool val, /* in: value to set */ | ||
2097 | 287 | mtr_t* mtr); /* in: mtr */ | 288 | mtr_t* mtr); /* in: mtr */ |
2098 | 288 | /***************************************************************** | 289 | /***************************************************************** |
2099 | 289 | Tries to compress a page of the tree on the leaf level. It is assumed | 290 | Tries to compress a page of the tree on the leaf level. It is assumed |
2100 | 290 | 291 | ||
2101 | === modified file 'Percona-Server/storage/innobase/include/dict0mem.h' | |||
2102 | --- Percona-Server/storage/innobase/include/dict0mem.h 2011-01-14 17:02:28 +0000 | |||
2103 | +++ Percona-Server/storage/innobase/include/dict0mem.h 2013-01-10 04:35:33 +0000 | |||
2104 | @@ -196,10 +196,15 @@ | |||
2105 | 196 | unsigned space:32; | 196 | unsigned space:32; |
2106 | 197 | /* space where the index tree is placed */ | 197 | /* space where the index tree is placed */ |
2107 | 198 | unsigned page:32;/* index tree root page number */ | 198 | unsigned page:32;/* index tree root page number */ |
2109 | 199 | unsigned trx_id_offset:10;/* position of the the trx id column | 199 | #define MAX_KEY_LENGTH_BITS 12 |
2110 | 200 | unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; | ||
2111 | 201 | /* position of the trx id column | ||
2112 | 200 | in a clustered index record, if the fields | 202 | in a clustered index record, if the fields |
2113 | 201 | before it are known to be of a fixed size, | 203 | before it are known to be of a fixed size, |
2114 | 202 | 0 otherwise */ | 204 | 0 otherwise */ |
2115 | 205 | #if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH | ||
2116 | 206 | # error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH | ||
2117 | 207 | #endif | ||
2118 | 203 | unsigned n_user_defined_cols:10; | 208 | unsigned n_user_defined_cols:10; |
2119 | 204 | /* number of columns the user defined to | 209 | /* number of columns the user defined to |
2120 | 205 | be in the index: in the internal | 210 | be in the index: in the internal |
2121 | 206 | 211 | ||
2122 | === modified file 'Percona-Server/storage/innobase/include/row0undo.h' | |||
2123 | --- Percona-Server/storage/innobase/include/row0undo.h 2006-08-28 17:42:45 +0000 | |||
2124 | +++ Percona-Server/storage/innobase/include/row0undo.h 2013-01-10 04:35:33 +0000 | |||
2125 | @@ -78,8 +78,6 @@ | |||
2126 | 78 | dulint undo_no;/* undo number of the record */ | 78 | dulint undo_no;/* undo number of the record */ |
2127 | 79 | ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC, | 79 | ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC, |
2128 | 80 | ... */ | 80 | ... */ |
2129 | 81 | dulint new_roll_ptr; /* roll ptr to restore to clustered index | ||
2130 | 82 | record */ | ||
2131 | 83 | dulint new_trx_id; /* trx id to restore to clustered index | 81 | dulint new_trx_id; /* trx id to restore to clustered index |
2132 | 84 | record */ | 82 | record */ |
2133 | 85 | btr_pcur_t pcur; /* persistent cursor used in searching the | 83 | btr_pcur_t pcur; /* persistent cursor used in searching the |
2134 | @@ -101,11 +99,8 @@ | |||
2135 | 101 | /* Execution states for an undo node */ | 99 | /* Execution states for an undo node */ |
2136 | 102 | #define UNDO_NODE_FETCH_NEXT 1 /* we should fetch the next undo log | 100 | #define UNDO_NODE_FETCH_NEXT 1 /* we should fetch the next undo log |
2137 | 103 | record */ | 101 | record */ |
2143 | 104 | #define UNDO_NODE_PREV_VERS 2 /* the roll ptr to previous version of | 102 | #define UNDO_NODE_INSERT 2 |
2144 | 105 | a row is stored in node, and undo | 103 | #define UNDO_NODE_MODIFY 3 |
2140 | 106 | should be done based on it */ | ||
2141 | 107 | #define UNDO_NODE_INSERT 3 | ||
2142 | 108 | #define UNDO_NODE_MODIFY 4 | ||
2145 | 109 | 104 | ||
2146 | 110 | 105 | ||
2147 | 111 | #ifndef UNIV_NONINL | 106 | #ifndef UNIV_NONINL |
2148 | 112 | 107 | ||
2149 | === modified file 'Percona-Server/storage/innobase/os/os0file.c' | |||
2150 | --- Percona-Server/storage/innobase/os/os0file.c 2010-10-28 04:18:59 +0000 | |||
2151 | +++ Percona-Server/storage/innobase/os/os0file.c 2013-01-10 04:35:33 +0000 | |||
2152 | @@ -1215,6 +1215,14 @@ | |||
2153 | 1215 | DWORD create_flag; | 1215 | DWORD create_flag; |
2154 | 1216 | DWORD attributes; | 1216 | DWORD attributes; |
2155 | 1217 | ibool retry; | 1217 | ibool retry; |
2156 | 1218 | |||
2157 | 1219 | DBUG_EXECUTE_IF( | ||
2158 | 1220 | "ib_create_table_fail_disk_full", | ||
2159 | 1221 | *success = FALSE; | ||
2160 | 1222 | SetLastError(ERROR_DISK_FULL); | ||
2161 | 1223 | return((os_file_t) -1); | ||
2162 | 1224 | ); | ||
2163 | 1225 | |||
2164 | 1218 | try_again: | 1226 | try_again: |
2165 | 1219 | ut_a(name); | 1227 | ut_a(name); |
2166 | 1220 | 1228 | ||
2167 | @@ -1318,6 +1326,13 @@ | |||
2168 | 1318 | ibool retry; | 1326 | ibool retry; |
2169 | 1319 | const char* mode_str = NULL; | 1327 | const char* mode_str = NULL; |
2170 | 1320 | 1328 | ||
2171 | 1329 | DBUG_EXECUTE_IF( | ||
2172 | 1330 | "ib_create_table_fail_disk_full", | ||
2173 | 1331 | *success = FALSE; | ||
2174 | 1332 | errno = ENOSPC; | ||
2175 | 1333 | return((os_file_t) -1); | ||
2176 | 1334 | ); | ||
2177 | 1335 | |||
2178 | 1321 | try_again: | 1336 | try_again: |
2179 | 1322 | ut_a(name); | 1337 | ut_a(name); |
2180 | 1323 | 1338 | ||
2181 | 1324 | 1339 | ||
2182 | === modified file 'Percona-Server/storage/innobase/row/row0sel.c' | |||
2183 | --- Percona-Server/storage/innobase/row/row0sel.c 2011-12-22 10:55:44 +0000 | |||
2184 | +++ Percona-Server/storage/innobase/row/row0sel.c 2013-01-10 04:35:33 +0000 | |||
2185 | @@ -3758,9 +3758,13 @@ | |||
2186 | 3758 | } | 3758 | } |
2187 | 3759 | 3759 | ||
2188 | 3760 | rec_loop: | 3760 | rec_loop: |
2189 | 3761 | if (trx_is_interrupted(trx)) { | ||
2190 | 3762 | err = DB_INTERRUPTED; | ||
2191 | 3763 | goto normal_return; | ||
2192 | 3764 | } | ||
2193 | 3765 | |||
2194 | 3761 | /*-------------------------------------------------------------*/ | 3766 | /*-------------------------------------------------------------*/ |
2195 | 3762 | /* PHASE 4: Look for matching records in a loop */ | 3767 | /* PHASE 4: Look for matching records in a loop */ |
2196 | 3763 | |||
2197 | 3764 | rec = btr_pcur_get_rec(pcur); | 3768 | rec = btr_pcur_get_rec(pcur); |
2198 | 3765 | ut_ad(!!page_rec_is_comp(rec) == comp); | 3769 | ut_ad(!!page_rec_is_comp(rec) == comp); |
2199 | 3766 | #ifdef UNIV_SEARCH_DEBUG | 3770 | #ifdef UNIV_SEARCH_DEBUG |
2200 | @@ -4656,14 +4660,18 @@ | |||
2201 | 4656 | /* TODO: We have to cast away the const of rec for now. This needs | 4660 | /* TODO: We have to cast away the const of rec for now. This needs |
2202 | 4657 | to be fixed later.*/ | 4661 | to be fixed later.*/ |
2203 | 4658 | offsets = rec_get_offsets( | 4662 | offsets = rec_get_offsets( |
2205 | 4659 | (rec_t*) rec, index, offsets, ULINT_UNDEFINED, &heap); | 4663 | (rec_t*) rec, index, offsets, col_no + 1, &heap); |
2206 | 4664 | |||
2207 | 4665 | if (rec_offs_nth_sql_null(offsets, col_no)) { | ||
2208 | 4666 | /* There is no non-NULL value in the auto-increment column. */ | ||
2209 | 4667 | value = 0; | ||
2210 | 4668 | goto func_exit; | ||
2211 | 4669 | } | ||
2212 | 4660 | 4670 | ||
2213 | 4661 | /* TODO: We have to cast away the const of rec for now. This needs | 4671 | /* TODO: We have to cast away the const of rec for now. This needs |
2214 | 4662 | to be fixed later.*/ | 4672 | to be fixed later.*/ |
2215 | 4663 | data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len); | 4673 | data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len); |
2216 | 4664 | 4674 | ||
2217 | 4665 | ut_a(len != UNIV_SQL_NULL); | ||
2218 | 4666 | |||
2219 | 4667 | switch (mtype) { | 4675 | switch (mtype) { |
2220 | 4668 | case DATA_INT: | 4676 | case DATA_INT: |
2221 | 4669 | ut_a(len <= sizeof value); | 4677 | ut_a(len <= sizeof value); |
2222 | @@ -4684,15 +4692,16 @@ | |||
2223 | 4684 | ut_error; | 4692 | ut_error; |
2224 | 4685 | } | 4693 | } |
2225 | 4686 | 4694 | ||
2226 | 4687 | if (UNIV_LIKELY_NULL(heap)) { | ||
2227 | 4688 | mem_heap_free(heap); | ||
2228 | 4689 | } | ||
2229 | 4690 | |||
2230 | 4691 | /* We assume that the autoinc counter can't be negative. */ | 4695 | /* We assume that the autoinc counter can't be negative. */ |
2231 | 4692 | if (!unsigned_type && (ib_longlong) value < 0) { | 4696 | if (!unsigned_type && (ib_longlong) value < 0) { |
2232 | 4693 | value = 0; | 4697 | value = 0; |
2233 | 4694 | } | 4698 | } |
2234 | 4695 | 4699 | ||
2235 | 4700 | func_exit: | ||
2236 | 4701 | if (UNIV_LIKELY_NULL(heap)) { | ||
2237 | 4702 | mem_heap_free(heap); | ||
2238 | 4703 | } | ||
2239 | 4704 | |||
2240 | 4696 | return(value); | 4705 | return(value); |
2241 | 4697 | } | 4706 | } |
2242 | 4698 | 4707 | ||
2243 | 4699 | 4708 | ||
2244 | === modified file 'Percona-Server/storage/innobase/row/row0umod.c' | |||
2245 | --- Percona-Server/storage/innobase/row/row0umod.c 2011-10-26 09:23:57 +0000 | |||
2246 | +++ Percona-Server/storage/innobase/row/row0umod.c 2013-01-10 04:35:33 +0000 | |||
2247 | @@ -42,37 +42,6 @@ | |||
2248 | 42 | version has become obsolete at the time the undo is started. */ | 42 | version has become obsolete at the time the undo is started. */ |
2249 | 43 | 43 | ||
2250 | 44 | /*************************************************************** | 44 | /*************************************************************** |
2251 | 45 | Checks if also the previous version of the clustered index record was | ||
2252 | 46 | modified or inserted by the same transaction, and its undo number is such | ||
2253 | 47 | that it should be undone in the same rollback. */ | ||
2254 | 48 | UNIV_INLINE | ||
2255 | 49 | ibool | ||
2256 | 50 | row_undo_mod_undo_also_prev_vers( | ||
2257 | 51 | /*=============================*/ | ||
2258 | 52 | /* out: TRUE if also previous modify or | ||
2259 | 53 | insert of this row should be undone */ | ||
2260 | 54 | undo_node_t* node, /* in: row undo node */ | ||
2261 | 55 | dulint* undo_no)/* out: the undo number */ | ||
2262 | 56 | { | ||
2263 | 57 | trx_undo_rec_t* undo_rec; | ||
2264 | 58 | trx_t* trx; | ||
2265 | 59 | |||
2266 | 60 | trx = node->trx; | ||
2267 | 61 | |||
2268 | 62 | if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) { | ||
2269 | 63 | |||
2270 | 64 | *undo_no = ut_dulint_zero; | ||
2271 | 65 | return(FALSE); | ||
2272 | 66 | } | ||
2273 | 67 | |||
2274 | 68 | undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap); | ||
2275 | 69 | |||
2276 | 70 | *undo_no = trx_undo_rec_get_undo_no(undo_rec); | ||
2277 | 71 | |||
2278 | 72 | return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0); | ||
2279 | 73 | } | ||
2280 | 74 | |||
2281 | 75 | /*************************************************************** | ||
2282 | 76 | Undoes a modify in a clustered index record. */ | 45 | Undoes a modify in a clustered index record. */ |
2283 | 77 | static | 46 | static |
2284 | 78 | ulint | 47 | ulint |
2285 | @@ -202,17 +171,9 @@ | |||
2286 | 202 | btr_pcur_t* pcur; | 171 | btr_pcur_t* pcur; |
2287 | 203 | mtr_t mtr; | 172 | mtr_t mtr; |
2288 | 204 | ulint err; | 173 | ulint err; |
2289 | 205 | ibool success; | ||
2290 | 206 | ibool more_vers; | ||
2291 | 207 | dulint new_undo_no; | ||
2292 | 208 | 174 | ||
2293 | 209 | ut_ad(node && thr); | 175 | ut_ad(node && thr); |
2294 | 210 | 176 | ||
2295 | 211 | /* Check if also the previous version of the clustered index record | ||
2296 | 212 | should be undone in this same rollback operation */ | ||
2297 | 213 | |||
2298 | 214 | more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no); | ||
2299 | 215 | |||
2300 | 216 | pcur = &(node->pcur); | 177 | pcur = &(node->pcur); |
2301 | 217 | 178 | ||
2302 | 218 | mtr_start(&mtr); | 179 | mtr_start(&mtr); |
2303 | @@ -260,20 +221,6 @@ | |||
2304 | 260 | 221 | ||
2305 | 261 | trx_undo_rec_release(node->trx, node->undo_no); | 222 | trx_undo_rec_release(node->trx, node->undo_no); |
2306 | 262 | 223 | ||
2307 | 263 | if (more_vers && err == DB_SUCCESS) { | ||
2308 | 264 | |||
2309 | 265 | /* Reserve the undo log record to the prior version after | ||
2310 | 266 | committing &mtr: this is necessary to comply with the latching | ||
2311 | 267 | order, as &mtr may contain the fsp latch which is lower in | ||
2312 | 268 | the latch hierarchy than trx->undo_mutex. */ | ||
2313 | 269 | |||
2314 | 270 | success = trx_undo_rec_reserve(node->trx, new_undo_no); | ||
2315 | 271 | |||
2316 | 272 | if (success) { | ||
2317 | 273 | node->state = UNDO_NODE_PREV_VERS; | ||
2318 | 274 | } | ||
2319 | 275 | } | ||
2320 | 276 | |||
2321 | 277 | return(err); | 224 | return(err); |
2322 | 278 | } | 225 | } |
2323 | 279 | 226 | ||
2324 | @@ -702,7 +649,6 @@ | |||
2325 | 702 | trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, | 649 | trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, |
2326 | 703 | roll_ptr, info_bits, trx, | 650 | roll_ptr, info_bits, trx, |
2327 | 704 | node->heap, &(node->update)); | 651 | node->heap, &(node->update)); |
2328 | 705 | node->new_roll_ptr = roll_ptr; | ||
2329 | 706 | node->new_trx_id = trx_id; | 652 | node->new_trx_id = trx_id; |
2330 | 707 | node->cmpl_info = cmpl_info; | 653 | node->cmpl_info = cmpl_info; |
2331 | 708 | } | 654 | } |
2332 | 709 | 655 | ||
2333 | === modified file 'Percona-Server/storage/innobase/row/row0undo.c' | |||
2334 | --- Percona-Server/storage/innobase/row/row0undo.c 2010-06-25 08:18:41 +0000 | |||
2335 | +++ Percona-Server/storage/innobase/row/row0undo.c 2013-01-10 04:35:33 +0000 | |||
2336 | @@ -242,25 +242,6 @@ | |||
2337 | 242 | } else { | 242 | } else { |
2338 | 243 | node->state = UNDO_NODE_MODIFY; | 243 | node->state = UNDO_NODE_MODIFY; |
2339 | 244 | } | 244 | } |
2340 | 245 | |||
2341 | 246 | } else if (node->state == UNDO_NODE_PREV_VERS) { | ||
2342 | 247 | |||
2343 | 248 | /* Undo should be done to the same clustered index record | ||
2344 | 249 | again in this same rollback, restoring the previous version */ | ||
2345 | 250 | |||
2346 | 251 | roll_ptr = node->new_roll_ptr; | ||
2347 | 252 | |||
2348 | 253 | node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr, | ||
2349 | 254 | node->heap); | ||
2350 | 255 | node->roll_ptr = roll_ptr; | ||
2351 | 256 | node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); | ||
2352 | 257 | |||
2353 | 258 | if (trx_undo_roll_ptr_is_insert(roll_ptr)) { | ||
2354 | 259 | |||
2355 | 260 | node->state = UNDO_NODE_INSERT; | ||
2356 | 261 | } else { | ||
2357 | 262 | node->state = UNDO_NODE_MODIFY; | ||
2358 | 263 | } | ||
2359 | 264 | } | 245 | } |
2360 | 265 | 246 | ||
2361 | 266 | /* Prevent DROP TABLE etc. while we are rolling back this row. | 247 | /* Prevent DROP TABLE etc. while we are rolling back this row. |
2362 | 267 | 248 | ||
2363 | === modified file 'Percona-Server/storage/innodb_plugin/ChangeLog' | |||
2364 | --- Percona-Server/storage/innodb_plugin/ChangeLog 2013-01-10 04:35:31 +0000 | |||
2365 | +++ Percona-Server/storage/innodb_plugin/ChangeLog 2013-01-10 04:35:33 +0000 | |||
2366 | @@ -1,3 +1,40 @@ | |||
2367 | 1 | 2012-10-18 The InnoDB Team | ||
2368 | 2 | |||
2369 | 3 | * row/row0sel.c: | ||
2370 | 4 | Fix Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION: | ||
2371 | 5 | LEN <= SIZEOF(ULONGLONG) | ||
2372 | 6 | |||
2373 | 7 | 2012-10-16 The InnoDB Team | ||
2374 | 8 | |||
2375 | 9 | * dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h: | ||
2376 | 10 | Fix Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL | ||
2377 | 11 | DUPLICATE VALUE FOR PREFIX KEYS | ||
2378 | 12 | |||
2379 | 13 | 2012-10-09 The InnoDB Team | ||
2380 | 14 | |||
2381 | 15 | * row/row0mysql.c: | ||
2382 | 16 | Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE | ||
2383 | 17 | |||
2384 | 18 | 2012-09-28 The InnoDB Team | ||
2385 | 19 | |||
2386 | 20 | * include/row0undo.h, row/row0umod.c, row/row0undo.c: | ||
2387 | 21 | Fix Bug#13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY | ||
2388 | 22 | IN TRANSACTION ROLLBACK. This patch will ensure that the | ||
2389 | 23 | undo logs will be applied in proper reverse order. | ||
2390 | 24 | |||
2391 | 25 | 2012-09-18 The InnoDB Team | ||
2392 | 26 | |||
2393 | 27 | * btr/btr0cur.c, handler/ha_innodb.cc, ibuf/ibuf0ibuf.c, | ||
2394 | 28 | include/btr0cur.h: | ||
2395 | 29 | Fix Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE | ||
2396 | 30 | |||
2397 | 31 | 2012-09-17 The InnoDB Team | ||
2398 | 32 | |||
2399 | 33 | * btr/btr0btr.c, btr/btr0cur.c, buf/buf0lru.c, | ||
2400 | 34 | include/page0zip.h, log/log0recv.c, page/page0cur.c, | ||
2401 | 35 | page/page0page.c, page/page0zip.c: | ||
2402 | 36 | Fix Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG | ||
2403 | 37 | |||
2404 | 1 | 2012-08-29 The InnoDB Team | 38 | 2012-08-29 The InnoDB Team |
2405 | 2 | 39 | ||
2406 | 3 | * btr/btr0btr.c, page/page0cur.c, page/page0page.c: | 40 | * btr/btr0btr.c, page/page0cur.c, page/page0page.c: |
2407 | 4 | 41 | ||
2408 | === modified file 'Percona-Server/storage/innodb_plugin/btr/btr0btr.c' | |||
2409 | --- Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2013-01-10 04:35:31 +0000 | |||
2410 | +++ Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2013-01-10 04:35:33 +0000 | |||
2411 | @@ -1620,7 +1620,7 @@ | |||
2412 | 1620 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); | 1620 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); |
2413 | 1621 | ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); | 1621 | ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); |
2414 | 1622 | #ifdef UNIV_ZIP_DEBUG | 1622 | #ifdef UNIV_ZIP_DEBUG |
2416 | 1623 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 1623 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2417 | 1624 | #endif /* UNIV_ZIP_DEBUG */ | 1624 | #endif /* UNIV_ZIP_DEBUG */ |
2418 | 1625 | data_size1 = page_get_data_size(page); | 1625 | data_size1 = page_get_data_size(page); |
2419 | 1626 | max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); | 1626 | max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); |
2420 | @@ -1738,7 +1738,7 @@ | |||
2421 | 1738 | 1738 | ||
2422 | 1739 | func_exit: | 1739 | func_exit: |
2423 | 1740 | #ifdef UNIV_ZIP_DEBUG | 1740 | #ifdef UNIV_ZIP_DEBUG |
2425 | 1741 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 1741 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2426 | 1742 | #endif /* UNIV_ZIP_DEBUG */ | 1742 | #endif /* UNIV_ZIP_DEBUG */ |
2427 | 1743 | #ifndef UNIV_HOTBACKUP | 1743 | #ifndef UNIV_HOTBACKUP |
2428 | 1744 | buf_block_free(temp_block); | 1744 | buf_block_free(temp_block); |
2429 | @@ -1813,7 +1813,7 @@ | |||
2430 | 1813 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); | 1813 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); |
2431 | 1814 | ut_ad(page_zip == buf_block_get_page_zip(block)); | 1814 | ut_ad(page_zip == buf_block_get_page_zip(block)); |
2432 | 1815 | #ifdef UNIV_ZIP_DEBUG | 1815 | #ifdef UNIV_ZIP_DEBUG |
2434 | 1816 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 1816 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2435 | 1817 | #endif /* UNIV_ZIP_DEBUG */ | 1817 | #endif /* UNIV_ZIP_DEBUG */ |
2436 | 1818 | 1818 | ||
2437 | 1819 | btr_search_drop_page_hash_index(block); | 1819 | btr_search_drop_page_hash_index(block); |
2438 | @@ -1870,10 +1870,10 @@ | |||
2439 | 1870 | root_block = btr_cur_get_block(cursor); | 1870 | root_block = btr_cur_get_block(cursor); |
2440 | 1871 | root_page_zip = buf_block_get_page_zip(root_block); | 1871 | root_page_zip = buf_block_get_page_zip(root_block); |
2441 | 1872 | ut_ad(page_get_n_recs(root) > 0); | 1872 | ut_ad(page_get_n_recs(root) > 0); |
2442 | 1873 | index = btr_cur_get_index(cursor); | ||
2443 | 1873 | #ifdef UNIV_ZIP_DEBUG | 1874 | #ifdef UNIV_ZIP_DEBUG |
2445 | 1874 | ut_a(!root_page_zip || page_zip_validate(root_page_zip, root)); | 1875 | ut_a(!root_page_zip || page_zip_validate(root_page_zip, root, index)); |
2446 | 1875 | #endif /* UNIV_ZIP_DEBUG */ | 1876 | #endif /* UNIV_ZIP_DEBUG */ |
2447 | 1876 | index = btr_cur_get_index(cursor); | ||
2448 | 1877 | #ifdef UNIV_BTR_DEBUG | 1877 | #ifdef UNIV_BTR_DEBUG |
2449 | 1878 | if (!dict_index_is_ibuf(index)) { | 1878 | if (!dict_index_is_ibuf(index)) { |
2450 | 1879 | ulint space = dict_index_get_space(index); | 1879 | ulint space = dict_index_get_space(index); |
2451 | @@ -2803,8 +2803,8 @@ | |||
2452 | 2803 | 2803 | ||
2453 | 2804 | #ifdef UNIV_ZIP_DEBUG | 2804 | #ifdef UNIV_ZIP_DEBUG |
2454 | 2805 | if (UNIV_LIKELY_NULL(page_zip)) { | 2805 | if (UNIV_LIKELY_NULL(page_zip)) { |
2457 | 2806 | ut_a(page_zip_validate(page_zip, page)); | 2806 | ut_a(page_zip_validate(page_zip, page, cursor->index)); |
2458 | 2807 | ut_a(page_zip_validate(new_page_zip, new_page)); | 2807 | ut_a(page_zip_validate(new_page_zip, new_page, cursor->index)); |
2459 | 2808 | } | 2808 | } |
2460 | 2809 | #endif /* UNIV_ZIP_DEBUG */ | 2809 | #endif /* UNIV_ZIP_DEBUG */ |
2461 | 2810 | 2810 | ||
2462 | @@ -2838,7 +2838,8 @@ | |||
2463 | 2838 | = buf_block_get_page_zip(insert_block); | 2838 | = buf_block_get_page_zip(insert_block); |
2464 | 2839 | 2839 | ||
2465 | 2840 | ut_a(!insert_page_zip | 2840 | ut_a(!insert_page_zip |
2467 | 2841 | || page_zip_validate(insert_page_zip, insert_page)); | 2841 | || page_zip_validate(insert_page_zip, insert_page, |
2468 | 2842 | cursor->index)); | ||
2469 | 2842 | } | 2843 | } |
2470 | 2843 | #endif /* UNIV_ZIP_DEBUG */ | 2844 | #endif /* UNIV_ZIP_DEBUG */ |
2471 | 2844 | 2845 | ||
2472 | @@ -3203,7 +3204,7 @@ | |||
2473 | 3203 | 3204 | ||
2474 | 3204 | btr_page_set_level(page, page_zip, page_level, mtr); | 3205 | btr_page_set_level(page, page_zip, page_level, mtr); |
2475 | 3205 | #ifdef UNIV_ZIP_DEBUG | 3206 | #ifdef UNIV_ZIP_DEBUG |
2477 | 3206 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3207 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2478 | 3207 | #endif /* UNIV_ZIP_DEBUG */ | 3208 | #endif /* UNIV_ZIP_DEBUG */ |
2479 | 3208 | } | 3209 | } |
2480 | 3209 | 3210 | ||
2481 | @@ -3379,8 +3380,8 @@ | |||
2482 | 3379 | const page_zip_des_t* page_zip | 3380 | const page_zip_des_t* page_zip |
2483 | 3380 | = buf_block_get_page_zip(block); | 3381 | = buf_block_get_page_zip(block); |
2484 | 3381 | ut_a(page_zip); | 3382 | ut_a(page_zip); |
2487 | 3382 | ut_a(page_zip_validate(merge_page_zip, merge_page)); | 3383 | ut_a(page_zip_validate(merge_page_zip, merge_page, index)); |
2488 | 3383 | ut_a(page_zip_validate(page_zip, page)); | 3384 | ut_a(page_zip_validate(page_zip, page, index)); |
2489 | 3384 | } | 3385 | } |
2490 | 3385 | #endif /* UNIV_ZIP_DEBUG */ | 3386 | #endif /* UNIV_ZIP_DEBUG */ |
2491 | 3386 | 3387 | ||
2492 | @@ -3513,7 +3514,8 @@ | |||
2493 | 3513 | 3514 | ||
2494 | 3514 | ut_ad(page_validate(merge_page, index)); | 3515 | ut_ad(page_validate(merge_page, index)); |
2495 | 3515 | #ifdef UNIV_ZIP_DEBUG | 3516 | #ifdef UNIV_ZIP_DEBUG |
2497 | 3516 | ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page)); | 3517 | ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page, |
2498 | 3518 | index)); | ||
2499 | 3517 | #endif /* UNIV_ZIP_DEBUG */ | 3519 | #endif /* UNIV_ZIP_DEBUG */ |
2500 | 3518 | 3520 | ||
2501 | 3519 | /* Free the file page */ | 3521 | /* Free the file page */ |
2502 | @@ -3696,7 +3698,7 @@ | |||
2503 | 3696 | page_zip_des_t* merge_page_zip | 3698 | page_zip_des_t* merge_page_zip |
2504 | 3697 | = buf_block_get_page_zip(merge_block); | 3699 | = buf_block_get_page_zip(merge_block); |
2505 | 3698 | ut_a(!merge_page_zip | 3700 | ut_a(!merge_page_zip |
2507 | 3699 | || page_zip_validate(merge_page_zip, merge_page)); | 3701 | || page_zip_validate(merge_page_zip, merge_page, index)); |
2508 | 3700 | } | 3702 | } |
2509 | 3701 | #endif /* UNIV_ZIP_DEBUG */ | 3703 | #endif /* UNIV_ZIP_DEBUG */ |
2510 | 3702 | 3704 | ||
2511 | @@ -4173,7 +4175,7 @@ | |||
2512 | 4173 | ut_a(space == page_get_space_id(page)); | 4175 | ut_a(space == page_get_space_id(page)); |
2513 | 4174 | #ifdef UNIV_ZIP_DEBUG | 4176 | #ifdef UNIV_ZIP_DEBUG |
2514 | 4175 | page_zip = buf_block_get_page_zip(block); | 4177 | page_zip = buf_block_get_page_zip(block); |
2516 | 4176 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 4178 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2517 | 4177 | #endif /* UNIV_ZIP_DEBUG */ | 4179 | #endif /* UNIV_ZIP_DEBUG */ |
2518 | 4178 | ut_a(!page_is_leaf(page)); | 4180 | ut_a(!page_is_leaf(page)); |
2519 | 4179 | 4181 | ||
2520 | @@ -4201,7 +4203,7 @@ | |||
2521 | 4201 | 4203 | ||
2522 | 4202 | #ifdef UNIV_ZIP_DEBUG | 4204 | #ifdef UNIV_ZIP_DEBUG |
2523 | 4203 | page_zip = buf_block_get_page_zip(block); | 4205 | page_zip = buf_block_get_page_zip(block); |
2525 | 4204 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 4206 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2526 | 4205 | #endif /* UNIV_ZIP_DEBUG */ | 4207 | #endif /* UNIV_ZIP_DEBUG */ |
2527 | 4206 | 4208 | ||
2528 | 4207 | /* Check ordering etc. of records */ | 4209 | /* Check ordering etc. of records */ |
2529 | 4208 | 4210 | ||
2530 | === modified file 'Percona-Server/storage/innodb_plugin/btr/btr0cur.c' | |||
2531 | --- Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2013-01-10 04:35:31 +0000 | |||
2532 | +++ Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2013-01-10 04:35:33 +0000 | |||
2533 | @@ -651,7 +651,8 @@ | |||
2534 | 651 | #ifdef UNIV_ZIP_DEBUG | 651 | #ifdef UNIV_ZIP_DEBUG |
2535 | 652 | const page_zip_des_t* page_zip | 652 | const page_zip_des_t* page_zip |
2536 | 653 | = buf_block_get_page_zip(block); | 653 | = buf_block_get_page_zip(block); |
2538 | 654 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 654 | ut_a(!page_zip |
2539 | 655 | || page_zip_validate(page_zip, page, index)); | ||
2540 | 655 | #endif /* UNIV_ZIP_DEBUG */ | 656 | #endif /* UNIV_ZIP_DEBUG */ |
2541 | 656 | 657 | ||
2542 | 657 | buf_block_dbg_add_level( | 658 | buf_block_dbg_add_level( |
2543 | @@ -2084,7 +2085,7 @@ | |||
2544 | 2084 | 2085 | ||
2545 | 2085 | page_zip = buf_block_get_page_zip(block); | 2086 | page_zip = buf_block_get_page_zip(block); |
2546 | 2086 | #ifdef UNIV_ZIP_DEBUG | 2087 | #ifdef UNIV_ZIP_DEBUG |
2548 | 2087 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 2088 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2549 | 2088 | #endif /* UNIV_ZIP_DEBUG */ | 2089 | #endif /* UNIV_ZIP_DEBUG */ |
2550 | 2089 | 2090 | ||
2551 | 2090 | if (page_zip | 2091 | if (page_zip |
2552 | @@ -2299,7 +2300,7 @@ | |||
2553 | 2299 | MTR_MEMO_X_LOCK)); | 2300 | MTR_MEMO_X_LOCK)); |
2554 | 2300 | ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); | 2301 | ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); |
2555 | 2301 | #ifdef UNIV_ZIP_DEBUG | 2302 | #ifdef UNIV_ZIP_DEBUG |
2557 | 2302 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 2303 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2558 | 2303 | #endif /* UNIV_ZIP_DEBUG */ | 2304 | #endif /* UNIV_ZIP_DEBUG */ |
2559 | 2304 | /* The insert buffer tree should never be updated in place. */ | 2305 | /* The insert buffer tree should never be updated in place. */ |
2560 | 2305 | ut_ad(!dict_index_is_ibuf(index)); | 2306 | ut_ad(!dict_index_is_ibuf(index)); |
2561 | @@ -2454,7 +2455,7 @@ | |||
2562 | 2454 | btr_search_update_hash_on_delete(cursor); | 2455 | btr_search_update_hash_on_delete(cursor); |
2563 | 2455 | 2456 | ||
2564 | 2456 | #ifdef UNIV_ZIP_DEBUG | 2457 | #ifdef UNIV_ZIP_DEBUG |
2566 | 2457 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 2458 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2567 | 2458 | #endif /* UNIV_ZIP_DEBUG */ | 2459 | #endif /* UNIV_ZIP_DEBUG */ |
2568 | 2459 | page_cursor = btr_cur_get_page_cur(cursor); | 2460 | page_cursor = btr_cur_get_page_cur(cursor); |
2569 | 2460 | 2461 | ||
2570 | @@ -2561,7 +2562,7 @@ | |||
2571 | 2561 | buf_block_t* rec_block = btr_cur_get_block(cursor); | 2562 | buf_block_t* rec_block = btr_cur_get_block(cursor); |
2572 | 2562 | 2563 | ||
2573 | 2563 | #ifdef UNIV_ZIP_DEBUG | 2564 | #ifdef UNIV_ZIP_DEBUG |
2575 | 2564 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 2565 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2576 | 2565 | page = buf_block_get_frame(rec_block); | 2566 | page = buf_block_get_frame(rec_block); |
2577 | 2566 | #endif /* UNIV_ZIP_DEBUG */ | 2567 | #endif /* UNIV_ZIP_DEBUG */ |
2578 | 2567 | page_zip = buf_block_get_page_zip(rec_block); | 2568 | page_zip = buf_block_get_page_zip(rec_block); |
2579 | @@ -2587,7 +2588,7 @@ | |||
2580 | 2587 | 2588 | ||
2581 | 2588 | return_after_reservations: | 2589 | return_after_reservations: |
2582 | 2589 | #ifdef UNIV_ZIP_DEBUG | 2590 | #ifdef UNIV_ZIP_DEBUG |
2584 | 2590 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 2591 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2585 | 2591 | #endif /* UNIV_ZIP_DEBUG */ | 2592 | #endif /* UNIV_ZIP_DEBUG */ |
2586 | 2592 | 2593 | ||
2587 | 2593 | if (n_extents > 0) { | 2594 | if (n_extents > 0) { |
2588 | @@ -2946,19 +2947,20 @@ | |||
2589 | 2946 | return(DB_SUCCESS); | 2947 | return(DB_SUCCESS); |
2590 | 2947 | } | 2948 | } |
2591 | 2948 | 2949 | ||
2594 | 2949 | /***********************************************************//** | 2950 | /*************************************************************** |
2595 | 2950 | Clear a secondary index record's delete mark. This function is only | 2951 | Sets a secondary index record delete mark. This function is only |
2596 | 2951 | used by the insert buffer insert merge mechanism. */ | 2952 | used by the insert buffer insert merge mechanism. */ |
2597 | 2952 | UNIV_INTERN | 2953 | UNIV_INTERN |
2598 | 2953 | void | 2954 | void |
2601 | 2954 | btr_cur_del_unmark_for_ibuf( | 2955 | btr_cur_set_deleted_flag_for_ibuf( |
2602 | 2955 | /*========================*/ | 2956 | /*==============================*/ |
2603 | 2956 | rec_t* rec, /*!< in/out: record to delete unmark */ | 2957 | rec_t* rec, /*!< in/out: record to delete unmark */ |
2604 | 2957 | page_zip_des_t* page_zip, /*!< in/out: compressed page | 2958 | page_zip_des_t* page_zip, /*!< in/out: compressed page |
2605 | 2958 | corresponding to rec, or NULL | 2959 | corresponding to rec, or NULL |
2606 | 2959 | when the tablespace is | 2960 | when the tablespace is |
2607 | 2960 | uncompressed */ | 2961 | uncompressed */ |
2609 | 2961 | mtr_t* mtr) /*!< in: mtr */ | 2962 | ibool val, /*!< in: value to set */ |
2610 | 2963 | mtr_t* mtr) /*!< in/out: mini-transaction */ | ||
2611 | 2962 | { | 2964 | { |
2612 | 2963 | /* We do not need to reserve btr_search_latch, as the page | 2965 | /* We do not need to reserve btr_search_latch, as the page |
2613 | 2964 | has just been read to the buffer pool and there cannot be | 2966 | has just been read to the buffer pool and there cannot be |
2614 | @@ -2966,9 +2968,9 @@ | |||
2615 | 2966 | updated in place and the adaptive hash index does not depend | 2968 | updated in place and the adaptive hash index does not depend |
2616 | 2967 | on it. */ | 2969 | on it. */ |
2617 | 2968 | 2970 | ||
2619 | 2969 | btr_rec_set_deleted_flag(rec, page_zip, FALSE); | 2971 | btr_rec_set_deleted_flag(rec, page_zip, val); |
2620 | 2970 | 2972 | ||
2622 | 2971 | btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr); | 2973 | btr_cur_del_mark_set_sec_rec_log(rec, val, mtr); |
2623 | 2972 | } | 2974 | } |
2624 | 2973 | 2975 | ||
2625 | 2974 | /*==================== B-TREE RECORD REMOVE =========================*/ | 2976 | /*==================== B-TREE RECORD REMOVE =========================*/ |
2626 | @@ -3063,12 +3065,14 @@ | |||
2627 | 3063 | page, 1); | 3065 | page, 1); |
2628 | 3064 | } | 3066 | } |
2629 | 3065 | #ifdef UNIV_ZIP_DEBUG | 3067 | #ifdef UNIV_ZIP_DEBUG |
2631 | 3066 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3068 | ut_a(!page_zip |
2632 | 3069 | || page_zip_validate(page_zip, page, cursor->index)); | ||
2633 | 3067 | #endif /* UNIV_ZIP_DEBUG */ | 3070 | #endif /* UNIV_ZIP_DEBUG */ |
2634 | 3068 | page_cur_delete_rec(btr_cur_get_page_cur(cursor), | 3071 | page_cur_delete_rec(btr_cur_get_page_cur(cursor), |
2635 | 3069 | cursor->index, offsets, mtr); | 3072 | cursor->index, offsets, mtr); |
2636 | 3070 | #ifdef UNIV_ZIP_DEBUG | 3073 | #ifdef UNIV_ZIP_DEBUG |
2638 | 3071 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3074 | ut_a(!page_zip |
2639 | 3075 | || page_zip_validate(page_zip, page, cursor->index)); | ||
2640 | 3072 | #endif /* UNIV_ZIP_DEBUG */ | 3076 | #endif /* UNIV_ZIP_DEBUG */ |
2641 | 3073 | 3077 | ||
2642 | 3074 | if (dict_index_is_clust(cursor->index) | 3078 | if (dict_index_is_clust(cursor->index) |
2643 | @@ -3165,7 +3169,7 @@ | |||
2644 | 3165 | rec = btr_cur_get_rec(cursor); | 3169 | rec = btr_cur_get_rec(cursor); |
2645 | 3166 | page_zip = buf_block_get_page_zip(block); | 3170 | page_zip = buf_block_get_page_zip(block); |
2646 | 3167 | #ifdef UNIV_ZIP_DEBUG | 3171 | #ifdef UNIV_ZIP_DEBUG |
2648 | 3168 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3172 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2649 | 3169 | #endif /* UNIV_ZIP_DEBUG */ | 3173 | #endif /* UNIV_ZIP_DEBUG */ |
2650 | 3170 | 3174 | ||
2651 | 3171 | offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); | 3175 | offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); |
2652 | @@ -3175,7 +3179,7 @@ | |||
2653 | 3175 | rec, offsets, page_zip, | 3179 | rec, offsets, page_zip, |
2654 | 3176 | rb_ctx, mtr); | 3180 | rb_ctx, mtr); |
2655 | 3177 | #ifdef UNIV_ZIP_DEBUG | 3181 | #ifdef UNIV_ZIP_DEBUG |
2657 | 3178 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3182 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2658 | 3179 | #endif /* UNIV_ZIP_DEBUG */ | 3183 | #endif /* UNIV_ZIP_DEBUG */ |
2659 | 3180 | } | 3184 | } |
2660 | 3181 | 3185 | ||
2661 | @@ -3236,7 +3240,7 @@ | |||
2662 | 3236 | 3240 | ||
2663 | 3237 | page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr); | 3241 | page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr); |
2664 | 3238 | #ifdef UNIV_ZIP_DEBUG | 3242 | #ifdef UNIV_ZIP_DEBUG |
2666 | 3239 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 3243 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
2667 | 3240 | #endif /* UNIV_ZIP_DEBUG */ | 3244 | #endif /* UNIV_ZIP_DEBUG */ |
2668 | 3241 | 3245 | ||
2669 | 3242 | ut_ad(btr_check_node_ptr(index, block, mtr)); | 3246 | ut_ad(btr_check_node_ptr(index, block, mtr)); |
2670 | 3243 | 3247 | ||
2671 | === modified file 'Percona-Server/storage/innodb_plugin/buf/buf0buf.c' | |||
2672 | --- Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2013-01-10 04:35:31 +0000 | |||
2673 | +++ Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2013-01-10 04:35:33 +0000 | |||
2674 | @@ -278,7 +278,7 @@ | |||
2675 | 278 | 278 | ||
2676 | 279 | #ifndef UNIV_HOTBACKUP | 279 | #ifndef UNIV_HOTBACKUP |
2677 | 280 | /** Value in microseconds */ | 280 | /** Value in microseconds */ |
2679 | 281 | static const int WAIT_FOR_READ = 5000; | 281 | static const int WAIT_FOR_READ = 100; |
2680 | 282 | /** Number of attemtps made to read in a page in the buffer pool */ | 282 | /** Number of attemtps made to read in a page in the buffer pool */ |
2681 | 283 | static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; | 283 | static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; |
2682 | 284 | 284 | ||
2683 | @@ -2202,8 +2202,9 @@ | |||
2684 | 2202 | mutex_exit(&block->mutex); | 2202 | mutex_exit(&block->mutex); |
2685 | 2203 | 2203 | ||
2686 | 2204 | if (io_fix == BUF_IO_READ) { | 2204 | if (io_fix == BUF_IO_READ) { |
2689 | 2205 | 2205 | /* wait by temporaly s-latch */ | |
2690 | 2206 | os_thread_sleep(WAIT_FOR_READ); | 2206 | rw_lock_s_lock(&(block->lock)); |
2691 | 2207 | rw_lock_s_unlock(&(block->lock)); | ||
2692 | 2207 | } else { | 2208 | } else { |
2693 | 2208 | break; | 2209 | break; |
2694 | 2209 | } | 2210 | } |
2695 | 2210 | 2211 | ||
2696 | === modified file 'Percona-Server/storage/innodb_plugin/buf/buf0lru.c' | |||
2697 | --- Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-11-23 11:15:06 +0000 | |||
2698 | +++ Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2013-01-10 04:35:33 +0000 | |||
2699 | @@ -1839,7 +1839,9 @@ | |||
2700 | 1839 | break; | 1839 | break; |
2701 | 1840 | case FIL_PAGE_INDEX: | 1840 | case FIL_PAGE_INDEX: |
2702 | 1841 | #ifdef UNIV_ZIP_DEBUG | 1841 | #ifdef UNIV_ZIP_DEBUG |
2704 | 1842 | ut_a(page_zip_validate(&bpage->zip, page)); | 1842 | ut_a(page_zip_validate( |
2705 | 1843 | &bpage->zip, page, | ||
2706 | 1844 | ((buf_block_t*) bpage)->index)); | ||
2707 | 1843 | #endif /* UNIV_ZIP_DEBUG */ | 1845 | #endif /* UNIV_ZIP_DEBUG */ |
2708 | 1844 | break; | 1846 | break; |
2709 | 1845 | default: | 1847 | default: |
2710 | 1846 | 1848 | ||
2711 | === modified file 'Percona-Server/storage/innodb_plugin/dict/dict0dict.c' | |||
2712 | --- Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2012-08-20 03:14:02 +0000 | |||
2713 | +++ Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2013-01-10 04:35:33 +0000 | |||
2714 | @@ -1,6 +1,6 @@ | |||
2715 | 1 | /***************************************************************************** | 1 | /***************************************************************************** |
2716 | 2 | 2 | ||
2718 | 3 | Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. | 3 | Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. |
2719 | 4 | 4 | ||
2720 | 5 | This program is free software; you can redistribute it and/or modify it under | 5 | This program is free software; you can redistribute it and/or modify it under |
2721 | 6 | the terms of the GNU General Public License as published by the Free Software | 6 | the terms of the GNU General Public License as published by the Free Software |
2722 | @@ -498,38 +498,55 @@ | |||
2723 | 498 | ULINT_UNDEFINED if not contained */ | 498 | ULINT_UNDEFINED if not contained */ |
2724 | 499 | UNIV_INTERN | 499 | UNIV_INTERN |
2725 | 500 | ulint | 500 | ulint |
2726 | 501 | dict_index_get_nth_col_or_prefix_pos( | ||
2727 | 502 | /*=================================*/ | ||
2728 | 503 | const dict_index_t* index, /*!< in: index */ | ||
2729 | 504 | ulint n, /*!< in: column number */ | ||
2730 | 505 | ibool inc_prefix) /*!< in: TRUE=consider | ||
2731 | 506 | column prefixes too */ | ||
2732 | 507 | { | ||
2733 | 508 | const dict_field_t* field; | ||
2734 | 509 | const dict_col_t* col; | ||
2735 | 510 | ulint pos; | ||
2736 | 511 | ulint n_fields; | ||
2737 | 512 | |||
2738 | 513 | ut_ad(index); | ||
2739 | 514 | ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); | ||
2740 | 515 | |||
2741 | 516 | col = dict_table_get_nth_col(index->table, n); | ||
2742 | 517 | |||
2743 | 518 | if (dict_index_is_clust(index)) { | ||
2744 | 519 | |||
2745 | 520 | return(dict_col_get_clust_pos(col, index)); | ||
2746 | 521 | } | ||
2747 | 522 | |||
2748 | 523 | n_fields = dict_index_get_n_fields(index); | ||
2749 | 524 | |||
2750 | 525 | for (pos = 0; pos < n_fields; pos++) { | ||
2751 | 526 | field = dict_index_get_nth_field(index, pos); | ||
2752 | 527 | |||
2753 | 528 | if (col == field->col | ||
2754 | 529 | && (inc_prefix || field->prefix_len == 0)) { | ||
2755 | 530 | |||
2756 | 531 | return(pos); | ||
2757 | 532 | } | ||
2758 | 533 | } | ||
2759 | 534 | |||
2760 | 535 | return(ULINT_UNDEFINED); | ||
2761 | 536 | } | ||
2762 | 537 | |||
2763 | 538 | /********************************************************************//** | ||
2764 | 539 | Looks for column n in an index. | ||
2765 | 540 | @return position in internal representation of the index; | ||
2766 | 541 | ULINT_UNDEFINED if not contained */ | ||
2767 | 542 | UNIV_INTERN | ||
2768 | 543 | ulint | ||
2769 | 501 | dict_index_get_nth_col_pos( | 544 | dict_index_get_nth_col_pos( |
2770 | 502 | /*=======================*/ | 545 | /*=======================*/ |
2771 | 503 | const dict_index_t* index, /*!< in: index */ | 546 | const dict_index_t* index, /*!< in: index */ |
2772 | 504 | ulint n) /*!< in: column number */ | 547 | ulint n) /*!< in: column number */ |
2773 | 505 | { | 548 | { |
2801 | 506 | const dict_field_t* field; | 549 | return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE)); |
2775 | 507 | const dict_col_t* col; | ||
2776 | 508 | ulint pos; | ||
2777 | 509 | ulint n_fields; | ||
2778 | 510 | |||
2779 | 511 | ut_ad(index); | ||
2780 | 512 | ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); | ||
2781 | 513 | |||
2782 | 514 | col = dict_table_get_nth_col(index->table, n); | ||
2783 | 515 | |||
2784 | 516 | if (dict_index_is_clust(index)) { | ||
2785 | 517 | |||
2786 | 518 | return(dict_col_get_clust_pos(col, index)); | ||
2787 | 519 | } | ||
2788 | 520 | |||
2789 | 521 | n_fields = dict_index_get_n_fields(index); | ||
2790 | 522 | |||
2791 | 523 | for (pos = 0; pos < n_fields; pos++) { | ||
2792 | 524 | field = dict_index_get_nth_field(index, pos); | ||
2793 | 525 | |||
2794 | 526 | if (col == field->col && field->prefix_len == 0) { | ||
2795 | 527 | |||
2796 | 528 | return(pos); | ||
2797 | 529 | } | ||
2798 | 530 | } | ||
2799 | 531 | |||
2800 | 532 | return(ULINT_UNDEFINED); | ||
2802 | 533 | } | 550 | } |
2803 | 534 | 551 | ||
2804 | 535 | #ifndef UNIV_HOTBACKUP | 552 | #ifndef UNIV_HOTBACKUP |
2805 | @@ -2062,7 +2079,6 @@ | |||
2806 | 2062 | { | 2079 | { |
2807 | 2063 | dict_index_t* new_index; | 2080 | dict_index_t* new_index; |
2808 | 2064 | dict_field_t* field; | 2081 | dict_field_t* field; |
2809 | 2065 | ulint fixed_size; | ||
2810 | 2066 | ulint trx_id_pos; | 2082 | ulint trx_id_pos; |
2811 | 2067 | ulint i; | 2083 | ulint i; |
2812 | 2068 | ibool* indexed; | 2084 | ibool* indexed; |
2813 | @@ -2139,7 +2155,7 @@ | |||
2814 | 2139 | 2155 | ||
2815 | 2140 | for (i = 0; i < trx_id_pos; i++) { | 2156 | for (i = 0; i < trx_id_pos; i++) { |
2816 | 2141 | 2157 | ||
2818 | 2142 | fixed_size = dict_col_get_fixed_size( | 2158 | ulint fixed_size = dict_col_get_fixed_size( |
2819 | 2143 | dict_index_get_nth_col(new_index, i), | 2159 | dict_index_get_nth_col(new_index, i), |
2820 | 2144 | dict_table_is_comp(table)); | 2160 | dict_table_is_comp(table)); |
2821 | 2145 | 2161 | ||
2822 | @@ -2156,7 +2172,20 @@ | |||
2823 | 2156 | break; | 2172 | break; |
2824 | 2157 | } | 2173 | } |
2825 | 2158 | 2174 | ||
2827 | 2159 | new_index->trx_id_offset += (unsigned int) fixed_size; | 2175 | /* Add fixed_size to new_index->trx_id_offset. |
2828 | 2176 | Because the latter is a bit-field, an overflow | ||
2829 | 2177 | can theoretically occur. Check for it. */ | ||
2830 | 2178 | fixed_size += new_index->trx_id_offset; | ||
2831 | 2179 | |||
2832 | 2180 | new_index->trx_id_offset = fixed_size; | ||
2833 | 2181 | |||
2834 | 2182 | if (new_index->trx_id_offset != fixed_size) { | ||
2835 | 2183 | /* Overflow. Pretend that this is a | ||
2836 | 2184 | variable-length PRIMARY KEY. */ | ||
2837 | 2185 | ut_ad(0); | ||
2838 | 2186 | new_index->trx_id_offset = 0; | ||
2839 | 2187 | break; | ||
2840 | 2188 | } | ||
2841 | 2160 | } | 2189 | } |
2842 | 2161 | 2190 | ||
2843 | 2162 | } | 2191 | } |
2844 | 2163 | 2192 | ||
2845 | === modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc' | |||
2846 | --- Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2013-01-10 04:35:31 +0000 | |||
2847 | +++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2013-01-10 04:35:33 +0000 | |||
2848 | @@ -12123,8 +12123,8 @@ | |||
2849 | 12123 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG | 12123 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG |
2850 | 12124 | static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, | 12124 | static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, |
2851 | 12125 | PLUGIN_VAR_RQCMDARG, | 12125 | PLUGIN_VAR_RQCMDARG, |
2854 | 12126 | "Debug flags for InnoDB change buffering (0=none)", | 12126 | "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)", |
2855 | 12127 | NULL, NULL, 0, 0, 1, 0); | 12127 | NULL, NULL, 0, 0, 2, 0); |
2856 | 12128 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ | 12128 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ |
2857 | 12129 | 12129 | ||
2858 | 12130 | static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, | 12130 | static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, |
2859 | 12131 | 12131 | ||
2860 | === modified file 'Percona-Server/storage/innodb_plugin/handler/handler0alter.cc' | |||
2861 | --- Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2012-08-20 03:14:02 +0000 | |||
2862 | +++ Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2013-01-10 04:35:33 +0000 | |||
2863 | @@ -108,13 +108,17 @@ | |||
2864 | 108 | /* These column types should never be shipped to MySQL. */ | 108 | /* These column types should never be shipped to MySQL. */ |
2865 | 109 | ut_ad(0); | 109 | ut_ad(0); |
2866 | 110 | 110 | ||
2867 | 111 | case DATA_CHAR: | ||
2868 | 112 | case DATA_FIXBINARY: | 111 | case DATA_FIXBINARY: |
2869 | 113 | case DATA_FLOAT: | 112 | case DATA_FLOAT: |
2870 | 114 | case DATA_DOUBLE: | 113 | case DATA_DOUBLE: |
2871 | 115 | case DATA_DECIMAL: | 114 | case DATA_DECIMAL: |
2872 | 116 | /* Above are the valid column types for MySQL data. */ | 115 | /* Above are the valid column types for MySQL data. */ |
2873 | 117 | ut_ad(flen == len); | 116 | ut_ad(flen == len); |
2874 | 117 | /* fall through */ | ||
2875 | 118 | case DATA_CHAR: | ||
2876 | 119 | /* We may have flen > len when there is a shorter | ||
2877 | 120 | prefix on a CHAR column. */ | ||
2878 | 121 | ut_ad(flen >= len); | ||
2879 | 118 | #else /* UNIV_DEBUG */ | 122 | #else /* UNIV_DEBUG */ |
2880 | 119 | default: | 123 | default: |
2881 | 120 | #endif /* UNIV_DEBUG */ | 124 | #endif /* UNIV_DEBUG */ |
2882 | @@ -147,7 +151,7 @@ | |||
2883 | 147 | 151 | ||
2884 | 148 | field->reset(); | 152 | field->reset(); |
2885 | 149 | 153 | ||
2887 | 150 | ipos = dict_index_get_nth_col_pos(index, i); | 154 | ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE); |
2888 | 151 | 155 | ||
2889 | 152 | if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) { | 156 | if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) { |
2890 | 153 | null_field: | 157 | null_field: |
2891 | 154 | 158 | ||
2892 | === modified file 'Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c' | |||
2893 | --- Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2013-01-10 04:35:31 +0000 | |||
2894 | +++ Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2013-01-10 04:35:33 +0000 | |||
2895 | @@ -3049,7 +3049,8 @@ | |||
2896 | 3049 | /* The records only differ in the delete-mark. | 3049 | /* The records only differ in the delete-mark. |
2897 | 3050 | Clear the delete-mark, like we did before | 3050 | Clear the delete-mark, like we did before |
2898 | 3051 | Bug #56680 was fixed. */ | 3051 | Bug #56680 was fixed. */ |
2900 | 3052 | btr_cur_del_unmark_for_ibuf(rec, page_zip, mtr); | 3052 | btr_cur_set_deleted_flag_for_ibuf( |
2901 | 3053 | rec, page_zip, FALSE, mtr); | ||
2902 | 3053 | updated_in_place: | 3054 | updated_in_place: |
2903 | 3054 | mem_heap_free(heap); | 3055 | mem_heap_free(heap); |
2904 | 3055 | return; | 3056 | return; |
2905 | @@ -3134,6 +3135,22 @@ | |||
2906 | 3134 | ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); | 3135 | ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); |
2907 | 3135 | ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); | 3136 | ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); |
2908 | 3136 | 3137 | ||
2909 | 3138 | #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG | ||
2910 | 3139 | if (ibuf_debug == 2) { | ||
2911 | 3140 | /* Inject a fault (crash). We do this before trying | ||
2912 | 3141 | optimistic delete, because a pessimistic delete in the | ||
2913 | 3142 | change buffer would require a larger test case. */ | ||
2914 | 3143 | |||
2915 | 3144 | /* Flag the buffered record as processed, to avoid | ||
2916 | 3145 | an assertion failure after crash recovery. */ | ||
2917 | 3146 | btr_cur_set_deleted_flag_for_ibuf( | ||
2918 | 3147 | btr_pcur_get_rec(pcur), NULL, TRUE, mtr); | ||
2919 | 3148 | mtr_commit(mtr); | ||
2920 | 3149 | log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE); | ||
2921 | 3150 | DBUG_SUICIDE(); | ||
2922 | 3151 | } | ||
2923 | 3152 | #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ | ||
2924 | 3153 | |||
2925 | 3137 | success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); | 3154 | success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); |
2926 | 3138 | 3155 | ||
2927 | 3139 | if (success) { | 3156 | if (success) { |
2928 | @@ -3152,7 +3169,13 @@ | |||
2929 | 3152 | ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); | 3169 | ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no); |
2930 | 3153 | ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); | 3170 | ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space); |
2931 | 3154 | 3171 | ||
2933 | 3155 | /* We have to resort to a pessimistic delete from ibuf */ | 3172 | /* We have to resort to a pessimistic delete from ibuf. |
2934 | 3173 | Delete-mark the record so that it will not be applied again, | ||
2935 | 3174 | in case the server crashes before the pessimistic delete is | ||
2936 | 3175 | made persistent. */ | ||
2937 | 3176 | btr_cur_set_deleted_flag_for_ibuf( | ||
2938 | 3177 | btr_pcur_get_rec(pcur), NULL, TRUE, mtr); | ||
2939 | 3178 | |||
2940 | 3156 | btr_pcur_store_position(pcur, mtr); | 3179 | btr_pcur_store_position(pcur, mtr); |
2941 | 3157 | 3180 | ||
2942 | 3158 | btr_pcur_commit_specify_mtr(pcur, mtr); | 3181 | btr_pcur_commit_specify_mtr(pcur, mtr); |
2943 | @@ -3461,7 +3484,7 @@ | |||
2944 | 3461 | fputs("InnoDB: Discarding record\n ", stderr); | 3484 | fputs("InnoDB: Discarding record\n ", stderr); |
2945 | 3462 | rec_print_old(stderr, rec); | 3485 | rec_print_old(stderr, rec); |
2946 | 3463 | fputs("\nInnoDB: from the insert buffer!\n\n", stderr); | 3486 | fputs("\nInnoDB: from the insert buffer!\n\n", stderr); |
2948 | 3464 | } else if (block) { | 3487 | } else if (block && !rec_get_deleted_flag(rec, 0)) { |
2949 | 3465 | /* Now we have at pcur a record which should be | 3488 | /* Now we have at pcur a record which should be |
2950 | 3466 | inserted to the index page; NOTE that the call below | 3489 | inserted to the index page; NOTE that the call below |
2951 | 3467 | copies pointers to fields in rec, and we must | 3490 | copies pointers to fields in rec, and we must |
2952 | 3468 | 3491 | ||
2953 | === modified file 'Percona-Server/storage/innodb_plugin/include/btr0cur.h' | |||
2954 | --- Percona-Server/storage/innodb_plugin/include/btr0cur.h 2012-10-16 11:18:45 +0000 | |||
2955 | +++ Percona-Server/storage/innodb_plugin/include/btr0cur.h 2013-01-10 04:35:33 +0000 | |||
2956 | @@ -358,19 +358,20 @@ | |||
2957 | 358 | ibool val, /*!< in: value to set */ | 358 | ibool val, /*!< in: value to set */ |
2958 | 359 | que_thr_t* thr, /*!< in: query thread */ | 359 | que_thr_t* thr, /*!< in: query thread */ |
2959 | 360 | mtr_t* mtr); /*!< in: mtr */ | 360 | mtr_t* mtr); /*!< in: mtr */ |
2962 | 361 | /***********************************************************//** | 361 | /*************************************************************** |
2963 | 362 | Clear a secondary index record's delete mark. This function is only | 362 | Sets a secondary index record delete mark. This function is only |
2964 | 363 | used by the insert buffer insert merge mechanism. */ | 363 | used by the insert buffer insert merge mechanism. */ |
2965 | 364 | UNIV_INTERN | 364 | UNIV_INTERN |
2966 | 365 | void | 365 | void |
2969 | 366 | btr_cur_del_unmark_for_ibuf( | 366 | btr_cur_set_deleted_flag_for_ibuf( |
2970 | 367 | /*========================*/ | 367 | /*==============================*/ |
2971 | 368 | rec_t* rec, /*!< in/out: record to delete unmark */ | 368 | rec_t* rec, /*!< in/out: record to delete unmark */ |
2972 | 369 | page_zip_des_t* page_zip, /*!< in/out: compressed page | 369 | page_zip_des_t* page_zip, /*!< in/out: compressed page |
2973 | 370 | corresponding to rec, or NULL | 370 | corresponding to rec, or NULL |
2974 | 371 | when the tablespace is | 371 | when the tablespace is |
2975 | 372 | uncompressed */ | 372 | uncompressed */ |
2977 | 373 | mtr_t* mtr); /*!< in: mtr */ | 373 | ibool val, /*!< in: value to set */ |
2978 | 374 | mtr_t* mtr); /*!< in/out: mini-transaction */ | ||
2979 | 374 | /*************************************************************//** | 375 | /*************************************************************//** |
2980 | 375 | Tries to compress a page of the tree if it seems useful. It is assumed | 376 | Tries to compress a page of the tree if it seems useful. It is assumed |
2981 | 376 | that mtr holds an x-latch on the tree and on the cursor page. To avoid | 377 | that mtr holds an x-latch on the tree and on the cursor page. To avoid |
2982 | 377 | 378 | ||
2983 | === modified file 'Percona-Server/storage/innodb_plugin/include/dict0dict.h' | |||
2984 | --- Percona-Server/storage/innodb_plugin/include/dict0dict.h 2012-05-09 04:14:12 +0000 | |||
2985 | +++ Percona-Server/storage/innodb_plugin/include/dict0dict.h 2013-01-10 04:35:33 +0000 | |||
2986 | @@ -839,6 +839,18 @@ | |||
2987 | 839 | const dict_index_t* index, /*!< in: index */ | 839 | const dict_index_t* index, /*!< in: index */ |
2988 | 840 | ulint n); /*!< in: column number */ | 840 | ulint n); /*!< in: column number */ |
2989 | 841 | /********************************************************************//** | 841 | /********************************************************************//** |
2990 | 842 | Looks for column n in an index. | ||
2991 | 843 | @return position in internal representation of the index; | ||
2992 | 844 | ULINT_UNDEFINED if not contained */ | ||
2993 | 845 | UNIV_INTERN | ||
2994 | 846 | ulint | ||
2995 | 847 | dict_index_get_nth_col_or_prefix_pos( | ||
2996 | 848 | /*=================================*/ | ||
2997 | 849 | const dict_index_t* index, /*!< in: index */ | ||
2998 | 850 | ulint n, /*!< in: column number */ | ||
2999 | 851 | ibool inc_prefix); /*!< in: TRUE=consider | ||
3000 | 852 | column prefixes too */ | ||
3001 | 853 | /********************************************************************//** | ||
3002 | 842 | Returns TRUE if the index contains a column or a prefix of that column. | 854 | Returns TRUE if the index contains a column or a prefix of that column. |
3003 | 843 | @return TRUE if contains the column or its prefix */ | 855 | @return TRUE if contains the column or its prefix */ |
3004 | 844 | UNIV_INTERN | 856 | UNIV_INTERN |
3005 | 845 | 857 | ||
3006 | === modified file 'Percona-Server/storage/innodb_plugin/include/dict0mem.h' | |||
3007 | --- Percona-Server/storage/innodb_plugin/include/dict0mem.h 2012-05-09 04:14:12 +0000 | |||
3008 | +++ Percona-Server/storage/innodb_plugin/include/dict0mem.h 2013-01-10 04:35:33 +0000 | |||
3009 | @@ -286,10 +286,15 @@ | |||
3010 | 286 | #endif /* !UNIV_HOTBACKUP */ | 286 | #endif /* !UNIV_HOTBACKUP */ |
3011 | 287 | unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, | 287 | unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, |
3012 | 288 | DICT_UNIVERSAL, DICT_IBUF) */ | 288 | DICT_UNIVERSAL, DICT_IBUF) */ |
3014 | 289 | unsigned trx_id_offset:10;/*!< position of the trx id column | 289 | #define MAX_KEY_LENGTH_BITS 12 |
3015 | 290 | unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; | ||
3016 | 291 | /*!< position of the trx id column | ||
3017 | 290 | in a clustered index record, if the fields | 292 | in a clustered index record, if the fields |
3018 | 291 | before it are known to be of a fixed size, | 293 | before it are known to be of a fixed size, |
3019 | 292 | 0 otherwise */ | 294 | 0 otherwise */ |
3020 | 295 | #if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH | ||
3021 | 296 | # error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH | ||
3022 | 297 | #endif | ||
3023 | 293 | unsigned n_user_defined_cols:10; | 298 | unsigned n_user_defined_cols:10; |
3024 | 294 | /*!< number of columns the user defined to | 299 | /*!< number of columns the user defined to |
3025 | 295 | be in the index: in the internal | 300 | be in the index: in the internal |
3026 | 296 | 301 | ||
3027 | === modified file 'Percona-Server/storage/innodb_plugin/include/page0zip.h' | |||
3028 | --- Percona-Server/storage/innodb_plugin/include/page0zip.h 2011-11-24 02:00:38 +0000 | |||
3029 | +++ Percona-Server/storage/innodb_plugin/include/page0zip.h 2013-01-10 04:35:33 +0000 | |||
3030 | @@ -156,9 +156,10 @@ | |||
3031 | 156 | /*==================*/ | 156 | /*==================*/ |
3032 | 157 | const page_zip_des_t* page_zip,/*!< in: compressed page */ | 157 | const page_zip_des_t* page_zip,/*!< in: compressed page */ |
3033 | 158 | const page_t* page, /*!< in: uncompressed page */ | 158 | const page_t* page, /*!< in: uncompressed page */ |
3034 | 159 | const dict_index_t* index, /*!< in: index of the page, if known */ | ||
3035 | 159 | ibool sloppy) /*!< in: FALSE=strict, | 160 | ibool sloppy) /*!< in: FALSE=strict, |
3036 | 160 | TRUE=ignore the MIN_REC_FLAG */ | 161 | TRUE=ignore the MIN_REC_FLAG */ |
3038 | 161 | __attribute__((nonnull)); | 162 | __attribute__((nonnull(1,2))); |
3039 | 162 | /**********************************************************************//** | 163 | /**********************************************************************//** |
3040 | 163 | Check that the compressed and decompressed pages match. */ | 164 | Check that the compressed and decompressed pages match. */ |
3041 | 164 | UNIV_INTERN | 165 | UNIV_INTERN |
3042 | @@ -166,8 +167,9 @@ | |||
3043 | 166 | page_zip_validate( | 167 | page_zip_validate( |
3044 | 167 | /*==============*/ | 168 | /*==============*/ |
3045 | 168 | const page_zip_des_t* page_zip,/*!< in: compressed page */ | 169 | const page_zip_des_t* page_zip,/*!< in: compressed page */ |
3048 | 169 | const page_t* page) /*!< in: uncompressed page */ | 170 | const page_t* page, /*!< in: uncompressed page */ |
3049 | 170 | __attribute__((nonnull)); | 171 | const dict_index_t* index) /*!< in: index of the page, if known */ |
3050 | 172 | __attribute__((nonnull(1,2))); | ||
3051 | 171 | #endif /* UNIV_ZIP_DEBUG */ | 173 | #endif /* UNIV_ZIP_DEBUG */ |
3052 | 172 | 174 | ||
3053 | 173 | /**********************************************************************//** | 175 | /**********************************************************************//** |
3054 | 174 | 176 | ||
3055 | === modified file 'Percona-Server/storage/innodb_plugin/include/row0undo.h' | |||
3056 | --- Percona-Server/storage/innodb_plugin/include/row0undo.h 2009-05-26 12:28:49 +0000 | |||
3057 | +++ Percona-Server/storage/innodb_plugin/include/row0undo.h 2013-01-10 04:35:33 +0000 | |||
3058 | @@ -87,10 +87,6 @@ | |||
3059 | 87 | enum undo_exec { | 87 | enum undo_exec { |
3060 | 88 | UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next | 88 | UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next |
3061 | 89 | undo log record */ | 89 | undo log record */ |
3062 | 90 | UNDO_NODE_PREV_VERS, /*!< the roll ptr to previous | ||
3063 | 91 | version of a row is stored in | ||
3064 | 92 | node, and undo should be done | ||
3065 | 93 | based on it */ | ||
3066 | 94 | UNDO_NODE_INSERT, /*!< undo a fresh insert of a | 90 | UNDO_NODE_INSERT, /*!< undo a fresh insert of a |
3067 | 95 | row to a table */ | 91 | row to a table */ |
3068 | 96 | UNDO_NODE_MODIFY /*!< undo a modify operation | 92 | UNDO_NODE_MODIFY /*!< undo a modify operation |
3069 | @@ -108,9 +104,6 @@ | |||
3070 | 108 | undo_no_t undo_no;/*!< undo number of the record */ | 104 | undo_no_t undo_no;/*!< undo number of the record */ |
3071 | 109 | ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC, | 105 | ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC, |
3072 | 110 | ... */ | 106 | ... */ |
3073 | 111 | roll_ptr_t new_roll_ptr; | ||
3074 | 112 | /*!< roll ptr to restore to clustered index | ||
3075 | 113 | record */ | ||
3076 | 114 | trx_id_t new_trx_id; /*!< trx id to restore to clustered index | 107 | trx_id_t new_trx_id; /*!< trx id to restore to clustered index |
3077 | 115 | record */ | 108 | record */ |
3078 | 116 | btr_pcur_t pcur; /*!< persistent cursor used in searching the | 109 | btr_pcur_t pcur; /*!< persistent cursor used in searching the |
3079 | 117 | 110 | ||
3080 | === modified file 'Percona-Server/storage/innodb_plugin/log/log0recv.c' | |||
3081 | --- Percona-Server/storage/innodb_plugin/log/log0recv.c 2012-06-14 09:16:03 +0000 | |||
3082 | +++ Percona-Server/storage/innodb_plugin/log/log0recv.c 2013-01-10 04:35:33 +0000 | |||
3083 | @@ -1687,9 +1687,8 @@ | |||
3084 | 1687 | if (fil_page_get_type(page) == FIL_PAGE_INDEX) { | 1687 | if (fil_page_get_type(page) == FIL_PAGE_INDEX) { |
3085 | 1688 | page_zip_des_t* page_zip = buf_block_get_page_zip(block); | 1688 | page_zip_des_t* page_zip = buf_block_get_page_zip(block); |
3086 | 1689 | 1689 | ||
3090 | 1690 | if (page_zip) { | 1690 | ut_a(!page_zip |
3091 | 1691 | ut_a(page_zip_validate_low(page_zip, page, FALSE)); | 1691 | || page_zip_validate_low(page_zip, page, NULL, FALSE)); |
3089 | 1692 | } | ||
3092 | 1693 | } | 1692 | } |
3093 | 1694 | #endif /* UNIV_ZIP_DEBUG */ | 1693 | #endif /* UNIV_ZIP_DEBUG */ |
3094 | 1695 | 1694 | ||
3095 | 1696 | 1695 | ||
3096 | === modified file 'Percona-Server/storage/innodb_plugin/os/os0file.c' | |||
3097 | --- Percona-Server/storage/innodb_plugin/os/os0file.c 2013-01-04 07:28:01 +0000 | |||
3098 | +++ Percona-Server/storage/innodb_plugin/os/os0file.c 2013-01-10 04:35:33 +0000 | |||
3099 | @@ -1296,6 +1296,14 @@ | |||
3100 | 1296 | DWORD create_flag; | 1296 | DWORD create_flag; |
3101 | 1297 | DWORD attributes; | 1297 | DWORD attributes; |
3102 | 1298 | ibool retry; | 1298 | ibool retry; |
3103 | 1299 | |||
3104 | 1300 | DBUG_EXECUTE_IF( | ||
3105 | 1301 | "ib_create_table_fail_disk_full", | ||
3106 | 1302 | *success = FALSE; | ||
3107 | 1303 | SetLastError(ERROR_DISK_FULL); | ||
3108 | 1304 | return((os_file_t) -1); | ||
3109 | 1305 | ); | ||
3110 | 1306 | |||
3111 | 1299 | try_again: | 1307 | try_again: |
3112 | 1300 | ut_a(name); | 1308 | ut_a(name); |
3113 | 1301 | 1309 | ||
3114 | @@ -1411,6 +1419,13 @@ | |||
3115 | 1411 | ibool retry; | 1419 | ibool retry; |
3116 | 1412 | const char* mode_str = NULL; | 1420 | const char* mode_str = NULL; |
3117 | 1413 | 1421 | ||
3118 | 1422 | DBUG_EXECUTE_IF( | ||
3119 | 1423 | "ib_create_table_fail_disk_full", | ||
3120 | 1424 | *success = FALSE; | ||
3121 | 1425 | errno = ENOSPC; | ||
3122 | 1426 | return((os_file_t) -1); | ||
3123 | 1427 | ); | ||
3124 | 1428 | |||
3125 | 1414 | try_again: | 1429 | try_again: |
3126 | 1415 | ut_a(name); | 1430 | ut_a(name); |
3127 | 1416 | 1431 | ||
3128 | 1417 | 1432 | ||
3129 | === modified file 'Percona-Server/storage/innodb_plugin/page/page0cur.c' | |||
3130 | --- Percona-Server/storage/innodb_plugin/page/page0cur.c 2013-01-10 04:35:31 +0000 | |||
3131 | +++ Percona-Server/storage/innodb_plugin/page/page0cur.c 2013-01-10 04:35:33 +0000 | |||
3132 | @@ -310,7 +310,7 @@ | |||
3133 | 310 | #endif /* UNIV_DEBUG */ | 310 | #endif /* UNIV_DEBUG */ |
3134 | 311 | page = buf_block_get_frame(block); | 311 | page = buf_block_get_frame(block); |
3135 | 312 | #ifdef UNIV_ZIP_DEBUG | 312 | #ifdef UNIV_ZIP_DEBUG |
3137 | 313 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 313 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
3138 | 314 | #endif /* UNIV_ZIP_DEBUG */ | 314 | #endif /* UNIV_ZIP_DEBUG */ |
3139 | 315 | 315 | ||
3140 | 316 | page_check_dir(page); | 316 | page_check_dir(page); |
3141 | @@ -1248,7 +1248,7 @@ | |||
3142 | 1248 | 1248 | ||
3143 | 1249 | ut_ad(!page_rec_is_supremum(*current_rec)); | 1249 | ut_ad(!page_rec_is_supremum(*current_rec)); |
3144 | 1250 | #ifdef UNIV_ZIP_DEBUG | 1250 | #ifdef UNIV_ZIP_DEBUG |
3146 | 1251 | ut_a(page_zip_validate(page_zip, page)); | 1251 | ut_a(page_zip_validate(page_zip, page, index)); |
3147 | 1252 | #endif /* UNIV_ZIP_DEBUG */ | 1252 | #endif /* UNIV_ZIP_DEBUG */ |
3148 | 1253 | 1253 | ||
3149 | 1254 | /* 1. Get the size of the physical record in the page */ | 1254 | /* 1. Get the size of the physical record in the page */ |
3150 | @@ -1973,7 +1973,7 @@ | |||
3151 | 1973 | } | 1973 | } |
3152 | 1974 | 1974 | ||
3153 | 1975 | #ifdef UNIV_ZIP_DEBUG | 1975 | #ifdef UNIV_ZIP_DEBUG |
3155 | 1976 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 1976 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
3156 | 1977 | #endif /* UNIV_ZIP_DEBUG */ | 1977 | #endif /* UNIV_ZIP_DEBUG */ |
3157 | 1978 | } | 1978 | } |
3158 | 1979 | 1979 | ||
3159 | 1980 | 1980 | ||
3160 | === modified file 'Percona-Server/storage/innodb_plugin/page/page0page.c' | |||
3161 | --- Percona-Server/storage/innodb_plugin/page/page0page.c 2013-01-10 04:35:31 +0000 | |||
3162 | +++ Percona-Server/storage/innodb_plugin/page/page0page.c 2013-01-10 04:35:33 +0000 | |||
3163 | @@ -625,7 +625,7 @@ | |||
3164 | 625 | Furthermore, btr_compress() may set FIL_PAGE_PREV to | 625 | Furthermore, btr_compress() may set FIL_PAGE_PREV to |
3165 | 626 | FIL_NULL on new_page while leaving it intact on | 626 | FIL_NULL on new_page while leaving it intact on |
3166 | 627 | new_page_zip. So, we cannot validate new_page_zip. */ | 627 | new_page_zip. So, we cannot validate new_page_zip. */ |
3168 | 628 | ut_a(page_zip_validate_low(page_zip, page, TRUE)); | 628 | ut_a(page_zip_validate_low(page_zip, page, index, TRUE)); |
3169 | 629 | } | 629 | } |
3170 | 630 | #endif /* UNIV_ZIP_DEBUG */ | 630 | #endif /* UNIV_ZIP_DEBUG */ |
3171 | 631 | ut_ad(buf_block_get_frame(block) == page); | 631 | ut_ad(buf_block_get_frame(block) == page); |
3172 | @@ -945,7 +945,7 @@ | |||
3173 | 945 | ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE); | 945 | ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE); |
3174 | 946 | ut_ad(!page_zip || page_rec_is_comp(rec)); | 946 | ut_ad(!page_zip || page_rec_is_comp(rec)); |
3175 | 947 | #ifdef UNIV_ZIP_DEBUG | 947 | #ifdef UNIV_ZIP_DEBUG |
3177 | 948 | ut_a(!page_zip || page_zip_validate(page_zip, page)); | 948 | ut_a(!page_zip || page_zip_validate(page_zip, page, index)); |
3178 | 949 | #endif /* UNIV_ZIP_DEBUG */ | 949 | #endif /* UNIV_ZIP_DEBUG */ |
3179 | 950 | 950 | ||
3180 | 951 | if (page_rec_is_infimum(rec)) { | 951 | if (page_rec_is_infimum(rec)) { |
3181 | @@ -987,7 +987,7 @@ | |||
3182 | 987 | ULINT_UNDEFINED, &heap); | 987 | ULINT_UNDEFINED, &heap); |
3183 | 988 | rec = rec_get_next_ptr(rec, TRUE); | 988 | rec = rec_get_next_ptr(rec, TRUE); |
3184 | 989 | #ifdef UNIV_ZIP_DEBUG | 989 | #ifdef UNIV_ZIP_DEBUG |
3186 | 990 | ut_a(page_zip_validate(page_zip, page)); | 990 | ut_a(page_zip_validate(page_zip, page, index)); |
3187 | 991 | #endif /* UNIV_ZIP_DEBUG */ | 991 | #endif /* UNIV_ZIP_DEBUG */ |
3188 | 992 | page_cur_delete_rec(&cur, index, offsets, mtr); | 992 | page_cur_delete_rec(&cur, index, offsets, mtr); |
3189 | 993 | } while (page_offset(rec) != PAGE_NEW_SUPREMUM); | 993 | } while (page_offset(rec) != PAGE_NEW_SUPREMUM); |
3190 | @@ -1127,7 +1127,8 @@ | |||
3191 | 1127 | between btr_attach_half_pages() and insert_page = ... | 1127 | between btr_attach_half_pages() and insert_page = ... |
3192 | 1128 | when btr_page_get_split_rec_to_left() holds | 1128 | when btr_page_get_split_rec_to_left() holds |
3193 | 1129 | (direction == FSP_DOWN). */ | 1129 | (direction == FSP_DOWN). */ |
3195 | 1130 | ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE)); | 1130 | ut_a(!page_zip |
3196 | 1131 | || page_zip_validate_low(page_zip, page, index, TRUE)); | ||
3197 | 1131 | } | 1132 | } |
3198 | 1132 | #endif /* UNIV_ZIP_DEBUG */ | 1133 | #endif /* UNIV_ZIP_DEBUG */ |
3199 | 1133 | 1134 | ||
3200 | @@ -1198,9 +1199,10 @@ | |||
3201 | 1198 | = buf_block_get_page_zip(block); | 1199 | = buf_block_get_page_zip(block); |
3202 | 1199 | ut_a(!new_page_zip == !page_zip); | 1200 | ut_a(!new_page_zip == !page_zip); |
3203 | 1200 | ut_a(!new_page_zip | 1201 | ut_a(!new_page_zip |
3205 | 1201 | || page_zip_validate(new_page_zip, new_page)); | 1202 | || page_zip_validate(new_page_zip, new_page, index)); |
3206 | 1202 | ut_a(!page_zip | 1203 | ut_a(!page_zip |
3208 | 1203 | || page_zip_validate(page_zip, page_align(split_rec))); | 1204 | || page_zip_validate(page_zip, page_align(split_rec), |
3209 | 1205 | index)); | ||
3210 | 1204 | } | 1206 | } |
3211 | 1205 | #endif /* UNIV_ZIP_DEBUG */ | 1207 | #endif /* UNIV_ZIP_DEBUG */ |
3212 | 1206 | 1208 | ||
3213 | 1207 | 1209 | ||
3214 | === modified file 'Percona-Server/storage/innodb_plugin/page/page0zip.c' | |||
3215 | --- Percona-Server/storage/innodb_plugin/page/page0zip.c 2011-11-24 02:00:43 +0000 | |||
3216 | +++ Percona-Server/storage/innodb_plugin/page/page0zip.c 2013-01-10 04:35:33 +0000 | |||
3217 | @@ -1437,7 +1437,7 @@ | |||
3218 | 1437 | page_zip_get_size(page_zip) - PAGE_DATA); | 1437 | page_zip_get_size(page_zip) - PAGE_DATA); |
3219 | 1438 | mem_heap_free(heap); | 1438 | mem_heap_free(heap); |
3220 | 1439 | #ifdef UNIV_ZIP_DEBUG | 1439 | #ifdef UNIV_ZIP_DEBUG |
3222 | 1440 | ut_a(page_zip_validate(page_zip, page)); | 1440 | ut_a(page_zip_validate(page_zip, page, index)); |
3223 | 1441 | #endif /* UNIV_ZIP_DEBUG */ | 1441 | #endif /* UNIV_ZIP_DEBUG */ |
3224 | 1442 | 1442 | ||
3225 | 1443 | if (mtr) { | 1443 | if (mtr) { |
3226 | @@ -3123,6 +3123,7 @@ | |||
3227 | 3123 | /*==================*/ | 3123 | /*==================*/ |
3228 | 3124 | const page_zip_des_t* page_zip,/*!< in: compressed page */ | 3124 | const page_zip_des_t* page_zip,/*!< in: compressed page */ |
3229 | 3125 | const page_t* page, /*!< in: uncompressed page */ | 3125 | const page_t* page, /*!< in: uncompressed page */ |
3230 | 3126 | const dict_index_t* index, /*!< in: index of the page, if known */ | ||
3231 | 3126 | ibool sloppy) /*!< in: FALSE=strict, | 3127 | ibool sloppy) /*!< in: FALSE=strict, |
3232 | 3127 | TRUE=ignore the MIN_REC_FLAG */ | 3128 | TRUE=ignore the MIN_REC_FLAG */ |
3233 | 3128 | { | 3129 | { |
3234 | @@ -3210,39 +3211,102 @@ | |||
3235 | 3210 | committed. Let us tolerate that difference when we | 3211 | committed. Let us tolerate that difference when we |
3236 | 3211 | are performing a sloppy validation. */ | 3212 | are performing a sloppy validation. */ |
3237 | 3212 | 3213 | ||
3266 | 3213 | if (sloppy) { | 3214 | ulint* offsets; |
3267 | 3214 | byte info_bits_diff; | 3215 | mem_heap_t* heap; |
3268 | 3215 | ulint offset | 3216 | const rec_t* rec; |
3269 | 3216 | = rec_get_next_offs(page + PAGE_NEW_INFIMUM, | 3217 | const rec_t* trec; |
3270 | 3217 | TRUE); | 3218 | byte info_bits_diff; |
3271 | 3218 | ut_a(offset >= PAGE_NEW_SUPREMUM); | 3219 | ulint offset |
3272 | 3219 | offset -= 5 /* REC_NEW_INFO_BITS */; | 3220 | = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE); |
3273 | 3220 | 3221 | ut_a(offset >= PAGE_NEW_SUPREMUM); | |
3274 | 3221 | info_bits_diff = page[offset] ^ temp_page[offset]; | 3222 | offset -= 5/*REC_NEW_INFO_BITS*/; |
3275 | 3222 | 3223 | ||
3276 | 3223 | if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { | 3224 | info_bits_diff = page[offset] ^ temp_page[offset]; |
3277 | 3224 | temp_page[offset] = page[offset]; | 3225 | |
3278 | 3225 | 3226 | if (info_bits_diff == REC_INFO_MIN_REC_FLAG) { | |
3279 | 3226 | if (!memcmp(page + PAGE_HEADER, | 3227 | temp_page[offset] = page[offset]; |
3280 | 3227 | temp_page + PAGE_HEADER, | 3228 | |
3281 | 3228 | UNIV_PAGE_SIZE - PAGE_HEADER | 3229 | if (!memcmp(page + PAGE_HEADER, |
3282 | 3229 | - FIL_PAGE_DATA_END)) { | 3230 | temp_page + PAGE_HEADER, |
3283 | 3230 | 3231 | UNIV_PAGE_SIZE - PAGE_HEADER | |
3284 | 3231 | /* Only the minimum record flag | 3232 | - FIL_PAGE_DATA_END)) { |
3285 | 3232 | differed. Let us ignore it. */ | 3233 | |
3286 | 3233 | page_zip_fail(("page_zip_validate: " | 3234 | /* Only the minimum record flag |
3287 | 3234 | "min_rec_flag " | 3235 | differed. Let us ignore it. */ |
3288 | 3235 | "(ignored, " | 3236 | page_zip_fail(("page_zip_validate: " |
3289 | 3236 | "%lu,%lu,0x%02lx)\n", | 3237 | "min_rec_flag " |
3290 | 3237 | page_get_space_id(page), | 3238 | "(%s" |
3291 | 3238 | page_get_page_no(page), | 3239 | "%lu,%lu,0x%02lx)\n", |
3292 | 3239 | (ulong) page[offset])); | 3240 | sloppy ? "ignored, " : "", |
3293 | 3240 | goto func_exit; | 3241 | page_get_space_id(page), |
3294 | 3242 | page_get_page_no(page), | ||
3295 | 3243 | (ulong) page[offset])); | ||
3296 | 3244 | valid = sloppy; | ||
3297 | 3245 | goto func_exit; | ||
3298 | 3246 | } | ||
3299 | 3247 | } | ||
3300 | 3248 | |||
3301 | 3249 | /* Compare the pointers in the PAGE_FREE list. */ | ||
3302 | 3250 | rec = page_header_get_ptr(page, PAGE_FREE); | ||
3303 | 3251 | trec = page_header_get_ptr(temp_page, PAGE_FREE); | ||
3304 | 3252 | |||
3305 | 3253 | while (rec || trec) { | ||
3306 | 3254 | if (page_offset(rec) != page_offset(trec)) { | ||
3307 | 3255 | page_zip_fail(("page_zip_validate: " | ||
3308 | 3256 | "PAGE_FREE list: %u!=%u\n", | ||
3309 | 3257 | (unsigned) page_offset(rec), | ||
3310 | 3258 | (unsigned) page_offset(trec))); | ||
3311 | 3259 | valid = FALSE; | ||
3312 | 3260 | goto func_exit; | ||
3313 | 3261 | } | ||
3314 | 3262 | |||
3315 | 3263 | rec = page_rec_get_next_low(rec, TRUE); | ||
3316 | 3264 | trec = page_rec_get_next_low(trec, TRUE); | ||
3317 | 3265 | } | ||
3318 | 3266 | |||
3319 | 3267 | /* Compare the records. */ | ||
3320 | 3268 | heap = NULL; | ||
3321 | 3269 | offsets = NULL; | ||
3322 | 3270 | rec = page_rec_get_next_low( | ||
3323 | 3271 | page + PAGE_NEW_INFIMUM, TRUE); | ||
3324 | 3272 | trec = page_rec_get_next_low( | ||
3325 | 3273 | temp_page + PAGE_NEW_INFIMUM, TRUE); | ||
3326 | 3274 | |||
3327 | 3275 | do { | ||
3328 | 3276 | if (page_offset(rec) != page_offset(trec)) { | ||
3329 | 3277 | page_zip_fail(("page_zip_validate: " | ||
3330 | 3278 | "record list: 0x%02x!=0x%02x\n", | ||
3331 | 3279 | (unsigned) page_offset(rec), | ||
3332 | 3280 | (unsigned) page_offset(trec))); | ||
3333 | 3281 | valid = FALSE; | ||
3334 | 3282 | break; | ||
3335 | 3283 | } | ||
3336 | 3284 | |||
3337 | 3285 | if (index) { | ||
3338 | 3286 | /* Compare the data. */ | ||
3339 | 3287 | offsets = rec_get_offsets( | ||
3340 | 3288 | rec, index, offsets, | ||
3341 | 3289 | ULINT_UNDEFINED, &heap); | ||
3342 | 3290 | |||
3343 | 3291 | if (memcmp(rec - rec_offs_extra_size(offsets), | ||
3344 | 3292 | trec - rec_offs_extra_size(offsets), | ||
3345 | 3293 | rec_offs_size(offsets))) { | ||
3346 | 3294 | page_zip_fail( | ||
3347 | 3295 | ("page_zip_validate: " | ||
3348 | 3296 | "record content: 0x%02x", | ||
3349 | 3297 | (unsigned) page_offset(rec))); | ||
3350 | 3298 | valid = FALSE; | ||
3351 | 3299 | break; | ||
3352 | 3241 | } | 3300 | } |
3353 | 3242 | } | 3301 | } |
3354 | 3302 | |||
3355 | 3303 | rec = page_rec_get_next_low(rec, TRUE); | ||
3356 | 3304 | trec = page_rec_get_next_low(trec, TRUE); | ||
3357 | 3305 | } while (rec || trec); | ||
3358 | 3306 | |||
3359 | 3307 | if (heap) { | ||
3360 | 3308 | mem_heap_free(heap); | ||
3361 | 3243 | } | 3309 | } |
3362 | 3244 | page_zip_fail(("page_zip_validate: content\n")); | ||
3363 | 3245 | valid = FALSE; | ||
3364 | 3246 | } | 3310 | } |
3365 | 3247 | 3311 | ||
3366 | 3248 | func_exit: | 3312 | func_exit: |
3367 | @@ -3264,9 +3328,10 @@ | |||
3368 | 3264 | page_zip_validate( | 3328 | page_zip_validate( |
3369 | 3265 | /*==============*/ | 3329 | /*==============*/ |
3370 | 3266 | const page_zip_des_t* page_zip,/*!< in: compressed page */ | 3330 | const page_zip_des_t* page_zip,/*!< in: compressed page */ |
3372 | 3267 | const page_t* page) /*!< in: uncompressed page */ | 3331 | const page_t* page, /*!< in: uncompressed page */ |
3373 | 3332 | const dict_index_t* index) /*!< in: index of the page, if known */ | ||
3374 | 3268 | { | 3333 | { |
3376 | 3269 | return(page_zip_validate_low(page_zip, page, | 3334 | return(page_zip_validate_low(page_zip, page, index, |
3377 | 3270 | recv_recovery_is_on())); | 3335 | recv_recovery_is_on())); |
3378 | 3271 | } | 3336 | } |
3379 | 3272 | #endif /* UNIV_ZIP_DEBUG */ | 3337 | #endif /* UNIV_ZIP_DEBUG */ |
3380 | @@ -3597,7 +3662,7 @@ | |||
3381 | 3597 | page_zip->m_nonempty = TRUE; | 3662 | page_zip->m_nonempty = TRUE; |
3382 | 3598 | 3663 | ||
3383 | 3599 | #ifdef UNIV_ZIP_DEBUG | 3664 | #ifdef UNIV_ZIP_DEBUG |
3385 | 3600 | ut_a(page_zip_validate(page_zip, page_align(rec))); | 3665 | ut_a(page_zip_validate(page_zip, page_align(rec), index)); |
3386 | 3601 | #endif /* UNIV_ZIP_DEBUG */ | 3666 | #endif /* UNIV_ZIP_DEBUG */ |
3387 | 3602 | } | 3667 | } |
3388 | 3603 | 3668 | ||
3389 | @@ -3644,7 +3709,7 @@ | |||
3390 | 3644 | } | 3709 | } |
3391 | 3645 | 3710 | ||
3392 | 3646 | #ifdef UNIV_ZIP_DEBUG | 3711 | #ifdef UNIV_ZIP_DEBUG |
3394 | 3647 | ut_a(page_zip_validate(page_zip, page)); | 3712 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3395 | 3648 | #endif /* UNIV_ZIP_DEBUG */ | 3713 | #endif /* UNIV_ZIP_DEBUG */ |
3396 | 3649 | 3714 | ||
3397 | 3650 | memcpy(page + offset, | 3715 | memcpy(page + offset, |
3398 | @@ -3653,7 +3718,7 @@ | |||
3399 | 3653 | ptr + 4, BTR_EXTERN_FIELD_REF_SIZE); | 3718 | ptr + 4, BTR_EXTERN_FIELD_REF_SIZE); |
3400 | 3654 | 3719 | ||
3401 | 3655 | #ifdef UNIV_ZIP_DEBUG | 3720 | #ifdef UNIV_ZIP_DEBUG |
3403 | 3656 | ut_a(page_zip_validate(page_zip, page)); | 3721 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3404 | 3657 | #endif /* UNIV_ZIP_DEBUG */ | 3722 | #endif /* UNIV_ZIP_DEBUG */ |
3405 | 3658 | } | 3723 | } |
3406 | 3659 | 3724 | ||
3407 | @@ -3720,7 +3785,7 @@ | |||
3408 | 3720 | memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE); | 3785 | memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE); |
3409 | 3721 | 3786 | ||
3410 | 3722 | #ifdef UNIV_ZIP_DEBUG | 3787 | #ifdef UNIV_ZIP_DEBUG |
3412 | 3723 | ut_a(page_zip_validate(page_zip, page)); | 3788 | ut_a(page_zip_validate(page_zip, page, index)); |
3413 | 3724 | #endif /* UNIV_ZIP_DEBUG */ | 3789 | #endif /* UNIV_ZIP_DEBUG */ |
3414 | 3725 | 3790 | ||
3415 | 3726 | if (mtr) { | 3791 | if (mtr) { |
3416 | @@ -3791,7 +3856,7 @@ | |||
3417 | 3791 | } | 3856 | } |
3418 | 3792 | 3857 | ||
3419 | 3793 | #ifdef UNIV_ZIP_DEBUG | 3858 | #ifdef UNIV_ZIP_DEBUG |
3421 | 3794 | ut_a(page_zip_validate(page_zip, page)); | 3859 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3422 | 3795 | #endif /* UNIV_ZIP_DEBUG */ | 3860 | #endif /* UNIV_ZIP_DEBUG */ |
3423 | 3796 | 3861 | ||
3424 | 3797 | field = page + offset; | 3862 | field = page + offset; |
3425 | @@ -3812,7 +3877,7 @@ | |||
3426 | 3812 | memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE); | 3877 | memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE); |
3427 | 3813 | 3878 | ||
3428 | 3814 | #ifdef UNIV_ZIP_DEBUG | 3879 | #ifdef UNIV_ZIP_DEBUG |
3430 | 3815 | ut_a(page_zip_validate(page_zip, page)); | 3880 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3431 | 3816 | #endif /* UNIV_ZIP_DEBUG */ | 3881 | #endif /* UNIV_ZIP_DEBUG */ |
3432 | 3817 | } | 3882 | } |
3433 | 3818 | 3883 | ||
3434 | @@ -4039,7 +4104,7 @@ | |||
3435 | 4039 | } | 4104 | } |
3436 | 4040 | 4105 | ||
3437 | 4041 | #ifdef UNIV_ZIP_DEBUG | 4106 | #ifdef UNIV_ZIP_DEBUG |
3439 | 4042 | ut_a(page_zip_validate(page_zip, page)); | 4107 | ut_a(page_zip_validate(page_zip, page, index)); |
3440 | 4043 | #endif /* UNIV_ZIP_DEBUG */ | 4108 | #endif /* UNIV_ZIP_DEBUG */ |
3441 | 4044 | } | 4109 | } |
3442 | 4045 | 4110 | ||
3443 | @@ -4063,7 +4128,7 @@ | |||
3444 | 4063 | *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8); | 4128 | *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8); |
3445 | 4064 | } | 4129 | } |
3446 | 4065 | #ifdef UNIV_ZIP_DEBUG | 4130 | #ifdef UNIV_ZIP_DEBUG |
3448 | 4066 | ut_a(page_zip_validate(page_zip, page_align(rec))); | 4131 | ut_a(page_zip_validate(page_zip, page_align(rec), NULL)); |
3449 | 4067 | #endif /* UNIV_ZIP_DEBUG */ | 4132 | #endif /* UNIV_ZIP_DEBUG */ |
3450 | 4068 | } | 4133 | } |
3451 | 4069 | 4134 | ||
3452 | @@ -4364,14 +4429,14 @@ | |||
3453 | 4364 | goto corrupt; | 4429 | goto corrupt; |
3454 | 4365 | } | 4430 | } |
3455 | 4366 | #ifdef UNIV_ZIP_DEBUG | 4431 | #ifdef UNIV_ZIP_DEBUG |
3457 | 4367 | ut_a(page_zip_validate(page_zip, page)); | 4432 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3458 | 4368 | #endif /* UNIV_ZIP_DEBUG */ | 4433 | #endif /* UNIV_ZIP_DEBUG */ |
3459 | 4369 | 4434 | ||
3460 | 4370 | memcpy(page + offset, ptr, len); | 4435 | memcpy(page + offset, ptr, len); |
3461 | 4371 | memcpy(page_zip->data + offset, ptr, len); | 4436 | memcpy(page_zip->data + offset, ptr, len); |
3462 | 4372 | 4437 | ||
3463 | 4373 | #ifdef UNIV_ZIP_DEBUG | 4438 | #ifdef UNIV_ZIP_DEBUG |
3465 | 4374 | ut_a(page_zip_validate(page_zip, page)); | 4439 | ut_a(page_zip_validate(page_zip, page, NULL)); |
3466 | 4375 | #endif /* UNIV_ZIP_DEBUG */ | 4440 | #endif /* UNIV_ZIP_DEBUG */ |
3467 | 4376 | } | 4441 | } |
3468 | 4377 | 4442 | ||
3469 | @@ -4446,7 +4511,7 @@ | |||
3470 | 4446 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); | 4511 | ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); |
3471 | 4447 | ut_ad(page_is_comp(page)); | 4512 | ut_ad(page_is_comp(page)); |
3472 | 4448 | ut_ad(!dict_index_is_ibuf(index)); | 4513 | ut_ad(!dict_index_is_ibuf(index)); |
3474 | 4449 | /* Note that page_zip_validate(page_zip, page) may fail here. */ | 4514 | /* Note that page_zip_validate(page_zip, page, index) may fail here. */ |
3475 | 4450 | UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); | 4515 | UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); |
3476 | 4451 | UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); | 4516 | UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); |
3477 | 4452 | 4517 | ||
3478 | @@ -4533,7 +4598,7 @@ | |||
3479 | 4533 | FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag | 4598 | FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag |
3480 | 4534 | mismatch. A strict page_zip_validate() will be executed later | 4599 | mismatch. A strict page_zip_validate() will be executed later |
3481 | 4535 | during the B-tree operations. */ | 4600 | during the B-tree operations. */ |
3483 | 4536 | ut_a(page_zip_validate_low(src_zip, src, TRUE)); | 4601 | ut_a(page_zip_validate_low(src_zip, src, index, TRUE)); |
3484 | 4537 | #endif /* UNIV_ZIP_DEBUG */ | 4602 | #endif /* UNIV_ZIP_DEBUG */ |
3485 | 4538 | ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); | 4603 | ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip)); |
3486 | 4539 | if (UNIV_UNLIKELY(src_zip->n_blobs)) { | 4604 | if (UNIV_UNLIKELY(src_zip->n_blobs)) { |
3487 | @@ -4594,7 +4659,7 @@ | |||
3488 | 4594 | } | 4659 | } |
3489 | 4595 | 4660 | ||
3490 | 4596 | #ifdef UNIV_ZIP_DEBUG | 4661 | #ifdef UNIV_ZIP_DEBUG |
3492 | 4597 | ut_a(page_zip_validate(page_zip, page)); | 4662 | ut_a(page_zip_validate(page_zip, page, index)); |
3493 | 4598 | #endif /* UNIV_ZIP_DEBUG */ | 4663 | #endif /* UNIV_ZIP_DEBUG */ |
3494 | 4599 | btr_blob_dbg_add(page, index, "page_zip_copy_recs"); | 4664 | btr_blob_dbg_add(page, index, "page_zip_copy_recs"); |
3495 | 4600 | 4665 | ||
3496 | 4601 | 4666 | ||
3497 | === modified file 'Percona-Server/storage/innodb_plugin/row/row0mysql.c' | |||
3498 | --- Percona-Server/storage/innodb_plugin/row/row0mysql.c 2012-10-17 11:00:21 +0000 | |||
3499 | +++ Percona-Server/storage/innodb_plugin/row/row0mysql.c 2013-01-10 04:35:33 +0000 | |||
3500 | @@ -1792,7 +1792,8 @@ | |||
3501 | 1792 | one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", | 1792 | one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", |
3502 | 1793 | "innodb_table_monitor", then this will also start the printing of monitor | 1793 | "innodb_table_monitor", then this will also start the printing of monitor |
3503 | 1794 | output by the master thread. If the table name ends in "innodb_mem_validate", | 1794 | output by the master thread. If the table name ends in "innodb_mem_validate", |
3505 | 1795 | InnoDB will try to invoke mem_validate(). | 1795 | InnoDB will try to invoke mem_validate(). On failure the transaction will |
3506 | 1796 | be rolled back and the 'table' object will be freed. | ||
3507 | 1796 | @return error code or DB_SUCCESS */ | 1797 | @return error code or DB_SUCCESS */ |
3508 | 1797 | UNIV_INTERN | 1798 | UNIV_INTERN |
3509 | 1798 | int | 1799 | int |
3510 | @@ -1931,6 +1932,8 @@ | |||
3511 | 1931 | 1932 | ||
3512 | 1932 | row_drop_table_for_mysql(table->name, trx, FALSE); | 1933 | row_drop_table_for_mysql(table->name, trx, FALSE); |
3513 | 1933 | trx_commit_for_mysql(trx); | 1934 | trx_commit_for_mysql(trx); |
3514 | 1935 | } else { | ||
3515 | 1936 | dict_mem_table_free(table); | ||
3516 | 1934 | } | 1937 | } |
3517 | 1935 | break; | 1938 | break; |
3518 | 1936 | 1939 | ||
3519 | 1937 | 1940 | ||
3520 | === modified file 'Percona-Server/storage/innodb_plugin/row/row0sel.c' | |||
3521 | --- Percona-Server/storage/innodb_plugin/row/row0sel.c 2012-04-02 02:09:15 +0000 | |||
3522 | +++ Percona-Server/storage/innodb_plugin/row/row0sel.c 2013-01-10 04:35:33 +0000 | |||
3523 | @@ -3926,6 +3926,11 @@ | |||
3524 | 3926 | } | 3926 | } |
3525 | 3927 | 3927 | ||
3526 | 3928 | rec_loop: | 3928 | rec_loop: |
3527 | 3929 | if (trx_is_interrupted(trx)) { | ||
3528 | 3930 | err = DB_INTERRUPTED; | ||
3529 | 3931 | goto normal_return; | ||
3530 | 3932 | } | ||
3531 | 3933 | |||
3532 | 3929 | /*-------------------------------------------------------------*/ | 3934 | /*-------------------------------------------------------------*/ |
3533 | 3930 | /* PHASE 4: Look for matching records in a loop */ | 3935 | /* PHASE 4: Look for matching records in a loop */ |
3534 | 3931 | 3936 | ||
3535 | @@ -4860,12 +4865,16 @@ | |||
3536 | 4860 | 4865 | ||
3537 | 4861 | rec_offs_init(offsets_); | 4866 | rec_offs_init(offsets_); |
3538 | 4862 | 4867 | ||
3540 | 4863 | offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); | 4868 | offsets = rec_get_offsets(rec, index, offsets, col_no + 1, &heap); |
3541 | 4869 | |||
3542 | 4870 | if (rec_offs_nth_sql_null(offsets, col_no)) { | ||
3543 | 4871 | /* There is no non-NULL value in the auto-increment column. */ | ||
3544 | 4872 | value = 0; | ||
3545 | 4873 | goto func_exit; | ||
3546 | 4874 | } | ||
3547 | 4864 | 4875 | ||
3548 | 4865 | data = rec_get_nth_field(rec, offsets, col_no, &len); | 4876 | data = rec_get_nth_field(rec, offsets, col_no, &len); |
3549 | 4866 | 4877 | ||
3550 | 4867 | ut_a(len != UNIV_SQL_NULL); | ||
3551 | 4868 | |||
3552 | 4869 | switch (mtype) { | 4878 | switch (mtype) { |
3553 | 4870 | case DATA_INT: | 4879 | case DATA_INT: |
3554 | 4871 | ut_a(len <= sizeof value); | 4880 | ut_a(len <= sizeof value); |
3555 | @@ -4886,14 +4895,15 @@ | |||
3556 | 4886 | ut_error; | 4895 | ut_error; |
3557 | 4887 | } | 4896 | } |
3558 | 4888 | 4897 | ||
3559 | 4889 | if (UNIV_LIKELY_NULL(heap)) { | ||
3560 | 4890 | mem_heap_free(heap); | ||
3561 | 4891 | } | ||
3562 | 4892 | |||
3563 | 4893 | if (!unsigned_type && (ib_int64_t) value < 0) { | 4898 | if (!unsigned_type && (ib_int64_t) value < 0) { |
3564 | 4894 | value = 0; | 4899 | value = 0; |
3565 | 4895 | } | 4900 | } |
3566 | 4896 | 4901 | ||
3567 | 4902 | func_exit: | ||
3568 | 4903 | if (UNIV_LIKELY_NULL(heap)) { | ||
3569 | 4904 | mem_heap_free(heap); | ||
3570 | 4905 | } | ||
3571 | 4906 | |||
3572 | 4897 | return(value); | 4907 | return(value); |
3573 | 4898 | } | 4908 | } |
3574 | 4899 | 4909 | ||
3575 | 4900 | 4910 | ||
3576 | === modified file 'Percona-Server/storage/innodb_plugin/row/row0umod.c' | |||
3577 | --- Percona-Server/storage/innodb_plugin/row/row0umod.c 2011-02-02 12:12:49 +0000 | |||
3578 | +++ Percona-Server/storage/innodb_plugin/row/row0umod.c 2013-01-10 04:35:33 +0000 | |||
3579 | @@ -69,36 +69,6 @@ | |||
3580 | 69 | introduced where a call to log_free_check() is bypassed. */ | 69 | introduced where a call to log_free_check() is bypassed. */ |
3581 | 70 | 70 | ||
3582 | 71 | /***********************************************************//** | 71 | /***********************************************************//** |
3583 | 72 | Checks if also the previous version of the clustered index record was | ||
3584 | 73 | modified or inserted by the same transaction, and its undo number is such | ||
3585 | 74 | that it should be undone in the same rollback. | ||
3586 | 75 | @return TRUE if also previous modify or insert of this row should be undone */ | ||
3587 | 76 | static | ||
3588 | 77 | ibool | ||
3589 | 78 | row_undo_mod_undo_also_prev_vers( | ||
3590 | 79 | /*=============================*/ | ||
3591 | 80 | undo_node_t* node, /*!< in: row undo node */ | ||
3592 | 81 | undo_no_t* undo_no)/*!< out: the undo number */ | ||
3593 | 82 | { | ||
3594 | 83 | trx_undo_rec_t* undo_rec; | ||
3595 | 84 | trx_t* trx; | ||
3596 | 85 | |||
3597 | 86 | trx = node->trx; | ||
3598 | 87 | |||
3599 | 88 | if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) { | ||
3600 | 89 | |||
3601 | 90 | *undo_no = ut_dulint_zero; | ||
3602 | 91 | return(FALSE); | ||
3603 | 92 | } | ||
3604 | 93 | |||
3605 | 94 | undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap); | ||
3606 | 95 | |||
3607 | 96 | *undo_no = trx_undo_rec_get_undo_no(undo_rec); | ||
3608 | 97 | |||
3609 | 98 | return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0); | ||
3610 | 99 | } | ||
3611 | 100 | |||
3612 | 101 | /***********************************************************//** | ||
3613 | 102 | Undoes a modify in a clustered index record. | 72 | Undoes a modify in a clustered index record. |
3614 | 103 | @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ | 73 | @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ |
3615 | 104 | static | 74 | static |
3616 | @@ -226,19 +196,11 @@ | |||
3617 | 226 | btr_pcur_t* pcur; | 196 | btr_pcur_t* pcur; |
3618 | 227 | mtr_t mtr; | 197 | mtr_t mtr; |
3619 | 228 | ulint err; | 198 | ulint err; |
3620 | 229 | ibool success; | ||
3621 | 230 | ibool more_vers; | ||
3622 | 231 | undo_no_t new_undo_no; | ||
3623 | 232 | 199 | ||
3624 | 233 | ut_ad(node && thr); | 200 | ut_ad(node && thr); |
3625 | 234 | 201 | ||
3626 | 235 | log_free_check(); | 202 | log_free_check(); |
3627 | 236 | 203 | ||
3628 | 237 | /* Check if also the previous version of the clustered index record | ||
3629 | 238 | should be undone in this same rollback operation */ | ||
3630 | 239 | |||
3631 | 240 | more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no); | ||
3632 | 241 | |||
3633 | 242 | pcur = &(node->pcur); | 204 | pcur = &(node->pcur); |
3634 | 243 | 205 | ||
3635 | 244 | mtr_start(&mtr); | 206 | mtr_start(&mtr); |
3636 | @@ -286,20 +248,6 @@ | |||
3637 | 286 | 248 | ||
3638 | 287 | trx_undo_rec_release(node->trx, node->undo_no); | 249 | trx_undo_rec_release(node->trx, node->undo_no); |
3639 | 288 | 250 | ||
3640 | 289 | if (more_vers && err == DB_SUCCESS) { | ||
3641 | 290 | |||
3642 | 291 | /* Reserve the undo log record to the prior version after | ||
3643 | 292 | committing &mtr: this is necessary to comply with the latching | ||
3644 | 293 | order, as &mtr may contain the fsp latch which is lower in | ||
3645 | 294 | the latch hierarchy than trx->undo_mutex. */ | ||
3646 | 295 | |||
3647 | 296 | success = trx_undo_rec_reserve(node->trx, new_undo_no); | ||
3648 | 297 | |||
3649 | 298 | if (success) { | ||
3650 | 299 | node->state = UNDO_NODE_PREV_VERS; | ||
3651 | 300 | } | ||
3652 | 301 | } | ||
3653 | 302 | |||
3654 | 303 | return(err); | 251 | return(err); |
3655 | 304 | } | 252 | } |
3656 | 305 | 253 | ||
3657 | @@ -799,7 +747,6 @@ | |||
3658 | 799 | trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, | 747 | trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, |
3659 | 800 | roll_ptr, info_bits, trx, | 748 | roll_ptr, info_bits, trx, |
3660 | 801 | node->heap, &(node->update)); | 749 | node->heap, &(node->update)); |
3661 | 802 | node->new_roll_ptr = roll_ptr; | ||
3662 | 803 | node->new_trx_id = trx_id; | 750 | node->new_trx_id = trx_id; |
3663 | 804 | node->cmpl_info = cmpl_info; | 751 | node->cmpl_info = cmpl_info; |
3664 | 805 | } | 752 | } |
3665 | 806 | 753 | ||
3666 | === modified file 'Percona-Server/storage/innodb_plugin/row/row0undo.c' | |||
3667 | --- Percona-Server/storage/innodb_plugin/row/row0undo.c 2010-06-29 13:00:58 +0000 | |||
3668 | +++ Percona-Server/storage/innodb_plugin/row/row0undo.c 2013-01-10 04:35:33 +0000 | |||
3669 | @@ -283,25 +283,6 @@ | |||
3670 | 283 | } else { | 283 | } else { |
3671 | 284 | node->state = UNDO_NODE_MODIFY; | 284 | node->state = UNDO_NODE_MODIFY; |
3672 | 285 | } | 285 | } |
3673 | 286 | |||
3674 | 287 | } else if (node->state == UNDO_NODE_PREV_VERS) { | ||
3675 | 288 | |||
3676 | 289 | /* Undo should be done to the same clustered index record | ||
3677 | 290 | again in this same rollback, restoring the previous version */ | ||
3678 | 291 | |||
3679 | 292 | roll_ptr = node->new_roll_ptr; | ||
3680 | 293 | |||
3681 | 294 | node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr, | ||
3682 | 295 | node->heap); | ||
3683 | 296 | node->roll_ptr = roll_ptr; | ||
3684 | 297 | node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec); | ||
3685 | 298 | |||
3686 | 299 | if (trx_undo_roll_ptr_is_insert(roll_ptr)) { | ||
3687 | 300 | |||
3688 | 301 | node->state = UNDO_NODE_INSERT; | ||
3689 | 302 | } else { | ||
3690 | 303 | node->state = UNDO_NODE_MODIFY; | ||
3691 | 304 | } | ||
3692 | 305 | } | 286 | } |
3693 | 306 | 287 | ||
3694 | 307 | /* Prevent DROP TABLE etc. while we are rolling back this row. | 288 | /* Prevent DROP TABLE etc. while we are rolling back this row. |
3695 | 308 | 289 | ||
3696 | === modified file 'Percona-Server/storage/myisam/myisamchk.c' | |||
3697 | --- Percona-Server/storage/myisam/myisamchk.c 2011-06-30 15:37:13 +0000 | |||
3698 | +++ Percona-Server/storage/myisam/myisamchk.c 2013-01-10 04:35:33 +0000 | |||
3699 | @@ -310,7 +310,14 @@ | |||
3700 | 310 | &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, | 310 | &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, |
3701 | 311 | (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, | 311 | (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, |
3702 | 312 | INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, | 312 | INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0}, |
3704 | 313 | { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", | 313 | { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, |
3705 | 314 | "Deprecated. myisam_sort_buffer_size alias is being used", | ||
3706 | 315 | &check_param.sort_buffer_length, | ||
3707 | 316 | &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, | ||
3708 | 317 | (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), | ||
3709 | 318 | ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0}, | ||
3710 | 319 | { "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE, | ||
3711 | 320 | "Alias of sort_buffer_size parameter", | ||
3712 | 314 | &check_param.sort_buffer_length, | 321 | &check_param.sort_buffer_length, |
3713 | 315 | &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, | 322 | &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG, |
3714 | 316 | (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), | 323 | (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), |
3715 | 317 | 324 | ||
3716 | === modified file 'Percona-Server/tests/mysql_client_test.c' | |||
3717 | --- Percona-Server/tests/mysql_client_test.c 2012-08-20 00:29:22 +0000 | |||
3718 | +++ Percona-Server/tests/mysql_client_test.c 2013-01-10 04:35:33 +0000 | |||
3719 | @@ -15278,6 +15278,7 @@ | |||
3720 | 15278 | 15278 | ||
3721 | 15279 | rc= mysql_query(mysql, "set names default"); | 15279 | rc= mysql_query(mysql, "set names default"); |
3722 | 15280 | myquery(rc); | 15280 | myquery(rc); |
3723 | 15281 | DBUG_VOID_RETURN; | ||
3724 | 15281 | } | 15282 | } |
3725 | 15282 | 15283 | ||
3726 | 15283 | 15284 |
Setting to WiP until https:/ /code.launchpad .net/~stewart/ percona- server/ 5.5.30/ +merge/ 148984 is merged.