Merge lp:~atcurtis/maria/maria-5.1-federatedx into lp:~maria-captains/maria/5.1-converting

Proposed by Antony T Curtis
Status: Merged
Merged at revision: not available
Proposed branch: lp:~atcurtis/maria/maria-5.1-federatedx
Merge into: lp:~maria-captains/maria/5.1-converting
Diff against target: 40882 lines
To merge this branch: bzr merge lp:~atcurtis/maria/maria-5.1-federatedx
Reviewer Review Type Date Requested Status
Michael Widenius review for inclusion Needs Fixing
Review via email: mp+14409@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Antony T Curtis (atcurtis) wrote :

Fix the disabled federated_server test.
Fix possible null-ptr deref bug exposed by federated_server test.
Reduce calls to txn->acquire() in ::info() and ::free_result().

Revision history for this message
Michael Widenius (monty) wrote :

I have merged this to my local copy of MariaDB 5.1 and I am going through all code and fixing some small issues that I find.

A lot of good stuff in the code, but it also added a lot of other things than was mentioned in the commit message, which made the review notable harder.

Next time, PLEASE do patches in smaller segments and only one thing per big patch!

I can push this into MariaDB 5.1 when I am have done a trough review/test and fix loop

review: Needs Fixing (review for inclusion)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-11-06 17:22:32 +0000
3+++ .bzrignore 2009-11-14 20:25:27 +0000
4@@ -1922,3 +1922,4 @@
5 extra/libevent/event-config.h
6 libmysqld/opt_table_elimination.cc
7 libmysqld/ha_federatedx.cc
8+libmysqld/debug_sync.cc
9
10=== modified file 'CMakeLists.txt'
11--- CMakeLists.txt 2009-10-03 19:24:13 +0000
12+++ CMakeLists.txt 2009-11-14 20:25:27 +0000
13@@ -66,6 +66,12 @@
14 ADD_DEFINITIONS(-D EXTRA_DEBUG)
15 ENDIF(EXTRA_DEBUG)
16
17+IF(ENABLED_DEBUG_SYNC)
18+ ADD_DEFINITIONS(-D ENABLED_DEBUG_SYNC)
19+ENDIF(ENABLED_DEBUG_SYNC)
20+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
21+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
22+
23 # in some places we use DBUG_OFF
24 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
25 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
26@@ -211,12 +217,16 @@
27 FILE(GLOB STORAGE_SUBDIRS storage/*)
28 FOREACH(SUBDIR ${STORAGE_SUBDIRS})
29 FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/storage ${SUBDIR})
30- STRING(TOUPPER ${DIRNAME} ENGINE)
31- STRING(TOLOWER ${DIRNAME} ENGINE_LOWER)
32 IF (EXISTS ${SUBDIR}/CMakeLists.txt)
33 # Check MYSQL_STORAGE_ENGINE macro is present
34 FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX MYSQL_STORAGE_ENGINE)
35 IF(HAVE_STORAGE_ENGINE)
36+ # Extract name of engine from HAVE_STORAGE_ENGINE
37+ STRING(REGEX REPLACE ".*MYSQL_STORAGE_ENGINE\\((.*\)\\).*"
38+ "\\1" ENGINE_NAME ${HAVE_STORAGE_ENGINE})
39+ STRING(TOUPPER ${ENGINE_NAME} ENGINE)
40+ STRING(TOLOWER ${ENGINE_NAME} ENGINE_LOWER)
41+
42 SET(ENGINE_BUILD_TYPE "DYNAMIC")
43 # Read plug.in to find out if a plugin is mandatory and whether it supports
44 # build as shared library (dynamic).
45@@ -254,6 +264,7 @@
46 SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME})
47 SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
48 SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
49+ SET (${ENGINE}_DIR ${DIRNAME})
50 ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
51 ENDIF(EXISTS ${SUBDIR}/plug.in)
52
53
54=== modified file 'Makefile.am'
55--- Makefile.am 2009-10-11 15:38:37 +0000
56+++ Makefile.am 2009-11-14 20:25:27 +0000
57@@ -1,4 +1,4 @@
58-# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
59+# Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc.
60 #
61 # This program is free software; you can redistribute it and/or modify
62 # it under the terms of the GNU General Public License as published by
63@@ -26,7 +26,7 @@
64 SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
65 @readline_topdir@ sql-common scripts \
66 @pstack_dir@ \
67- @sql_union_dirs@ unittest storage plugin \
68+ @sql_union_dirs@ storage \
69 @sql_server@ @man_dirs@ tests \
70 netware @libmysqld_dirs@ \
71 mysql-test support-files sql-bench @tools_dirs@ \
72@@ -208,6 +208,10 @@
73 -cd mysql-test ; MTR_BUILD_THREAD=auto \
74 @PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --force --comment=stress --suite=stress
75
76+test-bt-fast2:
77+ -cd mysql-test ; MTR_BUILD_THREAD=auto \
78+ @PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol --report-features
79+
80 test-bt-debug:
81 -cd mysql-test ; MTR_BUILD_THREAD=auto \
82 @PERL@ ./mysql-test-run.pl $(MTR_EXTRA_OPTIONS) --comment=debug --force --timer \
83@@ -215,6 +219,8 @@
84
85 test-bt-debug-fast:
86
87+test-bt-debug-fast:
88+
89 # Keep these for a while
90 test-pl: test
91 test-full-pl: test-full
92
93=== modified file 'client/mysql.cc'
94--- client/mysql.cc 2009-11-06 17:22:32 +0000
95+++ client/mysql.cc 2009-11-14 20:25:27 +0000
96@@ -1281,21 +1281,35 @@
97 MYSQL *kill_mysql= NULL;
98
99 /* terminate if no query being executed, or we already tried interrupting */
100- if (!executing_query || interrupted_query)
101+ /* terminate if no query being executed, or we already tried interrupting */
102+ if (!executing_query || (interrupted_query == 2))
103+ {
104+ tee_fprintf(stdout, "Ctrl-C -- exit!\n");
105 goto err;
106+ }
107
108 kill_mysql= mysql_init(kill_mysql);
109 if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
110 "", opt_mysql_port, opt_mysql_unix_port,0))
111+ {
112+ tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
113 goto err;
114+ }
115+
116+ interrupted_query++;
117+
118+ /* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
119+ if ((interrupted_query == 1) && (mysql_get_server_version(&mysql) < 50000))
120+ interrupted_query= 2;
121
122 /* kill_buffer is always big enough because max length of %lu is 15 */
123- sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
124- mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
125+ sprintf(kill_buffer, "KILL %s%lu",
126+ (interrupted_query == 1) ? "QUERY " : "",
127+ mysql_thread_id(&mysql));
128+ tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
129+ mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
130 mysql_close(kill_mysql);
131- tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
132-
133- interrupted_query= 1;
134+ tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
135
136 return;
137
138@@ -2873,7 +2887,7 @@
139 "For developer information, including the MySQL Reference Manual, "
140 "visit:\n"
141 " http://dev.mysql.com/\n"
142- "To buy MySQL Network Support, training, or other products, visit:\n"
143+ "To buy MySQL Enterprise support, training, or other products, visit:\n"
144 " https://shop.mysql.com/\n", INFO_INFO);
145 put_info("List of all MySQL commands:", INFO_INFO);
146 if (!named_cmds)
147
148=== modified file 'client/mysql_upgrade.c'
149--- client/mysql_upgrade.c 2009-11-06 17:22:32 +0000
150+++ client/mysql_upgrade.c 2009-11-14 20:25:27 +0000
151@@ -54,6 +54,8 @@
152
153 static my_bool not_used; /* Can't use GET_BOOL without a value pointer */
154
155+static my_bool opt_write_binlog;
156+
157 #include <help_start.h>
158
159 static struct my_option my_long_options[]=
160@@ -124,6 +126,11 @@
161 {"verbose", 'v', "Display more output about the process",
162 (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
163 GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
164+ {"write-binlog", OPT_WRITE_BINLOG,
165+ "All commands including mysqlcheck are binlogged. Enabled by default;"
166+ "use --skip-write-binlog when commands should not be sent to replication slaves.",
167+ (uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
168+ 1, 0, 0, 0, 0, 0},
169 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
170 };
171
172@@ -448,6 +455,8 @@
173 int ret;
174 File fd;
175 char query_file_path[FN_REFLEN];
176+ const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0;";
177+
178 DBUG_ENTER("run_query");
179 DBUG_PRINT("enter", ("query: %s", query));
180 if ((fd= create_temp_file(query_file_path, opt_tmpdir,
181@@ -455,6 +464,22 @@
182 MYF(MY_WME))) < 0)
183 die("Failed to create temporary file for defaults");
184
185+ /*
186+ Master and slave should be upgraded separately. All statements executed
187+ by mysql_upgrade will not be binlogged.
188+ 'SET SQL_LOG_BIN=0' is executed before any other statements.
189+ */
190+ if (!opt_write_binlog)
191+ {
192+ if (my_write(fd, sql_log_bin, sizeof(sql_log_bin)-1,
193+ MYF(MY_FNABP | MY_WME)))
194+ {
195+ my_close(fd, MYF(0));
196+ my_delete(query_file_path, MYF(0));
197+ die("Failed to write to '%s'", query_file_path);
198+ }
199+ }
200+
201 if (my_write(fd, (uchar*) query, strlen(query),
202 MYF(MY_FNABP | MY_WME)))
203 {
204@@ -647,6 +672,7 @@
205 "--check-upgrade",
206 "--all-databases",
207 "--auto-repair",
208+ opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
209 NULL);
210 }
211
212@@ -661,6 +687,7 @@
213 "--all-databases",
214 "--fix-db-names",
215 "--fix-table-names",
216+ opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
217 NULL);
218 }
219
220
221=== modified file 'client/mysqlbinlog.cc'
222--- client/mysqlbinlog.cc 2009-09-15 10:46:35 +0000
223+++ client/mysqlbinlog.cc 2009-11-14 20:25:27 +0000
224@@ -78,6 +78,9 @@
225 static int port= 0;
226 static uint my_end_arg;
227 static const char* sock= 0;
228+#ifdef HAVE_SMEM
229+static char *shared_memory_base_name= 0;
230+#endif
231 static const char* user = 0;
232 static char* pass = 0;
233 static char *charset= 0;
234@@ -726,7 +729,10 @@
235
236 switch (ev_type) {
237 case QUERY_EVENT:
238- if (shall_skip_database(((Query_log_event*)ev)->db))
239+ if (strncmp(((Query_log_event*)ev)->query, "BEGIN", 5) &&
240+ strncmp(((Query_log_event*)ev)->query, "COMMIT", 6) &&
241+ strncmp(((Query_log_event*)ev)->query, "ROLLBACK", 8) &&
242+ shall_skip_database(((Query_log_event*)ev)->db))
243 goto end;
244 if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS)
245 {
246@@ -989,13 +995,13 @@
247 /* 'unspec' is not mentioned because it is just a placeholder. */
248 "Determine when the output statements should be base64-encoded BINLOG "
249 "statements: 'never' disables it and works only for binlogs without "
250- "row-based events; 'auto' is the default and prints base64 only when "
251- "necessary (i.e., for row-based events and format description events); "
252- "'decode-rows' suppresses BINLOG statements for row events, but does "
253- "not exit as an error if a row event is found, unlike 'never'; "
254- "'always' prints base64 whenever possible. 'always' is for debugging "
255- "only and should not be used in a production system. The default is "
256- "'auto'. --base64-output is a short form for --base64-output=always."
257+ "row-based events; 'decode-rows' decodes row events into commented SQL "
258+ "statements if the --verbose option is also given; 'auto' prints base64 "
259+ "only when necessary (i.e., for row-based events and format description "
260+ "events); 'always' prints base64 whenever possible. 'always' is for "
261+ "debugging only and should not be used in a production system. If this "
262+ "argument is not given, the default is 'auto'; if it is given with no "
263+ "argument, 'always' is used."
264 ,(uchar**) &opt_base64_output_mode_str,
265 (uchar**) &opt_base64_output_mode_str,
266 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
267@@ -1074,6 +1080,12 @@
268 {"set-charset", OPT_SET_CHARSET,
269 "Add 'SET NAMES character_set' to the output.", (uchar**) &charset,
270 (uchar**) &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
271+#ifdef HAVE_SMEM
272+ {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
273+ "Base name of shared memory.", (uchar**) &shared_memory_base_name,
274+ (uchar**) &shared_memory_base_name,
275+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
276+#endif
277 {"short-form", 's', "Just show regular queries: no extra info and no "
278 "row-based events. This is for testing only, and should not be used in "
279 "production systems. If you want to suppress base64-output, consider "
280@@ -1376,6 +1388,11 @@
281
282 if (opt_protocol)
283 mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
284+#ifdef HAVE_SMEM
285+ if (shared_memory_base_name)
286+ mysql_options(mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
287+ shared_memory_base_name);
288+#endif
289 if (!mysql_real_connect(mysql, host, user, pass, 0, port, sock, 0))
290 {
291 error("Failed on connect: %s", mysql_error(mysql));
292
293=== modified file 'client/mysqlcheck.c'
294--- client/mysqlcheck.c 2009-07-14 17:08:38 +0000
295+++ client/mysqlcheck.c 2009-11-14 20:25:27 +0000
296@@ -652,6 +652,17 @@
297 return 0;
298 } /* use_db */
299
300+static int disable_binlog()
301+{
302+ const char *stmt= "SET SQL_LOG_BIN=0";
303+ if (mysql_query(sock, stmt))
304+ {
305+ fprintf(stderr, "Failed to %s\n", stmt);
306+ fprintf(stderr, "Error: %s\n", mysql_error(sock));
307+ return 1;
308+ }
309+ return 0;
310+}
311
312 static int handle_request_for_tables(char *tables, uint length)
313 {
314@@ -844,6 +855,14 @@
315 if (dbConnect(current_host, current_user, opt_password))
316 exit(EX_MYSQLERR);
317
318+ if (!opt_write_binlog)
319+ {
320+ if (disable_binlog()) {
321+ first_error= 1;
322+ goto end;
323+ }
324+ }
325+
326 if (opt_auto_repair &&
327 my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
328 {
329
330=== modified file 'client/mysqlimport.c'
331--- client/mysqlimport.c 2009-07-14 17:08:38 +0000
332+++ client/mysqlimport.c 2009-11-14 20:25:27 +0000
333@@ -1,4 +1,4 @@
334-/* Copyright (C) 2000-2006 MySQL AB
335+/* Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
336
337 This program is free software; you can redistribute it and/or modify
338 it under the terms of the GNU General Public License as published by
339@@ -583,7 +583,7 @@
340 counter--;
341 pthread_cond_signal(&count_threshhold);
342 pthread_mutex_unlock(&counter_mutex);
343- my_thread_end();
344+ mysql_thread_end();
345
346 return 0;
347 }
348
349=== modified file 'client/mysqlslap.c'
350--- client/mysqlslap.c 2009-11-11 22:13:07 +0000
351+++ client/mysqlslap.c 2009-11-14 20:25:27 +0000
352@@ -1,4 +1,4 @@
353-/* Copyright (C) 2005 MySQL AB
354+/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc.
355
356 This program is free software; you can redistribute it and/or modify
357 it under the terms of the GNU General Public License as published by
358@@ -423,6 +423,7 @@
359 stats *sptr;
360 conclusions conclusion;
361 unsigned long long client_limit;
362+ int sysret;
363
364 head_sptr= (stats *)my_malloc(sizeof(stats) * iterations,
365 MYF(MY_ZEROFILL|MY_FAE|MY_WME));
366@@ -472,7 +473,10 @@
367 run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
368
369 if (pre_system)
370- if (system(pre_system)) { /* Ignore for now */ }
371+ if ((sysret= system(pre_system)) != 0)
372+ fprintf(stderr,
373+ "Warning: Execution of pre_system option returned %d.\n",
374+ sysret);
375
376 /*
377 Pre statements are always run after all other logic so they can
378@@ -487,8 +491,10 @@
379 run_statements(mysql, post_statements);
380
381 if (post_system)
382- if (system(post_system)) { /* Ignore for now */ }
383-
384+ if ((sysret= system(post_system)) != 0)
385+ fprintf(stderr,
386+ "Warning: Execution of post_system option returned %d.\n",
387+ sysret);
388 /* We are finished with this run */
389 if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
390 drop_primary_key_list();
391@@ -1942,7 +1948,7 @@
392 if (!opt_only_print)
393 mysql_close(mysql);
394
395- my_thread_end();
396+ mysql_thread_end();
397
398 pthread_mutex_lock(&counter_mutex);
399 thread_counter--;
400
401=== modified file 'client/mysqltest.cc'
402--- client/mysqltest.cc 2009-10-15 21:52:31 +0000
403+++ client/mysqltest.cc 2009-11-14 20:25:27 +0000
404@@ -82,6 +82,9 @@
405 static int record= 0, opt_sleep= -1;
406 static char *opt_db= 0, *opt_pass= 0;
407 const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
408+#ifdef HAVE_SMEM
409+static char *shared_memory_base_name=0;
410+#endif
411 const char *opt_logdir= "";
412 const char *opt_include= 0, *opt_charsets_dir;
413 static int opt_port= 0;
414@@ -429,6 +432,7 @@
415 struct st_command
416 {
417 char *query, *query_buf,*first_argument,*last_argument,*end;
418+ DYNAMIC_STRING content;
419 int first_word_len, query_len;
420 my_bool abort_on_error;
421 struct st_expected_errors expected_errors;
422@@ -1152,6 +1156,8 @@
423 {
424 struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
425 my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
426+ if ((*q)->content.str)
427+ dynstr_free(&(*q)->content);
428 my_free((*q),MYF(0));
429 }
430 for (i= 0; i < 10; i++)
431@@ -1177,6 +1183,7 @@
432 mysql_server_end();
433
434 /* Don't use DBUG after mysql_server_end() */
435+ DBUG_VIOLATION_HELPER_LEAVE;
436 return;
437 }
438
439@@ -1543,7 +1550,7 @@
440 else
441 diff_name = 0;
442 #else
443- diff_name = "diff"; // Otherwise always assume it's called diff
444+ diff_name = "diff"; /* Otherwise always assume it's called diff */
445 #endif
446
447 if (diff_name)
448@@ -3321,21 +3328,30 @@
449 sizeof(write_file_args)/sizeof(struct command_arg),
450 ' ');
451
452- /* If no delimiter was provided, use EOF */
453- if (ds_delimiter.length == 0)
454- dynstr_set(&ds_delimiter, "EOF");
455-
456 if (!append && access(ds_filename.str, F_OK) == 0)
457 {
458 /* The file should not be overwritten */
459 die("File already exist: '%s'", ds_filename.str);
460 }
461
462- init_dynamic_string(&ds_content, "", 1024, 1024);
463- read_until_delimiter(&ds_content, &ds_delimiter);
464- DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
465- str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
466- dynstr_free(&ds_content);
467+ ds_content= command->content;
468+ /* If it hasn't been done already by a loop iteration, fill it in */
469+ if (! ds_content.str)
470+ {
471+ /* If no delimiter was provided, use EOF */
472+ if (ds_delimiter.length == 0)
473+ dynstr_set(&ds_delimiter, "EOF");
474+
475+ init_dynamic_string(&ds_content, "", 1024, 1024);
476+ read_until_delimiter(&ds_content, &ds_delimiter);
477+ command->content= ds_content;
478+ }
479+ /* This function could be called even if "false", so check before printing */
480+ if (cur_block->ok)
481+ {
482+ DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
483+ str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
484+ }
485 dynstr_free(&ds_filename);
486 dynstr_free(&ds_delimiter);
487 DBUG_VOID_RETURN;
488@@ -3478,12 +3494,17 @@
489 die("command \"diff_files\" failed, file '%s' does not exist",
490 ds_filename2.str);
491
492- if ((error= compare_files(ds_filename.str, ds_filename2.str)))
493+ if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
494+ match_expected_error(command, error, NULL) < 0)
495 {
496 /* Compare of the two files failed, append them to output
497- so the failure can be analyzed
498+ so the failure can be analyzed, but only if it was not
499+ expected to fail.
500 */
501 show_diff(&ds_res, ds_filename.str, ds_filename2.str);
502+ log_file.write(&ds_res);
503+ log_file.flush();
504+ dynstr_set(&ds_res, 0);
505 }
506
507 dynstr_free(&ds_filename);
508@@ -4910,6 +4931,8 @@
509 <opts> - options to use for the connection
510 * SSL - use SSL if available
511 * COMPRESS - use compression if available
512+ * SHM - use shared memory if available
513+ * PIPE - use named pipe if available
514
515 */
516
517@@ -4918,6 +4941,7 @@
518 int con_port= opt_port;
519 char *con_options;
520 my_bool con_ssl= 0, con_compress= 0;
521+ my_bool con_pipe= 0, con_shm= 0;
522 struct st_connection* con_slot;
523
524 static DYNAMIC_STRING ds_connection_name;
525@@ -4928,6 +4952,9 @@
526 static DYNAMIC_STRING ds_port;
527 static DYNAMIC_STRING ds_sock;
528 static DYNAMIC_STRING ds_options;
529+#ifdef HAVE_SMEM
530+ static DYNAMIC_STRING ds_shm;
531+#endif
532 const struct command_arg connect_args[] = {
533 { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
534 { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
535@@ -4955,6 +4982,11 @@
536 die("Illegal argument for port: '%s'", ds_port.str);
537 }
538
539+#ifdef HAVE_SMEM
540+ /* Shared memory */
541+ init_dynamic_string(&ds_shm, ds_sock.str, 0, 0);
542+#endif
543+
544 /* Sock */
545 if (ds_sock.length)
546 {
547@@ -4993,6 +5025,10 @@
548 con_ssl= 1;
549 else if (!strncmp(con_options, "COMPRESS", 8))
550 con_compress= 1;
551+ else if (!strncmp(con_options, "PIPE", 4))
552+ con_pipe= 1;
553+ else if (!strncmp(con_options, "SHM", 3))
554+ con_shm= 1;
555 else
556 die("Illegal option to connect: %.*s",
557 (int) (end - con_options), con_options);
558@@ -5043,6 +5079,31 @@
559 }
560 #endif
561
562+#ifdef __WIN__
563+ if (con_pipe)
564+ {
565+ uint protocol= MYSQL_PROTOCOL_PIPE;
566+ mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
567+ }
568+#endif
569+
570+#ifdef HAVE_SMEM
571+ if (con_shm)
572+ {
573+ uint protocol= MYSQL_PROTOCOL_MEMORY;
574+ if (!ds_shm.length)
575+ die("Missing shared memory base name");
576+ mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
577+ mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
578+ }
579+ else if(shared_memory_base_name)
580+ {
581+ mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
582+ shared_memory_base_name);
583+ }
584+#endif
585+
586+
587 /* Use default db name */
588 if (ds_database.length == 0)
589 dynstr_set(&ds_database, opt_db);
590@@ -5075,6 +5136,9 @@
591 dynstr_free(&ds_port);
592 dynstr_free(&ds_sock);
593 dynstr_free(&ds_options);
594+#ifdef HAVE_SMEM
595+ dynstr_free(&ds_shm);
596+#endif
597 DBUG_VOID_RETURN;
598 }
599
600@@ -5746,6 +5810,12 @@
601 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
602 {"server-file", 'F', "Read embedded server arguments from file.",
603 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
604+#ifdef HAVE_SMEM
605+ {"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
606+ "Base name of shared memory.", (uchar**) &shared_memory_base_name,
607+ (uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
608+ 0, 0, 0},
609+#endif
610 {"silent", 's', "Suppress all normal output. Synonym for --quiet.",
611 (uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
612 {"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
613@@ -6809,8 +6879,10 @@
614 MYSQL_STMT *stmt;
615 DYNAMIC_STRING ds_prepare_warnings;
616 DYNAMIC_STRING ds_execute_warnings;
617+ ulonglong affected_rows;
618 DBUG_ENTER("run_query_stmt");
619 DBUG_PRINT("query", ("'%-.60s'", query));
620+ LINT_INIT(affected_rows);
621
622 /*
623 Init a new stmt if it's not already one created for this connection
624@@ -6950,32 +7022,43 @@
625 */
626 }
627
628- if (!disable_warnings)
629+ /*
630+ Need to grab affected rows information before getting
631+ warnings here
632+ */
633 {
634- /* Get the warnings from execute */
635-
636- /* Append warnings to ds - if there are any */
637- if (append_warnings(&ds_execute_warnings, mysql) ||
638- ds_execute_warnings.length ||
639- ds_prepare_warnings.length ||
640- ds_warnings->length)
641+ ulonglong affected_rows;
642+ LINT_INIT(affected_rows);
643+
644+ if (!disable_info)
645+ affected_rows= mysql_affected_rows(mysql);
646+
647+ if (!disable_warnings)
648 {
649- dynstr_append_mem(ds, "Warnings:\n", 10);
650- if (ds_warnings->length)
651- dynstr_append_mem(ds, ds_warnings->str,
652- ds_warnings->length);
653- if (ds_prepare_warnings.length)
654- dynstr_append_mem(ds, ds_prepare_warnings.str,
655- ds_prepare_warnings.length);
656- if (ds_execute_warnings.length)
657- dynstr_append_mem(ds, ds_execute_warnings.str,
658- ds_execute_warnings.length);
659+ /* Get the warnings from execute */
660+
661+ /* Append warnings to ds - if there are any */
662+ if (append_warnings(&ds_execute_warnings, mysql) ||
663+ ds_execute_warnings.length ||
664+ ds_prepare_warnings.length ||
665+ ds_warnings->length)
666+ {
667+ dynstr_append_mem(ds, "Warnings:\n", 10);
668+ if (ds_warnings->length)
669+ dynstr_append_mem(ds, ds_warnings->str,
670+ ds_warnings->length);
671+ if (ds_prepare_warnings.length)
672+ dynstr_append_mem(ds, ds_prepare_warnings.str,
673+ ds_prepare_warnings.length);
674+ if (ds_execute_warnings.length)
675+ dynstr_append_mem(ds, ds_execute_warnings.str,
676+ ds_execute_warnings.length);
677+ }
678 }
679+
680+ if (!disable_info)
681+ append_info(ds, affected_rows, mysql_info(mysql));
682 }
683-
684- if (!disable_info)
685- append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql));
686-
687 }
688
689 end:
690@@ -7224,6 +7307,10 @@
691 run_query_normal(cn, command, flags, query, query_len,
692 ds, &ds_warnings);
693
694+ dynstr_free(&ds_warnings);
695+ if (command->type == Q_EVAL)
696+ dynstr_free(&eval_query);
697+
698 if (display_result_sorted)
699 {
700 /* Sort the result set and append it to result */
701@@ -7254,11 +7341,8 @@
702 check_require(ds, command->require_file);
703 }
704
705- dynstr_free(&ds_warnings);
706 if (ds == &ds_result)
707 dynstr_free(&ds_result);
708- if (command->type == Q_EVAL)
709- dynstr_free(&eval_query);
710 DBUG_VOID_RETURN;
711 }
712
713@@ -7704,6 +7788,11 @@
714 }
715 #endif
716
717+#ifdef HAVE_SMEM
718+ if (shared_memory_base_name)
719+ mysql_options(&con->mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
720+#endif
721+
722 if (!(con->name = my_strdup("default", MYF(MY_WME))))
723 die("Out of memory");
724
725@@ -7742,7 +7831,32 @@
726 command->type= Q_COMMENT;
727 }
728
729- if (cur_block->ok)
730+ my_bool ok_to_do= cur_block->ok;
731+ /*
732+ Some commands need to be "done" the first time if they may get
733+ re-iterated over in a true context. This can only happen if there's
734+ a while loop at some level above the current block.
735+ */
736+ if (!ok_to_do)
737+ {
738+ if (command->type == Q_SOURCE ||
739+ command->type == Q_ERROR ||
740+ command->type == Q_WRITE_FILE ||
741+ command->type == Q_APPEND_FILE ||
742+ command->type == Q_PERL)
743+ {
744+ for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--)
745+ {
746+ if (stb->cmd == cmd_while)
747+ {
748+ ok_to_do= 1;
749+ break;
750+ }
751+ }
752+ }
753+ }
754+
755+ if (ok_to_do)
756 {
757 command->last_argument= command->first_argument;
758 processed = 1;
759@@ -8053,6 +8167,8 @@
760 if (parsing_disabled)
761 die("Test ended with parsing disabled");
762
763+ my_bool empty_result= FALSE;
764+
765 /*
766 The whole test has been executed _sucessfully_.
767 Time to compare result or save it to record file.
768@@ -8093,11 +8209,20 @@
769 }
770 else
771 {
772- die("The test didn't produce any output");
773+ /* Empty output is an error *unless* we also have an empty result file */
774+ if (! result_file_name || record ||
775+ compare_files (log_file.file_name(), result_file_name))
776+ {
777+ die("The test didn't produce any output");
778+ }
779+ else
780+ {
781+ empty_result= TRUE; /* Meaning empty was expected */
782+ }
783 }
784
785- if (!command_executed && result_file_name)
786- die("No queries executed but result file found!");
787+ if (!command_executed && result_file_name && !empty_result)
788+ die("No queries executed but non-empty result file found!");
789
790 verbose_msg("Test has succeeded!");
791 timer_output();
792@@ -8184,6 +8309,8 @@
793 }
794 my_free(start, MYF(0));
795 command->last_argument= command->end;
796+
797+ DBUG_VOID_RETURN;
798 }
799
800
801
802=== modified file 'cmd-line-utils/readline/display.c'
803--- cmd-line-utils/readline/display.c 2009-09-07 20:50:10 +0000
804+++ cmd-line-utils/readline/display.c 2009-11-14 20:25:27 +0000
805@@ -463,10 +463,10 @@
806 int newlines, lpos, temp, modmark;
807 char *prompt_this_line;
808 #if defined (HANDLE_MULTIBYTE)
809- int num, n0;
810+ int num, n0= 0;
811 wchar_t wc;
812 size_t wc_bytes;
813- int wc_width;
814+ int wc_width= 0;
815 mbstate_t ps;
816 int _rl_wrapped_multicolumn = 0;
817 #endif
818@@ -824,7 +824,7 @@
819 cpos_buffer_position = out;
820 lb_linenum = newlines;
821 }
822- for (i = in; i < in+wc_bytes; i++)
823+ for (i = in; i < in+(int)wc_bytes; i++)
824 line[out++] = rl_line_buffer[i];
825 for (i = 0; i < wc_width; i++)
826 CHECK_LPOS();
827
828=== modified file 'configure.in'
829--- configure.in 2009-11-07 15:56:51 +0000
830+++ configure.in 2009-11-14 20:25:27 +0000
831@@ -15,7 +15,11 @@
832 # MySQL version number.
833 #
834 # Note: the following line must be parseable by win/configure.js:GetVersion()
835+<<<<<<< TREE
836 AM_INIT_AUTOMAKE(mysql, 5.1.39-maria-beta)
837+=======
838+AM_INIT_AUTOMAKE(mysql, 5.1.42-mariadb-beta)
839+>>>>>>> MERGE-SOURCE
840 AM_CONFIG_HEADER([include/config.h:config.h.in])
841
842 PROTOCOL_VERSION=10
843@@ -1652,13 +1656,14 @@
844 DEBUG_OPTIMIZE_CXX="-O"
845 OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
846 else
847- DEBUG_CXXFLAGS="-g"
848 DEBUG_OPTIMIZE_CXX=""
849 case $SYSTEM_TYPE in
850 *solaris*)
851+ DEBUG_CXXFLAGS="-g0"
852 OPTIMIZE_CXXFLAGS="-O1"
853 ;;
854 *)
855+ DEBUG_CXXFLAGS="-g"
856 OPTIMIZE_CXXFLAGS="-O"
857 ;;
858 esac
859@@ -1715,6 +1720,23 @@
860 CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
861 fi
862
863+# Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
864+AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
865+AC_ARG_ENABLE(debug_sync,
866+ AS_HELP_STRING([--enable-debug-sync],
867+ [Build a version with Debug Sync Facility]),
868+ [ enable_debug_sync=$enableval ],
869+ [ enable_debug_sync=$with_debug ])
870+
871+if test "$enable_debug_sync" != "no"
872+then
873+ AC_DEFINE([ENABLED_DEBUG_SYNC], [1],
874+ [If Debug Sync Facility should be enabled])
875+ AC_MSG_RESULT([yes])
876+else
877+ AC_MSG_RESULT([no])
878+fi
879+
880 # If we should allow error injection tests
881 AC_ARG_WITH(error-inject,
882 AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
883@@ -2775,7 +2797,7 @@
884
885 dnl This probably should be cleaned up more - for now the threaded
886 dnl client is just using plain-old libs.
887-sql_client_dirs="strings regex mysys libmysql"
888+sql_client_dirs="strings mysys dbug extra regex libmysql unittest"
889
890 AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
891
892@@ -2803,12 +2825,20 @@
893 AC_SUBST(netware_dir)
894 AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
895
896-if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
897+if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
898 then
899 AC_DEFINE([THREAD], [1],
900 [Define if you want to have threaded code. This may be undef on client code])
901+ # Avoid _PROGRAMS names
902+ THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o mf_keycaches.o waiting_threads.o"
903+ AC_SUBST(THREAD_LOBJECTS)
904+fi
905+AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no")
906+
907+if test "$with_server" != "no"
908+then
909 server_scripts="mysqld_safe mysql_install_db"
910- sql_server_dirs="strings mysys dbug extra regex"
911+ sql_server_dirs="strings mysys dbug extra regex storage plugin"
912
913 sql_server="vio sql"
914 fi
915@@ -2834,9 +2864,10 @@
916
917
918 # Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
919-# Start with the (longer) server list, add each client item not yet present.
920-sql_union_dirs=" $sql_server_dirs "
921-for DIR in $sql_client_dirs
922+# We support client-only builds by "--without-server", but not vice versa,
923+# so we start with the client list, then add each server item not yet present.
924+sql_union_dirs=" $sql_client_dirs "
925+for DIR in $sql_server_dirs
926 do
927 if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
928 then
929
930=== modified file 'extra/yassl/include/yassl_int.hpp'
931--- extra/yassl/include/yassl_int.hpp 2009-09-03 13:20:22 +0000
932+++ extra/yassl/include/yassl_int.hpp 2009-11-14 20:25:27 +0000
933@@ -441,7 +441,7 @@
934 const Ciphers& GetCiphers() const;
935 const DH_Parms& GetDH_Parms() const;
936 const Stats& GetStats() const;
937- VerifyCallback getVerifyCallback() const;
938+ VerifyCallback getVerifyCallback() const;
939 pem_password_cb GetPasswordCb() const;
940 void* GetUserData() const;
941 bool GetSessionCacheOff() const;
942
943=== modified file 'extra/yassl/taocrypt/src/random.cpp'
944--- extra/yassl/taocrypt/src/random.cpp 2007-01-29 15:54:40 +0000
945+++ extra/yassl/taocrypt/src/random.cpp 2009-11-14 20:25:27 +0000
946@@ -27,7 +27,6 @@
947 #include <time.h>
948
949 #if defined(_WIN32)
950- #define _WIN32_WINNT 0x0400
951 #include <windows.h>
952 #include <wincrypt.h>
953 #else
954
955=== modified file 'include/my_dbug.h'
956--- include/my_dbug.h 2009-09-07 20:50:10 +0000
957+++ include/my_dbug.h 2009-11-14 20:25:27 +0000
958@@ -1,4 +1,4 @@
959-/* Copyright (C) 2000 MySQL AB
960+/* Copyright (C) 2000 MySQL AB & 2009 Monty Program Ab
961
962 This program is free software; you can redistribute it and/or modify
963 it under the terms of the GNU General Public License as published by
964@@ -16,7 +16,30 @@
965 #ifndef _dbug_h
966 #define _dbug_h
967
968-#ifdef __cplusplus
969+#if defined(__cplusplus) && !defined(DBUG_OFF)
970+class Dbug_violation_helper
971+{
972+public:
973+ inline Dbug_violation_helper() :
974+ _entered(TRUE)
975+ { }
976+
977+ inline ~Dbug_violation_helper()
978+ {
979+ assert(!_entered);
980+ }
981+
982+ inline void leave()
983+ {
984+ _entered= FALSE;
985+ }
986+
987+private:
988+ bool _entered;
989+};
990+#endif /* C++ */
991+
992+#ifdef __cplusplus
993 extern "C" {
994 #endif
995 #if !defined(DBUG_OFF) && !defined(_lint)
996@@ -30,34 +53,51 @@
997
998 struct _db_code_state_;
999 extern my_bool _dbug_on_;
1000-extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
1001+extern my_bool _db_keyword_(struct _db_code_state_ *cs, const char *keyword,
1002+ int strict_flag);
1003+extern int _db_strict_keyword_(const char *keyword);
1004 extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
1005 extern int _db_explain_init_(char *buf, size_t len);
1006 extern int _db_is_pushed_(void);
1007 extern void _db_setjmp_(void);
1008 extern void _db_longjmp_(void);
1009 extern void _db_process_(const char *name);
1010-extern void _db_push_(const char *control);
1011-extern void _db_pop_(void);
1012+extern void _db_push_(const char *control);
1013+extern void _db_pop_(void);
1014 extern void _db_set_(const char *control);
1015 extern void _db_set_init_(const char *control);
1016-extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
1017- struct _db_stack_frame_ *_stack_frame_);
1018+extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
1019+ struct _db_stack_frame_ *_stack_frame_);
1020 extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
1021 extern void _db_pargs_(uint _line_,const char *keyword);
1022 extern void _db_doprnt_ _VARARGS((const char *format,...))
1023 ATTRIBUTE_FORMAT(printf, 1, 2);
1024-extern void _db_dump_(uint _line_,const char *keyword,
1025+extern void _db_dump_(uint _line_,const char *keyword,
1026 const unsigned char *memory, size_t length);
1027-extern void _db_end_(void);
1028-extern void _db_lock_file_(void);
1029-extern void _db_unlock_file_(void);
1030-extern FILE *_db_fp_(void);
1031+extern void _db_end_(void);
1032+extern void _db_lock_file_(void);
1033+extern void _db_unlock_file_(void);
1034+extern FILE *_db_fp_(void);
1035 extern void _db_flush_();
1036
1037-#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
1038- _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
1039-#define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_)
1040+#ifdef __cplusplus
1041+
1042+#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
1043+ Dbug_violation_helper dbug_violation_helper; \
1044+ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
1045+#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
1046+
1047+#else /* C */
1048+
1049+#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
1050+ _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
1051+#define DBUG_VIOLATION_HELPER_LEAVE do { } while(0)
1052+
1053+#endif /* C++ */
1054+
1055+#define DBUG_LEAVE \
1056+ DBUG_VIOLATION_HELPER_LEAVE; \
1057+ _db_return_ (__LINE__, &_db_stack_frame_)
1058 #define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
1059 #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
1060 #define DBUG_EXECUTE(keyword,a1) \
1061@@ -88,28 +128,15 @@
1062 #define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
1063 #define DEBUGGER_ON do { _dbug_on_= 1; } while(0)
1064 #define IF_DBUG(A) A
1065-#ifndef __WIN__
1066 #define DBUG_ABORT() (_db_flush_(), abort())
1067-#else
1068-/*
1069- Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
1070- call abort() instead of _exit(3) (now it would cause a "test signal" popup).
1071-*/
1072-#include <crtdbg.h>
1073-#define DBUG_ABORT() (_db_flush_(),\
1074- (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
1075- (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
1076- _exit(3))
1077-#endif
1078-
1079 #else /* No debugger */
1080
1081 #define DBUG_ENTER(a1)
1082 #define DBUG_LEAVE
1083-#define DBUG_RETURN(a1) do { return(a1); } while(0)
1084-#define DBUG_VOID_RETURN do { return; } while(0)
1085-#define DBUG_EXECUTE(keyword,a1) do { } while(0)
1086-#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
1087+#define DBUG_RETURN(a1) do { return(a1); } while(0)
1088+#define DBUG_VOID_RETURN do { return; } while(0)
1089+#define DBUG_EXECUTE(keyword,a1) do { } while(0)
1090+#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
1091 #define DBUG_EVALUATE(keyword,a1,a2) (a2)
1092 #define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
1093 #define DBUG_PRINT(keyword,arglist) do { } while(0)
1094
1095=== modified file 'include/my_sys.h'
1096--- include/my_sys.h 2009-09-07 20:50:10 +0000
1097+++ include/my_sys.h 2009-11-14 20:25:27 +0000
1098@@ -69,6 +69,7 @@
1099 #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
1100 #define MY_DONT_OVERWRITE_FILE 2048 /* my_copy: Don't overwrite file */
1101 #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
1102+#define MY_SYNC 4096 /* my_copy(): sync dst file */
1103
1104 #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
1105 #define MY_GIVE_INFO 2 /* Give time info about process*/
1106@@ -175,6 +176,16 @@
1107 #define TRASH(A,B) /* nothing */
1108 #endif
1109
1110+#if defined(ENABLED_DEBUG_SYNC)
1111+extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
1112+#define DEBUG_SYNC_C(_sync_point_name_) do { \
1113+ if (debug_sync_C_callback_ptr != NULL) \
1114+ (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \
1115+ while(0)
1116+#else
1117+#define DEBUG_SYNC_C(_sync_point_name_)
1118+#endif /* defined(ENABLED_DEBUG_SYNC) */
1119+
1120 #ifdef HAVE_LARGE_PAGES
1121 extern uint my_get_large_page_size(void);
1122 extern uchar * my_large_malloc(size_t size, myf my_flags);
1123@@ -727,7 +738,6 @@
1124 extern WF_PACK *wf_comp(char * str);
1125 extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
1126 extern void wf_end(struct wild_file_pack *buffer);
1127-extern size_t strip_sp(char * str);
1128 extern my_bool array_append_string_unique(const char *str,
1129 const char **array, size_t size);
1130 extern void get_date(char * to,int timeflag,time_t use_time);
1131
1132=== modified file 'include/myisamchk.h'
1133--- include/myisamchk.h 2009-09-07 20:50:10 +0000
1134+++ include/myisamchk.h 2009-11-14 20:25:27 +0000
1135@@ -154,6 +154,10 @@
1136 char temp_filename[FN_REFLEN];
1137 IO_CACHE read_cache;
1138 enum_handler_stats_method stats_method;
1139+#ifdef THREAD
1140+ pthread_mutex_t print_msg_mutex;
1141+ my_bool need_print_msg_lock;
1142+#endif
1143 } HA_CHECK;
1144
1145
1146
1147=== modified file 'include/mysql.h'
1148--- include/mysql.h 2009-10-02 10:36:28 +0000
1149+++ include/mysql.h 2009-11-14 20:25:27 +0000
1150@@ -558,6 +558,16 @@
1151 char *to,const char *from,
1152 unsigned long length);
1153 void STDCALL mysql_debug(const char *debug);
1154+char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
1155+ char *to,
1156+ unsigned long to_length,
1157+ const char *from,
1158+ unsigned long from_length,
1159+ void *param,
1160+ char *
1161+ (*extend_buffer)
1162+ (void *, char *to,
1163+ unsigned long *length));
1164 void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
1165 unsigned int STDCALL mysql_thread_safe(void);
1166 my_bool STDCALL mysql_embedded(void);
1167
1168=== modified file 'include/mysql.h.pp'
1169--- include/mysql.h.pp 2009-10-02 10:36:28 +0000
1170+++ include/mysql.h.pp 2009-11-14 20:25:27 +0000
1171@@ -518,6 +518,16 @@
1172 char *to,const char *from,
1173 unsigned long length);
1174 void mysql_debug(const char *debug);
1175+char * mysql_odbc_escape_string(MYSQL *mysql,
1176+ char *to,
1177+ unsigned long to_length,
1178+ const char *from,
1179+ unsigned long from_length,
1180+ void *param,
1181+ char *
1182+ (*extend_buffer)
1183+ (void *, char *to,
1184+ unsigned long *length));
1185 void myodbc_remove_escape(MYSQL *mysql,char *name);
1186 unsigned int mysql_thread_safe(void);
1187 my_bool mysql_embedded(void);
1188
1189=== modified file 'include/mysys_err.h'
1190--- include/mysys_err.h 2009-10-26 11:35:42 +0000
1191+++ include/mysys_err.h 2009-11-14 20:25:27 +0000
1192@@ -63,8 +63,9 @@
1193 #define EE_FILENOTFOUND 29
1194 #define EE_FILE_NOT_CLOSED 30
1195 #define EE_CANT_CHMOD 31
1196-#define EE_CANT_COPY_OWNERSHIP 32
1197-#define EE_ERROR_LAST 32 /* Copy last error nr */
1198+#define EE_CANT_SEEK 32
1199+#define EE_CANT_COPY_OWNERSHIP 33
1200+#define EE_ERROR_LAST 33 /* Copy last error nr */
1201 /* Add error numbers before EE_ERROR_LAST and change it accordingly. */
1202
1203 /* exit codes for all MySQL programs */
1204
1205=== modified file 'include/violite.h'
1206--- include/violite.h 2009-09-07 20:50:10 +0000
1207+++ include/violite.h 2009-11-14 20:25:27 +0000
1208@@ -44,7 +44,7 @@
1209 Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
1210 #ifdef __WIN__
1211 Vio* vio_new_win32pipe(HANDLE hPipe);
1212-Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
1213+Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
1214 HANDLE handle_map,
1215 HANDLE event_server_wrote,
1216 HANDLE event_server_read,
1217@@ -222,7 +222,11 @@
1218 HANDLE event_conn_closed;
1219 size_t shared_memory_remain;
1220 char *shared_memory_pos;
1221- NET *net;
1222 #endif /* HAVE_SMEM */
1223+#ifdef _WIN32
1224+ OVERLAPPED pipe_overlapped;
1225+ DWORD read_timeout_millis;
1226+ DWORD write_timeout_millis;
1227+#endif
1228 };
1229 #endif /* vio_violite_h_ */
1230
1231=== modified file 'libmysql/libmysql.c'
1232--- libmysql/libmysql.c 2009-11-06 17:22:32 +0000
1233+++ libmysql/libmysql.c 2009-11-14 20:25:27 +0000
1234@@ -1642,6 +1642,20 @@
1235 return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
1236 }
1237
1238+
1239+char * STDCALL
1240+mysql_odbc_escape_string(MYSQL *mysql __attribute__((unused)),
1241+ char *to __attribute__((unused)),
1242+ ulong to_length __attribute__((unused)),
1243+ const char *from __attribute__((unused)),
1244+ ulong from_length __attribute__((unused)),
1245+ void *param __attribute__((unused)),
1246+ char * (*extend_buffer)(void *, char *, ulong *)
1247+ __attribute__((unused)))
1248+{
1249+ return NULL;
1250+}
1251+
1252 void STDCALL
1253 myodbc_remove_escape(MYSQL *mysql,char *name)
1254 {
1255
1256=== modified file 'libmysql/libmysql.def'
1257--- libmysql/libmysql.def 2009-10-04 22:22:57 +0000
1258+++ libmysql/libmysql.def 2009-11-14 20:25:27 +0000
1259@@ -78,6 +78,7 @@
1260 mysql_next_result
1261 mysql_num_fields
1262 mysql_num_rows
1263+ mysql_odbc_escape_string
1264 mysql_options
1265 mysql_stmt_param_count
1266 mysql_stmt_param_metadata
1267
1268=== modified file 'libmysqld/CMakeLists.txt'
1269--- libmysqld/CMakeLists.txt 2009-10-03 19:24:13 +0000
1270+++ libmysqld/CMakeLists.txt 2009-11-14 20:25:27 +0000
1271@@ -90,8 +90,10 @@
1272 FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
1273 INCLUDE(${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/CMakeLists.txt)
1274 STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
1275+ SET(ENGINE_DIR ${${ENGINE_LIB_UPPER}_DIR})
1276+ INCLUDE(${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/CMakeLists.txt)
1277 FOREACH(rpath ${${ENGINE_LIB_UPPER}_SOURCES})
1278- SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${plugin_dir_${ENGINE_LIB}}/${rpath})
1279+ SET(LIB_SOURCES ${LIB_SOURCES} ${CMAKE_SOURCE_DIR}/storage/${ENGINE_DIR}/${rpath})
1280 ENDFOREACH(rpath)
1281 ENDFOREACH(ENGINE_LIB)
1282
1283@@ -127,6 +129,7 @@
1284 ../sql/sql_list.cc ../sql/sql_load.cc ../sql/sql_locale.cc
1285 ../sql/sql_binlog.cc ../sql/sql_manager.cc ../sql/sql_map.cc
1286 ../sql/sql_parse.cc ../sql/sql_partition.cc ../sql/sql_plugin.cc
1287+ ../sql/debug_sync.cc
1288 ../sql/sql_prepare.cc ../sql/sql_rename.cc ../sql/sql_repl.cc
1289 ../sql/sql_select.cc ../sql/sql_servers.cc
1290 ../sql/sql_show.cc ../sql/sql_state.c ../sql/sql_string.cc
1291@@ -152,6 +155,14 @@
1292 ADD_DEPENDENCIES(mysqlserver GenServerSource GenError)
1293 TARGET_LINK_LIBRARIES(mysqlserver)
1294
1295+# Add any additional libraries requested by engine(s)
1296+FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})
1297+ STRING(TOUPPER ${ENGINE_LIB} ENGINE_LIB_UPPER)
1298+ IF(${ENGINE_LIB_UPPER}_LIBS)
1299+ TARGET_LINK_LIBRARIES(mysqlserver ${${ENGINE_LIB_UPPER}_LIBS})
1300+ ENDIF(${ENGINE_LIB_UPPER}_LIBS)
1301+ENDFOREACH(ENGINE_LIB)
1302+
1303 ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def)
1304 ADD_DEPENDENCIES(libmysqld mysqlserver)
1305 TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32)
1306
1307=== modified file 'libmysqld/Makefile.am'
1308--- libmysqld/Makefile.am 2009-10-30 18:50:56 +0000
1309+++ libmysqld/Makefile.am 2009-11-14 20:25:27 +0000
1310@@ -74,6 +74,7 @@
1311 sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
1312 parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
1313 rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
1314+ debug_sync.cc \
1315 sql_tablespace.cc \
1316 rpl_injector.cc my_user.c partition_info.cc \
1317 sql_servers.cc event_parse_data.cc opt_table_elimination.cc
1318
1319=== modified file 'libmysqld/lib_sql.cc'
1320--- libmysqld/lib_sql.cc 2009-09-07 20:50:10 +0000
1321+++ libmysqld/lib_sql.cc 2009-11-14 20:25:27 +0000
1322@@ -142,6 +142,8 @@
1323 if (!skip_check)
1324 result= thd->is_error() ? -1 : 0;
1325
1326+ thd->mysys_var= 0;
1327+
1328 #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
1329 thd->profiling.finish_current_query();
1330 #endif
1331@@ -634,6 +636,7 @@
1332
1333 thread_count++;
1334 threads.append(thd);
1335+ thd->mysys_var= 0;
1336 return thd;
1337 err:
1338 delete(thd);
1339
1340=== modified file 'libmysqld/libmysqld.c'
1341--- libmysqld/libmysqld.c 2008-02-28 17:55:46 +0000
1342+++ libmysqld/libmysqld.c 2009-11-14 20:25:27 +0000
1343@@ -164,6 +164,7 @@
1344 port=0;
1345 unix_socket=0;
1346
1347+ client_flag|=mysql->options.client_flag;
1348 /* Send client information for access check */
1349 client_flag|=CLIENT_CAPABILITIES;
1350 if (client_flag & CLIENT_MULTI_STATEMENTS)
1351
1352=== modified file 'libmysqld/libmysqld.def'
1353--- libmysqld/libmysqld.def 2009-10-04 22:22:57 +0000
1354+++ libmysqld/libmysqld.def 2009-11-14 20:25:27 +0000
1355@@ -50,6 +50,7 @@
1356 mysql_next_result
1357 mysql_num_fields
1358 mysql_num_rows
1359+ mysql_odbc_escape_string
1360 mysql_options
1361 mysql_ping
1362 mysql_query
1363
1364=== modified file 'mysql-test/collections/README.experimental'
1365--- mysql-test/collections/README.experimental 2009-02-25 14:00:17 +0000
1366+++ mysql-test/collections/README.experimental 2009-11-14 20:25:27 +0000
1367@@ -23,3 +23,10 @@
1368 start with the same characters up to the last letter before the asterisk
1369 are considered experimental:
1370 main.a* # get rid of main.alias, main.alibaba and main.agliolio
1371+
1372+6) Optionally, the test case may be followed by one or more platform
1373+ qualifiers beginning with @ or @!. The test will then be considered
1374+ experimental only/except on that platform. Basic OS names as
1375+ reported by $^O in Perl, or 'windows' are supported, this includes
1376+ solaris, linux, windows, aix, darwin, ... Example:
1377+ main.alias @aix @windows # Fails on those
1378
1379=== modified file 'mysql-test/collections/default.experimental'
1380--- mysql-test/collections/default.experimental 2009-08-13 20:45:01 +0000
1381+++ mysql-test/collections/default.experimental 2009-11-14 20:25:27 +0000
1382@@ -1,6 +1,45 @@
1383+# For easier human reading (MTR doesn't care), please keep entries
1384+# in alphabetical order. This also helps with merge conflict resolution.
1385+
1386+binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
1387+
1388 funcs_1.charset_collation_1 # depends on compile-time decisions
1389-binlog.binlog_tmp_table # Bug#45578: Test binlog_tmp_table fails ramdonly on PB2: Unknown table 't2'
1390-main.ctype_gbk_binlog # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
1391-rpl.rpl_row_create_table # Bug#45576: rpl_row_create_table fails on PB2
1392+funcs_1.is_cml_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1393+funcs_1.is_columns_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1394+funcs_1.is_engines_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1395+funcs_1.is_tables_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1396+funcs_1.ndb* # joro : NDB tests marked as experimental as agreed with bochklin
1397+
1398+funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
1399+
1400+main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
1401+main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
1402+main.plugin_load @solaris # Bug#42144
1403+
1404+ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
1405+
1406+rpl.rpl_cross_version* # Bug #43913 2009-10-26 joro rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
1407+rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31
1408+rpl.rpl_innodb_bug28430* @solaris # Bug#46029
1409+rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2
1410+rpl.rpl_trigger* # Bug#47810 2009-10-04 joro rpl.rpl_trigger.test fails with valgrind errors with the innodb plugin
1411+
1412+rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
1413 rpl_ndb.rpl_ndb_log # Bug#38998
1414-rpl.rpl_innodb_bug28430 # Bug#46029
1415+
1416+stress.ddl_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1417+
1418+parts.ndb_dd_backuprestore # joro : NDB tests marked as experimental as agreed with bochklin
1419+parts.part_supported_sql_func_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1420+parts.partition_alter1_1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1421+parts.partition_alter1_1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1422+parts.partition_alter1_2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1423+parts.partition_auto_increment_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1424+parts.partition_basic_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1425+parts.partition_engine_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1426+parts.partition_int_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1427+parts.partition_mgm_lc0_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1428+parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1429+parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1430+parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1431+parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
1432
1433=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
1434--- mysql-test/extra/binlog_tests/binlog.test 2009-07-14 15:07:29 +0000
1435+++ mysql-test/extra/binlog_tests/binlog.test 2009-11-14 20:25:27 +0000
1436@@ -270,3 +270,42 @@
1437 CREATE TABLE test.t2 SELECT * FROM test.t1;
1438 USE test;
1439 DROP TABLES t1, t2;
1440+
1441+#
1442+# Bug#46640
1443+# This test verifies if the server_id stored in the "format
1444+# description BINLOG statement" will override the server_id
1445+# of the server executing the statements.
1446+#
1447+
1448+connect (fresh,localhost,root,,test);
1449+connection fresh;
1450+
1451+RESET MASTER;
1452+CREATE TABLE t1 (a INT PRIMARY KEY);
1453+
1454+# Format description event, with server_id = 10;
1455+BINLOG '
1456+3u9kSA8KAAAAZgAAAGoAAAABAAQANS4xLjM1LW1hcmlhLWJldGExLWRlYnVnLWxvZwAAAAAAAAAA
1457+AAAAAAAAAAAAAAAAAADe72RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
1458+';
1459+
1460+# What server_id is logged for a statement? Should be our own, not the
1461+# one from the format description event.
1462+INSERT INTO t1 VALUES (1);
1463+
1464+# INSERT INTO t1 VALUES (2), with server_id=20. Check that this is logged
1465+# with our own server id, not the 20 from the BINLOG statement.
1466+BINLOG '
1467+3u9kSBMUAAAAKQAAAJEBAAAAABoAAAAAAAAABHRlc3QAAnQxAAEDAAA=
1468+3u9kSBcUAAAAIgAAALMBAAAQABoAAAAAAAEAAf/+AgAAAA==
1469+';
1470+
1471+# Show binlog events to check that server ids are correct.
1472+--replace_column 1 # 2 # 5 #
1473+--replace_regex /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
1474+SHOW BINLOG EVENTS;
1475+
1476+DROP TABLE t1;
1477+disconnect fresh;
1478+
1479
1480=== added file 'mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test'
1481--- mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test 1970-01-01 00:00:00 +0000
1482+++ mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test 2009-11-14 20:25:27 +0000
1483@@ -0,0 +1,300 @@
1484+################################################################################
1485+# Let
1486+# - B be begin, C commit and R rollback.
1487+# - T a statement that accesses and changes only transactional tables, i.e.
1488+# T-tables
1489+# - N a statement that accesses and changes only non-transactional tables,
1490+# i.e, N-tables.
1491+# - M be a mixed statement, i.e. a statement that updates both T- and
1492+# N-tables.
1493+# - M* be a mixed statement that fails while updating either a T
1494+# or N-table.
1495+# - N* be a statement that fails while updating a N-table.
1496+#
1497+# In this test case, when changes are logged as rows either in the RBR or MIXED
1498+# modes, we check if a M* statement that happens early in a transaction is
1499+# written to the binary log outside the boundaries of the transaction and
1500+# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with
1501+# the master as the rollback will keep the changes on N-tables and undo them on
1502+# T-tables. In particular, we expect the following behavior:
1503+#
1504+# 1. B M* T C would generate in the binlog B M* R B T C.
1505+# 2. B M M* C would generate in the binlog B M M* C.
1506+# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C.
1507+#
1508+# SBR is not considered in this test because a failing statement is written to
1509+# the binary along with the error code such that a slave executes and rolls it
1510+# back, thus undoing the effects on T-tables.
1511+#
1512+# Note that, in the first case, we are not preserving history from the master as
1513+# we are introducing a rollback that never happened. However, this seems to be
1514+# more acceptable than making the slave diverge. In the second case, the slave
1515+# will diverge as the changes on T-tables that originated from the M statement
1516+# are rolled back on the master but not on the slave. Unfortunately, we cannot
1517+# simply roll the transaction back as this would undo any uncommitted changes
1518+# on T-tables.
1519+#
1520+# We check two more cases. First, INSERT...SELECT* which produces the following
1521+# results:
1522+#
1523+# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
1524+# the binlog the following entries: "Nothing".
1525+# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
1526+# the binlog the following entries: B INSERT M...SELECT* R.
1527+#
1528+# Finally, we also check if any N statement that happens early in a transaction
1529+# (i.e. before any T or M statement) is written to the binary log outside the
1530+# boundaries of the transaction. In particular, we expect the following
1531+# behavior:
1532+#
1533+# 1. B N N T C would generate in the binlog B N C B N C B T C.
1534+# 2. B N N T R would generate in the binlog B N C B N C B T R.
1535+# 3. B N* N* T C would generate in the binlog B N R B N R B T C.
1536+# 4. B N* N* T R would generate in the binlog B N R B N R B T R.
1537+# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C.
1538+# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R.
1539+#
1540+# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be
1541+# pushed after the WL#2687.
1542+#
1543+# Please, remove this test case after pushing WL#2687.
1544+################################################################################
1545+
1546+
1547+--echo ###################################################################################
1548+--echo # CONFIGURATION
1549+--echo ###################################################################################
1550+CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
1551+CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
1552+CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
1553+CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
1554+
1555+DELIMITER |;
1556+
1557+CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
1558+BEGIN
1559+ INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
1560+END|
1561+
1562+CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
1563+BEGIN
1564+ INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
1565+END|
1566+
1567+DELIMITER ;|
1568+
1569+--echo ###################################################################################
1570+--echo # CHECK HISTORY IN BINLOG
1571+--echo ###################################################################################
1572+--echo
1573+--echo
1574+--echo
1575+--echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
1576+--echo
1577+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1578+INSERT INTO nt_1 VALUES ("new text 1", 1);
1579+BEGIN;
1580+--error ER_DUP_ENTRY
1581+INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
1582+INSERT INTO tt_2 VALUES ("new text 3", 3);
1583+COMMIT;
1584+--source include/show_binlog_events.inc
1585+
1586+--echo
1587+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1588+INSERT INTO tt_2 VALUES ("new text 4", 4);
1589+BEGIN;
1590+--error ER_DUP_ENTRY
1591+INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
1592+INSERT INTO tt_2 VALUES ("new text 6", 6);
1593+COMMIT;
1594+--source include/show_binlog_events.inc
1595+
1596+--echo
1597+--echo
1598+--echo
1599+--echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
1600+--echo
1601+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1602+INSERT INTO nt_1 VALUES ("new text 10", 10);
1603+BEGIN;
1604+INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
1605+--error ER_DUP_ENTRY
1606+INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
1607+INSERT INTO tt_2 VALUES ("new text 11", 11);
1608+COMMIT;
1609+--source include/show_binlog_events.inc
1610+
1611+--echo
1612+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1613+INSERT INTO tt_2 VALUES ("new text 15", 15);
1614+BEGIN;
1615+INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
1616+--error ER_DUP_ENTRY
1617+INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
1618+INSERT INTO tt_2 VALUES ("new text 16", 16);
1619+COMMIT;
1620+--source include/show_binlog_events.inc
1621+
1622+
1623+--echo
1624+--echo
1625+--echo
1626+--echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
1627+--echo
1628+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1629+INSERT INTO nt_1 VALUES ("new text 18", 18);
1630+INSERT INTO nt_1 VALUES ("new text 20", 20);
1631+BEGIN;
1632+--error ER_DUP_ENTRY
1633+INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
1634+--error ER_DUP_ENTRY
1635+INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
1636+INSERT INTO tt_2 VALUES ("new text 21", 21);
1637+COMMIT;
1638+--source include/show_binlog_events.inc
1639+
1640+--echo
1641+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1642+INSERT INTO tt_2 VALUES ("new text 23", 23);
1643+INSERT INTO tt_2 VALUES ("new text 25", 25);
1644+BEGIN;
1645+--error ER_DUP_ENTRY
1646+INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
1647+--error ER_DUP_ENTRY
1648+INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
1649+INSERT INTO tt_2 VALUES ("new text 26", 26);
1650+COMMIT;
1651+--source include/show_binlog_events.inc
1652+
1653+--echo
1654+--echo
1655+--echo
1656+--echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
1657+--echo *** in the binlog the following entries: "Nothing".
1658+--echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
1659+--echo
1660+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1661+TRUNCATE TABLE nt_2;
1662+TRUNCATE TABLE tt_2;
1663+INSERT INTO tt_2 VALUES ("new text 7", 7);
1664+BEGIN;
1665+INSERT INTO tt_2 VALUES ("new text 27", 27);
1666+--error ER_DUP_ENTRY
1667+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
1668+INSERT INTO tt_2 VALUES ("new text 28", 28);
1669+ROLLBACK;
1670+--source include/show_binlog_events.inc
1671+
1672+--echo
1673+--echo
1674+--echo
1675+--echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
1676+--echo *** in the binlog the following entries: "B INSERT M..SELECT* R".
1677+--echo
1678+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1679+TRUNCATE TABLE nt_2;
1680+TRUNCATE TABLE tt_2;
1681+INSERT INTO tt_2 VALUES ("new text 7", 7);
1682+BEGIN;
1683+--error ER_DUP_ENTRY
1684+INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
1685+COMMIT;
1686+--source include/show_binlog_events.inc
1687+
1688+--echo
1689+--echo
1690+--echo
1691+--echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
1692+--echo
1693+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1694+TRUNCATE TABLE nt_1;
1695+TRUNCATE TABLE tt_2;
1696+BEGIN;
1697+INSERT INTO nt_1 VALUES (USER(), 1);
1698+INSERT INTO nt_1 VALUES (USER(), 2);
1699+INSERT INTO tt_2 VALUES (USER(), 3);
1700+COMMIT;
1701+--source include/show_binlog_events.inc
1702+
1703+--echo
1704+--echo
1705+--echo
1706+--echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
1707+--echo
1708+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1709+BEGIN;
1710+INSERT INTO nt_1 VALUES (USER(), 4);
1711+INSERT INTO nt_1 VALUES (USER(), 5);
1712+INSERT INTO tt_2 VALUES (USER(), 6);
1713+ROLLBACK;
1714+--source include/show_binlog_events.inc
1715+
1716+--echo
1717+--echo
1718+--echo
1719+--echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
1720+--echo
1721+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1722+BEGIN;
1723+--error ER_DUP_ENTRY
1724+INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
1725+--error ER_DUP_ENTRY
1726+INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
1727+INSERT INTO tt_2 VALUES (USER(), 9);
1728+COMMIT;
1729+--source include/show_binlog_events.inc
1730+
1731+--echo
1732+--echo
1733+--echo
1734+--echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
1735+--echo
1736+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1737+BEGIN;
1738+--error ER_DUP_ENTRY
1739+INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
1740+--error ER_DUP_ENTRY
1741+INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
1742+INSERT INTO tt_2 VALUES (USER(), 12);
1743+ROLLBACK;
1744+--source include/show_binlog_events.inc
1745+
1746+--echo
1747+--echo
1748+--echo
1749+--echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
1750+--echo
1751+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1752+BEGIN;
1753+INSERT INTO nt_1 VALUES (USER(), 13);
1754+INSERT INTO nt_1 VALUES (USER(), 14);
1755+INSERT INTO tt_2 VALUES (USER(), 15);
1756+INSERT INTO nt_1 VALUES (USER(), 16);
1757+INSERT INTO tt_2 VALUES (USER(), 17);
1758+COMMIT;
1759+--source include/show_binlog_events.inc
1760+
1761+--echo
1762+--echo
1763+--echo
1764+--echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
1765+--echo
1766+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
1767+BEGIN;
1768+INSERT INTO nt_1 VALUES (USER(), 18);
1769+INSERT INTO nt_1 VALUES (USER(), 19);
1770+INSERT INTO tt_2 VALUES (USER(), 20);
1771+INSERT INTO nt_1 VALUES (USER(), 21);
1772+INSERT INTO tt_2 VALUES (USER(), 22);
1773+ROLLBACK;
1774+--source include/show_binlog_events.inc
1775+
1776+--echo ###################################################################################
1777+--echo # CLEAN
1778+--echo ###################################################################################
1779+
1780+DROP TABLE tt_1;
1781+DROP TABLE tt_2;
1782+DROP TABLE nt_1;
1783+DROP TABLE nt_2;
1784
1785=== modified file 'mysql-test/extra/binlog_tests/drop_temp_table.test'
1786--- mysql-test/extra/binlog_tests/drop_temp_table.test 2007-06-15 16:56:11 +0000
1787+++ mysql-test/extra/binlog_tests/drop_temp_table.test 2009-11-14 20:25:27 +0000
1788@@ -1,27 +1,72 @@
1789
1790 --disable_warnings
1791-drop database if exists `drop-temp+table-test`;
1792+DROP DATABASE IF EXISTS `drop-temp+table-test`;
1793 --enable_warnings
1794
1795 connect (con1,localhost,root,,);
1796 connect (con2,localhost,root,,);
1797 connection con1;
1798-reset master;
1799-create database `drop-temp+table-test`;
1800-use `drop-temp+table-test`;
1801-create temporary table shortn1 (a int);
1802-create temporary table `table:name` (a int);
1803-create temporary table shortn2 (a int);
1804-select get_lock("a",10);
1805+RESET MASTER;
1806+CREATE DATABASE `drop-temp+table-test`;
1807+USE `drop-temp+table-test`;
1808+CREATE TEMPORARY TABLE shortn1 (a INT);
1809+CREATE TEMPORARY TABLE `table:name` (a INT);
1810+CREATE TEMPORARY TABLE shortn2 (a INT);
1811+
1812+##############################################################################
1813+# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
1814+# in ROW mode
1815+#
1816+# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
1817+# matter if the tables exist or not. In contrast, both in SBR and MBR, the
1818+# statement should be always binlogged no matter if the tables exist or not.
1819+##############################################################################
1820+CREATE TEMPORARY TABLE tmp(c1 int);
1821+CREATE TEMPORARY TABLE tmp1(c1 int);
1822+CREATE TEMPORARY TABLE tmp2(c1 int);
1823+CREATE TEMPORARY TABLE tmp3(c1 int);
1824+CREATE TABLE t(c1 int);
1825+
1826+DROP TEMPORARY TABLE IF EXISTS tmp;
1827+
1828+--disable_warnings
1829+# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
1830+# binlogged when the table did not exist in RBR.
1831+DROP TEMPORARY TABLE IF EXISTS tmp;
1832+
1833+# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
1834+# the tables exist or not.
1835+DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
1836+DROP TEMPORARY TABLE tmp3;
1837+
1838+#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
1839+DROP TABLE IF EXISTS tmp2, t;
1840+
1841+#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
1842+# whether it is a temporary table or not.
1843+DROP TABLE IF EXISTS tmp2, t;
1844+--enable_warnings
1845+
1846+SELECT GET_LOCK("a",10);
1847+
1848+#
1849+# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
1850+#
1851+# When the session is closed, any temporary tables of the session are dropped
1852+# and are binlogged. But it will be binlogged with a wrong database name when
1853+# the length of the database name('drop-temp-table-test') is greater than the
1854+# current database name('test').
1855+#
1856+USE test;
1857 disconnect con1;
1858
1859 connection con2;
1860 # We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
1861 # guarantee that logging of the terminated con1 has been done yet.
1862 # To be sure that logging has been done, we use a user lock.
1863-select get_lock("a",10);
1864-let $VERSION=`select version()`;
1865+SELECT GET_LOCK("a",10);
1866+let $VERSION=`SELECT VERSION()`;
1867 source include/show_binlog_events.inc;
1868-drop database `drop-temp+table-test`;
1869+DROP DATABASE `drop-temp+table-test`;
1870
1871 # End of 4.1 tests
1872
1873=== modified file 'mysql-test/extra/rpl_tests/rpl_auto_increment.test'
1874--- mysql-test/extra/rpl_tests/rpl_auto_increment.test 2009-04-08 16:55:26 +0000
1875+++ mysql-test/extra/rpl_tests/rpl_auto_increment.test 2009-11-14 20:25:27 +0000
1876@@ -163,5 +163,81 @@
1877 connection master;
1878 drop table t1;
1879
1880+#
1881+# BUG#45999 Row based replication fails when auto_increment field = 0.
1882+# Store engine of Slaves auto-generates new sequence numbers for
1883+# auto_increment fields if the values of them are 0. There is an inconsistency
1884+# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
1885+#
1886+source include/master-slave-reset.inc;
1887+
1888+connection master;
1889+--disable_warnings
1890+DROP TABLE IF EXISTS t1;
1891+DROP TABLE IF EXISTS t2;
1892+--enable_warnings
1893+
1894+eval CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type;
1895+eval CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=$engine_type2;
1896+SET SQL_MODE='';
1897+# Value of the id will be 1;
1898+INSERT INTO t1 VALUES(NULL);
1899+INSERT INTO t2 VALUES(NULL);
1900+SELECT * FROM t1;
1901+SELECT * FROM t2;
1902+# Value of the id will be 2;
1903+INSERT INTO t1 VALUES();
1904+INSERT INTO t2 VALUES();
1905+SELECT * FROM t1;
1906+SELECT * FROM t2;
1907+# Value of the id will be 3. The master treats 0 as NULL or empty because
1908+# NO_AUTO_VALUE_ON_ZERO is not assign to SQL_MODE.
1909+INSERT INTO t1 VALUES(0);
1910+INSERT INTO t2 VALUES(0);
1911+SELECT * FROM t1;
1912+SELECT * FROM t2;
1913+
1914+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
1915+# Value of the id will be 0. The master does not treat 0 as NULL or empty
1916+# because NO_AUTO_VALUE_ON_ZERO has assigned to SQL_MODE.
1917+INSERT INTO t1 VALUES(0);
1918+INSERT INTO t2 VALUES(0);
1919+SELECT * FROM t1;
1920+SELECT * FROM t2;
1921+
1922+INSERT INTO t1 VALUES(4);
1923+INSERT INTO t2 VALUES(4);
1924+FLUSH LOGS;
1925+sync_slave_with_master;
1926+
1927+let $diff_table_1= master:test.t1;
1928+let $diff_table_2= slave:test.t1;
1929+source include/diff_tables.inc;
1930+
1931+let $diff_table_1= master:test.t2;
1932+let $diff_table_2= slave:test.t2;
1933+source include/diff_tables.inc;
1934+
1935+connection master;
1936+DROP TABLE t1;
1937+DROP TABLE t2;
1938+sync_slave_with_master;
1939+
1940+connection master;
1941+let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
1942+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
1943+sync_slave_with_master;
1944+
1945+let $diff_table_1= master:test.t1;
1946+let $diff_table_2= slave:test.t1;
1947+source include/diff_tables.inc;
1948+
1949+let $diff_table_1= master:test.t2;
1950+let $diff_table_2= slave:test.t2;
1951+source include/diff_tables.inc;
1952+
1953 # End cleanup
1954+DROP TABLE t1;
1955+DROP TABLE t2;
1956+SET SQL_MODE='';
1957 sync_slave_with_master;
1958
1959=== added file 'mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test'
1960--- mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test 1970-01-01 00:00:00 +0000
1961+++ mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test 2009-11-14 20:25:27 +0000
1962@@ -0,0 +1,44 @@
1963+#
1964+# This test verifies if inserting data into view that invokes a
1965+# trigger will make the autoinc values become inconsistent on
1966+# master and slave.
1967+#
1968+connection master;
1969+CREATE TABLE t1(i1 int not null auto_increment, c1 INT, primary key(i1)) engine=innodb;
1970+CREATE TABLE t2(i1 int not null auto_increment, c2 INT, primary key(i1)) engine=innodb;
1971+CREATE TABLE t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
1972+eval create trigger tr16 $insert_action on t1 for each row insert into t3(a) values(new.c1);
1973+eval create trigger tr17 $insert_action on t2 for each row insert into t3(a) values(new.c2);
1974+begin;
1975+INSERT INTO t1(c1) VALUES (11), (12);
1976+INSERT INTO t2(c2) VALUES (13), (14);
1977+
1978+CREATE VIEW v16 AS SELECT c1, c2 FROM t1, t2;
1979+
1980+INSERT INTO v16(c1) VALUES (15),(16);
1981+INSERT INTO v16(c2) VALUES (17),(18);
1982+
1983+connection master1;
1984+INSERT INTO v16(c1) VALUES (19),(20);
1985+INSERT INTO v16(c2) VALUES (21),(22);
1986+
1987+connection master;
1988+INSERT INTO v16(c1) VALUES (23), (24);
1989+INSERT INTO v16(c1) VALUES (25), (26);
1990+commit;
1991+sync_slave_with_master;
1992+--echo #Test if the results are consistent on master and slave
1993+--echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
1994+let $diff_table_1=master:test.t3;
1995+let $diff_table_2=slave:test.t3;
1996+source include/diff_tables.inc;
1997+
1998+connection master;
1999+DROP TABLE t1;
2000+DROP TABLE t2;
2001+DROP TABLE t3;
2002+DROP VIEW v16;
2003+sync_slave_with_master;
2004+
2005+
2006+
2007
2008=== added file 'mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test'
2009--- mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test 1970-01-01 00:00:00 +0000
2010+++ mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test 2009-11-14 20:25:27 +0000
2011@@ -0,0 +1,82 @@
2012+#
2013+# This test verifies if concurrent transactions that invoke a
2014+# trigger that inserts more than one values into one or more
2015+# tables with an auto_increment column will make the autoinc
2016+# values become inconsistent on master and slave.
2017+#
2018+
2019+connection master;
2020+create table t1(a int, b int) engine=innodb;
2021+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
2022+eval create trigger tr1 $trigger_action on t1 for each row insert into t2(a) values(6);
2023+
2024+create table t3(a int, b int) engine=innodb;
2025+create table t4(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
2026+create table t5(a int) engine=innodb;
2027+delimiter |;
2028+eval create trigger tr2 $trigger_action on t3 for each row begin
2029+ insert into t4(a) values(f1_insert_triggered());
2030+ insert into t4(a) values(f1_insert_triggered());
2031+ insert into t5(a) values(8);
2032+end |
2033+delimiter ;|
2034+
2035+create table t6(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
2036+delimiter //;
2037+CREATE FUNCTION f1_insert_triggered() RETURNS INTEGER
2038+BEGIN
2039+ INSERT INTO t6(a) values(2),(3);
2040+ RETURN 1;
2041+END//
2042+delimiter ;//
2043+
2044+begin;
2045+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
2046+insert into t1(a,b) values(1,1),(2,1);
2047+insert into t3(a,b) values(1,1),(2,1);
2048+update t1 set a = a + 5 where b = 1;
2049+update t3 set a = a + 5 where b = 1;
2050+delete from t1 where b = 1;
2051+delete from t3 where b = 1;
2052+
2053+connection master1;
2054+#The default autocommit is set to 1, so the statement is auto committed
2055+insert into t2(a) values(3);
2056+insert into t4(a) values(3);
2057+
2058+connection master;
2059+commit;
2060+insert into t1(a,b) values(4,2);
2061+insert into t3(a,b) values(4,2);
2062+update t1 set a = a + 5 where b = 2;
2063+update t3 set a = a + 5 where b = 2;
2064+delete from t1 where b = 2;
2065+delete from t3 where b = 2;
2066+--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
2067+source include/show_binlog_events.inc;
2068+commit;
2069+
2070+connection master;
2071+sync_slave_with_master;
2072+--echo #Test if the results are consistent on master and slave
2073+--echo #for 'INVOKES A TRIGGER with $trigger_action action'
2074+let $diff_table_1=master:test.t2;
2075+let $diff_table_2=slave:test.t2;
2076+source include/diff_tables.inc;
2077+let $diff_table_1=master:test.t4;
2078+let $diff_table_2=slave:test.t4;
2079+source include/diff_tables.inc;
2080+let $diff_table_1=master:test.t6;
2081+let $diff_table_2=slave:test.t6;
2082+source include/diff_tables.inc;
2083+
2084+connection master;
2085+DROP TABLE t1;
2086+DROP TABLE t2;
2087+DROP TABLE t3;
2088+DROP TABLE t4;
2089+DROP TABLE t5;
2090+DROP TABLE t6;
2091+DROP FUNCTION f1_insert_triggered;
2092+sync_slave_with_master;
2093+
2094
2095=== added file 'mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test'
2096--- mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test 1970-01-01 00:00:00 +0000
2097+++ mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test 2009-11-14 20:25:27 +0000
2098@@ -0,0 +1,57 @@
2099+#
2100+# This test verifies if concurrent transactions that call a
2101+# function which invokes a 'after/before insert action' trigger
2102+# that inserts more than one values into a table with autoinc
2103+# column will make the autoinc values become inconsistent on
2104+# master and slave.
2105+#
2106+
2107+connection master;
2108+create table t1(a int) engine=innodb;
2109+create table t2(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
2110+create table t3(i1 int not null auto_increment, a int, primary key(i1)) engine=innodb;
2111+delimiter |;
2112+CREATE FUNCTION f1_two_inserts_trigger() RETURNS INTEGER
2113+BEGIN
2114+ INSERT INTO t2(a) values(2),(3);
2115+ INSERT INTO t2(a) values(2),(3);
2116+ RETURN 1;
2117+END |
2118+eval create trigger tr11 $insert_action on t2 for each row begin
2119+ insert into t3(a) values(new.a);
2120+ insert into t3(a) values(new.a);
2121+end |
2122+delimiter ;|
2123+begin;
2124+let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
2125+insert into t1(a) values(f1_two_inserts_trigger());
2126+
2127+connection master1;
2128+#The default autocommit is set to 1, so the statement is auto committed
2129+insert into t2(a) values(4),(5);
2130+
2131+connection master;
2132+commit;
2133+insert into t1(a) values(f1_two_inserts_trigger());
2134+--echo # To verify if insert/update in an autoinc column causes statement to be logged in row format
2135+source include/show_binlog_events.inc;
2136+commit;
2137+
2138+connection master;
2139+sync_slave_with_master;
2140+--echo #Test if the results are consistent on master and slave
2141+--echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action'
2142+let $diff_table_1=master:test.t2;
2143+let $diff_table_2=slave:test.t2;
2144+source include/diff_tables.inc;
2145+let $diff_table_1=master:test.t3;
2146+let $diff_table_2=slave:test.t3;
2147+source include/diff_tables.inc;
2148+
2149+connection master;
2150+drop table t1;
2151+drop table t2;
2152+drop table t3;
2153+drop function f1_two_inserts_trigger;
2154+sync_slave_with_master;
2155+
2156
2157=== modified file 'mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test'
2158--- mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2008-07-10 16:09:39 +0000
2159+++ mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test 2009-11-14 20:25:27 +0000
2160@@ -22,6 +22,8 @@
2161 # should stop the slave. #
2162 #################################################
2163
2164+call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051");
2165+
2166 --echo **** Diff Table Def Start ****
2167
2168 ##############################################
2169
2170=== modified file 'mysql-test/extra/rpl_tests/rpl_failed_optimize.test'
2171--- mysql-test/extra/rpl_tests/rpl_failed_optimize.test 2006-05-05 17:08:40 +0000
2172+++ mysql-test/extra/rpl_tests/rpl_failed_optimize.test 2009-11-14 20:25:27 +0000
2173@@ -22,3 +22,4 @@
2174 select * from t1;
2175 commit;
2176 drop table t1;
2177+-- sync_slave_with_master
2178
2179=== modified file 'mysql-test/extra/rpl_tests/rpl_loaddata.test'
2180--- mysql-test/extra/rpl_tests/rpl_loaddata.test 2008-11-13 19:19:00 +0000
2181+++ mysql-test/extra/rpl_tests/rpl_loaddata.test 2009-11-14 20:25:27 +0000
2182@@ -158,4 +158,65 @@
2183
2184 DROP TABLE IF EXISTS t1;
2185
2186+# BUG#48297: Schema name is ignored when LOAD DATA is written into binlog,
2187+# replication aborts
2188+-- source include/master-slave-reset.inc
2189+
2190+-- let $db1= b48297_db1
2191+-- let $db2= b42897_db2
2192+
2193+-- connection master
2194+
2195+-- disable_warnings
2196+-- eval drop database if exists $db1
2197+-- eval drop database if exists $db2
2198+-- enable_warnings
2199+
2200+-- eval create database $db1
2201+-- eval create database $db2
2202+
2203+-- eval use $db1
2204+-- eval CREATE TABLE t1 (c1 VARCHAR(256)) engine=$engine_type;
2205+
2206+-- eval use $db2
2207+
2208+-- echo ### assertion: works with cross-referenced database
2209+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2210+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
2211+
2212+-- eval use $db1
2213+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2214+-- echo ### assertion: works with fully qualified name on current database
2215+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2216+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
2217+
2218+-- echo ### assertion: works without fully qualified name on current database
2219+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2220+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
2221+
2222+-- echo ### create connection without default database
2223+-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
2224+connect (conn2,localhost,root,,*NO-ONE*);
2225+-- connection conn2
2226+-- echo ### assertion: works without stating the default database
2227+-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
2228+-- eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
2229+-- echo ### disconnect and switch back to master connection
2230+-- disconnect conn2
2231+-- connection master
2232+
2233+-- sync_slave_with_master
2234+-- eval use $db1
2235+
2236+let $diff_table_1=master:$db1.t1;
2237+let $diff_table_2=slave:$db1.t1;
2238+source include/diff_tables.inc;
2239+
2240+-- connection master
2241+
2242+-- eval DROP DATABASE $db1
2243+-- eval DROP DATABASE $db2
2244+
2245+-- sync_slave_with_master
2246+
2247 # End of 4.1 tests
2248
2249=== modified file 'mysql-test/extra/rpl_tests/rpl_row_sp006.test'
2250--- mysql-test/extra/rpl_tests/rpl_row_sp006.test 2007-06-18 13:36:10 +0000
2251+++ mysql-test/extra/rpl_tests/rpl_row_sp006.test 2009-11-14 20:25:27 +0000
2252@@ -9,29 +9,27 @@
2253 #############################################################################
2254
2255 # Begin clean up test section
2256-connection master;
2257 --disable_warnings
2258-create database if not exists mysqltest1;
2259-DROP PROCEDURE IF EXISTS mysqltest1.p1;
2260-DROP PROCEDURE IF EXISTS mysqltest1.p2;
2261-DROP TABLE IF EXISTS mysqltest1.t2;
2262-DROP TABLE IF EXISTS mysqltest1.t1;
2263+DROP TABLE IF EXISTS t1;
2264+DROP TABLE IF EXISTS t2;
2265+DROP PROCEDURE IF EXISTS p1;
2266+DROP PROCEDURE IF EXISTS p2;
2267 --enable_warnings
2268 # End of cleanup
2269
2270 # Begin test section 1
2271-eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
2272-eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
2273+eval CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
2274+eval CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
2275
2276 delimiter |;
2277-CREATE PROCEDURE mysqltest1.p1()
2278+CREATE PROCEDURE p1()
2279 BEGIN
2280 DECLARE done INT DEFAULT 0;
2281 DECLARE spa CHAR(16);
2282 DECLARE spb INT;
2283 DECLARE cur1 CURSOR FOR SELECT name,
2284 (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
2285- FROM mysqltest1.t1;
2286+ FROM t1;
2287 DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
2288
2289 OPEN cur1;
2290@@ -41,7 +39,7 @@
2291 FETCH cur1 INTO spa, spb;
2292 IF NOT done THEN
2293 START TRANSACTION;
2294- INSERT INTO mysqltest1.t2 VALUES (spa,spb);
2295+ INSERT INTO t2 VALUES (spa,spb);
2296 COMMIT;
2297 END IF;
2298 UNTIL done END REPEAT;
2299@@ -49,30 +47,29 @@
2300 SET AUTOCOMMIT=1;
2301 CLOSE cur1;
2302 END|
2303-CREATE PROCEDURE mysqltest1.p2()
2304+CREATE PROCEDURE p2()
2305 BEGIN
2306- INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
2307+ INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
2308 END|
2309 delimiter ;|
2310
2311-CALL mysqltest1.p2();
2312-sync_slave_with_master;
2313-
2314-connection master;
2315-CALL mysqltest1.p1();
2316-sync_slave_with_master;
2317-
2318-connection master;
2319-
2320---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
2321---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
2322-
2323-
2324-DROP PROCEDURE IF EXISTS mysqltest1.p1;
2325-DROP PROCEDURE IF EXISTS mysqltest1.p2;
2326-DROP TABLE IF EXISTS mysqltest1.t1;
2327-DROP TABLE IF EXISTS mysqltest1.t2;
2328-DROP DATABASE mysqltest1;
2329+CALL p2();
2330+sync_slave_with_master;
2331+
2332+connection master;
2333+CALL p1();
2334+sync_slave_with_master;
2335+
2336+connection master;
2337+
2338+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
2339+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
2340+
2341+
2342+DROP TABLE t1;
2343+DROP TABLE t2;
2344+DROP PROCEDURE p1;
2345+DROP PROCEDURE p2;
2346
2347 # Lets compare. Note: If they match test will pass, if they do not match
2348 # the test will show that the diff statement failed and not reject file
2349
2350=== modified file 'mysql-test/extra/rpl_tests/rpl_stm_000001.test'
2351--- mysql-test/extra/rpl_tests/rpl_stm_000001.test 2007-12-12 17:19:24 +0000
2352+++ mysql-test/extra/rpl_tests/rpl_stm_000001.test 2009-11-14 20:25:27 +0000
2353@@ -93,7 +93,7 @@
2354 # We don't drop t3 as this is a temporary table
2355 drop table t2;
2356 connection master;
2357---error 1053,2013
2358+--error 1317,2013
2359 reap;
2360 connection slave;
2361 # The SQL slave thread should now have stopped because the query was killed on
2362
2363=== modified file 'mysql-test/include/check-warnings.test'
2364--- mysql-test/include/check-warnings.test 2009-04-25 09:04:38 +0000
2365+++ mysql-test/include/check-warnings.test 2009-11-14 20:25:27 +0000
2366@@ -58,5 +58,5 @@
2367 skip OK;
2368 }
2369 --enable_query_log
2370-echo ^ Found warnings!!;
2371+echo ^ Found warnings in $log_error;
2372 exit;
2373
2374=== modified file 'mysql-test/include/concurrent.inc'
2375--- mysql-test/include/concurrent.inc 2009-09-15 06:08:54 +0000
2376+++ mysql-test/include/concurrent.inc 2009-11-14 20:25:27 +0000
2377@@ -25,8 +25,6 @@
2378 # new wrapper t/concurrent_innodb_safelog.test
2379 #
2380
2381---source include/not_embedded.inc
2382-
2383 connection default;
2384 #
2385 # Show prerequisites for this test.
2386
2387=== added file 'mysql-test/include/have_case_insensitive_fs.inc'
2388--- mysql-test/include/have_case_insensitive_fs.inc 1970-01-01 00:00:00 +0000
2389+++ mysql-test/include/have_case_insensitive_fs.inc 2009-11-14 20:25:27 +0000
2390@@ -0,0 +1,4 @@
2391+--require r/case_insensitive_fs.require
2392+--disable_query_log
2393+show variables like 'lower_case_file_system';
2394+--enable_query_log
2395
2396=== added file 'mysql-test/include/have_debug_sync.inc'
2397--- mysql-test/include/have_debug_sync.inc 1970-01-01 00:00:00 +0000
2398+++ mysql-test/include/have_debug_sync.inc 2009-11-14 20:25:27 +0000
2399@@ -0,0 +1,5 @@
2400+--require r/have_debug_sync.require
2401+disable_query_log;
2402+let $value= query_get_value(SHOW VARIABLES LIKE 'debug_sync', Value, 1);
2403+eval SELECT ('$value' LIKE 'ON %') AS debug_sync;
2404+enable_query_log;
2405
2406=== added file 'mysql-test/include/have_dynamic_loading.inc'
2407--- mysql-test/include/have_dynamic_loading.inc 1970-01-01 00:00:00 +0000
2408+++ mysql-test/include/have_dynamic_loading.inc 2009-11-14 20:25:27 +0000
2409@@ -0,0 +1,7 @@
2410+#
2411+# Whether server supports dynamic loading.
2412+#
2413+--require r/have_dynamic_loading.require
2414+disable_query_log;
2415+show variables like 'have_dynamic_loading';
2416+enable_query_log;
2417
2418=== removed file 'mysql-test/include/have_dynamic_loading.inc'
2419--- mysql-test/include/have_dynamic_loading.inc 2009-05-22 17:53:25 +0000
2420+++ mysql-test/include/have_dynamic_loading.inc 1970-01-01 00:00:00 +0000
2421@@ -1,4 +0,0 @@
2422--- require r/have_dynamic_loading.require
2423-disable_query_log;
2424-show variables like 'have_dynamic_loading';
2425-enable_query_log;
2426
2427=== modified file 'mysql-test/include/have_example_plugin.inc'
2428--- mysql-test/include/have_example_plugin.inc 2008-07-04 18:48:25 +0000
2429+++ mysql-test/include/have_example_plugin.inc 2009-11-14 20:25:27 +0000
2430@@ -2,10 +2,7 @@
2431 # Check if server has support for loading udf's
2432 # i.e it will support dlopen
2433 #
2434---require r/have_dynamic_loading.require
2435-disable_query_log;
2436-show variables like 'have_dynamic_loading';
2437-enable_query_log;
2438+--source include/have_dynamic_loading.inc
2439
2440 #
2441 # Check if the variable EXAMPLE_PLUGIN is set
2442
2443=== added file 'mysql-test/include/have_mysql_upgrade.inc'
2444--- mysql-test/include/have_mysql_upgrade.inc 1970-01-01 00:00:00 +0000
2445+++ mysql-test/include/have_mysql_upgrade.inc 2009-11-14 20:25:27 +0000
2446@@ -0,0 +1,4 @@
2447+--require r/have_mysql_upgrade.result
2448+--disable_query_log
2449+select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
2450+--enable_query_log
2451
2452=== added file 'mysql-test/include/have_not_innodb_plugin.inc'
2453--- mysql-test/include/have_not_innodb_plugin.inc 1970-01-01 00:00:00 +0000
2454+++ mysql-test/include/have_not_innodb_plugin.inc 2009-11-14 20:25:27 +0000
2455@@ -0,0 +1,4 @@
2456+disable_query_log;
2457+--require r/not_true.require
2458+select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
2459+enable_query_log;
2460
2461=== modified file 'mysql-test/include/have_simple_parser.inc'
2462--- mysql-test/include/have_simple_parser.inc 2008-12-17 13:24:34 +0000
2463+++ mysql-test/include/have_simple_parser.inc 2009-11-14 20:25:27 +0000
2464@@ -2,10 +2,7 @@
2465 # Check if server has support for loading udf's
2466 # i.e it will support dlopen
2467 #
2468---require r/have_dynamic_loading.require
2469-disable_query_log;
2470-show variables like 'have_dynamic_loading';
2471-enable_query_log;
2472+--source include/have_dynamic_loading.inc
2473
2474 #
2475 # Check if the variable SIMPLE_PARSER is set
2476
2477=== modified file 'mysql-test/include/have_udf.inc'
2478--- mysql-test/include/have_udf.inc 2008-07-04 18:48:25 +0000
2479+++ mysql-test/include/have_udf.inc 2009-11-14 20:25:27 +0000
2480@@ -2,10 +2,7 @@
2481 # Check if server has support for loading udf's
2482 # i.e it will support dlopen
2483 #
2484---require r/have_dynamic_loading.require
2485-disable_query_log;
2486-show variables like 'have_dynamic_loading';
2487-enable_query_log;
2488+--source include/have_dynamic_loading.inc
2489
2490 #
2491 # Check if the variable UDF_EXAMPLE_LIB is set
2492
2493=== modified file 'mysql-test/include/mix1.inc'
2494--- mysql-test/include/mix1.inc 2009-09-15 06:08:54 +0000
2495+++ mysql-test/include/mix1.inc 2009-11-14 20:25:27 +0000
2496@@ -442,6 +442,8 @@
2497 EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
2498 SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
2499 DELETE FROM t1;
2500+--echo # Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746).
2501+--replace_column 9 #
2502 EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
2503 SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
2504
2505
2506=== modified file 'mysql-test/include/mtr_warnings.sql'
2507--- mysql-test/include/mtr_warnings.sql 2009-09-07 20:50:10 +0000
2508+++ mysql-test/include/mtr_warnings.sql 2009-11-14 20:25:27 +0000
2509@@ -132,7 +132,7 @@
2510
2511 ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
2512
2513- ("Statement is not safe to log in statement format"),
2514+ ("Statement may not be safe to log in statement format"),
2515
2516 /* test case for Bug#bug29807 copies a stray frm into database */
2517 ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
2518@@ -162,6 +162,8 @@
2519 ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
2520 ("Slave: Can't DROP 'c7'.* 1091"),
2521 ("Slave: Key column 'c6'.* 1072"),
2522+ ("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
2523+ (".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
2524
2525 /* Test case for Bug#31590 in order_by.test produces the following error */
2526 ("Out of sort memory; increase server sort buffer size"),
2527@@ -171,6 +173,7 @@
2528 this error message.
2529 */
2530 ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
2531+ ("Slave: Unknown table 't1' Error_code: 1051"),
2532
2533 /* maria-recovery.test has warning about missing log file */
2534 ("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"),
2535@@ -217,7 +220,7 @@
2536 WHERE suspicious=1;
2537
2538 IF @num_warnings > 0 THEN
2539- SELECT file_name, line
2540+ SELECT line
2541 FROM error_log WHERE suspicious=1;
2542 --SELECT * FROM test_suppressions;
2543 -- Return 2 -> check failed
2544
2545=== added file 'mysql-test/include/not_windows_embedded.inc'
2546--- mysql-test/include/not_windows_embedded.inc 1970-01-01 00:00:00 +0000
2547+++ mysql-test/include/not_windows_embedded.inc 2009-11-14 20:25:27 +0000
2548@@ -0,0 +1,11 @@
2549+let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
2550+let $is_embedded = `select version() like '%embedded%'`;
2551+#echo is_win: $is_win;
2552+#echo is_embedded: $is_embedded;
2553+if ($is_win)
2554+{
2555+ if ($is_embedded)
2556+ {
2557+ skip Not supported with embedded on windows;
2558+ }
2559+}
2560
2561=== modified file 'mysql-test/lib/My/ConfigFactory.pm'
2562--- mysql-test/lib/My/ConfigFactory.pm 2009-10-07 22:57:43 +0000
2563+++ mysql-test/lib/My/ConfigFactory.pm 2009-11-14 20:25:27 +0000
2564@@ -7,6 +7,7 @@
2565
2566 use My::Config;
2567 use My::Find;
2568+use My::Platform;
2569
2570 use File::Basename;
2571
2572@@ -207,8 +208,8 @@
2573 { '#log-error' => \&fix_log_error },
2574 { 'general-log' => sub { return 1; } },
2575 { 'general-log-file' => \&fix_log },
2576+ { 'slow-query-log' => sub { return 1; } },
2577 { 'slow-query-log-file' => \&fix_log_slow_queries },
2578- { 'slow-query-log' => sub { return 1; } },
2579 { '#user' => sub { return shift->{ARGS}->{user} || ""; } },
2580 { '#password' => sub { return shift->{ARGS}->{password} || ""; } },
2581 { 'server-id' => \&fix_server_id, },
2582@@ -219,7 +220,13 @@
2583 { 'ssl-key' => \&fix_ssl_server_key },
2584 );
2585
2586-
2587+if (IS_WINDOWS)
2588+{
2589+ # For simplicity, we use the same names for shared memory and
2590+ # named pipes.
2591+ push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket});
2592+}
2593+
2594 sub fix_ndb_mgmd_port {
2595 my ($self, $config, $group_name, $group)= @_;
2596 my $hostname= $group->value('HostName');
2597@@ -348,6 +355,16 @@
2598 }
2599 $config->insert($client_group_name, $name_to, $option->value())
2600 }
2601+
2602+ if (IS_WINDOWS)
2603+ {
2604+ # Shared memory base may or may not be defined (e.g not defined in embedded)
2605+ my $shm = $group_to_copy_from->option("shared-memory-base-name");
2606+ if (defined $shm)
2607+ {
2608+ $config->insert($client_group_name,"shared-memory-base-name", $shm->value());
2609+ }
2610+ }
2611 }
2612
2613
2614@@ -394,6 +411,7 @@
2615 (
2616 '#log-error', # Embedded server writes stderr to mysqltest's log file
2617 'slave-net-timeout', # Embedded server are not build with replication
2618+ 'shared-memory-base-name', # No shared memory for embedded
2619 );
2620
2621 foreach my $option ( $mysqld->options(), $first_mysqld->options() ) {
2622
2623=== modified file 'mysql-test/lib/My/Platform.pm'
2624--- mysql-test/lib/My/Platform.pm 2009-02-25 09:32:13 +0000
2625+++ mysql-test/lib/My/Platform.pm 2009-11-14 20:25:27 +0000
2626@@ -106,10 +106,13 @@
2627 my ($path)= @_;
2628
2629 return 0 if IS_WINDOWS;
2630+ # This may not be true, but we can't test for it on AIX due to Perl bug
2631+ # See Bug #45771
2632+ return 0 if ($^O eq 'aix');
2633
2634 require IO::Socket::UNIX;
2635
2636- my $truncated= 1; # Be negative
2637+ my $truncated= undef;
2638
2639 # Create a tempfile name with same length as "path"
2640 my $tmpdir = tempdir( CLEANUP => 0);
2641@@ -122,6 +125,7 @@
2642 Local => $testfile,
2643 Listen => 1,
2644 );
2645+ $truncated= 1; # Be negatvie
2646
2647 die "Could not create UNIX domain socket: $!"
2648 unless defined $sock;
2649@@ -133,6 +137,9 @@
2650
2651 };
2652
2653+ die "Unexpected failure when checking socket path length: $@"
2654+ if $@ and not defined $truncated;
2655+
2656 $sock= undef; # Close socket
2657 rmtree($tmpdir); # Remove the tempdir and any socket file created
2658 return $truncated;
2659
2660=== modified file 'mysql-test/lib/My/SafeProcess/safe_kill_win.cc'
2661--- mysql-test/lib/My/SafeProcess/safe_kill_win.cc 2008-10-08 20:02:32 +0000
2662+++ mysql-test/lib/My/SafeProcess/safe_kill_win.cc 2009-11-14 20:25:27 +0000
2663@@ -30,7 +30,7 @@
2664 DWORD pid= -1;
2665 HANDLE shutdown_event;
2666 char safe_process_name[32]= {0};
2667- int retry_open_event= 100;
2668+ int retry_open_event= 2;
2669 /* Ignore any signals */
2670 signal(SIGINT, SIG_IGN);
2671 signal(SIGBREAK, SIG_IGN);
2672@@ -51,15 +51,31 @@
2673 {
2674 /*
2675 Check if the process is alive, otherwise there is really
2676- no idea to retry the open of the event
2677+ no sense to retry the open of the event
2678 */
2679 HANDLE process;
2680- if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL)
2681- {
2682- fprintf(stderr, "Could not open event or process %d, error: %d\n",
2683- pid, GetLastError());
2684- exit(3);
2685- }
2686+ DWORD exit_code;
2687+ process= OpenProcess(SYNCHRONIZE| PROCESS_QUERY_INFORMATION, FALSE, pid);
2688+ if (!process)
2689+ {
2690+ /* Already died */
2691+ exit(1);
2692+ }
2693+
2694+ if (!GetExitCodeProcess(process,&exit_code))
2695+ {
2696+ fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
2697+ pid, GetLastError());
2698+ exit(1);
2699+ }
2700+
2701+ if (exit_code != STILL_ACTIVE)
2702+ {
2703+ /* Already died */
2704+ CloseHandle(process);
2705+ exit(2);
2706+ }
2707+
2708 CloseHandle(process);
2709
2710 if (retry_open_event--)
2711
2712=== modified file 'mysql-test/lib/My/SafeProcess/safe_process_win.cc'
2713--- mysql-test/lib/My/SafeProcess/safe_process_win.cc 2009-09-17 22:46:10 +0000
2714+++ mysql-test/lib/My/SafeProcess/safe_process_win.cc 2009-11-14 20:25:27 +0000
2715@@ -50,9 +50,6 @@
2716 is killed.
2717 */
2718
2719-/* Requires Windows 2000 or higher */
2720-#define _WIN32_WINNT 0x0500
2721-
2722 #include <windows.h>
2723 #include <stdio.h>
2724 #include <tlhelp32.h>
2725@@ -189,7 +186,14 @@
2726 die("No real args -> nothing to do");
2727 /* Copy the remaining args to child_arg */
2728 for (int j= i+1; j < argc; j++) {
2729- to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]);
2730+ if (strchr (argv[j], ' ')) {
2731+ /* Protect with "" if this arg contains a space */
2732+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
2733+ "\"%s\" ", argv[j]);
2734+ } else {
2735+ to+= _snprintf(to, child_args + sizeof(child_args) - to,
2736+ "%s ", argv[j]);
2737+ }
2738 }
2739 break;
2740 } else {
2741
2742=== modified file 'mysql-test/lib/mtr_cases.pm'
2743--- mysql-test/lib/mtr_cases.pm 2009-11-06 17:24:38 +0000
2744+++ mysql-test/lib/mtr_cases.pm 2009-11-14 20:25:27 +0000
2745@@ -41,6 +41,7 @@
2746 our $defaults_file;
2747 our $defaults_extra_file;
2748 our $reorder= 1;
2749+our $quick_collect;
2750
2751 sub collect_option {
2752 my ($opt, $value)= @_;
2753@@ -68,6 +69,13 @@
2754 my $do_test_reg;
2755 my $skip_test_reg;
2756
2757+# Related to adding InnoDB plugin combinations
2758+my $lib_innodb_plugin;
2759+my $do_innodb_plugin;
2760+
2761+# If "Quick collect", set to 1 once a test to run has been found.
2762+my $some_test_found;
2763+
2764 sub init_pattern {
2765 my ($from, $what)= @_;
2766 return undef unless defined $from;
2767@@ -100,10 +108,23 @@
2768 $do_test_reg= init_pattern($do_test, "--do-test");
2769 $skip_test_reg= init_pattern($skip_test, "--skip-test");
2770
2771+ $lib_innodb_plugin=
2772+ my_find_file($::basedir,
2773+ ["storage/innodb_plugin", "storage/innodb_plugin/.libs",
2774+ "lib/mysql/plugin", "lib/mariadb/plugin", "lib/plugin"],
2775+ ["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
2776+ "ha_innodb_plugin.sl"],
2777+ NOT_REQUIRED);
2778+
2779+ $do_innodb_plugin= ($::mysql_version_id >= 50100 &&
2780+ !(IS_WINDOWS && $::opt_embedded_server) &&
2781+ $lib_innodb_plugin);
2782+
2783 foreach my $suite (split(",", $suites))
2784 {
2785 push(@$cases, collect_one_suite($suite, $opt_cases));
2786 $found_suites{$suite}= 1;
2787+ last if $some_test_found;
2788 }
2789
2790 if ( @$opt_cases )
2791@@ -147,7 +168,7 @@
2792 }
2793 }
2794
2795- if ( $reorder )
2796+ if ( $reorder && !$quick_collect)
2797 {
2798 # Reorder the test cases in an order that will make them faster to run
2799 my %sort_criteria;
2800@@ -398,7 +419,7 @@
2801 # Read combinations for this suite and build testcases x combinations
2802 # if any combinations exists
2803 # ----------------------------------------------------------------------
2804- if ( ! $skip_combinations )
2805+ if ( ! $skip_combinations && ! $quick_collect )
2806 {
2807 my @combinations;
2808 my $combination_file= "$suitedir/combinations";
2809@@ -491,21 +512,16 @@
2810 # ----------------------------------------------------------------------
2811 # Testing InnoDB plugin.
2812 # ----------------------------------------------------------------------
2813- my $lib_innodb_plugin=
2814- mtr_file_exists(::vs_config_dirs('storage/innodb_plugin', 'ha_innodb_plugin.dll'),
2815- "$::basedir/storage/innodb_plugin/.libs/ha_innodb_plugin.so",
2816- "$::basedir/lib/mariadb/plugin/ha_innodb_plugin.so",
2817- "$::basedir/lib/mariadb/plugin/ha_innodb_plugin.dll",
2818- "$::basedir/lib/mysql/plugin/ha_innodb_plugin.so",
2819- "$::basedir/lib/mysql/plugin/ha_innodb_plugin.dll");
2820- if ($::mysql_version_id >= 50100 && !(IS_WINDOWS && $::opt_embedded_server) &&
2821- $lib_innodb_plugin)
2822+ if ($do_innodb_plugin)
2823 {
2824 my @new_cases;
2825+ my $sep= (IS_WINDOWS) ? ';' : ':';
2826
2827 foreach my $test (@cases)
2828 {
2829- next if ($test->{'skip'} || !$test->{'innodb_test'});
2830+ next if (!$test->{'innodb_test'});
2831+ # If skipped due to no builtin innodb, we can still run it with plugin
2832+ next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
2833 # Exceptions
2834 next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
2835 next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
2836@@ -515,6 +531,8 @@
2837 next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
2838 # Diff around innodb_thread_concurrency variable
2839 next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
2840+ # Can't work with InnoPlug. Test framework needs to be re-designed.
2841+ next if ($test->{'name'} eq 'main.innodb_bug46000');
2842 # Copy test options
2843 my $new_test= My::Test->new();
2844 while (my ($key, $value) = each(%$test))
2845@@ -525,23 +543,24 @@
2846 }
2847 else
2848 {
2849- $new_test->{$key}= $value;
2850+ $new_test->{$key}= $value unless ($key eq 'skip');
2851 }
2852 }
2853 my $plugin_filename= basename($lib_innodb_plugin);
2854+ my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
2855 push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
2856 push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
2857- push(@{$new_test->{master_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
2858+ push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
2859 push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
2860 push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
2861- push(@{$new_test->{slave_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename");
2862+ push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
2863 if ($new_test->{combination})
2864 {
2865- $new_test->{combination}.= ' + InnoDB plugin';
2866+ $new_test->{combination}.= '+innodb_plugin';
2867 }
2868 else
2869 {
2870- $new_test->{combination}= 'InnoDB plugin';
2871+ $new_test->{combination}= 'innodb_plugin';
2872 }
2873 push(@new_cases, $new_test);
2874 }
2875@@ -670,34 +689,10 @@
2876 }
2877 }
2878
2879- # =======================================================
2880- # Check that engine selected by
2881- # --default-storage-engine=<engine> is supported
2882- # =======================================================
2883- my %builtin_engines = ('myisam' => 1, 'memory' => 1);
2884-
2885- foreach my $opt ( @{$tinfo->{master_opt}} ) {
2886- my $default_engine=
2887- mtr_match_prefix($opt, "--default-storage-engine=");
2888-
2889- if (defined $default_engine){
2890-
2891-
2892- my $engine_value= $::mysqld_variables{$default_engine};
2893-
2894- if ( ! exists $::mysqld_variables{$default_engine} and
2895- ! exists $builtin_engines{$default_engine} )
2896- {
2897- $tinfo->{'skip'}= 1;
2898- $tinfo->{'comment'}=
2899- "'$default_engine' not supported";
2900- }
2901-
2902- $tinfo->{'ndb_test'}= 1
2903- if ( $default_engine =~ /^ndb/i );
2904- $tinfo->{'innodb_test'}= 1
2905- if ( $default_engine =~ /^innodb/i );
2906- }
2907+ if ($quick_collect && ! $tinfo->{'skip'})
2908+ {
2909+ $some_test_found= 1;
2910+ return;
2911 }
2912 }
2913 @$cases= @new_cases;
2914@@ -1001,21 +996,24 @@
2915
2916 if ($tinfo->{'federated_test'})
2917 {
2918- # This is a test that need federated, enable it
2919+ # This is a test that needs federated, enable it
2920 push(@{$tinfo->{'master_opt'}}, "--loose-federated");
2921 push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
2922 }
2923
2924 if ( $tinfo->{'innodb_test'} )
2925 {
2926- # This is a test that need innodb
2927+ # This is a test that needs innodb
2928 if ( $::mysqld_variables{'innodb'} eq "OFF" ||
2929 ! exists $::mysqld_variables{'innodb'} )
2930 {
2931 # innodb is not supported, skip it
2932 $tinfo->{'skip'}= 1;
2933+ # This comment is checked for running with innodb plugin (see above),
2934+ # please keep that in mind if changing the text.
2935 $tinfo->{'comment'}= "No innodb support";
2936- return $tinfo;
2937+ # But continue processing if we may run it with innodb plugin
2938+ return $tinfo unless $do_innodb_plugin;
2939 }
2940 }
2941 else
2942@@ -1071,6 +1069,17 @@
2943 }
2944 }
2945
2946+ if ( $tinfo->{'need_ssl'} )
2947+ {
2948+ # This is a test that needs ssl
2949+ if ( ! $::opt_ssl_supported ) {
2950+ # SSL is not supported, skip it
2951+ $tinfo->{'skip'}= 1;
2952+ $tinfo->{'comment'}= "No SSL support";
2953+ return $tinfo;
2954+ }
2955+ }
2956+
2957 # ----------------------------------------------------------------------
2958 # Find config file to use if not already selected in <testname>.opt file
2959 # ----------------------------------------------------------------------
2960@@ -1163,7 +1172,8 @@
2961 ["federated.inc", "federated_test", 1],
2962 ["include/not_embedded.inc", "not_embedded", 1],
2963 ["include/not_valgrind.inc", "not_valgrind", 1],
2964- ["include/have_example_plugin.inc", "example_plugin_test", 1]
2965+ ["include/have_example_plugin.inc", "example_plugin_test", 1],
2966+ ["include/have_ssl.inc", "need_ssl", 1],
2967 );
2968
2969
2970
2971=== modified file 'mysql-test/lib/mtr_report.pm'
2972--- mysql-test/lib/mtr_report.pm 2009-09-07 20:50:10 +0000
2973+++ mysql-test/lib/mtr_report.pm 2009-11-14 20:25:27 +0000
2974@@ -134,8 +134,8 @@
2975 # an asterisk at the end, determine if the characters up to
2976 # but excluding the asterisk are the same
2977 if ( $exp ne "" && substr($exp, -1, 1) eq "*" ) {
2978- $exp = substr($exp, 0, length($exp) - 1);
2979- if ( substr($test_name, 0, length($exp)) ne $exp ) {
2980+ my $nexp = substr($exp, 0, length($exp) - 1);
2981+ if ( substr($test_name, 0, length($nexp)) ne $nexp ) {
2982 # no match, try next entry
2983 next;
2984 }
2985@@ -146,6 +146,7 @@
2986 }
2987 }
2988 $fail = "exp-fail";
2989+ $tinfo->{exp_fail}= 1;
2990 last;
2991 }
2992 }
2993@@ -387,7 +388,7 @@
2994 }
2995 elsif (@$extra_warnings)
2996 {
2997- mtr_error("There were errors/warnings in server logs after running test cases.");
2998+ mtr_error("There where errors/warnings in server logs after running test cases.");
2999 }
3000 elsif ($fail)
3001 {
3002
3003=== added file 'mysql-test/lib/v1/incompatible.tests'
3004--- mysql-test/lib/v1/incompatible.tests 1970-01-01 00:00:00 +0000
3005+++ mysql-test/lib/v1/incompatible.tests 2009-11-14 20:25:27 +0000
3006@@ -0,0 +1,6 @@
3007+# This file lists tests that cannot run in MTR v1 for some reason.
3008+# They will be skipped.
3009+# Any text following white space after full test name is ignored
3010+# Only exact test names can be used, no regexp.
3011+
3012+main.fulltext_plugin # Refers to $SIMPLE_PARSER_OPT which is not set
3013
3014=== modified file 'mysql-test/lib/v1/mtr_cases.pl'
3015--- mysql-test/lib/v1/mtr_cases.pl 2008-11-14 14:39:12 +0000
3016+++ mysql-test/lib/v1/mtr_cases.pl 2009-11-14 20:25:27 +0000
3017@@ -32,6 +32,7 @@
3018
3019 my $do_test;
3020 my $skip_test;
3021+my %incompatible;
3022
3023 sub init_pattern {
3024 my ($from, $what)= @_;
3025@@ -47,6 +48,15 @@
3026 }
3027
3028
3029+sub collect_incomp_tests {
3030+ open (INCOMP, "lib/v1/incompatible.tests");
3031+ while (<INCOMP>)
3032+ {
3033+ next unless /^\w/;
3034+ s/\s.*\n//; # Ignore anything from first white space
3035+ $incompatible{$_}= 1;
3036+ }
3037+}
3038
3039 ##############################################################################
3040 #
3041@@ -58,6 +68,8 @@
3042 $do_test= init_pattern($::opt_do_test, "--do-test");
3043 $skip_test= init_pattern($::opt_skip_test, "--skip-test");
3044
3045+ collect_incomp_tests();
3046+
3047 my $suites= shift; # Semicolon separated list of test suites
3048 my $cases = []; # Array of hash
3049
3050@@ -528,6 +540,17 @@
3051 $tinfo->{'component_id'} = $component_id;
3052 push(@$cases, $tinfo);
3053
3054+ # Remove "combinations" part of test name
3055+ my $test_base_name= $tinfo->{'name'};
3056+ $test_base_name=~ s/\s.*\n//;
3057+
3058+ if (exists ($incompatible{$test_base_name}))
3059+ {
3060+ $tinfo->{'skip'}= 1;
3061+ $tinfo->{'comment'}= "Test cannot run in mtr v1";
3062+ return;
3063+ }
3064+
3065 # ----------------------------------------------------------------------
3066 # Skip some tests but include in list, just mark them to skip
3067 # ----------------------------------------------------------------------
3068@@ -841,7 +864,7 @@
3069 if ( $tinfo->{'innodb_test'} )
3070 {
3071 # This is a test that need innodb
3072- if ( $::mysqld_variables{'innodb'} ne "TRUE" )
3073+ if ( $::mysqld_variables{'innodb'} eq "OFF" )
3074 {
3075 # innodb is not supported, skip it
3076 $tinfo->{'skip'}= 1;
3077
3078=== modified file 'mysql-test/mysql-stress-test.pl'
3079--- mysql-test/mysql-stress-test.pl 2009-09-30 23:40:51 +0000
3080+++ mysql-test/mysql-stress-test.pl 2009-11-14 20:25:27 +0000
3081@@ -14,17 +14,16 @@
3082 #
3083 # Design of stress script should allow one:
3084 #
3085-# - To stress test the mysqltest binary test engine.
3086-# - To stress test the regular test suite and any additional test suites
3087-# (such as mysql-test-extra-5.0).
3088-# - To specify files with lists of tests both for initialization of
3089-# stress db and for further testing itself.
3090-# - To define the number of threads to be concurrently used in testing.
3091-# - To define limitations for the test run. such as the number of tests or
3092-# loops for execution or duration of testing, delay between test
3093-# executions, and so forth.
3094-# - To get a readable log file that can be used for identification of
3095-# errors that occur during testing.
3096+# - to use for stress testing mysqltest binary as test engine
3097+# - to use for stress testing both regular test suite and any
3098+# additional test suites (e.g. mysql-test-extra-5.0)
3099+# - to specify files with lists of tests both for initialization of
3100+# stress db and for further testing itself
3101+# - to define number of threads that will be concurrently used in testing
3102+# - to define limitations for test run. e.g. number of tests or loops
3103+# for execution or duration of testing, delay between test executions, etc.
3104+# - to get readable log file which can be used for identification of
3105+# errors arose during testing
3106 #
3107 # Basic scenarios:
3108 #
3109@@ -58,6 +57,8 @@
3110 # to reproduce and debug errors that was found in continued stress
3111 # testing
3112 #
3113+# 2009-01-28 OBN Additions and modifications per WL#4685
3114+#
3115 ########################################################################
3116
3117 use Config;
3118@@ -114,13 +115,15 @@
3119 $opt_loop_count=0;
3120 $opt_test_count=0;
3121 $opt_test_duration=0;
3122-$opt_abort_on_error=0;
3123+# OBN: Changing abort-on-error default to -1 (for WL-4626/4685): -1 means no abort
3124+$opt_abort_on_error=-1;
3125 $opt_sleep_time = 0;
3126 $opt_threads=1;
3127 $pid_file="mysql_stress_test.pid";
3128 $opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest";
3129 $opt_check_tests_file="";
3130-@mysqltest_args=("--silent", "-v", "--skip-safemalloc");
3131+# OBM adding a setting for 'max-connect-retries=7' the default of 500 is to high
3132+@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=7");
3133
3134 # Client ip address
3135 $client_ip=inet_ntoa((gethostbyname(hostname()))[4]);
3136@@ -133,24 +136,31 @@
3137 #
3138 # S1 - Critical errors - cause immediately abort of testing. These errors
3139 # could be caused by server crash or impossibility
3140-# of test execution
3141+# of test execution.
3142 #
3143 # S2 - Serious errors - these errors are bugs for sure as it knowns that
3144 # they shouldn't appear during stress testing
3145 #
3146-# S3 - Non-seriuos errros - these errors could be caused by fact that
3147+# S3 - Unknown errors - Errors were returned but we don't know what they are
3148+# so script can't determine if they are OK or not
3149+#
3150+# S4 - Non-seriuos errros - these errors could be caused by fact that
3151 # we execute simultaneously statements that
3152 # affect tests executed by other threads
3153
3154 %error_strings = ( 'Failed in mysql_real_connect()' => S1,
3155+ 'Can\'t connect' => S1,
3156 'not found (Errcode: 2)' => S1 );
3157
3158 %error_codes = ( 1012 => S2, 1015 => S2, 1021 => S2,
3159 1027 => S2, 1037 => S2, 1038 => S2,
3160 1039 => S2, 1040 => S2, 1046 => S2,
3161- 1180 => S2, 1181 => S2, 1203 => S2,
3162- 1205 => S2, 1206 => S2, 1207 => S2,
3163- 1223 => S2, 2013 => S1);
3164+ 1053 => S2, 1180 => S2, 1181 => S2,
3165+ 1203 => S2, 1205 => S4, 1206 => S2,
3166+ 1207 => S2, 1213 => S4, 1223 => S2,
3167+ 2002 => S1, 2003 => S1, 2006 => S1,
3168+ 2013 => S1
3169+ );
3170
3171 share(%test_counters);
3172 %test_counters=( loop_count => 0, test_count=>0);
3173@@ -158,6 +168,35 @@
3174 share($exiting);
3175 $exiting=0;
3176
3177+# OBN Code and 'set_exit_code' function added by ES to set an exit code based on the error category returned
3178+# in combination with the --abort-on-error value see WL#4685)
3179+use constant ABORT_MAKEWEIGHT => 20;
3180+share($gExitCode);
3181+$gExitCode = 0; # global exit code
3182+sub set_exit_code {
3183+ my $severity = shift;
3184+ my $code = 0;
3185+ if ( $severity =~ /^S(\d+)/ ) {
3186+ $severity = $1;
3187+ $code = 11 - $severity; # S1=10, S2=9, ... -- as per WL
3188+ }
3189+ else {
3190+ # we know how we call the sub: severity should be S<num>; so, we should never be here...
3191+ print STDERR "Unknown severity format: $severity; setting to S1\n";
3192+ $severity = 1;
3193+ }
3194+ $abort = 0;
3195+ if ( $severity <= $opt_abort_on_error ) {
3196+ # the test finished with a failure severe enough to abort. We are adding the 'abort flag' to the exit code
3197+ $code += ABORT_MAKEWEIGHT;
3198+ # but are not exiting just yet -- we need to update global exit code first
3199+ $abort = 1;
3200+ }
3201+ lock $gExitCode; # we can use lock here because the script uses threads anyway
3202+ $gExitCode = $code if $code > $gExitCode;
3203+ kill INT, $$ if $abort; # this is just a way to call sig_INT_handler: it will set exiting flag, which should do the rest
3204+}
3205+
3206 share($test_counters_lock);
3207 $test_counters_lock=0;
3208 share($log_file_lock);
3209@@ -176,7 +215,8 @@
3210 "threads=s", "sleep-time=s", "loop-count=i", "test-count=i",
3211 "test-duration=i", "test-suffix=s", "check-tests-file",
3212 "verbose", "log-error-details", "cleanup", "mysqltest=s",
3213- "abort-on-error", "help") || usage();
3214+ # OBN: (changing 'abort-on-error' to numberic for WL-4626/4685)
3215+ "abort-on-error=i" => \$opt_abort_on_error, "help") || usage();
3216
3217 usage() if ($opt_help);
3218
3219@@ -563,7 +603,15 @@
3220
3221 if ($opt_test_duration)
3222 {
3223- sleep($opt_test_duration);
3224+ # OBN - At this point we need to wait for the duration of the test, hoever
3225+ # we need to be able to quit if an 'abort-on-error' condition has happend
3226+ # with one of the children (WL#4685). Using solution by ES and replacing
3227+ # the 'sleep' command with a loop checking the abort condition every second
3228+
3229+ foreach ( 1..$opt_test_duration ) {
3230+ last if $exiting;
3231+ sleep 1;
3232+ }
3233 kill INT, $$; #Interrupt child threads
3234 }
3235
3236@@ -580,6 +628,8 @@
3237 print "EXIT\n";
3238 }
3239
3240+exit $gExitCode; # ES WL#4685: script should return a meaningful exit code
3241+
3242 sub test_init
3243 {
3244 my ($env)=@_;
3245@@ -681,7 +731,9 @@
3246 {
3247 if (!exists($error_codes{$err_code}))
3248 {
3249- $severity="S3";
3250+ # OBN Changing severity level to S4 from S3 as S3 now reserved
3251+ # for the case where the error is unknown (for WL#4626/4685
3252+ $severity="S4";
3253 $err_code=0;
3254 }
3255 else
3256@@ -734,6 +786,7 @@
3257 {
3258 push @{$env->{test_status}}, "Severity $severity: $total";
3259 $env->{errors}->{total}=+$total;
3260+ set_exit_code($severity);
3261 }
3262 }
3263
3264@@ -748,18 +801,20 @@
3265
3266 log_session_errors($env, $test_file);
3267
3268- if (!$exiting && ($signal_num == 2 || $signal_num == 15 ||
3269- ($opt_abort_on_error && $env->{errors}->{S1} > 0)))
3270+ #OBN Removing the case of S1 and abort-on-error as that is now set
3271+ # inside the set_exit_code function (for WL#4626/4685)
3272+ #if (!$exiting && ($signal_num == 2 || $signal_num == 15 ||
3273+ # ($opt_abort_on_error && $env->{errors}->{S1} > 0)))
3274+ if (!$exiting && ($signal_num == 2 || $signal_num == 15))
3275 {
3276- #mysqltest was interrupted with INT or TERM signals or test was
3277- #ran with --abort-on-error option and we got errors with severity S1
3278+ #mysqltest was interrupted with INT or TERM signals
3279 #so we assume that we should cancel testing and exit
3280 $exiting=1;
3281+ # OBN - Adjusted text to exclude case of S1 and abort-on-error that
3282+ # was mentioned (for WL#4626/4685)
3283 print STDERR<<EOF;
3284 WARNING:
3285- mysqltest was interrupted with INT or TERM signals or test was
3286- ran with --abort-on-error option and we got errors with severity S1
3287- (test cann't connect to the server or server crashed) so we assume that
3288+ mysqltest was interrupted with INT or TERM signals so we assume that
3289 we should cancel testing and exit. Please check log file for this thread
3290 in $stress_log_file or
3291 inspect below output of the last test case executed with mysqltest to
3292@@ -840,12 +895,23 @@
3293 $client_env{test_count}."]:".
3294 " TID ".$client_env{thread_id}.
3295 " test: '$test_name' ".
3296- " Errors: ".join(" ",@{$client_env{test_status}}),"\n";
3297- print "\n";
3298+ " Errors: ".join(" ",@{$client_env{test_status}}).
3299+ ( $exiting ? " (thread aborting)" : "" )."\n";
3300 }
3301
3302- sleep($opt_sleep_time) if($opt_sleep_time);
3303-
3304+ # OBN - At this point we need to wait until the 'wait' time between test
3305+ # executions passes (in case it is specifed) passes, hoever we need
3306+ # to be able to quit and break out of the test if an 'abort-on-error'
3307+ # condition has happend with one of the other children (WL#4685).
3308+ # Using solution by ES and replacing the 'sleep' command with a loop
3309+ # checking the abort condition every second
3310+
3311+ if ( $opt_sleep_time ) {
3312+ foreach ( 1..$opt_sleep_time ) {
3313+ last if $exiting;
3314+ sleep 1;
3315+ }
3316+ }
3317 }
3318 }
3319
3320@@ -1119,6 +1185,9 @@
3321 --cleanup
3322 Force to clean up working directory (specified with --stress-basedir)
3323
3324+--abort-on-error=<number>
3325+ Causes the script to abort if an error with severity <= number was encounterd
3326+
3327 --log-error-details
3328 Enable errors details in the global error log file. (Default: off)
3329
3330
3331=== modified file 'mysql-test/mysql-test-run.pl'
3332--- mysql-test/mysql-test-run.pl 2009-11-06 17:24:38 +0000
3333+++ mysql-test/mysql-test-run.pl 2009-11-14 20:25:27 +0000
3334@@ -150,7 +150,7 @@
3335 my $opt_compress;
3336 my $opt_ssl;
3337 my $opt_skip_ssl;
3338-my $opt_ssl_supported;
3339+our $opt_ssl_supported;
3340 my $opt_ps_protocol;
3341 my $opt_sp_protocol;
3342 my $opt_cursor_protocol;
3343@@ -216,6 +216,7 @@
3344
3345 my $opt_start;
3346 my $opt_start_dirty;
3347+my $start_only;
3348 my $opt_wait_all;
3349 my $opt_repeat= 1;
3350 my $opt_retry= 3;
3351@@ -339,7 +340,8 @@
3352 for my $limit (2000, 1500, 1000, 500){
3353 $opt_parallel-- if ($sys_info->min_bogomips() < $limit);
3354 }
3355- $opt_parallel= 8 if ($opt_parallel > 8);
3356+ my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
3357+ $opt_parallel= $max_par if ($opt_parallel > $max_par);
3358 $opt_parallel= $num_tests if ($opt_parallel > $num_tests);
3359 $opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
3360 $opt_parallel= 1 if ($opt_parallel < 1);
3361@@ -547,7 +549,8 @@
3362 }
3363 }
3364 $num_saved_datadir++;
3365- $num_failed_test++ unless $result->{retries};
3366+ $num_failed_test++ unless ($result->{retries} ||
3367+ $result->{exp_fail});
3368
3369 $test_failure= 1;
3370 if ( !$opt_force ) {
3371@@ -1052,6 +1055,9 @@
3372
3373 if ( $opt_experimental )
3374 {
3375+ # $^O on Windows considered not generic enough
3376+ my $plat= (IS_WINDOWS) ? 'windows' : $^O;
3377+
3378 # read the list of experimental test cases from the file specified on
3379 # the command line
3380 open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental");
3381@@ -1062,6 +1068,15 @@
3382 # remove comments (# foo) at the beginning of the line, or after a
3383 # blank at the end of the line
3384 s/( +|^)#.*$//;
3385+ # If @ platform specifier given, use this entry only if it contains
3386+ # @<platform> or @!<xxx> where xxx != platform
3387+ if (/\@.*/)
3388+ {
3389+ next if (/\@!$plat/);
3390+ next unless (/\@$plat/ or /\@!/);
3391+ # Then remove @ and everything after it
3392+ s/\@.*$//;
3393+ }
3394 # remove whitespace
3395 s/^ +//;
3396 s/ +$//;
3397@@ -1321,6 +1336,21 @@
3398 {
3399 mtr_error("Can't use --extern when using debugger");
3400 }
3401+ # Set one week timeout (check-testcase timeout will be 1/10th)
3402+ $opt_testcase_timeout= 7 * 24 * 60;
3403+ $opt_suite_timeout= 7 * 24 * 60;
3404+ # One day to shutdown
3405+ $opt_shutdown_timeout= 24 * 60;
3406+ # One day for PID file creation (this is given in seconds not minutes)
3407+ $opt_start_timeout= 24 * 60 * 60;
3408+ }
3409+
3410+ # --------------------------------------------------------------------------
3411+ # Modified behavior with --start options
3412+ # --------------------------------------------------------------------------
3413+ if ($opt_start or $opt_start_dirty) {
3414+ collect_option ('quick-collect', 1);
3415+ $start_only= 1;
3416 }
3417 if ($opt_debug)
3418 {
3419@@ -1334,7 +1364,7 @@
3420 # Check use of wait-all
3421 # --------------------------------------------------------------------------
3422
3423- if ($opt_wait_all && ! ($opt_start_dirty || $opt_start))
3424+ if ($opt_wait_all && ! $start_only)
3425 {
3426 mtr_error("--wait-all can only be used with --start or --start-dirty");
3427 }
3428@@ -1394,6 +1424,9 @@
3429 push(@valgrind_args, @default_valgrind_args)
3430 unless @valgrind_args;
3431
3432+ # Make valgrind run in quiet mode so it only print errors
3433+ push(@valgrind_args, "--quiet" );
3434+
3435 mtr_report("Running valgrind with options \"",
3436 join(" ", @valgrind_args), "\"");
3437 }
3438@@ -1609,6 +1642,10 @@
3439 }
3440 }
3441
3442+ # "Convert" innodb flag
3443+ $mysqld_variables{'innodb'}= "ON"
3444+ if ($mysqld_variables{'have_innodb'} eq "YES");
3445+
3446 # Parse version
3447 my $version_str= $mysqld_variables{'version'};
3448 if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ )
3449@@ -1909,11 +1946,11 @@
3450 # --------------------------------------------------------------------------
3451 # Add the path where mysqld will find ha_example.so
3452 # --------------------------------------------------------------------------
3453- if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) {
3454+ if ($mysql_version_id >= 50100) {
3455 my $plugin_filename;
3456 if (IS_WINDOWS)
3457 {
3458- $plugin_filename = "ha_example.dll";
3459+ $plugin_filename = "ha_example.dll";
3460 }
3461 else
3462 {
3463@@ -1930,7 +1967,7 @@
3464 ($lib_example_plugin ? dirname($lib_example_plugin) : "");
3465
3466 $ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
3467- $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";";
3468+ $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
3469 }
3470
3471 # ----------------------------------------------------
3472@@ -3004,7 +3041,7 @@
3473
3474 if ( $tinfo->{'skip'} )
3475 {
3476- mtr_report_test_skipped($tinfo);
3477+ mtr_report_test_skipped($tinfo) unless $start_only;
3478 return 1;
3479 }
3480
3481@@ -3174,7 +3211,8 @@
3482 # Unknown process returned, most likley a crash, abort everything
3483 $tinfo->{comment}=
3484 "The server $proc crashed while running ".
3485- "'check testcase $mode test'";
3486+ "'check testcase $mode test'".
3487+ get_log_from_proc($proc, $tinfo->{name});
3488 $result= 3;
3489 }
3490
3491@@ -3292,7 +3330,8 @@
3492 else {
3493 # Unknown process returned, most likley a crash, abort everything
3494 $tinfo->{comment}.=
3495- "The server $proc crashed while running '$run'";
3496+ "The server $proc crashed while running '$run'".
3497+ get_log_from_proc($proc, $tinfo->{name});
3498 }
3499
3500 # Kill any check processes still running
3501@@ -3407,6 +3446,12 @@
3502
3503 mtr_verbose("Running test:", $tinfo->{name});
3504
3505+ # Allow only alpanumerics pluss _ - + . in combination names
3506+ my $combination= $tinfo->{combination};
3507+ if ($combination && $combination !~ /^\w[-\w\.\+]+$/)
3508+ {
3509+ mtr_error("Combination '$combination' contains illegal characters");
3510+ }
3511 # -------------------------------------------------------
3512 # Init variables that can change between each test case
3513 # -------------------------------------------------------
3514@@ -3501,9 +3546,16 @@
3515 # server exits
3516 # ----------------------------------------------------------------------
3517
3518- if ( $opt_start or $opt_start_dirty )
3519+ if ( $start_only )
3520 {
3521 mtr_print("\nStarted", started(all_servers()));
3522+ mtr_print("Using config for test", $tinfo->{name});
3523+ mtr_print("Port and socket path for server(s):");
3524+ foreach my $mysqld ( mysqlds() )
3525+ {
3526+ mtr_print ($mysqld->name() . " " . $mysqld->value('port') .
3527+ " " . $mysqld->value('socket'));
3528+ }
3529 mtr_print("Waiting for server(s) to exit...");
3530 if ( $opt_wait_all ) {
3531 My::SafeProcess->wait_all();
3532@@ -3597,7 +3649,7 @@
3533 my $check_res;
3534 if ( restart_forced_by_test() )
3535 {
3536- stop_all_servers();
3537+ stop_all_servers($opt_shutdown_timeout);
3538 }
3539 elsif ( $opt_check_testcases and
3540 $check_res= check_testcase($tinfo, "after"))
3541@@ -3614,7 +3666,7 @@
3542 # test.
3543 } else {
3544 # Not checking warnings, so can do a hard shutdown.
3545- stop_all_servers();
3546+ stop_all_servers($opt_shutdown_timeout);
3547 }
3548 mtr_report("Resuming tests...\n");
3549 }
3550@@ -3696,7 +3748,8 @@
3551 {
3552 # Server failed, probably crashed
3553 $tinfo->{comment}=
3554- "Server $proc failed during test run";
3555+ "Server $proc failed during test run" .
3556+ get_log_from_proc($proc, $tinfo->{name});
3557
3558 # ----------------------------------------------------
3559 # It's not mysqltest that has exited, kill it
3560@@ -3809,16 +3862,15 @@
3561 }
3562 }
3563
3564-#
3565-# Perform a rough examination of the servers
3566-# error log and write all lines that look
3567-# suspicious into $error_log.warnings
3568-#
3569-sub extract_warning_lines ($) {
3570- my ($error_log) = @_;
3571+# Extract server log from after the last occurrence of named test
3572+# Return as an array of lines
3573+#
3574+
3575+sub extract_server_log ($$) {
3576+ my ($error_log, $tname) = @_;
3577
3578 # Open the servers .err log file and read all lines
3579- # belonging to current tets into @lines
3580+ # belonging to current test into @lines
3581 my $Ferr = IO::File->new($error_log)
3582 or return [];
3583 my $last_pos= $last_warning_position->{$error_log}{seek_pos};
3584@@ -3849,8 +3901,37 @@
3585 }
3586 }
3587 }
3588-
3589- # Write all suspicious lines to $error_log.warnings file
3590+ return @lines;
3591+}
3592+
3593+# Get log from server identified from its $proc object, from named test
3594+# Return as a single string
3595+#
3596+
3597+sub get_log_from_proc ($$) {
3598+ my ($proc, $name)= @_;
3599+ my $srv_log= "";
3600+
3601+ foreach my $mysqld (mysqlds()) {
3602+ if ($mysqld->{proc} eq $proc) {
3603+ my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name);
3604+ $srv_log= "\nServer log from this test:\n" . join ("", @srv_lines);
3605+ last;
3606+ }
3607+ }
3608+ return $srv_log;
3609+}
3610+
3611+# Perform a rough examination of the servers
3612+# error log and write all lines that look
3613+# suspicious into $error_log.warnings
3614+#
3615+sub extract_warning_lines ($$) {
3616+ my ($error_log, $tname) = @_;
3617+
3618+ my @lines= extract_server_log($error_log, $tname);
3619+
3620+# Write all suspicious lines to $error_log.warnings file
3621 my $warning_log = "$error_log.warnings";
3622 my $Fwarn = IO::File->new($warning_log, "w")
3623 or die("Could not open file '$warning_log' for writing: $!");
3624@@ -3858,16 +3939,9 @@
3625
3626 my @patterns =
3627 (
3628- # The patterns for detection of [Warning] and [ERROR]
3629- # in the server log files have been faulty for a longer period
3630- # and correcting them shows a few additional harmless warnings.
3631- # Thus those patterns are temporarily removed from the list
3632- # of patterns. For more info see BUG#42408
3633- # qr/^Warning:|mysqld: Warning|\[Warning\]/,
3634- # qr/^Error:|\[ERROR\]/,
3635- qr/^Warning:|mysqld: Warning/,
3636- qr/^Error:/,
3637- qr/^==.* at 0x/,
3638+ qr/^Warning:|mysqld: Warning|\[Warning\]/,
3639+ qr/^Error:|\[ERROR\]/,
3640+ qr/^==\d*==/, # valgrind errors
3641 qr/InnoDB: Warning|InnoDB: Error/,
3642 qr/^safe_mutex:|allocated at line/,
3643 qr/missing DBUG_RETURN/,
3644@@ -3886,6 +3960,7 @@
3645 # Perl code.
3646 my @antipatterns =
3647 (
3648+ qr/error .*connecting to master/,
3649 qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/,
3650 qr/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/,
3651 );
3652@@ -3933,7 +4008,7 @@
3653 my $log_error= $mysqld->value('#log-error');
3654 # To be communicated to the test
3655 $ENV{MTR_LOG_ERROR}= $log_error;
3656- extract_warning_lines($log_error);
3657+ extract_warning_lines($log_error, $tinfo->{name});
3658
3659 my $args;
3660 mtr_init_args(\$args);
3661@@ -3980,7 +4055,7 @@
3662
3663 #
3664 # Loop through our list of processes and check the error log
3665-# for unexepcted errors and warnings
3666+# for unexpected errors and warnings
3667 #
3668 sub check_warnings ($) {
3669 my ($tinfo)= @_;
3670@@ -4067,7 +4142,8 @@
3671 else {
3672 # Unknown process returned, most likley a crash, abort everything
3673 $tinfo->{comment}=
3674- "The server $proc crashed while running 'check warnings'";
3675+ "The server $proc crashed while running 'check warnings'".
3676+ get_log_from_proc($proc, $tinfo->{name});
3677 $result= 3;
3678 }
3679
3680@@ -4083,13 +4159,15 @@
3681 }
3682
3683 # Check for warnings generated during shutdown of a mysqld server.
3684-# If any, report them to master server, and return true; else just return false.
3685+# If any, report them to master server, and return true; else just return
3686+# false.
3687+
3688 sub check_warnings_post_shutdown {
3689 my ($server_socket)= @_;
3690 my $testname_hash= { };
3691 foreach my $mysqld ( mysqlds())
3692 {
3693- my $testlist= extract_warning_lines($mysqld->value('#log-error'));
3694+ my $testlist= extract_warning_lines($mysqld->value('#log-error'), "");
3695 $testname_hash->{$_}= 1 for @$testlist;
3696 }
3697 my @warning_tests= keys(%$testname_hash);
3698@@ -4343,6 +4421,7 @@
3699 mtr_init_args(\$args);
3700
3701 mtr_add_arg($args, "--no-defaults");
3702+ mtr_add_arg($args, "--character-sets-dir=%s", $mysqld->value('character-sets-dir'));
3703 mtr_add_arg($args, "--user=%s", $opt_user);
3704 mtr_add_arg($args, "--password=");
3705 mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
3706@@ -4392,7 +4471,7 @@
3707
3708 if (!using_extern() and $mysql_version_id >= 50106 )
3709 {
3710- # Turn on logging to bothe tables and file
3711+ # Turn on logging to file and tables
3712 mtr_add_arg($args, "%s--log-output=table,file");
3713 }
3714
3715@@ -4555,7 +4634,8 @@
3716 $opt_start_timeout,
3717 $mysqld->{'proc'}))
3718 {
3719- mtr_error("Failed to start mysqld $mysqld->name()");
3720+ my $mname= $mysqld->name();
3721+ mtr_error("Failed to start mysqld $mname with command $exe");
3722 }
3723
3724 # Remember options used when starting
3725@@ -4566,11 +4646,12 @@
3726
3727
3728 sub stop_all_servers () {
3729+ my $shutdown_timeout = $_[0] or 0;
3730
3731 mtr_verbose("Stopping all servers...");
3732
3733 # Kill all started servers
3734- My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
3735+ My::SafeProcess::shutdown($shutdown_timeout,
3736 started(all_servers()));
3737
3738 # Remove pidfiles
3739@@ -4940,7 +5021,8 @@
3740 my $logfile= $mysqld->value('#log-error');
3741 if ( defined $logfile and -f $logfile )
3742 {
3743- $tinfo->{logfile}= mtr_fromfile($logfile);
3744+ my @srv_lines= extract_server_log($logfile, $tinfo->{name});
3745+ $tinfo->{logfile}= "Server log is:\n" . join ("", @srv_lines);
3746 }
3747 else
3748 {
3749@@ -5369,7 +5451,6 @@
3750 else
3751 {
3752 mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
3753- mtr_add_arg($args, "--alignment=8");
3754 mtr_add_arg($args, "--leak-check=yes");
3755 mtr_add_arg($args, "--num-callers=16");
3756 mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
3757@@ -5468,7 +5549,7 @@
3758 staging-run Run a limited number of tests (no slow tests). Used
3759 for running staging trees with valgrind.
3760 enable-disabled Run also tests marked as disabled
3761- print_testcases Don't run the tests but print details about all the
3762+ print-testcases Don't run the tests but print details about all the
3763 selected tests, in the order they would be run.
3764
3765 Options that specify ports
3766
3767=== modified file 'mysql-test/r/almost_full.result'
3768--- mysql-test/r/almost_full.result 2007-11-12 09:00:22 +0000
3769+++ mysql-test/r/almost_full.result 2009-11-14 20:25:27 +0000
3770@@ -1,3 +1,4 @@
3771+call mtr.add_suppression("The table 't1' is full");
3772 drop table if exists t1;
3773 set global myisam_data_pointer_size=2;
3774 CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
3775
3776=== modified file 'mysql-test/r/alter_table.result'
3777--- mysql-test/r/alter_table.result 2009-10-28 07:52:34 +0000
3778+++ mysql-test/r/alter_table.result 2009-11-14 20:25:27 +0000
3779@@ -1175,4 +1175,74 @@
3780 42
3781 DROP TABLE t1;
3782 SET @@sql_mode=@save_sql_mode;
3783+#
3784+# Bug#45567: Fast ALTER TABLE broken for enum and set
3785+#
3786+DROP TABLE IF EXISTS t1;
3787+CREATE TABLE t1 (a ENUM('a1','a2'));
3788+INSERT INTO t1 VALUES ('a1'),('a2');
3789+# No copy: No modification
3790+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2');
3791+affected rows: 0
3792+info: Records: 0 Duplicates: 0 Warnings: 0
3793+# No copy: Add new enumeration to the end
3794+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a3');
3795+affected rows: 0
3796+info: Records: 0 Duplicates: 0 Warnings: 0
3797+# Copy: Modify and add new to the end
3798+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx','a5');
3799+affected rows: 2
3800+info: Records: 2 Duplicates: 0 Warnings: 0
3801+# Copy: Remove from the end
3802+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx');
3803+affected rows: 2
3804+info: Records: 2 Duplicates: 0 Warnings: 0
3805+# Copy: Add new enumeration
3806+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx');
3807+affected rows: 2
3808+info: Records: 2 Duplicates: 0 Warnings: 0
3809+# No copy: Add new enumerations to the end
3810+ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx','a5','a6');
3811+affected rows: 0
3812+info: Records: 0 Duplicates: 0 Warnings: 0
3813+DROP TABLE t1;
3814+CREATE TABLE t1 (a SET('a1','a2'));
3815+INSERT INTO t1 VALUES ('a1'),('a2');
3816+# No copy: No modification
3817+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2');
3818+affected rows: 0
3819+info: Records: 0 Duplicates: 0 Warnings: 0
3820+# No copy: Add new to the end
3821+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a3');
3822+affected rows: 0
3823+info: Records: 0 Duplicates: 0 Warnings: 0
3824+# Copy: Modify and add new to the end
3825+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx','a5');
3826+affected rows: 2
3827+info: Records: 2 Duplicates: 0 Warnings: 0
3828+# Copy: Remove from the end
3829+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx');
3830+affected rows: 2
3831+info: Records: 2 Duplicates: 0 Warnings: 0
3832+# Copy: Add new member
3833+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx');
3834+affected rows: 2
3835+info: Records: 2 Duplicates: 0 Warnings: 0
3836+# No copy: Add new to the end
3837+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6');
3838+affected rows: 0
3839+info: Records: 0 Duplicates: 0 Warnings: 0
3840+# Copy: Numerical incrase (pack lenght)
3841+ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9','a10');
3842+affected rows: 2
3843+info: Records: 2 Duplicates: 0 Warnings: 0
3844+DROP TABLE t1;
3845+CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
3846+f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
3847+INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
3848+this should affect no rows as there is no real change
3849+ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
3850+affected rows: 0
3851+info: Records: 0 Duplicates: 0 Warnings: 0
3852+DROP TABLE t1;
3853 End of 5.1 tests
3854
3855=== modified file 'mysql-test/r/analyse.result'
3856--- mysql-test/r/analyse.result 2009-08-27 10:59:25 +0000
3857+++ mysql-test/r/analyse.result 2009-11-14 20:25:27 +0000
3858@@ -19,81 +19,10 @@
3859 test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
3860 test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
3861 create table t2 select * from t1 procedure analyse();
3862-select * from t2;
3863-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3864-test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
3865-test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
3866-test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
3867-test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
3868-test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
3869-drop table t1,t2;
3870+ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
3871+drop table t1;
3872 EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
3873 ERROR HY000: Incorrect usage of PROCEDURE and subquery
3874-create table t1 (a int not null);
3875-create table t2 select * from t1 where 0=1 procedure analyse();
3876-show create table t2;
3877-Table Create Table
3878-t2 CREATE TABLE `t2` (
3879- `Field_name` varbinary(255) NOT NULL DEFAULT '',
3880- `Min_value` varbinary(255) DEFAULT NULL,
3881- `Max_value` varbinary(255) DEFAULT NULL,
3882- `Min_length` bigint(11) NOT NULL DEFAULT '0',
3883- `Max_length` bigint(11) NOT NULL DEFAULT '0',
3884- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
3885- `Nulls` bigint(11) NOT NULL DEFAULT '0',
3886- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
3887- `Std` varbinary(255) DEFAULT NULL,
3888- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
3889-) ENGINE=MyISAM DEFAULT CHARSET=latin1
3890-select * from t1 where 0=1 procedure analyse();
3891-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3892-insert into t1 values(1);
3893-drop table t2;
3894-create table t2 select * from t1 where 0=1 procedure analyse();
3895-show create table t2;
3896-Table Create Table
3897-t2 CREATE TABLE `t2` (
3898- `Field_name` varbinary(255) NOT NULL DEFAULT '',
3899- `Min_value` varbinary(255) DEFAULT NULL,
3900- `Max_value` varbinary(255) DEFAULT NULL,
3901- `Min_length` bigint(11) NOT NULL DEFAULT '0',
3902- `Max_length` bigint(11) NOT NULL DEFAULT '0',
3903- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
3904- `Nulls` bigint(11) NOT NULL DEFAULT '0',
3905- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
3906- `Std` varbinary(255) DEFAULT NULL,
3907- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
3908-) ENGINE=MyISAM DEFAULT CHARSET=latin1
3909-select * from t2;
3910-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3911-insert into t2 select * from t1 procedure analyse();
3912-select * from t2;
3913-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3914-test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
3915-insert into t1 values(2);
3916-drop table t2;
3917-create table t2 select * from t1 where 0=1 procedure analyse();
3918-show create table t2;
3919-Table Create Table
3920-t2 CREATE TABLE `t2` (
3921- `Field_name` varbinary(255) NOT NULL DEFAULT '',
3922- `Min_value` varbinary(255) DEFAULT NULL,
3923- `Max_value` varbinary(255) DEFAULT NULL,
3924- `Min_length` bigint(11) NOT NULL DEFAULT '0',
3925- `Max_length` bigint(11) NOT NULL DEFAULT '0',
3926- `Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
3927- `Nulls` bigint(11) NOT NULL DEFAULT '0',
3928- `Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
3929- `Std` varbinary(255) DEFAULT NULL,
3930- `Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
3931-) ENGINE=MyISAM DEFAULT CHARSET=latin1
3932-select * from t2;
3933-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3934-insert into t2 select * from t1 procedure analyse();
3935-select * from t2;
3936-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
3937-test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
3938-drop table t1,t2;
3939 create table t1 (v varchar(128));
3940 insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
3941 select * from t1 procedure analyse();
3942@@ -157,3 +86,40 @@
3943 ERROR HY000: Incorrect usage of PROCEDURE and subquery
3944 DROP TABLE t1;
3945 End of 4.1 tests
3946+#
3947+# Bug #48293: crash with procedure analyse, view with > 10 columns,
3948+# having clause...
3949+#
3950+CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
3951+f INT, g INT, h INT, i INT, j INT,k INT);
3952+INSERT INTO t1 VALUES (),();
3953+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
3954+#should have a derived table
3955+EXPLAIN SELECT * FROM v1;
3956+id select_type table type possible_keys key key_len ref rows Extra
3957+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
3958+2 DERIVED t1 ALL NULL NULL NULL NULL 2
3959+#should not crash
3960+SELECT * FROM v1 PROCEDURE analyse();
3961+ERROR HY000: Incorrect usage of PROCEDURE and view
3962+#should not crash
3963+SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
3964+ERROR HY000: Incorrect usage of PROCEDURE and view
3965+#should not crash
3966+SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
3967+ERROR HY000: Incorrect usage of PROCEDURE and subquery
3968+#should not crash
3969+SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
3970+ERROR HY000: Incorrect usage of PROCEDURE and subquery
3971+#should not crash
3972+SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
3973+ERROR HY000: Can't use ORDER clause with this procedure
3974+DROP VIEW v1;
3975+DROP TABLE t1;
3976+CREATE TABLE t1(a INT);
3977+INSERT INTO t1 VALUES (1),(2);
3978+# should not crash
3979+CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
3980+ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
3981+DROP TABLE t1;
3982+End of 5.0 tests
3983
3984=== modified file 'mysql-test/r/archive.result'
3985--- mysql-test/r/archive.result 2009-03-26 14:27:34 +0000
3986+++ mysql-test/r/archive.result 2009-11-14 20:25:27 +0000
3987@@ -12695,3 +12695,25 @@
3988 1 NULL
3989 2 NULL
3990 DROP TABLE t1;
3991+CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
3992+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
3993+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
3994+DATA_LENGTH AVG_ROW_LENGTH
3995+8666 15
3996+INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
3997+SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
3998+INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
3999+DATA_LENGTH AVG_ROW_LENGTH
4000+8700 4350
4001+DROP TABLE t1;
4002+SET @save_join_buffer_size= @@join_buffer_size;
4003+SET @@join_buffer_size= 8228;
4004+CREATE TABLE t1(a CHAR(255)) ENGINE=archive;
4005+INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
4006+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
4007+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
4008+SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
4009+COUNT(t1.a)
4010+729
4011+DROP TABLE t1;
4012+SET @@join_buffer_size= @save_join_buffer_size;
4013
4014=== modified file 'mysql-test/r/bug46080.result'
4015--- mysql-test/r/bug46080.result 2009-07-13 11:17:14 +0000
4016+++ mysql-test/r/bug46080.result 2009-11-14 20:25:27 +0000
4017@@ -2,6 +2,8 @@
4018 # Bug #46080: group_concat(... order by) crashes server when
4019 # sort_buffer_size cannot allocate
4020 #
4021+call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'");
4022+call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k");
4023 CREATE TABLE t1(a CHAR(255));
4024 INSERT INTO t1 VALUES ('a');
4025 SET @@SESSION.sort_buffer_size=5*16*1000000;
4026
4027=== added file 'mysql-test/r/bug46760.result'
4028--- mysql-test/r/bug46760.result 1970-01-01 00:00:00 +0000
4029+++ mysql-test/r/bug46760.result 2009-11-14 20:25:27 +0000
4030@@ -0,0 +1,43 @@
4031+#
4032+# Bug#46760: Fast ALTER TABLE no longer works for InnoDB
4033+#
4034+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
4035+INSERT INTO t1 VALUES (1);
4036+# By using --enable_info and verifying that number of affected
4037+# rows is 0 we check that this ALTER TABLE is really carried
4038+# out as "fast/online" operation, i.e. without full-blown data
4039+# copying.
4040+#
4041+# I.e. info for the below statement should normally look like:
4042+#
4043+# affected rows: 0
4044+# info: Records: 0 Duplicates: 0 Warnings: 0
4045+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
4046+affected rows: 0
4047+info: Records: 0 Duplicates: 0 Warnings: 0
4048+SHOW CREATE TABLE t1;
4049+Table Create Table
4050+t1 CREATE TABLE `t1` (
4051+ `a` int(11) DEFAULT '10'
4052+) ENGINE=InnoDB DEFAULT CHARSET=latin1
4053+DROP TABLE t1;
4054+#
4055+# MySQL Bug#39200: optimize table does not recognize
4056+# ROW_FORMAT=COMPRESSED
4057+#
4058+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
4059+SHOW CREATE TABLE t1;
4060+Table Create Table
4061+t1 CREATE TABLE `t1` (
4062+ `a` int(11) DEFAULT NULL
4063+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
4064+OPTIMIZE TABLE t1;
4065+Table Op Msg_type Msg_text
4066+test.t1 optimize status Table is already up to date
4067+SHOW CREATE TABLE t1;
4068+Table Create Table
4069+t1 CREATE TABLE `t1` (
4070+ `a` int(11) DEFAULT NULL
4071+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
4072+DROP TABLE t1;
4073+End of 5.1 tests
4074
4075=== added file 'mysql-test/r/case_insensitive_fs.require'
4076--- mysql-test/r/case_insensitive_fs.require 1970-01-01 00:00:00 +0000
4077+++ mysql-test/r/case_insensitive_fs.require 2009-11-14 20:25:27 +0000
4078@@ -0,0 +1,2 @@
4079+Variable_name Value
4080+lower_case_file_system ON
4081
4082=== modified file 'mysql-test/r/create.result'
4083--- mysql-test/r/create.result 2009-09-23 11:03:47 +0000
4084+++ mysql-test/r/create.result 2009-11-14 20:25:27 +0000
4085@@ -1588,6 +1588,19 @@
4086 SELECT a FROM t1;
4087 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
4088 DROP TABLE t1, t2;
4089+#
4090+# BUG#46384 - mysqld segfault when trying to create table with same
4091+# name as existing view
4092+#
4093+CREATE TABLE t1 (a INT);
4094+CREATE TABLE t2 (a INT);
4095+INSERT INTO t1 VALUES (1),(2),(3);
4096+INSERT INTO t2 VALUES (1),(2),(3);
4097+CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
4098+CREATE TABLE v1 AS SELECT * FROM t1;
4099+ERROR 42S01: Table 'v1' already exists
4100+DROP VIEW v1;
4101+DROP TABLE t1,t2;
4102 End of 5.0 tests
4103 CREATE TABLE t1 (a int, b int);
4104 insert into t1 values (1,1),(1,2);
4105
4106=== modified file 'mysql-test/r/ctype_ldml.result'
4107--- mysql-test/r/ctype_ldml.result 2009-06-04 09:35:29 +0000
4108+++ mysql-test/r/ctype_ldml.result 2009-11-14 20:25:27 +0000
4109@@ -41,6 +41,14 @@
4110 ijkl ijkl
4111 DROP TABLE t1;
4112 #
4113+# Bug#45645 Mysql server close all connection and restart using lower function
4114+#
4115+CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
4116+INSERT INTO t1 (a) VALUES ('hello!');
4117+SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
4118+a
4119+DROP TABLE t1;
4120+#
4121 # Bug#43827 Server closes connections and restarts
4122 #
4123 CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
4124@@ -321,3 +329,11 @@
4125 Xx
4126 YyÝýỲỳỴỵỶỷỸỹ
4127 drop table t1;
4128+Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
4129+set names latin1;
4130+show collation like 'latin1_test';
4131+Collation Charset Id Default Compiled Sortlen
4132+latin1_test latin1 99 Yes 1
4133+select "foo" = "foo " collate latin1_test;
4134+"foo" = "foo " collate latin1_test
4135+1
4136
4137=== added file 'mysql-test/r/debug_sync.result'
4138--- mysql-test/r/debug_sync.result 1970-01-01 00:00:00 +0000
4139+++ mysql-test/r/debug_sync.result 2009-11-14 20:25:27 +0000
4140@@ -0,0 +1,277 @@
4141+SET DEBUG_SYNC= 'RESET';
4142+DROP TABLE IF EXISTS t1;
4143+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4144+Variable_name Value
4145+debug_sync ON - current signal: ''
4146+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
4147+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
4148+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
4149+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
4150+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
4151+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
4152+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
4153+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
4154+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
4155+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
4156+SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
4157+SET DEBUG_SYNC='p0 SIGNAL s1';
4158+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
4159+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
4160+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
4161+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
4162+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
4163+SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
4164+SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
4165+SET DEBUG_SYNC='p0 WAIT_FOR s2';
4166+SET DEBUG_SYNC='p0 HIT_LIMIT 3';
4167+SET DEBUG_SYNC='p0 CLEAR';
4168+SET DEBUG_SYNC='p0 TEST';
4169+SET DEBUG_SYNC='RESET';
4170+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
4171+set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
4172+set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
4173+set debug_sync='p0 signal s1 wait_for s2 timeout 6';
4174+set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
4175+set debug_sync='p0 signal s1 wait_for s2 execute 2';
4176+set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
4177+set debug_sync='p0 signal s1 wait_for s2';
4178+set debug_sync='p0 signal s1 execute 2 hit_limit 3';
4179+set debug_sync='p0 signal s1 execute 2';
4180+set debug_sync='p0 signal s1 hit_limit 3';
4181+set debug_sync='p0 signal s1';
4182+set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
4183+set debug_sync='p0 wait_for s2 timeout 6 execute 2';
4184+set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
4185+set debug_sync='p0 wait_for s2 timeout 6';
4186+set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
4187+set debug_sync='p0 wait_for s2 execute 2';
4188+set debug_sync='p0 wait_for s2 hit_limit 3';
4189+set debug_sync='p0 wait_for s2';
4190+set debug_sync='p0 hit_limit 3';
4191+set debug_sync='p0 clear';
4192+set debug_sync='p0 test';
4193+set debug_sync='reset';
4194+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
4195+ EXECUTE 2 HIT_LIMIT 3';
4196+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
4197+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
4198+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
4199+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
4200+SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
4201+SET DEBUG_SYNC='';
4202+ERROR 42000: Missing synchronization point name
4203+SET DEBUG_SYNC=' ';
4204+ERROR 42000: Missing synchronization point name
4205+SET DEBUG_SYNC='p0';
4206+ERROR 42000: Missing action after synchronization point name 'p0'
4207+SET DEBUG_SYNC='p0 EXECUTE 2';
4208+ERROR 42000: Missing action before EXECUTE
4209+SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
4210+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4211+SET DEBUG_SYNC='p0 TIMEOUT 6';
4212+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4213+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
4214+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4215+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
4216+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4217+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
4218+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4219+SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
4220+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4221+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
4222+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4223+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
4224+ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
4225+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
4226+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4227+SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
4228+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4229+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
4230+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4231+SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
4232+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4233+SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
4234+ERROR 42000: Missing action before EXECUTE
4235+SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
4236+ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
4237+SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
4238+ERROR 42000: Missing action before EXECUTE
4239+SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
4240+ERROR 42000: Nothing must follow action CLEAR
4241+SET DEBUG_SYNC='CLEAR';
4242+ERROR 42000: Missing action after synchronization point name 'CLEAR'
4243+SET DEBUG_SYNC='p0 CLEAR p0';
4244+ERROR 42000: Nothing must follow action CLEAR
4245+SET DEBUG_SYNC='TEST';
4246+ERROR 42000: Missing action after synchronization point name 'TEST'
4247+SET DEBUG_SYNC='p0 TEST p0';
4248+ERROR 42000: Nothing must follow action TEST
4249+SET DEBUG_SYNC='p0 RESET';
4250+ERROR 42000: Illegal or out of order stuff: 'RESET'
4251+SET DEBUG_SYNC='RESET p0';
4252+ERROR 42000: Illegal or out of order stuff: 'p0'
4253+SET DEBUG_SYNC='p0 RESET p0';
4254+ERROR 42000: Illegal or out of order stuff: 'RESET'
4255+SET DEBUG_SYNC='p0 SIGNAL ';
4256+ERROR 42000: Missing signal name after action SIGNAL
4257+SET DEBUG_SYNC='p0 WAIT_FOR ';
4258+ERROR 42000: Missing signal name after action WAIT_FOR
4259+SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
4260+ERROR 42000: Missing valid number after EXECUTE
4261+SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
4262+ERROR HY000: Unknown system variable 'DEBUG_SYNCx'
4263+SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
4264+ERROR 42000: Illegal or out of order stuff: 'SIGNAx'
4265+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
4266+ERROR 42000: Illegal or out of order stuff: 'WAIT_FOx'
4267+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
4268+ERROR 42000: Illegal or out of order stuff: 'TIMEOUx'
4269+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
4270+ERROR 42000: Illegal or out of order stuff: 'EXECUTx'
4271+SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
4272+ERROR 42000: Illegal or out of order stuff: 'HIT_LIMIx'
4273+SET DEBUG_SYNC='p0 CLEARx';
4274+ERROR 42000: Illegal or out of order stuff: 'CLEARx'
4275+SET DEBUG_SYNC='p0 TESTx';
4276+ERROR 42000: Illegal or out of order stuff: 'TESTx'
4277+SET DEBUG_SYNC='RESETx';
4278+ERROR 42000: Missing action after synchronization point name 'RESETx'
4279+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
4280+ERROR 42000: Missing valid number after TIMEOUT
4281+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
4282+ERROR 42000: Missing valid number after EXECUTE
4283+SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
4284+ERROR 42000: Missing valid number after HIT_LIMIT
4285+SET DEBUG_SYNC= 7;
4286+ERROR 42000: Incorrect argument type to variable 'debug_sync'
4287+SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
4288+ERROR HY000: Variable 'debug_sync' is a SESSION variable and can't be used with SET GLOBAL
4289+SET @myvar= 'now SIGNAL from_myvar';
4290+SET DEBUG_SYNC= @myvar;
4291+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4292+Variable_name Value
4293+debug_sync ON - current signal: 'from_myvar'
4294+SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
4295+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4296+Variable_name Value
4297+debug_sync ON - current signal: 'from_function'
4298+SET DEBUG_SYNC= 'now SIGNAL something';
4299+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4300+Variable_name Value
4301+debug_sync ON - current signal: 'something'
4302+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
4303+Warnings:
4304+Warning #### debug sync point wait timed out
4305+SET DEBUG_SYNC= 'now SIGNAL nothing';
4306+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4307+Variable_name Value
4308+debug_sync ON - current signal: 'nothing'
4309+SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
4310+SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
4311+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4312+Variable_name Value
4313+debug_sync ON - current signal: 'nothing'
4314+SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
4315+SET DEBUG_SYNC= 'now HIT_LIMIT 1';
4316+ERROR HY000: debug sync point hit limit reached
4317+SET DEBUG_SYNC= 'RESET';
4318+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4319+Variable_name Value
4320+debug_sync ON - current signal: ''
4321+SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
4322+SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
4323+SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
4324+SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
4325+SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
4326+SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
4327+SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
4328+SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
4329+SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
4330+SET DEBUG_SYNC= 'p4a TEST';
4331+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4332+Variable_name Value
4333+debug_sync ON - current signal: 's4'
4334+SET DEBUG_SYNC= 'p1abcd TEST';
4335+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4336+Variable_name Value
4337+debug_sync ON - current signal: 's1'
4338+SET DEBUG_SYNC= 'p7 TEST';
4339+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4340+Variable_name Value
4341+debug_sync ON - current signal: 's7'
4342+SET DEBUG_SYNC= 'p9abcdef TEST';
4343+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4344+Variable_name Value
4345+debug_sync ON - current signal: 's9'
4346+SET DEBUG_SYNC= 'p3abcdef TEST';
4347+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4348+Variable_name Value
4349+debug_sync ON - current signal: 's3'
4350+SET DEBUG_SYNC= 'p1abcd CLEAR';
4351+SET DEBUG_SYNC= 'p2abc CLEAR';
4352+SET DEBUG_SYNC= 'p5abcde CLEAR';
4353+SET DEBUG_SYNC= 'p6ab CLEAR';
4354+SET DEBUG_SYNC= 'p8abcdef CLEAR';
4355+SET DEBUG_SYNC= 'p9abcdef CLEAR';
4356+SET DEBUG_SYNC= 'p3abcdef CLEAR';
4357+SET DEBUG_SYNC= 'p4a CLEAR';
4358+SET DEBUG_SYNC= 'p7 CLEAR';
4359+SET DEBUG_SYNC= 'p1abcd TEST';
4360+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4361+Variable_name Value
4362+debug_sync ON - current signal: 's3'
4363+SET DEBUG_SYNC= 'p7 TEST';
4364+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4365+Variable_name Value
4366+debug_sync ON - current signal: 's3'
4367+SET DEBUG_SYNC= 'p9abcdef TEST';
4368+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4369+Variable_name Value
4370+debug_sync ON - current signal: 's3'
4371+SET DEBUG_SYNC= 'RESET';
4372+SHOW VARIABLES LIKE 'DEBUG_SYNC';
4373+Variable_name Value
4374+debug_sync ON - current signal: ''
4375+CREATE USER mysqltest_1@localhost;
4376+GRANT SUPER ON *.* TO mysqltest_1@localhost;
4377+connection con1, mysqltest_1
4378+SET DEBUG_SYNC= 'RESET';
4379+connection default
4380+DROP USER mysqltest_1@localhost;
4381+CREATE USER mysqltest_2@localhost;
4382+GRANT ALL ON *.* TO mysqltest_2@localhost;
4383+REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
4384+connection con1, mysqltest_2
4385+SET DEBUG_SYNC= 'RESET';
4386+ERROR 42000: Access denied; you need the SUPER privilege for this operation
4387+connection default
4388+DROP USER mysqltest_2@localhost;
4389+SET DEBUG_SYNC= 'RESET';
4390+DROP TABLE IF EXISTS t1;
4391+CREATE TABLE t1 (c1 INT);
4392+connection con1
4393+SET DEBUG_SYNC= 'before_lock_tables_takes_lock
4394+ SIGNAL opened WAIT_FOR flushed';
4395+INSERT INTO t1 VALUES(1);
4396+connection default
4397+SET DEBUG_SYNC= 'now WAIT_FOR opened';
4398+SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
4399+FLUSH TABLE t1;
4400+connection con1
4401+connection default
4402+DROP TABLE t1;
4403+SET DEBUG_SYNC= 'RESET';
4404+DROP TABLE IF EXISTS t1;
4405+CREATE TABLE t1 (c1 INT);
4406+LOCK TABLE t1 WRITE;
4407+connection con1
4408+SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
4409+INSERT INTO t1 VALUES (1);
4410+connection default
4411+SET DEBUG_SYNC= 'now WAIT_FOR locked';
4412+UNLOCK TABLES;
4413+connection con1
4414+retrieve INSERT result.
4415+connection default
4416+DROP TABLE t1;
4417+SET DEBUG_SYNC= 'RESET';
4418
4419=== modified file 'mysql-test/r/delete.result'
4420--- mysql-test/r/delete.result 2007-12-07 14:15:58 +0000
4421+++ mysql-test/r/delete.result 2009-11-14 20:25:27 +0000
4422@@ -279,3 +279,48 @@
4423 DROP TABLE t1;
4424 DROP FUNCTION f1;
4425 End of 5.0 tests
4426+#
4427+# Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
4428+# merge table
4429+#
4430+CREATE TABLE t1 ( a INT );
4431+CREATE TABLE t2 ( a INT );
4432+CREATE TABLE t3 ( a INT );
4433+INSERT INTO t1 VALUES (1), (2);
4434+INSERT INTO t2 VALUES (1), (2);
4435+INSERT INTO t3 VALUES (1), (2);
4436+CREATE TRIGGER tr1 BEFORE DELETE ON t2
4437+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
4438+DELETE t1, t2, t3 FROM t1, t2, t3;
4439+ERROR 42S02: Table 'test.no_such_table' doesn't exist
4440+SELECT * FROM t1;
4441+a
4442+SELECT * FROM t2;
4443+a
4444+1
4445+2
4446+SELECT * FROM t3;
4447+a
4448+1
4449+2
4450+DROP TABLE t1, t2, t3;
4451+CREATE TABLE t1 ( a INT );
4452+CREATE TABLE t2 ( a INT );
4453+CREATE TABLE t3 ( a INT );
4454+INSERT INTO t1 VALUES (1), (2);
4455+INSERT INTO t2 VALUES (1), (2);
4456+INSERT INTO t3 VALUES (1), (2);
4457+CREATE TRIGGER tr1 AFTER DELETE ON t2
4458+FOR EACH ROW INSERT INTO no_such_table VALUES (1);
4459+DELETE t1, t2, t3 FROM t1, t2, t3;
4460+ERROR 42S02: Table 'test.no_such_table' doesn't exist
4461+SELECT * FROM t1;
4462+a
4463+SELECT * FROM t2;
4464+a
4465+2
4466+SELECT * FROM t3;
4467+a
4468+1
4469+2
4470+DROP TABLE t1, t2, t3;
4471
4472=== modified file 'mysql-test/r/distinct.result'
4473--- mysql-test/r/distinct.result 2009-05-10 16:20:35 +0000
4474+++ mysql-test/r/distinct.result 2009-11-14 20:25:27 +0000
4475@@ -763,4 +763,34 @@
4476 1 2 0 2
4477 1 2 0 3
4478 DROP TABLE t1;
4479+#
4480+# Bug #46159: simple query that never returns
4481+#
4482+SET @old_max_heap_table_size = @@max_heap_table_size;
4483+SET @@max_heap_table_size = 16384;
4484+SET @old_sort_buffer_size = @@sort_buffer_size;
4485+SET @@sort_buffer_size = 32804;
4486+CREATE TABLE t1(c1 int, c2 VARCHAR(20));
4487+INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
4488+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4489+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4490+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4491+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4492+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4493+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4494+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4495+INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
4496+SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
4497+c1 c2 COUNT(*)
4498+1 1 2
4499+2 2 1
4500+3 1 2
4501+4 4 1
4502+SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
4503+c2
4504+1
4505+5
4506+DROP TABLE t1;
4507+SET @@sort_buffer_size = @old_sort_buffer_size;
4508+SET @@max_heap_table_size = @old_max_heap_table_size;
4509 End of 5.1 tests
4510
4511=== modified file 'mysql-test/r/explain.result'
4512--- mysql-test/r/explain.result 2009-06-11 16:21:32 +0000
4513+++ mysql-test/r/explain.result 2009-11-14 20:25:27 +0000
4514@@ -159,6 +159,14 @@
4515 EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
4516 ERROR 42000: Key 'a' doesn't exist in table 't1'
4517 DROP TABLE t1;
4518+CREATE TABLE t1(a LONGTEXT);
4519+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
4520+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
4521+EXPLAIN SELECT DISTINCT 1 FROM t1,
4522+(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
4523+WHERE t1.a = d1.a;
4524+ERROR 42S22: Unknown column 'd1.a' in 'where clause'
4525+DROP TABLE t1;
4526 #
4527 # Bug#37870: Usage of uninitialized value caused failed assertion.
4528 #
4529@@ -186,4 +194,20 @@
4530 2001-01-01 01:01:01
4531 2001-01-01 01:01:01
4532 drop tables t1, t2;
4533+#
4534+# Bug#48295:
4535+# explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
4536+#
4537+CREATE TABLE t1 (f1 INT);
4538+SELECT @@session.sql_mode INTO @old_sql_mode;
4539+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
4540+EXPLAIN EXTENDED SELECT 1 FROM t1
4541+WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
4542+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
4543+SHOW WARNINGS;
4544+Level Code Message
4545+Error 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
4546+Note 1003 select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
4547+SET SESSION sql_mode=@old_sql_mode;
4548+DROP TABLE t1;
4549 End of 5.1 tests.
4550
4551=== modified file 'mysql-test/r/func_group.result'
4552--- mysql-test/r/func_group.result 2009-04-01 11:10:03 +0000
4553+++ mysql-test/r/func_group.result 2009-11-14 20:25:27 +0000
4554@@ -1477,3 +1477,47 @@
4555 SET SQL_MODE=default;
4556 DROP TABLE t1;
4557 End of 5.0 tests
4558+#
4559+# BUG#47280 - strange results from count(*) with order by multiple
4560+# columns without where/group
4561+#
4562+#
4563+# Initialize test
4564+#
4565+CREATE TABLE t1 (
4566+pk INT NOT NULL,
4567+i INT,
4568+PRIMARY KEY (pk)
4569+);
4570+INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
4571+#
4572+# Start test
4573+# All the following queries shall return 1 record
4574+#
4575+
4576+# Masking all correct values {11...13} for column i in this result.
4577+SELECT MAX(pk) as max, i
4578+FROM t1
4579+ORDER BY max;
4580+max i
4581+3 #
4582+
4583+EXPLAIN
4584+SELECT MAX(pk) as max, i
4585+FROM t1
4586+ORDER BY max;
4587+id select_type table type possible_keys key key_len ref rows Extra
4588+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
4589+
4590+# Only 11 is correct for collumn i in this result
4591+SELECT MAX(pk) as max, i
4592+FROM t1
4593+WHERE pk<2
4594+ORDER BY max;
4595+max i
4596+1 11
4597+#
4598+# Cleanup
4599+#
4600+DROP TABLE t1;
4601+End of 5.1 tests
4602
4603=== modified file 'mysql-test/r/func_in.result'
4604--- mysql-test/r/func_in.result 2009-05-25 08:00:40 +0000
4605+++ mysql-test/r/func_in.result 2009-11-14 20:25:27 +0000
4606@@ -608,4 +608,146 @@
4607 ((AVG( 1 ), 1 + c, 1 + d), (AVG( 1 ), 2 + c, 2 + d));
4608 SUM( DISTINCT e )
4609 DROP TABLE t1;
4610+#
4611+# Bug #44139: Table scan when NULL appears in IN clause
4612+#
4613+CREATE TABLE t1 (
4614+c_int INT NOT NULL,
4615+c_decimal DECIMAL(5,2) NOT NULL,
4616+c_float FLOAT(5, 2) NOT NULL,
4617+c_bit BIT(10) NOT NULL,
4618+c_date DATE NOT NULL,
4619+c_datetime DATETIME NOT NULL,
4620+c_timestamp TIMESTAMP NOT NULL,
4621+c_time TIME NOT NULL,
4622+c_year YEAR NOT NULL,
4623+c_char CHAR(10) NOT NULL,
4624+INDEX(c_int), INDEX(c_decimal), INDEX(c_float), INDEX(c_bit), INDEX(c_date),
4625+INDEX(c_datetime), INDEX(c_timestamp), INDEX(c_time), INDEX(c_year),
4626+INDEX(c_char));
4627+INSERT INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
4628+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
4629+INSERT INTO t1 (c_int) SELECT 0 FROM t1;
4630+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
4631+id select_type table type possible_keys key key_len ref rows Extra
4632+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
4633+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
4634+id select_type table type possible_keys key key_len ref rows Extra
4635+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
4636+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
4637+id select_type table type possible_keys key key_len ref rows Extra
4638+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
4639+EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
4640+id select_type table type possible_keys key key_len ref rows Extra
4641+1 SIMPLE t1 range c_int c_int 4 NULL 3 Using where
4642+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
4643+id select_type table type possible_keys key key_len ref rows Extra
4644+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4645+EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL);
4646+id select_type table type possible_keys key key_len ref rows Extra
4647+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4648+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
4649+id select_type table type possible_keys key key_len ref rows Extra
4650+1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
4651+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
4652+id select_type table type possible_keys key key_len ref rows Extra
4653+1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using where
4654+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
4655+id select_type table type possible_keys key key_len ref rows Extra
4656+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4657+EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL);
4658+id select_type table type possible_keys key key_len ref rows Extra
4659+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4660+EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
4661+id select_type table type possible_keys key key_len ref rows Extra
4662+1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
4663+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
4664+id select_type table type possible_keys key key_len ref rows Extra
4665+1 SIMPLE t1 range c_float c_float 4 NULL 3 Using where
4666+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
4667+id select_type table type possible_keys key key_len ref rows Extra
4668+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4669+EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL);
4670+id select_type table type possible_keys key key_len ref rows Extra
4671+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4672+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
4673+id select_type table type possible_keys key key_len ref rows Extra
4674+1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
4675+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
4676+id select_type table type possible_keys key key_len ref rows Extra
4677+1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using where
4678+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
4679+id select_type table type possible_keys key key_len ref rows Extra
4680+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4681+EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL);
4682+id select_type table type possible_keys key key_len ref rows Extra
4683+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4684+EXPLAIN SELECT * FROM t1 WHERE c_date
4685+IN ('2009-09-01', '2009-09-02', '2009-09-03');
4686+id select_type table type possible_keys key key_len ref rows Extra
4687+1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
4688+EXPLAIN SELECT * FROM t1 WHERE c_date
4689+IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
4690+id select_type table type possible_keys key key_len ref rows Extra
4691+1 SIMPLE t1 range c_date c_date 3 NULL 3 Using where
4692+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
4693+id select_type table type possible_keys key key_len ref rows Extra
4694+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4695+EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL);
4696+id select_type table type possible_keys key key_len ref rows Extra
4697+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4698+EXPLAIN SELECT * FROM t1 WHERE c_datetime
4699+IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
4700+id select_type table type possible_keys key key_len ref rows Extra
4701+1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
4702+EXPLAIN SELECT * FROM t1 WHERE c_datetime
4703+IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
4704+id select_type table type possible_keys key key_len ref rows Extra
4705+1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using where
4706+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
4707+id select_type table type possible_keys key key_len ref rows Extra
4708+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4709+EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL);
4710+id select_type table type possible_keys key key_len ref rows Extra
4711+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4712+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
4713+IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
4714+id select_type table type possible_keys key key_len ref rows Extra
4715+1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
4716+EXPLAIN SELECT * FROM t1 WHERE c_timestamp
4717+IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
4718+id select_type table type possible_keys key key_len ref rows Extra
4719+1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using where
4720+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
4721+id select_type table type possible_keys key key_len ref rows Extra
4722+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4723+EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL);
4724+id select_type table type possible_keys key key_len ref rows Extra
4725+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4726+EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
4727+id select_type table type possible_keys key key_len ref rows Extra
4728+1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
4729+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
4730+id select_type table type possible_keys key key_len ref rows Extra
4731+1 SIMPLE t1 range c_year c_year 1 NULL 3 Using where
4732+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
4733+id select_type table type possible_keys key key_len ref rows Extra
4734+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4735+EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL);
4736+id select_type table type possible_keys key key_len ref rows Extra
4737+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4738+EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
4739+id select_type table type possible_keys key key_len ref rows Extra
4740+1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
4741+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
4742+id select_type table type possible_keys key key_len ref rows Extra
4743+1 SIMPLE t1 range c_char c_char 10 NULL 3 Using where
4744+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
4745+id select_type table type possible_keys key key_len ref rows Extra
4746+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4747+EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
4748+id select_type table type possible_keys key key_len ref rows Extra
4749+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
4750+DROP TABLE t1;
4751+#
4752 End of 5.1 tests
4753
4754=== modified file 'mysql-test/r/func_str.result'
4755--- mysql-test/r/func_str.result 2009-05-13 18:39:35 +0000
4756+++ mysql-test/r/func_str.result 2009-11-14 20:25:27 +0000
4757@@ -2534,6 +2534,15 @@
4758 LOAD_FILE(a)
4759 NULL
4760 DROP TABLE t1;
4761+CREATE TABLE t1 (f2 VARCHAR(20));
4762+CREATE TABLE t2 (f2 VARCHAR(20));
4763+INSERT INTO t1 VALUES ('MIN'),('MAX');
4764+INSERT INTO t2 VALUES ('LOAD');
4765+SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
4766+concat_name
4767+LOAD_MIN
4768+LOAD_MAX
4769+DROP TABLE t1, t2;
4770 End of 5.0 tests
4771 drop table if exists t1;
4772 create table t1(f1 tinyint default null)engine=myisam;
4773
4774=== modified file 'mysql-test/r/gis-rtree.result'
4775--- mysql-test/r/gis-rtree.result 2009-10-28 07:52:34 +0000
4776+++ mysql-test/r/gis-rtree.result 2009-11-14 20:25:27 +0000
4777@@ -1037,4 +1037,43 @@
4778 COUNT(*)
4779 2
4780 DROP TABLE t1;
4781+#
4782+# Bug #48258: Assertion failed when using a spatial index
4783+#
4784+CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
4785+INSERT INTO t1 VALUES
4786+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
4787+(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
4788+EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4789+id select_type table type possible_keys key key_len ref rows Extra
4790+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
4791+SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4792+1
4793+1
4794+1
4795+EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4796+id select_type table type possible_keys key key_len ref rows Extra
4797+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
4798+SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4799+1
4800+EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4801+id select_type table type possible_keys key key_len ref rows Extra
4802+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
4803+SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4804+1
4805+1
4806+1
4807+EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4808+id select_type table type possible_keys key key_len ref rows Extra
4809+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
4810+SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4811+1
4812+EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4813+id select_type table type possible_keys key key_len ref rows Extra
4814+1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where
4815+SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
4816+1
4817+1
4818+1
4819+DROP TABLE t1;
4820 End of 5.0 tests.
4821
4822=== modified file 'mysql-test/r/gis.result'
4823--- mysql-test/r/gis.result 2009-07-10 23:12:13 +0000
4824+++ mysql-test/r/gis.result 2009-11-14 20:25:27 +0000
4825@@ -972,6 +972,18 @@
4826 min(`col002`)
4827 NULL
4828 drop table t1;
4829+#
4830+# Bug #47780: crash when comparing GIS items from subquery
4831+#
4832+CREATE TABLE t1(a INT, b MULTIPOLYGON);
4833+INSERT INTO t1 VALUES
4834+(0,
4835+GEOMFROMTEXT(
4836+'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
4837+# must not crash
4838+SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
4839+1
4840+DROP TABLE t1;
4841 End of 5.0 tests
4842 create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
4843 create view v1 as select * from t1;
4844
4845=== modified file 'mysql-test/r/grant.result'
4846--- mysql-test/r/grant.result 2009-06-15 15:53:45 +0000
4847+++ mysql-test/r/grant.result 2009-11-14 20:25:27 +0000
4848@@ -1007,8 +1007,8 @@
4849 SHOW GRANTS;
4850 Grants for mysqltest_1@localhost
4851 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
4852+GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
4853 GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
4854-GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
4855 RENAME TABLE t1 TO t2;
4856 RENAME TABLE t2 TO t1;
4857 ALTER TABLE t1 RENAME TO t2;
4858@@ -1018,8 +1018,8 @@
4859 SHOW GRANTS;
4860 Grants for mysqltest_1@localhost
4861 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
4862+GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
4863 GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
4864-GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
4865 RENAME TABLE t1 TO t2;
4866 ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
4867 ALTER TABLE t1 RENAME TO t2;
4868
4869=== modified file 'mysql-test/r/grant3.result'
4870--- mysql-test/r/grant3.result 2008-02-13 15:34:12 +0000
4871+++ mysql-test/r/grant3.result 2009-11-14 20:25:27 +0000
4872@@ -154,4 +154,42 @@
4873 a
4874 DROP USER 'mysqltest1'@'%';
4875 DROP DATABASE mysqltest_1;
4876+#
4877+# Bug#41597 - After rename of user, there are additional grants
4878+# when grants are reapplied.
4879+#
4880+CREATE DATABASE temp;
4881+CREATE TABLE temp.t1(a INT, b VARCHAR(10));
4882+INSERT INTO temp.t1 VALUES(1, 'name1');
4883+INSERT INTO temp.t1 VALUES(2, 'name2');
4884+INSERT INTO temp.t1 VALUES(3, 'name3');
4885+CREATE USER 'user1'@'%';
4886+RENAME USER 'user1'@'%' TO 'user2'@'%';
4887+# Show privileges after rename and BEFORE grant
4888+SHOW GRANTS FOR 'user2'@'%';
4889+Grants for user2@%
4890+GRANT USAGE ON *.* TO 'user2'@'%'
4891+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
4892+# Show privileges after rename and grant
4893+SHOW GRANTS FOR 'user2'@'%';
4894+Grants for user2@%
4895+GRANT USAGE ON *.* TO 'user2'@'%'
4896+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
4897+# Connect as the renamed user
4898+SHOW GRANTS;
4899+Grants for user2@%
4900+GRANT USAGE ON *.* TO 'user2'@'%'
4901+GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%'
4902+SELECT a FROM temp.t1;
4903+a
4904+1
4905+2
4906+3
4907+# Check for additional privileges by accessing a
4908+# non privileged column. We shouldn't be able to
4909+# access this column.
4910+SELECT b FROM temp.t1;
4911+ERROR 42000: SELECT command denied to user 'user2'@'localhost' for column 'b' in table 't1'
4912+DROP USER 'user2'@'%';
4913+DROP DATABASE temp;
4914 End of 5.0 tests
4915
4916=== added file 'mysql-test/r/grant_lowercase_fs.result'
4917--- mysql-test/r/grant_lowercase_fs.result 1970-01-01 00:00:00 +0000
4918+++ mysql-test/r/grant_lowercase_fs.result 2009-11-14 20:25:27 +0000
4919@@ -0,0 +1,16 @@
4920+create database db1;
4921+GRANT CREATE ON db1.* to user_1@localhost;
4922+GRANT SELECT ON db1.* to USER_1@localhost;
4923+CREATE TABLE t1(f1 int);
4924+SELECT * FROM t1;
4925+ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
4926+SELECT * FROM t1;
4927+f1
4928+CREATE TABLE t2(f1 int);
4929+ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
4930+REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
4931+REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
4932+DROP USER user_1@localhost;
4933+DROP USER USER_1@localhost;
4934+DROP DATABASE db1;
4935+use test;
4936
4937=== modified file 'mysql-test/r/group_min_max.result'
4938--- mysql-test/r/group_min_max.result 2009-08-30 07:03:37 +0000
4939+++ mysql-test/r/group_min_max.result 2009-11-14 20:25:27 +0000
4940@@ -876,10 +876,10 @@
4941 1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
4942 explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
4943 id select_type table type possible_keys key key_len ref rows Extra
4944-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
4945+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
4946 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
4947 id select_type table type possible_keys key key_len ref rows Extra
4948-1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
4949+1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
4950 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
4951 id select_type table type possible_keys key key_len ref rows Extra
4952 1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
4953@@ -924,7 +924,7 @@
4954 1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
4955 explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
4956 id select_type table type possible_keys key key_len ref rows Extra
4957-1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
4958+1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
4959 explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
4960 id select_type table type possible_keys key key_len ref rows Extra
4961 1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
4962
4963=== added file 'mysql-test/r/have_debug_sync.require'
4964--- mysql-test/r/have_debug_sync.require 1970-01-01 00:00:00 +0000
4965+++ mysql-test/r/have_debug_sync.require 2009-11-14 20:25:27 +0000
4966@@ -0,0 +1,2 @@
4967+debug_sync
4968+1
4969
4970=== modified file 'mysql-test/r/information_schema_db.result'
4971--- mysql-test/r/information_schema_db.result 2009-09-07 20:50:10 +0000
4972+++ mysql-test/r/information_schema_db.result 2009-11-14 20:25:27 +0000
4973@@ -108,7 +108,7 @@
4974 View Create View character_set_client collation_connection
4975 v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
4976 Warnings:
4977-Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
4978+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
4979 show fields from testdb_1.v7;
4980 Field Type Null Key Default Extra
4981 f1 char(4) YES NULL
4982@@ -138,7 +138,7 @@
4983 View Create View character_set_client collation_connection
4984 v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
4985 Warnings:
4986-Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
4987+Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
4988 revoke insert(f1) on v3 from testdb_2@localhost;
4989 revoke show view on v5 from testdb_2@localhost;
4990 use testdb_1;
4991@@ -156,7 +156,8 @@
4992 show create view testdb_1.v7;
4993 ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
4994 show create view v4;
4995-ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
4996+View Create View character_set_client collation_connection
4997+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `v3`.`f1` AS `f1`,`v3`.`f2` AS `f2` from `testdb_1`.`v3` latin1 latin1_swedish_ci
4998 show fields from v4;
4999 Field Type Null Key Default Extra
5000 f1 char(4) YES NULL
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches