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

Proposed by Stewart Smith
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 469
Proposed branch: lp:~stewart/percona-server/5.1.65
Merge into: lp:percona-server/5.1
Diff against target: 7691 lines (+3763/-1578)
123 files modified
Makefile (+2/-2)
Percona-Server/.bzr-mysql/default.conf (+3/-3)
Percona-Server/client/mysqlbinlog.cc (+34/-4)
Percona-Server/client/mysqldump.c (+50/-8)
Percona-Server/client/mysqltest.cc (+3/-1)
Percona-Server/configure.in (+1/-1)
Percona-Server/extra/yassl/taocrypt/src/asn.cpp (+4/-0)
Percona-Server/include/my_getopt.h (+2/-2)
Percona-Server/include/sql_common.h (+5/-3)
Percona-Server/libmysql/libmysql.c (+4/-4)
Percona-Server/libmysqld/examples/CMakeLists.txt (+2/-1)
Percona-Server/libmysqld/examples/Makefile.am (+2/-1)
Percona-Server/libmysqld/lib_sql.cc (+0/-6)
Percona-Server/mysql-test/include/mysqlbinlog_have_debug.inc (+34/-0)
Percona-Server/mysql-test/lib/My/Find.pm (+4/-3)
Percona-Server/mysql-test/lib/mtr_cases.pm (+4/-3)
Percona-Server/mysql-test/mysql-test-run.pl (+2/-0)
Percona-Server/mysql-test/r/func_group.result (+2/-0)
Percona-Server/mysql-test/r/func_group_innodb.result (+40/-0)
Percona-Server/mysql-test/r/mysqldump.result (+42/-0)
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_release.result (+1/-0)
Percona-Server/mysql-test/r/ps.result (+103/-0)
Percona-Server/mysql-test/r/sp.result (+38/-0)
Percona-Server/mysql-test/r/type_blob.result (+4/-0)
Percona-Server/mysql-test/r/type_year.result (+15/-0)
Percona-Server/mysql-test/suite/binlog/r/binlog_grant.result (+4/-0)
Percona-Server/mysql-test/suite/binlog/t/binlog_grant.test (+19/-0)
Percona-Server/mysql-test/suite/engines/iuds/r/delete_year.result (+6/-0)
Percona-Server/mysql-test/suite/engines/iuds/r/insert_year.result (+12/-0)
Percona-Server/mysql-test/suite/engines/iuds/r/update_year.result (+6/-0)
Percona-Server/mysql-test/suite/funcs_1/r/innodb_views.result (+4/-0)
Percona-Server/mysql-test/suite/funcs_1/r/is_columns_innodb.result (+6/-0)
Percona-Server/mysql-test/suite/funcs_1/r/is_columns_memory.result (+6/-0)
Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam.result (+6/-0)
Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result (+6/-0)
Percona-Server/mysql-test/suite/funcs_1/r/memory_views.result (+4/-0)
Percona-Server/mysql-test/suite/funcs_1/r/myisam_views-big.result (+4/-0)
Percona-Server/mysql-test/suite/funcs_1/r/ndb_views.result (+4/-0)
Percona-Server/mysql-test/suite/funcs_1/r/storedproc.result (+4/-0)
Percona-Server/mysql-test/suite/innodb/r/innodb_bug14007649.result (+56/-0)
Percona-Server/mysql-test/suite/innodb/t/innodb_bug14007649.test (+58/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result (+56/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result (+1/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test (+58/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result (+36/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result (+22/-0)
Percona-Server/mysql-test/suite/rpl/r/rpl_log_pos.result (+1/-1)
Percona-Server/mysql-test/suite/rpl/r/rpl_packet.result (+6/-5)
Percona-Server/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result (+13/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test (+62/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test (+61/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_packet-slave.opt (+1/-1)
Percona-Server/mysql-test/suite/rpl/t/rpl_packet.test (+6/-5)
Percona-Server/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test (+35/-0)
Percona-Server/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result (+139/-0)
Percona-Server/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test (+177/-0)
Percona-Server/mysql-test/t/func_group_innodb.test (+44/-0)
Percona-Server/mysql-test/t/mysqldump.test (+27/-4)
Percona-Server/mysql-test/t/ps.test (+90/-0)
Percona-Server/mysql-test/t/sp.test (+37/-0)
Percona-Server/mysql-test/t/type_year.test (+8/-0)
Percona-Server/mysys/mf_iocache2.c (+5/-1)
Percona-Server/mysys/my_access.c (+2/-1)
Percona-Server/mysys/my_write.c (+11/-1)
Percona-Server/sql-common/client.c (+12/-3)
Percona-Server/sql/Makefile.am (+1/-0)
Percona-Server/sql/event_scheduler.cc (+2/-2)
Percona-Server/sql/field.cc (+11/-0)
Percona-Server/sql/handler.cc (+11/-0)
Percona-Server/sql/item.cc (+1/-1)
Percona-Server/sql/log.cc (+4/-1)
Percona-Server/sql/log.h (+8/-3)
Percona-Server/sql/log_event.cc (+113/-26)
Percona-Server/sql/log_event.h (+27/-1)
Percona-Server/sql/mem_root_array.h (+175/-0)
Percona-Server/sql/mysql_priv.h (+1/-0)
Percona-Server/sql/mysqld.cc (+21/-13)
Percona-Server/sql/protocol.cc (+3/-1)
Percona-Server/sql/records.cc (+1/-1)
Percona-Server/sql/rpl_rli.cc (+3/-1)
Percona-Server/sql/rpl_rli.h (+35/-0)
Percona-Server/sql/rpl_utility.cc (+61/-0)
Percona-Server/sql/rpl_utility.h (+18/-0)
Percona-Server/sql/set_var.cc (+2/-0)
Percona-Server/sql/slave.cc (+16/-9)
Percona-Server/sql/sql_base.cc (+36/-0)
Percona-Server/sql/sql_class.cc (+20/-5)
Percona-Server/sql/sql_class.h (+17/-4)
Percona-Server/sql/sql_lex.cc (+22/-0)
Percona-Server/sql/sql_lex.h (+14/-2)
Percona-Server/sql/sql_parse.cc (+9/-3)
Percona-Server/sql/sql_prepare.cc (+8/-0)
Percona-Server/sql/sql_profile.cc (+3/-3)
Percona-Server/sql/sql_repl.cc (+7/-4)
Percona-Server/sql/sql_select.cc (+8/-3)
Percona-Server/sql/sql_show.cc (+37/-31)
Percona-Server/sql/sql_yacc.yy (+17/-1)
Percona-Server/storage/innobase/btr/btr0cur.c (+2/-0)
Percona-Server/storage/innobase/dict/dict0load.c (+2/-2)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+29/-4)
Percona-Server/storage/innobase/handler/ha_innodb.h (+1/-0)
Percona-Server/storage/innobase/include/srv0srv.h (+1/-0)
Percona-Server/storage/innobase/row/row0mysql.c (+2/-2)
Percona-Server/storage/innobase/sync/sync0arr.c (+5/-0)
Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+2/-0)
Percona-Server/storage/innodb_plugin/dict/dict0dict.c (+22/-0)
Percona-Server/storage/innodb_plugin/dict/dict0load.c (+2/-2)
Percona-Server/storage/innodb_plugin/fil/fil0fil.c (+1/-1)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+29/-8)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.h (+1/-0)
Percona-Server/storage/innodb_plugin/handler/handler0alter.cc (+4/-0)
Percona-Server/storage/innodb_plugin/include/srv0srv.h (+1/-0)
Percona-Server/storage/innodb_plugin/include/univ.i (+1/-1)
Percona-Server/storage/innodb_plugin/row/row0ins.c (+2/-4)
Percona-Server/storage/innodb_plugin/row/row0vers.c (+0/-12)
Percona-Server/storage/innodb_plugin/sync/sync0arr.c (+5/-0)
Percona-Server/storage/myisam/ft_boolean_search.c (+14/-2)
Percona-Server/storage/myisam/ft_nlq_search.c (+17/-1)
Percona-Server/tests/Makefile.am (+2/-0)
Percona-Server/tests/mysql_client_fw.c (+1375/-0)
Percona-Server/tests/mysql_client_test.c (+8/-1356)
Percona-Server/vio/viosslfactories.c (+6/-4)
To merge this branch: bzr merge lp:~stewart/percona-server/5.1.65
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+120502@code.launchpad.net

This proposal supersedes a proposal from 2012-08-21.

Description of the change

Merge MySQL 5.1.65

This was a relatively simple merge, with a couple of post-merge fixes needed. I made these as separate commits so that they're easier to see and review.

http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/379/

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-06-15 06:13:39 +0000
3+++ Makefile 2012-08-21 05:42:33 +0000
4@@ -1,5 +1,5 @@
5-MYSQL_VERSION=5.1.63
6-PERCONA_SERVER_VERSION=rel13.4
7+MYSQL_VERSION=5.1.65
8+PERCONA_SERVER_VERSION=rel14.0
9 PERCONA_SERVER ?=Percona-Server-$(MYSQL_VERSION)-$(PERCONA_SERVER_VERSION)
10 PERCONA_SERVER_SHORT_1 ?=Percona-Server-$(MYSQL_VERSION)
11 PERCONA_SERVER_SHORT_2 ?=Percona-Server
12
13=== modified file 'Percona-Server/.bzr-mysql/default.conf'
14--- Percona-Server/.bzr-mysql/default.conf 2012-03-21 12:58:27 +0000
15+++ Percona-Server/.bzr-mysql/default.conf 2012-08-21 05:42:33 +0000
16@@ -1,4 +1,4 @@
17 [MYSQL]
18-post_commit_to = "MYSQL_COMMITS_SECURITY_WW@ORACLE.COM"
19-post_push_to = "MYSQL_COMMITS_SECURITY_WW@ORACLE.COM"
20-tree_name = "mysql-5.1-security"
21+post_commit_to = "commits@lists.mysql.com"
22+post_push_to = "commits@lists.mysql.com"
23+tree_name = "mysql-5.1"
24
25=== modified file 'Percona-Server/client/mysqlbinlog.cc'
26--- Percona-Server/client/mysqlbinlog.cc 2012-03-16 09:08:25 +0000
27+++ Percona-Server/client/mysqlbinlog.cc 2012-08-21 05:42:33 +0000
28@@ -1,5 +1,5 @@
29 /*
30- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
31+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
32
33 This program is free software; you can redistribute it and/or modify
34 it under the terms of the GNU General Public License as published by
35@@ -742,6 +742,7 @@
36 DBUG_ENTER("process_event");
37 print_event_info->short_form= short_form;
38 Exit_status retval= OK_CONTINUE;
39+ IO_CACHE *const head= &print_event_info->head_cache;
40
41 /*
42 Format events are not concerned by --offset and such, we always need to
43@@ -818,6 +819,8 @@
44 }
45 else
46 ev->print(result_file, print_event_info);
47+ if (head->error == -1)
48+ goto err;
49 break;
50 }
51
52@@ -847,8 +850,11 @@
53 goto end;
54 }
55 else
56+ {
57 ce->print(result_file, print_event_info, TRUE);
58-
59+ if (head->error == -1)
60+ goto err;
61+ }
62 // If this binlog is not 3.23 ; why this test??
63 if (glob_description_event->binlog_version >= 3)
64 {
65@@ -870,6 +876,8 @@
66 output of Append_block_log_event::print is only a comment.
67 */
68 ev->print(result_file, print_event_info);
69+ if (head->error == -1)
70+ goto err;
71 if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
72 OK_CONTINUE)
73 goto end;
74@@ -878,6 +886,8 @@
75 case EXEC_LOAD_EVENT:
76 {
77 ev->print(result_file, print_event_info);
78+ if (head->error == -1)
79+ goto err;
80 Execute_load_log_event *exv= (Execute_load_log_event*)ev;
81 Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
82 /*
83@@ -895,6 +905,8 @@
84 ce->print(result_file, print_event_info, TRUE);
85 my_free((char*)ce->fname,MYF(MY_WME));
86 delete ce;
87+ if (head->error == -1)
88+ goto err;
89 }
90 else
91 warning("Ignoring Execute_load_log_event as there is no "
92@@ -907,6 +919,8 @@
93 print_event_info->common_header_len=
94 glob_description_event->common_header_len;
95 ev->print(result_file, print_event_info);
96+ if (head->error == -1)
97+ goto err;
98 if (!remote_opt)
99 ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
100 else
101@@ -930,6 +944,8 @@
102 break;
103 case BEGIN_LOAD_QUERY_EVENT:
104 ev->print(result_file, print_event_info);
105+ if (head->error == -1)
106+ goto err;
107 if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
108 OK_CONTINUE)
109 goto end;
110@@ -946,6 +962,12 @@
111 {
112 convert_path_to_forward_slashes(fname);
113 exlq->print(result_file, print_event_info, fname);
114+ if (head->error == -1)
115+ {
116+ if (fname)
117+ my_free(fname, MYF(MY_WME));
118+ goto err;
119+ }
120 }
121 else
122 warning("Ignoring Execute_load_query since there is no "
123@@ -1049,6 +1071,8 @@
124 }
125 default:
126 ev->print(result_file, print_event_info);
127+ if (head->error == -1)
128+ goto err;
129 }
130 }
131
132@@ -1215,7 +1239,7 @@
133 "Stop reading the binlog at position N. Applies to the last binlog "
134 "passed on the command line.",
135 &stop_position, &stop_position, 0, GET_ULL,
136- REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
137+ REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
138 (ulonglong)(~(my_off_t)0), 0, 0, 0},
139 {"to-last-log", 't', "Requires -R. Will not stop at the end of the \
140 requested binlog but rather continue printing until the end of the last \
141@@ -2143,7 +2167,13 @@
142 end:
143 if (fd >= 0)
144 my_close(fd, MYF(MY_WME));
145- end_io_cache(file);
146+ /*
147+ Since the end_io_cache() writes to the
148+ file errors may happen.
149+ */
150+ if (end_io_cache(file))
151+ retval= ERROR_STOP;
152+
153 return retval;
154 }
155
156
157=== modified file 'Percona-Server/client/mysqldump.c'
158--- Percona-Server/client/mysqldump.c 2012-04-02 02:09:15 +0000
159+++ Percona-Server/client/mysqldump.c 2012-08-21 05:42:33 +0000
160@@ -85,6 +85,15 @@
161 #define IGNORE_DATA 0x01 /* don't dump data for this table */
162 #define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
163
164+/* general_log or slow_log tables under mysql database */
165+static inline my_bool general_log_or_slow_log_tables(const char *db,
166+ const char *table)
167+{
168+ return (strcmp(db, "mysql") == 0) &&
169+ ((strcmp(table, "general_log") == 0) ||
170+ (strcmp(table, "slow_log") == 0));
171+}
172+
173 static void add_load_option(DYNAMIC_STRING *str, const char *option,
174 const char *option_value);
175 static ulong find_set(TYPELIB *lib, const char *x, uint length,
176@@ -2668,6 +2677,7 @@
177 "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
178 FILE *sql_file= md_result_file;
179 int len;
180+ my_bool is_log_table;
181 MYSQL_RES *result;
182 MYSQL_ROW row;
183 my_bool UNINIT_VAR(has_pk);
184@@ -2764,9 +2774,12 @@
185 /*
186 Even if the "table" is a view, we do a DROP TABLE here. The
187 view-specific code below fills in the DROP VIEW.
188+ We will skip the DROP TABLE for general_log and slow_log, since
189+ those stmts will fail, in case we apply dump by enabling logging.
190 */
191- fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
192- opt_quoted_table);
193+ if (!general_log_or_slow_log_tables(db, table))
194+ fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
195+ opt_quoted_table);
196 check_io(sql_file);
197 }
198
199@@ -2881,12 +2894,25 @@
200 if (opt_innodb_optimize_keys && !strcmp(table_type, "InnoDB"))
201 skip_secondary_keys(row[1], has_pk);
202
203- fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
204- "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
205- "/*!40101 SET character_set_client = utf8 */;\n"
206- "%s;\n"
207- "/*!40101 SET character_set_client = @saved_cs_client */;\n",
208- row[1]);
209+ is_log_table= general_log_or_slow_log_tables(db, table);
210+ if (is_log_table)
211+ row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
212+ if (opt_compatible_mode & 3)
213+ {
214+ fprintf(sql_file,
215+ is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
216+ row[1]);
217+ }
218+ else
219+ {
220+ fprintf(sql_file,
221+ "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
222+ "/*!40101 SET character_set_client = utf8 */;\n"
223+ "%s%s;\n"
224+ "/*!40101 SET character_set_client = @saved_cs_client */;\n",
225+ is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
226+ row[1]);
227+ }
228
229 check_io(sql_file);
230 mysql_free_result(result);
231@@ -4517,6 +4543,22 @@
232 if (opt_xml)
233 print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
234
235+ if (strcmp(database, "mysql") == 0)
236+ {
237+ char table_type[NAME_LEN];
238+ char ignore_flag;
239+ uint num_fields;
240+ num_fields= get_table_structure((char *) "general_log",
241+ database, table_type, &ignore_flag);
242+ if (num_fields == 0)
243+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
244+ "error for 'general_log' table\n");
245+ num_fields= get_table_structure((char *) "slow_log",
246+ database, table_type, &ignore_flag);
247+ if (num_fields == 0)
248+ verbose_msg("-- Warning: get_table_structure() failed with some internal "
249+ "error for 'slow_log' table\n");
250+ }
251 if (lock_tables)
252 {
253 DYNAMIC_STRING query;
254
255=== modified file 'Percona-Server/client/mysqltest.cc'
256--- Percona-Server/client/mysqltest.cc 2011-09-14 13:19:24 +0000
257+++ Percona-Server/client/mysqltest.cc 2012-08-21 05:42:33 +0000
258@@ -1,5 +1,5 @@
259 /*
260- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
261+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
262
263 This program is free software; you can redistribute it and/or modify
264 it under the terms of the GNU General Public License as published by
265@@ -6848,6 +6848,8 @@
266 */
267 if ((counter==0) && mysql_read_query_result(mysql))
268 {
269+ /* we've failed to collect the result set */
270+ cn->pending= TRUE;
271 handle_error(command, mysql_errno(mysql), mysql_error(mysql),
272 mysql_sqlstate(mysql), ds);
273 goto end;
274
275=== modified file 'Percona-Server/configure.in'
276--- Percona-Server/configure.in 2012-05-09 04:14:12 +0000
277+++ Percona-Server/configure.in 2012-08-21 05:42:33 +0000
278@@ -12,7 +12,7 @@
279 dnl When changing the major version number please also check the switch
280 dnl statement in mysqlbinlog::check_master_version(). You may also need
281 dnl to update version.c in ndb.
282-AC_INIT([MySQL Server], [5.1.63], [], [mysql])
283+AC_INIT([MySQL Server], [5.1.65], [], [mysql])
284
285 AC_CONFIG_SRCDIR([sql/mysqld.cc])
286 AC_CANONICAL_SYSTEM
287
288=== modified file 'Percona-Server/extra/yassl/taocrypt/src/asn.cpp'
289--- Percona-Server/extra/yassl/taocrypt/src/asn.cpp 2012-03-02 12:18:12 +0000
290+++ Percona-Server/extra/yassl/taocrypt/src/asn.cpp 2012-08-21 05:42:33 +0000
291@@ -758,6 +758,10 @@
292
293 while (source_.get_index() < length) {
294 GetSet();
295+ if (source_.GetError().What() == SET_E) {
296+ source_.SetError(NO_ERROR_E); // extensions may only have sequence
297+ source_.prev();
298+ }
299 GetSequence();
300
301 byte b = source_.next();
302
303=== modified file 'Percona-Server/include/my_getopt.h'
304--- Percona-Server/include/my_getopt.h 2011-07-03 15:47:37 +0000
305+++ Percona-Server/include/my_getopt.h 2012-08-21 05:42:33 +0000
306@@ -1,5 +1,5 @@
307 /*
308- Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
309+ Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
310
311 This program is free software; you can redistribute it and/or modify
312 it under the terms of the GNU General Public License as published by
313@@ -54,7 +54,7 @@
314 enum get_opt_arg_type arg_type;
315 longlong def_value; /* Default value */
316 longlong min_value; /* Min allowed value */
317- longlong max_value; /* Max allowed value */
318+ ulonglong max_value; /* Max allowed value */
319 longlong sub_size; /* Subtract this from given value */
320 long block_size; /* Value should be a mult. of this */
321 void *app_type; /* To be used by an application */
322
323=== modified file 'Percona-Server/include/sql_common.h'
324--- Percona-Server/include/sql_common.h 2008-02-27 09:00:59 +0000
325+++ Percona-Server/include/sql_common.h 2012-08-21 05:42:33 +0000
326@@ -1,4 +1,5 @@
327-/* Copyright (C) 2003-2004, 2006 MySQL AB
328+/*
329+ Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
330
331 This program is free software; you can redistribute it and/or modify
332 it under the terms of the GNU General Public License as published by
333@@ -23,8 +24,9 @@
334 #endif
335
336 extern CHARSET_INFO *default_client_charset_info;
337-MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
338- my_bool default_value, uint server_capabilities);
339+MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,
340+ uint fields, my_bool default_value,
341+ uint server_capabilities);
342 void free_rows(MYSQL_DATA *cur);
343 void free_old_query(MYSQL *mysql);
344 void end_server(MYSQL *mysql);
345
346=== modified file 'Percona-Server/libmysql/libmysql.c'
347--- Percona-Server/libmysql/libmysql.c 2011-07-03 15:47:37 +0000
348+++ Percona-Server/libmysql/libmysql.c 2012-08-21 05:42:33 +0000
349@@ -1,4 +1,4 @@
350-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
351+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
352
353 This program is free software; you can redistribute it and/or modify
354 it under the terms of the GNU General Public License as published by
355@@ -1254,7 +1254,7 @@
356 return NULL;
357
358 mysql->field_count= (uint) query->rows;
359- return unpack_fields(query,&mysql->field_alloc,
360+ return unpack_fields(mysql, query,&mysql->field_alloc,
361 mysql->field_count, 1, mysql->server_capabilities);
362 }
363
364@@ -1314,7 +1314,7 @@
365 if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
366 protocol_41(mysql) ? 7 : 5)))
367 DBUG_RETURN(NULL);
368- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
369+ if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,field_count,0,
370 mysql->server_capabilities)))
371 DBUG_RETURN(0);
372 mysql->status=MYSQL_STATUS_GET_RESULT;
373@@ -1891,7 +1891,7 @@
374
375 if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
376 DBUG_RETURN(1);
377- if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
378+ if (!(stmt->fields= unpack_fields(mysql, fields_data,&stmt->mem_root,
379 field_count,0,
380 mysql->server_capabilities)))
381 DBUG_RETURN(1);
382
383=== modified file 'Percona-Server/libmysqld/examples/CMakeLists.txt'
384--- Percona-Server/libmysqld/examples/CMakeLists.txt 2011-06-30 15:37:13 +0000
385+++ Percona-Server/libmysqld/examples/CMakeLists.txt 2012-08-21 05:42:33 +0000
386@@ -17,7 +17,8 @@
387 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
388 ${CMAKE_SOURCE_DIR}/libmysqld/include
389 ${CMAKE_SOURCE_DIR}/regex
390- ${CMAKE_SOURCE_DIR}/zlib
391+ ${CMAKE_SOURCE_DIR}/zlib
392+ ${CMAKE_SOURCE_DIR}/tests
393 ${CMAKE_SOURCE_DIR}/extra/yassl/include)
394
395 # Currently does not work with DBUG, there are missing symbols reported.
396
397=== modified file 'Percona-Server/libmysqld/examples/Makefile.am'
398--- Percona-Server/libmysqld/examples/Makefile.am 2011-06-30 15:37:13 +0000
399+++ Percona-Server/libmysqld/examples/Makefile.am 2012-08-21 05:42:33 +0000
400@@ -35,7 +35,7 @@
401 DEFS = -DEMBEDDED_LIBRARY
402 INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
403 -I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
404- $(openssl_includes)
405+ -I$(top_srcdir)/tests $(openssl_includes)
406 LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
407 LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
408 @NDB_SCI_LIBS@
409@@ -51,6 +51,7 @@
410
411 mysql_client_test_embedded_LINK = $(CXXLINK)
412 nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
413+mysql_client_test.o: $(top_srcdir)/tests/mysql_client_fw.c
414
415 # Don't update the files from bitkeeper
416 %::SCCS/s.%
417
418=== modified file 'Percona-Server/libmysqld/lib_sql.cc'
419--- Percona-Server/libmysqld/lib_sql.cc 2012-04-06 11:33:13 +0000
420+++ Percona-Server/libmysqld/lib_sql.cc 2012-08-21 05:42:33 +0000
421@@ -756,12 +756,6 @@
422 cur_data= 0;
423 }
424
425-void THD::clear_error()
426-{
427- if (main_da.is_error())
428- main_da.reset_diagnostics_area();
429-}
430-
431 static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
432 CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
433 {
434
435=== added file 'Percona-Server/mysql-test/include/mysqlbinlog_have_debug.inc'
436--- Percona-Server/mysql-test/include/mysqlbinlog_have_debug.inc 1970-01-01 00:00:00 +0000
437+++ Percona-Server/mysql-test/include/mysqlbinlog_have_debug.inc 2012-08-21 05:42:33 +0000
438@@ -0,0 +1,34 @@
439+#############################################
440+# checks if mysqlbinlog is debug compiled
441+# this "cannot" be done simply by using
442+# have_debug.inc
443+#############################################
444+
445+--disable_query_log
446+--let $temp_out_help_file=$MYSQL_TMP_DIR/mysqlbinlog_help.tmp
447+--exec $MYSQL_BINLOG --help>$temp_out_help_file
448+let log_tmp=$temp_out_help_file;
449+--let $temp_inc=$MYSQL_TMP_DIR/temp.inc
450+let inc_tmp=$temp_inc;
451+
452+--perl
453+use strict;
454+my $tmp_file= $ENV{'log_tmp'} or die "log_tmp not set";
455+open(FILE, "$tmp_file") or die("Unable to open $tmp_file: $!\n");
456+my $count = () = grep(/Output debug log/g,<FILE>);
457+close FILE;
458+
459+my $temp_inc= $ENV{'inc_tmp'} or die "temp_inc not set";
460+open(FILE_INC,">", "$temp_inc") or die("can't open file \"$temp_inc\": $!");
461+print FILE_INC '--let $is_debug= '.$count;
462+close FILE_INC;
463+EOF
464+--source $temp_inc
465+
466+if (!$is_debug)
467+{
468+ --skip mysqlbinlog needs to be debug compiled
469+}
470+--remove_file $temp_out_help_file
471+--remove_file $temp_inc
472+--enable_query_log
473
474=== modified file 'Percona-Server/mysql-test/lib/My/Find.pm'
475--- Percona-Server/mysql-test/lib/My/Find.pm 2011-07-03 15:47:37 +0000
476+++ Percona-Server/mysql-test/lib/My/Find.pm 2012-08-21 05:42:33 +0000
477@@ -126,9 +126,9 @@
478 #
479 #
480 sub my_find_dir {
481- my ($base, $paths, $dirs, $required)= @_;
482- croak "usage: my_find_dir(<base>, <paths>[, <dirs>])"
483- unless (@_ == 3 or @_ == 2);
484+ my ($base, $paths, $dirs, $optional)= @_;
485+ croak "usage: my_find_dir(<base>, <paths>[, <dirs>[, <optional>]])"
486+ unless (@_ == 3 or @_ == 2 or @_ == 4);
487
488 # -------------------------------------------------------
489 # Find and return the first directory
490@@ -136,6 +136,7 @@
491 foreach my $path (my_find_paths($base, $paths, $dirs)) {
492 return $path if ( -d $path );
493 }
494+ return "" if $optional;
495 find_error($base, $paths, $dirs);
496 }
497
498
499=== modified file 'Percona-Server/mysql-test/lib/mtr_cases.pm'
500--- Percona-Server/mysql-test/lib/mtr_cases.pm 2012-04-02 02:09:15 +0000
501+++ Percona-Server/mysql-test/lib/mtr_cases.pm 2012-08-21 05:42:33 +0000
502@@ -127,6 +127,7 @@
503 {
504 push(@$cases, collect_one_suite($suite, $opt_cases));
505 last if $some_test_found;
506+ push(@$cases, collect_one_suite("i_".$suite, $opt_cases));
507 }
508 }
509
510@@ -277,10 +278,10 @@
511 $suitedir= my_find_dir($suitedir,
512 ["suite",
513 ".",
514- # Look in storage engine specific suite dirs
515- "../storage/*/mysql-test-suites"
516+ "../internal/mysql-test/suite"
517 ],
518- [$suite]);
519+ [$suite], ($suite =~ /^i_/));
520+ return unless $suitedir;
521 }
522 mtr_verbose("suitedir: $suitedir");
523 }
524
525=== modified file 'Percona-Server/mysql-test/mysql-test-run.pl'
526--- Percona-Server/mysql-test/mysql-test-run.pl 2012-04-02 02:09:15 +0000
527+++ Percona-Server/mysql-test/mysql-test-run.pl 2012-08-21 05:42:33 +0000
528@@ -1971,6 +1971,7 @@
529 my $lib_example_plugin=
530 mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename),
531 "$basedir/storage/example/.libs/".$plugin_filename,
532+ "$basedir/lib64/mysql/plugin/".$plugin_filename,
533 "$basedir/lib/mysql/plugin/".$plugin_filename);
534 $ENV{'EXAMPLE_PLUGIN'}=
535 ($lib_example_plugin ? basename($lib_example_plugin) : "");
536@@ -1993,6 +1994,7 @@
537 my $lib_fed_plugin=
538 mtr_file_exists(vs_config_dirs('storage/federated',$fedplug_filename),
539 "$basedir/storage/federated/.libs/".$fedplug_filename,
540+ "$basedir/lib64/mysql/plugin/".$fedplug_filename,
541 "$basedir/lib/mysql/plugin/".$fedplug_filename);
542
543 $ENV{'FEDERATED_PLUGIN'}= $fedplug_filename;
544
545=== modified file 'Percona-Server/mysql-test/r/func_group.result'
546--- Percona-Server/mysql-test/r/func_group.result 2011-04-12 10:01:33 +0000
547+++ Percona-Server/mysql-test/r/func_group.result 2012-08-21 05:42:33 +0000
548@@ -1524,6 +1524,8 @@
549 # Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
550 #
551 create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
552+Warnings:
553+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
554 insert into t1 values
555 (98,1998,19980101,"1998-01-01 00:00:00"),
556 (00,2000,20000101,"2000-01-01 00:00:01"),
557
558=== modified file 'Percona-Server/mysql-test/r/func_group_innodb.result'
559--- Percona-Server/mysql-test/r/func_group_innodb.result 2007-05-29 12:58:18 +0000
560+++ Percona-Server/mysql-test/r/func_group_innodb.result 2012-08-21 05:42:33 +0000
561@@ -145,3 +145,43 @@
562 count(*) min(7) max(7)
563 0 NULL NULL
564 drop table t1m, t1i, t2m, t2i;
565+#
566+# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
567+# COUNT(*) LIMIT.
568+#
569+CREATE TABLE t1 (
570+id BIGINT(20) ,
571+member_id_to INT(11) ,
572+r_date DATE ,
573+PRIMARY KEY (id,r_date),
574+KEY r_date_idx (r_date),
575+KEY t1_idx01 (member_id_to)
576+) ENGINE=InnoDB;
577+INSERT INTO t1 VALUES
578+(107924526,518491,'2011-05-01'),
579+(107924527,518491,'2011-05-01'),
580+(107924528,518491,'2011-05-01'),
581+(107924529,518491,'2011-05-01'),
582+(107924530,518491,'2011-05-01'),
583+(107924531,518491,'2011-05-01'),
584+(107924532,518491,'2011-05-01'),
585+(107924534,518491,'2011-06-21'),
586+(107924535,518491,'2011-06-21'),
587+(107924536,518491,'2011-06-21'),
588+(107924537,518491,'2011-06-21'),
589+(107924538,518491,'2011-06-21'),
590+(107924542,1601319,'2011-06-21'),
591+(107924543,1601319,'2011-06-21'),
592+(107924544,1601319,'2011-06-21'),
593+(107924545,1601319,'2011-06-21'),
594+(107924546,1601319,'2011-06-21'),
595+(107924547,1601319,'2011-06-21'),
596+(107924548,1601319,'2011-06-21'),
597+(107924549,1601319,'2011-06-21'),
598+(107924550,1601319,'2011-06-21');
599+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
600+'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
601+member_id_to COUNT(*)
602+518491 5
603+DROP TABLE t1;
604+# End of test BUG#12713907
605
606=== modified file 'Percona-Server/mysql-test/r/mysqldump.result'
607--- Percona-Server/mysql-test/r/mysqldump.result 2012-04-02 02:09:15 +0000
608+++ Percona-Server/mysql-test/r/mysqldump.result 2012-08-21 05:42:33 +0000
609@@ -5067,5 +5067,47 @@
610 DROP DATABASE BUG52792;
611 USE test;
612 #
613+# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
614+#
615+SET @old_log_output_state= @@global.log_output;
616+SET @old_general_log_state= @@global.general_log;
617+SET @old_slow_query_log_state= @@global.slow_query_log;
618+call mtr.add_suppression("Failed to write to mysql.general_log");
619+SET @@global.log_output="TABLE";
620+SET @@global.general_log='ON';
621+SET @@global.slow_query_log='ON';
622+DROP DATABASE mysql;
623+Warnings:
624+Error 1146 Table 'mysql.proc' doesn't exist
625+Error 1146 Table 'mysql.event' doesn't exist
626+SHOW CREATE TABLE mysql.general_log;
627+Table Create Table
628+general_log CREATE TABLE `general_log` (
629+ `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
630+ `user_host` mediumtext NOT NULL,
631+ `thread_id` int(11) NOT NULL,
632+ `server_id` int(10) unsigned NOT NULL,
633+ `command_type` varchar(64) NOT NULL,
634+ `argument` mediumtext NOT NULL
635+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
636+SHOW CREATE TABLE mysql.slow_log;
637+Table Create Table
638+slow_log CREATE TABLE `slow_log` (
639+ `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
640+ `user_host` mediumtext NOT NULL,
641+ `query_time` time NOT NULL,
642+ `lock_time` time NOT NULL,
643+ `rows_sent` int(11) NOT NULL,
644+ `rows_examined` int(11) NOT NULL,
645+ `db` varchar(512) NOT NULL,
646+ `last_insert_id` int(11) NOT NULL,
647+ `insert_id` int(11) NOT NULL,
648+ `server_id` int(10) unsigned NOT NULL,
649+ `sql_text` mediumtext NOT NULL
650+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
651+SET @@global.log_output= @old_log_output_state;
652+SET @@global.slow_query_log= @old_slow_query_log_state;
653+SET @@global.general_log= @old_general_log_state;
654+#
655 # End of 5.1 tests
656 #
657
658=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
659--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-15 14:05:13 +0000
660+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-21 05:42:33 +0000
661@@ -290,6 +290,7 @@
662 SLAVE_COMPRESSED_PROTOCOL
663 SLAVE_EXEC_MODE
664 SLAVE_LOAD_TMPDIR
665+SLAVE_MAX_ALLOWED_PACKET
666 SLAVE_NET_TIMEOUT
667 SLAVE_SKIP_ERRORS
668 SLAVE_TRANSACTION_RETRIES
669
670=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
671--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-15 14:05:13 +0000
672+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-21 05:42:33 +0000
673@@ -287,6 +287,7 @@
674 SLAVE_COMPRESSED_PROTOCOL
675 SLAVE_EXEC_MODE
676 SLAVE_LOAD_TMPDIR
677+SLAVE_MAX_ALLOWED_PACKET
678 SLAVE_NET_TIMEOUT
679 SLAVE_SKIP_ERRORS
680 SLAVE_TRANSACTION_RETRIES
681
682=== modified file 'Percona-Server/mysql-test/r/ps.result'
683--- Percona-Server/mysql-test/r/ps.result 2010-10-04 08:51:26 +0000
684+++ Percona-Server/mysql-test/r/ps.result 2012-08-21 05:42:33 +0000
685@@ -3040,3 +3040,106 @@
686 DEALLOCATE PREPARE stmt;
687 DROP TABLE t1;
688 End of 5.1 tests.
689+
690+# Bug#13805127: Stored program cache produces wrong result in same THD
691+
692+PREPARE s1 FROM
693+"
694+SELECT c1, t2.c2, count(c3)
695+FROM
696+ (
697+ SELECT 3 as c2 FROM dual WHERE @x = 1
698+ UNION
699+ SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
700+ ) AS t1,
701+ (
702+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
703+ UNION
704+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
705+ UNION
706+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
707+ ) AS t2
708+WHERE t2.c2 = t1.c2
709+GROUP BY c1, c2
710+";
711+
712+SET @x = 1;
713+SELECT c1, t2.c2, count(c3)
714+FROM
715+(
716+SELECT 3 as c2 FROM dual WHERE @x = 1
717+UNION
718+SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
719+) AS t1,
720+(
721+SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
722+UNION
723+SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
724+UNION
725+SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
726+) AS t2
727+WHERE t2.c2 = t1.c2
728+GROUP BY c1, c2;
729+c1 c2 count(c3)
730+2012-03-01 01:00:00 2 1
731+2012-03-01 01:00:00 3 1
732+2012-03-01 02:00:00 3 1
733+
734+EXECUTE s1;
735+c1 c2 count(c3)
736+2012-03-01 01:00:00 2 1
737+2012-03-01 01:00:00 3 1
738+2012-03-01 02:00:00 3 1
739+
740+SET @x = 2;
741+SELECT c1, t2.c2, count(c3)
742+FROM
743+(
744+SELECT 3 as c2 FROM dual WHERE @x = 1
745+UNION
746+SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
747+) AS t1,
748+(
749+SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
750+UNION
751+SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
752+UNION
753+SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
754+) AS t2
755+WHERE t2.c2 = t1.c2
756+GROUP BY c1, c2;
757+c1 c2 count(c3)
758+2012-03-01 01:00:00 2 1
759+
760+EXECUTE s1;
761+c1 c2 count(c3)
762+2012-03-01 01:00:00 2 1
763+
764+SET @x = 1;
765+SELECT c1, t2.c2, count(c3)
766+FROM
767+(
768+SELECT 3 as c2 FROM dual WHERE @x = 1
769+UNION
770+SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
771+) AS t1,
772+(
773+SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
774+UNION
775+SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
776+UNION
777+SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
778+) AS t2
779+WHERE t2.c2 = t1.c2
780+GROUP BY c1, c2;
781+c1 c2 count(c3)
782+2012-03-01 01:00:00 2 1
783+2012-03-01 01:00:00 3 1
784+2012-03-01 02:00:00 3 1
785+
786+EXECUTE s1;
787+c1 c2 count(c3)
788+2012-03-01 01:00:00 2 1
789+2012-03-01 01:00:00 3 1
790+2012-03-01 02:00:00 3 1
791+DEALLOCATE PREPARE s1;
792
793=== modified file 'Percona-Server/mysql-test/r/sp.result'
794--- Percona-Server/mysql-test/r/sp.result 2012-01-09 10:28:02 +0000
795+++ Percona-Server/mysql-test/r/sp.result 2012-08-21 05:42:33 +0000
796@@ -7110,3 +7110,41 @@
797 # ------------------------------------------------------------------
798 # -- End of 5.1 tests
799 # ------------------------------------------------------------------
800+
801+# Bug#13805127: Stored program cache produces wrong result in same THD
802+
803+CREATE PROCEDURE p1(x INT UNSIGNED)
804+BEGIN
805+SELECT c1, t2.c2, count(c3)
806+FROM
807+(
808+SELECT 3 as c2 FROM dual WHERE x = 1
809+UNION
810+SELECT 2 FROM dual WHERE x = 1 OR x = 2
811+) AS t1,
812+(
813+SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
814+UNION
815+SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
816+UNION
817+SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
818+) AS t2
819+WHERE t2.c2 = t1.c2
820+GROUP BY c1, c2
821+;
822+END|
823+
824+CALL p1(1);
825+c1 c2 count(c3)
826+2012-03-01 01:00:00 2 1
827+2012-03-01 01:00:00 3 1
828+2012-03-01 02:00:00 3 1
829+CALL p1(2);
830+c1 c2 count(c3)
831+2012-03-01 01:00:00 2 1
832+CALL p1(1);
833+c1 c2 count(c3)
834+2012-03-01 01:00:00 2 1
835+2012-03-01 01:00:00 3 1
836+2012-03-01 02:00:00 3 1
837+DROP PROCEDURE p1;
838
839=== modified file 'Percona-Server/mysql-test/r/type_blob.result'
840--- Percona-Server/mysql-test/r/type_blob.result 2010-10-31 16:04:38 +0000
841+++ Percona-Server/mysql-test/r/type_blob.result 2012-08-21 05:42:33 +0000
842@@ -878,6 +878,8 @@
843 CREATE TABLE b15776 (a char(4294967296));
844 ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
845 CREATE TABLE b15776 (a year(4294967295));
846+Warnings:
847+Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
848 INSERT INTO b15776 VALUES (42);
849 SELECT * FROM b15776;
850 a
851@@ -886,6 +888,8 @@
852 CREATE TABLE b15776 (a year(4294967296));
853 ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
854 CREATE TABLE b15776 (a year(0));
855+Warnings:
856+Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
857 DROP TABLE b15776;
858 CREATE TABLE b15776 (a year(-2));
859 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
860
861=== modified file 'Percona-Server/mysql-test/r/type_year.result'
862--- Percona-Server/mysql-test/r/type_year.result 2011-02-22 21:03:32 +0000
863+++ Percona-Server/mysql-test/r/type_year.result 2012-08-21 05:42:33 +0000
864@@ -1,5 +1,7 @@
865 drop table if exists t1;
866 create table t1 (y year,y2 year(2));
867+Warnings:
868+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
869 insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
870 select * from t1;
871 y y2
872@@ -50,6 +52,8 @@
873 # Bug #49480: WHERE using YEAR columns returns unexpected results
874 #
875 CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
876+Warnings:
877+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
878 CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
879 INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
880 INSERT INTO t4 (c4) SELECT c2 FROM t2;
881@@ -355,4 +359,15 @@
882 3 0 2155
883 DROP TABLE t1;
884 #
885+# WL#6219: Deprecate and remove YEAR(2) type
886+#
887+CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
888+Warnings:
889+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
890+ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
891+Warnings:
892+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
893+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
894+DROP TABLE t1;
895+#
896 End of 5.1 tests
897
898=== modified file 'Percona-Server/mysql-test/suite/binlog/r/binlog_grant.result'
899--- Percona-Server/mysql-test/suite/binlog/r/binlog_grant.result 2008-09-09 10:19:31 +0000
900+++ Percona-Server/mysql-test/suite/binlog/r/binlog_grant.result 2012-08-21 05:42:33 +0000
901@@ -26,3 +26,7 @@
902 **** Clean up ****
903 set global binlog_format = @saved_binlog_format;
904 drop user mysqltest_1@localhost;
905+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
906+SHOW MASTER LOGS;
907+SHOW BINARY LOGS;
908+DROP USER 'mysqltest_1'@'localhost';
909
910=== modified file 'Percona-Server/mysql-test/suite/binlog/t/binlog_grant.test'
911--- Percona-Server/mysql-test/suite/binlog/t/binlog_grant.test 2008-09-09 10:19:31 +0000
912+++ Percona-Server/mysql-test/suite/binlog/t/binlog_grant.test 2012-08-21 05:42:33 +0000
913@@ -58,3 +58,22 @@
914 connection default;
915 set global binlog_format = @saved_binlog_format;
916 drop user mysqltest_1@localhost;
917+
918+
919+# Testing if REPLICATION CLIENT privilege is enough to execute
920+# SHOW MASTER LOGS and SHOW BINARY.
921+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
922+--connect(rpl,localhost,mysqltest_1,,)
923+
924+--connection rpl
925+# We are only interested if the following commands succeed and not on
926+# their output.
927+--disable_result_log
928+SHOW MASTER LOGS;
929+SHOW BINARY LOGS;
930+--enable_result_log
931+
932+# clean up
933+--disconnect rpl
934+connection default;
935+DROP USER 'mysqltest_1'@'localhost';
936
937=== modified file 'Percona-Server/mysql-test/suite/engines/iuds/r/delete_year.result'
938--- Percona-Server/mysql-test/suite/engines/iuds/r/delete_year.result 2010-03-18 06:42:07 +0000
939+++ Percona-Server/mysql-test/suite/engines/iuds/r/delete_year.result 2012-08-21 05:42:33 +0000
940@@ -2,7 +2,13 @@
941 CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
942 CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
943 CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
944+Warnings:
945+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
946+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
947 CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
948+Warnings:
949+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
950+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
951 INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
952 INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
953 INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
954
955=== modified file 'Percona-Server/mysql-test/suite/engines/iuds/r/insert_year.result'
956--- Percona-Server/mysql-test/suite/engines/iuds/r/insert_year.result 2011-03-01 15:56:24 +0000
957+++ Percona-Server/mysql-test/suite/engines/iuds/r/insert_year.result 2012-08-21 05:42:33 +0000
958@@ -3235,9 +3235,21 @@
959 1999 1999 1998-12-30 1998-12-30 11:30:45
960 DROP TABLE t1,t2,t3,t4;
961 CREATE TABLE t1(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
962+Warnings:
963+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
964+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
965 CREATE TABLE t2(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2));
966+Warnings:
967+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
968+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
969 CREATE TABLE t3(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2));
970+Warnings:
971+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
972+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
973 CREATE TABLE t4(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME);
974+Warnings:
975+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
976+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
977 INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
978 INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
979 INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
980
981=== modified file 'Percona-Server/mysql-test/suite/engines/iuds/r/update_year.result'
982--- Percona-Server/mysql-test/suite/engines/iuds/r/update_year.result 2010-03-18 06:42:07 +0000
983+++ Percona-Server/mysql-test/suite/engines/iuds/r/update_year.result 2012-08-21 05:42:33 +0000
984@@ -2,7 +2,13 @@
985 CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
986 CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
987 CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
988+Warnings:
989+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
990+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
991 CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
992+Warnings:
993+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
994+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
995 INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
996 INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
997 INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
998
999=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/innodb_views.result'
1000--- Percona-Server/mysql-test/suite/funcs_1/r/innodb_views.result 2009-05-15 12:57:51 +0000
1001+++ Percona-Server/mysql-test/suite/funcs_1/r/innodb_views.result 2012-08-21 05:42:33 +0000
1002@@ -53,6 +53,8 @@
1003 f108 enum("1enum","2enum") not null default "1enum",
1004 f109 set("1set","2set") not null default "1set"
1005 ) engine = innodb;
1006+Warnings:
1007+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1008 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
1009 into table tb2;
1010 DROP DATABASE IF EXISTS test1;
1011@@ -112,6 +114,8 @@
1012 f108 enum("1enum","2enum") not null default "1enum",
1013 f109 set("1set","2set") not null default "1set"
1014 ) engine = innodb;
1015+Warnings:
1016+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1017 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
1018 into table tb2;
1019 USE test;
1020
1021=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/is_columns_innodb.result'
1022--- Percona-Server/mysql-test/suite/funcs_1/r/is_columns_innodb.result 2010-07-16 13:56:33 +0000
1023+++ Percona-Server/mysql-test/suite/funcs_1/r/is_columns_innodb.result 2012-08-21 05:42:33 +0000
1024@@ -132,6 +132,8 @@
1025 f108 enum("1enum","2enum") not null default "1enum",
1026 f109 set("1set","2set") not null default "1set"
1027 ) engine = innodb;
1028+Warnings:
1029+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1030 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
1031 into table tb2;
1032 drop table if exists tb3 ;
1033@@ -262,6 +264,8 @@
1034 f240 varchar(2000),
1035 f241 char(100)
1036 ) engine = innodb;
1037+Warnings:
1038+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1039 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb4.txt'
1040 into table tb4;
1041 USE test1;
1042@@ -319,6 +323,8 @@
1043 f108 enum("1enum","2enum") not null default "1enum",
1044 f109 set("1set","2set") not null default "1set"
1045 ) engine = innodb;
1046+Warnings:
1047+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1048 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
1049 into table tb2;
1050 USE test;
1051
1052=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/is_columns_memory.result'
1053--- Percona-Server/mysql-test/suite/funcs_1/r/is_columns_memory.result 2010-07-16 13:56:33 +0000
1054+++ Percona-Server/mysql-test/suite/funcs_1/r/is_columns_memory.result 2012-08-21 05:42:33 +0000
1055@@ -128,6 +128,8 @@
1056 f108 enum("1enum","2enum") not null default "1enum",
1057 f109 set("1set","2set") not null default "1set"
1058 ) engine = memory;
1059+Warnings:
1060+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1061 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
1062 into table tb2 ;
1063 drop table if exists tb3;
1064@@ -251,6 +253,8 @@
1065 f239 varbinary(0),
1066 f240 varchar(1200)
1067 ) engine = memory;
1068+Warnings:
1069+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1070 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb4.txt'
1071 into table tb4;
1072 USE test1;
1073@@ -308,6 +312,8 @@
1074 f108 enum("1enum","2enum") not null default "1enum",
1075 f109 set("1set","2set") not null default "1set"
1076 ) engine = memory;
1077+Warnings:
1078+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1079 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
1080 into table tb2 ;
1081 USE test;
1082
1083=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam.result'
1084--- Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam.result 2010-07-16 13:56:33 +0000
1085+++ Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam.result 2012-08-21 05:42:33 +0000
1086@@ -144,6 +144,8 @@
1087 f116 VARBINARY(64) null,
1088 f117 VARBINARY(192) null
1089 ) engine = myisam;
1090+Warnings:
1091+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1092 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1093 into table tb2;
1094 drop table if exists tb3 ;
1095@@ -283,6 +285,8 @@
1096 f241 char(100),
1097 f242 bit(30)
1098 ) engine = myisam;
1099+Warnings:
1100+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1101 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
1102 into table tb4;
1103 USE test1;
1104@@ -348,6 +352,8 @@
1105 f116 VARBINARY(64) null,
1106 f117 VARBINARY(192) null
1107 ) engine = myisam;
1108+Warnings:
1109+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1110 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1111 into table tb2;
1112 USE test;
1113
1114=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result'
1115--- Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result 2011-03-18 11:05:57 +0000
1116+++ Percona-Server/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result 2012-08-21 05:42:33 +0000
1117@@ -144,6 +144,8 @@
1118 f116 VARBINARY(64) null,
1119 f117 VARBINARY(192) null
1120 ) engine = myisam;
1121+Warnings:
1122+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1123 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1124 into table tb2;
1125 drop table if exists tb3 ;
1126@@ -283,6 +285,8 @@
1127 f241 char(100),
1128 f242 bit(30)
1129 ) engine = myisam;
1130+Warnings:
1131+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1132 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
1133 into table tb4;
1134 USE test1;
1135@@ -348,6 +352,8 @@
1136 f116 VARBINARY(64) null,
1137 f117 VARBINARY(192) null
1138 ) engine = myisam;
1139+Warnings:
1140+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1141 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1142 into table tb2;
1143 USE test;
1144
1145=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/memory_views.result'
1146--- Percona-Server/mysql-test/suite/funcs_1/r/memory_views.result 2009-02-27 15:06:23 +0000
1147+++ Percona-Server/mysql-test/suite/funcs_1/r/memory_views.result 2012-08-21 05:42:33 +0000
1148@@ -54,6 +54,8 @@
1149 f108 enum("1enum","2enum") not null default "1enum",
1150 f109 set("1set","2set") not null default "1set"
1151 ) engine = memory;
1152+Warnings:
1153+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1154 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
1155 into table tb2 ;
1156 DROP DATABASE IF EXISTS test1;
1157@@ -113,6 +115,8 @@
1158 f108 enum("1enum","2enum") not null default "1enum",
1159 f109 set("1set","2set") not null default "1set"
1160 ) engine = memory;
1161+Warnings:
1162+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1163 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
1164 into table tb2 ;
1165 USE test;
1166
1167=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/myisam_views-big.result'
1168--- Percona-Server/mysql-test/suite/funcs_1/r/myisam_views-big.result 2010-12-31 11:07:34 +0000
1169+++ Percona-Server/mysql-test/suite/funcs_1/r/myisam_views-big.result 2012-08-21 05:42:33 +0000
1170@@ -62,6 +62,8 @@
1171 f116 VARBINARY(64) null,
1172 f117 VARBINARY(192) null
1173 ) engine = myisam;
1174+Warnings:
1175+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1176 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1177 into table tb2;
1178 DROP DATABASE IF EXISTS test1;
1179@@ -129,6 +131,8 @@
1180 f116 VARBINARY(64) null,
1181 f117 VARBINARY(192) null
1182 ) engine = myisam;
1183+Warnings:
1184+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1185 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
1186 into table tb2;
1187 USE test;
1188
1189=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/ndb_views.result'
1190--- Percona-Server/mysql-test/suite/funcs_1/r/ndb_views.result 2009-02-27 15:06:23 +0000
1191+++ Percona-Server/mysql-test/suite/funcs_1/r/ndb_views.result 2012-08-21 05:42:33 +0000
1192@@ -53,6 +53,8 @@
1193 f108 enum("1enum","2enum") not null default "1enum",
1194 f109 set("1set","2set") not null default "1set"
1195 ) engine = ndb;
1196+Warnings:
1197+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1198 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
1199 into table tb2 ;
1200 DROP DATABASE IF EXISTS test1;
1201@@ -112,6 +114,8 @@
1202 f108 enum("1enum","2enum") not null default "1enum",
1203 f109 set("1set","2set") not null default "1set"
1204 ) engine = ndb;
1205+Warnings:
1206+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1207 load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
1208 into table tb2 ;
1209 USE test;
1210
1211=== modified file 'Percona-Server/mysql-test/suite/funcs_1/r/storedproc.result'
1212--- Percona-Server/mysql-test/suite/funcs_1/r/storedproc.result 2010-03-19 08:56:26 +0000
1213+++ Percona-Server/mysql-test/suite/funcs_1/r/storedproc.result 2012-08-21 05:42:33 +0000
1214@@ -7526,9 +7526,13 @@
1215 declare x, y, z year(3) default 2005;
1216 SELECT x, y, z;
1217 END//
1218+Warnings:
1219+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1220 CALL sp1();
1221 x y z
1222 2005 2005 2005
1223+Warnings:
1224+Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1225 DROP PROCEDURE IF EXISTS sp1;
1226 CREATE PROCEDURE sp1( )
1227 BEGIN
1228
1229=== added file 'Percona-Server/mysql-test/suite/innodb/r/innodb_bug14007649.result'
1230--- Percona-Server/mysql-test/suite/innodb/r/innodb_bug14007649.result 1970-01-01 00:00:00 +0000
1231+++ Percona-Server/mysql-test/suite/innodb/r/innodb_bug14007649.result 2012-08-21 05:42:33 +0000
1232@@ -0,0 +1,56 @@
1233+create table t1 (
1234+rowid int,
1235+f1 int,
1236+f2 int,
1237+key i1 (f1, f2),
1238+key i2 (f2)) engine=innodb;
1239+show create table t1;
1240+Table Create Table
1241+t1 CREATE TABLE `t1` (
1242+ `rowid` int(11) DEFAULT NULL,
1243+ `f1` int(11) DEFAULT NULL,
1244+ `f2` int(11) DEFAULT NULL,
1245+ KEY `i1` (`f1`,`f2`),
1246+ KEY `i2` (`f2`)
1247+) ENGINE=InnoDB DEFAULT CHARSET=latin1
1248+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
1249+start transaction with consistent snapshot;
1250+start transaction;
1251+update t1 set f2 = 4 where f1 = 1 and f2 is null;
1252+(b) Number of rows updated:
1253+select row_count();
1254+row_count()
1255+1
1256+insert into t1 values (3, 1, null);
1257+(b) After update and insert query.
1258+select rowid, f1, f2 from t1;
1259+rowid f1 f2
1260+1 1 10
1261+2 1 4
1262+3 1 NULL
1263+commit;
1264+(a) Before the update statement is executed.
1265+select rowid, f1, f2 from t1;
1266+rowid f1 f2
1267+1 1 10
1268+2 1 NULL
1269+SET SESSION debug="+d,bug14007649";
1270+update t1 set f2 = 6 where f1 = 1 and f2 is null;
1271+(a) Number of rows updated:
1272+select row_count();
1273+row_count()
1274+1
1275+(a) After the update statement is executed.
1276+select rowid, f1, f2 from t1;
1277+rowid f1 f2
1278+1 1 10
1279+2 1 NULL
1280+3 1 6
1281+commit;
1282+"The trx with consistent snapshot ended."
1283+select rowid, f1, f2 from t1;
1284+rowid f1 f2
1285+1 1 10
1286+2 1 4
1287+3 1 6
1288+drop table t1;
1289
1290=== added file 'Percona-Server/mysql-test/suite/innodb/t/innodb_bug14007649.test'
1291--- Percona-Server/mysql-test/suite/innodb/t/innodb_bug14007649.test 1970-01-01 00:00:00 +0000
1292+++ Percona-Server/mysql-test/suite/innodb/t/innodb_bug14007649.test 2012-08-21 05:42:33 +0000
1293@@ -0,0 +1,58 @@
1294+--source include/have_innodb.inc
1295+--source include/have_debug.inc
1296+
1297+create table t1 (
1298+ rowid int,
1299+ f1 int,
1300+ f2 int,
1301+ key i1 (f1, f2),
1302+ key i2 (f2)) engine=innodb;
1303+
1304+show create table t1;
1305+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
1306+
1307+connect (a,localhost,root,,);
1308+connect (b,localhost,root,,);
1309+
1310+connection a;
1311+start transaction with consistent snapshot;
1312+
1313+connection b;
1314+start transaction;
1315+update t1 set f2 = 4 where f1 = 1 and f2 is null;
1316+
1317+-- echo (b) Number of rows updated:
1318+select row_count();
1319+
1320+insert into t1 values (3, 1, null);
1321+
1322+-- echo (b) After update and insert query.
1323+select rowid, f1, f2 from t1;
1324+
1325+commit;
1326+
1327+connection a;
1328+
1329+-- echo (a) Before the update statement is executed.
1330+select rowid, f1, f2 from t1;
1331+
1332+SET SESSION debug="+d,bug14007649";
1333+update t1 set f2 = 6 where f1 = 1 and f2 is null;
1334+
1335+-- echo (a) Number of rows updated:
1336+select row_count();
1337+
1338+-- echo (a) After the update statement is executed.
1339+select rowid, f1, f2 from t1;
1340+
1341+commit;
1342+
1343+--echo "The trx with consistent snapshot ended."
1344+
1345+select rowid, f1, f2 from t1;
1346+
1347+connection default;
1348+disconnect a;
1349+disconnect b;
1350+
1351+drop table t1;
1352
1353=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result'
1354--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result 1970-01-01 00:00:00 +0000
1355+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result 2012-08-21 05:42:33 +0000
1356@@ -0,0 +1,56 @@
1357+create table t1 (
1358+rowid int,
1359+f1 int,
1360+f2 int,
1361+key i1 (f1, f2),
1362+key i2 (f2)) engine=innodb;
1363+show create table t1;
1364+Table Create Table
1365+t1 CREATE TABLE `t1` (
1366+ `rowid` int(11) DEFAULT NULL,
1367+ `f1` int(11) DEFAULT NULL,
1368+ `f2` int(11) DEFAULT NULL,
1369+ KEY `i1` (`f1`,`f2`),
1370+ KEY `i2` (`f2`)
1371+) ENGINE=InnoDB DEFAULT CHARSET=latin1
1372+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
1373+start transaction with consistent snapshot;
1374+start transaction;
1375+update t1 set f2 = 4 where f1 = 1 and f2 is null;
1376+(b) Number of rows updated:
1377+select row_count();
1378+row_count()
1379+1
1380+insert into t1 values (3, 1, null);
1381+(b) After update and insert query.
1382+select rowid, f1, f2 from t1;
1383+rowid f1 f2
1384+1 1 10
1385+2 1 4
1386+3 1 NULL
1387+commit;
1388+(a) Before the update statement is executed.
1389+select rowid, f1, f2 from t1;
1390+rowid f1 f2
1391+1 1 10
1392+2 1 NULL
1393+SET SESSION debug="+d,bug14007649";
1394+update t1 set f2 = 6 where f1 = 1 and f2 is null;
1395+(a) Number of rows updated:
1396+select row_count();
1397+row_count()
1398+1
1399+(a) After the update statement is executed.
1400+select rowid, f1, f2 from t1;
1401+rowid f1 f2
1402+1 1 10
1403+2 1 NULL
1404+3 1 6
1405+commit;
1406+"The trx with consistent snapshot ended."
1407+select rowid, f1, f2 from t1;
1408+rowid f1 f2
1409+1 1 10
1410+2 1 4
1411+3 1 6
1412+drop table t1;
1413
1414=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result'
1415--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result 2011-09-27 10:56:05 +0000
1416+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result 2012-08-21 05:42:33 +0000
1417@@ -58,6 +58,7 @@
1418 col90 tinyblob
1419 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
1420 Warnings:
1421+Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
1422 Note 1291 Column 'col82' has duplicated value '' in ENUM
1423 Note 1291 Column 'col82' has duplicated value '' in ENUM
1424 INSERT INTO bug52745 SET
1425
1426=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test'
1427--- Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test 1970-01-01 00:00:00 +0000
1428+++ Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test 2012-08-21 05:42:33 +0000
1429@@ -0,0 +1,58 @@
1430+--source include/have_innodb_plugin.inc
1431+--source include/have_debug.inc
1432+
1433+create table t1 (
1434+ rowid int,
1435+ f1 int,
1436+ f2 int,
1437+ key i1 (f1, f2),
1438+ key i2 (f2)) engine=innodb;
1439+
1440+show create table t1;
1441+insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
1442+
1443+connect (a,localhost,root,,);
1444+connect (b,localhost,root,,);
1445+
1446+connection a;
1447+start transaction with consistent snapshot;
1448+
1449+connection b;
1450+start transaction;
1451+update t1 set f2 = 4 where f1 = 1 and f2 is null;
1452+
1453+-- echo (b) Number of rows updated:
1454+select row_count();
1455+
1456+insert into t1 values (3, 1, null);
1457+
1458+-- echo (b) After update and insert query.
1459+select rowid, f1, f2 from t1;
1460+
1461+commit;
1462+
1463+connection a;
1464+
1465+-- echo (a) Before the update statement is executed.
1466+select rowid, f1, f2 from t1;
1467+
1468+SET SESSION debug="+d,bug14007649";
1469+update t1 set f2 = 6 where f1 = 1 and f2 is null;
1470+
1471+-- echo (a) Number of rows updated:
1472+select row_count();
1473+
1474+-- echo (a) After the update statement is executed.
1475+select rowid, f1, f2 from t1;
1476+
1477+commit;
1478+
1479+--echo "The trx with consistent snapshot ended."
1480+
1481+select rowid, f1, f2 from t1;
1482+
1483+connection default;
1484+disconnect a;
1485+disconnect b;
1486+
1487+drop table t1;
1488
1489=== added file 'Percona-Server/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result'
1490--- Percona-Server/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result 1970-01-01 00:00:00 +0000
1491+++ Percona-Server/mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result 2012-08-21 05:42:33 +0000
1492@@ -0,0 +1,36 @@
1493+include/master-slave.inc
1494+[connection master]
1495+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
1496+create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
1497+create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
1498+ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
1499+create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
1500+set @@binlog_format=statement;
1501+*** autoincrement field is not the first in PK warning must be there: ***
1502+insert into tm set b=null, a=1;
1503+Warnings:
1504+Note 1592 Statement may not be safe to log in statement format.
1505+show warnings;
1506+Level Code Message
1507+Note 1592 Statement may not be safe to log in statement format.
1508+*** no warning when autoincrement is the first in PK
1509+insert into ti set b=null, a=1;
1510+show warnings;
1511+Level Code Message
1512+create function multi_part_pk_with_autoinc (arg int)
1513+returns int
1514+begin
1515+insert into tm set b=null, a=arg;
1516+return arg;
1517+end//
1518+select multi_part_pk_with_autoinc (3);
1519+multi_part_pk_with_autoinc (3)
1520+3
1521+*** No warnings in 5.1 because of Bug11749859-39934 ***
1522+show warnings;
1523+Level Code Message
1524+set @@binlog_format=mixed;
1525+insert into tm set b=null, a=2;
1526+drop table tm, ti;
1527+drop function multi_part_pk_with_autoinc;
1528+include/rpl_end.inc
1529
1530=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result'
1531--- Percona-Server/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result 2011-02-23 09:31:37 +0000
1532+++ Percona-Server/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result 2012-08-21 05:42:33 +0000
1533@@ -114,4 +114,26 @@
1534 3 3
1535 [on master]
1536 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
1537+CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
1538+CREATE TABLE test.t1 (a INT);
1539+INSERT INTO test.t1 VALUES(1);
1540+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
1541+CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
1542+CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
1543+INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
1544+SET INSERT_ID=2;
1545+SET @c=2;
1546+SET @@rand_seed1=10000000, @@rand_seed2=1000000;
1547+INSERT INTO t5 VALUES (NULL, RAND(), @c);
1548+Warnings:
1549+Note 1592 Statement may not be safe to log in statement format.
1550+SELECT b into @b FROM test.t5;
1551+UPDATE test.t1 SET a=2;
1552+SELECT a AS 'ONE' into @a FROM test.t_slave;
1553+SELECT c AS 'NULL' into @c FROM test.t_slave;
1554+SELECT b into @b FROM test.t_slave;
1555+include/assert.inc [Random values from master and slave must be different]
1556+drop table test.t5;
1557+drop table test.t1;
1558+drop table test.t_slave;
1559 include/rpl_end.inc
1560
1561=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_log_pos.result'
1562--- Percona-Server/mysql-test/suite/rpl/r/rpl_log_pos.result 2010-12-19 17:07:28 +0000
1563+++ Percona-Server/mysql-test/suite/rpl/r/rpl_log_pos.result 2012-08-21 05:42:33 +0000
1564@@ -9,7 +9,7 @@
1565 Read_Master_Log_Pos = '75'
1566 start slave;
1567 include/wait_for_slave_io_error.inc [errno=1236]
1568-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master''
1569+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event''
1570 include/stop_slave_sql.inc
1571 show master status;
1572 File Position Binlog_Do_DB Binlog_Ignore_DB
1573
1574=== modified file 'Percona-Server/mysql-test/suite/rpl/r/rpl_packet.result'
1575--- Percona-Server/mysql-test/suite/rpl/r/rpl_packet.result 2011-03-25 10:57:27 +0000
1576+++ Percona-Server/mysql-test/suite/rpl/r/rpl_packet.result 2012-08-21 05:42:33 +0000
1577@@ -1,7 +1,7 @@
1578 include/master-slave.inc
1579 [connection master]
1580-call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
1581-call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
1582+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
1583+call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
1584 drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
1585 create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
1586 SET @@global.max_allowed_packet=1024;
1587@@ -30,14 +30,14 @@
1588 CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
1589 INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
1590 include/wait_for_slave_io_error.inc [errno=1153]
1591-Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes'
1592+Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
1593 include/stop_slave_sql.inc
1594 include/rpl_reset.inc
1595 DROP TABLE t1;
1596 CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
1597 INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
1598-include/wait_for_slave_io_error.inc [errno=1236]
1599-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master''
1600+include/wait_for_slave_io_error.inc [errno=1153]
1601+Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
1602 STOP SLAVE;
1603 RESET SLAVE;
1604 RESET MASTER;
1605@@ -52,6 +52,7 @@
1606 Warnings:
1607 Warning 1105 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
1608 SET @@global.net_buffer_length= 1024;
1609+SET @@global.slave_max_allowed_packet= 1073741824;
1610 DROP TABLE t1;
1611 RESET SLAVE;
1612 include/rpl_end.inc
1613
1614=== added file 'Percona-Server/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result'
1615--- Percona-Server/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result 1970-01-01 00:00:00 +0000
1616+++ Percona-Server/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result 2012-08-21 05:42:33 +0000
1617@@ -0,0 +1,13 @@
1618+include/master-slave.inc
1619+[connection master]
1620+[connection slave]
1621+SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
1622+SHOW BINLOG EVENTS;
1623+[connection slave1]
1624+SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
1625+FLUSH LOGS;
1626+SET DEBUG_SYNC= 'now SIGNAL end';
1627+SET DEBUG_SYNC= 'RESET';
1628+[connection slave]
1629+SET DEBUG_SYNC= 'RESET';
1630+include/rpl_end.inc
1631
1632=== added file 'Percona-Server/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test'
1633--- Percona-Server/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test 1970-01-01 00:00:00 +0000
1634+++ Percona-Server/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test 2012-08-21 05:42:33 +0000
1635@@ -0,0 +1,62 @@
1636+# Test of auto-increment.
1637+#
1638+# BUG#11754117-45670
1639+# Multipart primary key with the autoincrement part not first in it
1640+# is replication unsafe.
1641+#
1642+
1643+source include/master-slave.inc;
1644+source include/have_binlog_format_mixed.inc;
1645+source include/have_innodb.inc;
1646+
1647+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
1648+
1649+--connection master
1650+create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
1651+--error ER_WRONG_AUTO_KEY
1652+create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
1653+create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
1654+
1655+set @@binlog_format=statement;
1656+--echo *** autoincrement field is not the first in PK warning must be there: ***
1657+insert into tm set b=null, a=1;
1658+show warnings;
1659+--echo *** no warning when autoincrement is the first in PK
1660+insert into ti set b=null, a=1;
1661+show warnings;
1662+
1663+delimiter //;
1664+create function multi_part_pk_with_autoinc (arg int)
1665+returns int
1666+begin
1667+ insert into tm set b=null, a=arg;
1668+ return arg;
1669+end//
1670+delimiter ;//
1671+
1672+select multi_part_pk_with_autoinc (3);
1673+--echo *** No warnings in 5.1 because of Bug11749859-39934 ***
1674+show warnings;
1675+
1676+set @@binlog_format=mixed;
1677+insert into tm set b=null, a=2;
1678+
1679+sync_slave_with_master;
1680+
1681+if (`select count(*) <> 3 from tm`)
1682+{
1683+ --echo Wrong result from SELECT on the slave side.
1684+ select * from tm;
1685+ --die
1686+}
1687+
1688+# cleanup
1689+
1690+--connection master
1691+
1692+drop table tm, ti;
1693+drop function multi_part_pk_with_autoinc;
1694+
1695+sync_slave_with_master;
1696+
1697+--source include/rpl_end.inc
1698
1699=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test'
1700--- Percona-Server/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test 2011-02-23 09:31:37 +0000
1701+++ Percona-Server/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test 2012-08-21 05:42:33 +0000
1702@@ -206,4 +206,65 @@
1703 connection master;
1704 echo [on master];
1705 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
1706+
1707+--sync_slave_with_master
1708+
1709+#
1710+# BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED
1711+# Int-, Rand- and User- var events accompaning a filtered out Query-log-event should
1712+# be filtered as well.
1713+#
1714+connection master;
1715+# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
1716+CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT); # ignored on slave
1717+CREATE TABLE test.t1 (a INT); # accepted on slave
1718+INSERT INTO test.t1 VALUES(1);
1719+
1720+--sync_slave_with_master
1721+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
1722+# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
1723+CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
1724+CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
1725+ INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
1726+
1727+connection master;
1728+SET INSERT_ID=2;
1729+SET @c=2;
1730+SET @@rand_seed1=10000000, @@rand_seed2=1000000;
1731+INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored
1732+SELECT b into @b FROM test.t5;
1733+--let $b_master=`select @b`
1734+UPDATE test.t1 SET a=2; # to run trigger on slave
1735+
1736+--sync_slave_with_master
1737+
1738+# The proof:
1739+SELECT a AS 'ONE' into @a FROM test.t_slave;
1740+SELECT c AS 'NULL' into @c FROM test.t_slave;
1741+
1742+let $count= 1;
1743+let $table= test.t_slave;
1744+source include/wait_until_rows_count.inc;
1745+
1746+if (`SELECT @a != 2 and @c != NULL`)
1747+{
1748+ SELECT * FROM test.t_slave;
1749+ --die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
1750+}
1751+
1752+SELECT b into @b FROM test.t_slave;
1753+--let $b_slave=`select @b`
1754+
1755+--let $assert_text= Random values from master and slave must be different
1756+--let $assert_cond= $b_master != $b_slave
1757+--source include/assert.inc
1758+
1759+# cleanup BUG#11754117
1760+connection master;
1761+drop table test.t5;
1762+drop table test.t1;
1763+
1764+--sync_slave_with_master
1765+drop table test.t_slave;
1766+
1767 --source include/rpl_end.inc
1768
1769=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_packet-slave.opt'
1770--- Percona-Server/mysql-test/suite/rpl/t/rpl_packet-slave.opt 2007-06-27 12:28:02 +0000
1771+++ Percona-Server/mysql-test/suite/rpl/t/rpl_packet-slave.opt 2012-08-21 05:42:33 +0000
1772@@ -1,1 +1,1 @@
1773--O max_allowed_packet=1024 -O net_buffer_length=1024
1774+-O max_allowed_packet=1024 -O net_buffer_length=1024 -O slave_max_allowed_packet=1024
1775
1776=== modified file 'Percona-Server/mysql-test/suite/rpl/t/rpl_packet.test'
1777--- Percona-Server/mysql-test/suite/rpl/t/rpl_packet.test 2011-01-18 17:23:49 +0000
1778+++ Percona-Server/mysql-test/suite/rpl/t/rpl_packet.test 2012-08-21 05:42:33 +0000
1779@@ -11,9 +11,8 @@
1780 # max-out size db name
1781 source include/master-slave.inc;
1782 source include/have_binlog_format_row.inc;
1783-call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
1784-call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
1785-
1786+call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
1787+call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
1788 let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
1789 disable_warnings;
1790 eval drop database if exists $db;
1791@@ -23,6 +22,7 @@
1792 connection master;
1793 let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
1794 let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
1795+let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
1796 SET @@global.max_allowed_packet=1024;
1797 SET @@global.net_buffer_length=1024;
1798
1799@@ -124,8 +124,8 @@
1800
1801 connection slave;
1802 # The slave I/O thread must stop after receiving
1803-# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
1804---let $slave_io_errno= 1236
1805+# 1153 = ER_NET_PACKET_TOO_LARGE
1806+--let $slave_io_errno= 1153
1807 --let $show_slave_io_error= 1
1808 --source include/wait_for_slave_io_error.inc
1809
1810@@ -166,6 +166,7 @@
1811 DROP TABLE t1;
1812 eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
1813 eval SET @@global.net_buffer_length= $old_net_buffer_length;
1814+eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
1815 # slave is stopped
1816 connection slave;
1817 DROP TABLE t1;
1818
1819=== added file 'Percona-Server/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test'
1820--- Percona-Server/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test 1970-01-01 00:00:00 +0000
1821+++ Percona-Server/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test 2012-08-21 05:42:33 +0000
1822@@ -0,0 +1,35 @@
1823+# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
1824+#
1825+# The function mysql_show_binlog_events has a local stack variable
1826+# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
1827+# this variable goes out of scope and is destroyed before clean
1828+# thd->current_linfo.
1829+#
1830+# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
1831+# that with the fix local variable linfo is valid along all
1832+# mysql_show_binlog_events function scope.
1833+#
1834+--source include/have_debug_sync.inc
1835+--source include/master-slave.inc
1836+
1837+--echo [connection slave]
1838+--connection slave
1839+SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
1840+--send SHOW BINLOG EVENTS
1841+
1842+--connection slave1
1843+--echo [connection slave1]
1844+SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
1845+FLUSH LOGS;
1846+SET DEBUG_SYNC= 'now SIGNAL end';
1847+SET DEBUG_SYNC= 'RESET';
1848+
1849+--echo [connection slave]
1850+--connection slave
1851+--disable_result_log
1852+--reap
1853+--enable_result_log
1854+SET DEBUG_SYNC= 'RESET';
1855+
1856+--connection master
1857+--source include/rpl_end.inc
1858
1859=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result'
1860--- Percona-Server/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result 1970-01-01 00:00:00 +0000
1861+++ Percona-Server/mysql-test/suite/sys_vars/r/slave_max_allowed_packet_basic.result 2012-08-21 05:42:33 +0000
1862@@ -0,0 +1,139 @@
1863+SET @start_value = @@global.slave_max_allowed_packet;
1864+SELECT @start_value;
1865+@start_value
1866+1073741824
1867+'#--------------------FN_DYNVARS_072_01------------------------#'
1868+SET @@global.slave_max_allowed_packet = 5000;
1869+SET @@global.slave_max_allowed_packet = DEFAULT;
1870+SELECT @@global.slave_max_allowed_packet;
1871+@@global.slave_max_allowed_packet
1872+1073741824
1873+'#---------------------FN_DYNVARS_072_02-------------------------#'
1874+SET @@global.slave_max_allowed_packet = @start_value;
1875+SELECT @@global.slave_max_allowed_packet = 1073741824;
1876+@@global.slave_max_allowed_packet = 1073741824
1877+1
1878+'Bug# 34876: Incorrect Default Value is assigned to variable';
1879+'#--------------------FN_DYNVARS_072_03------------------------#'
1880+SET @@global.slave_max_allowed_packet = 1024;
1881+SELECT @@global.slave_max_allowed_packet;
1882+@@global.slave_max_allowed_packet
1883+1024
1884+SET @@global.slave_max_allowed_packet = 1073741824;
1885+SELECT @@global.slave_max_allowed_packet;
1886+@@global.slave_max_allowed_packet
1887+1073741824
1888+SET @@global.slave_max_allowed_packet = 1073741824;
1889+SELECT @@global.slave_max_allowed_packet;
1890+@@global.slave_max_allowed_packet
1891+1073741824
1892+SET @@global.slave_max_allowed_packet = 1025;
1893+SELECT @@global.slave_max_allowed_packet;
1894+@@global.slave_max_allowed_packet
1895+1024
1896+SET @@global.slave_max_allowed_packet = 65535;
1897+SELECT @@global.slave_max_allowed_packet;
1898+@@global.slave_max_allowed_packet
1899+64512
1900+'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
1901+'#--------------------FN_DYNVARS_072_04-------------------------#'
1902+SET @@global.slave_max_allowed_packet = -1;
1903+Warnings:
1904+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1'
1905+SELECT @@global.slave_max_allowed_packet;
1906+@@global.slave_max_allowed_packet
1907+1024
1908+SET @@global.slave_max_allowed_packet = 100000000000;
1909+Warnings:
1910+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '100000000000'
1911+SELECT @@global.slave_max_allowed_packet;
1912+@@global.slave_max_allowed_packet
1913+1073741824
1914+SET @@global.slave_max_allowed_packet = 10000.01;
1915+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
1916+SELECT @@global.slave_max_allowed_packet;
1917+@@global.slave_max_allowed_packet
1918+1073741824
1919+SET @@global.slave_max_allowed_packet = -1024;
1920+Warnings:
1921+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1024'
1922+SELECT @@global.slave_max_allowed_packet;
1923+@@global.slave_max_allowed_packet
1924+1024
1925+SET @@global.slave_max_allowed_packet = 4294967296;
1926+Warnings:
1927+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '4294967296'
1928+SELECT @@global.slave_max_allowed_packet;
1929+@@global.slave_max_allowed_packet
1930+1073741824
1931+SET @@global.slave_max_allowed_packet = 1023;
1932+Warnings:
1933+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1023'
1934+SELECT @@global.slave_max_allowed_packet;
1935+@@global.slave_max_allowed_packet
1936+1024
1937+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
1938+SET @@global.slave_max_allowed_packet = ON;
1939+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
1940+SELECT @@global.slave_max_allowed_packet;
1941+@@global.slave_max_allowed_packet
1942+1024
1943+SET @@global.slave_max_allowed_packet = 'test';
1944+ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
1945+SELECT @@global.slave_max_allowed_packet;
1946+@@global.slave_max_allowed_packet
1947+1024
1948+'#-------------------FN_DYNVARS_072_05----------------------------#'
1949+SET @@session.slave_max_allowed_packet = 4096;
1950+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
1951+SELECT @@session.slave_max_allowed_packet;
1952+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable
1953+'#----------------------FN_DYNVARS_072_06------------------------#'
1954+SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
1955+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
1956+WHERE VARIABLE_NAME='slave_max_allowed_packet';
1957+@@global.slave_max_allowed_packet = VARIABLE_VALUE
1958+1
1959+SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
1960+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
1961+WHERE VARIABLE_NAME='slave_max_allowed_packet';
1962+@@slave_max_allowed_packet = VARIABLE_VALUE
1963+1
1964+'#---------------------FN_DYNVARS_072_07----------------------#'
1965+SET @@global.slave_max_allowed_packet = TRUE;
1966+Warnings:
1967+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1'
1968+SELECT @@global.slave_max_allowed_packet;
1969+@@global.slave_max_allowed_packet
1970+1024
1971+SET @@global.slave_max_allowed_packet = FALSE;
1972+Warnings:
1973+Warning 1292 Truncated incorrect slave_max_allowed_packet value: '0'
1974+SELECT @@global.slave_max_allowed_packet;
1975+@@global.slave_max_allowed_packet
1976+1024
1977+'#---------------------FN_DYNVARS_072_08----------------------#'
1978+SET @@global.slave_max_allowed_packet = 5000;
1979+SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
1980+@@slave_max_allowed_packet = @@global.slave_max_allowed_packet
1981+1
1982+'#---------------------FN_DYNVARS_072_09----------------------#'
1983+SET slave_max_allowed_packet = 6000;
1984+ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
1985+SELECT @@slave_max_allowed_packet;
1986+@@slave_max_allowed_packet
1987+4096
1988+SET local.slave_max_allowed_packet = 7000;
1989+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave_max_allowed_packet = 7000' at line 1
1990+SELECT local.slave_max_allowed_packet;
1991+ERROR 42S02: Unknown table 'local' in field list
1992+SET global.slave_max_allowed_packet = 8000;
1993+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave_max_allowed_packet = 8000' at line 1
1994+SELECT global.slave_max_allowed_packet;
1995+ERROR 42S02: Unknown table 'global' in field list
1996+SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
1997+ERROR 42S22: Unknown column 'slave_max_allowed_packet' in 'field list'
1998+SET @@global.slave_max_allowed_packet = @start_value;
1999+SELECT @@global.slave_max_allowed_packet;
2000+@@global.slave_max_allowed_packet
2001+1073741824
2002
2003=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test'
2004--- Percona-Server/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test 1970-01-01 00:00:00 +0000
2005+++ Percona-Server/mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test 2012-08-21 05:42:33 +0000
2006@@ -0,0 +1,177 @@
2007+############## mysql-test\t\slave_max_allowed_packet_basic.test ##################
2008+# #
2009+# Variable Name: slave_max_allowed_packet #
2010+# Scope: GLOBAL #
2011+# Access Type: Dynamic #
2012+# Data Type: numeric #
2013+# Default Value:1073741824 #
2014+# Range: 1024 - 1073741824 #
2015+# #
2016+# #
2017+# #
2018+# Description: Test Cases of Dynamic System Variable slave_max_allowed_packet #
2019+# that checks the behavior of this variable in the following ways#
2020+# * Default Value #
2021+# * Valid & Invalid values #
2022+# * Scope & Access method #
2023+# * Data Integrity #
2024+# #
2025+###############################################################################
2026+
2027+--source include/load_sysvars.inc
2028+
2029+########################################################################
2030+# START OF slave_max_allowed_packet TESTS #
2031+########################################################################
2032+
2033+
2034+###########################################################################
2035+# Saving initial value of slave_max_allowed_packet in a temporary variable#
2036+###########################################################################
2037+
2038+SET @start_value = @@global.slave_max_allowed_packet;
2039+SELECT @start_value;
2040+
2041+
2042+--echo '#--------------------FN_DYNVARS_072_01------------------------#'
2043+########################################################################
2044+# Display the DEFAULT value of slave_max_allowed_packet #
2045+########################################################################
2046+
2047+SET @@global.slave_max_allowed_packet = 5000;
2048+SET @@global.slave_max_allowed_packet = DEFAULT;
2049+SELECT @@global.slave_max_allowed_packet;
2050+
2051+
2052+--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
2053+###############################################
2054+# Verify default value of variable #
2055+###############################################
2056+
2057+SET @@global.slave_max_allowed_packet = @start_value;
2058+SELECT @@global.slave_max_allowed_packet = 1073741824;
2059+--echo 'Bug# 34876: Incorrect Default Value is assigned to variable';
2060+
2061+--echo '#--------------------FN_DYNVARS_072_03------------------------#'
2062+########################################################################
2063+# Change the value of slave_max_allowed_packet to a valid value #
2064+########################################################################
2065+
2066+SET @@global.slave_max_allowed_packet = 1024;
2067+SELECT @@global.slave_max_allowed_packet;
2068+SET @@global.slave_max_allowed_packet = 1073741824;
2069+SELECT @@global.slave_max_allowed_packet;
2070+SET @@global.slave_max_allowed_packet = 1073741824;
2071+SELECT @@global.slave_max_allowed_packet;
2072+SET @@global.slave_max_allowed_packet = 1025;
2073+SELECT @@global.slave_max_allowed_packet;
2074+SET @@global.slave_max_allowed_packet = 65535;
2075+SELECT @@global.slave_max_allowed_packet;
2076+--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
2077+
2078+
2079+--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
2080+###########################################################################
2081+# Change the value of slave_max_allowed_packet to invalid value #
2082+###########################################################################
2083+
2084+SET @@global.slave_max_allowed_packet = -1;
2085+SELECT @@global.slave_max_allowed_packet;
2086+SET @@global.slave_max_allowed_packet = 100000000000;
2087+SELECT @@global.slave_max_allowed_packet;
2088+--Error ER_WRONG_TYPE_FOR_VAR
2089+SET @@global.slave_max_allowed_packet = 10000.01;
2090+SELECT @@global.slave_max_allowed_packet;
2091+SET @@global.slave_max_allowed_packet = -1024;
2092+SELECT @@global.slave_max_allowed_packet;
2093+SET @@global.slave_max_allowed_packet = 4294967296;
2094+SELECT @@global.slave_max_allowed_packet;
2095+SET @@global.slave_max_allowed_packet = 1023;
2096+SELECT @@global.slave_max_allowed_packet;
2097+
2098+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
2099+
2100+--Error ER_WRONG_TYPE_FOR_VAR
2101+SET @@global.slave_max_allowed_packet = ON;
2102+SELECT @@global.slave_max_allowed_packet;
2103+--Error ER_WRONG_TYPE_FOR_VAR
2104+SET @@global.slave_max_allowed_packet = 'test';
2105+SELECT @@global.slave_max_allowed_packet;
2106+
2107+
2108+--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
2109+###########################################################################
2110+# Test if accessing session slave_max_allowed_packet gives error #
2111+###########################################################################
2112+
2113+--Error ER_GLOBAL_VARIABLE
2114+SET @@session.slave_max_allowed_packet = 4096;
2115+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
2116+SELECT @@session.slave_max_allowed_packet;
2117+
2118+
2119+--echo '#----------------------FN_DYNVARS_072_06------------------------#'
2120+##############################################################################
2121+# Check if the value in GLOBAL & SESSION Tables matches values in variable #
2122+##############################################################################
2123+
2124+SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
2125+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
2126+WHERE VARIABLE_NAME='slave_max_allowed_packet';
2127+
2128+SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
2129+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
2130+WHERE VARIABLE_NAME='slave_max_allowed_packet';
2131+
2132+
2133+--echo '#---------------------FN_DYNVARS_072_07----------------------#'
2134+###################################################################
2135+# Check if TRUE and FALSE values can be used on variable #
2136+###################################################################
2137+
2138+SET @@global.slave_max_allowed_packet = TRUE;
2139+SELECT @@global.slave_max_allowed_packet;
2140+SET @@global.slave_max_allowed_packet = FALSE;
2141+SELECT @@global.slave_max_allowed_packet;
2142+
2143+
2144+--echo '#---------------------FN_DYNVARS_072_08----------------------#'
2145+########################################################################################################
2146+# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
2147+########################################################################################################
2148+
2149+SET @@global.slave_max_allowed_packet = 5000;
2150+SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
2151+
2152+
2153+--echo '#---------------------FN_DYNVARS_072_09----------------------#'
2154+################################################################################
2155+# Check if slave_max_allowed_packet can be accessed with and without @@ sign #
2156+################################################################################
2157+
2158+--Error ER_GLOBAL_VARIABLE
2159+SET slave_max_allowed_packet = 6000;
2160+SELECT @@slave_max_allowed_packet;
2161+--Error ER_PARSE_ERROR
2162+SET local.slave_max_allowed_packet = 7000;
2163+--Error ER_UNKNOWN_TABLE
2164+SELECT local.slave_max_allowed_packet;
2165+--Error ER_PARSE_ERROR
2166+SET global.slave_max_allowed_packet = 8000;
2167+--Error ER_UNKNOWN_TABLE
2168+SELECT global.slave_max_allowed_packet;
2169+--Error ER_BAD_FIELD_ERROR
2170+SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
2171+
2172+
2173+##############################
2174+# Restore initial value #
2175+##############################
2176+
2177+SET @@global.slave_max_allowed_packet = @start_value;
2178+SELECT @@global.slave_max_allowed_packet;
2179+
2180+
2181+########################################################################
2182+# END OF slave_max_allowed_packet TESTS #
2183+########################################################################
2184
2185=== modified file 'Percona-Server/mysql-test/t/func_group_innodb.test'
2186--- Percona-Server/mysql-test/t/func_group_innodb.test 2006-05-22 11:27:58 +0000
2187+++ Percona-Server/mysql-test/t/func_group_innodb.test 2012-08-21 05:42:33 +0000
2188@@ -83,3 +83,47 @@
2189 select count(*), min(7), max(7) from t2m, t1i;
2190
2191 drop table t1m, t1i, t2m, t2i;
2192+
2193+--echo #
2194+--echo # Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
2195+--echo # COUNT(*) LIMIT.
2196+--echo #
2197+
2198+CREATE TABLE t1 (
2199+id BIGINT(20) ,
2200+member_id_to INT(11) ,
2201+r_date DATE ,
2202+PRIMARY KEY (id,r_date),
2203+KEY r_date_idx (r_date),
2204+KEY t1_idx01 (member_id_to)
2205+) ENGINE=InnoDB;
2206+
2207+INSERT INTO t1 VALUES
2208+(107924526,518491,'2011-05-01'),
2209+(107924527,518491,'2011-05-01'),
2210+(107924528,518491,'2011-05-01'),
2211+(107924529,518491,'2011-05-01'),
2212+(107924530,518491,'2011-05-01'),
2213+(107924531,518491,'2011-05-01'),
2214+(107924532,518491,'2011-05-01'),
2215+(107924534,518491,'2011-06-21'),
2216+(107924535,518491,'2011-06-21'),
2217+(107924536,518491,'2011-06-21'),
2218+(107924537,518491,'2011-06-21'),
2219+(107924538,518491,'2011-06-21'),
2220+(107924542,1601319,'2011-06-21'),
2221+(107924543,1601319,'2011-06-21'),
2222+(107924544,1601319,'2011-06-21'),
2223+(107924545,1601319,'2011-06-21'),
2224+(107924546,1601319,'2011-06-21'),
2225+(107924547,1601319,'2011-06-21'),
2226+(107924548,1601319,'2011-06-21'),
2227+(107924549,1601319,'2011-06-21'),
2228+(107924550,1601319,'2011-06-21');
2229+
2230+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
2231+ '2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
2232+
2233+DROP TABLE t1;
2234+
2235+--echo # End of test BUG#12713907
2236
2237=== modified file 'Percona-Server/mysql-test/t/mysqldump.test'
2238--- Percona-Server/mysql-test/t/mysqldump.test 2012-01-10 08:03:45 +0000
2239+++ Percona-Server/mysql-test/t/mysqldump.test 2012-08-21 05:42:33 +0000
2240@@ -2308,9 +2308,32 @@
2241
2242 USE test;
2243
2244---echo #
2245---echo # End of 5.1 tests
2246---echo #
2247-
2248 # Wait till we reached the initial number of concurrent sessions
2249 --source include/wait_until_count_sessions.inc
2250+
2251+--echo #
2252+--echo # Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
2253+--echo #
2254+SET @old_log_output_state= @@global.log_output;
2255+SET @old_general_log_state= @@global.general_log;
2256+SET @old_slow_query_log_state= @@global.slow_query_log;
2257+
2258+call mtr.add_suppression("Failed to write to mysql.general_log");
2259+--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug45740.sql
2260+# Make log_output as table and enable general_log and slow_log
2261+SET @@global.log_output="TABLE";
2262+SET @@global.general_log='ON';
2263+SET @@global.slow_query_log='ON';
2264+DROP DATABASE mysql;
2265+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug45740.sql
2266+SHOW CREATE TABLE mysql.general_log;
2267+SHOW CREATE TABLE mysql.slow_log;
2268+--remove_file $MYSQLTEST_VARDIR/tmp/bug45740.sql
2269+
2270+SET @@global.log_output= @old_log_output_state;
2271+SET @@global.slow_query_log= @old_slow_query_log_state;
2272+SET @@global.general_log= @old_general_log_state;
2273+
2274+--echo #
2275+--echo # End of 5.1 tests
2276+--echo #
2277
2278=== modified file 'Percona-Server/mysql-test/t/ps.test'
2279--- Percona-Server/mysql-test/t/ps.test 2010-10-01 10:08:38 +0000
2280+++ Percona-Server/mysql-test/t/ps.test 2012-08-21 05:42:33 +0000
2281@@ -3102,3 +3102,93 @@
2282 DROP TABLE t1;
2283
2284 --echo End of 5.1 tests.
2285+
2286+--echo
2287+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
2288+--echo
2289+
2290+PREPARE s1 FROM
2291+"
2292+SELECT c1, t2.c2, count(c3)
2293+FROM
2294+ (
2295+ SELECT 3 as c2 FROM dual WHERE @x = 1
2296+ UNION
2297+ SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
2298+ ) AS t1,
2299+ (
2300+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
2301+ UNION
2302+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
2303+ UNION
2304+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
2305+ ) AS t2
2306+WHERE t2.c2 = t1.c2
2307+GROUP BY c1, c2
2308+";
2309+
2310+--echo
2311+SET @x = 1;
2312+SELECT c1, t2.c2, count(c3)
2313+FROM
2314+ (
2315+ SELECT 3 as c2 FROM dual WHERE @x = 1
2316+ UNION
2317+ SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
2318+ ) AS t1,
2319+ (
2320+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
2321+ UNION
2322+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
2323+ UNION
2324+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
2325+ ) AS t2
2326+WHERE t2.c2 = t1.c2
2327+GROUP BY c1, c2;
2328+--echo
2329+EXECUTE s1;
2330+
2331+--echo
2332+SET @x = 2;
2333+SELECT c1, t2.c2, count(c3)
2334+FROM
2335+ (
2336+ SELECT 3 as c2 FROM dual WHERE @x = 1
2337+ UNION
2338+ SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
2339+ ) AS t1,
2340+ (
2341+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
2342+ UNION
2343+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
2344+ UNION
2345+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
2346+ ) AS t2
2347+WHERE t2.c2 = t1.c2
2348+GROUP BY c1, c2;
2349+--echo
2350+EXECUTE s1;
2351+
2352+--echo
2353+SET @x = 1;
2354+SELECT c1, t2.c2, count(c3)
2355+FROM
2356+ (
2357+ SELECT 3 as c2 FROM dual WHERE @x = 1
2358+ UNION
2359+ SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
2360+ ) AS t1,
2361+ (
2362+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
2363+ UNION
2364+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
2365+ UNION
2366+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
2367+ ) AS t2
2368+WHERE t2.c2 = t1.c2
2369+GROUP BY c1, c2;
2370+--echo
2371+EXECUTE s1;
2372+
2373+DEALLOCATE PREPARE s1;
2374+
2375
2376=== modified file 'Percona-Server/mysql-test/t/sp.test'
2377--- Percona-Server/mysql-test/t/sp.test 2012-01-09 10:28:02 +0000
2378+++ Percona-Server/mysql-test/t/sp.test 2012-08-21 05:42:33 +0000
2379@@ -8429,3 +8429,40 @@
2380 --echo # ------------------------------------------------------------------
2381 --echo # -- End of 5.1 tests
2382 --echo # ------------------------------------------------------------------
2383+
2384+--echo
2385+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
2386+--echo
2387+
2388+delimiter |;
2389+
2390+CREATE PROCEDURE p1(x INT UNSIGNED)
2391+BEGIN
2392+ SELECT c1, t2.c2, count(c3)
2393+ FROM
2394+ (
2395+ SELECT 3 as c2 FROM dual WHERE x = 1
2396+ UNION
2397+ SELECT 2 FROM dual WHERE x = 1 OR x = 2
2398+ ) AS t1,
2399+ (
2400+ SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
2401+ UNION
2402+ SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
2403+ UNION
2404+ SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
2405+ ) AS t2
2406+ WHERE t2.c2 = t1.c2
2407+ GROUP BY c1, c2
2408+ ;
2409+END|
2410+
2411+delimiter ;|
2412+
2413+--echo
2414+CALL p1(1);
2415+CALL p1(2);
2416+CALL p1(1);
2417+
2418+DROP PROCEDURE p1;
2419+
2420
2421=== modified file 'Percona-Server/mysql-test/t/type_year.test'
2422--- Percona-Server/mysql-test/t/type_year.test 2011-02-22 21:03:32 +0000
2423+++ Percona-Server/mysql-test/t/type_year.test 2012-08-21 05:42:33 +0000
2424@@ -160,5 +160,13 @@
2425 DROP TABLE t1;
2426
2427 --echo #
2428+--echo # WL#6219: Deprecate and remove YEAR(2) type
2429+--echo #
2430+
2431+CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
2432+ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
2433+DROP TABLE t1;
2434+
2435+--echo #
2436
2437 --echo End of 5.1 tests
2438
2439=== modified file 'Percona-Server/mysys/mf_iocache2.c'
2440--- Percona-Server/mysys/mf_iocache2.c 2011-06-30 15:37:13 +0000
2441+++ Percona-Server/mysys/mf_iocache2.c 2012-08-21 05:42:33 +0000
2442@@ -430,7 +430,11 @@
2443 memset(buffz, '0', minimum_width - length2);
2444 else
2445 memset(buffz, ' ', minimum_width - length2);
2446- my_b_write(info, buffz, minimum_width - length2);
2447+ if (my_b_write(info, buffz, minimum_width - length2))
2448+ {
2449+ my_afree(buffz);
2450+ goto err;
2451+ }
2452 my_afree(buffz);
2453 }
2454
2455
2456=== modified file 'Percona-Server/mysys/my_access.c'
2457--- Percona-Server/mysys/my_access.c 2006-12-23 19:20:40 +0000
2458+++ Percona-Server/mysys/my_access.c 2012-08-21 05:42:33 +0000
2459@@ -148,7 +148,8 @@
2460 int check_if_legal_tablename(const char *name)
2461 {
2462 DBUG_ENTER("check_if_legal_tablename");
2463- DBUG_RETURN((reserved_map[(uchar) name[0]] & 1) &&
2464+ DBUG_RETURN(name[0] != 0 && name[1] != 0 &&
2465+ (reserved_map[(uchar) name[0]] & 1) &&
2466 (reserved_map[(uchar) name[1]] & 2) &&
2467 (reserved_map[(uchar) name[2]] & 4) &&
2468 str_list_find(&reserved_names[1], name));
2469
2470=== modified file 'Percona-Server/mysys/my_write.c'
2471--- Percona-Server/mysys/my_write.c 2011-06-30 15:37:13 +0000
2472+++ Percona-Server/mysys/my_write.c 2012-08-21 05:42:33 +0000
2473@@ -38,7 +38,17 @@
2474
2475 for (;;)
2476 {
2477- if ((writenbytes= write(Filedes, Buffer, Count)) == Count)
2478+ writenbytes= write(Filedes, Buffer, Count);
2479+ /**
2480+ To simulate the write error set the errno = error code
2481+ and the number pf written bytes to -1.
2482+ */
2483+ DBUG_EXECUTE_IF ("simulate_file_write_error",
2484+ {
2485+ errno= ENOSPC;
2486+ writenbytes= (size_t) -1;
2487+ });
2488+ if (writenbytes == Count)
2489 break;
2490 if (writenbytes != (size_t) -1)
2491 { /* Safeguard */
2492
2493=== modified file 'Percona-Server/sql-common/client.c'
2494--- Percona-Server/sql-common/client.c 2011-06-30 15:37:13 +0000
2495+++ Percona-Server/sql-common/client.c 2012-08-21 05:42:33 +0000
2496@@ -1,5 +1,5 @@
2497 /*
2498- Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2499+ Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
2500
2501 This program is free software; you can redistribute it and/or modify
2502 it under the terms of the GNU General Public License as published by
2503@@ -1268,7 +1268,7 @@
2504 ***************************************************************************/
2505
2506 MYSQL_FIELD *
2507-unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
2508+unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
2509 my_bool default_value, uint server_capabilities)
2510 {
2511 MYSQL_ROWS *row;
2512@@ -1281,6 +1281,7 @@
2513 if (!result)
2514 {
2515 free_rows(data); /* Free old data */
2516+ set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
2517 DBUG_RETURN(0);
2518 }
2519 bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields);
2520@@ -1308,6 +1309,14 @@
2521 field->org_name_length= lengths[5];
2522
2523 /* Unpack fixed length parts */
2524+ if (lengths[6] != 12)
2525+ {
2526+ /* malformed packet. signal an error. */
2527+ free_rows(data); /* Free old data */
2528+ set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
2529+ DBUG_RETURN(0);
2530+ }
2531+
2532 pos= (uchar*) row->data[6];
2533 field->charsetnr= uint2korr(pos);
2534 field->length= (uint) uint4korr(pos+2);
2535@@ -2868,7 +2877,7 @@
2536
2537 if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
2538 DBUG_RETURN(1);
2539- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
2540+ if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,
2541 (uint) field_count,0,
2542 mysql->server_capabilities)))
2543 DBUG_RETURN(1);
2544
2545=== modified file 'Percona-Server/sql/Makefile.am'
2546--- Percona-Server/sql/Makefile.am 2012-04-02 02:09:15 +0000
2547+++ Percona-Server/sql/Makefile.am 2012-08-21 05:42:33 +0000
2548@@ -71,6 +71,7 @@
2549 tztime.h my_decimal.h\
2550 sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
2551 parse_file.h sql_view.h sql_trigger.h \
2552+ mem_root_array.h \
2553 sql_array.h sql_cursor.h events.h scheduler.h \
2554 event_db_repository.h event_queue.h \
2555 sql_plugin.h authors.h event_parse_data.h \
2556
2557=== modified file 'Percona-Server/sql/event_scheduler.cc'
2558--- Percona-Server/sql/event_scheduler.cc 2011-11-24 01:59:42 +0000
2559+++ Percona-Server/sql/event_scheduler.cc 2012-08-21 05:42:33 +0000
2560@@ -633,13 +633,13 @@
2561 DBUG_PRINT("info", ("Scheduler thread has id %lu",
2562 scheduler_thd->thread_id));
2563 /* Lock from delete */
2564- pthread_mutex_lock(&scheduler_thd->LOCK_thd_data);
2565+ pthread_mutex_lock(&scheduler_thd->LOCK_thd_kill);
2566 /* This will wake up the thread if it waits on Queue's conditional */
2567 sql_print_information("Event Scheduler: Killing the scheduler thread, "
2568 "thread id %lu",
2569 scheduler_thd->thread_id);
2570 scheduler_thd->awake(THD::KILL_CONNECTION);
2571- pthread_mutex_unlock(&scheduler_thd->LOCK_thd_data);
2572+ pthread_mutex_unlock(&scheduler_thd->LOCK_thd_kill);
2573
2574 /* thd could be 0x0, when shutting down */
2575 sql_print_information("Event Scheduler: "
2576
2577=== modified file 'Percona-Server/sql/field.cc'
2578--- Percona-Server/sql/field.cc 2011-07-03 15:47:37 +0000
2579+++ Percona-Server/sql/field.cc 2012-08-21 05:42:33 +0000
2580@@ -10227,6 +10227,17 @@
2581 geom_type= ((Field_geom*)old_field)->geom_type;
2582 break;
2583 #endif
2584+ case MYSQL_TYPE_YEAR:
2585+ if (length != 4)
2586+ {
2587+ char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
2588+ my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
2589+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
2590+ ER_WARN_DEPRECATED_SYNTAX,
2591+ ER(ER_WARN_DEPRECATED_SYNTAX),
2592+ buff, "YEAR(4)");
2593+ }
2594+ break;
2595 default:
2596 break;
2597 }
2598
2599=== modified file 'Percona-Server/sql/handler.cc'
2600--- Percona-Server/sql/handler.cc 2012-08-17 06:12:17 +0000
2601+++ Percona-Server/sql/handler.cc 2012-08-21 05:42:33 +0000
2602@@ -2405,8 +2405,19 @@
2603 reservation means potentially losing unused values).
2604 Note that in prelocked mode no estimation is given.
2605 */
2606+
2607 if ((auto_inc_intervals_count == 0) && (estimation_rows_to_insert > 0))
2608 nb_desired_values= estimation_rows_to_insert;
2609+ else if ((auto_inc_intervals_count == 0) &&
2610+ (thd->lex->many_values.elements > 0))
2611+ {
2612+ /*
2613+ For multi-row inserts, if the bulk inserts cannot be started, the
2614+ handler::estimation_rows_to_insert will not be set. But we still
2615+ want to reserve the autoinc values.
2616+ */
2617+ nb_desired_values= thd->lex->many_values.elements;
2618+ }
2619 else /* go with the increasing defaults */
2620 {
2621 /* avoid overflow in formula, with this if() */
2622
2623=== modified file 'Percona-Server/sql/item.cc'
2624--- Percona-Server/sql/item.cc 2012-03-12 07:56:56 +0000
2625+++ Percona-Server/sql/item.cc 2012-08-21 05:42:33 +0000
2626@@ -6010,7 +6010,7 @@
2627 if (from_field != not_found_field)
2628 {
2629 Item_field* fld;
2630- if (!(fld= new Item_field(from_field)))
2631+ if (!(fld= new Item_field(thd, last_checked_context, from_field)))
2632 goto error;
2633 thd->change_item_tree(reference, fld);
2634 mark_as_dependent(thd, last_checked_context->select_lex,
2635
2636=== modified file 'Percona-Server/sql/log.cc'
2637--- Percona-Server/sql/log.cc 2012-05-09 04:14:12 +0000
2638+++ Percona-Server/sql/log.cc 2012-08-21 05:42:33 +0000
2639@@ -2517,7 +2517,10 @@
2640 {
2641 end= strxmov(buff, "# administrator command: ", NullS);
2642 buff_len= (ulong) (end - buff);
2643- my_b_write(&log_file, (uchar*) buff, buff_len);
2644+ DBUG_EXECUTE_IF("simulate_slow_log_write_error",
2645+ {DBUG_SET("+d,simulate_file_write_error");});
2646+ if(my_b_write(&log_file, (uchar*) buff, buff_len))
2647+ tmp_errno= errno;
2648 }
2649 if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) ||
2650 my_b_write(&log_file, (uchar*) ";\n",2) ||
2651
2652=== modified file 'Percona-Server/sql/log.h'
2653--- Percona-Server/sql/log.h 2011-11-24 01:59:48 +0000
2654+++ Percona-Server/sql/log.h 2012-08-21 05:42:33 +0000
2655@@ -1,5 +1,5 @@
2656 /*
2657- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2658+ Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
2659
2660 This program is free software; you can redistribute it and/or modify
2661 it under the terms of the GNU General Public License as published by
2662@@ -130,6 +130,11 @@
2663
2664 class Relay_log_info;
2665
2666+/*
2667+ Note that we destroy the lock mutex in the desctructor here.
2668+ This means that object instances cannot be destroyed/go out of scope,
2669+ until we have reset thd->current_linfo to NULL;
2670+ */
2671 typedef struct st_log_info
2672 {
2673 char log_file_name[FN_REFLEN];
2674@@ -289,8 +294,8 @@
2675 int new_file_impl(bool need_lock);
2676
2677 public:
2678- MYSQL_LOG::generate_name;
2679- MYSQL_LOG::is_open;
2680+ using MYSQL_LOG::generate_name;
2681+ using MYSQL_LOG::is_open;
2682
2683 /* This is relay log */
2684 bool is_relay_log;
2685
2686=== modified file 'Percona-Server/sql/log_event.cc'
2687--- Percona-Server/sql/log_event.cc 2012-05-24 21:26:46 +0000
2688+++ Percona-Server/sql/log_event.cc 2012-08-21 05:42:33 +0000
2689@@ -1122,7 +1122,7 @@
2690 Log_event *res= 0;
2691 #ifndef max_allowed_packet
2692 THD *thd=current_thd;
2693- uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
2694+ uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
2695 #endif
2696
2697 if (data_len > max_allowed_packet)
2698@@ -2885,23 +2885,40 @@
2699 pos= (const uchar*) end; // Break loop
2700 }
2701 }
2702-
2703+
2704+ /**
2705+ Layout for the data buffer is as follows
2706+ +--------+-----------+------+------+---------+----+-------+
2707+ | catlog | time_zone | user | host | db name | \0 | Query |
2708+ +--------+-----------+------+------+---------+----+-------+
2709+
2710+ To support the query cache we append the following buffer to the above
2711+ +-------+----------------------------------------+-------+
2712+ |db len | uninitiatlized space of size of db len | FLAGS |
2713+ +-------+----------------------------------------+-------+
2714+
2715+ The area of buffer starting from Query field all the way to the end belongs
2716+ to the Query buffer and its structure is described in alloc_query() in
2717+ sql_parse.cc
2718+ */
2719+
2720 #if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
2721- if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
2722- time_zone_len + 1 +
2723- data_len + 1 +
2724- QUERY_CACHE_FLAGS_SIZE +
2725- user.length + 1 +
2726- host.length + 1 +
2727- db_len + 1,
2728- MYF(MY_WME))))
2729+ if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
2730+ + time_zone_len + 1
2731+ + user.length + 1
2732+ + host.length + 1
2733+ + data_len + 1
2734+ + sizeof(size_t)//for db_len
2735+ + db_len + 1
2736+ + QUERY_CACHE_FLAGS_SIZE,
2737+ MYF(MY_WME))))
2738 #else
2739- if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
2740- time_zone_len + 1 +
2741- data_len + 1 +
2742- user.length + 1 +
2743- host.length + 1,
2744- MYF(MY_WME))))
2745+ if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
2746+ + time_zone_len + 1
2747+ + user.length + 1
2748+ + host.length + 1
2749+ + data_len + 1,
2750+ MYF(MY_WME))))
2751 #endif
2752 DBUG_VOID_RETURN;
2753 if (catalog_len) // If catalog is given
2754@@ -2941,6 +2958,14 @@
2755 db= (char *)start;
2756 query= (char *)(start + db_len + 1);
2757 q_len= data_len - db_len -1;
2758+ /**
2759+ Append the db length at the end of the buffer. This will be used by
2760+ Query_cache::send_result_to_client() in case the query cache is On.
2761+ */
2762+#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
2763+ size_t db_length= (size_t)db_len;
2764+ memcpy(start + data_len + 1, &db_length, sizeof(size_t));
2765+#endif
2766 DBUG_VOID_RETURN;
2767 }
2768
2769@@ -3122,6 +3147,12 @@
2770 {
2771 Write_on_release_cache cache(&print_event_info->head_cache, file);
2772
2773+ /**
2774+ reduce the size of io cache so that the write function is called
2775+ for every call to my_b_write().
2776+ */
2777+ DBUG_EXECUTE_IF ("simulate_file_write_error",
2778+ {(&cache)->write_pos= (&cache)->write_end- 500;});
2779 print_query_header(&cache, print_event_info);
2780 my_b_write(&cache, (uchar*) query, q_len);
2781 my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
2782@@ -5351,11 +5382,12 @@
2783 #endif
2784
2785
2786+#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
2787+
2788 /*
2789 Intvar_log_event::do_apply_event()
2790 */
2791
2792-#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
2793 int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
2794 {
2795 /*
2796@@ -5364,6 +5396,9 @@
2797 */
2798 const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
2799
2800+ if (rli->deferred_events_collecting)
2801+ return rli->deferred_events->add(this);
2802+
2803 switch (type) {
2804 case LAST_INSERT_ID_EVENT:
2805 thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
2806@@ -5469,6 +5504,9 @@
2807 */
2808 const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
2809
2810+ if (rli->deferred_events_collecting)
2811+ return rli->deferred_events->add(this);
2812+
2813 thd->rand.seed1= (ulong) seed1;
2814 thd->rand.seed2= (ulong) seed2;
2815 return 0;
2816@@ -5495,6 +5533,29 @@
2817 return continue_group(rli);
2818 }
2819
2820+/**
2821+ Exec deferred Int-, Rand- and User- var events prefixing
2822+ a Query-log-event event.
2823+
2824+ @param thd THD handle
2825+
2826+ @return false on success, true if a failure in an event applying occurred.
2827+*/
2828+bool slave_execute_deferred_events(THD *thd)
2829+{
2830+ bool res= false;
2831+ Relay_log_info *rli= thd->rli_slave;
2832+
2833+ DBUG_ASSERT(rli && (!rli->deferred_events_collecting || rli->deferred_events));
2834+
2835+ if (!rli->deferred_events_collecting || rli->deferred_events->is_empty())
2836+ return res;
2837+
2838+ res= rli->deferred_events->execute(rli);
2839+
2840+ return res;
2841+}
2842+
2843 #endif /* !MYSQL_CLIENT */
2844
2845
2846@@ -5673,6 +5734,9 @@
2847 User_var_log_event(const char* buf,
2848 const Format_description_log_event* description_event)
2849 :Log_event(buf, description_event)
2850+#ifndef MYSQL_CLIENT
2851+ , deferred(false)
2852+#endif
2853 {
2854 /* The Post-Header is empty. The Variable Data part begins immediately. */
2855 buf+= description_event->common_header_len +
2856@@ -5879,6 +5943,13 @@
2857 {
2858 Item *it= 0;
2859 CHARSET_INFO *charset;
2860+
2861+ if (rli->deferred_events_collecting)
2862+ {
2863+ set_deferred();
2864+ return rli->deferred_events->add(this);
2865+ }
2866+
2867 if (!(charset= get_charset(charset_number, MYF(MY_WME))))
2868 return 1;
2869 LEX_STRING user_var_name;
2870@@ -5929,7 +6000,8 @@
2871 return 0;
2872 }
2873 }
2874- Item_func_set_user_var e(user_var_name, it);
2875+
2876+ Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
2877 /*
2878 Item_func_set_user_var can't substitute something else on its place =>
2879 0 can be passed as last argument (reference on item)
2880@@ -5938,7 +6010,7 @@
2881 crash the server, so if fix fields fails, we just return with an
2882 error.
2883 */
2884- if (e.fix_fields(thd, 0))
2885+ if (e->fix_fields(thd, 0))
2886 return 1;
2887
2888 /*
2889@@ -5946,8 +6018,9 @@
2890 a single record and with a single column. Thus, like
2891 a column value, it could always have IMPLICIT derivation.
2892 */
2893- e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
2894- free_root(thd->mem_root,0);
2895+ e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
2896+ if (!is_deferred())
2897+ free_root(thd->mem_root,0);
2898
2899 return 0;
2900 }
2901@@ -6341,11 +6414,18 @@
2902 {
2903 Load_log_event::print(file, print_event_info,
2904 !check_fname_outside_temp_buf());
2905- /*
2906- That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
2907- SHOW BINLOG EVENTS we don't.
2908- */
2909- my_b_printf(&cache, "#");
2910+ /**
2911+ reduce the size of io cache so that the write function is called
2912+ for every call to my_b_printf().
2913+ */
2914+ DBUG_EXECUTE_IF ("simulate_create_event_write_error",
2915+ {(&cache)->write_pos= (&cache)->write_end;
2916+ DBUG_SET("+d,simulate_file_write_error");});
2917+ /*
2918+ That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
2919+ SHOW BINLOG EVENTS we don't.
2920+ */
2921+ my_b_printf(&cache, "#");
2922 }
2923
2924 my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len);
2925@@ -7021,6 +7101,13 @@
2926 Write_on_release_cache cache(&print_event_info->head_cache, file);
2927
2928 print_query_header(&cache, print_event_info);
2929+ /**
2930+ reduce the size of io cache so that the write function is called
2931+ for every call to my_b_printf().
2932+ */
2933+ DBUG_EXECUTE_IF ("simulate_execute_event_write_error",
2934+ {(&cache)->write_pos= (&cache)->write_end;
2935+ DBUG_SET("+d,simulate_file_write_error");});
2936
2937 if (local_fname)
2938 {
2939
2940=== modified file 'Percona-Server/sql/log_event.h'
2941--- Percona-Server/sql/log_event.h 2012-02-09 15:03:59 +0000
2942+++ Percona-Server/sql/log_event.h 2012-08-21 05:42:33 +0000
2943@@ -275,6 +275,13 @@
2944 MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
2945 NAME_LEN + 1)
2946
2947+/*
2948+ The new option is added to handle large packets that are sent from the master
2949+ to the slave. It is used to increase the thd(max_allowed) for both the
2950+ DUMP thread on the master and the SQL/IO thread on the slave.
2951+*/
2952+#define MAX_MAX_ALLOWED_PACKET 1024*1024*1024
2953+
2954 /*
2955 Event header offsets;
2956 these point to places inside the fixed header.
2957@@ -2494,11 +2501,13 @@
2958 uint charset_number;
2959 bool is_null;
2960 #ifndef MYSQL_CLIENT
2961+ bool deferred;
2962 User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
2963 char *val_arg, ulong val_len_arg, Item_result type_arg,
2964 uint charset_number_arg)
2965 :Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
2966- val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
2967+ val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
2968+ deferred(false)
2969 { is_null= !val; }
2970 void pack_info(Protocol* protocol);
2971 #else
2972@@ -2511,6 +2520,13 @@
2973 Log_event_type get_type_code() { return USER_VAR_EVENT;}
2974 #ifndef MYSQL_CLIENT
2975 bool write(IO_CACHE* file);
2976+ /*
2977+ Getter and setter for deferred User-event.
2978+ Returns true if the event is not applied directly
2979+ and which case the applier adjusts execution path.
2980+ */
2981+ bool is_deferred() { return deferred; }
2982+ void set_deferred() { deferred= val; }
2983 #endif
2984 bool is_valid() const { return 1; }
2985
2986@@ -3981,6 +3997,16 @@
2987 reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
2988 }
2989
2990+#ifndef MYSQL_CLIENT
2991+/**
2992+ The function is called by slave applier in case there are
2993+ active table filtering rules to force gathering events associated
2994+ with Query-log-event into an array to execute
2995+ them once the fate of the Query is determined for execution.
2996+*/
2997+bool slave_execute_deferred_events(THD *thd);
2998+#endif
2999+
3000 /**
3001 @} (end of group Replication)
3002 */
3003
3004=== added file 'Percona-Server/sql/mem_root_array.h'
3005--- Percona-Server/sql/mem_root_array.h 1970-01-01 00:00:00 +0000
3006+++ Percona-Server/sql/mem_root_array.h 2012-08-21 05:42:33 +0000
3007@@ -0,0 +1,175 @@
3008+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3009+
3010+ This program is free software; you can redistribute it and/or modify
3011+ it under the terms of the GNU General Public License as published by
3012+ the Free Software Foundation; version 2 of the License.
3013+
3014+ This program is distributed in the hope that it will be useful,
3015+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3016+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3017+ GNU General Public License for more details.
3018+
3019+ You should have received a copy of the GNU General Public License
3020+ along with this program; if not, write to the Free Software
3021+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
3022+
3023+
3024+#ifndef MEM_ROOT_ARRAY_INCLUDED
3025+#define MEM_ROOT_ARRAY_INCLUDED
3026+
3027+#include <my_alloc.h>
3028+
3029+/**
3030+ A typesafe replacement for DYNAMIC_ARRAY.
3031+ We use MEM_ROOT for allocating storage, rather than the C++ heap.
3032+ The interface is chosen to be similar to std::vector.
3033+
3034+ @remark
3035+ Unlike DYNAMIC_ARRAY, elements are properly copied
3036+ (rather than memcpy()d) if the underlying array needs to be expanded.
3037+
3038+ @remark
3039+ Depending on has_trivial_destructor, we destroy objects which are
3040+ removed from the array (including when the array object itself is destroyed).
3041+
3042+ @remark
3043+ Note that MEM_ROOT has no facility for reusing free space,
3044+ so don't use this if multiple re-expansions are likely to happen.
3045+
3046+ @param Element_type The type of the elements of the container.
3047+ Elements must be copyable.
3048+ @param has_trivial_destructor If true, we don't destroy elements.
3049+ We could have used type traits to determine this.
3050+ __has_trivial_destructor is supported by some (but not all)
3051+ compilers we use.
3052+*/
3053+template<typename Element_type, bool has_trivial_destructor>
3054+class Mem_root_array
3055+{
3056+public:
3057+ Mem_root_array(MEM_ROOT *root)
3058+ : m_root(root), m_array(NULL), m_size(0), m_capacity(0)
3059+ {
3060+ DBUG_ASSERT(m_root != NULL);
3061+ }
3062+
3063+ ~Mem_root_array()
3064+ {
3065+ clear();
3066+ }
3067+
3068+ Element_type &at(size_t n)
3069+ {
3070+ DBUG_ASSERT(n < size());
3071+ return m_array[n];
3072+ }
3073+
3074+ const Element_type &at(size_t n) const
3075+ {
3076+ DBUG_ASSERT(n < size());
3077+ return m_array[n];
3078+ }
3079+
3080+ // Returns a pointer to the first element in the array.
3081+ Element_type *begin() { return &m_array[0]; }
3082+
3083+ // Returns a pointer to the past-the-end element in the array.
3084+ Element_type *end() { return &m_array[size()]; }
3085+
3086+ // Erases all of the elements.
3087+ void clear()
3088+ {
3089+ if (!empty())
3090+ chop(0);
3091+ }
3092+
3093+ /*
3094+ Chops the tail off the array, erasing all tail elements.
3095+ @param pos Index of first element to erase.
3096+ */
3097+ void chop(const size_t pos)
3098+ {
3099+ DBUG_ASSERT(pos < m_size);
3100+ if (!has_trivial_destructor)
3101+ {
3102+ for (size_t ix= pos; ix < m_size; ++ix)
3103+ {
3104+ Element_type *p= &m_array[ix];
3105+ p->~Element_type(); // Destroy discarded element.
3106+ }
3107+ }
3108+ m_size= pos;
3109+ }
3110+
3111+ /*
3112+ Reserves space for array elements.
3113+ Copies over existing elements, in case we are re-expanding the array.
3114+
3115+ @param n number of elements.
3116+ @retval true if out-of-memory, false otherwise.
3117+ */
3118+ bool reserve(size_t n)
3119+ {
3120+ if (n <= m_capacity)
3121+ return false;
3122+
3123+ void *mem= alloc_root(m_root, n * element_size());
3124+ if (!mem)
3125+ return true;
3126+ Element_type *array= static_cast<Element_type*>(mem);
3127+
3128+ // Copy all the existing elements into the new array.
3129+ for (size_t ix= 0; ix < m_size; ++ix)
3130+ {
3131+ Element_type *new_p= &array[ix];
3132+ Element_type *old_p= &m_array[ix];
3133+ new (new_p) Element_type(*old_p); // Copy into new location.
3134+ if (!has_trivial_destructor)
3135+ old_p->~Element_type(); // Destroy the old element.
3136+ }
3137+
3138+ // Forget the old array.
3139+ m_array= array;
3140+ m_capacity= n;
3141+ return false;
3142+ }
3143+
3144+ /*
3145+ Adds a new element at the end of the array, after its current last
3146+ element. The content of this new element is initialized to a copy of
3147+ the input argument.
3148+
3149+ @param element Object to copy.
3150+ @retval true if out-of-memory, false otherwise.
3151+ */
3152+ bool push_back(const Element_type &element)
3153+ {
3154+ const size_t min_capacity= 20;
3155+ const size_t expansion_factor= 2;
3156+ if (0 == m_capacity && reserve(min_capacity))
3157+ return true;
3158+ if (m_size == m_capacity && reserve(m_capacity * expansion_factor))
3159+ return true;
3160+ Element_type *p= &m_array[m_size++];
3161+ new (p) Element_type(element);
3162+ return false;
3163+ }
3164+
3165+ size_t capacity() const { return m_capacity; }
3166+ size_t element_size() const { return sizeof(Element_type); }
3167+ bool empty() const { return size() == 0; }
3168+ size_t size() const { return m_size; }
3169+
3170+private:
3171+ MEM_ROOT *const m_root;
3172+ Element_type *m_array;
3173+ size_t m_size;
3174+ size_t m_capacity;
3175+
3176+ // Not (yet) implemented.
3177+ Mem_root_array(const Mem_root_array&);
3178+ Mem_root_array &operator=(const Mem_root_array&);
3179+};
3180+
3181+
3182+#endif // MEM_ROOT_ARRAY_INCLUDED
3183
3184=== modified file 'Percona-Server/sql/mysql_priv.h'
3185--- Percona-Server/sql/mysql_priv.h 2012-05-09 04:14:12 +0000
3186+++ Percona-Server/sql/mysql_priv.h 2012-08-21 05:42:33 +0000
3187@@ -2062,6 +2062,7 @@
3188 extern ulonglong denied_connections;
3189 extern ulong what_to_log,flush_time;
3190 extern ulong query_buff_size;
3191+extern ulong slave_max_allowed_packet;
3192 extern ulong max_prepared_stmt_count, prepared_stmt_count;
3193 extern ulong binlog_cache_size, open_files_limit;
3194 extern ulonglong max_binlog_cache_size;
3195
3196=== modified file 'Percona-Server/sql/mysqld.cc'
3197--- Percona-Server/sql/mysqld.cc 2012-05-09 04:14:12 +0000
3198+++ Percona-Server/sql/mysqld.cc 2012-08-21 05:42:33 +0000
3199@@ -1,4 +1,4 @@
3200-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3201+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3202
3203 This program is free software; you can redistribute it and/or modify
3204 it under the terms of the GNU General Public License as published by
3205@@ -28,6 +28,7 @@
3206 #include "mysys_err.h"
3207 #include "events.h"
3208 #include "debug_sync.h"
3209+#include "log_event.h"
3210
3211 #include "../storage/myisam/ha_myisam.h"
3212
3213@@ -601,6 +602,7 @@
3214 ulong thread_cache_size=0, thread_pool_size= 0;
3215 ulong binlog_cache_size=0;
3216 ulonglong max_binlog_cache_size=0;
3217+ulong slave_max_allowed_packet= 0;
3218 ulong query_cache_size=0;
3219 ulong refresh_version; /* Increments on each reload */
3220 query_id_t global_query_id;
3221@@ -5801,6 +5803,7 @@
3222 OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
3223 OPT_LONG_QUERY_TIME,
3224 OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
3225+ OPT_SLAVE_MAX_ALLOWED_PACKET,
3226 OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
3227 OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
3228 OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE,
3229@@ -7030,10 +7033,14 @@
3230 &global_system_variables.max_allowed_packet,
3231 &max_system_variables.max_allowed_packet, 0, GET_ULONG,
3232 REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3233+ {"slave_max_allowed_packet", OPT_SLAVE_MAX_ALLOWED_PACKET,
3234+ "The maximum packet length to sent successfully from the master to slave.",
3235+ &slave_max_allowed_packet, &slave_max_allowed_packet, 0, GET_ULONG,
3236+ REQUIRED_ARG, MAX_MAX_ALLOWED_PACKET, 1024, MAX_MAX_ALLOWED_PACKET, MALLOC_OVERHEAD, 1024, 0},
3237 {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3238 "Can be used to restrict the total size used to cache a multi-transaction query.",
3239 &max_binlog_cache_size, &max_binlog_cache_size, 0,
3240- GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
3241+ GET_ULL, REQUIRED_ARG, (longlong) ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
3242 {"max_binlog_size", OPT_MAX_BINLOG_SIZE,
3243 "Binary log will be rotated automatically when the size exceeds this "
3244 "value. Will also apply to relay logs if max_relay_log_size is 0. "
3245@@ -7071,7 +7078,7 @@
3246 "Joins that are probably going to read more than max_join_size records return an error.",
3247 &global_system_variables.max_join_size,
3248 &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
3249- HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
3250+ (longlong) HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
3251 {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
3252 "Max number of bytes in sorted records.",
3253 &global_system_variables.max_length_for_sort_data,
3254@@ -7098,7 +7105,7 @@
3255 "Limit assumed max number of seeks when looking up rows based on a key.",
3256 &global_system_variables.max_seeks_for_key,
3257 &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
3258- REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
3259+ REQUIRED_ARG, (longlong) ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
3260 {"max_sort_length", OPT_MAX_SORT_LENGTH,
3261 "The number of bytes to use when sorting BLOB or TEXT values (only the "
3262 "first max_sort_length bytes of each value are used; the rest are ignored).",
3263@@ -7122,7 +7129,7 @@
3264 {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
3265 "After this many write locks, allow some read locks to run in between.",
3266 &max_write_lock_count, &max_write_lock_count, 0, GET_ULONG,
3267- REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
3268+ REQUIRED_ARG, (longlong) ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
3269 {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
3270 "Don't log queries which examine less than min_examined_row_limit rows to file.",
3271 &global_system_variables.min_examined_row_limit,
3272@@ -7149,18 +7156,19 @@
3273 &global_system_variables.myisam_max_extra_sort_file_size,
3274 &max_system_variables.myisam_max_extra_sort_file_size,
3275 0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32,
3276- 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
3277+ 0, MAX_FILE_SIZE, 0, 1, 0},
3278 {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
3279 "Don't use the fast sort index method to created index if the temporary "
3280 "file would get bigger than this.",
3281 &global_system_variables.myisam_max_sort_file_size,
3282 &max_system_variables.myisam_max_sort_file_size, 0,
3283- GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
3284+ GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, MAX_FILE_SIZE,
3285 0, 1024*1024, 0},
3286 {"myisam_mmap_size", OPT_MYISAM_MMAP_SIZE,
3287 "Can be used to restrict the total memory used for memory mmaping of myisam files",
3288 &myisam_mmap_size, &myisam_mmap_size, 0,
3289- GET_ULL, REQUIRED_ARG, SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX, 0, 1, 0},
3290+ GET_ULL, REQUIRED_ARG, (longlong) SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX,
3291+ 0, 1, 0},
3292 {"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
3293 "Specifies whether several threads should be used when repairing MyISAM "
3294 "tables. For values > 1, one thread is used per index. The value of 1 "
3295@@ -7173,7 +7181,7 @@
3296 "or when creating indexes with CREATE INDEX or ALTER TABLE.",
3297 &global_system_variables.myisam_sort_buff_size,
3298 &max_system_variables.myisam_sort_buff_size, 0,
3299- GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, ~0L, 0, 1, 0},
3300+ GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, ~0ULL, 0, 1, 0},
3301 {"myisam_use_mmap", OPT_MYISAM_USE_MMAP,
3302 "Use memory mapping for reading and writing MyISAM tables.",
3303 &opt_myisam_use_mmap, &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG,
3304@@ -7295,7 +7303,7 @@
3305 {"query_cache_size", OPT_QUERY_CACHE_SIZE,
3306 "The memory allocated to store results from old queries.",
3307 &query_cache_size, &query_cache_size, 0, GET_ULONG,
3308- REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
3309+ REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1024, 0},
3310 #ifdef HAVE_QUERY_CACHE
3311 {"query_cache_type", OPT_QUERY_CACHE_TYPE,
3312 "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results "
3313@@ -7357,7 +7365,7 @@
3314 "Maximum space to use for all relay logs.",
3315 &relay_log_space_limit,
3316 &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
3317- (longlong) ULONG_MAX, 0, 1, 0},
3318+ ULONG_MAX, 0, 1, 0},
3319 {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
3320 "Use compression on master/slave protocol.",
3321 &opt_slave_compressed_protocol,
3322@@ -7372,7 +7380,7 @@
3323 "it failed with a deadlock or elapsed lock wait timeout, "
3324 "before giving up and stopping.",
3325 &slave_trans_retries, &slave_trans_retries, 0,
3326- GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0},
3327+ GET_ULONG, REQUIRED_ARG, 10L, 0L, ULONG_MAX, 0, 1, 0},
3328 #endif /* HAVE_REPLICATION */
3329 {"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
3330 "If creating the thread takes longer than this value (in seconds), "
3331@@ -7383,7 +7391,7 @@
3332 "Each thread that needs to do a sort allocates a buffer of this size.",
3333 &global_system_variables.sortbuff_size,
3334 &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3335- MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0L, MALLOC_OVERHEAD,
3336+ MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0ULL, MALLOC_OVERHEAD,
3337 1, 0},
3338 {"sync-binlog", OPT_SYNC_BINLOG,
3339 "Synchronously flush binary log to disk after every #th event. "
3340
3341=== modified file 'Percona-Server/sql/protocol.cc'
3342--- Percona-Server/sql/protocol.cc 2012-02-15 16:21:38 +0000
3343+++ Percona-Server/sql/protocol.cc 2012-08-21 05:42:33 +0000
3344@@ -1,4 +1,4 @@
3345-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3346+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3347
3348 This program is free software; you can redistribute it and/or modify
3349 it under the terms of the GNU General Public License as published by
3350@@ -620,6 +620,8 @@
3351 /* Store fixed length fields */
3352 pos= (char*) local_packet->ptr()+local_packet->length();
3353 *pos++= 12; // Length of packed fields
3354+ /* inject a NULL to test the client */
3355+ DBUG_EXECUTE_IF("poison_rs_fields", pos[-1]= 0xfb;);
3356 if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
3357 {
3358 /* No conversion */
3359
3360=== modified file 'Percona-Server/sql/records.cc'
3361--- Percona-Server/sql/records.cc 2011-06-30 15:37:13 +0000
3362+++ Percona-Server/sql/records.cc 2012-08-21 05:42:33 +0000
3363@@ -631,7 +631,7 @@
3364 if (a[4] != b[4])
3365 return (int) a[4] - (int) b[4];
3366 if (a[5] != b[5])
3367- return (int) a[1] - (int) b[5];
3368+ return (int) a[5] - (int) b[5];
3369 if (a[6] != b[6])
3370 return (int) a[6] - (int) b[6];
3371 return (int) a[7] - (int) b[7];
3372
3373=== modified file 'Percona-Server/sql/rpl_rli.cc'
3374--- Percona-Server/sql/rpl_rli.cc 2011-06-30 15:37:13 +0000
3375+++ Percona-Server/sql/rpl_rli.cc 2012-08-21 05:42:33 +0000
3376@@ -45,7 +45,9 @@
3377 inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
3378 until_log_pos(0), retried_trans(0),
3379 tables_to_lock(0), tables_to_lock_count(0),
3380- last_event_start_time(0), m_flags(0)
3381+ last_event_start_time(0),
3382+ deferred_events(NULL),
3383+ m_flags(0)
3384 {
3385 DBUG_ENTER("Relay_log_info::Relay_log_info");
3386
3387
3388=== modified file 'Percona-Server/sql/rpl_rli.h'
3389--- Percona-Server/sql/rpl_rli.h 2012-03-12 12:28:27 +0000
3390+++ Percona-Server/sql/rpl_rli.h 2012-08-21 05:42:33 +0000
3391@@ -369,6 +369,41 @@
3392 */
3393 time_t last_event_start_time;
3394
3395+ /*
3396+ A container to hold on Intvar-, Rand-, Uservar- log-events in case
3397+ the slave is configured with table filtering rules.
3398+ The withhold events are executed when their parent Query destiny is
3399+ determined for execution as well.
3400+ */
3401+ Deferred_log_events *deferred_events;
3402+
3403+ /*
3404+ State of the container: true stands for IRU events gathering,
3405+ false does for execution, either deferred or direct.
3406+ */
3407+ bool deferred_events_collecting;
3408+
3409+ /*
3410+ Returns true if the argument event resides in the containter;
3411+ more specifically, the checking is done against the last added event.
3412+ */
3413+ bool is_deferred_event(Log_event * ev)
3414+ {
3415+ return deferred_events_collecting ? deferred_events->is_last(ev) : false;
3416+ };
3417+ /* The general cleanup that slave applier may need at the end of query. */
3418+ inline void cleanup_after_query()
3419+ {
3420+ if (deferred_events)
3421+ deferred_events->rewind();
3422+ };
3423+ /* The general cleanup that slave applier may need at the end of session. */
3424+ void cleanup_after_session()
3425+ {
3426+ if (deferred_events)
3427+ delete deferred_events;
3428+ };
3429+
3430 /**
3431 Helper function to do after statement completion.
3432
3433
3434=== modified file 'Percona-Server/sql/rpl_utility.cc'
3435--- Percona-Server/sql/rpl_utility.cc 2011-06-30 15:37:13 +0000
3436+++ Percona-Server/sql/rpl_utility.cc 2012-08-21 05:42:33 +0000
3437@@ -226,3 +226,64 @@
3438
3439 return error;
3440 }
3441+
3442+#ifndef MYSQL_CLIENT
3443+Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
3444+{
3445+ my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16);
3446+}
3447+
3448+Deferred_log_events::~Deferred_log_events()
3449+{
3450+ delete_dynamic(&array);
3451+}
3452+
3453+int Deferred_log_events::add(Log_event *ev)
3454+{
3455+ last_added= ev;
3456+ insert_dynamic(&array, (uchar*) &ev);
3457+ return 0;
3458+}
3459+
3460+bool Deferred_log_events::is_empty()
3461+{
3462+ return array.elements == 0;
3463+}
3464+
3465+bool Deferred_log_events::execute(Relay_log_info *rli)
3466+{
3467+ bool res= false;
3468+
3469+ DBUG_ASSERT(rli->deferred_events_collecting);
3470+
3471+ rli->deferred_events_collecting= false;
3472+ for (uint i= 0; !res && i < array.elements; i++)
3473+ {
3474+ Log_event *ev= (* (Log_event **)
3475+ dynamic_array_ptr(&array, i));
3476+ res= ev->apply_event(rli);
3477+ }
3478+ rli->deferred_events_collecting= true;
3479+ return res;
3480+}
3481+
3482+void Deferred_log_events::rewind()
3483+{
3484+ /*
3485+ Reset preceeding Query log event events which execution was
3486+ deferred because of slave side filtering.
3487+ */
3488+ if (!is_empty())
3489+ {
3490+ for (uint i= 0; i < array.elements; i++)
3491+ {
3492+ Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
3493+ delete ev;
3494+ }
3495+ if (array.elements > array.max_element)
3496+ freeze_size(&array);
3497+ reset_dynamic(&array);
3498+ }
3499+}
3500+
3501+#endif
3502
3503=== modified file 'Percona-Server/sql/rpl_utility.h'
3504--- Percona-Server/sql/rpl_utility.h 2011-06-30 15:37:13 +0000
3505+++ Percona-Server/sql/rpl_utility.h 2012-08-21 05:42:33 +0000
3506@@ -290,6 +290,24 @@
3507 };
3508
3509 }
3510+
3511+class Deferred_log_events
3512+{
3513+private:
3514+ DYNAMIC_ARRAY array;
3515+ Log_event *last_added;
3516+
3517+public:
3518+ Deferred_log_events(Relay_log_info *rli);
3519+ ~Deferred_log_events();
3520+ /* queue for exection at Query-log-event time prior the Query */
3521+ int add(Log_event *ev);
3522+ bool is_empty();
3523+ bool execute(Relay_log_info *rli);
3524+ void rewind();
3525+ bool is_last(Log_event *ev) { return ev == last_added; };
3526+};
3527+
3528 #endif
3529
3530 // NB. number of printed bit values is limited to sizeof(buf) - 1
3531
3532=== modified file 'Percona-Server/sql/set_var.cc'
3533--- Percona-Server/sql/set_var.cc 2012-01-30 04:30:33 +0000
3534+++ Percona-Server/sql/set_var.cc 2012-08-21 05:42:33 +0000
3535@@ -436,6 +436,8 @@
3536 static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
3537 &SV::max_allowed_packet,
3538 check_max_allowed_packet);
3539+static sys_var_long_ptr sys_slave_max_allowed_packet(&vars, "slave_max_allowed_packet",
3540+ &slave_max_allowed_packet);
3541 static sys_var_ulonglong_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
3542 &max_binlog_cache_size);
3543 static sys_var_long_ptr sys_max_binlog_size(&vars, "max_binlog_size",
3544
3545=== modified file 'Percona-Server/sql/slave.cc'
3546--- Percona-Server/sql/slave.cc 2012-05-09 04:14:12 +0000
3547+++ Percona-Server/sql/slave.cc 2012-08-21 05:42:33 +0000
3548@@ -515,7 +515,7 @@
3549 int error;
3550 DBUG_PRINT("loop", ("killing slave thread"));
3551
3552- pthread_mutex_lock(&thd->LOCK_thd_data);
3553+ pthread_mutex_lock(&thd->LOCK_thd_kill);
3554 #ifndef DONT_USE_THR_ALARM
3555 /*
3556 Error codes from pthread_kill are:
3557@@ -526,7 +526,7 @@
3558 DBUG_ASSERT(err != EINVAL);
3559 #endif
3560 thd->awake(THD::NOT_KILLED);
3561- pthread_mutex_unlock(&thd->LOCK_thd_data);
3562+ pthread_mutex_unlock(&thd->LOCK_thd_kill);
3563
3564 /*
3565 There is a small chance that slave thread might miss the first
3566@@ -1891,8 +1891,7 @@
3567 slave threads, since a replication event can become this much larger
3568 than the corresponding packet (query) sent from client to master.
3569 */
3570- thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
3571- + MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
3572+ thd->variables.max_allowed_packet= slave_max_allowed_packet;
3573 thd->slave_thread = 1;
3574 thd->enable_slow_log= opt_log_slow_slave_statements;
3575 thd->write_to_slow_log= opt_log_slow_slave_statements;
3576@@ -2368,7 +2367,8 @@
3577 used to read info about the relay log's format; it will be deleted when
3578 the SQL thread does not need it, i.e. when this thread terminates.
3579 */
3580- if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
3581+ if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT &&
3582+ !rli->is_deferred_event(ev))
3583 {
3584 DBUG_PRINT("info", ("Deleting the event after it has been executed"));
3585 delete ev;
3586@@ -2637,6 +2637,7 @@
3587 thread, since a replication event can become this much larger than
3588 the corresponding packet (query) sent from client to master.
3589 */
3590+ thd->net.max_packet_size= slave_max_allowed_packet;
3591 mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
3592 }
3593 else
3594@@ -2768,12 +2769,12 @@
3595 switch (mysql_error_number) {
3596 case CR_NET_PACKET_TOO_LARGE:
3597 sql_print_error("\
3598-Log entry on master is longer than max_allowed_packet (%ld) on \
3599+Log entry on master is longer than slave_max_allowed_packet (%lu) on \
3600 slave. If the entry is correct, restart the server with a higher value of \
3601-max_allowed_packet",
3602- thd->variables.max_allowed_packet);
3603+slave_max_allowed_packet",
3604+ slave_max_allowed_packet);
3605 mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
3606- "%s", ER(ER_NET_PACKET_TOO_LARGE));
3607+ "%s", "Got a packet bigger than 'slave_max_allowed_packet' bytes");
3608 goto err;
3609 case ER_MASTER_FATAL_ERROR_READING_BINLOG:
3610 mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
3611@@ -2998,6 +2999,12 @@
3612 goto err;
3613 }
3614 thd->init_for_queries();
3615+ thd->rli_slave= rli;
3616+ if ((rli->deferred_events_collecting= rpl_filter->is_on()))
3617+ {
3618+ rli->deferred_events= new Deferred_log_events(rli);
3619+ }
3620+
3621 thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
3622 set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
3623 pthread_mutex_lock(&LOCK_thread_count);
3624
3625=== modified file 'Percona-Server/sql/sql_base.cc'
3626--- Percona-Server/sql/sql_base.cc 2011-11-24 16:33:30 +0000
3627+++ Percona-Server/sql/sql_base.cc 2012-08-21 05:42:33 +0000
3628@@ -116,6 +116,8 @@
3629 bool send_refresh);
3630 static bool
3631 has_write_table_with_auto_increment(TABLE_LIST *tables);
3632+static bool
3633+has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables);
3634
3635
3636 extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
3637@@ -2225,6 +2227,8 @@
3638 */
3639
3640 pthread_mutex_unlock(mutex);
3641+ DEBUG_SYNC(thd, "waiting_for_table_unlock");
3642+ DBUG_EXECUTE_IF("sleep_after_waiting_for_table", my_sleep(1000000););
3643 pthread_mutex_lock(&thd->mysys_var->mutex);
3644 thd->mysys_var->current_mutex= 0;
3645 thd->mysys_var->current_cond= 0;
3646@@ -5495,6 +5499,12 @@
3647 *(ptr++)= table->table;
3648 }
3649
3650+ if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables)
3651+ {
3652+ if (has_write_table_auto_increment_not_first_in_pk(tables))
3653+ thd->lex->set_stmt_unsafe();
3654+ }
3655+
3656 /* We have to emulate LOCK TABLES if we are statement needs prelocking. */
3657 if (thd->lex->requires_prelocking())
3658 {
3659@@ -9091,6 +9101,32 @@
3660 return 0;
3661 }
3662
3663+/*
3664+ Tells if there is a table whose auto_increment column is a part
3665+ of a compound primary key while is not the first column in
3666+ the table definition.
3667+
3668+ @param tables Table list
3669+
3670+ @return true if the table exists, fais if does not.
3671+*/
3672+
3673+static bool
3674+has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables)
3675+{
3676+ for (TABLE_LIST *table= tables; table; table= table->next_global)
3677+ {
3678+ /* we must do preliminary checks as table->table may be NULL */
3679+ if (!table->placeholder() &&
3680+ table->table->found_next_number_field &&
3681+ (table->lock_type >= TL_WRITE_ALLOW_WRITE)
3682+ && table->table->s->next_number_keypart != 0)
3683+ return 1;
3684+ }
3685+
3686+ return 0;
3687+}
3688+
3689
3690 /*
3691 Open and lock system tables for read.
3692
3693=== modified file 'Percona-Server/sql/sql_class.cc'
3694--- Percona-Server/sql/sql_class.cc 2012-04-02 02:09:15 +0000
3695+++ Percona-Server/sql/sql_class.cc 2012-08-21 05:42:33 +0000
3696@@ -396,6 +396,7 @@
3697 char *thd_security_context(THD *thd, char *buffer, unsigned int length,
3698 unsigned int max_query_len)
3699 {
3700+ DEBUG_SYNC(thd, "thd_security_context");
3701 String str(buffer, length, &my_charset_latin1);
3702 const Security_context *sctx= &thd->main_security_ctx;
3703 char header[64];
3704@@ -486,9 +487,9 @@
3705 extern "C"
3706 void thd_kill(THD* thd)
3707 {
3708- pthread_mutex_lock(&thd->LOCK_thd_data);
3709+ pthread_mutex_lock(&thd->LOCK_thd_kill);
3710 thd->awake(THD::KILL_CONNECTION);
3711- pthread_mutex_unlock(&thd->LOCK_thd_data);
3712+ pthread_mutex_unlock(&thd->LOCK_thd_kill);
3713 }
3714
3715 /**
3716@@ -652,7 +653,7 @@
3717 THD::THD()
3718 :Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
3719 /* statement id */ 0),
3720- Open_tables_state(refresh_version), rli_fake(0),
3721+ Open_tables_state(refresh_version), rli_fake(NULL), rli_slave(NULL),
3722 lock_id(&main_lock_id),
3723 user_time(0), in_sub_stmt(0),
3724 sql_log_bin_toplevel(false),
3725@@ -754,6 +755,7 @@
3726 #endif
3727 pthread_mutex_init(&LOCK_thd_data, MY_MUTEX_INIT_FAST);
3728 pthread_mutex_init(&LOCK_temporary_tables, MY_MUTEX_INIT_FAST);
3729+ pthread_mutex_init(&LOCK_thd_kill, MY_MUTEX_INIT_FAST);
3730
3731 /* Variables with default values */
3732 proc_info="login";
3733@@ -1141,6 +1143,8 @@
3734 /* Ensure that no one is using THD */
3735 pthread_mutex_lock(&LOCK_thd_data);
3736 pthread_mutex_unlock(&LOCK_thd_data);
3737+ pthread_mutex_lock(&LOCK_thd_kill);
3738+ pthread_mutex_unlock(&LOCK_thd_kill);
3739 add_to_status(&global_status_var, &status_var);
3740
3741 /* Close connection */
3742@@ -1169,6 +1173,7 @@
3743 mysys_var=0; // Safety (shouldn't be needed)
3744 pthread_mutex_destroy(&LOCK_thd_data);
3745 pthread_mutex_destroy(&LOCK_temporary_tables);
3746+ pthread_mutex_destroy(&LOCK_thd_kill);
3747 #ifndef DBUG_OFF
3748 dbug_sentry= THD_SENTRY_GONE;
3749 #endif
3750@@ -1178,6 +1183,8 @@
3751 delete rli_fake;
3752 rli_fake= NULL;
3753 }
3754+ if (rli_slave)
3755+ rli_slave->cleanup_after_session();
3756 #endif
3757
3758 free_root(&main_mem_root, MYF(0));
3759@@ -1245,9 +1252,11 @@
3760 void THD::awake(THD::killed_state state_to_set)
3761 {
3762 DBUG_ENTER("THD::awake");
3763- DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
3764+ DBUG_PRINT("enter", ("this: 0x%lx thread_id=%lu killed_state=%d",
3765+ (long) this, thread_id, state_to_set));
3766 THD_CHECK_SENTRY(this);
3767- safe_mutex_assert_owner(&LOCK_thd_data);
3768+ safe_mutex_assert_not_owner(&LOCK_thd_data);
3769+ safe_mutex_assert_owner(&LOCK_thd_kill);
3770
3771 killed= state_to_set;
3772 if (state_to_set != THD::KILL_QUERY)
3773@@ -1268,7 +1277,9 @@
3774 hack is not used.
3775 */
3776
3777+ pthread_mutex_lock(&LOCK_thd_data);
3778 close_active_vio();
3779+ pthread_mutex_unlock(&LOCK_thd_data);
3780 }
3781 #endif
3782 }
3783@@ -1410,6 +1421,10 @@
3784 /* reset table map for multi-table update */
3785 table_map_for_update= 0;
3786 m_binlog_invoker= FALSE;
3787+#ifndef EMBEDDED_LIBRARY
3788+ if (rli_slave)
3789+ rli_slave->cleanup_after_query();
3790+#endif
3791 }
3792
3793
3794
3795=== modified file 'Percona-Server/sql/sql_class.h'
3796--- Percona-Server/sql/sql_class.h 2012-01-30 04:30:33 +0000
3797+++ Percona-Server/sql/sql_class.h 2012-08-21 05:42:33 +0000
3798@@ -1342,6 +1342,8 @@
3799 public:
3800 /* Used to execute base64 coded binlog events in MySQL server */
3801 Relay_log_info* rli_fake;
3802+ /* Slave applier execution context */
3803+ Relay_log_info* rli_slave;
3804
3805 /*
3806 Constant for THD::where initialization in the beginning of every query.
3807@@ -1391,11 +1393,23 @@
3808 Protects THD data accessed from other threads:
3809 - thd->query and thd->query_length (used by SHOW ENGINE
3810 INNODB STATUS and SHOW PROCESSLIST
3811- - thd->mysys_var (used by KILL statement and shutdown).
3812- Is locked when THD is deleted.
3813 */
3814 pthread_mutex_t LOCK_thd_data;
3815
3816+ /**
3817+ - Protects thd->mysys_var (used during KILL statement and shutdown).
3818+ - Is Locked when THD is deleted.
3819+
3820+ Note: This responsibility was earlier handled by LOCK_thd_data.
3821+ This lock is introduced to solve a deadlock issue waiting for
3822+ LOCK_thd_data. As this lock reduces responsibility of LOCK_thd_data
3823+ the deadlock issues is solved.
3824+ Caution: LOCK_thd_kill should not be taken while holding LOCK_thd_data.
3825+ THD::awake() currently takes LOCK_thd_data after holding
3826+ LOCK_thd_kill.
3827+ */
3828+ pthread_mutex_t LOCK_thd_kill;
3829+
3830 /* all prepared statements and cursors of this connection */
3831 Statement_map stmt_map;
3832 /*
3833@@ -2249,7 +2263,6 @@
3834 void add_changed_table(const char *key, long key_length);
3835 CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
3836 int send_explain_fields(select_result *result);
3837-#ifndef EMBEDDED_LIBRARY
3838 /**
3839 Clear the current error, if any.
3840 We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
3841@@ -2265,9 +2278,9 @@
3842 is_slave_error= 0;
3843 DBUG_VOID_RETURN;
3844 }
3845+#ifndef EMBEDDED_LIBRARY
3846 inline bool vio_ok() const { return net.vio != 0; }
3847 #else
3848- void clear_error();
3849 inline bool vio_ok() const { return true; }
3850 #endif
3851 /**
3852
3853=== modified file 'Percona-Server/sql/sql_lex.cc'
3854--- Percona-Server/sql/sql_lex.cc 2011-11-24 02:01:33 +0000
3855+++ Percona-Server/sql/sql_lex.cc 2012-08-21 05:42:33 +0000
3856@@ -305,6 +305,8 @@
3857 lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
3858 lex->select_lex.init_order();
3859 lex->select_lex.group_list.empty();
3860+ if (lex->select_lex.group_list_ptrs)
3861+ lex->select_lex.group_list_ptrs->clear();
3862 lex->describe= 0;
3863 lex->subqueries= FALSE;
3864 lex->context_analysis_only= 0;
3865@@ -1637,6 +1639,8 @@
3866 {
3867 st_select_lex_node::init_select();
3868 group_list.empty();
3869+ if (group_list_ptrs)
3870+ group_list_ptrs->clear();
3871 type= db= 0;
3872 having= 0;
3873 table_join_options= 0;
3874@@ -2906,6 +2910,8 @@
3875 The passed WHERE and HAVING are to be saved for the future executions.
3876 This function saves it, and returns a copy which can be thrashed during
3877 this execution of the statement. By saving/thrashing here we mean only
3878+ We also save the chain of ORDER::next in group_list, in case
3879+ the list is modified by remove_const().
3880 AND/OR trees.
3881 The function also calls fix_prepare_info_in_table_list that saves all
3882 ON expressions.
3883@@ -2917,6 +2923,19 @@
3884 if (!thd->stmt_arena->is_conventional() && first_execution)
3885 {
3886 first_execution= 0;
3887+ if (group_list.first)
3888+ {
3889+ if (!group_list_ptrs)
3890+ {
3891+ void *mem= thd->stmt_arena->alloc(sizeof(Group_list_ptrs));
3892+ group_list_ptrs= new (mem) Group_list_ptrs(thd->stmt_arena->mem_root);
3893+ }
3894+ group_list_ptrs->reserve(group_list.elements);
3895+ for (ORDER *order= group_list.first; order; order= order->next)
3896+ {
3897+ group_list_ptrs->push_back(order);
3898+ }
3899+ }
3900 if (*conds)
3901 {
3902 prep_where= *conds;
3903@@ -3021,3 +3040,6 @@
3904 alter_info.flags == ALTER_REORGANIZE_PARTITION));
3905 }
3906
3907+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
3908+template class Mem_root_array<ORDER*, true>;
3909+#endif
3910
3911=== modified file 'Percona-Server/sql/sql_lex.h'
3912--- Percona-Server/sql/sql_lex.h 2011-11-24 02:01:33 +0000
3913+++ Percona-Server/sql/sql_lex.h 2012-08-21 05:42:33 +0000
3914@@ -40,6 +40,7 @@
3915 */
3916
3917 #include "set_var.h"
3918+#include "mem_root_array.h"
3919
3920 #ifdef MYSQL_YACC
3921 #define LEX_YYSTYPE void *
3922@@ -188,6 +189,7 @@
3923 };
3924
3925 typedef List<Item> List_item;
3926+typedef Mem_root_array<ORDER*, true> Group_list_ptrs;
3927
3928 /* SERVERS CACHE CHANGES */
3929 typedef struct st_lex_server_options
3930@@ -595,7 +597,16 @@
3931 enum olap_type olap;
3932 /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
3933 SQL_I_List<TABLE_LIST> table_list;
3934- SQL_I_List<ORDER> group_list; /* GROUP BY clause. */
3935+
3936+ /*
3937+ GROUP BY clause.
3938+ This list may be mutated during optimization (by remove_const()),
3939+ so for prepared statements, we keep a copy of the ORDER.next pointers in
3940+ group_list_ptrs, and re-establish the original list before each execution.
3941+ */
3942+ SQL_I_List<ORDER> group_list;
3943+ Group_list_ptrs *group_list_ptrs;
3944+
3945 List<Item> item_list; /* list of fields & expressions */
3946 List<String> interval_list;
3947 bool is_item_list_lookup;
3948@@ -784,7 +795,8 @@
3949 bool test_limit();
3950
3951 friend void lex_start(THD *thd);
3952- st_select_lex() : n_sum_items(0), n_child_sum_items(0) {}
3953+ st_select_lex() : group_list_ptrs(NULL), n_sum_items(0), n_child_sum_items(0)
3954+ {}
3955 void make_empty_select()
3956 {
3957 init_query();
3958
3959=== modified file 'Percona-Server/sql/sql_parse.cc'
3960--- Percona-Server/sql/sql_parse.cc 2012-08-13 13:37:18 +0000
3961+++ Percona-Server/sql/sql_parse.cc 2012-08-21 05:42:33 +0000
3962@@ -2357,6 +2357,11 @@
3963 }
3964 DBUG_RETURN(0);
3965 }
3966+ /*
3967+ Execute deferred events first
3968+ */
3969+ if (slave_execute_deferred_events(thd))
3970+ DBUG_RETURN(-1);
3971 }
3972 else
3973 {
3974@@ -3184,7 +3189,7 @@
3975 goto error;
3976 #else
3977 {
3978- if (check_global_access(thd, SUPER_ACL))
3979+ if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
3980 goto error;
3981 res = show_binlogs(thd);
3982 break;
3983@@ -7439,7 +7444,7 @@
3984 continue;
3985 if (tmp->thread_id == id)
3986 {
3987- pthread_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
3988+ pthread_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
3989 break;
3990 }
3991 }
3992@@ -7467,12 +7472,13 @@
3993 if ((thd->security_ctx->master_access & SUPER_ACL) ||
3994 thd->security_ctx->user_matches(tmp->security_ctx))
3995 {
3996+ DEBUG_SYNC(thd, "kill_one_thread_before_kill");
3997 tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION);
3998 error=0;
3999 }
4000 else
4001 error=ER_KILL_DENIED_ERROR;
4002- pthread_mutex_unlock(&tmp->LOCK_thd_data);
4003+ pthread_mutex_unlock(&tmp->LOCK_thd_kill);
4004 }
4005 DBUG_PRINT("exit", ("%d", error));
4006 DBUG_RETURN(error);
4007
4008=== modified file 'Percona-Server/sql/sql_prepare.cc'
4009--- Percona-Server/sql/sql_prepare.cc 2012-05-09 04:14:12 +0000
4010+++ Percona-Server/sql/sql_prepare.cc 2012-08-21 05:42:33 +0000
4011@@ -2429,6 +2429,14 @@
4012 DBUG_ASSERT(sl->join == 0);
4013 ORDER *order;
4014 /* Fix GROUP list */
4015+ if (sl->group_list_ptrs && sl->group_list_ptrs->size() > 0)
4016+ {
4017+ for (uint ix= 0; ix < sl->group_list_ptrs->size() - 1; ++ix)
4018+ {
4019+ order= sl->group_list_ptrs->at(ix);
4020+ order->next= sl->group_list_ptrs->at(ix+1);
4021+ }
4022+ }
4023 for (order= sl->group_list.first; order; order= order->next)
4024 order->item= &order->item_ptr;
4025 /* Fix ORDER list */
4026
4027=== modified file 'Percona-Server/sql/sql_profile.cc'
4028--- Percona-Server/sql/sql_profile.cc 2011-11-24 01:59:44 +0000
4029+++ Percona-Server/sql/sql_profile.cc 2012-08-21 05:42:33 +0000
4030@@ -1,5 +1,5 @@
4031 /*
4032- Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
4033+ Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
4034
4035 This program is free software; you can redistribute it and/or modify
4036 it under the terms of the GNU General Public License as published by
4037@@ -84,8 +84,8 @@
4038
4039 int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
4040 {
4041- int profile_options = thd->lex->profile_options;
4042- int fields_include_condition_truth_values[]= {
4043+ uint profile_options = thd->lex->profile_options;
4044+ uint fields_include_condition_truth_values[]= {
4045 FALSE, /* Query_id */
4046 FALSE, /* Seq */
4047 TRUE, /* Status */
4048
4049=== modified file 'Percona-Server/sql/sql_repl.cc'
4050--- Percona-Server/sql/sql_repl.cc 2011-06-30 15:37:13 +0000
4051+++ Percona-Server/sql/sql_repl.cc 2012-08-21 05:42:33 +0000
4052@@ -469,7 +469,7 @@
4053 this larger than the corresponding packet (query) sent
4054 from client to master.
4055 */
4056- thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
4057+ thd->variables.max_allowed_packet= MAX_MAX_ALLOWED_PACKET;
4058
4059 /*
4060 We can set log_lock now, it does not move (it's a member of
4061@@ -1133,7 +1133,7 @@
4062 if (tmp->command == COM_BINLOG_DUMP &&
4063 tmp->server_id == slave_server_id)
4064 {
4065- pthread_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
4066+ pthread_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
4067 break;
4068 }
4069 }
4070@@ -1146,7 +1146,7 @@
4071 again. We just to do kill the thread ourselves.
4072 */
4073 tmp->awake(THD::KILL_QUERY);
4074- pthread_mutex_unlock(&tmp->LOCK_thd_data);
4075+ pthread_mutex_unlock(&tmp->LOCK_thd_kill);
4076 }
4077 }
4078
4079@@ -1454,6 +1454,8 @@
4080 IO_CACHE log;
4081 File file = -1;
4082 int old_max_allowed_packet= thd->variables.max_allowed_packet;
4083+ LOG_INFO linfo;
4084+
4085 DBUG_ENTER("mysql_show_binlog_events");
4086
4087 Log_event::init_show_field_list(&field_list);
4088@@ -1480,7 +1482,6 @@
4089 char search_file_name[FN_REFLEN], *name;
4090 const char *log_file_name = lex_mi->log_file_name;
4091 pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock();
4092- LOG_INFO linfo;
4093 Log_event* ev;
4094
4095 unit->set_limit(thd->lex->current_select);
4096@@ -1572,6 +1573,8 @@
4097
4098 pthread_mutex_unlock(log_lock);
4099 }
4100+ // Check that linfo is still on the function scope.
4101+ DEBUG_SYNC(thd, "after_show_binlog_events");
4102
4103 ret= FALSE;
4104
4105
4106=== modified file 'Percona-Server/sql/sql_select.cc'
4107--- Percona-Server/sql/sql_select.cc 2012-05-09 04:14:12 +0000
4108+++ Percona-Server/sql/sql_select.cc 2012-08-21 05:42:33 +0000
4109@@ -551,6 +551,8 @@
4110
4111 if (having)
4112 {
4113+ Query_arena backup, *arena;
4114+ arena= thd->activate_stmt_arena_if_needed(&backup);
4115 nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
4116 thd->where="having clause";
4117 thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level;
4118@@ -559,6 +561,10 @@
4119 (having->fix_fields(thd, &having) ||
4120 having->check_cols(1)));
4121 select_lex->having_fix_field= 0;
4122+ select_lex->having= having;
4123+ if (arena)
4124+ thd->restore_active_arena(arena, &backup);
4125+
4126 if (having_fix_rc || thd->is_error())
4127 DBUG_RETURN(-1); /* purecov: inspected */
4128 thd->lex->allow_sum_func= save_allow_sum_func;
4129@@ -11835,7 +11841,8 @@
4130 Locking reads can legally return also these errors, do not
4131 print them to the .err log
4132 */
4133- if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
4134+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT
4135+ && !table->in_use->killed)
4136 sql_print_error("Got error %d when reading table '%s'",
4137 error, table->s->path.str);
4138 table->file->print_error(error,MYF(0));
4139@@ -13869,8 +13876,6 @@
4140 join_read_first:join_read_last;
4141 tab->type=JT_NEXT; // Read with index_first(), index_next()
4142
4143- if (table->covering_keys.is_set(best_key))
4144- table->set_keyread(TRUE);
4145 table->file->ha_index_or_rnd_end();
4146 if (tab->join->select_options & SELECT_DESCRIBE)
4147 {
4148
4149=== modified file 'Percona-Server/sql/sql_show.cc'
4150--- Percona-Server/sql/sql_show.cc 2012-06-07 10:43:53 +0000
4151+++ Percona-Server/sql/sql_show.cc 2012-08-21 05:42:33 +0000
4152@@ -3523,39 +3523,44 @@
4153
4154 static int fill_schema_table_names(THD *thd, TABLE *table,
4155 LEX_STRING *db_name, LEX_STRING *table_name,
4156- bool with_i_schema)
4157+ bool with_i_schema,
4158+ bool need_table_type)
4159 {
4160- if (with_i_schema)
4161- {
4162- table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
4163- system_charset_info);
4164- }
4165- else
4166- {
4167- enum legacy_db_type not_used;
4168- char path[FN_REFLEN + 1];
4169- (void) build_table_filename(path, sizeof(path) - 1, db_name->str,
4170- table_name->str, reg_ext, 0);
4171- switch (mysql_frm_type(thd, path, &not_used)) {
4172- case FRMTYPE_ERROR:
4173- table->field[3]->store(STRING_WITH_LEN("ERROR"),
4174- system_charset_info);
4175- break;
4176- case FRMTYPE_TABLE:
4177- table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
4178- system_charset_info);
4179- break;
4180- case FRMTYPE_VIEW:
4181- table->field[3]->store(STRING_WITH_LEN("VIEW"),
4182- system_charset_info);
4183- break;
4184- default:
4185- DBUG_ASSERT(0);
4186+ /* Avoid opening FRM files if table type is not needed. */
4187+ if (need_table_type)
4188+ {
4189+ if (with_i_schema)
4190+ {
4191+ table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
4192+ system_charset_info);
4193 }
4194- if (thd->is_error() && thd->main_da.sql_errno() == ER_NO_SUCH_TABLE)
4195+ else
4196 {
4197- thd->clear_error();
4198- return 0;
4199+ enum legacy_db_type not_used;
4200+ char path[FN_REFLEN + 1];
4201+ (void) build_table_filename(path, sizeof(path) - 1, db_name->str,
4202+ table_name->str, reg_ext, 0);
4203+ switch (mysql_frm_type(thd, path, &not_used)) {
4204+ case FRMTYPE_ERROR:
4205+ table->field[3]->store(STRING_WITH_LEN("ERROR"),
4206+ system_charset_info);
4207+ break;
4208+ case FRMTYPE_TABLE:
4209+ table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
4210+ system_charset_info);
4211+ break;
4212+ case FRMTYPE_VIEW:
4213+ table->field[3]->store(STRING_WITH_LEN("VIEW"),
4214+ system_charset_info);
4215+ break;
4216+ default:
4217+ DBUG_ASSERT(0);
4218+ }
4219+ if (thd->is_error() && thd->main_da.sql_errno() == ER_NO_SUCH_TABLE)
4220+ {
4221+ thd->clear_error();
4222+ return 0;
4223+ }
4224 }
4225 }
4226 if (schema_table_store_record(thd, table))
4227@@ -4107,7 +4112,8 @@
4228 if (schema_table_idx == SCH_TABLE_NAMES)
4229 {
4230 if (fill_schema_table_names(thd, tables->table, db_name,
4231- table_name, with_i_schema))
4232+ table_name, with_i_schema,
4233+ lex->verbose))
4234 continue;
4235 }
4236 else
4237
4238=== modified file 'Percona-Server/sql/sql_yacc.yy'
4239--- Percona-Server/sql/sql_yacc.yy 2012-04-02 02:09:15 +0000
4240+++ Percona-Server/sql/sql_yacc.yy 2012-08-21 05:42:33 +0000
4241@@ -5044,7 +5044,23 @@
4242 $$= MYSQL_TYPE_VARCHAR;
4243 }
4244 | YEAR_SYM opt_field_length field_options
4245- { $$=MYSQL_TYPE_YEAR; }
4246+ {
4247+ if (Lex->length)
4248+ {
4249+ errno= 0;
4250+ ulong length= strtoul(Lex->length, NULL, 10);
4251+ if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4)
4252+ {
4253+ char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
4254+ my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
4255+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE,
4256+ ER_WARN_DEPRECATED_SYNTAX,
4257+ ER(ER_WARN_DEPRECATED_SYNTAX),
4258+ buff, "YEAR(4)");
4259+ }
4260+ }
4261+ $$=MYSQL_TYPE_YEAR;
4262+ }
4263 | DATE_SYM
4264 { $$=MYSQL_TYPE_DATE; }
4265 | TIME_SYM
4266
4267=== modified file 'Percona-Server/storage/innobase/btr/btr0cur.c'
4268--- Percona-Server/storage/innobase/btr/btr0cur.c 2012-01-25 08:15:27 +0000
4269+++ Percona-Server/storage/innobase/btr/btr0cur.c 2012-08-21 05:42:33 +0000
4270@@ -2792,6 +2792,8 @@
4271 n_rows = n_rows * 2;
4272 }
4273
4274+ DBUG_EXECUTE_IF("bug14007649", return(n_rows););
4275+
4276 /* Do not estimate the number of rows in the range
4277 to over 1 / 2 of the estimated rows in the whole
4278 table */
4279
4280=== modified file 'Percona-Server/storage/innobase/dict/dict0load.c'
4281--- Percona-Server/storage/innobase/dict/dict0load.c 2011-05-04 10:06:21 +0000
4282+++ Percona-Server/storage/innobase/dict/dict0load.c 2012-08-21 05:42:33 +0000
4283@@ -150,7 +150,7 @@
4284 monitor printout */
4285
4286 mutex_enter(&kernel_mutex);
4287- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
4288+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
4289 mutex_exit(&kernel_mutex);
4290
4291 mutex_enter(&(dict_sys->mutex));
4292@@ -178,7 +178,7 @@
4293 /* Restore the fatal semaphore wait timeout */
4294
4295 mutex_enter(&kernel_mutex);
4296- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
4297+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
4298 mutex_exit(&kernel_mutex);
4299
4300 return;
4301
4302=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
4303--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-05-09 04:14:12 +0000
4304+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-21 05:42:33 +0000
4305@@ -3180,6 +3180,30 @@
4306 DBUG_RETURN(0);
4307 }
4308
4309+handler*
4310+ha_innobase::clone(
4311+/*===============*/
4312+ const char* name, /*!< in: table name */
4313+ MEM_ROOT* mem_root) /*!< in: memory context */
4314+{
4315+ ha_innobase* new_handler;
4316+
4317+ DBUG_ENTER("ha_innobase::clone");
4318+
4319+ new_handler = static_cast<ha_innobase*>(handler::clone(name,
4320+ mem_root));
4321+ if (new_handler) {
4322+ DBUG_ASSERT(new_handler->prebuilt != NULL);
4323+ DBUG_ASSERT(new_handler->user_thd == user_thd);
4324+ DBUG_ASSERT(new_handler->prebuilt->trx == prebuilt->trx);
4325+
4326+ new_handler->prebuilt->select_lock_type
4327+ = prebuilt->select_lock_type;
4328+ }
4329+
4330+ DBUG_RETURN(new_handler);
4331+}
4332+
4333 uint
4334 ha_innobase::max_supported_key_part_length() const
4335 {
4336@@ -4875,6 +4899,7 @@
4337 ulint ret;
4338
4339 DBUG_ENTER("index_read");
4340+ DEBUG_SYNC_C("ha_innobase_index_read_begin");
4341
4342 ut_a(prebuilt->trx == thd_to_trx(user_thd));
4343 ut_ad(key_len != 0 || find_flag != HA_READ_KEY_EXACT);
4344@@ -9112,7 +9137,7 @@
4345 static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
4346 PLUGIN_VAR_RQCMDARG,
4347 "Desired maximum length of the purge queue (0 = no limit)",
4348- NULL, NULL, 0, 0, ~0L, 0);
4349+ NULL, NULL, 0, 0, ~0UL, 0);
4350
4351 static MYSQL_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
4352 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
4353@@ -9166,7 +9191,7 @@
4354 static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
4355 PLUGIN_VAR_RQCMDARG,
4356 "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
4357- NULL, NULL, 500L, 1L, ~0L, 0);
4358+ NULL, NULL, 500L, 1L, ~0UL, 0);
4359
4360 static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
4361 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
4362@@ -9211,7 +9236,7 @@
4363 static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
4364 PLUGIN_VAR_RQCMDARG,
4365 "Count of spin-loop rounds in InnoDB mutexes",
4366- NULL, NULL, 20L, 0L, ~0L, 0);
4367+ NULL, NULL, 20L, 0L, ~0UL, 0);
4368
4369 static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
4370 PLUGIN_VAR_RQCMDARG,
4371@@ -9221,7 +9246,7 @@
4372 static MYSQL_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
4373 PLUGIN_VAR_RQCMDARG,
4374 "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
4375- NULL, NULL, 10000L, 0L, ~0L, 0);
4376+ NULL, NULL, 10000L, 0L, ~0UL, 0);
4377
4378 static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path,
4379 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
4380
4381=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.h'
4382--- Percona-Server/storage/innobase/handler/ha_innodb.h 2010-10-18 10:48:11 +0000
4383+++ Percona-Server/storage/innobase/handler/ha_innodb.h 2012-08-21 05:42:33 +0000
4384@@ -117,6 +117,7 @@
4385 const key_map *keys_to_use_for_scanning() { return &key_map_full; }
4386
4387 int open(const char *name, int mode, uint test_if_locked);
4388+ handler* clone(const char *name, MEM_ROOT *mem_root);
4389 int close(void);
4390 double scan_time();
4391 double read_time(uint index, uint ranges, ha_rows rows);
4392
4393=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
4394--- Percona-Server/storage/innobase/include/srv0srv.h 2011-01-14 17:02:28 +0000
4395+++ Percona-Server/storage/innobase/include/srv0srv.h 2012-08-21 05:42:33 +0000
4396@@ -173,6 +173,7 @@
4397
4398 extern ulint srv_activity_count;
4399 extern ulint srv_fatal_semaphore_wait_threshold;
4400+#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
4401 extern ulint srv_dml_needed_delay;
4402
4403 extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
4404
4405=== modified file 'Percona-Server/storage/innobase/row/row0mysql.c'
4406--- Percona-Server/storage/innobase/row/row0mysql.c 2012-03-01 05:35:51 +0000
4407+++ Percona-Server/storage/innobase/row/row0mysql.c 2012-08-21 05:42:33 +0000
4408@@ -4189,7 +4189,7 @@
4409
4410 /* Enlarge the fatal lock wait timeout during CHECK TABLE. */
4411 mutex_enter(&kernel_mutex);
4412- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
4413+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
4414 mutex_exit(&kernel_mutex);
4415
4416 index = dict_table_get_first_index(table);
4417@@ -4247,7 +4247,7 @@
4418
4419 /* Restore the fatal lock wait timeout after CHECK TABLE. */
4420 mutex_enter(&kernel_mutex);
4421- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
4422+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
4423 mutex_exit(&kernel_mutex);
4424
4425 prebuilt->trx->op_info = "";
4426
4427=== modified file 'Percona-Server/storage/innobase/sync/sync0arr.c'
4428--- Percona-Server/storage/innobase/sync/sync0arr.c 2011-03-30 11:25:58 +0000
4429+++ Percona-Server/storage/innobase/sync/sync0arr.c 2012-08-21 05:42:33 +0000
4430@@ -931,6 +931,11 @@
4431 ibool fatal = FALSE;
4432 double longest_diff = 0;
4433
4434+ /* For huge tables, skip the check during CHECK TABLE etc... */
4435+ if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
4436+ return(FALSE);
4437+ }
4438+
4439 for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
4440
4441 double diff;
4442
4443=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0cur.c'
4444--- Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-04-02 02:09:15 +0000
4445+++ Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-08-21 05:42:33 +0000
4446@@ -3483,6 +3483,8 @@
4447 n_rows = n_rows * 2;
4448 }
4449
4450+ DBUG_EXECUTE_IF("bug14007649", return(n_rows););
4451+
4452 /* Do not estimate the number of rows in the range
4453 to over 1 / 2 of the estimated rows in the whole
4454 table */
4455
4456=== modified file 'Percona-Server/storage/innodb_plugin/dict/dict0dict.c'
4457--- Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2012-06-25 17:40:48 +0000
4458+++ Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2012-08-21 05:42:33 +0000
4459@@ -5388,6 +5388,28 @@
4460 foreign->foreign_index = new_index;
4461 }
4462 }
4463+
4464+
4465+ for (foreign = UT_LIST_GET_FIRST(table->referenced_list);
4466+ foreign;
4467+ foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
4468+
4469+ dict_index_t* new_index;
4470+
4471+ if (foreign->referenced_index == index) {
4472+ ut_ad(foreign->referenced_table == index->table);
4473+
4474+ new_index = dict_foreign_find_index(
4475+ foreign->referenced_table,
4476+ foreign->referenced_col_names,
4477+ foreign->n_fields, index,
4478+ /*check_charsets=*/TRUE, /*check_null=*/FALSE);
4479+ ut_ad(new_index || !trx->check_foreigns);
4480+ ut_ad(!new_index || new_index->table == index->table);
4481+
4482+ foreign->referenced_index = new_index;
4483+ }
4484+ }
4485 }
4486
4487 /**********************************************************************//**
4488
4489=== modified file 'Percona-Server/storage/innodb_plugin/dict/dict0load.c'
4490--- Percona-Server/storage/innodb_plugin/dict/dict0load.c 2011-12-09 16:53:35 +0000
4491+++ Percona-Server/storage/innodb_plugin/dict/dict0load.c 2012-08-21 05:42:33 +0000
4492@@ -165,7 +165,7 @@
4493 monitor printout */
4494
4495 mutex_enter(&kernel_mutex);
4496- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
4497+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
4498 mutex_exit(&kernel_mutex);
4499
4500 mutex_enter(&(dict_sys->mutex));
4501@@ -193,7 +193,7 @@
4502 /* Restore the fatal semaphore wait timeout */
4503
4504 mutex_enter(&kernel_mutex);
4505- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
4506+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
4507 mutex_exit(&kernel_mutex);
4508
4509 return;
4510
4511=== modified file 'Percona-Server/storage/innodb_plugin/fil/fil0fil.c'
4512--- Percona-Server/storage/innodb_plugin/fil/fil0fil.c 2012-06-01 07:51:41 +0000
4513+++ Percona-Server/storage/innodb_plugin/fil/fil0fil.c 2012-08-21 05:42:33 +0000
4514@@ -1876,7 +1876,7 @@
4515
4516 if (space == NULL) {
4517 fprintf(stderr,
4518- "InnoDB: Error: trying to do ibuf merge to a"
4519+ "InnoDB: Error: trying to do an operation on a"
4520 " dropped tablespace %lu\n",
4521 (ulong) id);
4522 }
4523
4524=== modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc'
4525--- Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-08-17 06:13:44 +0000
4526+++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-08-21 05:42:33 +0000
4527@@ -4283,6 +4283,27 @@
4528 }
4529
4530 UNIV_INTERN
4531+handler*
4532+ha_innobase::clone(
4533+/*===============*/
4534+ const char* name, /*!< in: table name */
4535+ MEM_ROOT* mem_root) /*!< in: memory context */
4536+{
4537+ ha_innobase* new_handler;
4538+
4539+ DBUG_ENTER("ha_innobase::clone");
4540+
4541+ new_handler = static_cast<ha_innobase*>(handler::clone(name,
4542+ mem_root));
4543+ if (new_handler) {
4544+ new_handler->prebuilt->select_lock_type
4545+ = prebuilt->select_lock_type;
4546+ }
4547+
4548+ DBUG_RETURN(new_handler);
4549+}
4550+
4551+UNIV_INTERN
4552 uint
4553 ha_innobase::max_supported_key_part_length() const
4554 {
4555@@ -8696,7 +8717,7 @@
4556
4557 /* Enlarge the fatal lock wait timeout during CHECK TABLE. */
4558 mutex_enter(&kernel_mutex);
4559- srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
4560+ srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
4561 mutex_exit(&kernel_mutex);
4562
4563 for (index = dict_table_get_first_index(prebuilt->table);
4564@@ -8792,7 +8813,7 @@
4565
4566 /* Restore the fatal lock wait timeout after CHECK TABLE. */
4567 mutex_enter(&kernel_mutex);
4568- srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
4569+ srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
4570 mutex_exit(&kernel_mutex);
4571
4572 prebuilt->trx->op_info = "";
4573@@ -11615,7 +11636,7 @@
4574 static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
4575 PLUGIN_VAR_RQCMDARG,
4576 "Number of IOPs the server can do. Tunes the background IO rate",
4577- NULL, NULL, 200, 100, ~0L, 0);
4578+ NULL, NULL, 200, 100, ~0UL, 0);
4579
4580 static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
4581 PLUGIN_VAR_OPCMDARG,
4582@@ -11703,7 +11724,7 @@
4583 static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
4584 PLUGIN_VAR_RQCMDARG,
4585 "Desired maximum length of the purge queue (0 = no limit)",
4586- NULL, NULL, 0, 0, ~0L, 0);
4587+ NULL, NULL, 0, 0, ~0UL, 0);
4588
4589 static MYSQL_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
4590 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
4591@@ -11790,7 +11811,7 @@
4592 static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
4593 PLUGIN_VAR_RQCMDARG,
4594 "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
4595- NULL, NULL, 500L, 1L, ~0L, 0);
4596+ NULL, NULL, 500L, 1L, ~0UL, 0);
4597
4598 static MYSQL_SYSVAR_LONG(kill_idle_transaction, srv_kill_idle_transaction,
4599 PLUGIN_VAR_RQCMDARG,
4600@@ -11861,12 +11882,12 @@
4601 static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
4602 PLUGIN_VAR_RQCMDARG,
4603 "Count of spin-loop rounds in InnoDB mutexes (30 by default)",
4604- NULL, NULL, 30L, 0L, ~0L, 0);
4605+ NULL, NULL, 30L, 0L, ~0UL, 0);
4606
4607 static MYSQL_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
4608 PLUGIN_VAR_OPCMDARG,
4609 "Maximum delay between polling for a spin lock (6 by default)",
4610- NULL, NULL, 6L, 0L, ~0L, 0);
4611+ NULL, NULL, 6L, 0L, ~0UL, 0);
4612
4613 static MYSQL_SYSVAR_BOOL(thread_concurrency_timer_based,
4614 innobase_thread_concurrency_timer_based,
4615@@ -11882,7 +11903,7 @@
4616 static MYSQL_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
4617 PLUGIN_VAR_RQCMDARG,
4618 "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
4619- NULL, NULL, 10000L, 0L, ~0L, 0);
4620+ NULL, NULL, 10000L, 0L, ~0UL, 0);
4621
4622 static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path,
4623 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
4624
4625=== modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.h'
4626--- Percona-Server/storage/innodb_plugin/handler/ha_innodb.h 2012-01-17 14:05:16 +0000
4627+++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.h 2012-08-21 05:42:33 +0000
4628@@ -133,6 +133,7 @@
4629 const key_map* keys_to_use_for_scanning();
4630
4631 int open(const char *name, int mode, uint test_if_locked);
4632+ handler* clone(const char *name, MEM_ROOT *mem_root);
4633 int close(void);
4634 double scan_time();
4635 double read_time(uint index, uint ranges, ha_rows rows);
4636
4637=== modified file 'Percona-Server/storage/innodb_plugin/handler/handler0alter.cc'
4638--- Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2012-05-29 06:32:03 +0000
4639+++ Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2012-08-21 05:42:33 +0000
4640@@ -668,6 +668,10 @@
4641 DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
4642 }
4643
4644+ if (innodb_table->tablespace_discarded) {
4645+ DBUG_RETURN(-1);
4646+ }
4647+
4648 /* Check that index keys are sensible */
4649 error = innobase_check_index_keys(key_info, num_of_keys, innodb_table);
4650
4651
4652=== modified file 'Percona-Server/storage/innodb_plugin/include/srv0srv.h'
4653--- Percona-Server/storage/innodb_plugin/include/srv0srv.h 2012-08-15 14:05:13 +0000
4654+++ Percona-Server/storage/innodb_plugin/include/srv0srv.h 2012-08-21 05:42:33 +0000
4655@@ -297,6 +297,7 @@
4656
4657 extern ulint srv_activity_count;
4658 extern ulint srv_fatal_semaphore_wait_threshold;
4659+#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
4660 extern ulint srv_dml_needed_delay;
4661 extern lint srv_kill_idle_transaction;
4662
4663
4664=== modified file 'Percona-Server/storage/innodb_plugin/include/univ.i'
4665--- Percona-Server/storage/innodb_plugin/include/univ.i 2012-04-02 02:09:15 +0000
4666+++ Percona-Server/storage/innodb_plugin/include/univ.i 2012-08-21 05:42:33 +0000
4667@@ -48,7 +48,7 @@
4668 #define INNODB_VERSION_BUGFIX 17
4669
4670 #ifndef PERCONA_INNODB_VERSION
4671-#define PERCONA_INNODB_VERSION 12.5
4672+#define PERCONA_INNODB_VERSION 14.0
4673 #endif
4674
4675
4676
4677=== modified file 'Percona-Server/storage/innodb_plugin/row/row0ins.c'
4678--- Percona-Server/storage/innodb_plugin/row/row0ins.c 2012-05-09 04:14:12 +0000
4679+++ Percona-Server/storage/innodb_plugin/row/row0ins.c 2012-08-21 05:42:33 +0000
4680@@ -1296,7 +1296,8 @@
4681 check_index = foreign->foreign_index;
4682 }
4683
4684- if (check_table == NULL || check_table->ibd_file_missing) {
4685+ if (check_table == NULL || check_table->ibd_file_missing
4686+ || check_index == NULL) {
4687 if (check_ref) {
4688 FILE* ef = dict_foreign_err_file;
4689
4690@@ -1331,9 +1332,6 @@
4691 goto exit_func;
4692 }
4693
4694- ut_a(check_table);
4695- ut_a(check_index);
4696-
4697 if (check_table != table) {
4698 /* We already have a LOCK_IX on table, but not necessarily
4699 on check_table */
4700
4701=== modified file 'Percona-Server/storage/innodb_plugin/row/row0vers.c'
4702--- Percona-Server/storage/innodb_plugin/row/row0vers.c 2011-06-16 08:51:04 +0000
4703+++ Percona-Server/storage/innodb_plugin/row/row0vers.c 2012-08-21 05:42:33 +0000
4704@@ -208,18 +208,6 @@
4705 vers_del = rec_get_deleted_flag(prev_version, comp);
4706 prev_trx_id = row_get_rec_trx_id(prev_version, clust_index,
4707 clust_offsets);
4708-
4709- /* If the trx_id and prev_trx_id are different and if
4710- the prev_version is marked deleted then the
4711- prev_trx_id must have already committed for the trx_id
4712- to be able to modify the row. Therefore, prev_trx_id
4713- cannot hold any implicit lock. */
4714- if (vers_del && 0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
4715-
4716- mutex_enter(&kernel_mutex);
4717- break;
4718- }
4719-
4720 /* The stack of versions is locked by mtr. Thus, it
4721 is safe to fetch the prefixes for externally stored
4722 columns. */
4723
4724=== modified file 'Percona-Server/storage/innodb_plugin/sync/sync0arr.c'
4725--- Percona-Server/storage/innodb_plugin/sync/sync0arr.c 2011-11-24 02:00:30 +0000
4726+++ Percona-Server/storage/innodb_plugin/sync/sync0arr.c 2012-08-21 05:42:33 +0000
4727@@ -926,6 +926,11 @@
4728 ibool fatal = FALSE;
4729 double longest_diff = 0;
4730
4731+ /* For huge tables, skip the check during CHECK TABLE etc... */
4732+ if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
4733+ return(FALSE);
4734+ }
4735+
4736 for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
4737
4738 double diff;
4739
4740=== modified file 'Percona-Server/storage/myisam/ft_boolean_search.c'
4741--- Percona-Server/storage/myisam/ft_boolean_search.c 2012-02-15 16:21:38 +0000
4742+++ Percona-Server/storage/myisam/ft_boolean_search.c 2012-08-21 05:42:33 +0000
4743@@ -354,7 +354,7 @@
4744
4745 returns 1 if the search was finished (must-word wasn't found)
4746 */
4747-static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
4748+static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
4749 {
4750 int r;
4751 int subkeys=1;
4752@@ -454,7 +454,7 @@
4753 ftbw->key_root=info->s->state.key_root[ftb->keynr];
4754 ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
4755 ftbw->off=0;
4756- return _ft2_search(ftb, ftbw, 0);
4757+ return _ft2_search_no_lock(ftb, ftbw, 0);
4758 }
4759
4760 /* matching key found */
4761@@ -482,6 +482,18 @@
4762 return 0;
4763 }
4764
4765+static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
4766+{
4767+ int r;
4768+ MYISAM_SHARE *share= ftb->info->s;
4769+ if (share->concurrent_insert)
4770+ rw_rdlock(&share->key_root_lock[ftb->keynr]);
4771+ r= _ft2_search_no_lock(ftb, ftbw, init_search);
4772+ if (share->concurrent_insert)
4773+ rw_unlock(&share->key_root_lock[ftb->keynr]);
4774+ return r;
4775+}
4776+
4777 static void _ftb_init_index_search(FT_INFO *ftb)
4778 {
4779 int i;
4780
4781=== modified file 'Percona-Server/storage/myisam/ft_nlq_search.c'
4782--- Percona-Server/storage/myisam/ft_nlq_search.c 2012-02-15 16:21:38 +0000
4783+++ Percona-Server/storage/myisam/ft_nlq_search.c 2012-08-21 05:42:33 +0000
4784@@ -71,9 +71,10 @@
4785 TREE_ELEMENT *selem;
4786 double gweight=1;
4787 MI_INFO *info=aio->info;
4788+ MYISAM_SHARE *share= info->s;
4789 uchar *keybuff=aio->keybuff;
4790 MI_KEYDEF *keyinfo=info->s->keyinfo+aio->keynr;
4791- my_off_t key_root=info->s->state.key_root[aio->keynr];
4792+ my_off_t key_root;
4793 uint extra= HA_FT_WLEN + info->s->rec_reflength;
4794 #if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
4795 float tmp_weight;
4796@@ -89,6 +90,11 @@
4797 keylen-=HA_FT_WLEN;
4798 doc_cnt=0;
4799
4800+ if (share->concurrent_insert)
4801+ rw_rdlock(&share->key_root_lock[aio->keynr]);
4802+
4803+ key_root= share->state.key_root[aio->keynr];
4804+
4805 /* Skip rows inserted by current inserted */
4806 for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
4807 !r &&
4808@@ -98,6 +104,9 @@
4809 info->lastkey_length, SEARCH_BIGGER, key_root))
4810 ;
4811
4812+ if (share->concurrent_insert)
4813+ rw_unlock(&share->key_root_lock[aio->keynr]);
4814+
4815 info->update|= HA_STATE_AKTIV; /* for _mi_test_if_changed() */
4816
4817 /* The following should be safe, even if we compare doubles */
4818@@ -121,6 +130,8 @@
4819 keyinfo=& info->s->ft2_keyinfo;
4820 key_root=info->lastpos;
4821 keylen=0;
4822+ if (share->concurrent_insert)
4823+ rw_rdlock(&share->key_root_lock[aio->keynr]);
4824 r=_mi_search_first(info, keyinfo, key_root);
4825 goto do_skip;
4826 }
4827@@ -155,6 +166,9 @@
4828 if (gweight < 0 || doc_cnt > 2000000)
4829 gweight=0;
4830
4831+ if (share->concurrent_insert)
4832+ rw_rdlock(&share->key_root_lock[aio->keynr]);
4833+
4834 if (_mi_test_if_changed(info) == 0)
4835 r=_mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
4836 SEARCH_BIGGER, key_root);
4837@@ -167,6 +181,8 @@
4838 r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
4839 SEARCH_BIGGER, key_root);
4840
4841+ if (share->concurrent_insert)
4842+ rw_unlock(&share->key_root_lock[aio->keynr]);
4843 }
4844 word->weight=gweight;
4845
4846
4847=== modified file 'Percona-Server/tests/Makefile.am'
4848--- Percona-Server/tests/Makefile.am 2011-06-30 15:37:13 +0000
4849+++ Percona-Server/tests/Makefile.am 2012-08-21 05:42:33 +0000
4850@@ -33,6 +33,7 @@
4851 grant.pl grant.res test_delayed_insert.pl \
4852 pmail.pl mail_to_db.pl table_types.pl \
4853 myisam-big-rows.tst \
4854+ mysql_client_fw.c \
4855 CMakeLists.txt
4856
4857 bin_PROGRAMS = mysql_client_test
4858@@ -47,6 +48,7 @@
4859 mysql_client_test_LDADD= $(LDADD) $(CXXLDFLAGS)
4860 mysql_client_test_SOURCES= mysql_client_test.c\
4861 $(top_srcdir)/mysys/my_memmem.c
4862+mysql_client_test.o: mysql_client_fw.c
4863
4864 insert_test_SOURCES= insert_test.c
4865 select_test_SOURCES= select_test.c
4866
4867=== added file 'Percona-Server/tests/mysql_client_fw.c'
4868--- Percona-Server/tests/mysql_client_fw.c 1970-01-01 00:00:00 +0000
4869+++ Percona-Server/tests/mysql_client_fw.c 2012-08-21 05:42:33 +0000
4870@@ -0,0 +1,1375 @@
4871+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4872+
4873+ This program is free software; you can redistribute it and/or modify
4874+ it under the terms of the GNU General Public License as published by
4875+ the Free Software Foundation; version 2 of the License.
4876+
4877+ This program is distributed in the hope that it will be useful,
4878+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4879+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4880+ GNU General Public License for more details.
4881+
4882+ You should have received a copy of the GNU General Public License
4883+ along with this program; if not, write to the Free Software
4884+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
4885+
4886+#include <my_global.h>
4887+#include <my_sys.h>
4888+#include <mysql.h>
4889+#include <errmsg.h>
4890+#include <my_getopt.h>
4891+#include <m_string.h>
4892+#include <mysqld_error.h>
4893+
4894+#define VER "2.1"
4895+#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
4896+#define MAX_KEY MAX_INDEXES
4897+#define MAX_SERVER_ARGS 64
4898+
4899+/* set default options */
4900+static int opt_testcase = 0;
4901+static char *opt_db= 0;
4902+static char *opt_user= 0;
4903+static char *opt_password= 0;
4904+static char *opt_host= 0;
4905+static char *opt_unix_socket= 0;
4906+#ifdef HAVE_SMEM
4907+static char *shared_memory_base_name= 0;
4908+#endif
4909+static unsigned int opt_port;
4910+static my_bool tty_password= 0, opt_silent= 0;
4911+
4912+static MYSQL *mysql= 0;
4913+static char current_db[]= "client_test_db";
4914+static unsigned int test_count= 0;
4915+static unsigned int opt_count= 0;
4916+static unsigned int iter_count= 0;
4917+static my_bool have_innodb= FALSE;
4918+
4919+static const char *opt_basedir= "./";
4920+static const char *opt_vardir= "mysql-test/var";
4921+
4922+static longlong opt_getopt_ll_test= 0;
4923+
4924+static int embedded_server_arg_count= 0;
4925+static char *embedded_server_args[MAX_SERVER_ARGS];
4926+
4927+static const char *embedded_server_groups[]= {
4928+"server",
4929+"embedded",
4930+"mysql_client_test_SERVER",
4931+NullS
4932+};
4933+
4934+static time_t start_time, end_time;
4935+static double total_time;
4936+
4937+const char *default_dbug_option= "d:t:o,/tmp/mysql_client_test.trace";
4938+
4939+struct my_tests_st
4940+{
4941+const char *name;
4942+void (*function)();
4943+};
4944+
4945+#define myheader(str) \
4946+DBUG_PRINT("test", ("name: %s", str)); \
4947+ if (opt_silent < 2) \
4948+ { \
4949+ fprintf(stdout, "\n\n#####################################\n"); \
4950+ fprintf(stdout, "%u of (%u/%u): %s", test_count++, iter_count, \
4951+ opt_count, str); \
4952+ fprintf(stdout, " \n#####################################\n"); \
4953+ }
4954+
4955+#define myheader_r(str) \
4956+DBUG_PRINT("test", ("name: %s", str)); \
4957+ if (!opt_silent) \
4958+ { \
4959+ fprintf(stdout, "\n\n#####################################\n"); \
4960+ fprintf(stdout, "%s", str); \
4961+ fprintf(stdout, " \n#####################################\n"); \
4962+ }
4963+
4964+static void print_error(const char *msg);
4965+static void print_st_error(MYSQL_STMT *stmt, const char *msg);
4966+static void client_disconnect(MYSQL* mysql, my_bool drop_db);
4967+
4968+
4969+/*
4970+Abort unless given experssion is non-zero.
4971+
4972+SYNOPSIS
4973+DIE_UNLESS(expr)
4974+
4975+DESCRIPTION
4976+We can't use any kind of system assert as we need to
4977+preserve tested invariants in release builds as well.
4978+*/
4979+
4980+#define DIE_UNLESS(expr) \
4981+((void) ((expr) ? 0 : (die(__FILE__, __LINE__, #expr), 0)))
4982+#define DIE_IF(expr) \
4983+((void) ((expr) ? (die(__FILE__, __LINE__, #expr), 0) : 0))
4984+#define DIE(expr) \
4985+die(__FILE__, __LINE__, #expr)
4986+
4987+static void die(const char *file, int line, const char *expr)
4988+{
4989+ fflush(stdout);
4990+ fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr);
4991+ fflush(stderr);
4992+ exit(1);
4993+}
4994+
4995+
4996+#define myerror(msg) print_error(msg)
4997+#define mysterror(stmt, msg) print_st_error(stmt, msg)
4998+
4999+#define myquery(RES) \
5000+{ \
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches