Merge lp:~stewart/percona-server/5.1.68 into lp:percona-server/5.1

Proposed by Stewart Smith
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 552
Proposed branch: lp:~stewart/percona-server/5.1.68
Merge into: lp:percona-server/5.1
Diff against target: 9883 lines (+3456/-1645)
165 files modified
Percona-Server/README (+1/-1)
Percona-Server/client/mysql.cc (+89/-2)
Percona-Server/client/mysqldump.c (+2/-1)
Percona-Server/client/mysqltest.cc (+1/-2)
Percona-Server/config/ac-macros/ssl.m4 (+1/-1)
Percona-Server/configure.in (+27/-2)
Percona-Server/extra/yassl/README (+10/-1)
Percona-Server/extra/yassl/include/lock.hpp (+5/-4)
Percona-Server/extra/yassl/include/openssl/ssl.h (+1/-1)
Percona-Server/extra/yassl/include/yassl_error.hpp (+1/-1)
Percona-Server/extra/yassl/src/cert_wrapper.cpp (+1/-2)
Percona-Server/extra/yassl/src/handshake.cpp (+7/-1)
Percona-Server/extra/yassl/src/lock.cpp (+2/-2)
Percona-Server/extra/yassl/src/ssl.cpp (+1/-2)
Percona-Server/extra/yassl/src/yassl_error.cpp (+1/-6)
Percona-Server/extra/yassl/taocrypt/include/aes.hpp (+0/-1)
Percona-Server/extra/yassl/taocrypt/include/pwdbased.hpp (+3/-1)
Percona-Server/extra/yassl/taocrypt/src/asn.cpp (+3/-1)
Percona-Server/extra/yassl/taocrypt/src/coding.cpp (+21/-0)
Percona-Server/extra/yassl/taocrypt/taocrypt.dsw (+16/-1)
Percona-Server/extra/yassl/taocrypt/test/memory.cpp (+1/-1)
Percona-Server/extra/yassl/taocrypt/test/test.dsp (+7/-7)
Percona-Server/extra/yassl/yassl.dsw (+1/-4)
Percona-Server/include/my_sys.h (+3/-0)
Percona-Server/include/welcome_copyright_notice.h (+2/-2)
Percona-Server/libmysql/libmysql.c (+1/-1)
Percona-Server/libmysqld/Makefile.am (+1/-1)
Percona-Server/mysql-test/Makefile.am (+1/-2)
Percona-Server/mysql-test/include/get_binlog_dump_thread_id.inc (+0/-22)
Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.cc (+12/-8)
Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.pl (+0/-166)
Percona-Server/mysql-test/mysql-test-run.pl (+4/-0)
Percona-Server/mysql-test/r/ctype_ucs.result (+26/-0)
Percona-Server/mysql-test/r/group_min_max_innodb.result (+1/-1)
Percona-Server/mysql-test/r/loaddata.result (+0/-29)
Percona-Server/mysql-test/r/percona_innodb_version.result (+1/-1)
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+2/-0)
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/engines/funcs/r/rpl_row_until.result (+59/-203)
Percona-Server/mysql-test/suite/engines/funcs/t/disabled.def (+0/-1)
Percona-Server/mysql-test/suite/engines/funcs/t/rpl_row_until.test (+114/-78)
Percona-Server/mysql-test/suite/innodb/r/innodb_bug14676111.result (+53/-0)
Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result (+53/-0)
Percona-Server/mysql-test/suite/innodb/t/innodb_bug14676111.test (+128/-0)
Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test (+95/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14676111.result (+53/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_mysql.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/t/innodb-index.test (+4/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14676111.test (+128/-0)
Percona-Server/mysql-test/suite/parts/r/partition_alter4_innodb.result (+24/-24)
Percona-Server/mysql-test/suite/rpl/r/rpl_row_until.result (+0/-1)
Percona-Server/mysql-test/suite/rpl/t/disabled.def (+1/-1)
Percona-Server/mysql-test/suite/rpl/t/rpl_row_until.test (+2/-2)
Percona-Server/mysql-test/t/ctype_ucs.test (+32/-0)
Percona-Server/mysql-test/t/loaddata.test (+34/-30)
Percona-Server/mysql-test/t/percona_innodb_version.test (+1/-1)
Percona-Server/mysql-test/t/sp_notembedded.test (+10/-10)
Percona-Server/mysys/errors.c (+18/-6)
Percona-Server/mysys/mf_pack.c (+5/-4)
Percona-Server/mysys/my_access.c (+61/-0)
Percona-Server/mysys/my_error.c (+22/-0)
Percona-Server/mysys/my_fopen.c (+5/-0)
Percona-Server/mysys/my_lib.c (+6/-4)
Percona-Server/mysys/my_open.c (+7/-0)
Percona-Server/mysys/my_write.c (+4/-0)
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/.cvsignore (+1/-0)
Percona-Server/sql/Makefile.am (+2/-8)
Percona-Server/sql/field.cc (+4/-4)
Percona-Server/sql/ha_partition.cc (+19/-2)
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/item_xmlfunc.cc (+5/-1)
Percona-Server/sql/log.cc (+6/-0)
Percona-Server/sql/log_event.cc (+69/-8)
Percona-Server/sql/log_event.h (+19/-5)
Percona-Server/sql/mysql_priv.h (+61/-1)
Percona-Server/sql/mysqld.cc (+42/-11)
Percona-Server/sql/set_var.cc (+3/-0)
Percona-Server/sql/sp_head.cc (+27/-21)
Percona-Server/sql/sql_acl.cc (+169/-93)
Percona-Server/sql/sql_base.cc (+28/-22)
Percona-Server/sql/sql_cache.cc (+15/-15)
Percona-Server/sql/sql_connect.cc (+60/-8)
Percona-Server/sql/sql_lex.cc (+1/-0)
Percona-Server/sql/sql_lex.h (+5/-1)
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_repl.cc (+4/-0)
Percona-Server/sql/sql_select.cc (+13/-13)
Percona-Server/sql/sql_table.cc (+151/-110)
Percona-Server/sql/sql_trigger.cc (+1/-3)
Percona-Server/sql/tztime.cc (+3/-18)
Percona-Server/storage/heap/hp_delete.c (+14/-4)
Percona-Server/storage/innobase/btr/btr0btr.c (+23/-1)
Percona-Server/storage/innobase/btr/btr0cur.c (+16/-6)
Percona-Server/storage/innobase/dict/dict0dict.c (+15/-3)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+22/-2)
Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c (+25/-3)
Percona-Server/storage/innobase/include/btr0cur.h (+10/-4)
Percona-Server/storage/innobase/include/btr0cur.ic (+13/-0)
Percona-Server/storage/innobase/include/dict0mem.h (+6/-1)
Percona-Server/storage/innobase/include/lock0lock.h (+7/-0)
Percona-Server/storage/innobase/include/row0undo.h (+2/-7)
Percona-Server/storage/innobase/include/srv0srv.h (+8/-0)
Percona-Server/storage/innobase/include/trx0purge.h (+4/-0)
Percona-Server/storage/innobase/lock/lock0lock.c (+71/-14)
Percona-Server/storage/innobase/os/os0file.c (+15/-0)
Percona-Server/storage/innobase/row/row0ins.c (+4/-1)
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/innobase/srv/srv0srv.c (+50/-0)
Percona-Server/storage/innobase/trx/trx0purge.c (+13/-0)
Percona-Server/storage/innodb_plugin/ChangeLog (+56/-0)
Percona-Server/storage/innodb_plugin/btr/btr0btr.c (+50/-20)
Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+30/-18)
Percona-Server/storage/innodb_plugin/buf/buf0buf.c (+42/-74)
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/fil/fil0fil.c (+25/-1)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+38/-3)
Percona-Server/storage/innodb_plugin/handler/handler0alter.cc (+6/-3)
Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c (+26/-3)
Percona-Server/storage/innodb_plugin/include/btr0cur.h (+11/-5)
Percona-Server/storage/innodb_plugin/include/btr0cur.ic (+13/-0)
Percona-Server/storage/innodb_plugin/include/buf0buf.h (+5/-4)
Percona-Server/storage/innodb_plugin/include/buf0buf.ic (+3/-4)
Percona-Server/storage/innodb_plugin/include/data0type.ic (+5/-23)
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/fil0fil.h (+15/-0)
Percona-Server/storage/innodb_plugin/include/lock0lock.h (+10/-2)
Percona-Server/storage/innodb_plugin/include/page0zip.h (+5/-3)
Percona-Server/storage/innodb_plugin/include/rem0rec.h (+42/-38)
Percona-Server/storage/innodb_plugin/include/row0undo.h (+0/-7)
Percona-Server/storage/innodb_plugin/include/srv0srv.h (+9/-0)
Percona-Server/storage/innodb_plugin/include/trx0purge.h (+4/-0)
Percona-Server/storage/innodb_plugin/include/univ.i (+10/-13)
Percona-Server/storage/innodb_plugin/lock/lock0lock.c (+72/-15)
Percona-Server/storage/innodb_plugin/log/log0recv.c (+13/-7)
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/rem/rem0rec.c (+172/-65)
Percona-Server/storage/innodb_plugin/row/row0ins.c (+4/-1)
Percona-Server/storage/innodb_plugin/row/row0merge.c (+81/-27)
Percona-Server/storage/innodb_plugin/row/row0mysql.c (+11/-1)
Percona-Server/storage/innodb_plugin/row/row0sel.c (+17/-7)
Percona-Server/storage/innodb_plugin/row/row0umod.c (+3/-53)
Percona-Server/storage/innodb_plugin/row/row0undo.c (+1/-20)
Percona-Server/storage/innodb_plugin/srv/srv0srv.c (+56/-0)
Percona-Server/storage/innodb_plugin/trx/trx0purge.c (+13/-0)
Percona-Server/storage/innodb_plugin/trx/trx0rec.c (+20/-0)
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.68
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Laurynas Biveinis (community) Approve
Review via email: mp+152096@code.launchpad.net

Description of the change

Merge MySQL 5.1.68. Joint effort of Laurynas and myself.

http://jenkins.percona.com/job/percona-server-5.1-param/527/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Approving everything except buf0buf changes, which where done by me.

review: Approve
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/README'
2--- Percona-Server/README 2012-02-28 11:44:21 +0000
3+++ Percona-Server/README 2013-03-07 06:40:28 +0000
4@@ -5,7 +5,7 @@
5 is released under the version 2 of the GNU General Public License.
6 MySQL is brought to you by Oracle.
7
8-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
9+Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
10
11 License information can be found in the COPYING file.
12
13
14=== modified file 'Percona-Server/client/mysql.cc'
15--- Percona-Server/client/mysql.cc 2012-10-16 04:49:59 +0000
16+++ Percona-Server/client/mysql.cc 2013-03-07 06:40:28 +0000
17@@ -250,6 +250,8 @@
18 static char *get_arg(char *line, my_bool get_next_arg);
19 static void init_username();
20 static void add_int_to_prompt(int toadd);
21+static int normalize_dbname(const char *line, char *buff, uint buff_size);
22+static int get_quote_count(const char *line);
23
24 /* A structure which contains information on the commands this program
25 can understand. */
26@@ -4172,8 +4174,23 @@
27 int select_db;
28
29 bzero(buff, sizeof(buff));
30- strmake(buff, line, sizeof(buff) - 1);
31- tmp= get_arg(buff, 0);
32+
33+ /*
34+ In case number of quotes exceed 2, we try to get
35+ the normalized db name.
36+ */
37+ if (get_quote_count(line) > 2)
38+ {
39+ if (normalize_dbname(line, buff, sizeof(buff)))
40+ return put_error(&mysql);
41+ tmp= buff;
42+ }
43+ else
44+ {
45+ strmake(buff, line, sizeof(buff) - 1);
46+ tmp= get_arg(buff, 0);
47+ }
48+
49 if (!tmp || !*tmp)
50 {
51 put_info("USE must be followed by a database name", INFO_ERROR);
52@@ -4239,6 +4256,62 @@
53 return 0;
54 }
55
56+/**
57+ Normalize database name.
58+
59+ @param line [IN] The command.
60+ @param buff [OUT] Normalized db name.
61+ @param buff_size [IN] Buffer size.
62+
63+ @return Operation status
64+ @retval 0 Success
65+ @retval 1 Failure
66+
67+ @note Sometimes server normilizes the database names
68+ & APIs like mysql_select_db() expect normalized
69+ database names. Since it is difficult to perform
70+ the name conversion/normalization on the client
71+ side, this function tries to get the normalized
72+ dbname (indirectly) from the server.
73+*/
74+
75+static int
76+normalize_dbname(const char *line, char *buff, uint buff_size)
77+{
78+ MYSQL_RES *res= NULL;
79+
80+ /* Send the "USE db" commmand to the server. */
81+ if (mysql_query(&mysql, line))
82+ return 1;
83+
84+ /*
85+ Now, get the normalized database name and store it
86+ into the buff.
87+ */
88+ if (!mysql_query(&mysql, "SELECT DATABASE()") &&
89+ (res= mysql_use_result(&mysql)))
90+ {
91+ MYSQL_ROW row= mysql_fetch_row(res);
92+ if (row && row[0])
93+ {
94+ size_t len= strlen(row[0]);
95+ /* Make sure there is enough room to store the dbname. */
96+ if ((len > buff_size) || ! memcpy(buff, row[0], len))
97+ {
98+ mysql_free_result(res);
99+ return 1;
100+ }
101+ }
102+ mysql_free_result(res);
103+ }
104+
105+ /* Restore the original database. */
106+ if (current_db && mysql_select_db(&mysql, current_db))
107+ return 1;
108+
109+ return 0;
110+}
111+
112 static int
113 com_warnings(String *buffer __attribute__((unused)),
114 char *line __attribute__((unused)))
115@@ -4318,6 +4391,20 @@
116 return valid_arg ? start : NullS;
117 }
118
119+/*
120+ Number of quotes present in the command's argument.
121+*/
122+static int
123+get_quote_count(const char *line)
124+{
125+ int quote_count;
126+ const char *ptr= line;
127+
128+ for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
129+ quote_count ++;
130+
131+ return quote_count;
132+}
133
134 static int
135 sql_real_connect(char *host,char *database,char *user,char *password,
136
137=== modified file 'Percona-Server/client/mysqldump.c'
138--- Percona-Server/client/mysqldump.c 2013-01-18 03:33:06 +0000
139+++ Percona-Server/client/mysqldump.c 2013-03-07 06:40:28 +0000
140@@ -3691,7 +3691,8 @@
141 if (!opt_events && !my_strcasecmp(&my_charset_latin1, db, "mysql") &&
142 !my_strcasecmp(&my_charset_latin1, table, "event"))
143 {
144- verbose_msg("-- Skipping data table mysql.event, --skip-events was used\n");
145+ fprintf(stderr, "-- Warning: Skipping the data of table mysql.event."
146+ " Specify the --events option explicitly.\n");
147 DBUG_VOID_RETURN;
148 }
149
150
151=== modified file 'Percona-Server/client/mysqltest.cc'
152--- Percona-Server/client/mysqltest.cc 2012-10-16 04:49:59 +0000
153+++ Percona-Server/client/mysqltest.cc 2013-03-07 06:40:28 +0000
154@@ -1168,7 +1168,7 @@
155 void free_used_memory()
156 {
157 uint i;
158- DBUG_ENTER("free_used_memory");
159+ // Do not use DBUG_ENTER("free_used_memory"); here, see below.
160
161 if (connections)
162 close_connections();
163@@ -1206,7 +1206,6 @@
164 mysql_server_end();
165
166 /* Don't use DBUG after mysql_server_end() */
167- DBUG_VIOLATION_HELPER_LEAVE;
168 return;
169 }
170
171
172=== modified file 'Percona-Server/config/ac-macros/ssl.m4'
173--- Percona-Server/config/ac-macros/ssl.m4 2010-06-08 21:14:18 +0000
174+++ Percona-Server/config/ac-macros/ssl.m4 2013-03-07 06:40:28 +0000
175@@ -42,7 +42,7 @@
176 yassl_thread_cxxflags=""
177 yassl_thread_safe=""
178 if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"; then
179- yassl_thread_cxxflags="-DYASSL_THREAD_SAFE"
180+ yassl_thread_cxxflags="-DMULTI_THREADED"
181 yassl_thread_safe="(thread-safe)"
182 fi
183 AC_SUBST([yassl_thread_cxxflags])
184
185=== modified file 'Percona-Server/configure.in'
186--- Percona-Server/configure.in 2012-10-24 10:41:13 +0000
187+++ Percona-Server/configure.in 2013-03-07 06:40:28 +0000
188@@ -12,7 +12,7 @@
189 dnl When changing the major version number please also check the switch
190 dnl statement in mysqlbinlog::check_master_version(). You may also need
191 dnl to update version.c in ndb.
192-AC_INIT([MySQL Server], [5.1.66], [], [mysql])
193+AC_INIT([MySQL Server], [5.1.68], [], [mysql])
194
195 AC_CONFIG_SRCDIR([sql/mysqld.cc])
196 AC_CANONICAL_SYSTEM
197@@ -22,7 +22,7 @@
198 AM_INIT_AUTOMAKE([1.9 tar-ustar])
199 AC_PROG_LIBTOOL
200
201-AM_CONFIG_HEADER([include/config.h])
202+AC_CONFIG_HEADERS([include/config.h])
203
204 # Request support for automake silent-rules if available.
205 # Default to verbose output. One can use the configure-time
206@@ -269,6 +269,31 @@
207
208 AC_SUBST(NM)dnl
209
210+##############################################################################
211+# In automake 1.12, the extension on generated yacc/bison header files changed
212+##############################################################################
213+
214+YACC_HEXT="h"
215+MAKEFILE_1ST=`head -1 "$srcdir/Makefile.in"`
216+AMAKE_MAJOR=`expr "$MAKEFILE_1ST" : '.*generated by automake \([[0-9]]*\).*'`
217+if test $? -eq "0" ; then
218+ if test "$AMAKE_MAJOR" -gt "1" ; then
219+ YACC_HEXT="hh"
220+ CXXFLAGS="$CXXFLAGS -DYACC_HEXT_HH"
221+ elif test "$AMAKE_MAJOR" -eq "1" ; then
222+ AMAKE_MINOR=`expr "$MAKEFILE_1ST" : '.*generated by automake 1.\([[0-9]]*\).*'`
223+ if test $? -eq "0" ; then
224+ if test "$AMAKE_MINOR" -ge "12" ; then
225+ YACC_HEXT="hh"
226+ CXXFLAGS="$CXXFLAGS -DYACC_HEXT_HH"
227+ fi
228+ fi
229+ fi
230+fi
231+AC_SUBST(YACC_HEXT)
232+
233+##############################################################################
234+
235 # NM= "$NM -X64"
236 #archive_expsym_cmds= `echo "$archive_expsym_cmds" | sed -e '/"$(CC)"//'`
237 #archive_expsym_cmds= "$CC -q64 $archive_expsym_cmds"
238
239=== modified file 'Percona-Server/extra/yassl/README'
240--- Percona-Server/extra/yassl/README 2012-03-02 12:12:07 +0000
241+++ Percona-Server/extra/yassl/README 2013-03-07 06:40:28 +0000
242@@ -12,7 +12,16 @@
243
244 *** end Note ***
245
246-yaSSL Release notes, version 2.1.2 (9/2/2011)
247+yaSSL Release notes, version 2.2.2 (7/5/2012)
248+
249+ This release of yaSSL contains bug fixes and more security checks around
250+ malicious certificates.
251+
252+See normal build instructions below under 1.0.6.
253+See libcurl build instructions below under 1.3.0 and note in 1.5.8.
254+
255+
256+*****************yaSSL Release notes, version 2.1.2 (9/2/2011)
257
258 This release of yaSSL contains bug fixes, better non-blocking support with
259 SSL_write, and OpenSSL RSA public key format support.
260
261=== modified file 'Percona-Server/extra/yassl/include/lock.hpp'
262--- Percona-Server/extra/yassl/include/lock.hpp 2010-12-28 23:47:05 +0000
263+++ Percona-Server/extra/yassl/include/lock.hpp 2013-03-07 06:40:28 +0000
264@@ -27,7 +27,7 @@
265 Visual Studio Source Annotations header (sourceannotations.h) fails
266 to compile if outside of the global namespace.
267 */
268-#ifdef YASSL_THREAD_SAFE
269+#ifdef MULTI_THREADED
270 #ifdef _WIN32
271 #include <windows.h>
272 #endif
273@@ -36,8 +36,9 @@
274 namespace yaSSL {
275
276
277-#ifdef YASSL_THREAD_SAFE
278+#ifdef MULTI_THREADED
279 #ifdef _WIN32
280+ #include <windows.h>
281
282 class Mutex {
283 CRITICAL_SECTION cs_;
284@@ -77,7 +78,7 @@
285 };
286
287 #endif // _WIN32
288-#else // YASSL_THREAD_SAFE (WE'RE SINGLE)
289+#else // MULTI_THREADED (WE'RE SINGLE)
290
291 class Mutex {
292 public:
293@@ -87,7 +88,7 @@
294 };
295 };
296
297-#endif // YASSL_THREAD_SAFE
298+#endif // MULTI_THREADED
299
300
301
302
303=== modified file 'Percona-Server/extra/yassl/include/openssl/ssl.h'
304--- Percona-Server/extra/yassl/include/openssl/ssl.h 2012-03-02 12:18:12 +0000
305+++ Percona-Server/extra/yassl/include/openssl/ssl.h 2013-03-07 06:40:28 +0000
306@@ -35,7 +35,7 @@
307 #include "rsa.h"
308
309
310-#define YASSL_VERSION "2.2.0"
311+#define YASSL_VERSION "2.2.2"
312
313
314 #if defined(__cplusplus)
315
316=== modified file 'Percona-Server/extra/yassl/include/yassl_error.hpp'
317--- Percona-Server/extra/yassl/include/yassl_error.hpp 2012-02-10 09:39:51 +0000
318+++ Percona-Server/extra/yassl/include/yassl_error.hpp 2013-03-07 06:40:28 +0000
319@@ -65,7 +65,7 @@
320 enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib };
321 enum { MAX_ERROR_SZ = 80 };
322
323-void SetErrorString(unsigned long, char*);
324+void SetErrorString(YasslError, char*);
325
326 /* remove for now, if go back to exceptions use this wrapper
327 // Base class for all yaSSL exceptions
328
329=== modified file 'Percona-Server/extra/yassl/src/cert_wrapper.cpp'
330--- Percona-Server/extra/yassl/src/cert_wrapper.cpp 2012-02-13 11:40:12 +0000
331+++ Percona-Server/extra/yassl/src/cert_wrapper.cpp 2013-03-07 06:40:28 +0000
332@@ -250,8 +250,7 @@
333 TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
334 TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
335
336- int err = cert.GetError().What();
337- if ( err )
338+ if (int err = cert.GetError().What())
339 return err;
340
341 const TaoCrypt::PublicKey& key = cert.GetPublicKey();
342
343=== modified file 'Percona-Server/extra/yassl/src/handshake.cpp'
344--- Percona-Server/extra/yassl/src/handshake.cpp 2012-02-13 11:40:12 +0000
345+++ Percona-Server/extra/yassl/src/handshake.cpp 2013-03-07 06:40:28 +0000
346@@ -767,8 +767,14 @@
347
348 while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) {
349 // each message in record, can be more than 1 if not encrypted
350- if (ssl.getSecurity().get_parms().pending_ == false) // cipher on
351+ if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on
352+ // sanity check for malicious/corrupted/illegal input
353+ if (buffer.get_remaining() < hdr.length_) {
354+ ssl.SetError(bad_input);
355+ return 0;
356+ }
357 decrypt_message(ssl, buffer, hdr.length_);
358+ }
359
360 mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_));
361 if (!msg.get()) {
362
363=== modified file 'Percona-Server/extra/yassl/src/lock.cpp'
364--- Percona-Server/extra/yassl/src/lock.cpp 2010-12-28 18:57:23 +0000
365+++ Percona-Server/extra/yassl/src/lock.cpp 2013-03-07 06:40:28 +0000
366@@ -26,7 +26,7 @@
367 namespace yaSSL {
368
369
370-#ifdef YASSL_THREAD_SAFE
371+#ifdef MULTI_THREADED
372 #ifdef _WIN32
373
374 Mutex::Mutex()
375@@ -79,7 +79,7 @@
376
377
378 #endif // _WIN32
379-#endif // YASSL_THREAD_SAFE
380+#endif // MULTI_THREADED
381
382
383
384
385=== modified file 'Percona-Server/extra/yassl/src/ssl.cpp'
386--- Percona-Server/extra/yassl/src/ssl.cpp 2012-08-11 10:13:04 +0000
387+++ Percona-Server/extra/yassl/src/ssl.cpp 2013-03-07 06:40:28 +0000
388@@ -27,7 +27,6 @@
389
390
391
392-
393 /* see man pages for function descriptions */
394
395 #include "runtime.hpp"
396@@ -1014,7 +1013,7 @@
397 static char* msg = (char*)"Please supply a buffer for error string";
398
399 if (buffer) {
400- SetErrorString(errNumber, buffer);
401+ SetErrorString(YasslError(errNumber), buffer);
402 return buffer;
403 }
404
405
406=== modified file 'Percona-Server/extra/yassl/src/yassl_error.cpp'
407--- Percona-Server/extra/yassl/src/yassl_error.cpp 2012-02-13 11:40:12 +0000
408+++ Percona-Server/extra/yassl/src/yassl_error.cpp 2013-03-07 06:40:28 +0000
409@@ -31,11 +31,6 @@
410 #pragma warning(disable: 4996)
411 #endif
412
413-#ifdef _MSC_VER
414- // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
415- #pragma warning(disable: 4996)
416-#endif
417-
418 namespace yaSSL {
419
420
421@@ -60,7 +55,7 @@
422 */
423
424
425-void SetErrorString(unsigned long error, char* buffer)
426+void SetErrorString(YasslError error, char* buffer)
427 {
428 using namespace TaoCrypt;
429 const int max = MAX_ERROR_SZ; // shorthand
430
431=== modified file 'Percona-Server/extra/yassl/taocrypt/include/aes.hpp'
432--- Percona-Server/extra/yassl/taocrypt/include/aes.hpp 2007-01-29 15:54:40 +0000
433+++ Percona-Server/extra/yassl/taocrypt/include/aes.hpp 2013-03-07 06:40:28 +0000
434@@ -92,7 +92,6 @@
435 typedef BlockCipher<DECRYPTION, AES, CBC> AES_CBC_Decryption;
436
437
438-
439 } // naemspace
440
441 #endif // TAO_CRYPT_AES_HPP
442
443=== modified file 'Percona-Server/extra/yassl/taocrypt/include/pwdbased.hpp'
444--- Percona-Server/extra/yassl/taocrypt/include/pwdbased.hpp 2012-02-10 14:33:27 +0000
445+++ Percona-Server/extra/yassl/taocrypt/include/pwdbased.hpp 2013-03-07 06:40:28 +0000
446@@ -48,9 +48,11 @@
447 word32 pLen, const byte* salt, word32 sLen,
448 word32 iterations) const
449 {
450- if (dLen > MaxDerivedKeyLength())
451+ if (dLen > MaxDerivedKeyLength())
452 return 0;
453
454+ if (iterations < 0)
455+ return 0;
456
457 ByteBlock buffer(T::DIGEST_SIZE);
458 HMAC<T> hmac;
459
460=== modified file 'Percona-Server/extra/yassl/taocrypt/src/asn.cpp'
461--- Percona-Server/extra/yassl/taocrypt/src/asn.cpp 2012-08-20 00:29:22 +0000
462+++ Percona-Server/extra/yassl/taocrypt/src/asn.cpp 2013-03-07 06:40:28 +0000
463@@ -154,6 +154,8 @@
464 else
465 length = b;
466
467+ if (source.IsLeft(length) == false) return 0;
468+
469 return length;
470 }
471
472@@ -832,7 +834,7 @@
473 if (email) {
474 if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) {
475 source_.SetError(CONTENT_E);
476- return;
477+ return;
478 }
479 }
480
481
482=== modified file 'Percona-Server/extra/yassl/taocrypt/src/coding.cpp'
483--- Percona-Server/extra/yassl/taocrypt/src/coding.cpp 2012-02-13 11:40:12 +0000
484+++ Percona-Server/extra/yassl/taocrypt/src/coding.cpp 2013-03-07 06:40:28 +0000
485@@ -103,6 +103,16 @@
486 byte b = coded_.next() - 0x30; // 0 starts at 0x30
487 byte b2 = coded_.next() - 0x30;
488
489+ // sanity checks
490+ if (b >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
491+ coded_.SetError(PEM_E);
492+ return;
493+ }
494+ if (b2 >= sizeof(hexDecode)/sizeof(hexDecode[0])) {
495+ coded_.SetError(PEM_E);
496+ return;
497+ }
498+
499 b = hexDecode[b];
500 b2 = hexDecode[b2];
501
502@@ -178,6 +188,7 @@
503 {
504 word32 bytes = coded_.size();
505 word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
506+ const byte maxIdx = (byte)sizeof(base64Decode) + 0x2B - 1;
507 plainSz = ((plainSz * 3) / 4) + 3;
508 decoded_.New(plainSz);
509
510@@ -200,6 +211,16 @@
511 if (e4 == pad)
512 pad4 = true;
513
514+ if (e1 < 0x2B || e2 < 0x2B || e3 < 0x2B || e4 < 0x2B) {
515+ coded_.SetError(PEM_E);
516+ return;
517+ }
518+
519+ if (e1 > maxIdx || e2 > maxIdx || e3 > maxIdx || e4 > maxIdx) {
520+ coded_.SetError(PEM_E);
521+ return;
522+ }
523+
524 e1 = base64Decode[e1 - 0x2B];
525 e2 = base64Decode[e2 - 0x2B];
526 e3 = (e3 == pad) ? 0 : base64Decode[e3 - 0x2B];
527
528=== modified file 'Percona-Server/extra/yassl/taocrypt/taocrypt.dsw'
529--- Percona-Server/extra/yassl/taocrypt/taocrypt.dsw 2005-04-28 13:23:27 +0000
530+++ Percona-Server/extra/yassl/taocrypt/taocrypt.dsw 2013-03-07 06:40:28 +0000
531@@ -3,6 +3,21 @@
532
533 ###############################################################################
534
535+Project: "benchmark"=.\benchmark\benchmark.dsp - Package Owner=<4>
536+
537+Package=<5>
538+{{{
539+}}}
540+
541+Package=<4>
542+{{{
543+ Begin Project Dependency
544+ Project_Dep_Name taocrypt
545+ End Project Dependency
546+}}}
547+
548+###############################################################################
549+
550 Project: "taocrypt"=.\taocrypt.dsp - Package Owner=<4>
551
552 Package=<5>
553@@ -15,7 +30,7 @@
554
555 ###############################################################################
556
557-Project: "test"=.\test.dsp - Package Owner=<4>
558+Project: "test"=.\test\test.dsp - Package Owner=<4>
559
560 Package=<5>
561 {{{
562
563=== modified file 'Percona-Server/extra/yassl/taocrypt/test/memory.cpp'
564--- Percona-Server/extra/yassl/taocrypt/test/memory.cpp 2012-02-10 14:33:27 +0000
565+++ Percona-Server/extra/yassl/taocrypt/test/memory.cpp 2013-03-07 06:40:28 +0000
566@@ -31,7 +31,7 @@
567 To use MemoryTracker merely add this file to your project
568 No need to instantiate anything
569
570-If your app is multi threaded define YASSL_THREAD_SAFE
571+If your app is multi threaded define MULTI_THREADED
572
573 *********************************************************************/
574
575
576=== renamed file 'Percona-Server/extra/yassl/taocrypt/test.dsp' => 'Percona-Server/extra/yassl/taocrypt/test/test.dsp'
577--- Percona-Server/extra/yassl/taocrypt/test.dsp 2006-11-29 13:35:59 +0000
578+++ Percona-Server/extra/yassl/taocrypt/test/test.dsp 2013-03-07 06:40:28 +0000
579@@ -37,12 +37,12 @@
580 # PROP BASE Target_Dir ""
581 # PROP Use_MFC 0
582 # PROP Use_Debug_Libraries 0
583-# PROP Output_Dir "test\Release"
584-# PROP Intermediate_Dir "test\Release"
585+# PROP Output_Dir "Release"
586+# PROP Intermediate_Dir "Release"
587 # PROP Ignore_Export_Lib 0
588 # PROP Target_Dir ""
589 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
590-# ADD CPP /nologo /MT /W3 /O2 /I "include" /I "mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
591+# ADD CPP /nologo /MD /W3 /O2 /I "../include" /I "../mySTL" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
592 # ADD BASE RSC /l 0x409 /d "NDEBUG"
593 # ADD RSC /l 0x409 /d "NDEBUG"
594 BSC32=bscmake.exe
595@@ -61,12 +61,12 @@
596 # PROP BASE Target_Dir ""
597 # PROP Use_MFC 0
598 # PROP Use_Debug_Libraries 1
599-# PROP Output_Dir "test\Debug"
600-# PROP Intermediate_Dir "test\Debug"
601+# PROP Output_Dir "Debug"
602+# PROP Intermediate_Dir "Debug"
603 # PROP Ignore_Export_Lib 0
604 # PROP Target_Dir ""
605 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
606-# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "include" /I "mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
607+# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../include" /I "../mySTL" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
608 # ADD BASE RSC /l 0x409 /d "_DEBUG"
609 # ADD RSC /l 0x409 /d "_DEBUG"
610 BSC32=bscmake.exe
611@@ -87,7 +87,7 @@
612 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
613 # Begin Source File
614
615-SOURCE=.\test\test.cpp
616+SOURCE=.\test.cpp
617 # End Source File
618 # End Group
619 # Begin Group "Header Files"
620
621=== modified file 'Percona-Server/extra/yassl/yassl.dsw'
622--- Percona-Server/extra/yassl/yassl.dsw 2006-04-07 09:35:12 +0000
623+++ Percona-Server/extra/yassl/yassl.dsw 2013-03-07 06:40:28 +0000
624@@ -90,7 +90,7 @@
625
626 ###############################################################################
627
628-Project: "test"=.\taocrypt\test.dsp - Package Owner=<4>
629+Project: "test"=.\taocrypt\test\test.dsp - Package Owner=<4>
630
631 Package=<5>
632 {{{
633@@ -114,9 +114,6 @@
634 Package=<4>
635 {{{
636 Begin Project Dependency
637- Project_Dep_Name taocrypt
638- End Project Dependency
639- Begin Project Dependency
640 Project_Dep_Name yassl
641 End Project Dependency
642 }}}
643
644=== modified file 'Percona-Server/include/my_sys.h'
645--- Percona-Server/include/my_sys.h 2012-10-25 17:55:07 +0000
646+++ Percona-Server/include/my_sys.h 2013-03-07 06:40:28 +0000
647@@ -234,6 +234,7 @@
648 extern const char *my_progname; /* program-name (printed in errors) */
649 extern char NEAR curr_dir[]; /* Current directory for user */
650 extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
651+extern void(*sql_print_warning_hook)(const char *format,...);
652 extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
653 myf MyFlags);
654 extern uint my_file_limit;
655@@ -649,6 +650,7 @@
656 #endif
657 extern int check_if_legal_filename(const char *path);
658 extern int check_if_legal_tablename(const char *path);
659+extern my_bool is_filename_allowed(const char *name, size_t length);
660
661 #if defined(__WIN__) && defined(__NT__)
662 extern int nt_share_delete(const char *name,myf MyFlags);
663@@ -674,6 +676,7 @@
664 extern int my_printf_error _VARARGS((uint my_err, const char *format,
665 myf MyFlags, ...))
666 ATTRIBUTE_FORMAT(printf, 2, 4);
667+extern void my_printf_warning _VARARGS((const char * format, ...));
668 extern int my_error_register(const char **errmsgs, int first, int last);
669 extern const char **my_error_unregister(int first, int last);
670 extern int my_message(uint my_err, const char *str,myf MyFlags);
671
672=== modified file 'Percona-Server/include/welcome_copyright_notice.h'
673--- Percona-Server/include/welcome_copyright_notice.h 2012-08-07 13:28:19 +0000
674+++ Percona-Server/include/welcome_copyright_notice.h 2013-03-07 06:40:28 +0000
675@@ -1,4 +1,4 @@
676-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
677+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
678
679 This program is free software; you can redistribute it and/or modify
680 it under the terms of the GNU General Public License as published by
681@@ -16,7 +16,7 @@
682 #ifndef _welcome_copyright_notice_h_
683 #define _welcome_copyright_notice_h_
684
685-#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012"
686+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2013"
687
688 /*
689 This define specifies copyright notice which is displayed by every MySQL
690
691=== modified file 'Percona-Server/libmysql/libmysql.c'
692--- Percona-Server/libmysql/libmysql.c 2012-08-20 00:29:22 +0000
693+++ Percona-Server/libmysql/libmysql.c 2013-03-07 06:40:28 +0000
694@@ -4653,7 +4653,7 @@
695 if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE)
696 {
697 set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL);
698- return 1;
699+ DBUG_RETURN(1);
700 }
701 if (column >= stmt->field_count)
702 {
703
704=== modified file 'Percona-Server/libmysqld/Makefile.am'
705--- Percona-Server/libmysqld/Makefile.am 2011-06-30 15:37:13 +0000
706+++ Percona-Server/libmysqld/Makefile.am 2013-03-07 06:40:28 +0000
707@@ -90,7 +90,7 @@
708 storagesourceslinks = @condition_dependent_plugin_links@
709
710 # automake misses these
711-sql_yacc.cc sql_yacc.h: $(top_srcdir)/sql/sql_yacc.yy
712+sql_yacc.cc sql_yacc.$(YACC_HEXT): $(top_srcdir)/sql/sql_yacc.yy
713
714 # The following libraries should be included in libmysqld.a
715 INC_LIB= $(top_builddir)/regex/libregex.a \
716
717=== modified file 'Percona-Server/mysql-test/Makefile.am'
718--- Percona-Server/mysql-test/Makefile.am 2012-10-16 04:49:59 +0000
719+++ Percona-Server/mysql-test/Makefile.am 2013-03-07 06:40:28 +0000
720@@ -64,8 +64,7 @@
721 lib/My/File/Path.pm \
722 lib/My/SysInfo.pm \
723 lib/My/CoreDump.pm \
724- lib/My/SafeProcess/Base.pm \
725- lib/My/SafeProcess/safe_process.pl
726+ lib/My/SafeProcess/Base.pm
727
728 SUBDIRS = lib/My/SafeProcess
729
730
731=== renamed file 'Percona-Server/mysql-test/include/mysqlbinlog_row_engine.inc' => 'Percona-Server/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc'
732=== removed file 'Percona-Server/mysql-test/include/get_binlog_dump_thread_id.inc'
733--- Percona-Server/mysql-test/include/get_binlog_dump_thread_id.inc 2007-02-26 08:16:22 +0000
734+++ Percona-Server/mysql-test/include/get_binlog_dump_thread_id.inc 1970-01-01 00:00:00 +0000
735@@ -1,22 +0,0 @@
736---exec $MYSQL test -e "show processlist" > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
737---disable_warnings
738-drop table if exists t999;
739---enable_warnings
740-# Create a table to hold the process list
741-create temporary table t999(
742- id int,
743- user char(255),
744- host char(255),
745- db char(255),
746- Command char(255),
747- time int,
748- State char(255),
749- info char(255)
750-);
751-# Load processlist into table, headers will create seom warnings
752---disable_warnings
753---replace_result $MYSQLTEST_VARDIR "."
754-eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
755---enable_warnings
756-let $id = `select Id from t999 where Command="Binlog Dump"`;
757-drop table t999;
758
759=== modified file 'Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.cc'
760--- Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.cc 2012-10-09 10:47:51 +0000
761+++ Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.cc 2013-03-07 06:40:28 +0000
762@@ -153,15 +153,19 @@
763 pid_t own_pid= getpid();
764 pid_t parent_pid= getppid();
765 bool nocore = false;
766- struct sigaction sigchld_action;
767-
768- sigchld_action.sa_handler= handle_signal;
769- sigchld_action.sa_flags= SA_NOCLDSTOP;
770+ struct sigaction sa,sa_abort;
771+
772+ sa.sa_handler= handle_signal;
773+ sa.sa_flags= SA_NOCLDSTOP;
774+ sigemptyset(&sa.sa_mask);
775+
776+ sa_abort.sa_handler= handle_abort;
777+ sigemptyset(&sa_abort.sa_mask);
778 /* Install signal handlers */
779- signal(SIGTERM, handle_signal);
780- signal(SIGINT, handle_signal);
781- sigaction(SIGCHLD, &sigchld_action, NULL);
782- signal(SIGABRT, handle_abort);
783+ sigaction(SIGTERM, &sa,NULL);
784+ sigaction(SIGINT, &sa,NULL);
785+ sigaction(SIGCHLD, &sa,NULL);
786+ sigaction(SIGABRT, &sa_abort,NULL);
787
788 sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
789
790
791=== removed file 'Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.pl'
792--- Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.pl 2011-07-03 15:47:37 +0000
793+++ Percona-Server/mysql-test/lib/My/SafeProcess/safe_process.pl 1970-01-01 00:00:00 +0000
794@@ -1,166 +0,0 @@
795-#!/usr/bin/perl
796-# -*- cperl -*-
797-
798-# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
799-#
800-# This program is free software; you can redistribute it and/or modify
801-# it under the terms of the GNU General Public License as published by
802-# the Free Software Foundation; version 2 of the License.
803-#
804-# This program is distributed in the hope that it will be useful,
805-# but WITHOUT ANY WARRANTY; without even the implied warranty of
806-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
807-# GNU General Public License for more details.
808-#
809-# You should have received a copy of the GNU General Public License
810-# along with this program; if not, write to the Free Software
811-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
812-
813-use strict;
814-use warnings;
815-
816-use lib 'lib';
817-use My::SafeProcess::Base;
818-use POSIX qw(WNOHANG);
819-
820-###########################################################################
821-# Util functions
822-###########################################################################
823-
824-#
825-#Print message to stderr
826-#
827-my $verbose= 0;
828-sub message {
829- if ($verbose > 0){
830- use Time::localtime;
831- my $tm= localtime();
832- my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
833- $tm->year % 100, $tm->mon+1, $tm->mday,
834- $tm->hour, $tm->min, $tm->sec);
835- print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
836- }
837-}
838-
839-
840-###########################################################################
841-# Main program
842-###########################################################################
843-
844-my $terminated= 0;
845-
846-# Protect against being killed in the middle
847-# of child creation, just set the terminated flag
848-# to make sure the child will be killed off
849-# when program is ready to do that
850-$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
851-$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
852-
853-my $parent_pid= getppid();
854-
855-my $found_double_dash= 0;
856-while (my $arg= shift(@ARGV)){
857-
858- if ($arg =~ /^--$/){
859- $found_double_dash= 1;
860- last;
861- }
862- elsif ($arg =~ /^--verbose$/){
863- $verbose= 1;
864- }
865- else {
866- die "Unknown option: $arg";
867- }
868-}
869-
870-my $path= shift(@ARGV); # Executable
871-
872-die "usage:\n" .
873- " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
874- unless defined $path || $found_double_dash;
875-
876-
877-message("started");
878-#message("path: '$path'");
879-message("parent: $parent_pid");
880-
881-# Start process to monitor
882-my $child_pid=
883- create_process(
884- path => $path,
885- args => \@ARGV,
886- setpgrp => 1,
887- );
888-message("Started child $child_pid");
889-
890-eval {
891- sub handle_signal {
892- $terminated= 1;
893- message("Got signal @_");
894-
895- # Ignore all signals
896- foreach my $name (keys %SIG){
897- $SIG{$name}= 'IGNORE';
898- }
899-
900- die "signaled\n";
901- };
902- local $SIG{TERM}= \&handle_signal;
903- local $SIG{INT}= \&handle_signal;
904- local $SIG{CHLD}= sub {
905- message("Got signal @_");
906- kill('KILL', -$child_pid);
907- my $ret= waitpid($child_pid, 0);
908- if ($? & 127){
909- exit(65); # Killed by signal
910- }
911- exit($? >> 8);
912- };
913-
914- # Monitoring loop
915- while(!$terminated) {
916-
917- # Check if parent is still alive
918- if (kill(0, $parent_pid) < 1){
919- message("Parent is not alive anymore");
920- last;
921- }
922-
923- # Wait for child to terminate but wakeup every
924- # second to also check that parent is still alive
925- my $ret_pid;
926- $ret_pid= waitpid($child_pid, &WNOHANG);
927- if ($ret_pid == $child_pid) {
928- # Process has exited, collect return status
929- my $ret_code= $? >> 8;
930- message("Child exit: $ret_code");
931- # Exit with exit status of the child
932- exit ($ret_code);
933- }
934- sleep(1);
935- }
936-};
937-if ( $@ ) {
938- # The monitoring loop should have been
939- # broken by handle_signal
940- warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
941-}
942-
943-# Use negative pid in order to kill the whole
944-# process group
945-#
946-my $ret= kill('KILL', -$child_pid);
947-message("Killed child: $child_pid, ret: $ret");
948-if ($ret > 0) {
949- message("Killed child: $child_pid");
950- # Wait blocking for the child to return
951- my $ret_pid= waitpid($child_pid, 0);
952- if ($ret_pid != $child_pid){
953- message("unexpected pid $ret_pid returned from waitpid($child_pid)");
954- }
955-}
956-
957-message("DONE!");
958-exit (1);
959-
960-
961
962=== modified file 'Percona-Server/mysql-test/mysql-test-run.pl'
963--- Percona-Server/mysql-test/mysql-test-run.pl 2012-08-20 03:14:02 +0000
964+++ Percona-Server/mysql-test/mysql-test-run.pl 2013-03-07 06:40:28 +0000
965@@ -618,6 +618,10 @@
966 else {
967 mtr_report("\nRetrying test $tname, ".
968 "attempt($retries/$opt_retry)...\n");
969+ #saving the log file as filename.failed in case of retry
970+ my $worker_logdir= $result->{savedir};
971+ my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
972+ rename $log_file_name,$log_file_name.".failed";
973 delete($result->{result});
974 $result->{retries}= $retries+1;
975 $result->write_test($sock, 'TESTCASE');
976
977=== modified file 'Percona-Server/mysql-test/r/ctype_ucs.result'
978--- Percona-Server/mysql-test/r/ctype_ucs.result 2011-03-03 15:39:26 +0000
979+++ Percona-Server/mysql-test/r/ctype_ucs.result 2013-03-07 06:40:28 +0000
980@@ -191,6 +191,32 @@
981 `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
982 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
983 DROP TABLE t1;
984+#
985+# Bug #51876 : crash/memory underrun when loading data with ucs2
986+# and reverse() function
987+#
988+# Problem # 1 (original report): wrong parsing of ucs2 data
989+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
990+CREATE TABLE t1(a INT);
991+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
992+(@b) SET a=REVERSE(@b);
993+# should return 2 zeroes (as the value is truncated)
994+SELECT * FROM t1;
995+a
996+0
997+1
998+DROP TABLE t1;
999+# Problem # 2 : if you write and read ucs2 data to a file they're lost
1000+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
1001+CREATE TABLE t1(a INT);
1002+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
1003+(@b) SET a=REVERSE(@b);
1004+# should return 0 and 1 (10 reversed)
1005+SELECT * FROM t1;
1006+a
1007+0
1008+1
1009+DROP TABLE t1;
1010 create table t2(f1 Char(30));
1011 insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
1012 select lpad(f1, 12, "-o-/") from t2;
1013
1014=== modified file 'Percona-Server/mysql-test/r/group_min_max_innodb.result'
1015--- Percona-Server/mysql-test/r/group_min_max_innodb.result 2008-06-27 18:50:53 +0000
1016+++ Percona-Server/mysql-test/r/group_min_max_innodb.result 2013-03-07 06:40:28 +0000
1017@@ -70,7 +70,7 @@
1018 1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
1019 explain select distinct f1, f2 from t1;
1020 id select_type table type possible_keys key key_len ref rows Extra
1021-1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
1022+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index
1023 drop table t1;
1024 create table t1(pk int primary key) engine=innodb;
1025 create view v1 as select pk from t1 where pk < 20;
1026
1027=== modified file 'Percona-Server/mysql-test/r/loaddata.result'
1028--- Percona-Server/mysql-test/r/loaddata.result 2011-05-10 13:57:40 +0000
1029+++ Percona-Server/mysql-test/r/loaddata.result 2013-03-07 06:40:28 +0000
1030@@ -504,35 +504,6 @@
1031 LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
1032 DROP TABLE t1;
1033 #
1034-# Bug #51876 : crash/memory underrun when loading data with ucs2
1035-# and reverse() function
1036-#
1037-# Problem # 1 (original report): wrong parsing of ucs2 data
1038-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
1039-CREATE TABLE t1(a INT);
1040-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
1041-(@b) SET a=REVERSE(@b);
1042-Warnings:
1043-Warning 1366 Incorrect integer value: '00' for column 'a' at row 1
1044-Warning 1366 Incorrect integer value: '10' for column 'a' at row 2
1045-# should return 2 zeroes (as the value is truncated)
1046-SELECT * FROM t1;
1047-a
1048-0
1049-0
1050-DROP TABLE t1;
1051-# Problem # 2 : if you write and read ucs2 data to a file they're lost
1052-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
1053-CREATE TABLE t1(a INT);
1054-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
1055-(@b) SET a=REVERSE(@b);
1056-# should return 0 and 1 (10 reversed)
1057-SELECT * FROM t1;
1058-a
1059-0
1060-1
1061-DROP TABLE t1;
1062-#
1063 # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
1064 #
1065 CREATE TABLE t1(f1 INT);
1066
1067=== modified file 'Percona-Server/mysql-test/r/percona_innodb_version.result'
1068--- Percona-Server/mysql-test/r/percona_innodb_version.result 2012-01-19 08:13:24 +0000
1069+++ Percona-Server/mysql-test/r/percona_innodb_version.result 2013-03-07 06:40:28 +0000
1070@@ -1,3 +1,3 @@
1071 SELECT @@innodb_version;
1072 @@innodb_version
1073-1.0.x-x.x
1074+5.1.x-x.x
1075
1076=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
1077--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2013-01-29 15:11:27 +0000
1078+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2013-03-07 06:40:28 +0000
1079@@ -120,6 +120,7 @@
1080 INNODB_IO_CAPACITY
1081 INNODB_KILL_IDLE_TRANSACTION
1082 INNODB_LAZY_DROP_TABLE
1083+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG
1084 INNODB_LOCKING_FAKE_CHANGES
1085 INNODB_LOCKS_UNSAFE_FOR_BINLOG
1086 INNODB_LOCK_WAIT_TIMEOUT
1087@@ -163,6 +164,7 @@
1088 INNODB_THREAD_CONCURRENCY_TIMER_BASED
1089 INNODB_THREAD_SLEEP_DELAY
1090 INNODB_TRACK_CHANGED_PAGES
1091+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
1092 INNODB_TRX_RSEG_N_SLOTS_DEBUG
1093 INNODB_USE_PURGE_THREAD
1094 INNODB_USE_SYS_MALLOC
1095
1096=== modified file 'Percona-Server/mysql-test/r/sp_notembedded.result'
1097--- Percona-Server/mysql-test/r/sp_notembedded.result 2012-03-28 06:35:31 +0000
1098+++ Percona-Server/mysql-test/r/sp_notembedded.result 2013-03-07 06:40:28 +0000
1099@@ -248,7 +248,6 @@
1100 DROP PROCEDURE p1;
1101 DELETE FROM mysql.user WHERE User='mysqltest_1';
1102 FLUSH PRIVILEGES;
1103-set @@global.concurrent_insert= @old_concurrent_insert;
1104 #
1105 # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
1106 #
1107@@ -302,3 +301,4 @@
1108 # ------------------------------------------------------------------
1109 # -- End of 5.1 tests
1110 # ------------------------------------------------------------------
1111+set @@global.concurrent_insert= @old_concurrent_insert;
1112
1113=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog-cp932.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result'
1114=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog2.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result'
1115=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_base64.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result'
1116=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result'
1117=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result'
1118=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result'
1119=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result'
1120=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932-master.opt' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt'
1121=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test'
1122=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog2.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test'
1123=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_base64.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test'
1124=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test'
1125=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test'
1126--- Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test 2008-08-20 14:06:31 +0000
1127+++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test 2013-03-07 06:40:28 +0000
1128@@ -20,5 +20,5 @@
1129 --source include/have_binlog_format_row.inc
1130 --source include/have_ucs2.inc
1131
1132---source include/mysqlbinlog_row_engine.inc
1133+--source extra/binlog_tests/mysqlbinlog_row_engine.inc
1134
1135
1136=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test'
1137--- Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test 2008-08-20 14:06:31 +0000
1138+++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test 2013-03-07 06:40:28 +0000
1139@@ -20,4 +20,4 @@
1140 --source include/have_binlog_format_row.inc
1141 --source include/have_ucs2.inc
1142
1143---source include/mysqlbinlog_row_engine.inc
1144+--source extra/binlog_tests/mysqlbinlog_row_engine.inc
1145
1146=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_trans.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test'
1147=== modified file 'Percona-Server/mysql-test/suite/engines/funcs/r/rpl_row_until.result'
1148--- Percona-Server/mysql-test/suite/engines/funcs/r/rpl_row_until.result 2011-01-05 06:46:07 +0000
1149+++ Percona-Server/mysql-test/suite/engines/funcs/r/rpl_row_until.result 2013-03-07 06:40:28 +0000
1150@@ -1,204 +1,60 @@
1151-stop slave;
1152-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
1153-reset master;
1154-reset slave;
1155-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
1156-start slave;
1157-stop slave;
1158-create table t1(n int not null auto_increment primary key);
1159-insert into t1 values (1),(2),(3),(4);
1160-drop table t1;
1161-create table t2(n int not null auto_increment primary key);
1162-insert into t2 values (1),(2);
1163-insert into t2 values (3),(4);
1164-drop table t2;
1165-start slave until master_log_file='master-bin.000001', master_log_pos=311;
1166-select * from t1;
1167-n
1168-1
1169-2
1170-3
1171-4
1172-show slave status;
1173-Slave_IO_State #
1174-Master_Host 127.0.0.1
1175-Master_User root
1176-Master_Port MASTER_MYPORT
1177-Connect_Retry 1
1178-Master_Log_File master-bin.000001
1179-Read_Master_Log_Pos #
1180-Relay_Log_File slave-relay-bin.000004
1181-Relay_Log_Pos #
1182-Relay_Master_Log_File master-bin.000001
1183-Slave_IO_Running #
1184-Slave_SQL_Running No
1185-Replicate_Do_DB
1186-Replicate_Ignore_DB
1187-Replicate_Do_Table
1188-Replicate_Ignore_Table
1189-Replicate_Wild_Do_Table
1190-Replicate_Wild_Ignore_Table
1191-Last_Errno 0
1192-Last_Error
1193-Skip_Counter 0
1194-Exec_Master_Log_Pos #
1195-Relay_Log_Space #
1196-Until_Condition Master
1197-Until_Log_File master-bin.000001
1198-Until_Log_Pos 311
1199-Master_SSL_Allowed No
1200-Master_SSL_CA_File
1201-Master_SSL_CA_Path
1202-Master_SSL_Cert
1203-Master_SSL_Cipher
1204-Master_SSL_Key
1205-Seconds_Behind_Master #
1206-Master_SSL_Verify_Server_Cert No
1207-Last_IO_Errno 0
1208-Last_IO_Error
1209-Last_SQL_Errno 0
1210-Last_SQL_Error
1211-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
1212-select * from t1;
1213-n 1
1214-n 2
1215-n 3
1216-n 4
1217-show slave status;
1218-Slave_IO_State #
1219-Master_Host 127.0.0.1
1220-Master_User root
1221-Master_Port MASTER_MYPORT
1222-Connect_Retry 1
1223-Master_Log_File master-bin.000001
1224-Read_Master_Log_Pos #
1225-Relay_Log_File slave-relay-bin.000004
1226-Relay_Log_Pos #
1227-Relay_Master_Log_File master-bin.000001
1228-Slave_IO_Running #
1229-Slave_SQL_Running No
1230-Replicate_Do_DB
1231-Replicate_Ignore_DB
1232-Replicate_Do_Table
1233-Replicate_Ignore_Table
1234-Replicate_Wild_Do_Table
1235-Replicate_Wild_Ignore_Table
1236-Last_Errno 0
1237-Last_Error
1238-Skip_Counter 0
1239-Exec_Master_Log_Pos #
1240-Relay_Log_Space #
1241-Until_Condition Master
1242-Until_Log_File master-no-such-bin.000001
1243-Until_Log_Pos 291
1244-Master_SSL_Allowed No
1245-Master_SSL_CA_File
1246-Master_SSL_CA_Path
1247-Master_SSL_Cert
1248-Master_SSL_Cipher
1249-Master_SSL_Key
1250-Seconds_Behind_Master #
1251-Master_SSL_Verify_Server_Cert No
1252-Last_IO_Errno 0
1253-Last_IO_Error
1254-Last_SQL_Errno 0
1255-Last_SQL_Error
1256-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
1257-select * from t2;
1258-show slave status;
1259-Slave_IO_State #
1260-Master_Host 127.0.0.1
1261-Master_User root
1262-Master_Port MASTER_MYPORT
1263-Connect_Retry 1
1264-Master_Log_File master-bin.000001
1265-Read_Master_Log_Pos #
1266-Relay_Log_File slave-relay-bin.000004
1267-Relay_Log_Pos #
1268-Relay_Master_Log_File master-bin.000001
1269-Slave_IO_Running #
1270-Slave_SQL_Running No
1271-Replicate_Do_DB
1272-Replicate_Ignore_DB
1273-Replicate_Do_Table
1274-Replicate_Ignore_Table
1275-Replicate_Wild_Do_Table
1276-Replicate_Wild_Ignore_Table
1277-Last_Errno 0
1278-Last_Error
1279-Skip_Counter 0
1280-Exec_Master_Log_Pos #
1281-Relay_Log_Space #
1282-Until_Condition Relay
1283-Until_Log_File slave-relay-bin.000004
1284-Until_Log_Pos 728
1285-Master_SSL_Allowed No
1286-Master_SSL_CA_File
1287-Master_SSL_CA_Path
1288-Master_SSL_Cert
1289-Master_SSL_Cipher
1290-Master_SSL_Key
1291-Seconds_Behind_Master #
1292-Master_SSL_Verify_Server_Cert No
1293-Last_IO_Errno 0
1294-Last_IO_Error
1295-Last_SQL_Errno 0
1296-Last_SQL_Error
1297-start slave;
1298-stop slave;
1299-start slave until master_log_file='master-bin.000001', master_log_pos=740;
1300-show slave status;
1301-Slave_IO_State #
1302-Master_Host 127.0.0.1
1303-Master_User root
1304-Master_Port MASTER_MYPORT
1305-Connect_Retry 1
1306-Master_Log_File master-bin.000001
1307-Read_Master_Log_Pos #
1308-Relay_Log_File slave-relay-bin.000004
1309-Relay_Log_Pos #
1310-Relay_Master_Log_File master-bin.000001
1311-Slave_IO_Running Yes
1312-Slave_SQL_Running No
1313-Replicate_Do_DB
1314-Replicate_Ignore_DB
1315-Replicate_Do_Table
1316-Replicate_Ignore_Table
1317-Replicate_Wild_Do_Table
1318-Replicate_Wild_Ignore_Table
1319-Last_Errno 0
1320-Last_Error
1321-Skip_Counter 0
1322-Exec_Master_Log_Pos #
1323-Relay_Log_Space #
1324-Until_Condition Master
1325-Until_Log_File master-bin.000001
1326-Until_Log_Pos 740
1327-Master_SSL_Allowed No
1328-Master_SSL_CA_File
1329-Master_SSL_CA_Path
1330-Master_SSL_Cert
1331-Master_SSL_Cipher
1332-Master_SSL_Key
1333-Seconds_Behind_Master #
1334-Master_SSL_Verify_Server_Cert No
1335-Last_IO_Errno 0
1336-Last_IO_Error
1337-Last_SQL_Errno 0
1338-Last_SQL_Error
1339-start slave until master_log_file='master-bin', master_log_pos=561;
1340-ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1341-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
1342-ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1343-start slave until master_log_file='master-bin.000001';
1344-ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1345-start slave until relay_log_file='slave-relay-bin.000002';
1346-ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1347-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
1348-ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1349-start slave sql_thread;
1350-start slave until master_log_file='master-bin.000001', master_log_pos=740;
1351+include/master-slave.inc
1352+[connection master]
1353+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
1354+INSERT INTO t1 VALUES (1),(2),(3),(4);
1355+DROP TABLE t1;
1356+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
1357+INSERT INTO t2 VALUES (1),(2);
1358+INSERT INTO t2 VALUES (3),(4);
1359+DROP TABLE t2;
1360+include/stop_slave.inc
1361+RESET SLAVE;
1362+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
1363+include/wait_for_slave_sql_to_stop.inc
1364+SELECT * FROM t1;
1365+n
1366+1
1367+2
1368+3
1369+4
1370+include/check_slave_param.inc [Exec_Master_Log_Pos]
1371+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
1372+include/wait_for_slave_sql_to_stop.inc
1373+SELECT * FROM t1;
1374+n
1375+1
1376+2
1377+3
1378+4
1379+include/check_slave_param.inc [Exec_Master_Log_Pos]
1380+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
1381+include/wait_for_slave_sql_to_stop.inc
1382+SELECT * FROM t2;
1383+n
1384+1
1385+2
1386+include/check_slave_param.inc [Exec_Master_Log_Pos]
1387+START SLAVE;
1388+include/wait_for_slave_to_start.inc
1389+include/stop_slave.inc
1390+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
1391+include/wait_for_slave_param.inc [Until_Log_Pos]
1392+include/wait_for_slave_sql_to_stop.inc
1393+include/check_slave_param.inc [Exec_Master_Log_Pos]
1394+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS;
1395+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1396+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS;
1397+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1398+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
1399+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1400+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
1401+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1402+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
1403+ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
1404+START SLAVE;
1405+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
1406 Warnings:
1407-Level Note
1408-Code 1254
1409-Message Slave is already running
1410+Note 1254 Slave is already running
1411+include/stop_slave.inc
1412+RESET SLAVE;
1413+include/rpl_end.inc
1414
1415=== modified file 'Percona-Server/mysql-test/suite/engines/funcs/t/disabled.def'
1416--- Percona-Server/mysql-test/suite/engines/funcs/t/disabled.def 2011-01-05 06:46:07 +0000
1417+++ Percona-Server/mysql-test/suite/engines/funcs/t/disabled.def 2013-03-07 06:40:28 +0000
1418@@ -72,7 +72,6 @@
1419 rpl_skip_error : Result Difference Due to Change in .inc file
1420 rpl_sp : Result Difference Due to Change in .inc file
1421
1422-rpl_row_until : Test Present in rpl suite as well . Test Fails with table t2 not found.
1423 rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation.
1424 rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation.
1425 rpl_row_NOW : Result Difference Due to Change in .inc file
1426
1427=== modified file 'Percona-Server/mysql-test/suite/engines/funcs/t/rpl_row_until.test'
1428--- Percona-Server/mysql-test/suite/engines/funcs/t/rpl_row_until.test 2011-01-05 06:46:07 +0000
1429+++ Percona-Server/mysql-test/suite/engines/funcs/t/rpl_row_until.test 2013-03-07 06:40:28 +0000
1430@@ -2,90 +2,126 @@
1431 -- source include/have_binlog_format_row.inc
1432 -- source include/master-slave.inc
1433
1434-# Test is dependent on binlog positions
1435-
1436-# prepare version for substitutions
1437-let $VERSION=`select version()`;
1438-
1439-# stop slave before he will start replication also sync with master
1440-# for avoiding undetermenistic behaviour
1441-save_master_pos;
1442-connection slave;
1443-sync_with_master;
1444-stop slave;
1445-
1446-connection master;
1447-# create some events on master
1448-create table t1(n int not null auto_increment primary key);
1449-insert into t1 values (1),(2),(3),(4);
1450-drop table t1;
1451-create table t2(n int not null auto_increment primary key);
1452-insert into t2 values (1),(2);
1453-insert into t2 values (3),(4);
1454-drop table t2;
1455-
1456-# try to replicate all queries until drop of t1
1457-connection slave;
1458-start slave until master_log_file='master-bin.000001', master_log_pos=311;
1459-sleep 2;
1460-wait_for_slave_to_stop;
1461-# here table should be still not deleted
1462-select * from t1;
1463---vertical_results
1464---replace_result $MASTER_MYPORT MASTER_MYPORT
1465---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
1466-show slave status;
1467-
1468-# this should fail right after start
1469-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
1470+# Note: The test is dependent on binlog positions
1471+
1472+# Create some events on master
1473+connection master;
1474+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
1475+INSERT INTO t1 VALUES (1),(2),(3),(4);
1476+DROP TABLE t1;
1477+# Save master log position for query DROP TABLE t1
1478+save_master_pos;
1479+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
1480+let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
1481+
1482+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
1483+# Save master log position for query CREATE TABLE t2
1484+save_master_pos;
1485+let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
1486+
1487+INSERT INTO t2 VALUES (1),(2);
1488+save_master_pos;
1489+# Save master log position for query INSERT INTO t2 VALUES (1),(2);
1490+let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
1491+sync_slave_with_master;
1492+
1493+# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
1494+let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
1495+
1496+connection master;
1497+INSERT INTO t2 VALUES (3),(4);
1498+DROP TABLE t2;
1499+# Save master log position for query INSERT INTO t2 VALUES (1),(2);
1500+let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
1501+sync_slave_with_master;
1502+
1503+--source include/stop_slave.inc
1504+# Reset slave.
1505+RESET SLAVE;
1506+--disable_query_log
1507+eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
1508+--enable_query_log
1509+
1510+# Try to replicate all queries until drop of t1
1511+connection slave;
1512+echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
1513+--disable_query_log
1514+eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
1515+--enable_query_log
1516+--source include/wait_for_slave_sql_to_stop.inc
1517+
1518+# Here table should be still not deleted
1519+SELECT * FROM t1;
1520+--let $slave_param= Exec_Master_Log_Pos
1521+--let $slave_param_value= $master_pos_drop_t1
1522+--source include/check_slave_param.inc
1523+
1524+# This should fail right after start
1525+--replace_result 291 MASTER_LOG_POS
1526+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
1527+--source include/wait_for_slave_sql_to_stop.inc
1528 # again this table should be still not deleted
1529-select * from t1;
1530-sleep 2;
1531-wait_for_slave_to_stop;
1532---vertical_results
1533---replace_result $MASTER_MYPORT MASTER_MYPORT
1534---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
1535-show slave status;
1536-
1537-# try replicate all up to and not including the second insert to t2;
1538-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
1539-sleep 2;
1540-wait_for_slave_to_stop;
1541-select * from t2;
1542---vertical_results
1543---replace_result $MASTER_MYPORT MASTER_MYPORT
1544---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
1545-show slave status;
1546+SELECT * FROM t1;
1547+
1548+--let $slave_param= Exec_Master_Log_Pos
1549+--let $slave_param_value= $master_pos_drop_t1
1550+--source include/check_slave_param.inc
1551+
1552+# Try replicate all up to and not including the second insert to t2;
1553+echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
1554+--disable_query_log
1555+eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
1556+--enable_query_log
1557+--source include/wait_for_slave_sql_to_stop.inc
1558+SELECT * FROM t2;
1559+
1560+--let $slave_param= Exec_Master_Log_Pos
1561+--let $slave_param_value= $master_pos_insert1_t2
1562+--source include/check_slave_param.inc
1563
1564 # clean up
1565-start slave;
1566+START SLAVE;
1567+--source include/wait_for_slave_to_start.inc
1568 connection master;
1569-save_master_pos;
1570-connection slave;
1571-sync_with_master;
1572-stop slave;
1573+sync_slave_with_master;
1574+--source include/stop_slave.inc
1575
1576-# this should stop immediately as we are already there
1577-start slave until master_log_file='master-bin.000001', master_log_pos=740;
1578-sleep 2;
1579-wait_for_slave_to_stop;
1580+# This should stop immediately as we are already there
1581+echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
1582+--disable_query_log
1583+eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
1584+--enable_query_log
1585+let $slave_param= Until_Log_Pos;
1586+let $slave_param_value= $master_pos_create_t2;
1587+--source include/wait_for_slave_param.inc
1588+--source include/wait_for_slave_sql_to_stop.inc
1589 # here the sql slave thread should be stopped
1590---vertical_results
1591---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
1592---replace_column 1 # 7 # 9 # 22 # 23 # 33 #
1593-show slave status;
1594+--let $slave_param= Exec_Master_Log_Pos
1595+--let $slave_param_value= $master_pos_drop_t2
1596+--source include/check_slave_param.inc
1597
1598 #testing various error conditions
1599---error 1277
1600-start slave until master_log_file='master-bin', master_log_pos=561;
1601---error 1277
1602-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
1603---error 1277
1604-start slave until master_log_file='master-bin.000001';
1605---error 1277
1606-start slave until relay_log_file='slave-relay-bin.000002';
1607---error 1277
1608-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
1609+--replace_result 561 MASTER_LOG_POS
1610+--error 1277
1611+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
1612+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
1613+--error 1277
1614+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
1615+--error 1277
1616+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
1617+--error 1277
1618+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
1619+--replace_result 561 MASTER_LOG_POS
1620+--error 1277
1621+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
1622 # Warning should be given for second command
1623-start slave sql_thread;
1624-start slave until master_log_file='master-bin.000001', master_log_pos=740;
1625+START SLAVE;
1626+--replace_result 740 MASTER_LOG_POS
1627+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
1628+
1629+--source include/stop_slave.inc
1630+# Clear slave IO error.
1631+RESET SLAVE;
1632+
1633+--let $rpl_only_running_threads= 1
1634+--source include/rpl_end.inc
1635
1636=== added file 'Percona-Server/mysql-test/suite/innodb/r/innodb_bug14676111.result'
1637--- Percona-Server/mysql-test/suite/innodb/r/innodb_bug14676111.result 1970-01-01 00:00:00 +0000
1638+++ Percona-Server/mysql-test/suite/innodb/r/innodb_bug14676111.result 2013-03-07 06:40:28 +0000
1639@@ -0,0 +1,53 @@
1640+drop table if exists t1;
1641+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
1642+set global innodb_limit_optimistic_insert_debug = 2;
1643+insert into t1 values (1);
1644+insert into t1 values (5);
1645+insert into t1 values (4);
1646+insert into t1 values (3);
1647+insert into t1 values (2);
1648+analyze table t1;
1649+Table Op Msg_type Msg_text
1650+test.t1 analyze status OK
1651+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1652+DATA_LENGTH / 16384
1653+10.0000
1654+delete from t1 where a=4;
1655+analyze table t1;
1656+Table Op Msg_type Msg_text
1657+test.t1 analyze status OK
1658+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1659+DATA_LENGTH / 16384
1660+8.0000
1661+delete from t1 where a=5;
1662+analyze table t1;
1663+Table Op Msg_type Msg_text
1664+test.t1 analyze status OK
1665+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1666+DATA_LENGTH / 16384
1667+5.0000
1668+set global innodb_limit_optimistic_insert_debug = 10000;
1669+delete from t1 where a=2;
1670+analyze table t1;
1671+Table Op Msg_type Msg_text
1672+test.t1 analyze status OK
1673+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1674+DATA_LENGTH / 16384
1675+3.0000
1676+insert into t1 values (2);
1677+delete from t1 where a=2;
1678+analyze table t1;
1679+Table Op Msg_type Msg_text
1680+test.t1 analyze status OK
1681+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1682+DATA_LENGTH / 16384
1683+2.0000
1684+insert into t1 values (2);
1685+delete from t1 where a=2;
1686+analyze table t1;
1687+Table Op Msg_type Msg_text
1688+test.t1 analyze status OK
1689+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1690+DATA_LENGTH / 16384
1691+1.0000
1692+drop table t1;
1693
1694=== added file 'Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result'
1695--- Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 1970-01-01 00:00:00 +0000
1696+++ Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 2013-03-07 06:40:28 +0000
1697@@ -0,0 +1,53 @@
1698+use test;
1699+drop table if exists t1;
1700+create table t1 (id int primary key, value int, value2 int,
1701+value3 int, index(value,value2)) engine=innodb;
1702+insert into t1 values
1703+(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
1704+(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
1705+(20,20,20,20);
1706+use test;
1707+start transaction with consistent snapshot;
1708+use test;
1709+CREATE PROCEDURE update_t1()
1710+BEGIN
1711+DECLARE i INT DEFAULT 1;
1712+while (i <= 5000) DO
1713+update test.t1 set value2=value2+1, value3=value3+1 where id=12;
1714+SET i = i + 1;
1715+END WHILE;
1716+END|
1717+set autocommit=0;
1718+CALL update_t1();
1719+select * from t1;
1720+id value value2 value3
1721+10 10 10 10
1722+11 11 11 11
1723+12 12 5012 5012
1724+13 13 13 13
1725+14 14 14 14
1726+15 15 15 15
1727+16 16 16 16
1728+17 17 17 17
1729+18 18 18 18
1730+19 19 19 19
1731+20 20 20 20
1732+set autocommit=1;
1733+select * from t1;
1734+id value value2 value3
1735+10 10 10 10
1736+11 11 11 11
1737+12 12 5012 5012
1738+13 13 13 13
1739+14 14 14 14
1740+15 15 15 15
1741+16 16 16 16
1742+17 17 17 17
1743+18 18 18 18
1744+19 19 19 19
1745+20 20 20 20
1746+select * from t1 force index(value) where value=12;
1747+kill query @id;
1748+ERROR 70100: Query execution was interrupted
1749+drop procedure if exists update_t1;
1750+drop table if exists t1;
1751
1752=== added file 'Percona-Server/mysql-test/suite/innodb/t/innodb_bug14676111.test'
1753--- Percona-Server/mysql-test/suite/innodb/t/innodb_bug14676111.test 1970-01-01 00:00:00 +0000
1754+++ Percona-Server/mysql-test/suite/innodb/t/innodb_bug14676111.test 2013-03-07 06:40:28 +0000
1755@@ -0,0 +1,128 @@
1756+# Test for bug #14676111: WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP()
1757+
1758+-- source include/have_innodb.inc
1759+-- source include/have_debug.inc
1760+
1761+if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
1762+{
1763+ --skip Test requires InnoDB built with UNIV_DEBUG definition.
1764+}
1765+
1766+--disable_query_log
1767+set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
1768+--enable_query_log
1769+--disable_warnings
1770+drop table if exists t1;
1771+--enable_warnings
1772+
1773+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
1774+
1775+let $wait_condition=
1776+ SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS
1777+ WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';
1778+
1779+#
1780+# make 4 leveled straight tree
1781+#
1782+set global innodb_limit_optimistic_insert_debug = 2;
1783+insert into t1 values (1);
1784+insert into t1 values (5);
1785+#current tree form
1786+# (1, 5)
1787+
1788+insert into t1 values (4);
1789+#records in a page is limited to 2 artificially. root rise occurs
1790+#current tree form
1791+# (1, 5)
1792+#(1, 4) (5)
1793+
1794+insert into t1 values (3);
1795+#current tree form
1796+# (1, 5)
1797+# (1, 4) (5)
1798+#(1, 3) (4) (5)
1799+
1800+insert into t1 values (2);
1801+#current tree form
1802+# (1, 5)
1803+# (1, 4) (5)
1804+# (1, 3) (4) (5)
1805+#(1, 2) (3) (4) (5)
1806+
1807+analyze table t1;
1808+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1809+
1810+delete from t1 where a=4;
1811+--source include/wait_condition.inc
1812+#deleting 1 record of 2 records don't cause merge artificially.
1813+#current tree form
1814+# (1, 5)
1815+# (1) (5)
1816+# (1, 3) (5)
1817+#(1, 2) (3) (5)
1818+
1819+analyze table t1;
1820+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1821+
1822+delete from t1 where a=5;
1823+--source include/wait_condition.inc
1824+#deleting 1 record of 2 records don't cause merge artificially.
1825+#current tree form
1826+# (1)
1827+# (1)
1828+# (1, 3) <- lift up this level next, when deleting node ptr
1829+#(1, 2) (3) <- merged next
1830+
1831+analyze table t1;
1832+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1833+
1834+#
1835+# cause merge at level 0
1836+#
1837+
1838+#disable the artificial limitation of records in a page
1839+set global innodb_limit_optimistic_insert_debug = 10000;
1840+delete from t1 where a=2;
1841+--source include/wait_condition.inc
1842+#merge page occurs. and lift up occurs.
1843+#current tree form
1844+# (1)
1845+# (1)
1846+# (1, 3)
1847+
1848+analyze table t1;
1849+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1850+
1851+insert into t1 values (2);
1852+#current tree form
1853+# (1)
1854+# (1) <- lift up this level next, because it is not root
1855+# (1, 2, 3)
1856+
1857+delete from t1 where a=2;
1858+--source include/wait_condition.inc
1859+#current tree form
1860+# (1)
1861+# (1, 3)
1862+
1863+analyze table t1;
1864+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1865+
1866+insert into t1 values (2);
1867+#current tree form
1868+# (1)
1869+# (1, 2, 3) <- lift up this level next, because the father is root
1870+
1871+delete from t1 where a=2;
1872+--source include/wait_condition.inc
1873+#current tree form
1874+# (1, 3)
1875+
1876+analyze table t1;
1877+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
1878+
1879+drop table t1;
1880+
1881+--disable_query_log
1882+set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
1883+--enable_query_log
1884
1885=== added file 'Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test'
1886--- Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 1970-01-01 00:00:00 +0000
1887+++ Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 2013-03-07 06:40:28 +0000
1888@@ -0,0 +1,95 @@
1889+--source include/have_innodb.inc
1890+
1891+#
1892+# create test-bed to run test
1893+#
1894+use test;
1895+--disable_warnings
1896+drop table if exists t1;
1897+--enable_warnings
1898+create table t1 (id int primary key, value int, value2 int,
1899+value3 int, index(value,value2)) engine=innodb;
1900+
1901+insert into t1 values
1902+(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
1903+(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
1904+(20,20,20,20);
1905+let $ID= `SELECT @id := CONNECTION_ID()`;
1906+
1907+#
1908+# we need multiple connections as we need to keep one connection
1909+# active with trx requesting consistent read.
1910+#
1911+connect (conn1, localhost, root,,);
1912+connect (conn2, localhost, root,,);
1913+connect (conn3, localhost, root,,);
1914+
1915+#
1916+# start trx with consistent read
1917+#
1918+connection conn1;
1919+use test;
1920+
1921+start transaction with consistent snapshot;
1922+
1923+#
1924+# update table such that secondary index is updated.
1925+#
1926+connection conn2;
1927+use test;
1928+delimiter |;
1929+CREATE PROCEDURE update_t1()
1930+BEGIN
1931+ DECLARE i INT DEFAULT 1;
1932+ while (i <= 5000) DO
1933+ update test.t1 set value2=value2+1, value3=value3+1 where id=12;
1934+ SET i = i + 1;
1935+ END WHILE;
1936+END|
1937+
1938+delimiter ;|
1939+set autocommit=0;
1940+CALL update_t1();
1941+select * from t1;
1942+set autocommit=1;
1943+select * from t1;
1944+
1945+#
1946+# Now try to fire select query from connection-1 enforcing
1947+# use of secondary index.
1948+#
1949+connection conn1;
1950+let $ID= `SELECT @id := CONNECTION_ID()`;
1951+#--error ER_QUERY_INTERRUPTED
1952+--send
1953+select * from t1 force index(value) where value=12;
1954+
1955+#
1956+# select is going to take good time so let's kill query.
1957+#
1958+connection conn3;
1959+let $wait_condition=
1960+ select * from information_schema.processlist where state = 'Sending data' and
1961+ info = 'select * from t1 force index(value) where value=12';
1962+--source include/wait_condition.inc
1963+let $ignore= `SELECT @id := $ID`;
1964+kill query @id;
1965+
1966+#
1967+# reap the value of connection-1
1968+#
1969+connection conn1;
1970+--error ER_QUERY_INTERRUPTED
1971+reap;
1972+
1973+#
1974+# clean test-bed.
1975+#
1976+connection default;
1977+disconnect conn1;
1978+disconnect conn2;
1979+disconnect conn3;
1980+drop procedure if exists update_t1;
1981+drop table if exists t1;
1982+
1983+
1984
1985=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result'
1986--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result 2012-08-31 10:12:00 +0000
1987+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result 2013-03-07 06:40:28 +0000
1988@@ -963,7 +963,7 @@
1989 test.t1 check status OK
1990 explain select * from t1 where b like 'adfd%';
1991 id select_type table type possible_keys key key_len ref rows Extra
1992-1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
1993+1 SIMPLE t1 range b b 769 NULL # Using where
1994 create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
1995 insert into t2 select a,left(b,255) from t1;
1996 drop table t1;
1997
1998=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14676111.result'
1999--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14676111.result 1970-01-01 00:00:00 +0000
2000+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14676111.result 2013-03-07 06:40:28 +0000
2001@@ -0,0 +1,53 @@
2002+drop table if exists t1;
2003+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
2004+set global innodb_limit_optimistic_insert_debug = 2;
2005+insert into t1 values (1);
2006+insert into t1 values (5);
2007+insert into t1 values (4);
2008+insert into t1 values (3);
2009+insert into t1 values (2);
2010+analyze table t1;
2011+Table Op Msg_type Msg_text
2012+test.t1 analyze status OK
2013+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2014+DATA_LENGTH / 16384
2015+10.0000
2016+delete from t1 where a=4;
2017+analyze table t1;
2018+Table Op Msg_type Msg_text
2019+test.t1 analyze status OK
2020+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2021+DATA_LENGTH / 16384
2022+8.0000
2023+delete from t1 where a=5;
2024+analyze table t1;
2025+Table Op Msg_type Msg_text
2026+test.t1 analyze status OK
2027+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2028+DATA_LENGTH / 16384
2029+5.0000
2030+set global innodb_limit_optimistic_insert_debug = 10000;
2031+delete from t1 where a=2;
2032+analyze table t1;
2033+Table Op Msg_type Msg_text
2034+test.t1 analyze status OK
2035+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2036+DATA_LENGTH / 16384
2037+3.0000
2038+insert into t1 values (2);
2039+delete from t1 where a=2;
2040+analyze table t1;
2041+Table Op Msg_type Msg_text
2042+test.t1 analyze status OK
2043+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2044+DATA_LENGTH / 16384
2045+2.0000
2046+insert into t1 values (2);
2047+delete from t1 where a=2;
2048+analyze table t1;
2049+Table Op Msg_type Msg_text
2050+test.t1 analyze status OK
2051+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2052+DATA_LENGTH / 16384
2053+1.0000
2054+drop table t1;
2055
2056=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_mysql.result'
2057--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_mysql.result 2011-11-24 02:01:46 +0000
2058+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_mysql.result 2013-03-07 06:40:28 +0000
2059@@ -343,7 +343,7 @@
2060 1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
2061 explain select distinct f1, f2 from t1;
2062 id select_type table type possible_keys key key_len ref rows Extra
2063-1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
2064+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index
2065 drop table t1;
2066 CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
2067 INDEX (name));
2068
2069=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/t/innodb-index.test'
2070--- Percona-Server/mysql-test/suite/innodb_plugin/t/innodb-index.test 2012-02-02 11:38:32 +0000
2071+++ Percona-Server/mysql-test/suite/innodb_plugin/t/innodb-index.test 2013-03-07 06:40:28 +0000
2072@@ -420,6 +420,10 @@
2073 length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
2074 show create table t1;
2075 check table t1;
2076+
2077+# In my local machine and in pb2 machine only the key_len field is differing.
2078+# So masking this problematic output.
2079+--replace_column 9 #
2080 explain select * from t1 where b like 'adfd%';
2081
2082 #
2083
2084=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14676111.test'
2085--- Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14676111.test 1970-01-01 00:00:00 +0000
2086+++ Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14676111.test 2013-03-07 06:40:28 +0000
2087@@ -0,0 +1,128 @@
2088+# Test for bug #14676111: WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP()
2089+
2090+-- source include/have_innodb_plugin.inc
2091+-- source include/have_debug.inc
2092+
2093+if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
2094+{
2095+ --skip Test requires InnoDB built with UNIV_DEBUG definition.
2096+}
2097+
2098+--disable_query_log
2099+set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
2100+--enable_query_log
2101+--disable_warnings
2102+drop table if exists t1;
2103+--enable_warnings
2104+
2105+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
2106+
2107+let $wait_condition=
2108+ SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS
2109+ WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';
2110+
2111+#
2112+# make 4 leveled straight tree
2113+#
2114+set global innodb_limit_optimistic_insert_debug = 2;
2115+insert into t1 values (1);
2116+insert into t1 values (5);
2117+#current tree form
2118+# (1, 5)
2119+
2120+insert into t1 values (4);
2121+#records in a page is limited to 2 artificially. root rise occurs
2122+#current tree form
2123+# (1, 5)
2124+#(1, 4) (5)
2125+
2126+insert into t1 values (3);
2127+#current tree form
2128+# (1, 5)
2129+# (1, 4) (5)
2130+#(1, 3) (4) (5)
2131+
2132+insert into t1 values (2);
2133+#current tree form
2134+# (1, 5)
2135+# (1, 4) (5)
2136+# (1, 3) (4) (5)
2137+#(1, 2) (3) (4) (5)
2138+
2139+analyze table t1;
2140+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2141+
2142+delete from t1 where a=4;
2143+--source include/wait_condition.inc
2144+#deleting 1 record of 2 records don't cause merge artificially.
2145+#current tree form
2146+# (1, 5)
2147+# (1) (5)
2148+# (1, 3) (5)
2149+#(1, 2) (3) (5)
2150+
2151+analyze table t1;
2152+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2153+
2154+delete from t1 where a=5;
2155+--source include/wait_condition.inc
2156+#deleting 1 record of 2 records don't cause merge artificially.
2157+#current tree form
2158+# (1)
2159+# (1)
2160+# (1, 3) <- lift up this level next, when deleting node ptr
2161+#(1, 2) (3) <- merged next
2162+
2163+analyze table t1;
2164+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2165+
2166+#
2167+# cause merge at level 0
2168+#
2169+
2170+#disable the artificial limitation of records in a page
2171+set global innodb_limit_optimistic_insert_debug = 10000;
2172+delete from t1 where a=2;
2173+--source include/wait_condition.inc
2174+#merge page occurs. and lift up occurs.
2175+#current tree form
2176+# (1)
2177+# (1)
2178+# (1, 3)
2179+
2180+analyze table t1;
2181+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2182+
2183+insert into t1 values (2);
2184+#current tree form
2185+# (1)
2186+# (1) <- lift up this level next, because it is not root
2187+# (1, 2, 3)
2188+
2189+delete from t1 where a=2;
2190+--source include/wait_condition.inc
2191+#current tree form
2192+# (1)
2193+# (1, 3)
2194+
2195+analyze table t1;
2196+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2197+
2198+insert into t1 values (2);
2199+#current tree form
2200+# (1)
2201+# (1, 2, 3) <- lift up this level next, because the father is root
2202+
2203+delete from t1 where a=2;
2204+--source include/wait_condition.inc
2205+#current tree form
2206+# (1, 3)
2207+
2208+analyze table t1;
2209+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
2210+
2211+drop table t1;
2212+
2213+--disable_query_log
2214+set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
2215+--enable_query_log
2216
2217=== modified file 'Percona-Server/mysql-test/suite/parts/r/partition_alter4_innodb.result'
2218--- Percona-Server/mysql-test/suite/parts/r/partition_alter4_innodb.result 2008-11-04 07:43:21 +0000
2219+++ Percona-Server/mysql-test/suite/parts/r/partition_alter4_innodb.result 2013-03-07 06:40:28 +0000
2220@@ -37566,7 +37566,7 @@
2221 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2222 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2223 Table Op Msg_type Msg_text
2224-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2225+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2226 test.t1 optimize status OK
2227 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2228 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2229@@ -38026,7 +38026,7 @@
2230 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2231 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2232 Table Op Msg_type Msg_text
2233-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2234+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2235 test.t1 optimize status OK
2236 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2237 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2238@@ -38497,7 +38497,7 @@
2239 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2240 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2241 Table Op Msg_type Msg_text
2242-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2243+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2244 test.t1 optimize status OK
2245 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2246 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2247@@ -38969,7 +38969,7 @@
2248 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2249 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2250 Table Op Msg_type Msg_text
2251-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2252+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2253 test.t1 optimize status OK
2254 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2255 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2256@@ -39435,7 +39435,7 @@
2257 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2258 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2259 Table Op Msg_type Msg_text
2260-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2261+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2262 test.t1 optimize status OK
2263 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2264 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2265@@ -39907,7 +39907,7 @@
2266 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2267 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2268 Table Op Msg_type Msg_text
2269-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2270+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2271 test.t1 optimize status OK
2272 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2273 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2274@@ -40384,7 +40384,7 @@
2275 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2276 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2277 Table Op Msg_type Msg_text
2278-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2279+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2280 test.t1 optimize status OK
2281 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2282 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2283@@ -40859,7 +40859,7 @@
2284 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2285 ALTER TABLE t1 OPTIMIZE PARTITION part_1;
2286 Table Op Msg_type Msg_text
2287-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2288+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2289 test.t1 optimize status OK
2290 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2291 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2292@@ -41324,7 +41324,7 @@
2293 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2294 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2295 Table Op Msg_type Msg_text
2296-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2297+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2298 test.t1 optimize status OK
2299 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2300 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2301@@ -41784,7 +41784,7 @@
2302 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2303 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2304 Table Op Msg_type Msg_text
2305-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2306+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2307 test.t1 optimize status OK
2308 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2309 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2310@@ -42255,7 +42255,7 @@
2311 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2312 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2313 Table Op Msg_type Msg_text
2314-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2315+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2316 test.t1 optimize status OK
2317 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2318 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2319@@ -42727,7 +42727,7 @@
2320 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2321 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2322 Table Op Msg_type Msg_text
2323-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2324+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2325 test.t1 optimize status OK
2326 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2327 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2328@@ -43193,7 +43193,7 @@
2329 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2330 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2331 Table Op Msg_type Msg_text
2332-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2333+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2334 test.t1 optimize status OK
2335 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2336 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2337@@ -43665,7 +43665,7 @@
2338 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2339 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2340 Table Op Msg_type Msg_text
2341-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2342+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2343 test.t1 optimize status OK
2344 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2345 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2346@@ -44142,7 +44142,7 @@
2347 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2348 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2349 Table Op Msg_type Msg_text
2350-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2351+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2352 test.t1 optimize status OK
2353 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2354 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2355@@ -44617,7 +44617,7 @@
2356 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2357 ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
2358 Table Op Msg_type Msg_text
2359-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2360+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2361 test.t1 optimize status OK
2362 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2363 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2364@@ -52582,7 +52582,7 @@
2365 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2366 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2367 Table Op Msg_type Msg_text
2368-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2369+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2370 test.t1 optimize status OK
2371 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2372 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2373@@ -53042,7 +53042,7 @@
2374 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2375 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2376 Table Op Msg_type Msg_text
2377-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2378+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2379 test.t1 optimize status OK
2380 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2381 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2382@@ -53513,7 +53513,7 @@
2383 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2384 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2385 Table Op Msg_type Msg_text
2386-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2387+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2388 test.t1 optimize status OK
2389 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2390 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2391@@ -53985,7 +53985,7 @@
2392 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2393 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2394 Table Op Msg_type Msg_text
2395-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2396+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2397 test.t1 optimize status OK
2398 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2399 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2400@@ -54451,7 +54451,7 @@
2401 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2402 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2403 Table Op Msg_type Msg_text
2404-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2405+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2406 test.t1 optimize status OK
2407 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2408 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2409@@ -54923,7 +54923,7 @@
2410 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2411 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2412 Table Op Msg_type Msg_text
2413-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2414+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2415 test.t1 optimize status OK
2416 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2417 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2418@@ -55400,7 +55400,7 @@
2419 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2420 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2421 Table Op Msg_type Msg_text
2422-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2423+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2424 test.t1 optimize status OK
2425 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2426 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2427@@ -55875,7 +55875,7 @@
2428 WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
2429 ALTER TABLE t1 OPTIMIZE PARTITION ALL;
2430 Table Op Msg_type Msg_text
2431-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2432+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
2433 test.t1 optimize status OK
2434 INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
2435 SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
2436
2437=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_row_until.result'
2438--- Percona-Server/mysql-test/suite/rpl/r/rpl_row_until.result 2010-12-19 17:07:28 +0000
2439+++ Percona-Server/mysql-test/suite/rpl/r/rpl_row_until.result 2013-03-07 06:40:28 +0000
2440@@ -27,7 +27,6 @@
2441 3
2442 4
2443 include/check_slave_param.inc [Exec_Master_Log_Pos]
2444-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
2445 include/wait_for_slave_sql_to_stop.inc
2446 SELECT * FROM t2;
2447 n
2448
2449=== modified file 'Percona-Server/mysql-test/suite/rpl/t/disabled.def'
2450--- Percona-Server/mysql-test/suite/rpl/t/disabled.def 2011-05-24 06:38:13 +0000
2451+++ Percona-Server/mysql-test/suite/rpl/t/disabled.def 2013-03-07 06:40:28 +0000
2452@@ -12,5 +12,5 @@
2453
2454 rpl_row_create_table : Bug#11759274 Feb 27 2010 andrei failed different way than earlier with bug#45576
2455 rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
2456-rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
2457 rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
2458+rpl_row_until @macosx : BUG#15965353 RPL.RPL_ROW_UNTIL FAILS ON PB2 , PLATFORM= MACOSX10.6 X86_64 MAX
2459
2460=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_row_until.test'
2461--- Percona-Server/mysql-test/suite/rpl/t/rpl_row_until.test 2011-05-05 23:46:53 +0000
2462+++ Percona-Server/mysql-test/suite/rpl/t/rpl_row_until.test 2013-03-07 06:40:28 +0000
2463@@ -26,6 +26,7 @@
2464 sync_slave_with_master;
2465
2466 # Save relay log position for query INSERT INTO t2 VALUES (1),(2);
2467+let $relay_log_file= query_get_value(show slave status, Relay_Log_File,1);
2468 let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
2469
2470 connection master;
2471@@ -68,9 +69,8 @@
2472 --source include/check_slave_param.inc
2473
2474 # Try replicate all up to and not including the second insert to t2;
2475-echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
2476 --disable_query_log
2477-eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
2478+eval START SLAVE UNTIL RELAY_LOG_FILE='$relay_log_file', RELAY_LOG_POS=$relay_pos_insert1_t2;
2479 --enable_query_log
2480 --source include/wait_for_slave_sql_to_stop.inc
2481 SELECT * FROM t2;
2482
2483=== modified file 'Percona-Server/mysql-test/t/ctype_ucs.test'
2484--- Percona-Server/mysql-test/t/ctype_ucs.test 2011-03-03 15:39:26 +0000
2485+++ Percona-Server/mysql-test/t/ctype_ucs.test 2013-03-07 06:40:28 +0000
2486@@ -68,6 +68,38 @@
2487 SHOW CREATE TABLE t1;
2488 DROP TABLE t1;
2489
2490+--echo #
2491+--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
2492+--echo # and reverse() function
2493+--echo #
2494+
2495+--echo # Problem # 1 (original report): wrong parsing of ucs2 data
2496+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
2497+CREATE TABLE t1(a INT);
2498+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
2499+(@b) SET a=REVERSE(@b);
2500+--echo # should return 2 zeroes (as the value is truncated)
2501+SELECT * FROM t1;
2502+
2503+DROP TABLE t1;
2504+let $MYSQLD_DATADIR= `select @@datadir`;
2505+remove_file $MYSQLD_DATADIR/test/tmpp.txt;
2506+
2507+
2508+--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
2509+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
2510+CREATE TABLE t1(a INT);
2511+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
2512+(@b) SET a=REVERSE(@b);
2513+--echo # should return 0 and 1 (10 reversed)
2514+SELECT * FROM t1;
2515+
2516+DROP TABLE t1;
2517+let $MYSQLD_DATADIR= `select @@datadir`;
2518+remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
2519+
2520+
2521+
2522 #
2523 # BUG3946
2524 #
2525
2526=== modified file 'Percona-Server/mysql-test/t/loaddata.test'
2527--- Percona-Server/mysql-test/t/loaddata.test 2011-11-24 02:00:56 +0000
2528+++ Percona-Server/mysql-test/t/loaddata.test 2013-03-07 06:40:28 +0000
2529@@ -580,36 +580,40 @@
2530 connection default;
2531 disconnect con1;
2532
2533-
2534---echo #
2535---echo # Bug #51876 : crash/memory underrun when loading data with ucs2
2536---echo # and reverse() function
2537---echo #
2538-
2539---echo # Problem # 1 (original report): wrong parsing of ucs2 data
2540-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
2541-CREATE TABLE t1(a INT);
2542-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
2543-(@b) SET a=REVERSE(@b);
2544---echo # should return 2 zeroes (as the value is truncated)
2545-SELECT * FROM t1;
2546-
2547-DROP TABLE t1;
2548-let $MYSQLD_DATADIR= `select @@datadir`;
2549-remove_file $MYSQLD_DATADIR/test/tmpp.txt;
2550-
2551-
2552---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
2553-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
2554-CREATE TABLE t1(a INT);
2555-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
2556-(@b) SET a=REVERSE(@b);
2557---echo # should return 0 and 1 (10 reversed)
2558-SELECT * FROM t1;
2559-
2560-DROP TABLE t1;
2561-let $MYSQLD_DATADIR= `select @@datadir`;
2562-remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
2563+#############################################################################
2564+# The below protion is moved to ctype_ucs.test #
2565+#############################################################################
2566+#--echo #
2567+#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
2568+#--echo # and reverse() function
2569+#--echo #
2570+
2571+#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
2572+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
2573+#CREATE TABLE t1(a INT);
2574+#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
2575+#(@b) SET a=REVERSE(@b);
2576+#--echo # should return 2 zeroes (as the value is truncated)
2577+#SELECT * FROM t1;
2578+
2579+#DROP TABLE t1;
2580+#let $MYSQLD_DATADIR= `select @@datadir`;
2581+#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
2582+
2583+
2584+#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
2585+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
2586+#CREATE TABLE t1(a INT);
2587+#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
2588+#(@b) SET a=REVERSE(@b);
2589+#--echo # should return 0 and 1 (10 reversed)
2590+#SELECT * FROM t1;
2591+
2592+#DROP TABLE t1;
2593+#let $MYSQLD_DATADIR= `select @@datadir`;
2594+#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
2595+######################################################################################
2596+
2597
2598 --echo #
2599 --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
2600
2601=== modified file 'Percona-Server/mysql-test/t/percona_innodb_version.test'
2602--- Percona-Server/mysql-test/t/percona_innodb_version.test 2012-01-19 08:13:24 +0000
2603+++ Percona-Server/mysql-test/t/percona_innodb_version.test 2013-03-07 06:40:28 +0000
2604@@ -4,5 +4,5 @@
2605 # Bug #917246: Unintentional change of innodb_version format in 5.1.60
2606 ########################################################################
2607
2608---replace_regex /1\.0\.[0-9]+-[0-9]+\.[0-9]+/1.0.x-x.x/
2609+--replace_regex /5\.1\.[0-9]+-[0-9]+\.[0-9]+/5.1.x-x.x/
2610 SELECT @@innodb_version;
2611
2612=== modified file 'Percona-Server/mysql-test/t/sp_notembedded.test'
2613--- Percona-Server/mysql-test/t/sp_notembedded.test 2012-03-28 06:35:31 +0000
2614+++ Percona-Server/mysql-test/t/sp_notembedded.test 2013-03-07 06:40:28 +0000
2615@@ -371,16 +371,6 @@
2616 FLUSH PRIVILEGES;
2617
2618
2619-#
2620-# Restore global concurrent_insert value. Keep in the end of the test file.
2621-#
2622-
2623-set @@global.concurrent_insert= @old_concurrent_insert;
2624-
2625-# Wait till all disconnects are completed
2626---source include/wait_until_count_sessions.inc
2627-
2628-
2629 --echo #
2630 --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
2631 --echo #
2632@@ -476,3 +466,13 @@
2633 --echo # ------------------------------------------------------------------
2634 --echo # -- End of 5.1 tests
2635 --echo # ------------------------------------------------------------------
2636+
2637+
2638+#
2639+# Restore global concurrent_insert value. Keep in the end of the test file.
2640+#
2641+
2642+set @@global.concurrent_insert= @old_concurrent_insert;
2643+
2644+# Wait till all disconnects are completed
2645+--source include/wait_until_count_sessions.inc
2646
2647=== modified file 'Percona-Server/mysys/errors.c'
2648--- Percona-Server/mysys/errors.c 2011-06-30 15:37:13 +0000
2649+++ Percona-Server/mysys/errors.c 2013-03-07 06:40:28 +0000
2650@@ -101,16 +101,28 @@
2651 }
2652 #endif
2653
2654+/*
2655+ We cannot call my_error/my_printf_error here in this function.
2656+ Those functions will set status variable in diagnostic area
2657+ and there is no provision to reset them back.
2658+ Here we are waiting for free space and will wait forever till
2659+ space is created. So just giving warning in the error file
2660+ should be enough.
2661+*/
2662 void wait_for_free_space(const char *filename, int errors)
2663 {
2664- if (errors == 0)
2665- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
2666+ if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
2667+ {
2668+ my_printf_warning(EE(EE_DISK_FULL),
2669 filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
2670- if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
2671- my_printf_error(EE_DISK_FULL,
2672- "Retry in %d secs. Message reprinted in %d secs",
2673- MYF(ME_BELL | ME_NOREFRESH),
2674+ my_printf_warning("Retry in %d secs. Message reprinted in %d secs",
2675 MY_WAIT_FOR_USER_TO_FIX_PANIC,
2676 MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
2677+ }
2678+ DBUG_EXECUTE_IF("simulate_file_write_error_once",
2679+ {
2680+ VOID(sleep(1));
2681+ return;
2682+ });
2683 VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
2684 }
2685
2686=== modified file 'Percona-Server/mysys/mf_pack.c'
2687--- Percona-Server/mysys/mf_pack.c 2011-06-30 15:37:13 +0000
2688+++ Percona-Server/mysys/mf_pack.c 2013-03-07 06:40:28 +0000
2689@@ -1,4 +1,4 @@
2690-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2691+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2692
2693 This program is free software; you can redistribute it and/or modify
2694 it under the terms of the GNU General Public License as published by
2695@@ -11,7 +11,8 @@
2696
2697 You should have received a copy of the GNU General Public License
2698 along with this program; if not, write to the Free Software
2699- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
2700+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2701+*/
2702
2703 #include "mysys_priv.h"
2704 #include <m_string.h>
2705@@ -519,10 +520,10 @@
2706 char buff[FN_REFLEN];
2707 if (from == to)
2708 { /* Dirname may destroy from */
2709- strmov(buff,from);
2710+ (void) strnmov(buff, from, FN_REFLEN);
2711 from=buff;
2712 }
2713 length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */
2714- (void) strmov(to + to_length,from+length);
2715+ (void) strnmov(to + to_length, from + length, FN_REFLEN - to_length);
2716 return (to);
2717 } /* intern_filename */
2718
2719=== modified file 'Percona-Server/mysys/my_access.c'
2720--- Percona-Server/mysys/my_access.c 2012-08-20 00:29:22 +0000
2721+++ Percona-Server/mysys/my_access.c 2013-03-07 06:40:28 +0000
2722@@ -156,6 +156,67 @@
2723 }
2724
2725
2726+#ifdef __WIN__
2727+/**
2728+ Checks if the drive letter supplied is valid or not. Valid drive
2729+ letters are A to Z, both lower case and upper case.
2730+
2731+ @param drive_letter : The drive letter to validate.
2732+
2733+ @return TRUE if the drive exists, FALSE otherwise.
2734+*/
2735+static my_bool does_drive_exists(char drive_letter)
2736+{
2737+ DWORD drive_mask= GetLogicalDrives();
2738+ drive_letter= toupper(drive_letter);
2739+
2740+ return (drive_letter >= 'A' && drive_letter <= 'Z') &&
2741+ (drive_mask & (0x1 << (drive_letter - 'A')));
2742+}
2743+#endif
2744+
2745+/**
2746+ Verifies if the file name supplied is allowed or not. On Windows
2747+ file names with a colon (:) are not allowed because such file names
2748+ store data in Alternate Data Streams which can be used to hide
2749+ the data.
2750+
2751+ @param name contains the file name with or without path
2752+ @param length contains the length of file name
2753+
2754+ @return TRUE if the file name is allowed, FALSE otherwise.
2755+*/
2756+my_bool is_filename_allowed(const char *name __attribute__((unused)),
2757+ size_t length __attribute__((unused)))
2758+{
2759+#ifdef __WIN__
2760+ /*
2761+ For Windows, check if the file name contains : character.
2762+ Start from end of path and search if the file name contains :
2763+ */
2764+ const char* ch = NULL;
2765+ for(ch= name + length - 1; ch >= name; --ch)
2766+ {
2767+ if (FN_LIBCHAR == *ch || '/' == *ch)
2768+ break;
2769+ else if (':' == *ch)
2770+ {
2771+ /*
2772+ File names like C:foobar.txt are allowed since the syntax means
2773+ file foobar.txt in current directory of C drive. However file
2774+ names likes CC:foobar are not allowed since this syntax means ADS
2775+ foobar in file CC.
2776+ */
2777+ return ((ch - name == 1) && does_drive_exists(*name));
2778+ }
2779+ }
2780+ return TRUE;
2781+#else
2782+ /* For other platforms, file names can contain colon : */
2783+ return TRUE;
2784+#endif
2785+} /* is_filename_allowed */
2786+
2787 #if defined(__WIN__) || defined(__EMX__)
2788
2789
2790
2791=== modified file 'Percona-Server/mysys/my_error.c'
2792--- Percona-Server/mysys/my_error.c 2011-06-30 15:37:13 +0000
2793+++ Percona-Server/mysys/my_error.c 2013-03-07 06:40:28 +0000
2794@@ -129,6 +129,28 @@
2795 }
2796
2797 /*
2798+ Warning as printf
2799+
2800+ SYNOPSIS
2801+ my_printf_warning()
2802+ format> Format string
2803+ ...> variable list
2804+*/
2805+void(*sql_print_warning_hook)(const char *format,...);
2806+void my_printf_warning(const char *format, ...)
2807+{
2808+ va_list args;
2809+ char wbuff[ERRMSGSIZE];
2810+ DBUG_ENTER("my_printf_warning");
2811+ DBUG_PRINT("my", ("Format: %s", format));
2812+ va_start(args,format);
2813+ (void) my_vsnprintf (wbuff, sizeof(wbuff), format, args);
2814+ va_end(args);
2815+ (*sql_print_warning_hook)(wbuff);
2816+ DBUG_VOID_RETURN;
2817+}
2818+
2819+/*
2820 Give message using error_handler_hook
2821
2822 SYNOPSIS
2823
2824=== modified file 'Percona-Server/mysys/my_fopen.c'
2825--- Percona-Server/mysys/my_fopen.c 2011-02-22 21:03:32 +0000
2826+++ Percona-Server/mysys/my_fopen.c 2013-03-07 06:40:28 +0000
2827@@ -56,6 +56,11 @@
2828 errno= EACCES;
2829 fd= 0;
2830 }
2831+ else if (!is_filename_allowed(filename, strlen(filename)))
2832+ {
2833+ errno= EINVAL;
2834+ fd= 0;
2835+ }
2836 else
2837 #endif
2838 {
2839
2840=== modified file 'Percona-Server/mysys/my_lib.c'
2841--- Percona-Server/mysys/my_lib.c 2010-12-28 23:47:05 +0000
2842+++ Percona-Server/mysys/my_lib.c 2013-03-07 06:40:28 +0000
2843@@ -1,4 +1,4 @@
2844-/* Copyright (C) 2000 MySQL AB
2845+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2846
2847 This program is free software; you can redistribute it and/or modify
2848 it under the terms of the GNU General Public License as published by
2849@@ -11,7 +11,8 @@
2850
2851 You should have received a copy of the GNU General Public License
2852 along with this program; if not, write to the Free Software
2853- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
2854+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2855+*/
2856
2857 /* TODO: check for overun of memory for names. */
2858 /* Convert MSDOS-TIME to standar time_t (still needed?) */
2859@@ -103,7 +104,7 @@
2860 MEM_ROOT *names_storage;
2861 DIR *dirp;
2862 struct dirent *dp;
2863- char tmp_path[FN_REFLEN+1],*tmp_file;
2864+ char tmp_path[FN_REFLEN + 2], *tmp_file;
2865 #ifdef THREAD
2866 char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
2867 #endif
2868@@ -215,10 +216,11 @@
2869 /* Process as Unix format: just remove test the final slash. */
2870
2871 char * end;
2872+ DBUG_ASSERT(strlen(src) < (FN_REFLEN + 1));
2873
2874 if (src[0] == 0)
2875 src= (char*) "."; /* Use empty as current */
2876- end=strmov(dst, src);
2877+ end= strnmov(dst, src, FN_REFLEN + 1);
2878 if (end[-1] != FN_LIBCHAR)
2879 {
2880 end[0]=FN_LIBCHAR; /* Add last '/' */
2881
2882=== modified file 'Percona-Server/mysys/my_open.c'
2883--- Percona-Server/mysys/my_open.c 2007-10-11 15:07:40 +0000
2884+++ Percona-Server/mysys/my_open.c 2013-03-07 06:40:28 +0000
2885@@ -218,6 +218,13 @@
2886 DWORD fileattrib; /* OS file attribute flags */
2887 SECURITY_ATTRIBUTES SecurityAttributes;
2888
2889+ if (!is_filename_allowed(path, strlen(path)))
2890+ {
2891+ errno= EINVAL;
2892+ _doserrno= 0L; /* not an OS error */
2893+ return -1;
2894+ }
2895+
2896 SecurityAttributes.nLength= sizeof(SecurityAttributes);
2897 SecurityAttributes.lpSecurityDescriptor= NULL;
2898 SecurityAttributes.bInheritHandle= !(oflag & _O_NOINHERIT);
2899
2900=== modified file 'Percona-Server/mysys/my_write.c'
2901--- Percona-Server/mysys/my_write.c 2012-08-20 00:29:22 +0000
2902+++ Percona-Server/mysys/my_write.c 2013-03-07 06:40:28 +0000
2903@@ -36,6 +36,8 @@
2904 if (unlikely(!Count))
2905 DBUG_RETURN(0);
2906
2907+ DBUG_EXECUTE_IF ("simulate_file_write_error_once",
2908+ { DBUG_SET("+d,simulate_file_write_error");});
2909 for (;;)
2910 {
2911 writenbytes= write(Filedes, Buffer, Count);
2912@@ -69,6 +71,8 @@
2913 {
2914 wait_for_free_space(my_filename(Filedes), errors);
2915 errors++;
2916+ DBUG_EXECUTE_IF("simulate_file_write_error_once",
2917+ { DBUG_SET("-d,simulate_file_write_error");});
2918 continue;
2919 }
2920
2921
2922=== modified file 'Percona-Server/scripts/mysql_install_db.pl.in'
2923--- Percona-Server/scripts/mysql_install_db.pl.in 2012-02-15 16:21:38 +0000
2924+++ Percona-Server/scripts/mysql_install_db.pl.in 2013-03-07 06:40:28 +0000
2925@@ -423,10 +423,11 @@
2926 "--bootstrap",
2927 "--basedir=$opt->{basedir}",
2928 "--datadir=$opt->{ldata}",
2929- "--skip-innodb",
2930- "--skip-bdb",
2931- "--skip-ndbcluster",
2932+ "--log-warnings=0",
2933+ "--loose-skip-innodb",
2934+ "--loose-skip-ndbcluster",
2935 "--max_allowed_packet=8M",
2936+ "--default-storage-engine=MyISAM",
2937 "--net_buffer_length=16K",
2938 @args,
2939 );
2940@@ -439,6 +440,8 @@
2941
2942 open(SQL, $create_system_tables)
2943 or error($opt,"can't open $create_system_tables for reading: $!");
2944+open(SQL2, $fill_system_tables)
2945+ or error($opt,"can't open $fill_system_tables for reading: $!");
2946 # FIXME > /dev/null ?
2947 if ( open(PIPE, "| $mysqld_install_cmd_line") )
2948 {
2949@@ -452,8 +455,20 @@
2950
2951 print PIPE $_;
2952 }
2953+ while ( <SQL2> )
2954+ {
2955+ # TODO: make it similar to the above condition when we're sure
2956+ # @@hostname returns a fqdn
2957+ # When doing a "cross bootstrap" install, no reference to the current
2958+ # host should be added to the system tables. So we filter out any
2959+ # lines which contain the current host name.
2960+ next if /\@current_hostname/;
2961+
2962+ print PIPE $_;
2963+ }
2964 close PIPE;
2965 close SQL;
2966+ close SQL2;
2967
2968 report_verbose($opt,"OK");
2969
2970
2971=== modified file 'Percona-Server/scripts/mysqld_multi.sh'
2972--- Percona-Server/scripts/mysqld_multi.sh 2011-06-30 15:37:13 +0000
2973+++ Percona-Server/scripts/mysqld_multi.sh 2013-03-07 06:40:28 +0000
2974@@ -47,6 +47,28 @@
2975 $my_progname = $0;
2976 $my_progname =~ s/.*[\/]//;
2977
2978+
2979+if (defined($ENV{UMASK})) {
2980+ my $UMASK = $ENV{UMASK};
2981+ my $m;
2982+ my $fmode = "0640";
2983+
2984+ if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
2985+ printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
2986+ printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
2987+ else {
2988+ $fmode= substr $UMASK, 2, 2;
2989+ $fmode= "06${fmode}"; }
2990+
2991+ if($fmode != $UMASK) {
2992+ printf("UMASK corrected from $UMASK to $fmode ...\n"); }
2993+
2994+ $fmode= oct($fmode);
2995+
2996+ umask($fmode);
2997+}
2998+
2999+
3000 main();
3001
3002 ####
3003
3004=== modified file 'Percona-Server/scripts/mysqld_safe.sh'
3005--- Percona-Server/scripts/mysqld_safe.sh 2010-04-09 11:47:18 +0000
3006+++ Percona-Server/scripts/mysqld_safe.sh 2013-03-07 06:40:28 +0000
3007@@ -27,7 +27,28 @@
3008
3009 trap '' 1 2 3 15 # we shouldn't let anyone kill us
3010
3011-umask 007
3012+# MySQL-specific environment variable. First off, it's not really a umask,
3013+# it's the desired mode. Second, it follows umask(2), not umask(3) in that
3014+# octal needs to be explicit. Our shell might be a proper sh without printf,
3015+# multiple-base arithmetic, and binary arithmetic, so this will get ugly.
3016+# We reject decimal values to keep things at least half-sane.
3017+umask 007 # fallback
3018+UMASK="${UMASK-0640}"
3019+fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'`
3020+octalp=`echo "$fmode"|cut -c1`
3021+fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'`
3022+if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ]
3023+then
3024+ fmode=0640
3025+ echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2
3026+ echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2
3027+fi
3028+fmode=`echo "$fmode"|cut -c3-4`
3029+fmode="6$fmode"
3030+if [ "x$UMASK" != "x0$fmode" ]
3031+then
3032+ echo "UMASK corrected from $UMASK to 0$fmode ..."
3033+fi
3034
3035 defaults=
3036 case "$1" in
3037@@ -371,6 +392,12 @@
3038 # Log to err_log file
3039 log_notice "Logging to '$err_log'."
3040 logging=file
3041+
3042+ if [ ! -f "$err_log" ]; then # if error log already exists,
3043+ touch "$err_log" # we just append. otherwise,
3044+ chmod "$fmode" "$err_log" # fix the permissions here!
3045+ fi
3046+
3047 else
3048 if [ -n "$syslog_tag" ]
3049 then
3050@@ -572,6 +599,12 @@
3051
3052 eval_log_error "$cmd"
3053
3054+ if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then
3055+ touch "$err_log" # hypothetical: log was renamed but not
3056+ chown $user "$err_log" # flushed yet. we'd recreate it with
3057+ chmod "$fmode" "$err_log" # wrong owner next time we log, so set
3058+ fi # it up correctly while we can!
3059+
3060 if test ! -f "$pid_file" # This is removed if normal shutdown
3061 then
3062 break
3063
3064=== modified file 'Percona-Server/sql/.cvsignore'
3065--- Percona-Server/sql/.cvsignore 2000-07-31 19:29:14 +0000
3066+++ Percona-Server/sql/.cvsignore 2013-03-07 06:40:28 +0000
3067@@ -9,4 +9,5 @@
3068 mysqlbinlog
3069 mysqld
3070 sql_yacc.cc
3071+sql_yacc.hh
3072 sql_yacc.h
3073
3074=== modified file 'Percona-Server/sql/Makefile.am'
3075--- Percona-Server/sql/Makefile.am 2012-10-10 10:43:22 +0000
3076+++ Percona-Server/sql/Makefile.am 2013-03-07 06:40:28 +0000
3077@@ -146,14 +146,8 @@
3078 -DHAVE_EVENT_SCHEDULER \
3079 @DEFS@
3080
3081-# Automake 1.12 generates sql_yacc.hh instead of sql_yacc.h
3082-BUILT_MAINT_SRC = sql_yacc.cc sql_yacc.h
3083-if HAVE_AM_YACC_C2H
3084-sql_yacc.h:
3085- @LN_CP_F@ sql_yacc.hh sql_yacc.h
3086-endif
3087-
3088-BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h patch_info.h link_sources
3089+BUILT_MAINT_SRC = sql_yacc.cc patch_info.h sql_yacc.$(YACC_HEXT)
3090+BUILT_SOURCES = $(BUILT_MAINT_SRC) lex_hash.h link_sources
3091 EXTRA_DIST = udf_example.c udf_example.def $(BUILT_MAINT_SRC) \
3092 nt_servc.cc nt_servc.h \
3093 message.mc message.h message.rc MSG00001.bin \
3094
3095=== modified file 'Percona-Server/sql/field.cc'
3096--- Percona-Server/sql/field.cc 2012-08-20 00:29:22 +0000
3097+++ Percona-Server/sql/field.cc 2013-03-07 06:40:28 +0000
3098@@ -184,7 +184,7 @@
3099 //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
3100 MYSQL_TYPE_LONG, MYSQL_TYPE_VARCHAR,
3101 //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
3102- MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24,
3103+ MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONG,
3104 //MYSQL_TYPE_DATE MYSQL_TYPE_TIME
3105 MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
3106 //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
3107@@ -215,7 +215,7 @@
3108 //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
3109 MYSQL_TYPE_FLOAT, MYSQL_TYPE_VARCHAR,
3110 //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
3111- MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24,
3112+ MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT,
3113 //MYSQL_TYPE_DATE MYSQL_TYPE_TIME
3114 MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
3115 //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
3116@@ -246,7 +246,7 @@
3117 //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
3118 MYSQL_TYPE_DOUBLE, MYSQL_TYPE_VARCHAR,
3119 //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
3120- MYSQL_TYPE_DOUBLE, MYSQL_TYPE_INT24,
3121+ MYSQL_TYPE_DOUBLE, MYSQL_TYPE_DOUBLE,
3122 //MYSQL_TYPE_DATE MYSQL_TYPE_TIME
3123 MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
3124 //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
3125@@ -277,7 +277,7 @@
3126 //MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
3127 MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
3128 //MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
3129- MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24,
3130+ MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG,
3131 //MYSQL_TYPE_DATE MYSQL_TYPE_TIME
3132 MYSQL_TYPE_NEWDATE, MYSQL_TYPE_TIME,
3133 //MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
3134
3135=== modified file 'Percona-Server/sql/ha_partition.cc'
3136--- Percona-Server/sql/ha_partition.cc 2012-08-20 10:39:36 +0000
3137+++ Percona-Server/sql/ha_partition.cc 2013-03-07 06:40:28 +0000
3138@@ -4077,6 +4077,7 @@
3139 {
3140 if (bitmap_is_set(&m_part_info->used_partitions, i))
3141 {
3142+ DBUG_PRINT("info", ("init rec-buf for part %u", i));
3143 int2store(ptr, i);
3144 ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
3145 }
3146@@ -4981,11 +4982,27 @@
3147 m_top_entry= NO_CURRENT_PART_ID;
3148 queue_remove_all(&m_queue);
3149
3150- DBUG_PRINT("info", ("m_part_spec.start_part %d", m_part_spec.start_part));
3151- for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++)
3152+ /*
3153+ Position part_rec_buf_ptr to point to the first used partition >=
3154+ start_part. There may be partitions marked by used_partitions,
3155+ but is before start_part. These partitions has allocated record buffers
3156+ but is dynamically pruned, so those buffers must be skipped.
3157+ */
3158+ uint first_used_part= bitmap_get_first_set(&m_part_info->used_partitions);
3159+ for (; first_used_part < m_part_spec.start_part; first_used_part++)
3160+ {
3161+ if (bitmap_is_set(&(m_part_info->used_partitions), first_used_part))
3162+ part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
3163+ }
3164+ DBUG_PRINT("info", ("m_part_spec.start_part %u first_used_part %u",
3165+ m_part_spec.start_part, first_used_part));
3166+ for (i= first_used_part; i <= m_part_spec.end_part; i++)
3167 {
3168 if (!(bitmap_is_set(&(m_part_info->used_partitions), i)))
3169 continue;
3170+ DBUG_PRINT("info", ("reading from part %u (scan_type: %u)",
3171+ i, m_index_scan_type));
3172+ DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr));
3173 uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS;
3174 int error;
3175 handler *file= m_file[i];
3176
3177=== modified file 'Percona-Server/sql/hostname.cc'
3178--- Percona-Server/sql/hostname.cc 2012-06-19 07:26:40 +0000
3179+++ Percona-Server/sql/hostname.cc 2013-03-07 06:40:28 +0000
3180@@ -214,6 +214,15 @@
3181 }
3182 my_gethostbyname_r_free();
3183 #else
3184+
3185+ DBUG_EXECUTE_IF("addr_fake_ipv4",
3186+ {
3187+ const char* fake_host= "santa.claus.ipv4.example.com";
3188+ name=my_strdup(fake_host, MYF(0));
3189+ add_hostname(in,name);
3190+ DBUG_RETURN(name);
3191+ };);
3192+
3193 VOID(pthread_mutex_lock(&LOCK_hostname));
3194 if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
3195 {
3196
3197=== modified file 'Percona-Server/sql/item_cmpfunc.cc'
3198--- Percona-Server/sql/item_cmpfunc.cc 2011-07-03 15:47:37 +0000
3199+++ Percona-Server/sql/item_cmpfunc.cc 2013-03-07 06:40:28 +0000
3200@@ -1,4 +1,4 @@
3201-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3202+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3203
3204 This program is free software; you can redistribute it and/or modify
3205 it under the terms of the GNU General Public License as published by
3206@@ -3045,6 +3045,15 @@
3207 return;
3208 }
3209 }
3210+ /*
3211+ Set cmp_context of all WHEN arguments. This prevents
3212+ Item_field::equal_fields_propagator() from transforming a
3213+ zerofill argument into a string constant. Such a change would
3214+ require rebuilding cmp_items.
3215+ */
3216+ for (i= 0; i < ncases; i+= 2)
3217+ args[i]->cmp_context= item_cmp_type(left_result_type,
3218+ args[i]->result_type());
3219 }
3220
3221 if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
3222@@ -4032,6 +4041,16 @@
3223 }
3224 }
3225 }
3226+ /*
3227+ Set cmp_context of all arguments. This prevents
3228+ Item_field::equal_fields_propagator() from transforming a zerofill integer
3229+ argument into a string constant. Such a change would require rebuilding
3230+ cmp_itmes.
3231+ */
3232+ for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
3233+ {
3234+ arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
3235+ }
3236 max_length= 1;
3237 }
3238
3239
3240=== modified file 'Percona-Server/sql/item_func.cc'
3241--- Percona-Server/sql/item_func.cc 2012-10-05 07:20:04 +0000
3242+++ Percona-Server/sql/item_func.cc 2013-03-07 06:40:28 +0000
3243@@ -3596,7 +3596,8 @@
3244 thd->first_successful_insert_id_in_prev_stmt= value;
3245 return value;
3246 }
3247- return thd->read_first_successful_insert_id_in_prev_stmt();
3248+ return
3249+ static_cast<longlong>(thd->read_first_successful_insert_id_in_prev_stmt());
3250 }
3251
3252
3253
3254=== modified file 'Percona-Server/sql/item_func.h'
3255--- Percona-Server/sql/item_func.h 2012-10-05 07:20:04 +0000
3256+++ Percona-Server/sql/item_func.h 2013-03-07 06:40:28 +0000
3257@@ -1043,6 +1043,7 @@
3258 const char *func_name() const { return "last_insert_id"; }
3259 void fix_length_and_dec()
3260 {
3261+ unsigned_flag= TRUE;
3262 if (arg_count)
3263 max_length= args[0]->max_length;
3264 }
3265
3266=== modified file 'Percona-Server/sql/item_xmlfunc.cc'
3267--- Percona-Server/sql/item_xmlfunc.cc 2011-06-30 15:37:13 +0000
3268+++ Percona-Server/sql/item_xmlfunc.cc 2013-03-07 06:40:28 +0000
3269@@ -2669,8 +2669,12 @@
3270
3271 node.parent= data->parent; // Set parent for the new node to old parent
3272 data->parent= numnodes; // Remember current node as new parent
3273+ DBUG_ASSERT(data->level <= MAX_LEVEL);
3274 data->pos[data->level]= numnodes;
3275- node.level= data->level++;
3276+ if (data->level < MAX_LEVEL)
3277+ node.level= data->level++;
3278+ else
3279+ return MY_XML_ERROR;
3280 node.type= st->current_node_type; // TAG or ATTR
3281 node.beg= attr;
3282 node.end= attr + len;
3283
3284=== modified file 'Percona-Server/sql/log.cc'
3285--- Percona-Server/sql/log.cc 2013-01-20 16:49:07 +0000
3286+++ Percona-Server/sql/log.cc 2013-03-07 06:40:28 +0000
3287@@ -4474,10 +4474,16 @@
3288 /*
3289 Write pending event to log file or transaction cache
3290 */
3291+ DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
3292+ {DBUG_SET("+d,simulate_file_write_error");});
3293 if (pending->write(file))
3294 {
3295 pthread_mutex_unlock(&LOCK_log);
3296 set_write_error(thd);
3297+ delete pending;
3298+ trx_data->set_pending(NULL);
3299+ DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
3300+ {DBUG_SET("-d,simulate_file_write_error");});
3301 DBUG_RETURN(1);
3302 }
3303
3304
3305=== modified file 'Percona-Server/sql/log_event.cc'
3306--- Percona-Server/sql/log_event.cc 2013-01-20 16:49:07 +0000
3307+++ Percona-Server/sql/log_event.cc 2013-03-07 06:40:28 +0000
3308@@ -54,6 +54,22 @@
3309 */
3310 #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1)
3311
3312+/*
3313+ Explicit instantiation to unsigned int of template available_buffer
3314+ function.
3315+*/
3316+template unsigned int available_buffer<unsigned int>(const char*,
3317+ const char*,
3318+ unsigned int);
3319+
3320+/*
3321+ Explicit instantiation to unsigned int of template valid_buffer_range
3322+ function.
3323+*/
3324+template bool valid_buffer_range<unsigned int>(unsigned int,
3325+ const char*,
3326+ const char*,
3327+ unsigned int);
3328
3329 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3330 static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd);
3331@@ -1286,7 +1302,7 @@
3332 ev = new Rand_log_event(buf, description_event);
3333 break;
3334 case USER_VAR_EVENT:
3335- ev = new User_var_log_event(buf, description_event);
3336+ ev = new User_var_log_event(buf, event_len, description_event);
3337 break;
3338 case FORMAT_DESCRIPTION_EVENT:
3339 ev = new Format_description_log_event(buf, event_len, description_event);
3340@@ -4249,7 +4265,6 @@
3341 into 'server_version_split':
3342 X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z}
3343 X.Yabc -> {X,Y,0}
3344- Xabc -> {X,0,0}
3345 'server_version_split' is then used for lookups to find if the server which
3346 created this event has some known bug.
3347 */
3348@@ -4260,10 +4275,21 @@
3349 for (uint i= 0; i<=2; i++)
3350 {
3351 number= strtoul(p, &r, 10);
3352- server_version_split[i]= (uchar)number;
3353- DBUG_ASSERT(number < 256); // fit in uchar
3354+ /*
3355+ It is an invalid version if any version number greater than 255 or
3356+ first number is not followed by '.'.
3357+ */
3358+ if (number < 256 && (*r == '.' || i != 0))
3359+ server_version_split[i]= (uchar)number;
3360+ else
3361+ {
3362+ server_version_split[0]= 0;
3363+ server_version_split[1]= 0;
3364+ server_version_split[2]= 0;
3365+ break;
3366+ }
3367+
3368 p= r;
3369- DBUG_ASSERT(!((i == 0) && (*r != '.'))); // should be true in practice
3370 if (*r == '.')
3371 p++; // skip the dot
3372 }
3373@@ -5751,18 +5777,34 @@
3374
3375
3376 User_var_log_event::
3377-User_var_log_event(const char* buf,
3378+User_var_log_event(const char* buf, uint event_len,
3379 const Format_description_log_event* description_event)
3380 :Log_event(buf, description_event)
3381 #ifndef MYSQL_CLIENT
3382 , deferred(false)
3383 #endif
3384 {
3385+ bool error= false;
3386+ const char* buf_start= buf;
3387 /* The Post-Header is empty. The Variable Data part begins immediately. */
3388 buf+= description_event->common_header_len +
3389 description_event->post_header_len[USER_VAR_EVENT-1];
3390 name_len= uint4korr(buf);
3391 name= (char *) buf + UV_NAME_LEN_SIZE;
3392+
3393+ /*
3394+ We don't know yet is_null value, so we must assume that name_len
3395+ may have the bigger value possible, is_null= True and there is no
3396+ payload for val.
3397+ */
3398+ if (0 == name_len ||
3399+ !valid_buffer_range<uint>(name_len, buf_start, name,
3400+ event_len - UV_VAL_IS_NULL))
3401+ {
3402+ error= true;
3403+ goto err;
3404+ }
3405+
3406 buf+= UV_NAME_LEN_SIZE + name_len;
3407 is_null= (bool) *buf;
3408 if (is_null)
3409@@ -5774,13 +5816,31 @@
3410 }
3411 else
3412 {
3413+ if (!valid_buffer_range<uint>(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE
3414+ + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE,
3415+ buf_start, buf, event_len))
3416+ {
3417+ error= true;
3418+ goto err;
3419+ }
3420+
3421 type= (Item_result) buf[UV_VAL_IS_NULL];
3422 charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE);
3423 val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
3424 UV_CHARSET_NUMBER_SIZE);
3425 val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
3426 UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE);
3427+
3428+ if (!valid_buffer_range<uint>(val_len, buf_start, val, event_len))
3429+ {
3430+ error= true;
3431+ goto err;
3432+ }
3433 }
3434+
3435+err:
3436+ if (error)
3437+ name= 0;
3438 }
3439
3440
3441@@ -5927,8 +5987,9 @@
3442 char *hex_str;
3443 CHARSET_INFO *cs;
3444
3445- if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte
3446- break; // no error, as we are 'void'
3447+ hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte
3448+ if (!hex_str)
3449+ return;
3450 str_to_hex(hex_str, val, val_len);
3451 /*
3452 For proper behaviour when mysqlbinlog|mysql, we need to explicitely
3453
3454=== modified file 'Percona-Server/sql/log_event.h'
3455--- Percona-Server/sql/log_event.h 2013-01-18 03:33:06 +0000
3456+++ Percona-Server/sql/log_event.h 2013-03-07 06:40:28 +0000
3457@@ -983,7 +983,7 @@
3458 return thd ? thd->db : 0;
3459 }
3460 #else
3461- Log_event() : temp_buf(0) {}
3462+ Log_event() : temp_buf(0), flags(0) {}
3463 /* avoid having to link mysqlbinlog against libpthread */
3464 static Log_event* read_log_event(IO_CACHE* file,
3465 const Format_description_log_event
3466@@ -2265,12 +2265,26 @@
3467 #ifndef MYSQL_CLIENT
3468 bool write(IO_CACHE* file);
3469 #endif
3470- bool is_valid() const
3471+ bool header_is_valid() const
3472 {
3473 return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
3474 LOG_EVENT_MINIMAL_HEADER_LEN)) &&
3475 (post_header_len != NULL));
3476 }
3477+
3478+ bool version_is_valid() const
3479+ {
3480+ /* It is invalid only when all version numbers are 0 */
3481+ return !(server_version_split[0] == 0 &&
3482+ server_version_split[1] == 0 &&
3483+ server_version_split[2] == 0);
3484+ }
3485+
3486+ bool is_valid() const
3487+ {
3488+ return header_is_valid() && version_is_valid();
3489+ }
3490+
3491 int get_data_size()
3492 {
3493 /*
3494@@ -2517,7 +2531,7 @@
3495 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
3496 #endif
3497
3498- User_var_log_event(const char* buf,
3499+ User_var_log_event(const char* buf, uint event_len,
3500 const Format_description_log_event *description_event);
3501 ~User_var_log_event() {}
3502 Log_event_type get_type_code() { return USER_VAR_EVENT;}
3503@@ -2529,9 +2543,9 @@
3504 and which case the applier adjusts execution path.
3505 */
3506 bool is_deferred() { return deferred; }
3507- void set_deferred() { deferred= val; }
3508+ void set_deferred() { deferred= true; }
3509 #endif
3510- bool is_valid() const { return 1; }
3511+ bool is_valid() const { return name != 0; }
3512
3513 private:
3514 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
3515
3516=== modified file 'Percona-Server/sql/mysql_priv.h'
3517--- Percona-Server/sql/mysql_priv.h 2012-10-05 07:20:04 +0000
3518+++ Percona-Server/sql/mysql_priv.h 2013-03-07 06:40:28 +0000
3519@@ -505,6 +505,41 @@
3520 */
3521 #define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
3522
3523+/*
3524+ Check how many bytes are available on buffer.
3525+
3526+ @param buf_start Pointer to buffer start.
3527+ @param buf_current Pointer to the current position on buffer.
3528+ @param buf_len Buffer length.
3529+
3530+ @return Number of bytes available on event buffer.
3531+*/
3532+template <class T> T available_buffer(const char* buf_start,
3533+ const char* buf_current,
3534+ T buf_len)
3535+{
3536+ return buf_len - (buf_current - buf_start);
3537+}
3538+
3539+/*
3540+ Check if jump value is within buffer limits.
3541+
3542+ @param jump Number of positions we want to advance.
3543+ @param buf_start Pointer to buffer start
3544+ @param buf_current Pointer to the current position on buffer.
3545+ @param buf_len Buffer length.
3546+
3547+ @return True If jump value is within buffer limits.
3548+ False Otherwise.
3549+*/
3550+template <class T> bool valid_buffer_range(T jump,
3551+ const char* buf_start,
3552+ const char* buf_current,
3553+ T buf_len)
3554+{
3555+ return (jump <= available_buffer(buf_start, buf_current, buf_len));
3556+}
3557+
3558 /* The rest of the file is included in the server only */
3559 #ifndef MYSQL_CLIENT
3560
3561@@ -1377,6 +1412,31 @@
3562 bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
3563 uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
3564 bool tmp_table);
3565+
3566+/**
3567+ Create a table cache key for non-temporary table.
3568+
3569+ @param key Buffer for key (must be at least NAME_LEN*2+2 bytes).
3570+ @param db Database name.
3571+ @param table_name Table name.
3572+
3573+ @return Length of key.
3574+
3575+ @sa create_table_def_key(thd, char *, table_list, bool)
3576+*/
3577+
3578+inline uint
3579+create_table_def_key(char *key, const char *db, const char *table_name)
3580+{
3581+ /*
3582+ In theory caller should ensure that both db and table_name are
3583+ not longer than NAME_LEN bytes. In practice we play safe to avoid
3584+ buffer overruns.
3585+ */
3586+ return (uint)(strmake(strmake(key, db, NAME_LEN) + 1, table_name,
3587+ NAME_LEN) - key + 1);
3588+}
3589+
3590 TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
3591 uint key_length, uint db_flags, int *error);
3592 void release_table_share(TABLE_SHARE *share, enum release_type type);
3593@@ -1675,7 +1735,7 @@
3594 int decide_logging_format(THD *thd, TABLE_LIST *tables);
3595 TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
3596 const char *table_name, bool link_in_list);
3597-bool rm_temporary_table(handlerton *base, char *path);
3598+bool rm_temporary_table(handlerton *base, const char *path);
3599 void free_io_cache(TABLE *entry);
3600 void intern_close_table(TABLE *entry);
3601 bool close_thread_table(THD *thd, TABLE **table_ptr);
3602
3603=== modified file 'Percona-Server/sql/mysqld.cc'
3604--- Percona-Server/sql/mysqld.cc 2012-10-16 04:49:59 +0000
3605+++ Percona-Server/sql/mysqld.cc 2013-03-07 06:40:28 +0000
3606@@ -906,6 +906,7 @@
3607 static int test_if_case_insensitive(const char *dir_name);
3608
3609 #ifndef EMBEDDED_LIBRARY
3610+static bool pid_file_created= false;
3611 static void usage(void);
3612 static void start_signal_handler(void);
3613 static void close_server_sock();
3614@@ -914,6 +915,7 @@
3615 static void create_pid_file();
3616 static void end_ssl();
3617 #endif
3618+static void delete_pid_file(myf flags);
3619
3620
3621 #ifndef EMBEDDED_LIBRARY
3622@@ -1379,7 +1381,6 @@
3623 lex_free(); /* Free some memory */
3624 item_create_cleanup();
3625 set_var_free();
3626- free_charsets();
3627 if (!opt_noacl)
3628 {
3629 #ifdef HAVE_DLOPEN
3630@@ -1437,15 +1438,13 @@
3631 #ifdef USE_REGEX
3632 my_regex_end();
3633 #endif
3634+ free_charsets();
3635 #if defined(ENABLED_DEBUG_SYNC)
3636 /* End the debug sync facility. See debug_sync.cc. */
3637 debug_sync_end();
3638 #endif /* defined(ENABLED_DEBUG_SYNC) */
3639
3640-#if !defined(EMBEDDED_LIBRARY)
3641- if (!opt_bootstrap)
3642- (void) my_delete(pidfile_name,MYF(0)); // This may not always exist
3643-#endif
3644+ delete_pid_file(MYF(0));
3645 if (print_message && errmesg && server_start_time)
3646 sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname);
3647 thread_scheduler.end();
3648@@ -2020,7 +2019,7 @@
3649 this thread for handling of new THD object/connection.
3650 */
3651 thd->mysys_var->abort= 0;
3652- thd->thr_create_utime= my_micro_time();
3653+ thd->thr_create_utime= thd->start_utime= my_micro_time();
3654 threads.append(thd);
3655 return(1);
3656 }
3657@@ -4545,6 +4544,7 @@
3658 After this we can't quit by a simple unireg_abort
3659 */
3660 error_handler_hook= my_message_sql;
3661+ sql_print_warning_hook = sql_print_warning;
3662 start_signal_handler(); // Creates pidfile
3663
3664 if (mysql_rm_tmp_tables() || acl_init(opt_noacl) ||
3665@@ -4556,9 +4556,7 @@
3666 (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
3667 #endif /* __NETWARE__ */
3668
3669- if (!opt_bootstrap)
3670- (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
3671-
3672+ delete_pid_file(MYF(MY_WME));
3673 if (unix_sock != INVALID_SOCKET)
3674 unlink(mysqld_unix_port);
3675 exit(1);
3676@@ -4981,7 +4979,7 @@
3677 if (cached_thread_count > wake_thread)
3678 {
3679 /* Get thread from cache */
3680- thread_cache.append(thd);
3681+ thread_cache.push_back(thd);
3682 wake_thread++;
3683 pthread_cond_signal(&COND_thread_cache);
3684 }
3685@@ -9524,12 +9522,13 @@
3686 if ((file = my_create(pidfile_name,0664,
3687 O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0)
3688 {
3689- char buff[21], *end;
3690+ char buff[MAX_BIGINT_WIDTH + 1], *end;
3691 end= int10_to_str((long) getpid(), buff, 10);
3692 *end++= '\n';
3693 if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
3694 {
3695 (void) my_close(file, MYF(0));
3696+ pid_file_created= true;
3697 return;
3698 }
3699 (void) my_close(file, MYF(0));
3700@@ -9539,6 +9538,38 @@
3701 }
3702 #endif /* EMBEDDED_LIBRARY */
3703
3704+
3705+/**
3706+ Remove the process' pid file.
3707+
3708+ @param flags file operation flags
3709+*/
3710+
3711+static void delete_pid_file(myf flags)
3712+{
3713+#ifndef EMBEDDED_LIBRARY
3714+ File file;
3715+ if (opt_bootstrap ||
3716+ !pid_file_created ||
3717+ !(file= my_open(pidfile_name, O_RDONLY, flags)))
3718+ return;
3719+
3720+ /* Make sure that the pid file was created by the same process. */
3721+ uchar buff[MAX_BIGINT_WIDTH + 1];
3722+ size_t error= my_read(file, buff, sizeof(buff), flags);
3723+ my_close(file, flags);
3724+ buff[sizeof(buff) - 1]= '\0';
3725+ if (error != MY_FILE_ERROR &&
3726+ atol((char *) buff) == (long) getpid())
3727+ {
3728+ my_delete(pidfile_name, flags);
3729+ pid_file_created= false;
3730+ }
3731+#endif /* EMBEDDED_LIBRARY */
3732+ return;
3733+}
3734+
3735+
3736 /** Clear most status variables. */
3737 void refresh_status(THD *thd)
3738 {
3739
3740=== modified file 'Percona-Server/sql/set_var.cc'
3741--- Percona-Server/sql/set_var.cc 2012-09-05 22:27:47 +0000
3742+++ Percona-Server/sql/set_var.cc 2013-03-07 06:40:28 +0000
3743@@ -2670,6 +2670,9 @@
3744 goto err;
3745 }
3746
3747+ if (!is_filename_allowed(log_file_str, strlen(log_file_str)))
3748+ goto err;
3749+
3750 if (my_stat(path, &f_stat, MYF(0)))
3751 {
3752 /*
3753
3754=== modified file 'Percona-Server/sql/sp_head.cc'
3755--- Percona-Server/sql/sp_head.cc 2012-10-15 15:08:07 +0000
3756+++ Percona-Server/sql/sp_head.cc 2013-03-07 06:40:28 +0000
3757@@ -3860,8 +3860,6 @@
3758 Multi-set key:
3759 db_name\0table_name\0alias\0 - for normal tables
3760 db_name\0table_name\0 - for temporary tables
3761- Note that in both cases we don't take last '\0' into account when
3762- we count length of key.
3763 */
3764 LEX_STRING qname;
3765 uint db_length, table_name_length;
3766@@ -3918,19 +3916,26 @@
3767 for (; table ; table= table->next_global)
3768 if (!table->derived && !table->schema_table)
3769 {
3770- char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\0
3771- uint tlen, alen;
3772+ /*
3773+ Structure of key for the multi-set is "db\0table\0alias\0".
3774+ Since "alias" part can have arbitrary length we use String
3775+ object to construct the key. By default String will use
3776+ buffer allocated on stack with NAME_LEN bytes reserved for
3777+ alias, since in most cases it is going to be smaller than
3778+ NAME_LEN bytes.
3779+ */
3780+ char tname_buff[(NAME_LEN + 1) * 3];
3781+ String tname(tname_buff, sizeof(tname_buff), &my_charset_bin);
3782+ uint temp_table_key_length;
3783
3784- tlen= table->db_length;
3785- memcpy(tname, table->db, tlen);
3786- tname[tlen++]= '\0';
3787- memcpy(tname+tlen, table->table_name, table->table_name_length);
3788- tlen+= table->table_name_length;
3789- tname[tlen++]= '\0';
3790- alen= strlen(table->alias);
3791- memcpy(tname+tlen, table->alias, alen);
3792- tlen+= alen;
3793- tname[tlen]= '\0';
3794+ tname.length(0);
3795+ tname.append(table->db, table->db_length);
3796+ tname.append('\0');
3797+ tname.append(table->table_name, table->table_name_length);
3798+ tname.append('\0');
3799+ temp_table_key_length= tname.length();
3800+ tname.append(table->alias);
3801+ tname.append('\0');
3802
3803 /*
3804 Upgrade the lock type because this table list will be used
3805@@ -3945,9 +3950,10 @@
3806 (and therefore should not be prelocked). Otherwise we will erroneously
3807 treat table with same name but with different alias as non-temporary.
3808 */
3809- if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) ||
3810- ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname,
3811- tlen - alen - 1)) &&
3812+ if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
3813+ tname.length())) ||
3814+ ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
3815+ temp_table_key_length)) &&
3816 tab->temp))
3817 {
3818 if (tab->lock_type < table->lock_type)
3819@@ -3966,11 +3972,11 @@
3820 lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
3821 {
3822 tab->temp= TRUE;
3823- tab->qname.length= tlen - alen - 1;
3824+ tab->qname.length= temp_table_key_length;
3825 }
3826 else
3827- tab->qname.length= tlen;
3828- tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);
3829+ tab->qname.length= tname.length();
3830+ tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length);
3831 if (!tab->qname.str)
3832 return FALSE;
3833 tab->table_name_length= table->table_name_length;
3834@@ -4039,7 +4045,7 @@
3835 if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *
3836 stab->lock_count)) ||
3837 !(key_buff= (char*)thd->memdup(stab->qname.str,
3838- stab->qname.length + 1)))
3839+ stab->qname.length)))
3840 DBUG_RETURN(FALSE);
3841
3842 for (uint j= 0; j < stab->lock_count; j++)
3843
3844=== modified file 'Percona-Server/sql/sql_acl.cc'
3845--- Percona-Server/sql/sql_acl.cc 2012-11-28 22:39:45 +0000
3846+++ Percona-Server/sql/sql_acl.cc 2013-03-07 06:40:28 +0000
3847@@ -195,7 +195,17 @@
3848 static my_bool acl_load(THD *thd, TABLE_LIST *tables);
3849 static my_bool grant_load(THD *thd, TABLE_LIST *tables);
3850 static inline void get_grantor(THD *thd, char* grantor);
3851-
3852+/*
3853+ Enumeration of various ACL's and Hashes used in handle_grant_struct()
3854+*/
3855+enum enum_acl_lists
3856+{
3857+ USER_ACL= 0,
3858+ DB_ACL,
3859+ COLUMN_PRIVILEGES_HASH,
3860+ PROC_PRIVILEGES_HASH,
3861+ FUNC_PRIVILEGES_HASH
3862+};
3863 /*
3864 Convert scrambled password to binary form, according to scramble type,
3865 Binary form is stored in user.salt.
3866@@ -1346,10 +1356,19 @@
3867 {
3868 ulong host_access= ~(ulong)0, db_access= 0;
3869 uint i;
3870- size_t key_length;
3871+ size_t key_length, copy_length;
3872 char key[ACL_KEY_LENGTH],*tmp_db,*end;
3873 acl_entry *entry;
3874 DBUG_ENTER("acl_get");
3875+
3876+ copy_length= (size_t) (strlen(ip ? ip : "") +
3877+ strlen(user ? user : "") +
3878+ strlen(db ? db : ""));
3879+ /*
3880+ Make sure that strmov() operations do not result in buffer overflow.
3881+ */
3882+ if (copy_length >= ACL_KEY_LENGTH)
3883+ DBUG_RETURN(0);
3884
3885 tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1;
3886 end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db);
3887@@ -4336,6 +4355,16 @@
3888 char helping [NAME_LEN+USERNAME_LENGTH+2], *end;
3889 uint len;
3890 bool error= TRUE;
3891+ size_t copy_length;
3892+
3893+ copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") +
3894+ strlen(db ? db : ""));
3895+
3896+ /*
3897+ Make sure that strmov() operations do not result in buffer overflow.
3898+ */
3899+ if (copy_length >= (NAME_LEN+USERNAME_LENGTH+2))
3900+ return 1;
3901
3902 end= strmov(helping, sctx->priv_user) + 1;
3903 end= strnmov(end, db, helping + sizeof(helping) - end);
3904@@ -5402,19 +5431,19 @@
3905 Delete from grant structure if drop is true.
3906 Update in grant structure if drop is false and user_to is not NULL.
3907 Search in grant structure if drop is false and user_to is NULL.
3908- Structures are numbered as follows:
3909- 0 acl_users
3910- 1 acl_dbs
3911- 2 column_priv_hash
3912- 3 proc_priv_hash
3913- 4 func_priv_hash
3914+ Structures are enumerated as follows:
3915+ 0 ACL_USER
3916+ 1 ACL_DB
3917+ 2 COLUMN_PRIVILEGES_HASH
3918+ 3 PROC_PRIVILEGES_HASH
3919+ 4 FUNC_PRIVILEGES_HASH
3920
3921 @retval > 0 At least one element matched.
3922 @retval 0 OK, but no element matched.
3923- @retval -1 Wrong arguments to function.
3924+ @retval -1 Wrong arguments to function or Out of Memory
3925 */
3926
3927-static int handle_grant_struct(uint struct_no, bool drop,
3928+static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
3929 LEX_USER *user_from, LEX_USER *user_to)
3930 {
3931 int result= 0;
3932@@ -5425,6 +5454,11 @@
3933 ACL_USER *acl_user= NULL;
3934 ACL_DB *acl_db= NULL;
3935 GRANT_NAME *grant_name= NULL;
3936+ /*
3937+ Dynamic array acl_grant_name used to store pointers to all
3938+ GRANT_NAME objects
3939+ */
3940+ Dynamic_array<GRANT_NAME *> acl_grant_name;
3941 HASH *grant_name_hash= NULL;
3942 DBUG_ENTER("handle_grant_struct");
3943 DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",
3944@@ -5437,21 +5471,21 @@
3945
3946 /* Get the number of elements in the in-memory structure. */
3947 switch (struct_no) {
3948- case 0:
3949+ case USER_ACL:
3950 elements= acl_users.elements;
3951 break;
3952- case 1:
3953+ case DB_ACL:
3954 elements= acl_dbs.elements;
3955 break;
3956- case 2:
3957+ case COLUMN_PRIVILEGES_HASH:
3958 elements= column_priv_hash.records;
3959 grant_name_hash= &column_priv_hash;
3960 break;
3961- case 3:
3962+ case PROC_PRIVILEGES_HASH:
3963 elements= proc_priv_hash.records;
3964 grant_name_hash= &proc_priv_hash;
3965 break;
3966- case 4:
3967+ case FUNC_PRIVILEGES_HASH:
3968 elements= func_priv_hash.records;
3969 grant_name_hash= &func_priv_hash;
3970 break;
3971@@ -5470,21 +5504,21 @@
3972 Get a pointer to the element.
3973 */
3974 switch (struct_no) {
3975- case 0:
3976+ case USER_ACL:
3977 acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
3978 user= acl_user->user;
3979 host= acl_user->host.hostname;
3980 break;
3981
3982- case 1:
3983+ case DB_ACL:
3984 acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
3985 user= acl_db->user;
3986 host= acl_db->host.hostname;
3987 break;
3988
3989- case 2:
3990- case 3:
3991- case 4:
3992+ case COLUMN_PRIVILEGES_HASH:
3993+ case PROC_PRIVILEGES_HASH:
3994+ case FUNC_PRIVILEGES_HASH:
3995 grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx);
3996 user= grant_name->user;
3997 host= grant_name->host.hostname;
3998@@ -5510,86 +5544,60 @@
3999 if ( drop )
4000 {
4001 switch ( struct_no ) {
4002- case 0:
4003+ case USER_ACL:
4004 delete_dynamic_element(&acl_users, idx);
4005- break;
4006-
4007- case 1:
4008- delete_dynamic_element(&acl_dbs, idx);
4009- break;
4010-
4011- case 2:
4012- case 3:
4013- case 4:
4014- hash_delete(grant_name_hash, (uchar*) grant_name);
4015- break;
4016- }
4017- elements--;
4018- /*
4019+ elements--;
4020+ /*
4021 - If we are iterating through an array then we just have moved all
4022 elements after the current element one position closer to its head.
4023 This means that we have to take another look at the element at
4024 current position as it is a new element from the array's tail.
4025- - If we are iterating through a hash the current element was replaced
4026- with one of elements from the tail. So we also have to take a look
4027- at the new element in current position.
4028- Note that in our HASH implementation hash_delete() won't move any
4029- elements with position after current one to position before the
4030- current (i.e. from the tail to the head), so it is safe to continue
4031- iteration without re-starting.
4032- */
4033- idx--;
4034+ - This is valid for USER_ACL, DB_ACL.
4035+ */
4036+ idx--;
4037+ break;
4038+
4039+ case DB_ACL:
4040+ delete_dynamic_element(&acl_dbs, idx);
4041+ elements--;
4042+ idx--;
4043+ break;
4044+
4045+ case COLUMN_PRIVILEGES_HASH:
4046+ case PROC_PRIVILEGES_HASH:
4047+ case FUNC_PRIVILEGES_HASH:
4048+ /*
4049+ Deleting while traversing a hash table is not valid procedure and
4050+ hence we save pointers to GRANT_NAME objects for later processing.
4051+ */
4052+ if (acl_grant_name.append(grant_name))
4053+ DBUG_RETURN(-1);
4054+ break;
4055+ }
4056 }
4057 else if ( user_to )
4058 {
4059 switch ( struct_no ) {
4060- case 0:
4061+ case USER_ACL:
4062 acl_user->user= strdup_root(&mem, user_to->user.str);
4063 acl_user->host.hostname= strdup_root(&mem, user_to->host.str);
4064 break;
4065
4066- case 1:
4067+ case DB_ACL:
4068 acl_db->user= strdup_root(&mem, user_to->user.str);
4069 acl_db->host.hostname= strdup_root(&mem, user_to->host.str);
4070 break;
4071
4072- case 2:
4073- case 3:
4074- case 4:
4075- {
4076- /*
4077- Save old hash key and its length to be able properly update
4078- element position in hash.
4079- */
4080- char *old_key= grant_name->hash_key;
4081- size_t old_key_length= grant_name->key_length;
4082-
4083- /*
4084- Update the grant structure with the new user name and host name.
4085- */
4086- grant_name->set_user_details(user_to->host.str, grant_name->db,
4087- user_to->user.str, grant_name->tname,
4088- TRUE);
4089-
4090- /*
4091- Since username is part of the hash key, when the user name
4092- is renamed, the hash key is changed. Update the hash to
4093- ensure that the position matches the new hash key value
4094- */
4095- hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
4096- old_key_length);
4097- /*
4098- hash_update() operation could have moved element from the tail
4099- of the hash to the current position. So we need to take a look
4100- at the element in current position once again.
4101- Thanks to the fact that hash_update() for our HASH implementation
4102- won't move any elements from the tail of the hash to the positions
4103- before the current one (a.k.a. head) it is safe to continue
4104- iteration without restarting.
4105- */
4106- idx--;
4107- break;
4108- }
4109+ case COLUMN_PRIVILEGES_HASH:
4110+ case PROC_PRIVILEGES_HASH:
4111+ case FUNC_PRIVILEGES_HASH:
4112+ /*
4113+ Updating while traversing a hash table is not valid procedure and
4114+ hence we save pointers to GRANT_NAME objects for later processing.
4115+ */
4116+ if (acl_grant_name.append(grant_name))
4117+ DBUG_RETURN(-1);
4118+ break;
4119 }
4120 }
4121 else
4122@@ -5598,6 +5606,48 @@
4123 break;
4124 }
4125 }
4126+
4127+ if (drop || user_to)
4128+ {
4129+ /*
4130+ Traversing the elements stored in acl_grant_name dynamic array
4131+ to either delete or update them.
4132+ */
4133+ for (int i= 0; i < acl_grant_name.elements(); ++i)
4134+ {
4135+ grant_name= acl_grant_name.at(i);
4136+
4137+ if (drop)
4138+ {
4139+ my_hash_delete(grant_name_hash, (uchar *) grant_name);
4140+ }
4141+ else
4142+ {
4143+ /*
4144+ Save old hash key and its length to be able properly update
4145+ element position in hash.
4146+ */
4147+ char *old_key= grant_name->hash_key;
4148+ size_t old_key_length= grant_name->key_length;
4149+
4150+ /*
4151+ Update the grant structure with the new user name and host name.
4152+ */
4153+ grant_name->set_user_details(user_to->host.str, grant_name->db,
4154+ user_to->user.str, grant_name->tname,
4155+ TRUE);
4156+
4157+ /*
4158+ Since username is part of the hash key, when the user name
4159+ is renamed, the hash key is changed. Update the hash to
4160+ ensure that the position matches the new hash key value
4161+ */
4162+ my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
4163+ old_key_length);
4164+ }
4165+ }
4166+ }
4167+
4168 #ifdef EXTRA_DEBUG
4169 DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result));
4170 #endif
4171@@ -5635,6 +5685,7 @@
4172 {
4173 int result= 0;
4174 int found;
4175+ int ret;
4176 DBUG_ENTER("handle_grant_data");
4177
4178 /* Handle user table. */
4179@@ -5646,14 +5697,19 @@
4180 else
4181 {
4182 /* Handle user array. */
4183- if ((handle_grant_struct(0, drop, user_from, user_to) && ! result) ||
4184- found)
4185+ if (((ret= handle_grant_struct(USER_ACL, drop, user_from, user_to) > 0) &&
4186+ ! result) || found)
4187 {
4188 result= 1; /* At least one record/element found. */
4189 /* If search is requested, we do not need to search further. */
4190 if (! drop && ! user_to)
4191 goto end;
4192 }
4193+ else if (ret < 0)
4194+ {
4195+ result= -1;
4196+ goto end;
4197+ }
4198 }
4199
4200 /* Handle db table. */
4201@@ -5665,14 +5721,19 @@
4202 else
4203 {
4204 /* Handle db array. */
4205- if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) ||
4206- found) && ! result)
4207+ if ((((ret= handle_grant_struct(DB_ACL, drop, user_from, user_to) > 0) &&
4208+ ! result) || found) && ! result)
4209 {
4210 result= 1; /* At least one record/element found. */
4211 /* If search is requested, we do not need to search further. */
4212 if (! drop && ! user_to)
4213 goto end;
4214 }
4215+ else if (ret < 0)
4216+ {
4217+ result= -1;
4218+ goto end;
4219+ }
4220 }
4221
4222 /* Handle stored routines table. */
4223@@ -5684,23 +5745,35 @@
4224 else
4225 {
4226 /* Handle procs array. */
4227- if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) ||
4228- found) && ! result)
4229+ if ((((ret= handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from,
4230+ user_to) > 0) && ! result) || found) &&
4231+ ! result)
4232 {
4233 result= 1; /* At least one record/element found. */
4234 /* If search is requested, we do not need to search further. */
4235 if (! drop && ! user_to)
4236 goto end;
4237 }
4238+ else if (ret < 0)
4239+ {
4240+ result= -1;
4241+ goto end;
4242+ }
4243 /* Handle funcs array. */
4244- if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) ||
4245- found) && ! result)
4246+ if ((((ret= handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from,
4247+ user_to) > 0) && ! result) || found) &&
4248+ ! result)
4249 {
4250 result= 1; /* At least one record/element found. */
4251 /* If search is requested, we do not need to search further. */
4252 if (! drop && ! user_to)
4253 goto end;
4254 }
4255+ else if (ret < 0)
4256+ {
4257+ result= -1;
4258+ goto end;
4259+ }
4260 }
4261
4262 /* Handle tables table. */
4263@@ -5728,9 +5801,12 @@
4264 else
4265 {
4266 /* Handle columns hash. */
4267- if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) ||
4268- found) && ! result)
4269+ if ((((ret= handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from,
4270+ user_to) > 0) && ! result) || found) &&
4271+ ! result)
4272 result= 1; /* At least one record/element found. */
4273+ else if (ret < 0)
4274+ result= -1;
4275 }
4276 }
4277 end:
4278
4279=== modified file 'Percona-Server/sql/sql_base.cc'
4280--- Percona-Server/sql/sql_base.cc 2012-10-05 07:20:04 +0000
4281+++ Percona-Server/sql/sql_base.cc 2013-03-07 06:40:28 +0000
4282@@ -242,12 +242,9 @@
4283 uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
4284 bool tmp_table)
4285 {
4286- char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2);
4287- *db_end++= '\0';
4288- char *table_end= strnmov(db_end, table_list->table_name,
4289- key + MAX_DBKEY_LENGTH - 1 - db_end);
4290- *table_end++= '\0';
4291- uint key_length= (uint) (table_end-key);
4292+ uint key_length= create_table_def_key(key, table_list->db,
4293+ table_list->table_name);
4294+
4295 if (tmp_table)
4296 {
4297 int4store(key + key_length, thd->server_id);
4298@@ -623,13 +620,10 @@
4299 TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
4300 {
4301 char key[NAME_LEN*2+2];
4302- TABLE_LIST table_list;
4303 uint key_length;
4304 safe_mutex_assert_owner(&LOCK_open);
4305
4306- table_list.db= (char*) db;
4307- table_list.table_name= (char*) table_name;
4308- key_length= create_table_def_key((THD*) 0, key, &table_list, 0);
4309+ key_length= create_table_def_key(key, db, table_name);
4310 return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length);
4311 }
4312
4313@@ -2443,7 +2437,7 @@
4314 uint key_length;
4315 DBUG_ENTER("lock_table_name_if_not_cached");
4316
4317- key_length= (uint)(strmov(strmov(key, db) + 1, table_name) - key) + 1;
4318+ key_length= create_table_def_key(key, db, table_name);
4319 VOID(pthread_mutex_lock(&LOCK_open));
4320
4321 if (hash_search(&open_cache, (uchar *)key, key_length))
4322@@ -3049,7 +3043,7 @@
4323 TABLE *find_locked_table(THD *thd, const char *db,const char *table_name)
4324 {
4325 char key[MAX_DBKEY_LENGTH];
4326- uint key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
4327+ uint key_length= create_table_def_key(key, db, table_name);
4328
4329 for (TABLE *table=thd->open_tables; table ; table=table->next)
4330 {
4331@@ -5779,17 +5773,27 @@
4332 }
4333
4334
4335-bool rm_temporary_table(handlerton *base, char *path)
4336+/**
4337+ Delete a temporary table.
4338+
4339+ @param base Handlerton for table to be deleted.
4340+ @param path Path to the table to be deleted (i.e. path
4341+ to its .frm without an extension).
4342+
4343+ @retval false - success.
4344+ @retval true - failure.
4345+*/
4346+
4347+bool rm_temporary_table(handlerton *base, const char *path)
4348 {
4349 bool error=0;
4350 handler *file;
4351- char *ext;
4352+ char frm_path[FN_REFLEN + 1];
4353 DBUG_ENTER("rm_temporary_table");
4354
4355- strmov(ext= strend(path), reg_ext);
4356- if (my_delete(path,MYF(0)))
4357+ strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS);
4358+ if (my_delete(frm_path, MYF(0)))
4359 error=1; /* purecov: inspected */
4360- *ext= 0; // remove extension
4361 file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base);
4362 if (file && file->ha_delete_table(path))
4363 {
4364@@ -8675,7 +8679,7 @@
4365 DBUG_ENTER("remove_table_from_cache");
4366 DBUG_PRINT("enter", ("table: '%s'.'%s' flags: %u", db, table_name, flags));
4367
4368- key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
4369+ key_length= create_table_def_key(key, db, table_name);
4370 for (;;)
4371 {
4372 HASH_SEARCH_STATE state;
4373@@ -8873,12 +8877,14 @@
4374 {
4375 LEX_STRING pathstr;
4376 File_parser *parser;
4377- char path[FN_REFLEN];
4378+ char path[FN_REFLEN+1];
4379 DBUG_ENTER("open_new_frm");
4380
4381 /* Create path with extension */
4382- pathstr.length= (uint) (strxmov(path, share->normalized_path.str, reg_ext,
4383- NullS)- path);
4384+ pathstr.length= (uint) (strxnmov(path, sizeof(path) - 1,
4385+ share->normalized_path.str,
4386+ reg_ext,
4387+ NullS) - path);
4388 pathstr.str= path;
4389
4390 if ((parser= sql_parse_prepare(&pathstr, mem_root, 1)))
4391@@ -9019,7 +9025,7 @@
4392 TABLE *table;
4393 DBUG_ENTER("mysql_wait_completed_table");
4394
4395- key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1;
4396+ key_length= create_table_def_key(key, lpt->db, lpt->table_name);
4397 VOID(pthread_mutex_lock(&LOCK_open));
4398 HASH_SEARCH_STATE state;
4399 for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length,
4400
4401=== modified file 'Percona-Server/sql/sql_cache.cc'
4402--- Percona-Server/sql/sql_cache.cc 2012-04-02 02:09:15 +0000
4403+++ Percona-Server/sql/sql_cache.cc 2013-03-07 06:40:28 +0000
4404@@ -3025,8 +3025,8 @@
4405 char key[MAX_DBKEY_LENGTH];
4406 uint key_length;
4407
4408- key_length=(uint) (strmov(strmov(key,table_list->db)+1,
4409- table_list->table_name) -key)+ 1;
4410+ key_length= create_table_def_key(key, table_list->db,
4411+ table_list->table_name);
4412
4413 // We don't store temporary tables => no key_length+=4 ...
4414 invalidate_table(thd, (uchar *)key, key_length);
4415@@ -3147,8 +3147,8 @@
4416 DBUG_PRINT("qcache", ("view: %s db: %s",
4417 tables_used->view_name.str,
4418 tables_used->view_db.str));
4419- key_length= (uint) (strmov(strmov(key, tables_used->view_db.str) + 1,
4420- tables_used->view_name.str) - key) + 1;
4421+ key_length= create_table_def_key(key, tables_used->view_db.str,
4422+ tables_used->view_name.str);
4423 /*
4424 There are not callback function for for VIEWs
4425 */
4426@@ -4209,15 +4209,14 @@
4427 case Query_cache_block::RES_CONT:
4428 case Query_cache_block::RESULT:
4429 {
4430- DBUG_PRINT("qcache", ("block 0x%lx RES* (%d)", (ulong) block,
4431- (int) block->type));
4432- if (*border == 0)
4433- break;
4434- Query_cache_block *query_block = block->result()->parent(),
4435- *next = block->next,
4436- *prev = block->prev;
4437- Query_cache_block::block_type type = block->type;
4438- BLOCK_LOCK_WR(query_block);
4439+ DBUG_PRINT("qcache", ("block 0x%lx RES* (%d)", (ulong) block,
4440+ (int) block->type));
4441+ if (*border == 0)
4442+ break;
4443+ Query_cache_block *query_block= block->result()->parent();
4444+ BLOCK_LOCK_WR(query_block);
4445+ Query_cache_block *next= block->next, *prev= block->prev;
4446+ Query_cache_block::block_type type= block->type;
4447 ulong len = block->length, used = block->used;
4448 Query_cache_block *pprev = block->pprev,
4449 *pnext = block->pnext,
4450@@ -4379,8 +4378,9 @@
4451 *db_length= (filename - dbname) - 1;
4452 DBUG_PRINT("qcache", ("table '%-.*s.%s'", *db_length, dbname, filename));
4453
4454- DBUG_RETURN((uint) (strmov(strmake(key, dbname, *db_length) + 1,
4455- filename) -key) + 1);
4456+ DBUG_RETURN((uint) (strmake(strmake(key, dbname,
4457+ min(*db_length, NAME_LEN)) + 1,
4458+ filename, NAME_LEN) - key) + 1);
4459 }
4460
4461 /****************************************************************************
4462
4463=== modified file 'Percona-Server/sql/sql_connect.cc'
4464--- Percona-Server/sql/sql_connect.cc 2013-01-20 16:49:07 +0000
4465+++ Percona-Server/sql/sql_connect.cc 2013-03-07 06:40:28 +0000
4466@@ -914,6 +914,7 @@
4467
4468 USER_RESOURCES ur;
4469 int res= acl_getroot(thd, &ur, passwd, passwd_len);
4470+ DBUG_EXECUTE_IF("password_format_mismatch",{res= -1;};);
4471 #ifndef EMBEDDED_LIBRARY
4472 if (res == -1)
4473 {
4474@@ -924,6 +925,12 @@
4475 in old format.
4476 */
4477 NET *net= &thd->net;
4478+ DBUG_EXECUTE_IF("password_format_mismatch",
4479+ {
4480+ inc_host_errors(&thd->remote.sin_addr);
4481+ my_error(ER_HANDSHAKE_ERROR, MYF(0));
4482+ DBUG_RETURN(1);
4483+ };);
4484 if (opt_secure_auth_local)
4485 {
4486 my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0),
4487@@ -1395,6 +1402,8 @@
4488 size_t passwd_len;
4489 char *user;
4490 size_t user_len;
4491+ uint charset_code= 0;
4492+ size_t bytes_remaining_in_packet= 0;
4493
4494 DBUG_PRINT("info",
4495 ("New connection received on %s", vio_description(net->vio)));
4496@@ -1411,6 +1420,19 @@
4497 my_error(ER_BAD_HOST_ERROR, MYF(0));
4498 return 1;
4499 }
4500+ /* BEGIN : DEBUG */
4501+ DBUG_EXECUTE_IF("addr_fake_ipv4",
4502+ {
4503+ struct sockaddr *sa= (sockaddr *) &net->vio->remote;
4504+ sa->sa_family= AF_INET;
4505+ struct in_addr *ip4= &((struct sockaddr_in *)sa)->sin_addr;
4506+ /* See RFC 5737, 192.0.2.0/23 is reserved */
4507+ const char* fake= "192.0.2.4";
4508+ ip4->s_addr= inet_addr(fake);
4509+ strcpy(ip, fake);
4510+ };);
4511+ /* END : DEBUG */
4512+
4513 if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
4514 return 1; /* The error is set by my_strdup(). */
4515 thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;
4516@@ -1506,32 +1528,31 @@
4517 (uchar*) buff, (size_t) (end-buff)) ||
4518 (pkt_len= my_net_read(net)) == packet_error)
4519 {
4520- inc_host_errors(&thd->remote.sin_addr);
4521- my_error(ER_HANDSHAKE_ERROR, MYF(0));
4522- return 1;
4523+ goto error;
4524 }
4525 }
4526 #ifdef _CUSTOMCONFIG_
4527 #include "_cust_sql_parse.h"
4528 #endif
4529- if (connect_errors)
4530- reset_host_errors(&thd->remote.sin_addr);
4531 if (thd->packet.alloc(thd->variables.net_buffer_length))
4532 return 1; /* The error is set by alloc(). */
4533
4534- uint charset_code= 0;
4535 end= (char *)net->read_pos;
4536 /*
4537 In order to safely scan a head for '\0' string terminators
4538 we must keep track of how many bytes remain in the allocated
4539 buffer or we might read past the end of the buffer.
4540 */
4541- size_t bytes_remaining_in_packet= pkt_len;
4542+ bytes_remaining_in_packet= pkt_len;
4543
4544 /*
4545 Peek ahead on the client capability packet and determine which version of
4546 the protocol should be used.
4547 */
4548+ DBUG_EXECUTE_IF("host_error_packet_length",
4549+ {
4550+ bytes_remaining_in_packet= 0;
4551+ };);
4552 if (bytes_remaining_in_packet < 2)
4553 goto error;
4554
4555@@ -1590,6 +1611,10 @@
4556
4557 skip_to_ssl:
4558
4559+ DBUG_EXECUTE_IF("host_error_charset",
4560+ {
4561+ goto error;
4562+ };);
4563 DBUG_PRINT("info", ("client_character_set: %u", charset_code));
4564 if (thd_init_client_charset(thd, charset_code))
4565 goto error;
4566@@ -1658,6 +1683,10 @@
4567 bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40;
4568 }
4569
4570+ DBUG_EXECUTE_IF("host_error_SSL_layering",
4571+ {
4572+ packet_has_required_size= 0;
4573+ };);
4574 if (!packet_has_required_size)
4575 goto error;
4576 }
4577@@ -1683,6 +1712,11 @@
4578 get_string= get_40_protocol_string;
4579
4580 user= get_string(&end, &bytes_remaining_in_packet, &user_len);
4581+ DBUG_EXECUTE_IF("host_error_user",
4582+ {
4583+ user= NULL;
4584+ };);
4585+
4586 if (user == NULL)
4587 goto error;
4588
4589@@ -1710,6 +1744,11 @@
4590 passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len);
4591 }
4592
4593+ DBUG_EXECUTE_IF("host_error_password",
4594+ {
4595+ passwd= NULL;
4596+ };);
4597+
4598 if (passwd == NULL)
4599 goto error;
4600
4601@@ -1770,7 +1809,20 @@
4602
4603 if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))
4604 return 1; /* The error is set by my_strdup(). */
4605- return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE);
4606+
4607+ if (!check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE))
4608+ {
4609+ /*
4610+ Call to reset_host_errors() should be made only when all sanity checks
4611+ are done and connection is going to be a successful.
4612+ */
4613+ reset_host_errors(&thd->remote.sin_addr);
4614+ return 0;
4615+ }
4616+ else
4617+ {
4618+ return 1;
4619+ }
4620
4621 error:
4622 inc_host_errors(&thd->remote.sin_addr);
4623
4624=== modified file 'Percona-Server/sql/sql_lex.cc'
4625--- Percona-Server/sql/sql_lex.cc 2012-08-20 03:14:02 +0000
4626+++ Percona-Server/sql/sql_lex.cc 2013-03-07 06:40:28 +0000
4627@@ -1621,6 +1621,7 @@
4628 ref_pointer_array= 0;
4629 select_n_where_fields= 0;
4630 select_n_having_items= 0;
4631+ n_child_sum_items= 0;
4632 subquery_in_having= explicit_limit= 0;
4633 is_item_list_lookup= 0;
4634 first_execution= 1;
4635
4636=== modified file 'Percona-Server/sql/sql_lex.h'
4637--- Percona-Server/sql/sql_lex.h 2012-08-20 03:14:02 +0000
4638+++ Percona-Server/sql/sql_lex.h 2013-03-07 06:40:28 +0000
4639@@ -47,7 +47,11 @@
4640 #else
4641 #include "lex_symbol.h"
4642 #if MYSQL_LEX
4643-#include "sql_yacc.h"
4644+# if YACC_HEXT_HH
4645+# include "sql_yacc.hh"
4646+# else
4647+# include "sql_yacc.h"
4648+# endif
4649 #define LEX_YYSTYPE YYSTYPE *
4650 #else
4651 #define LEX_YYSTYPE void *
4652
4653=== modified file 'Percona-Server/sql/sql_list.h'
4654--- Percona-Server/sql/sql_list.h 2011-06-30 15:37:13 +0000
4655+++ Percona-Server/sql/sql_list.h 2013-03-07 06:40:28 +0000
4656@@ -1,7 +1,6 @@
4657 #ifndef INCLUDES_MYSQL_SQL_LIST_H
4658 #define INCLUDES_MYSQL_SQL_LIST_H
4659-/*
4660- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
4661+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
4662
4663 This program is free software; you can redistribute it and/or modify
4664 it under the terms of the GNU General Public License as published by
4665@@ -165,6 +164,14 @@
4666 public:
4667 uint elements;
4668
4669+ bool operator==(const base_list &rhs) const
4670+ {
4671+ return
4672+ elements == rhs.elements &&
4673+ first == rhs.first &&
4674+ last == rhs.last;
4675+ }
4676+
4677 inline void empty() { elements=0; first= &end_of_list; last=&first;}
4678 inline base_list() { empty(); }
4679 /**
4680
4681=== modified file 'Percona-Server/sql/sql_profile.cc'
4682--- Percona-Server/sql/sql_profile.cc 2012-08-20 03:14:02 +0000
4683+++ Percona-Server/sql/sql_profile.cc 2013-03-07 06:40:28 +0000
4684@@ -39,6 +39,7 @@
4685 #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)
4686
4687 #define MAX_QUERY_LENGTH 300
4688+#define MAX_QUERY_HISTORY 101
4689
4690 /* Reserved for systems that can't record the function name in source. */
4691 const char * const _unknown_func_ = "<unknown>";
4692@@ -247,9 +248,12 @@
4693 QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)
4694 :profiling(profiling_arg), profiling_query_id(0), query_source(NULL)
4695 {
4696- profile_start= new PROF_MEASUREMENT(this, status_arg);
4697- entries.push_back(profile_start);
4698- profile_end= profile_start;
4699+ m_seq_counter= 1;
4700+ PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg);
4701+ prof->m_seq= m_seq_counter++;
4702+ m_start_time_usecs= prof->time_usecs;
4703+ m_end_time_usecs= m_start_time_usecs;
4704+ entries.push_back(prof);
4705 }
4706
4707 QUERY_PROFILE::~QUERY_PROFILE()
4708@@ -289,9 +293,14 @@
4709 else
4710 prof= new PROF_MEASUREMENT(this, status_arg);
4711
4712- profile_end= prof;
4713+ prof->m_seq= m_seq_counter++;
4714+ m_end_time_usecs= prof->time_usecs;
4715 entries.push_back(prof);
4716
4717+ /* Maintain the query history size. */
4718+ while (entries.elements > MAX_QUERY_HISTORY)
4719+ delete entries.pop();
4720+
4721 DBUG_VOID_RETURN;
4722 }
4723
4724@@ -452,8 +461,7 @@
4725
4726 String elapsed;
4727
4728- PROF_MEASUREMENT *ps= prof->profile_start;
4729- PROF_MEASUREMENT *pe= prof->profile_end;
4730+ double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs;
4731
4732 if (++idx <= unit->offset_limit_cnt)
4733 continue;
4734@@ -462,7 +470,7 @@
4735
4736 protocol->prepare_for_resend();
4737 protocol->store((uint32)(prof->profiling_query_id));
4738- protocol->store((double)(pe->time_usecs - ps->time_usecs)/(1000.0*1000),
4739+ protocol->store((double)(query_time_usecs/(1000.0*1000)),
4740 (uint32) TIME_FLOAT_DIGITS-1, &elapsed);
4741 if (prof->query_source != NULL)
4742 protocol->store(prof->query_source, strlen(prof->query_source),
4743@@ -634,17 +642,18 @@
4744 us also include a numbering of each state per query. The query_id and
4745 the "seq" together are unique.
4746 */
4747- ulonglong seq;
4748+ ulong seq;
4749
4750 void *entry_iterator;
4751 PROF_MEASUREMENT *entry, *previous= NULL;
4752 /* ...and for each query, go through all its state-change steps. */
4753- for (seq= 0, entry_iterator= query->entries.new_iterator();
4754+ for (entry_iterator= query->entries.new_iterator();
4755 entry_iterator != NULL;
4756 entry_iterator= query->entries.iterator_next(entry_iterator),
4757- seq++, previous=entry, row_number++)
4758+ previous=entry, row_number++)
4759 {
4760 entry= query->entries.iterator_value(entry_iterator);
4761+ seq= entry->m_seq;
4762
4763 /* Skip the first. We count spans of fence, not fence-posts. */
4764 if (previous == NULL) continue;
4765
4766=== modified file 'Percona-Server/sql/sql_profile.h'
4767--- Percona-Server/sql/sql_profile.h 2011-11-24 01:59:44 +0000
4768+++ Percona-Server/sql/sql_profile.h 2013-03-07 06:40:28 +0000
4769@@ -186,6 +186,7 @@
4770 char *file;
4771 unsigned int line;
4772
4773+ ulong m_seq;
4774 double time_usecs;
4775 double cpu_time_usecs;
4776 PROF_MEASUREMENT();
4777@@ -212,8 +213,9 @@
4778 query_id_t profiling_query_id; /* Session-specific id. */
4779 char *query_source;
4780
4781- PROF_MEASUREMENT *profile_start;
4782- PROF_MEASUREMENT *profile_end;
4783+ double m_start_time_usecs;
4784+ double m_end_time_usecs;
4785+ ulong m_seq_counter;
4786 Queue<PROF_MEASUREMENT> entries;
4787
4788
4789
4790=== modified file 'Percona-Server/sql/sql_repl.cc'
4791--- Percona-Server/sql/sql_repl.cc 2012-10-05 07:20:04 +0000
4792+++ Percona-Server/sql/sql_repl.cc 2013-03-07 06:40:28 +0000
4793@@ -869,6 +869,8 @@
4794
4795 if (thd->lex->mi.pos)
4796 {
4797+ if (thd->lex->mi.relay_log_pos)
4798+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
4799 mi->rli.until_condition= Relay_log_info::UNTIL_MASTER_POS;
4800 mi->rli.until_log_pos= thd->lex->mi.pos;
4801 /*
4802@@ -880,6 +882,8 @@
4803 }
4804 else if (thd->lex->mi.relay_log_pos)
4805 {
4806+ if (thd->lex->mi.pos)
4807+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
4808 mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS;
4809 mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
4810 strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
4811
4812=== modified file 'Percona-Server/sql/sql_select.cc'
4813--- Percona-Server/sql/sql_select.cc 2012-10-16 04:49:59 +0000
4814+++ Percona-Server/sql/sql_select.cc 2013-03-07 06:40:28 +0000
4815@@ -1,4 +1,4 @@
4816-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
4817+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
4818
4819 This program is free software; you can redistribute it and/or modify
4820 it under the terms of the GNU General Public License as published by
4821@@ -1699,6 +1699,8 @@
4822 */
4823 void JOIN::restore_tmp()
4824 {
4825+ DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
4826+ DBUG_ASSERT(tmp_join != this);
4827 memcpy(tmp_join, this, (size_t) sizeof(JOIN));
4828 }
4829
4830@@ -7116,21 +7118,19 @@
4831 }
4832 }
4833 }
4834- /*
4835- We are not using tables anymore
4836- Unlock all tables. We may be in an INSERT .... SELECT statement.
4837- */
4838 if (full)
4839 {
4840- if (tmp_join)
4841- tmp_table_param.copy_field= 0;
4842+ /*
4843+ Ensure that the following delete_elements() would not be called
4844+ twice for the same list.
4845+ */
4846+ if (tmp_join && tmp_join != this &&
4847+ tmp_join->group_fields == this->group_fields)
4848+ tmp_join->group_fields.empty();
4849+
4850+ // Run Cached_item DTORs!
4851 group_fields.delete_elements();
4852- /*
4853- Ensure that the above delete_elements() would not be called
4854- twice for the same list.
4855- */
4856- if (tmp_join && tmp_join != this)
4857- tmp_join->group_fields= group_fields;
4858+
4859 /*
4860 We can't call delete_elements() on copy_funcs as this will cause
4861 problems in free_elements() as some of the elements are then deleted.
4862
4863=== modified file 'Percona-Server/sql/sql_table.cc'
4864--- Percona-Server/sql/sql_table.cc 2012-10-05 07:20:04 +0000
4865+++ Percona-Server/sql/sql_table.cc 2013-03-07 06:40:28 +0000
4866@@ -1,5 +1,5 @@
4867 /*
4868- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
4869+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
4870
4871 This program is free software; you can redistribute it and/or modify
4872 it under the terms of the GNU General Public License as published by
4873@@ -617,13 +617,6 @@
4874
4875 struct st_global_ddl_log
4876 {
4877- /*
4878- We need to adjust buffer size to be able to handle downgrades/upgrades
4879- where IO_SIZE has changed. We'll set the buffer size such that we can
4880- handle that the buffer size was upto 4 times bigger in the version
4881- that wrote the DDL log.
4882- */
4883- char file_entry_buf[4*IO_SIZE];
4884 char file_name_str[FN_REFLEN];
4885 char *file_name;
4886 DDL_LOG_MEMORY_ENTRY *first_free;
4887@@ -651,51 +644,60 @@
4888 #define DDL_LOG_NUM_ENTRY_POS 0
4889 #define DDL_LOG_NAME_LEN_POS 4
4890 #define DDL_LOG_IO_SIZE_POS 8
4891-
4892-/*
4893- Read one entry from ddl log file
4894- SYNOPSIS
4895- read_ddl_log_file_entry()
4896- entry_no Entry number to read
4897- RETURN VALUES
4898- TRUE Error
4899- FALSE Success
4900+#define DDL_LOG_HEADER_SIZE 12
4901+
4902+/**
4903+ Read one entry from ddl log file.
4904+ @param[out] file_entry_buf Buffer to read into
4905+ @param entry_no Entry number to read
4906+ @param size Number of bytes of the entry to read
4907+
4908+ @return Operation status
4909+ @retval true Error
4910+ @retval false Success
4911 */
4912
4913-static bool read_ddl_log_file_entry(uint entry_no)
4914+static bool read_ddl_log_file_entry(uchar *file_entry_buf,
4915+ uint entry_no,
4916+ uint size)
4917 {
4918 bool error= FALSE;
4919 File file_id= global_ddl_log.file_id;
4920- uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf;
4921 uint io_size= global_ddl_log.io_size;
4922 DBUG_ENTER("read_ddl_log_file_entry");
4923+ DBUG_ASSERT(io_size >= size);
4924
4925- if (my_pread(file_id, file_entry_buf, io_size, io_size * entry_no,
4926- MYF(MY_WME)) != io_size)
4927+ if (my_pread(file_id, file_entry_buf, size, io_size * entry_no,
4928+ MYF(MY_WME)) != size)
4929 error= TRUE;
4930 DBUG_RETURN(error);
4931 }
4932
4933
4934-/*
4935- Write one entry from ddl log file
4936- SYNOPSIS
4937- write_ddl_log_file_entry()
4938- entry_no Entry number to write
4939- RETURN VALUES
4940- TRUE Error
4941- FALSE Success
4942+/**
4943+ Write one entry to ddl log file.
4944+
4945+ @param file_entry_buf Buffer to write
4946+ @param entry_no Entry number to write
4947+ @param size Number of bytes of the entry to write
4948+
4949+ @return Operation status
4950+ @retval true Error
4951+ @retval false Success
4952 */
4953
4954-static bool write_ddl_log_file_entry(uint entry_no)
4955+static bool write_ddl_log_file_entry(uchar *file_entry_buf,
4956+ uint entry_no,
4957+ uint size)
4958 {
4959 bool error= FALSE;
4960 File file_id= global_ddl_log.file_id;
4961- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
4962+ uint io_size= global_ddl_log.io_size;
4963 DBUG_ENTER("write_ddl_log_file_entry");
4964+ DBUG_ASSERT(io_size >= size);
4965
4966- if (my_pwrite(file_id, (uchar*)file_entry_buf,
4967- IO_SIZE, IO_SIZE * entry_no, MYF(MY_WME)) != IO_SIZE)
4968+ if (my_pwrite(file_id, file_entry_buf, size,
4969+ io_size * entry_no, MYF(MY_WME)) != size)
4970 error= TRUE;
4971 DBUG_RETURN(error);
4972 }
4973@@ -714,17 +716,20 @@
4974 {
4975 uint16 const_var;
4976 bool error= FALSE;
4977+ uchar file_entry_buf[DDL_LOG_HEADER_SIZE];
4978 DBUG_ENTER("write_ddl_log_header");
4979+ DBUG_ASSERT((DDL_LOG_NAME_POS + 3 * global_ddl_log.name_len)
4980+ <= global_ddl_log.io_size);
4981
4982- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NUM_ENTRY_POS],
4983+ int4store(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS],
4984 global_ddl_log.num_entries);
4985- const_var= FN_LEN;
4986- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_LEN_POS],
4987- (ulong) const_var);
4988- const_var= IO_SIZE;
4989- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_IO_SIZE_POS],
4990- (ulong) const_var);
4991- if (write_ddl_log_file_entry(0UL))
4992+ const_var= global_ddl_log.name_len;
4993+ int4store(&file_entry_buf[DDL_LOG_NAME_LEN_POS],
4994+ (ulong) const_var);
4995+ const_var= global_ddl_log.io_size;
4996+ int4store(&file_entry_buf[DDL_LOG_IO_SIZE_POS],
4997+ (ulong) const_var);
4998+ if (write_ddl_log_file_entry(file_entry_buf, 0UL, DDL_LOG_HEADER_SIZE))
4999 {
5000 sql_print_error("Error writing ddl log header");
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches