From: Tor Didriksen Date: November 1 2010 9:52am Subject: bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3350) List-Archive: http://lists.mysql.com/commits/122403 Message-Id: <20101101095225.DA2C6376A@atum07.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///export/home/didrik/repo/next-mr-bugfixing/ based on revid:dao-gang.qu@stripped 3350 Tor Didriksen 2010-11-01 [merge] Merge trunk-bugfixing => next-mr-bugfixing Text conflict in client/mysqlbinlog.cc Text conflict in mysql-test/t/mysqlbinlog.test modified: client/mysqlbinlog.cc mysql-test/r/ctype_binary.result mysql-test/r/ctype_cp1251.result mysql-test/r/ctype_latin1.result mysql-test/r/ctype_ucs.result mysql-test/r/ctype_utf8.result mysql-test/r/func_time.result mysql-test/r/mysqlbinlog.result mysql-test/r/type_blob.result mysql-test/t/func_time.test mysql-test/t/mysqlbinlog.test mysql-test/t/type_blob.test sql/item_timefunc.h sql/log_event.h sql/sql_select.cc storage/innobase/os/os0sync.c === modified file 'client/mysqlbinlog.cc' --- a/client/mysqlbinlog.cc 2010-11-01 05:40:27 +0000 +++ b/client/mysqlbinlog.cc 2010-11-01 09:52:05 +0000 @@ -68,7 +68,7 @@ static void warning(const char *format, static my_bool one_database=0, disable_log_bin= 0; static my_bool opt_hexdump= 0; const char *base64_output_mode_names[]= -{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS}; +{"NEVER", "AUTO", "UNSPEC", "DECODE-ROWS", NullS}; TYPELIB base64_output_mode_typelib= { array_elements(base64_output_mode_names) - 1, "", base64_output_mode_names, NULL }; @@ -634,45 +634,6 @@ static bool shall_skip_database(const ch /** - Prints the given event in base64 format. - - The header is printed to the head cache and the body is printed to - the body cache of the print_event_info structure. This allows all - base64 events corresponding to the same statement to be joined into - one BINLOG statement. - - @param[in] ev Log_event to print. - @param[in,out] result_file FILE to which the output will be written. - @param[in,out] print_event_info Parameters and context state - determining how to print. - - @retval ERROR_STOP An error occurred - the program should terminate. - @retval OK_CONTINUE No error, the program should continue. -*/ -static Exit_status -write_event_header_and_base64(Log_event *ev, FILE *result_file, - PRINT_EVENT_INFO *print_event_info) -{ - IO_CACHE *head= &print_event_info->head_cache; - IO_CACHE *body= &print_event_info->body_cache; - DBUG_ENTER("write_event_header_and_base64"); - - /* Write header and base64 output to cache */ - ev->print_header(head, print_event_info, FALSE); - ev->print_base64(body, print_event_info, FALSE); - - /* Read data from cache and write to result file */ - if (copy_event_cache_to_file_and_reinit(head, result_file) || - copy_event_cache_to_file_and_reinit(body, result_file)) - { - error("Error writing event to file."); - DBUG_RETURN(ERROR_STOP); - } - DBUG_RETURN(OK_CONTINUE); -} - - -/** Print the given event, and either delete it or delegate the deletion to someone else. @@ -748,15 +709,7 @@ Exit_status process_event(PRINT_EVENT_IN if (!((Query_log_event*)ev)->is_trans_keyword() && shall_skip_database(((Query_log_event*)ev)->db)) goto end; - if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS) - { - if ((retval= write_event_header_and_base64(ev, result_file, - print_event_info)) != - OK_CONTINUE) - goto end; - } - else - ev->print(result_file, print_event_info); + ev->print(result_file, print_event_info); break; case CREATE_FILE_EVENT: @@ -777,15 +730,7 @@ Exit_status process_event(PRINT_EVENT_IN filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT' below. */ - if (opt_base64_output_mode == BASE64_OUTPUT_ALWAYS) - { - if ((retval= write_event_header_and_base64(ce, result_file, - print_event_info)) != - OK_CONTINUE) - goto end; - } - else - ce->print(result_file, print_event_info, TRUE); + ce->print(result_file, print_event_info, TRUE); // If this binlog is not 3.23 ; why this test?? if (glob_description_event->binlog_version >= 3) @@ -1046,12 +991,10 @@ static struct my_option my_long_options[ "row-based events; 'decode-rows' decodes row events into commented SQL " "statements if the --verbose option is also given; 'auto' prints base64 " "only when necessary (i.e., for row-based events and format description " - "events); 'always' prints base64 whenever possible. 'always' is for " - "debugging only and should not be used in a production system. If this " - "argument is not given, the default is 'auto'; if it is given with no " - "argument, 'always' is used.", + "events). If no --base64-output[=name] option is given at all, the " + "default is 'auto'.", &opt_base64_output_mode_str, &opt_base64_output_mode_str, - 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bind-address", 0, "IP address to bind to.", (uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1381,13 +1324,8 @@ get_one_option(int optid, const struct m stop_datetime= convert_str_to_timestamp(stop_datetime_str); break; case OPT_BASE64_OUTPUT_MODE: - if (argument == NULL) - opt_base64_output_mode= BASE64_OUTPUT_ALWAYS; - else - { - opt_base64_output_mode= (enum_base64_output_mode) - (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1); - } + opt_base64_output_mode= (enum_base64_output_mode) + (find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1); break; case 'v': if (argument == disabled_my_option) @@ -1973,8 +1911,7 @@ static Exit_status check_header(IO_CACHE (ulonglong)tmp_pos); return ERROR_STOP; } - if (opt_base64_output_mode == BASE64_OUTPUT_AUTO - || opt_base64_output_mode == BASE64_OUTPUT_ALWAYS) + if (opt_base64_output_mode == BASE64_OUTPUT_AUTO) { /* process_event will delete *description_event and set it to === modified file 'mysql-test/r/ctype_binary.result' --- a/mysql-test/r/ctype_binary.result 2010-08-19 11:55:35 +0000 +++ b/mysql-test/r/ctype_binary.result 2010-10-31 23:23:37 +0000 @@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(10) NOT NULL DEFAULT '' + `c1` varbinary(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); === modified file 'mysql-test/r/ctype_cp1251.result' --- a/mysql-test/r/ctype_cp1251.result 2010-08-19 12:54:22 +0000 +++ b/mysql-test/r/ctype_cp1251.result 2010-11-01 09:52:05 +0000 @@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); === modified file 'mysql-test/r/ctype_latin1.result' --- a/mysql-test/r/ctype_latin1.result 2010-08-19 12:17:24 +0000 +++ b/mysql-test/r/ctype_latin1.result 2010-10-31 23:37:14 +0000 @@ -1835,7 +1835,7 @@ create table t1 as select concat(time_to show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) NOT NULL DEFAULT '' + `c1` varchar(10) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); === modified file 'mysql-test/r/ctype_ucs.result' --- a/mysql-test/r/ctype_ucs.result 2010-10-21 09:49:16 +0000 +++ b/mysql-test/r/ctype_ucs.result 2010-11-01 09:52:05 +0000 @@ -2733,7 +2733,7 @@ create table t1 as select concat(time_to show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); === modified file 'mysql-test/r/ctype_utf8.result' --- a/mysql-test/r/ctype_utf8.result 2010-08-30 06:38:09 +0000 +++ b/mysql-test/r/ctype_utf8.result 2010-11-01 09:52:05 +0000 @@ -3602,7 +3602,7 @@ create table t1 as select concat(time_to show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(extract(year from 20090702))); === modified file 'mysql-test/r/func_time.result' --- a/mysql-test/r/func_time.result 2010-10-21 09:49:16 +0000 +++ b/mysql-test/r/func_time.result 2010-11-01 09:52:05 +0000 @@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a 1 1 DROP TABLE t1; +# +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +# +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +COUNT(*) +2 +Warnings: +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: '' +DROP TABLE t1; End of 5.1 tests # # BUG#43578 "MyISAM&Maria gives wrong rows with range access === modified file 'mysql-test/r/mysqlbinlog.result' --- a/mysql-test/r/mysqlbinlog.result 2010-08-20 03:37:42 +0000 +++ b/mysql-test/r/mysqlbinlog.result 2010-10-29 15:57:09 +0000 @@ -879,3 +879,9 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; End of 5.0 tests End of 5.1 tests +# Expect error for unknown argument. +Unknown option to base64-output: always +Alternatives are: 'NEVER','AUTO','UNSPEC','DECODE-ROWS' +# Expect error for unknown argument again. +Unknown option to base64-output: std_data/master-bin.000001 +Alternatives are: 'NEVER','AUTO','UNSPEC','DECODE-ROWS' === modified file 'mysql-test/r/type_blob.result' --- a/mysql-test/r/type_blob.result 2010-10-25 09:20:53 +0000 +++ b/mysql-test/r/type_blob.result 2010-11-01 09:52:05 +0000 @@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2; LENGTH(c) 65535 DROP TABLE t1, t2; +# Bug #52160: crash and inconsistent results when grouping +# by a function and column +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; +COUNT(*) +2 +DROP FUNCTION f1; +DROP TABLE t1; End of 5.1 tests === modified file 'mysql-test/t/func_time.test' --- a/mysql-test/t/func_time.test 2010-10-21 09:49:16 +0000 +++ b/mysql-test/t/func_time.test 2010-11-01 09:52:05 +0000 @@ -832,6 +832,16 @@ INSERT INTO t1 VALUES (0),(9.216e-096); SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); DROP TABLE t1; +--echo # +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column +--echo # + +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +DROP TABLE t1; + --echo End of 5.1 tests --echo # === modified file 'mysql-test/t/mysqlbinlog.test' --- a/mysql-test/t/mysqlbinlog.test 2010-10-18 12:18:18 +0000 +++ b/mysql-test/t/mysqlbinlog.test 2010-11-01 09:52:05 +0000 @@ -494,3 +494,19 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqlb # --exec $MYSQL_BINLOG --short-form --read-from-remote-server --protocol=tcp --bind-address=127.0.0.1 master-bin.000001 > /dev/null +# +# WL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output +# + +--echo # Expect error for unknown argument. +--error 1 +--exec $MYSQL_BINLOG --base64-output=always std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn +--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +--echo # Expect error for unknown argument again. +--error 1 +--exec $MYSQL_BINLOG --base64-output std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn +--cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +# Clean up this part of the test. +--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn === modified file 'mysql-test/t/type_blob.test' --- a/mysql-test/t/type_blob.test 2010-10-25 09:20:53 +0000 +++ b/mysql-test/t/type_blob.test 2010-11-01 09:52:05 +0000 @@ -617,4 +617,17 @@ SELECT LENGTH(c) FROM t2; DROP TABLE t1, t2; +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column + +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; + +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); + +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; + +DROP FUNCTION f1; +DROP TABLE t1; + --echo End of 5.1 tests === modified file 'sql/item_timefunc.h' --- a/sql/item_timefunc.h 2010-10-07 10:26:57 +0000 +++ b/sql/item_timefunc.h 2010-10-31 23:37:14 +0000 @@ -361,6 +361,7 @@ public: const char *func_name() const { return "time_to_sec"; } void fix_length_and_dec() { + maybe_null= TRUE; decimals=0; max_length=10*MY_CHARSET_BIN_MB_MAXLEN; } === modified file 'sql/log_event.h' --- a/sql/log_event.h 2010-10-21 13:05:32 +0000 +++ b/sql/log_event.h 2010-11-01 09:52:05 +0000 @@ -649,9 +649,8 @@ class Relay_log_info; enum enum_base64_output_mode { BASE64_OUTPUT_NEVER= 0, BASE64_OUTPUT_AUTO= 1, - BASE64_OUTPUT_ALWAYS= 2, - BASE64_OUTPUT_UNSPEC= 3, - BASE64_OUTPUT_DECODE_ROWS= 4, + BASE64_OUTPUT_UNSPEC= 2, + BASE64_OUTPUT_DECODE_ROWS= 3, /* insert new output modes here */ BASE64_OUTPUT_MODE_COUNT }; === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-10-27 14:46:44 +0000 +++ b/sql/sql_select.cc 2010-11-01 09:52:05 +0000 @@ -21066,6 +21066,8 @@ calc_group_buffer(JOIN *join,ORDER *grou { key_length+= 8; } + else if (type == MYSQL_TYPE_BLOB) + key_length+= MAX_BLOB_WIDTH; // Can't be used as a key else { /* === modified file 'storage/innobase/os/os0sync.c' --- a/storage/innobase/os/os0sync.c 2010-10-28 17:28:56 +0000 +++ b/storage/innobase/os/os0sync.c 2010-11-01 09:52:05 +0000 @@ -656,7 +656,7 @@ os_event_wait_time_low( os_event_reset(). */ { - ibool timed_out; + ibool timed_out = FALSE; ib_int64_t old_signal_count; #ifdef __WIN__ No bundle (reason: revision is a merge).