From f3b4465de979916621a14535f7465282535cbe2d Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Thu, 5 Oct 2006 17:29:50 +0500 Subject: [PATCH 001/160] Fix for bug #22377: iNCONSISTENCY WITH null Backport. See #20910: NOT NULL column reported as NULL in SHOW FIELDS or INFORMATION_SCHEMA --- mysql-test/r/type_ranges.result | 6 +++--- mysql-test/r/type_timestamp.result | 18 +++++++++--------- sql/sql_show.cc | 11 +---------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 90207f39417..2e8fa4c26b7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -54,7 +54,7 @@ ushort smallint(5) unsigned zerofill NULL MUL 00000 # umedium mediumint(8) unsigned NULL MUL 0 # ulong int(11) unsigned NULL MUL 0 # ulonglong bigint(13) unsigned NULL MUL 0 # -time_stamp timestamp NULL YES CURRENT_TIMESTAMP # +time_stamp timestamp NULL CURRENT_TIMESTAMP # date_field date NULL YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -222,7 +222,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 # umedium mediumint(8) unsigned NULL MUL 0 # ulong int(11) unsigned NULL MUL 0 # ulonglong bigint(13) unsigned NULL MUL 0 # -time_stamp timestamp NULL YES CURRENT_TIMESTAMP # +time_stamp timestamp NULL CURRENT_TIMESTAMP # date_field varchar(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -248,7 +248,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 # umedium mediumint(8) unsigned NULL 0 # ulong int(11) unsigned NULL 0 # ulonglong bigint(13) unsigned NULL 0 # -time_stamp timestamp NULL YES 0000-00-00 00:00:00 # +time_stamp timestamp NULL 0000-00-00 00:00:00 # date_field varchar(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index c0396e4640d..4e71d76785a 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -188,9 +188,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES 2003-01-01 00:00:00 +t1 timestamp 2003-01-01 00:00:00 t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); SET TIMESTAMP=1000000002; @@ -212,9 +212,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp CURRENT_TIMESTAMP t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); SET TIMESTAMP=1000000004; @@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES 2003-01-01 00:00:00 +t1 timestamp 2003-01-01 00:00:00 t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp default now() on update now(), t2 datetime); @@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp, t2 datetime, t3 timestamp); @@ -289,9 +289,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp CURRENT_TIMESTAMP t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); SET TIMESTAMP=1000000009; @@ -315,7 +315,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp CURRENT_TIMESTAMP t2 datetime YES NULL delete from t1; insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 41e145790e9..bd4d7c4d851 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -714,16 +714,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, if (verbose) protocol->store(field->has_charset() ? field->charset()->name : "NULL", system_charset_info); - /* - Even if TIMESTAMP field can't contain NULL as its value it - will accept NULL if you will try to insert such value and will - convert NULL value to current TIMESTAMP. So YES here means - that NULL is allowed for assignment (but may be won't be - returned). - */ - pos=(byte*) ((flags & NOT_NULL_FLAG) && - field->type() != FIELD_TYPE_TIMESTAMP ? - "" : "YES"); + pos= (byte*) ((flags & NOT_NULL_FLAG) ? "" : "YES"); protocol->store((const char*) pos, system_charset_info); pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" : (field->flags & UNIQUE_KEY_FLAG) ? "UNI" : From 413d18658f86d0e94c2ad91fb058ee56bbbdb06f Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Wed, 8 Nov 2006 15:37:54 +0400 Subject: [PATCH 002/160] Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails Problem: After introducing of LC_TIME_NAMES variable, the function date_format() can return international non-ascii characters in month and weekday names. Thus, it cannot return a binary string anymore, because inserting a result of date_format() into a column with non-utf8 character set produces garbage. Fix: date_format() now returns a character string, using "collation_connection" to detect character set and collation for the returned value. This allows to insert results of date_format() properly into columns with various character sets. --- mysql-test/r/ctype_utf8.result | 24 +++++++++- mysql-test/t/ctype_utf8.test | 20 ++++++++ sql/item_timefunc.cc | 83 +++++++++++++++------------------- 3 files changed, 79 insertions(+), 48 deletions(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index fdf21a50a02..24f29b23e87 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -124,12 +124,34 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` binary(10) default NULL + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(10) character set utf8 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") 2004-01-19 drop table t1; +set names utf8; +set LC_TIME_NAMES='fr_FR'; +create table t1 (s1 char(20) character set latin1); +insert into t1 values (date_format('2004-02-02','%M')); +select hex(s1) from t1; +hex(s1) +66E97672696572 +drop table t1; +create table t1 (s1 char(20) character set koi8r); +set LC_TIME_NAMES='ru_RU'; +insert into t1 values (date_format('2004-02-02','%M')); +insert into t1 values (date_format('2004-02-02','%b')); +insert into t1 values (date_format('2004-02-02','%W')); +insert into t1 values (date_format('2004-02-02','%a')); +select hex(s1), s1 from t1; +hex(s1) s1 +E6C5D7D2C1CCD1 Февраля +E6C5D7 Фев +F0CFCEC5C4C5CCD8CEC9CB Понедельник +F0CEC4 Пнд +drop table t1; +set LC_TIME_NAMES='en_US'; set names koi8r; create table t1 (s1 char(1) character set utf8); insert into t1 values (_koi8r''); diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index af40121852f..0b3f9ed2400 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -93,6 +93,26 @@ show create table t1; select * from t1; drop table t1; +# +# Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails +# +set names utf8; +set LC_TIME_NAMES='fr_FR'; +create table t1 (s1 char(20) character set latin1); +insert into t1 values (date_format('2004-02-02','%M')); +select hex(s1) from t1; +drop table t1; +create table t1 (s1 char(20) character set koi8r); +set LC_TIME_NAMES='ru_RU'; +insert into t1 values (date_format('2004-02-02','%M')); +insert into t1 values (date_format('2004-02-02','%b')); +insert into t1 values (date_format('2004-02-02','%W')); +insert into t1 values (date_format('2004-02-02','%a')); +select hex(s1), s1 from t1; +drop table t1; +set LC_TIME_NAMES='en_US'; + + # # Bug #2366 Wrong utf8 behaviour when data is truncated # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index c1bca7afc60..8334c8ea3fa 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -595,16 +595,10 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, uint weekday; ulong length; const char *ptr, *end; - MY_LOCALE *locale; THD *thd= current_thd; - char buf[128]; - String tmp(buf, sizeof(buf), thd->variables.character_set_results); - uint errors= 0; + MY_LOCALE *locale= thd->variables.lc_time_names; - tmp.length(0); str->length(0); - str->set_charset(&my_charset_bin); - locale = thd->variables.lc_time_names; if (l_time->neg) str->append("-", 1); @@ -618,41 +612,37 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, { switch (*++ptr) { case 'M': - if (!l_time->month) - return 1; - tmp.copy(locale->month_names->type_names[l_time->month-1], - strlen(locale->month_names->type_names[l_time->month-1]), - system_charset_info, tmp.charset(), &errors); - str->append(tmp.ptr(), tmp.length()); - break; + if (!l_time->month) + return 1; + str->append(locale->month_names->type_names[l_time->month-1], + strlen(locale->month_names->type_names[l_time->month-1]), + system_charset_info); + break; case 'b': - if (!l_time->month) - return 1; - tmp.copy(locale->ab_month_names->type_names[l_time->month-1], - strlen(locale->ab_month_names->type_names[l_time->month-1]), - system_charset_info, tmp.charset(), &errors); - str->append(tmp.ptr(), tmp.length()); - break; + if (!l_time->month) + return 1; + str->append(locale->ab_month_names->type_names[l_time->month-1], + strlen(locale->ab_month_names->type_names[l_time->month-1]), + system_charset_info); + break; case 'W': - if (type == MYSQL_TIMESTAMP_TIME) - return 1; - weekday= calc_weekday(calc_daynr(l_time->year,l_time->month, - l_time->day),0); - tmp.copy(locale->day_names->type_names[weekday], - strlen(locale->day_names->type_names[weekday]), - system_charset_info, tmp.charset(), &errors); - str->append(tmp.ptr(), tmp.length()); - break; + if (type == MYSQL_TIMESTAMP_TIME) + return 1; + weekday= calc_weekday(calc_daynr(l_time->year,l_time->month, + l_time->day),0); + str->append(locale->day_names->type_names[weekday], + strlen(locale->day_names->type_names[weekday]), + system_charset_info); + break; case 'a': - if (type == MYSQL_TIMESTAMP_TIME) - return 1; - weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, - l_time->day),0); - tmp.copy(locale->ab_day_names->type_names[weekday], - strlen(locale->ab_day_names->type_names[weekday]), - system_charset_info, tmp.charset(), &errors); - str->append(tmp.ptr(), tmp.length()); - break; + if (type == MYSQL_TIMESTAMP_TIME) + return 1; + weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, + l_time->day),0); + str->append(locale->ab_day_names->type_names[weekday], + strlen(locale->ab_day_names->type_names[weekday]), + system_charset_info); + break; case 'D': if (type == MYSQL_TIMESTAMP_TIME) return 1; @@ -1638,8 +1628,9 @@ longlong Item_func_sec_to_time::val_int() void Item_func_date_format::fix_length_and_dec() { + THD* thd= current_thd; decimals=0; - collation.set(&my_charset_bin); + collation.set(thd->variables.collation_connection); if (args[1]->type() == STRING_ITEM) { // Optimize the normal case fixed_length=1; @@ -1653,17 +1644,14 @@ void Item_func_date_format::fix_length_and_dec() args[1]->collation.set( get_charset_by_csname(args[1]->collation.collation->csname, MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE); - /* - The result is a binary string (no reason to use collation->mbmaxlen - This is becasue make_date_time() only returns binary strings - */ - max_length= format_length(((Item_string*) args[1])->const_string()); + max_length= format_length(((Item_string*) args[1])->const_string()) * + collation.collation->mbmaxlen; } else { fixed_length=0; - /* The result is a binary string (no reason to use collation->mbmaxlen */ - max_length=min(args[1]->max_length,MAX_BLOB_WIDTH) * 10; + max_length= min(args[1]->max_length,MAX_BLOB_WIDTH) * 10 * + collation.collation->mbmaxlen; set_if_smaller(max_length,MAX_BLOB_WIDTH); } maybe_null=1; // If wrong date @@ -1783,6 +1771,7 @@ String *Item_func_date_format::val_str(String *str) date_time_format.format.length= format->length(); /* Create the result string */ + str->set_charset(collation.collation); if (!make_date_time(&date_time_format, &l_time, is_time_format ? MYSQL_TIMESTAMP_TIME : MYSQL_TIMESTAMP_DATE, From a5de478d5153512b52881a23922d1b6a7a89fcab Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 9 Nov 2006 14:27:34 +0400 Subject: [PATCH 003/160] Bug#23619 Incorrectly escaped multibyte characters in binary log break replication Problem: when embedding a character string with introducer with charset X into a SQL query which is generally in character set Y, the string constants were escaped according to their own character set (i.e.X), then after reading such a "mixed" query from binlog, the string constants were unescaped using character set of the query (i.e. Y), instead of X, which gave wrong results or even syntax errors with tricky charsets (e.g. sjis) Fix: when embedding a string constant of charset X into a query of charset Y, the string constant is now escaped according to character Y, instead of its own character set X. --- mysql-test/r/ctype_cp932_binlog.result | 6 +++--- mysql-test/r/rpl_charset_sjis.result | 26 ++++++++++++++++++++++++++ mysql-test/t/rpl_charset_sjis.test | 25 +++++++++++++++++++++++++ sql/log_event.cc | 2 +- sql/sp_head.cc | 11 ++++++----- 5 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 mysql-test/r/rpl_charset_sjis.result create mode 100644 mysql-test/t/rpl_charset_sjis.test diff --git a/mysql-test/r/ctype_cp932_binlog.result b/mysql-test/r/ctype_cp932_binlog.result index 6d742f3d464..d3d800b7bf0 100644 --- a/mysql-test/r/ctype_cp932_binlog.result +++ b/mysql-test/r/ctype_cp932_binlog.result @@ -41,6 +41,6 @@ IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4 +master-bin.000001 801 Query 1 1017 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 1017 Query 1 1103 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1103 Query 1 1179 use `test`; DROP TABLE t4 diff --git a/mysql-test/r/rpl_charset_sjis.result b/mysql-test/r/rpl_charset_sjis.result new file mode 100644 index 00000000000..770ad0588d1 --- /dev/null +++ b/mysql-test/r/rpl_charset_sjis.result @@ -0,0 +1,26 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +drop table if exists t1; +drop procedure if exists p1; +create table t1 (a varchar(255) character set sjis); +create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a); +SET NAMES binary; +CALL p1 ('\\'); +select "--- on master ---"; +--- on master --- +--- on master --- +select hex(a) from t1 ; +hex(a) +965C +select "--- on slave ---"; +--- on slave --- +--- on slave --- +select hex(a) from t1; +hex(a) +965C +drop table t1; +drop procedure p1; diff --git a/mysql-test/t/rpl_charset_sjis.test b/mysql-test/t/rpl_charset_sjis.test new file mode 100644 index 00000000000..2469b0db8a2 --- /dev/null +++ b/mysql-test/t/rpl_charset_sjis.test @@ -0,0 +1,25 @@ +source include/have_sjis.inc; +source include/master-slave.inc; + +--disable_warnings +drop table if exists t1; +drop procedure if exists p1; +--enable_warnings +create table t1 (a varchar(255) character set sjis); +create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a); + +SET NAMES binary; +CALL p1 ('\\'); +select "--- on master ---"; +select hex(a) from t1 ; +sync_slave_with_master; +connection slave; +select "--- on slave ---"; +select hex(a) from t1; +connection master; +drop table t1; +drop procedure p1; +sync_slave_with_master; +connection master; + +# End of 5.0 tests diff --git a/sql/log_event.cc b/sql/log_event.cc index 271658d8054..8b10612d869 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -261,7 +261,7 @@ append_query_string(CHARSET_INFO *csinfo, else { *ptr++= '\''; - ptr+= escape_string_for_mysql(from->charset(), ptr, 0, + ptr+= escape_string_for_mysql(csinfo, ptr, 0, from->ptr(), from->length()); *ptr++='\''; } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index a06bfe28a6f..88f9d4dece4 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -93,7 +93,7 @@ sp_map_item_type(enum enum_field_types type) */ static String * -sp_get_item_value(Item *item, String *str) +sp_get_item_value(THD *thd, Item *item, String *str) { Item_result result_type= item->result_type(); @@ -113,15 +113,16 @@ sp_get_item_value(Item *item, String *str) { char buf_holder[STRING_BUFFER_USUAL_SIZE]; String buf(buf_holder, sizeof(buf_holder), result->charset()); + CHARSET_INFO *cs= thd->variables.character_set_client; /* We must reset length of the buffer, because of String specificity. */ buf.length(0); buf.append('_'); buf.append(result->charset()->csname); - if (result->charset()->escape_with_backslash_is_dangerous) + if (cs->escape_with_backslash_is_dangerous) buf.append(' '); - append_query_string(result->charset(), result, &buf); + append_query_string(cs, result, &buf); str->copy(buf); return str; @@ -862,7 +863,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) val= (*splocal)->this_item(); DBUG_PRINT("info", ("print %p", val)); - str_value= sp_get_item_value(val, &str_value_holder); + str_value= sp_get_item_value(thd, val, &str_value_holder); if (str_value) res|= qbuf.append(*str_value); else @@ -1456,7 +1457,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, if (arg_no) binlog_buf.append(','); - str_value= sp_get_item_value(nctx->get_item(arg_no), + str_value= sp_get_item_value(thd, nctx->get_item(arg_no), &str_value_holder); if (str_value) From c1d25bf2164961a27b600dc4b2ecaa7dd3b26de4 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 16 Nov 2006 20:07:46 +0400 Subject: [PATCH 004/160] After merge fix: modifying test results according to the fix --- mysql-test/r/ctype_cp932_binlog_stm.result | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index d354a8b99f7..ef1067e7c5d 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -41,6 +41,6 @@ IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 805 Query 1 1010 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 1010 Query 1 1096 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1096 Query 1 1172 use `test`; DROP TABLE t4 +master-bin.000001 805 Query 1 1021 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 1021 Query 1 1107 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1107 Query 1 1183 use `test`; DROP TABLE t4 From 2b25e2b3f63574b0cc5a810c3fc21f3c6eedc179 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Mon, 20 Nov 2006 17:57:57 +0400 Subject: [PATCH 005/160] After merge fix --- mysql-test/r/ctype_utf8.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 48f998863fd..be1e1742ba6 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -124,7 +124,7 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(10) character set utf8 default NULL + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) character set utf8 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") From 17d0ff0e3bfeec37e07dd2cbbb701643f2b9bb21 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Mon, 20 Nov 2006 18:05:01 +0400 Subject: [PATCH 006/160] After merge fix --- mysql-test/r/ctype_utf8.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 60109267b69..37ef5e2756f 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -124,7 +124,7 @@ create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d"); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) character set utf8 DEFAULT NULL + `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` varchar(10) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t1; date_format("2004-01-19 10:10:10", "%Y-%m-%d") From 45b77b838aa22f808410d3285f406b4371b6866d Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Mon, 20 Nov 2006 12:49:52 -0700 Subject: [PATCH 007/160] Backport patch of bugfix for: - Bug #15815: Very poor performance with multiple queries running concurrently - Bug #22868: 'Thread thrashing' with > 50 concurrent conns under an upd-intensive workloadw This is a patch from an e-mail; it is not included in an InnoDB snapshot. --- innobase/buf/buf0buf.c | 143 ++++++++++++++++++++++++----------- innobase/buf/buf0flu.c | 93 ++++++++++++++++------- innobase/buf/buf0lru.c | 18 ++++- innobase/include/buf0buf.h | 40 +++++++--- innobase/include/buf0buf.ic | 21 +++-- innobase/include/sync0arr.h | 13 +--- innobase/include/sync0rw.h | 1 + innobase/include/sync0rw.ic | 6 +- innobase/include/sync0sync.h | 1 + innobase/os/os0sync.c | 55 +++++++++++++- innobase/sync/sync0arr.c | 119 ++++++++++------------------- innobase/sync/sync0rw.c | 2 + innobase/sync/sync0sync.c | 8 +- 13 files changed, 326 insertions(+), 194 deletions(-) diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index aea3932eda7..382304451d6 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -433,6 +433,9 @@ buf_block_init( block->check_index_page_at_flush = FALSE; + mutex_create(&block->mutex); + mutex_set_level(&block->mutex, SYNC_BUF_BLOCK); + rw_lock_create(&(block->lock)); ut_ad(rw_lock_validate(&(block->lock))); @@ -599,13 +602,22 @@ buf_block_make_young( /*=================*/ buf_block_t* block) /* in: block to make younger */ { - if (buf_pool->freed_page_clock >= block->freed_page_clock - + 1 + (buf_pool->curr_size / 1024)) { +#ifdef UNIV_SYNC_DEBUG + ut_ad(!mutex_own(&(buf_pool->mutex))); +#endif /* UNIV_SYNC_DEBUG */ + /* Note that we read freed_page_clock's without holding any mutex: + this is allowed since the result is used only in heuristics */ + + if (buf_pool->freed_page_clock >= block->freed_page_clock + + 1 + (buf_pool->curr_size / 4)) { + + mutex_enter(&buf_pool->mutex); /* There has been freeing activity in the LRU list: best to move to the head of the LRU list */ buf_LRU_make_block_young(block); + mutex_exit(&buf_pool->mutex); } } @@ -640,12 +652,16 @@ buf_block_free( /*===========*/ buf_block_t* block) /* in, own: block to be freed */ { - ut_ad(block->state != BUF_BLOCK_FILE_PAGE); - mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); + + ut_a(block->state != BUF_BLOCK_FILE_PAGE); + buf_LRU_block_free_non_file_page(block); + mutex_exit(&block->mutex); + mutex_exit(&(buf_pool->mutex)); } @@ -864,9 +880,8 @@ buf_page_get_gen( #endif buf_pool->n_page_gets++; loop: - mutex_enter_fast(&(buf_pool->mutex)); - block = NULL; + mutex_enter_fast(&(buf_pool->mutex)); if (guess) { block = buf_block_align(guess); @@ -904,6 +919,10 @@ loop: goto loop; } + mutex_enter(&block->mutex); + + ut_a(block->state == BUF_BLOCK_FILE_PAGE); + must_read = FALSE; if (block->io_fix == BUF_IO_READ) { @@ -911,9 +930,9 @@ loop: must_read = TRUE; if (mode == BUF_GET_IF_IN_POOL) { - /* The page is only being read to buffer */ - mutex_exit(&(buf_pool->mutex)); + mutex_exit(&buf_pool->mutex); + mutex_exit(&block->mutex); return(NULL); } @@ -924,7 +943,7 @@ loop: #else buf_block_buf_fix_inc(block); #endif - buf_block_make_young(block); + mutex_exit(&buf_pool->mutex); /* Check if this is the first access to the page */ @@ -932,10 +951,13 @@ loop: block->accessed = TRUE; + mutex_exit(&block->mutex); + + buf_block_make_young(block); + #ifdef UNIV_DEBUG_FILE_ACCESSES ut_a(block->file_page_was_freed == FALSE); #endif - mutex_exit(&(buf_pool->mutex)); #ifdef UNIV_DEBUG buf_dbg_counter++; @@ -960,13 +982,14 @@ loop: } if (!success) { - mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); block->buf_fix_count--; + + mutex_exit(&block->mutex); #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); #endif - mutex_exit(&(buf_pool->mutex)); return(NULL); } @@ -1032,11 +1055,11 @@ buf_page_optimistic_get_func( block = buf_block_align(guess); - mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); if (block->state != BUF_BLOCK_FILE_PAGE) { - mutex_exit(&(buf_pool->mutex)); + mutex_exit(&block->mutex); return(FALSE); } @@ -1046,16 +1069,15 @@ buf_page_optimistic_get_func( #else buf_block_buf_fix_inc(block); #endif + accessed = block->accessed; + block->accessed = TRUE; + + mutex_exit(&block->mutex); + buf_block_make_young(block); /* Check if this is the first access to the page */ - accessed = block->accessed; - - block->accessed = TRUE; - - mutex_exit(&(buf_pool->mutex)); - ut_ad(!ibuf_inside() || ibuf_page(block->space, block->offset)); if (rw_latch == RW_S_LATCH) { @@ -1069,14 +1091,15 @@ buf_page_optimistic_get_func( } if (!success) { - mutex_enter(&(buf_pool->mutex)); - + mutex_enter(&block->mutex); + block->buf_fix_count--; + + mutex_exit(&block->mutex); + #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); -#endif - mutex_exit(&(buf_pool->mutex)); - +#endif return(FALSE); } @@ -1090,14 +1113,15 @@ buf_page_optimistic_get_func( rw_lock_x_unlock(&(block->lock)); } - mutex_enter(&(buf_pool->mutex)); - + mutex_enter(&block->mutex); + block->buf_fix_count--; + + mutex_exit(&block->mutex); + #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); -#endif - mutex_exit(&(buf_pool->mutex)); - +#endif return(FALSE); } @@ -1156,7 +1180,7 @@ buf_page_get_known_nowait( block = buf_block_align(guess); - mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); if (block->state == BUF_BLOCK_REMOVE_HASH) { /* Another thread is just freeing the block from the LRU list @@ -1166,7 +1190,7 @@ buf_page_get_known_nowait( we have already removed it from the page address hash table of the buffer pool. */ - mutex_exit(&(buf_pool->mutex)); + mutex_exit(&block->mutex); return(FALSE); } @@ -1176,12 +1200,12 @@ buf_page_get_known_nowait( #else buf_block_buf_fix_inc(block); #endif + mutex_exit(&block->mutex); + if (mode == BUF_MAKE_YOUNG) { buf_block_make_young(block); } - mutex_exit(&(buf_pool->mutex)); - ut_ad(!ibuf_inside() || (mode == BUF_KEEP_OLD)); if (rw_latch == RW_S_LATCH) { @@ -1195,13 +1219,15 @@ buf_page_get_known_nowait( } if (!success) { - mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); block->buf_fix_count--; + + mutex_exit(&block->mutex); + #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); #endif - mutex_exit(&(buf_pool->mutex)); return(FALSE); } @@ -1247,8 +1273,7 @@ buf_page_init_for_backup_restore( block->offset = offset; block->lock_hash_val = 0; - block->lock_mutex = NULL; - + block->freed_page_clock = 0; block->newest_modification = ut_dulint_zero; @@ -1280,6 +1305,7 @@ buf_page_init( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&(block->mutex))); #endif /* UNIV_SYNC_DEBUG */ ut_ad(block->state == BUF_BLOCK_READY_FOR_USE); @@ -1293,8 +1319,7 @@ buf_page_init( block->check_index_page_at_flush = FALSE; block->lock_hash_val = lock_rec_hash(space, offset); - block->lock_mutex = NULL; - + /* Insert into the hash table of file pages */ HASH_INSERT(buf_block_t, hash, buf_pool->page_hash, @@ -1362,12 +1387,15 @@ buf_page_init_for_read( ut_ad(block); mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); if (NULL != buf_page_hash_get(space, offset)) { /* The page is already in buf_pool, return */ + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); + buf_block_free(block); if (mode == BUF_READ_IBUF_PAGES_ONLY) { @@ -1387,6 +1415,7 @@ buf_page_init_for_read( buf_LRU_add_block(block, TRUE); /* TRUE == to old blocks */ block->io_fix = BUF_IO_READ; + buf_pool->n_pend_reads++; /* We set a pass-type x-lock on the frame because then the same @@ -1400,6 +1429,7 @@ buf_page_init_for_read( rw_lock_x_lock_gen(&(block->read_lock), BUF_IO_READ); + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); if (mode == BUF_READ_IBUF_PAGES_ONLY) { @@ -1462,6 +1492,8 @@ buf_page_create( block = free_block; + mutex_enter(&block->mutex); + buf_page_init(space, offset, block); /* The block must be put to the LRU list */ @@ -1472,13 +1504,15 @@ buf_page_create( #else buf_block_buf_fix_inc(block); #endif + buf_pool->n_pages_created++; + + mutex_exit(&(buf_pool->mutex)); + mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX); block->accessed = TRUE; - buf_pool->n_pages_created++; - - mutex_exit(&(buf_pool->mutex)); + mutex_exit(&block->mutex); /* Delete possible entries for the page from the insert buffer: such can exist if the page belonged to an index which was dropped */ @@ -1516,6 +1550,12 @@ buf_page_io_complete( ut_ad(block); + /* We do not need protect block->io_fix here by block->mutex to read + it because this is the only function where we can change the value + from BUF_IO_READ or BUF_IO_WRITE to some other value, and our code + ensures that this is the only thread that handles the i/o for this + block. */ + io_type = block->io_fix; if (io_type == BUF_IO_READ) { @@ -1584,11 +1624,12 @@ buf_page_io_complete( } } + mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); + #ifdef UNIV_IBUF_DEBUG ut_a(ibuf_count_get(block->space, block->offset) == 0); #endif - mutex_enter(&(buf_pool->mutex)); - /* Because this thread which does the unlocking is not the same that did the locking, we use a pass value != 0 in unlock, which simply removes the newest lock debug record, without checking the thread @@ -1629,6 +1670,7 @@ buf_page_io_complete( } } + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); if (buf_debug_prints) { @@ -1688,6 +1730,8 @@ buf_validate(void) block = buf_pool_get_nth_block(buf_pool, i); + mutex_enter(&block->mutex); + if (block->state == BUF_BLOCK_FILE_PAGE) { ut_a(buf_page_hash_get(block->space, @@ -1731,6 +1775,8 @@ buf_validate(void) } else if (block->state == BUF_BLOCK_NOT_USED) { n_free++; } + + mutex_exit(&block->mutex); } if (n_lru + n_free > buf_pool->curr_size) { @@ -2001,16 +2047,21 @@ buf_all_freed(void) block = buf_pool_get_nth_block(buf_pool, i); + mutex_enter(&block->mutex); + if (block->state == BUF_BLOCK_FILE_PAGE) { if (!buf_flush_ready_for_replace(block)) { fprintf(stderr, "Page %lu %lu still fixed or dirty\n", - block->space, block->offset); + (ulong) block->space, + (ulong) block->offset); ut_error; } } + + mutex_exit(&block->mutex); } mutex_exit(&(buf_pool->mutex)); diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c index 9eb8076732d..d36041ae133 100644 --- a/innobase/buf/buf0flu.c +++ b/innobase/buf/buf0flu.c @@ -111,6 +111,7 @@ buf_flush_ready_for_replace( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&block->mutex)); #endif /* UNIV_SYNC_DEBUG */ ut_a(block->state == BUF_BLOCK_FILE_PAGE); @@ -137,6 +138,7 @@ buf_flush_ready_for_flush( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&(block->mutex))); #endif /* UNIV_SYNC_DEBUG */ ut_ad(block->state == BUF_BLOCK_FILE_PAGE); @@ -507,10 +509,17 @@ buf_flush_try_page( block = buf_page_hash_get(space, offset); + if (!block) { + mutex_exit(&(buf_pool->mutex)); + return(0); + } + ut_a(block->state == BUF_BLOCK_FILE_PAGE); + mutex_enter(&block->mutex); + if (flush_type == BUF_FLUSH_LIST - && block && buf_flush_ready_for_flush(block, flush_type)) { + && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; block->flush_type = flush_type; @@ -534,6 +543,7 @@ buf_flush_try_page( locked = TRUE; } + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); if (!locked) { @@ -552,8 +562,8 @@ buf_flush_try_page( return(1); - } else if (flush_type == BUF_FLUSH_LRU && block - && buf_flush_ready_for_flush(block, flush_type)) { + } else if (flush_type == BUF_FLUSH_LRU + && buf_flush_ready_for_flush(block, flush_type)) { /* VERY IMPORTANT: Because any thread may call the LRU flush, even when owning @@ -579,14 +589,15 @@ buf_flush_try_page( buf_pool mutex: this ensures that the latch is acquired immediately. */ + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); buf_flush_write_block_low(block); return(1); - } else if (flush_type == BUF_FLUSH_SINGLE_PAGE && block - && buf_flush_ready_for_flush(block, flush_type)) { + } else if (flush_type == BUF_FLUSH_SINGLE_PAGE + && buf_flush_ready_for_flush(block, flush_type)) { block->io_fix = BUF_IO_WRITE; block->flush_type = flush_type; @@ -598,6 +609,7 @@ buf_flush_try_page( (buf_pool->n_flush[flush_type])++; + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); @@ -611,11 +623,12 @@ buf_flush_try_page( buf_flush_write_block_low(block); return(1); - } else { - mutex_exit(&(buf_pool->mutex)); + } - return(0); - } + mutex_exit(&block->mutex); + mutex_exit(&(buf_pool->mutex)); + + return(0); } /*************************************************************** @@ -659,34 +672,48 @@ buf_flush_try_neighbors( block = buf_page_hash_get(space, i); - if (block && flush_type == BUF_FLUSH_LRU && i != offset - && !block->old) { + if (!block) { + + continue; + + } else if (flush_type == BUF_FLUSH_LRU && i != offset + && !block->old) { /* We avoid flushing 'non-old' blocks in an LRU flush, because the flushed blocks are soon freed */ continue; - } + } else { - if (block && buf_flush_ready_for_flush(block, flush_type) - && (i == offset || block->buf_fix_count == 0)) { - /* We only try to flush those neighbors != offset - where the buf fix count is zero, as we then know that - we probably can latch the page without a semaphore - wait. Semaphore waits are expensive because we must - flush the doublewrite buffer before we start - waiting. */ + mutex_enter(&block->mutex); - mutex_exit(&(buf_pool->mutex)); + if (buf_flush_ready_for_flush(block, flush_type) + && (i == offset || block->buf_fix_count == 0)) { + /* We only try to flush those + neighbors != offset where the buf fix count is + zero, as we then know that we probably can + latch the page without a semaphore wait. + Semaphore waits are expensive because we must + flush the doublewrite buffer before we start + waiting. */ - /* Note: as we release the buf_pool mutex above, in - buf_flush_try_page we cannot be sure the page is still - in a flushable state: therefore we check it again - inside that function. */ + mutex_exit(&block->mutex); - count += buf_flush_try_page(space, i, flush_type); + mutex_exit(&(buf_pool->mutex)); - mutex_enter(&(buf_pool->mutex)); + /* Note: as we release the buf_pool mutex + above, in buf_flush_try_page we cannot be sure + the page is still in a flushable state: + therefore we check it again inside that + function. */ + + count += buf_flush_try_page(space, i, + flush_type); + + mutex_enter(&(buf_pool->mutex)); + } else { + mutex_exit(&block->mutex); + } } } @@ -780,12 +807,15 @@ buf_flush_batch( while ((block != NULL) && !found) { + mutex_enter(&block->mutex); + if (buf_flush_ready_for_flush(block, flush_type)) { found = TRUE; space = block->space; offset = block->offset; + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); old_page_count = page_count; @@ -803,11 +833,14 @@ buf_flush_batch( } else if (flush_type == BUF_FLUSH_LRU) { - block = UT_LIST_GET_PREV(LRU, block); + mutex_exit(&block->mutex); + block = UT_LIST_GET_PREV(LRU, block); } else { ut_ad(flush_type == BUF_FLUSH_LIST); + mutex_exit(&block->mutex); + block = UT_LIST_GET_PREV(flush_list, block); } } @@ -884,10 +917,14 @@ buf_flush_LRU_recommendation(void) + BUF_FLUSH_EXTRA_MARGIN) && (distance < BUF_LRU_FREE_SEARCH_LEN)) { + mutex_enter(&block->mutex); + if (buf_flush_ready_for_replace(block)) { n_replaceable++; } + mutex_exit(&block->mutex); + distance++; block = UT_LIST_GET_PREV(LRU, block); diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c index 0ced7e23abe..0255082a53e 100644 --- a/innobase/buf/buf0lru.c +++ b/innobase/buf/buf0lru.c @@ -123,6 +123,8 @@ buf_LRU_search_and_free_block( while (block != NULL) { + mutex_enter(&block->mutex); + if (buf_flush_ready_for_replace(block)) { if (buf_debug_prints) { @@ -134,20 +136,24 @@ buf_LRU_search_and_free_block( buf_LRU_block_remove_hashed_page(block); mutex_exit(&(buf_pool->mutex)); + mutex_exit(&block->mutex); btr_search_drop_page_hash_index(block->frame); - mutex_enter(&(buf_pool->mutex)); - ut_a(block->buf_fix_count == 0); - buf_LRU_block_free_hashed_page(block); + mutex_enter(&(buf_pool->mutex)); + mutex_enter(&block->mutex); + buf_LRU_block_free_hashed_page(block); freed = TRUE; + mutex_exit(&block->mutex); break; } + mutex_exit(&block->mutex); + block = UT_LIST_GET_PREV(LRU, block); distance++; @@ -274,7 +280,10 @@ loop: block = UT_LIST_GET_FIRST(buf_pool->free); UT_LIST_REMOVE(free, buf_pool->free, block); + + mutex_enter(&block->mutex); block->state = BUF_BLOCK_READY_FOR_USE; + mutex_exit(&block->mutex); mutex_exit(&(buf_pool->mutex)); @@ -636,6 +645,7 @@ buf_LRU_block_free_non_file_page( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&block->mutex)); #endif /* UNIV_SYNC_DEBUG */ ut_ad(block); @@ -664,6 +674,7 @@ buf_LRU_block_remove_hashed_page( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&block->mutex)); #endif /* UNIV_SYNC_DEBUG */ ut_ad(block); @@ -697,6 +708,7 @@ buf_LRU_block_free_hashed_page( { #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(buf_pool->mutex))); + ut_ad(mutex_own(&block->mutex)); #endif /* UNIV_SYNC_DEBUG */ ut_ad(block->state == BUF_BLOCK_REMOVE_HASH); diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h index 5ac9c83a5f9..872f6f3461b 100644 --- a/innobase/include/buf0buf.h +++ b/innobase/include/buf0buf.h @@ -431,8 +431,8 @@ Gets the mutex number protecting the page record lock hash chain in the lock table. */ UNIV_INLINE mutex_t* -buf_frame_get_lock_mutex( -/*=====================*/ +buf_frame_get_mutex( +/*================*/ /* out: mutex */ byte* ptr); /* in: pointer to within a buffer frame */ /*********************************************************************** @@ -654,7 +654,10 @@ struct buf_block_struct{ ulint magic_n; /* magic number to check */ ulint state; /* state of the control block: - BUF_BLOCK_NOT_USED, ... */ + BUF_BLOCK_NOT_USED, ...; changing + this is only allowed when a thread + has BOTH the buffer pool mutex AND + block->mutex locked */ byte* frame; /* pointer to buffer frame which is of size UNIV_PAGE_SIZE, and aligned to an address divisible by @@ -663,8 +666,12 @@ struct buf_block_struct{ ulint offset; /* page number within the space */ ulint lock_hash_val; /* hashed value of the page address in the record lock hash table */ - mutex_t* lock_mutex; /* mutex protecting the chain in the - record lock hash table */ + mutex_t mutex; /* mutex protecting this block: + state (also protected by the buffer + pool mutex), io_fix, buf_fix_count, + and accessed; we introduce this new + mutex in InnoDB-5.1 to relieve + contention on the buffer pool mutex */ rw_lock_t lock; /* read-write lock of the buffer frame */ rw_lock_t read_lock; /* rw-lock reserved when a page read @@ -720,20 +727,27 @@ struct buf_block_struct{ in heuristic algorithms, because of the possibility of a wrap-around! */ ulint freed_page_clock;/* the value of freed_page_clock - buffer pool when this block was - last time put to the head of the - LRU list */ + of the buffer pool when this block was + the last time put to the head of the + LRU list; a thread is allowed to + read this for heuristic purposes + without holding any mutex or latch */ ibool old; /* TRUE if the block is in the old blocks in the LRU list */ ibool accessed; /* TRUE if the page has been accessed while in the buffer pool: read-ahead may read in pages which have not been - accessed yet */ + accessed yet; this is protected by + block->mutex; a thread is allowed to + read this for heuristic purposes + without holding any mutex or latch */ ulint buf_fix_count; /* count of how manyfold this block - is currently bufferfixed */ + is currently bufferfixed; this is + protected by block->mutex */ ulint io_fix; /* if a read is pending to the frame, io_fix is BUF_IO_READ, in the case - of a write BUF_IO_WRITE, otherwise 0 */ + of a write BUF_IO_WRITE, otherwise 0; + this is protected by block->mutex */ /* 4. Optimistic search field */ dulint modify_clock; /* this clock is incremented every @@ -859,7 +873,9 @@ struct buf_pool_struct{ number of buffer blocks removed from the end of the LRU list; NOTE that this counter may wrap around at 4 - billion! */ + billion! A thread is allowed to + read this for heuristic purposes + without holding any mutex or latch */ ulint LRU_flush_ended;/* when an LRU flush ends for a page, this is incremented by one; this is set to zero when a buffer block is diff --git a/innobase/include/buf0buf.ic b/innobase/include/buf0buf.ic index 16deade0901..1b50d7ffb9b 100644 --- a/innobase/include/buf0buf.ic +++ b/innobase/include/buf0buf.ic @@ -357,8 +357,8 @@ Gets the mutex number protecting the page record lock hash chain in the lock table. */ UNIV_INLINE mutex_t* -buf_frame_get_lock_mutex( -/*=====================*/ +buf_frame_get_mutex( +/*================*/ /* out: mutex */ byte* ptr) /* in: pointer to within a buffer frame */ { @@ -366,7 +366,7 @@ buf_frame_get_lock_mutex( block = buf_block_align(ptr); - return(block->lock_mutex); + return(&block->mutex); } /************************************************************************* @@ -523,6 +523,7 @@ buf_block_buf_fix_inc_debug( ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line); ut_ad(ret == TRUE); + ut_ad(mutex_own(&block->mutex)); block->buf_fix_count++; } @@ -623,27 +624,25 @@ buf_page_release( RW_NO_LATCH */ mtr_t* mtr) /* in: mtr */ { - ulint buf_fix_count; - ut_ad(block); - mutex_enter_fast(&(buf_pool->mutex)); - ut_ad(block->state == BUF_BLOCK_FILE_PAGE); ut_ad(block->buf_fix_count > 0); if (rw_latch == RW_X_LATCH && mtr->modifications) { - + mutex_enter(&buf_pool->mutex); buf_flush_note_modification(block, mtr); + mutex_exit(&buf_pool->mutex); } + mutex_enter(&block->mutex); + #ifdef UNIV_SYNC_DEBUG rw_lock_s_unlock(&(block->debug_latch)); #endif - buf_fix_count = block->buf_fix_count; - block->buf_fix_count = buf_fix_count - 1; + block->buf_fix_count--; - mutex_exit(&(buf_pool->mutex)); + mutex_exit(&block->mutex); if (rw_latch == RW_S_LATCH) { rw_lock_s_unlock(&(block->lock)); diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h index 73496a2ea84..cc0913e4a70 100644 --- a/innobase/include/sync0arr.h +++ b/innobase/include/sync0arr.h @@ -75,17 +75,12 @@ sync_array_free_cell( sync_array_t* arr, /* in: wait array */ ulint index); /* in: index of the cell in array */ /************************************************************************** -Looks for the cells in the wait array which refer -to the wait object specified, -and sets their corresponding events to the signaled state. In this -way releases the threads waiting for the object to contend for the object. -It is possible that no such cell is found, in which case does nothing. */ +Note that one of the wait objects was signalled. */ void -sync_array_signal_object( -/*=====================*/ - sync_array_t* arr, /* in: wait array */ - void* object);/* in: wait object */ +sync_array_object_signalled( +/*========================*/ + sync_array_t* arr); /* in: wait array */ /************************************************************************** If the wakeup algorithm does not work perfectly at semaphore relases, this function will do the waking (see the comment in mutex_exit). This diff --git a/innobase/include/sync0rw.h b/innobase/include/sync0rw.h index d71691b4353..c3a75f6acd1 100644 --- a/innobase/include/sync0rw.h +++ b/innobase/include/sync0rw.h @@ -410,6 +410,7 @@ blocked by readers, a writer may queue for the lock by setting the writer field. Then no new readers are allowed in. */ struct rw_lock_struct { + os_event_t event; /* Used by sync0arr.c for thread queueing */ ulint reader_count; /* Number of readers who have locked this lock in the shared mode */ ulint writer; /* This field is set to RW_LOCK_EX if there diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic index 8fc93f4a9da..a8fb17a552a 100644 --- a/innobase/include/sync0rw.ic +++ b/innobase/include/sync0rw.ic @@ -380,7 +380,8 @@ rw_lock_s_unlock_func( mutex_exit(mutex); if (sg == TRUE) { - sync_array_signal_object(sync_primary_wait_array, lock); + os_event_set(lock->event); + sync_array_object_signalled(sync_primary_wait_array); } ut_ad(rw_lock_validate(lock)); @@ -459,7 +460,8 @@ rw_lock_x_unlock_func( mutex_exit(&(lock->mutex)); if (sg == TRUE) { - sync_array_signal_object(sync_primary_wait_array, lock); + os_event_set(lock->event); + sync_array_object_signalled(sync_primary_wait_array); } ut_ad(rw_lock_validate(lock)); diff --git a/innobase/include/sync0sync.h b/innobase/include/sync0sync.h index 40197cd61bd..707b34ab28e 100644 --- a/innobase/include/sync0sync.h +++ b/innobase/include/sync0sync.h @@ -447,6 +447,7 @@ Do not use its fields directly! The structure used in the spin lock implementation of a mutual exclusion semaphore. */ struct mutex_struct { + os_event_t event; /* Used by sync0arr.c for the wait queue */ ulint lock_word; /* This ulint is the target of the atomic test-and-set instruction in Win32 */ #if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER) diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c index 827d68501db..d0d03c2e247 100644 --- a/innobase/os/os0sync.c +++ b/innobase/os/os0sync.c @@ -21,6 +21,7 @@ Created 9/6/1995 Heikki Tuuri /* Type definition for an operating system mutex struct */ struct os_mutex_struct{ + os_event_t event; /* Used by sync0arr.c for queing threads */ void* handle; /* OS handle to mutex */ ulint count; /* we use this counter to check that the same thread does not @@ -35,6 +36,7 @@ struct os_mutex_struct{ /* Mutex protecting counts and the lists of OS mutexes and events */ os_mutex_t os_sync_mutex; ibool os_sync_mutex_inited = FALSE; +ibool os_sync_free_called = FALSE; /* This is incremented by 1 in os_thread_create and decremented by 1 in os_thread_exit */ @@ -50,6 +52,10 @@ ulint os_event_count = 0; ulint os_mutex_count = 0; ulint os_fast_mutex_count = 0; +/* Because a mutex is embedded inside an event and there is an +event embedded inside a mutex, on free, this generates a recursive call. +This version of the free event function doesn't acquire the global lock */ +static void os_event_free_internal(os_event_t event); /************************************************************* Initializes global event and OS 'slow' mutex lists. */ @@ -76,6 +82,7 @@ os_sync_free(void) os_event_t event; os_mutex_t mutex; + os_sync_free_called = TRUE; event = UT_LIST_GET_FIRST(os_event_list); while (event) { @@ -99,6 +106,7 @@ os_sync_free(void) mutex = UT_LIST_GET_FIRST(os_mutex_list); } + os_sync_free_called = FALSE; } /************************************************************* @@ -146,14 +154,21 @@ os_event_create( event->signal_count = 0; #endif /* __WIN__ */ - /* Put to the list of events */ - os_mutex_enter(os_sync_mutex); + /* The os_sync_mutex can be NULL because during startup an event + can be created [ because it's embedded in the mutex/rwlock ] before + this module has been initialized */ + if (os_sync_mutex != NULL) { + os_mutex_enter(os_sync_mutex); + } + /* Put to the list of events */ UT_LIST_ADD_FIRST(os_event_list, os_event_list, event); os_event_count++; - os_mutex_exit(os_sync_mutex); + if (os_sync_mutex != NULL) { + os_mutex_exit(os_sync_mutex); + } return(event); } @@ -255,6 +270,35 @@ os_event_reset( #endif } +/************************************************************** +Frees an event object, without acquiring the global lock. */ +static +void +os_event_free_internal( +/*===================*/ + os_event_t event) /* in: event to free */ +{ +#ifdef __WIN__ + ut_a(event); + + ut_a(CloseHandle(event->handle)); +#else + ut_a(event); + + /* This is to avoid freeing the mutex twice */ + os_fast_mutex_free(&(event->os_mutex)); + + ut_a(0 == pthread_cond_destroy(&(event->cond_var))); +#endif + /* Remove from the list of events */ + + UT_LIST_REMOVE(os_event_list, os_event_list, event); + + os_event_count--; + + ut_free(event); +} + /************************************************************** Frees an event object. */ @@ -456,6 +500,7 @@ os_mutex_create( mutex_str->handle = mutex; mutex_str->count = 0; + mutex_str->event = os_event_create(NULL); if (os_sync_mutex_inited) { /* When creating os_sync_mutex itself we cannot reserve it */ @@ -532,6 +577,10 @@ os_mutex_free( { ut_a(mutex); + if (!os_sync_free_called) { + os_event_free_internal(mutex->event); + } + if (os_sync_mutex_inited) { os_mutex_enter(os_sync_mutex); } diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c index a443d630425..43d3962a55e 100644 --- a/innobase/sync/sync0arr.c +++ b/innobase/sync/sync0arr.c @@ -62,9 +62,6 @@ struct sync_cell_struct { ibool waiting; /* TRUE if the thread has already called sync_array_event_wait on this cell */ - ibool event_set; /* TRUE if the event is set */ - os_event_t event; /* operating system event - semaphore handle */ time_t reservation_time;/* time when the thread reserved the wait cell */ }; @@ -218,10 +215,7 @@ sync_array_create( for (i = 0; i < n_cells; i++) { cell = sync_array_get_nth_cell(arr, i); cell->wait_object = NULL; - - /* Create an operating system event semaphore with no name */ - cell->event = os_event_create(NULL); - cell->event_set = FALSE; /* it is created in reset state */ + cell->waiting = FALSE; } return(arr); @@ -235,19 +229,12 @@ sync_array_free( /*============*/ sync_array_t* arr) /* in, own: sync wait array */ { - ulint i; - sync_cell_t* cell; ulint protection; ut_a(arr->n_reserved == 0); sync_array_validate(arr); - for (i = 0; i < arr->n_cells; i++) { - cell = sync_array_get_nth_cell(arr, i); - os_event_free(cell->event); - } - protection = arr->protection; /* Release the mutex protecting the wait array complex */ @@ -292,28 +279,20 @@ sync_array_validate( sync_array_exit(arr); } -/*********************************************************************** -Puts the cell event in set state. */ -static -void -sync_cell_event_set( -/*================*/ - sync_cell_t* cell) /* in: array cell */ -{ - os_event_set(cell->event); - cell->event_set = TRUE; -} - /*********************************************************************** Puts the cell event in reset state. */ static void sync_cell_event_reset( /*==================*/ - sync_cell_t* cell) /* in: array cell */ + ulint type, /* in: lock type mutex/rw_lock */ + void* object) /* in: the rw_lock/mutex object */ { - os_event_reset(cell->event); - cell->event_set = FALSE; + if (type == SYNC_MUTEX) { + os_event_reset(((mutex_t *) object)->event); + } else { + os_event_reset(((rw_lock_t *) object)->event); + } } /********************************************************************** @@ -346,14 +325,7 @@ sync_array_reserve_cell( if (cell->wait_object == NULL) { - /* Make sure the event is reset */ - if (cell->event_set) { - sync_cell_event_reset(cell); - } - - cell->reservation_time = time(NULL); - cell->thread = os_thread_get_curr_id(); - + cell->waiting = FALSE; cell->wait_object = object; if (type == SYNC_MUTEX) { @@ -363,7 +335,6 @@ sync_array_reserve_cell( } cell->request_type = type; - cell->waiting = FALSE; cell->file = file; cell->line = line; @@ -373,6 +344,13 @@ sync_array_reserve_cell( *index = i; sync_array_exit(arr); + + /* Make sure the event is reset */ + sync_cell_event_reset(type, object); + + cell->reservation_time = time(NULL); + + cell->thread = os_thread_get_curr_id(); return; } @@ -408,7 +386,12 @@ sync_array_wait_event( ut_a(!cell->waiting); ut_ad(os_thread_get_curr_id() == cell->thread); - event = cell->event; + if (cell->request_type == SYNC_MUTEX) { + event = ((mutex_t*) cell->wait_object)->event; + } else { + event = ((rw_lock_t*) cell->wait_object)->event; + } + cell->waiting = TRUE; #ifdef UNIV_SYNC_DEBUG @@ -505,10 +488,6 @@ sync_array_cell_print( if (!cell->waiting) { fputs("wait has ended\n", file); } - - if (cell->event_set) { - fputs("wait is ending\n", file); - } } #ifdef UNIV_SYNC_DEBUG @@ -618,7 +597,7 @@ sync_array_detect_deadlock( depth++; - if (cell->event_set || !cell->waiting) { + if (!cell->waiting) { return(FALSE); /* No deadlock here */ } @@ -797,6 +776,7 @@ sync_array_free_cell( ut_a(cell->wait_object != NULL); + cell->waiting = FALSE; cell->wait_object = NULL; ut_a(arr->n_reserved > 0); @@ -806,44 +786,17 @@ sync_array_free_cell( } /************************************************************************** -Looks for the cells in the wait array which refer to the wait object -specified, and sets their corresponding events to the signaled state. In this -way releases the threads waiting for the object to contend for the object. -It is possible that no such cell is found, in which case does nothing. */ +Increments the signalled count. */ void -sync_array_signal_object( -/*=====================*/ - sync_array_t* arr, /* in: wait array */ - void* object) /* in: wait object */ +sync_array_object_signalled( +/*========================*/ + sync_array_t* arr) /* in: wait array */ { - sync_cell_t* cell; - ulint count; - ulint i; - sync_array_enter(arr); arr->sg_count++; - i = 0; - count = 0; - - while (count < arr->n_reserved) { - - cell = sync_array_get_nth_cell(arr, i); - - if (cell->wait_object != NULL) { - - count++; - if (cell->wait_object == object) { - - sync_cell_event_set(cell); - } - } - - i++; - } - sync_array_exit(arr); } @@ -876,7 +829,17 @@ sync_arr_wake_threads_if_sema_free(void) if (sync_arr_cell_can_wake_up(cell)) { - sync_cell_event_set(cell); + if (cell->request_type == SYNC_MUTEX) { + mutex_t* mutex; + + mutex = cell->wait_object; + os_event_set(mutex->event); + } else { + rw_lock_t* lock; + + lock = cell->wait_object; + os_event_set(lock->event); + } } } @@ -906,7 +869,7 @@ sync_array_print_long_waits(void) cell = sync_array_get_nth_cell(sync_primary_wait_array, i); - if (cell->wait_object != NULL + if (cell->wait_object != NULL && cell->waiting && difftime(time(NULL), cell->reservation_time) > 240) { fputs("InnoDB: Warning: a long semaphore wait:\n", stderr); @@ -914,7 +877,7 @@ sync_array_print_long_waits(void) noticed = TRUE; } - if (cell->wait_object != NULL + if (cell->wait_object != NULL && cell->waiting && difftime(time(NULL), cell->reservation_time) > fatal_timeout) { fatal = TRUE; diff --git a/innobase/sync/sync0rw.c b/innobase/sync/sync0rw.c index e3caa24cb1e..70b3ba11462 100644 --- a/innobase/sync/sync0rw.c +++ b/innobase/sync/sync0rw.c @@ -123,6 +123,7 @@ rw_lock_create_func( lock->last_x_file_name = (char *) "not yet reserved"; lock->last_s_line = 0; lock->last_x_line = 0; + lock->event = os_event_create(NULL); mutex_enter(&rw_lock_list_mutex); @@ -151,6 +152,7 @@ rw_lock_free( mutex_free(rw_lock_get_mutex(lock)); mutex_enter(&rw_lock_list_mutex); + os_event_free(lock->event); UT_LIST_REMOVE(list, rw_lock_list, lock); diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index 5ee08d83987..59161254343 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -210,6 +210,7 @@ mutex_create_func( os_fast_mutex_init(&(mutex->os_fast_mutex)); mutex->lock_word = 0; #endif + mutex->event = os_event_create(NULL); mutex_set_waiters(mutex, 0); mutex->magic_n = MUTEX_MAGIC_N; #ifdef UNIV_SYNC_DEBUG @@ -260,6 +261,8 @@ mutex_free( mutex_exit(&mutex_list_mutex); } + os_event_free(mutex->event); + #if !defined(_WIN32) || !defined(UNIV_CAN_USE_X86_ASSEMBLER) os_fast_mutex_free(&(mutex->os_fast_mutex)); #endif @@ -481,8 +484,8 @@ mutex_signal_object( /* The memory order of resetting the waiters field and signaling the object is important. See LEMMA 1 above. */ - - sync_array_signal_object(sync_primary_wait_array, mutex); + os_event_set(mutex->event); + sync_array_object_signalled(sync_primary_wait_array); } #ifdef UNIV_SYNC_DEBUG @@ -1030,6 +1033,7 @@ sync_thread_add_level( ut_a(sync_thread_levels_g(array, SYNC_PURGE_SYS)); } else if (level == SYNC_TREE_NODE) { ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE) + || sync_thread_levels_contain(array, SYNC_DICT_OPERATION) || sync_thread_levels_g(array, SYNC_TREE_NODE - 1)); } else if (level == SYNC_TREE_NODE_FROM_HASH) { ut_a(1); From fb419c4241b62939744579e25d461309c36d7d6a Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 21 Nov 2006 11:09:33 +0400 Subject: [PATCH 008/160] BUG#13926: --order-by-primary fails if PKEY contains quote character. Backporting from 5.0 --- client/mysqldump.c | 18 +++++++--- mysql-test/r/mysqldump.result | 62 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 15 +++++++++ 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 2d2fe439f76..3bf9fff1b86 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2589,6 +2589,8 @@ static char *primary_key_fields(const char *table_name) char show_keys_buff[15 + 64 * 2 + 3]; uint result_length = 0; char *result = 0; + char buff[NAME_LEN * 2 + 3]; + char *quoted_field; my_snprintf(show_keys_buff, sizeof(show_keys_buff), "SHOW KEYS FROM %s", table_name); @@ -2612,8 +2614,10 @@ static char *primary_key_fields(const char *table_name) { /* Key is unique */ do - result_length += strlen(row[4]) + 1; /* + 1 for ',' or \0 */ - while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1); + { + quoted_field= quote_name(row[4], buff, 0); + result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */ + } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1); } /* Build the ORDER BY clause result */ @@ -2627,9 +2631,13 @@ static char *primary_key_fields(const char *table_name) } mysql_data_seek(res, 0); row = mysql_fetch_row(res); - end = strmov(result, row[4]); - while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1) - end = strxmov(end, ",", row[4], NullS); + quoted_field= quote_name(row[4], buff, 0); + end= strmov(result, quoted_field); + while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1) + { + quoted_field= quote_name(row[4], buff, 0); + end= strxmov(end, ",", quoted_field, NullS); + } } cleanup: diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 721982e11e3..498fee2d037 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1584,4 +1584,66 @@ CREATE TABLE `t1` ( /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +CREATE TABLE `t1` ( +`a b` INT, +`c"d` INT, +`e``f` INT, +PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +CREATE TABLE "t1" ( + "a b" int(11) NOT NULL default '0', + "c""d" int(11) NOT NULL default '0', + "e`f" int(11) NOT NULL default '0', + PRIMARY KEY ("a b","c""d","e`f") +); + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +INSERT INTO "t1" VALUES (815,4711,2006); +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a b` int(11) NOT NULL default '0', + `c"d` int(11) NOT NULL default '0', + `e``f` int(11) NOT NULL default '0', + PRIMARY KEY (`a b`,`c"d`,`e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (815,4711,2006); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE `t1`; End of 4.1 tests diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index b0df2bb9db2..4a077f1ffa3 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -702,4 +702,19 @@ create table t1 (a int); --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 drop table t1; +# +# BUG#13926: --order-by-primary fails if PKEY contains quote character +# +CREATE TABLE `t1` ( + `a b` INT, + `c"d` INT, + `e``f` INT, + PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); + +--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1 +--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1 +DROP TABLE `t1`; + --echo End of 4.1 tests From 78c74b039635b32436a69d872958593a0d9ea4d4 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 21 Nov 2006 12:09:14 +0400 Subject: [PATCH 009/160] Prepare to merge "backport of bug#13926 from 5.0 to 4.1" back into 5.0: Moving tests into their new place into 4.1 tests section --- mysql-test/r/mysqldump.result | 144 +++++++++++++++++----------------- mysql-test/t/mysqldump.test | 38 ++++----- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 54583febbc8..6984d7689e7 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1786,6 +1786,78 @@ CREATE TABLE `t1` ( /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +# +# BUG#13926: --order-by-primary fails if PKEY contains quote character +# +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( +`a b` INT, +`c"d` INT, +`e``f` INT, +PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +CREATE TABLE "t1" ( + "a b" int(11) NOT NULL default '0', + "c""d" int(11) NOT NULL default '0', + "e`f" int(11) NOT NULL default '0', + PRIMARY KEY ("a b","c""d","e`f") +); + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +INSERT INTO "t1" VALUES (815,4711,2006); +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a b` int(11) NOT NULL default '0', + `c"d` int(11) NOT NULL default '0', + `e``f` int(11) NOT NULL default '0', + PRIMARY KEY (`a b`,`c"d`,`e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (815,4711,2006); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE `t1`; End of 4.1 tests # # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) @@ -3124,78 +3196,6 @@ drop user myDB_User; drop database mysqldump_myDB; use test; # -# BUG#13926: --order-by-primary fails if PKEY contains quote character -# -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( -`a b` INT, -`c"d` INT, -`e``f` INT, -PRIMARY KEY (`a b`, `c"d`, `e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -insert into t1 values (0815, 4711, 2006); -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS "t1"; -CREATE TABLE "t1" ( - "a b" int(11) NOT NULL default '0', - "c""d" int(11) NOT NULL default '0', - "e`f" int(11) NOT NULL default '0', - PRIMARY KEY ("a b","c""d","e`f") -); - -LOCK TABLES "t1" WRITE; -/*!40000 ALTER TABLE "t1" DISABLE KEYS */; -INSERT INTO "t1" VALUES (815,4711,2006); -/*!40000 ALTER TABLE "t1" ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a b` int(11) NOT NULL default '0', - `c"d` int(11) NOT NULL default '0', - `e``f` int(11) NOT NULL default '0', - PRIMARY KEY (`a b`,`c"d`,`e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES (815,4711,2006); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE `t1`; -# # Bug #19745: mysqldump --xml produces invalid xml # DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 72aad395ec0..47a3ff52aae 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -713,6 +713,25 @@ create table t1 (a int); --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 drop table t1; +--echo # +--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character +--echo # + +--disable_warnings +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a b` INT, + `c"d` INT, + `e``f` INT, + PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); + +--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1 +--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1 +DROP TABLE `t1`; +--enable_warnings + --echo End of 4.1 tests --echo # @@ -1393,25 +1412,6 @@ drop user myDB_User; drop database mysqldump_myDB; use test; ---echo # ---echo # BUG#13926: --order-by-primary fails if PKEY contains quote character ---echo # - ---disable_warnings -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a b` INT, - `c"d` INT, - `e``f` INT, - PRIMARY KEY (`a b`, `c"d`, `e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -insert into t1 values (0815, 4711, 2006); - ---exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1 ---exec $MYSQL_DUMP --skip-comments --order-by-primary test t1 -DROP TABLE `t1`; ---enable_warnings - --echo # --echo # Bug #19745: mysqldump --xml produces invalid xml --echo # From e39643290496d32a0337b4b0133aecad3f2154d9 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 21 Nov 2006 12:22:10 +0400 Subject: [PATCH 010/160] Preparing to merge "backport of bug#13926 into 5.0" Moving tests to 4.1 section --- mysql-test/r/mysqldump.result | 144 +++++++++++++++++----------------- mysql-test/t/mysqldump.test | 38 ++++----- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 54c68701f78..a042d1e8628 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1787,6 +1787,78 @@ CREATE TABLE `t1` ( /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop table t1; +# +# BUG#13926: --order-by-primary fails if PKEY contains quote character +# +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( +`a b` INT, +`c"d` INT, +`e``f` INT, +PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +CREATE TABLE "t1" ( + "a b" int(11) NOT NULL DEFAULT '0', + "c""d" int(11) NOT NULL DEFAULT '0', + "e`f" int(11) NOT NULL DEFAULT '0', + PRIMARY KEY ("a b","c""d","e`f") +); + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +INSERT INTO "t1" VALUES (815,4711,2006); +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a b` int(11) NOT NULL DEFAULT '0', + `c"d` int(11) NOT NULL DEFAULT '0', + `e``f` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`a b`,`c"d`,`e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (815,4711,2006); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE `t1`; End of 4.1 tests # # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X) @@ -3123,78 +3195,6 @@ drop user myDB_User; drop database mysqldump_myDB; use test; # -# BUG#13926: --order-by-primary fails if PKEY contains quote character -# -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( -`a b` INT, -`c"d` INT, -`e``f` INT, -PRIMARY KEY (`a b`, `c"d`, `e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -insert into t1 values (0815, 4711, 2006); -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS "t1"; -CREATE TABLE "t1" ( - "a b" int(11) NOT NULL DEFAULT '0', - "c""d" int(11) NOT NULL DEFAULT '0', - "e`f" int(11) NOT NULL DEFAULT '0', - PRIMARY KEY ("a b","c""d","e`f") -); - -LOCK TABLES "t1" WRITE; -/*!40000 ALTER TABLE "t1" DISABLE KEYS */; -INSERT INTO "t1" VALUES (815,4711,2006); -/*!40000 ALTER TABLE "t1" ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a b` int(11) NOT NULL DEFAULT '0', - `c"d` int(11) NOT NULL DEFAULT '0', - `e``f` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`a b`,`c"d`,`e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -LOCK TABLES `t1` WRITE; -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES (815,4711,2006); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -DROP TABLE `t1`; -# # Bug #19745: mysqldump --xml produces invalid xml # DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 1f1c8a44dbe..4b69a9c446d 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -713,6 +713,25 @@ create table t1 (a int); --exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1 drop table t1; +--echo # +--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character +--echo # + +--disable_warnings +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a b` INT, + `c"d` INT, + `e``f` INT, + PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); + +--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1 +--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1 +DROP TABLE `t1`; +--enable_warnings + --echo End of 4.1 tests --echo # @@ -1395,25 +1414,6 @@ drop user myDB_User; drop database mysqldump_myDB; use test; ---echo # ---echo # BUG#13926: --order-by-primary fails if PKEY contains quote character ---echo # - ---disable_warnings -DROP TABLE IF EXISTS `t1`; -CREATE TABLE `t1` ( - `a b` INT, - `c"d` INT, - `e``f` INT, - PRIMARY KEY (`a b`, `c"d`, `e``f`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -insert into t1 values (0815, 4711, 2006); - ---exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1 ---exec $MYSQL_DUMP --skip-comments --order-by-primary test t1 -DROP TABLE `t1`; ---enable_warnings - --echo # --echo # Bug #19745: mysqldump --xml produces invalid xml --echo # From c610c271fae132eebfd007a95a224dcd31b8584a Mon Sep 17 00:00:00 2001 From: "aelkin/elkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi" <> Date: Sun, 26 Nov 2006 15:55:49 +0200 Subject: [PATCH 011/160] Bug #24487 Valgrind: uninited byte in table->record[1] in binlog code for rbr + innodb The reason of this valgrind's compaint is not a bug but rather a feature of bitwise ops: for any value of the byte x x | 1 -> 1, and x & 0 -> 0. x, being a null_byte part of record[1] can be left unassigned even after ha_innobase::index_read_idx because the above and still be correct. Addding a check memory upon the invocation of the function can detect this fact long before record[1], old record, is eventually passed to my_write. Fixed with initialization of record[1]'s null_bytes part in open_table_from_share. --- sql/table.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/table.cc b/sql/table.cc index 7f80b95c954..1506c1220d7 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1400,6 +1400,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, if (records > 1) { memcpy(outparam->record[0], share->default_values, share->rec_buff_length); + memcpy(outparam->record[1], share->default_values, share->null_bytes); if (records > 2) memcpy(outparam->record[1], share->default_values, share->rec_buff_length); From 32d1ad79b098055af4f7af2836c7411fd3bc1f8e Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Mon, 27 Nov 2006 19:12:10 +0300 Subject: [PATCH 012/160] Fix for bug #24261 "crash when WHERE contains NOT IN ('') for unsigned column type" When calculating a SEL_TREE for the "c_{i-1} < X < c_i" interval, check if the tree returned for the "-inf < X < c_0" interval is NULL --- mysql-test/r/func_in.result | 4 ++++ mysql-test/t/func_in.test | 7 +++++++ sql/opt_range.cc | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index e38e2624e19..60bde9555e4 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -342,4 +342,8 @@ select some_id from t1 where some_id not in(-4,-1,3423534,2342342); some_id 1 2 +select some_id from t1 where some_id not in('-1', '0'); +some_id +1 +2 drop table t1; diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 8ddf1fbe314..0153da12b53 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -231,4 +231,11 @@ insert into t1 values (1),(2); select some_id from t1 where some_id not in(2,-1); select some_id from t1 where some_id not in(-4,-1,-4); select some_id from t1 where some_id not in(-4,-1,3423534,2342342); + +# +# BUG#24261: crash when WHERE contains NOT IN ('') for unsigned column type +# + +select some_id from t1 where some_id not in('-1', '0'); + drop table t1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 96239315026..efef9361bda 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3703,7 +3703,8 @@ static SEL_TREE *get_func_mm_tree(PARAM *param, Item_func *cond_func, for (uint idx= 0; idx < param->keys; idx++) { SEL_ARG *new_interval, *last_val; - if (((new_interval= tree2->keys[idx])) && + if (((new_interval= tree2->keys[idx])) && + (tree->keys[idx]) && ((last_val= tree->keys[idx]->last()))) { new_interval->min_value= last_val->max_value; From a70028a855ba39f7bc7b8beecd9525236367dcd2 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 28 Nov 2006 16:26:15 +0400 Subject: [PATCH 013/160] Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails Problem: when loading mysqlbinlog dumps, CREATE PROCEDURE having semicolons in their bodies failed. Fix: Using safe delimiter "/*!*/;" to dump log entries. --- client/mysqlbinlog.cc | 38 +- mysql-test/r/ctype_ucs_binlog.result | 20 +- mysql-test/r/mix_innodb_myisam_binlog.result | 4 +- mysql-test/r/mysqlbinlog.result | 241 ++-- mysql-test/r/mysqlbinlog2.result | 1086 ++++++++++-------- mysql-test/r/rpl_charset.result | 158 +-- mysql-test/r/rpl_timezone.result | 44 +- mysql-test/r/user_var-binlog.result | 28 +- mysql-test/t/mix_innodb_myisam_binlog.test | 2 +- mysql-test/t/mysqlbinlog.test | 24 + sql/log_event.cc | 73 +- sql/log_event.h | 2 + 12 files changed, 953 insertions(+), 767 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index c04c2ecabd6..7c9e52611f6 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -94,8 +94,10 @@ static bool stop_passed= 0; */ Format_description_log_event* description_event; -static int dump_local_log_entries(const char* logname); -static int dump_remote_log_entries(const char* logname); +static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, + const char* logname); +static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, + const char* logname); static int dump_log_entries(const char* logname); static int dump_remote_file(NET* net, const char* fname); static void die(const char* fmt, ...); @@ -950,8 +952,22 @@ static MYSQL* safe_connect() static int dump_log_entries(const char* logname) { - return (remote_opt ? dump_remote_log_entries(logname) : - dump_local_log_entries(logname)); + int rc; + PRINT_EVENT_INFO print_event_info; + /* + Set safe delimiter, to dump things + like CREATE PROCEDURE safely + */ + fprintf(result_file, "DELIMITER /*!*/;\n"); + strcpy(print_event_info.delimiter, "/*!*/;"); + + rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) : + dump_local_log_entries(&print_event_info, logname)); + + /* Set delimiter back to semicolon */ + fprintf(result_file, "DELIMITER ;\n"); + strcpy(print_event_info.delimiter, ";"); + return rc; } @@ -1016,11 +1032,11 @@ static int check_master_version(MYSQL* mysql, } -static int dump_remote_log_entries(const char* logname) +static int dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, + const char* logname) { char buf[128]; - PRINT_EVENT_INFO print_event_info; ulong len; uint logname_len; NET* net; @@ -1143,7 +1159,7 @@ could be out of memory"); len= 1; // fake Rotate, so don't increment old_off } } - if ((error= process_event(&print_event_info, ev, old_off))) + if ((error= process_event(print_event_info, ev, old_off))) { error= ((error < 0) ? 0 : 1); goto err; @@ -1162,7 +1178,7 @@ could be out of memory"); goto err; } - if ((error= process_event(&print_event_info, ev, old_off))) + if ((error= process_event(print_event_info, ev, old_off))) { my_close(file,MYF(MY_WME)); error= ((error < 0) ? 0 : 1); @@ -1288,11 +1304,11 @@ at offset %lu ; this could be a log format error or read error", } -static int dump_local_log_entries(const char* logname) +static int dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, + const char* logname) { File fd = -1; IO_CACHE cache,*file= &cache; - PRINT_EVENT_INFO print_event_info; byte tmp_buff[BIN_LOG_HEADER_SIZE]; int error= 0; @@ -1364,7 +1380,7 @@ static int dump_local_log_entries(const char* logname) // file->error == 0 means EOF, that's OK, we break in this case break; } - if ((error= process_event(&print_event_info, ev, old_off))) + if ((error= process_event(print_event_info, ev, old_off))) { if (error < 0) error= 0; diff --git a/mysql-test/r/ctype_ucs_binlog.result b/mysql-test/r/ctype_ucs_binlog.result index 88912f98252..2657bf60c04 100644 --- a/mysql-test/r/ctype_ucs_binlog.result +++ b/mysql-test/r/ctype_ucs_binlog.result @@ -9,15 +9,17 @@ master-bin.000001 98 User var 1 138 @`v`=_ucs2 0x006100620063 COLLATE ucs2_gener master-bin.000001 138 Query 1 227 use `test`; insert into t2 values (@v) /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`; -use test; -SET TIMESTAMP=10000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t2 values (@v); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; +use test/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t2 values (@v)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 6c19c429296..a8b132ae927 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -275,8 +275,8 @@ is not null; is not null 1 select -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index c3be791b523..0c8c7efc6b0 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -15,31 +15,33 @@ flush logs; --- Local -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -drop table if exists t1,t2; -SET TIMESTAMP=1000000000; -create table t1 (word varchar(20)); -SET TIMESTAMP=1000000000; -create table t2 (id int auto_increment not null primary key); -SET TIMESTAMP=1000000000; -insert into t1 values ("abirvalg"); -SET INSERT_ID=1; -SET TIMESTAMP=1000000000; -insert into t2 values (); -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +drop table if exists t1,t2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create table t1 (word varchar(20))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create table t2 (id int auto_increment not null primary key)/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 values ("abirvalg")/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t2 values ()/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-0' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-0' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -47,13 +49,15 @@ ROLLBACK /* added by mysqlbinlog */; --- Broken LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values ("Alas"); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values ("Alas")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -61,8 +65,10 @@ ROLLBACK /* added by mysqlbinlog */; --- --database -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -70,13 +76,15 @@ ROLLBACK /* added by mysqlbinlog */; --- --position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values ("Alas"); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values ("Alas")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -84,31 +92,33 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -drop table if exists t1,t2; -SET TIMESTAMP=1000000000; -create table t1 (word varchar(20)); -SET TIMESTAMP=1000000000; -create table t2 (id int auto_increment not null primary key); -SET TIMESTAMP=1000000000; -insert into t1 values ("abirvalg"); -SET INSERT_ID=1; -SET TIMESTAMP=1000000000; -insert into t2 values (); -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1; -SET TIMESTAMP=1000000000; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +drop table if exists t1,t2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create table t1 (word varchar(20))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create table t2 (id int auto_increment not null primary key)/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 values ("abirvalg")/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t2 values ()/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-2-2' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-3-2' INTO table t1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -116,13 +126,15 @@ ROLLBACK /* added by mysqlbinlog */; --- Broken LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values ("Alas"); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values ("Alas")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -130,8 +142,10 @@ ROLLBACK /* added by mysqlbinlog */; --- --database -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -139,13 +153,15 @@ ROLLBACK /* added by mysqlbinlog */; --- --position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values ("Alas"); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values ("Alas")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -153,22 +169,26 @@ ROLLBACK /* added by mysqlbinlog */; --- reading stdin -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1108844556; -BEGIN; -SET TIMESTAMP=1108844555; -insert t1 values (1); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1108844556/*!*/; +BEGIN/*!*/; +SET TIMESTAMP=1108844555/*!*/; +insert t1 values (1)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1108844556; -BEGIN; -SET TIMESTAMP=1108844555; -insert t1 values (1); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1108844556/*!*/; +BEGIN/*!*/; +SET TIMESTAMP=1108844555/*!*/; +insert t1 values (1)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -194,4 +214,39 @@ select * from t5 /* must be (1),(1) */; a 1 1 +drop procedure if exists p1; +flush logs; +create procedure p1() +begin +select 1; +end; +// +flush logs; +call p1(); +1 +1 +drop procedure p1; +call p1(); +ERROR 42000: PROCEDURE test.p1 does not exist +/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +CREATE DEFINER=`root`@`localhost` procedure p1() +begin +select 1; +end/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +call p1(); +1 +1 +drop procedure p1; drop table t1, t2, t03, t04, t3, t4, t5; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index 4d6be811037..51ca19654c7 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -17,29 +17,31 @@ insert into t1 values(null, "f"); --- Local -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -47,27 +49,29 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -75,17 +79,19 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -SET INSERT_ID=4; -use test; -SET TIMESTAMP=1579609946; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +SET INSERT_ID=4/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609946/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -93,23 +99,25 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -117,21 +125,23 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=3; -use test; -SET TIMESTAMP=1579609944; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=3/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609944/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -139,20 +149,22 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -160,37 +172,41 @@ ROLLBACK /* added by mysqlbinlog */; --- Local with 2 binlogs on command line -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -198,35 +214,39 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -234,25 +254,29 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -SET INSERT_ID=4; -use test; -SET TIMESTAMP=1579609946; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +SET INSERT_ID=4/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609946/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -260,30 +284,34 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -291,29 +319,33 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=3; -use test; -SET TIMESTAMP=1579609944; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=3/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609944/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -321,20 +353,22 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -342,29 +376,31 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -372,27 +408,29 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -400,17 +438,19 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -SET INSERT_ID=4; -use test; -SET TIMESTAMP=1579609946; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +SET INSERT_ID=4/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609946/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -418,23 +458,25 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -442,21 +484,23 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=3; -use test; -SET TIMESTAMP=1579609944; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=3/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609944/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -464,20 +508,22 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -485,37 +531,41 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote with 2 binlogs on command line -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -523,35 +573,39 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=1; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=1/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -559,25 +613,29 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -SET INSERT_ID=4; -use test; -SET TIMESTAMP=1579609946; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +SET INSERT_ID=4/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609946/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -585,30 +643,34 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -616,29 +678,33 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET INSERT_ID=3; -use test; -SET TIMESTAMP=1579609944; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -use test; -SET TIMESTAMP=1579609943; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET INSERT_ID=3/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609944/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +DELIMITER ; +DELIMITER /*!*/; +SET INSERT_ID=6/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609943/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -646,20 +712,22 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -667,32 +735,34 @@ ROLLBACK /* added by mysqlbinlog */; --- to-last-log -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1579609942; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (a int auto_increment not null primary key, b char(3)); -SET INSERT_ID=1; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "a"); -SET INSERT_ID=2; -SET TIMESTAMP=1579609942; -insert into t1 values(null, "b"); -SET INSERT_ID=3; -SET TIMESTAMP=1579609944; -insert into t1 values(null, "c"); -SET INSERT_ID=4; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "d"); -SET INSERT_ID=5; -SET TIMESTAMP=1579609946; -insert into t1 values(null, "e"); -SET INSERT_ID=6; -SET TIMESTAMP=1579609943; -insert into t1 values(null, "f"); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1579609942/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (a int auto_increment not null primary key, b char(3))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "a")/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1579609942/*!*/; +insert into t1 values(null, "b")/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1579609944/*!*/; +insert into t1 values(null, "c")/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "d")/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1579609946/*!*/; +insert into t1 values(null, "e")/*!*/; +SET INSERT_ID=6/*!*/; +SET TIMESTAMP=1579609943/*!*/; +insert into t1 values(null, "f")/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index e3e677ad0da..4b6d9f44a2b 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -176,84 +176,86 @@ hex(c1) hex(c2) CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -drop database if exists mysqltest2; -SET TIMESTAMP=1000000000; -drop database if exists mysqltest3; -SET TIMESTAMP=1000000000; -create database mysqltest2 character set latin2; -SET TIMESTAMP=1000000000; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; -create database mysqltest3; -SET TIMESTAMP=1000000000; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64; -drop database mysqltest3; -SET TIMESTAMP=1000000000; -create database mysqltest3; -use mysqltest2; -SET TIMESTAMP=1000000000; -create table t1 (a int auto_increment primary key, b varchar(100)); -SET INSERT_ID=1; -SET TIMESTAMP=1000000000; -/*!\C cp850 */; -SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64; -insert into t1 (b) values(@@character_set_server); -SET INSERT_ID=2; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(@@collation_server); -SET INSERT_ID=3; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(@@character_set_client); -SET INSERT_ID=4; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(@@character_set_connection); -SET INSERT_ID=5; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(@@collation_connection); -SET TIMESTAMP=1000000000; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64; -truncate table t1; -SET INSERT_ID=1; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(@@collation_connection); -SET INSERT_ID=2; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(LEAST("Mller","Muffler")); -SET INSERT_ID=3; -SET TIMESTAMP=1000000000; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64; -insert into t1 (b) values(@@collation_connection); -SET INSERT_ID=4; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(LEAST("Mller","Muffler")); -SET TIMESTAMP=1000000000; -truncate table t1; -SET INSERT_ID=1; -SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; -SET TIMESTAMP=1000000000; -insert into t1 (b) values(collation(@a)); -SET TIMESTAMP=1000000000; -drop database mysqltest2; -SET TIMESTAMP=1000000000; -drop database mysqltest3; -use test; -SET TIMESTAMP=1000000000; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30; -CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255)); -SET TIMESTAMP=1000000000; -/*!\C koi8r */; -SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30; -INSERT INTO t1 (c1, c2) VALUES (', ',', '); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +drop database if exists mysqltest2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +drop database if exists mysqltest3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create database mysqltest2 character set latin2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/; +create database mysqltest3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64/*!*/; +drop database mysqltest3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create database mysqltest3/*!*/; +use mysqltest2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +create table t1 (a int auto_increment primary key, b varchar(100))/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C cp850 *//*!*/; +SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64/*!*/; +insert into t1 (b) values(@@character_set_server)/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(@@collation_server)/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(@@character_set_client)/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(@@character_set_connection)/*!*/; +SET INSERT_ID=5/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(@@collation_connection)/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64/*!*/; +truncate table t1/*!*/; +SET INSERT_ID=1/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(@@collation_connection)/*!*/; +SET INSERT_ID=2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/; +SET INSERT_ID=3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64/*!*/; +insert into t1 (b) values(@@collation_connection)/*!*/; +SET INSERT_ID=4/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(LEAST("Mller","Muffler"))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +truncate table t1/*!*/; +SET INSERT_ID=1/*!*/; +SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`/*!*/; +SET TIMESTAMP=1000000000/*!*/; +insert into t1 (b) values(collation(@a))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +drop database mysqltest2/*!*/; +SET TIMESTAMP=1000000000/*!*/; +drop database mysqltest3/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30/*!*/; +CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +/*!\C koi8r *//*!*/; +SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30/*!*/; +INSERT INTO t1 (c1, c2) VALUES (', ',', ')/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index 96a892f00fc..b3ae37e01f7 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -43,27 +43,29 @@ t 2004-06-11 09:39:02 /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=100000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -create table t1 (t timestamp); -SET TIMESTAMP=100000000; -create table t2 (t char(32)); -SET TIMESTAMP=100000000; -SET @@session.time_zone='Europe/Moscow'; -insert into t1 values ('20050101000000'), ('20050611093902'); -SET TIMESTAMP=100000000; -SET @@session.time_zone='UTC'; -insert into t1 values ('20040101000000'), ('20040611093902'); -SET TIMESTAMP=100000000; -delete from t1; -SET TIMESTAMP=100000000; -SET @@session.time_zone='Europe/Moscow'; -insert into t1 values ('20040101000000'), ('20040611093902'); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=100000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +create table t1 (t timestamp)/*!*/; +SET TIMESTAMP=100000000/*!*/; +create table t2 (t char(32))/*!*/; +SET TIMESTAMP=100000000/*!*/; +SET @@session.time_zone='Europe/Moscow'/*!*/; +insert into t1 values ('20050101000000'), ('20050611093902')/*!*/; +SET TIMESTAMP=100000000/*!*/; +SET @@session.time_zone='UTC'/*!*/; +insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; +SET TIMESTAMP=100000000/*!*/; +delete from t1/*!*/; +SET TIMESTAMP=100000000/*!*/; +SET @@session.time_zone='Europe/Moscow'/*!*/; +insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index d1555bb793f..2b37a4b1d9a 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -15,19 +15,21 @@ master-bin.000001 273 User var 1 311 @`var2`=_binary 0x61 COLLATE binary master-bin.000001 311 Query 1 411 use `test`; insert into t1 values (@var1),(@var2) /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`; -use test; -SET TIMESTAMP=10000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -INSERT INTO t1 VALUES(@`a b`); -SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`; -SET @`var2`:=_binary 0x61 COLLATE `binary`; -SET TIMESTAMP=10000; -insert into t1 values (@var1),(@var2); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/; +use test/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +INSERT INTO t1 VALUES(@`a b`)/*!*/; +SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/; +SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/; +SET TIMESTAMP=10000/*!*/; +insert into t1 values (@var1),(@var2)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 66440f1236e..c289f537d38 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -290,6 +290,6 @@ eval select is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 0691cb7c76b..a0cd21acec1 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -134,6 +134,30 @@ flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL select * from t5 /* must be (1),(1) */; +# +# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails +# +--disable_warnings +drop procedure if exists p1; +--enable_warnings +flush logs; +delimiter //; +create procedure p1() +begin +select 1; +end; +// +delimiter ;// +flush logs; +call p1(); +drop procedure p1; +--error 1305 +call p1(); +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL +call p1(); +drop procedure p1; + # clean up drop table t1, t2, t03, t04, t3, t4, t5; diff --git a/sql/log_event.cc b/sql/log_event.cc index 30490f75c0f..3d2cd842171 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1506,15 +1506,16 @@ void Query_log_event::print_query_header(FILE* file, if (different_db= memcmp(print_event_info->db, db, db_len + 1)) memcpy(print_event_info->db, db, db_len + 1); if (db[0] && different_db) - fprintf(file, "use %s;\n", db); + fprintf(file, "use %s%s\n", db, print_event_info->delimiter); } end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10); - *end++=';'; + end= strmov(end, print_event_info->delimiter); *end++='\n'; my_fwrite(file, (byte*) buff, (uint) (end-buff),MYF(MY_NABP | MY_WME)); if (flags & LOG_EVENT_THREAD_SPECIFIC_F) - fprintf(file,"SET @@session.pseudo_thread_id=%lu;\n",(ulong)thread_id); + fprintf(file,"SET @@session.pseudo_thread_id=%lu%s\n", + (ulong)thread_id, print_event_info->delimiter); /* If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to @@ -1543,7 +1544,7 @@ void Query_log_event::print_query_header(FILE* file, "@@session.sql_auto_is_null", &need_comma); print_set_option(file, tmp, OPTION_RELAXED_UNIQUE_CHECKS, ~flags2, "@@session.unique_checks", &need_comma); - fprintf(file,";\n"); + fprintf(file,"%s\n", print_event_info->delimiter); print_event_info->flags2= flags2; } } @@ -1571,15 +1572,17 @@ void Query_log_event::print_query_header(FILE* file, } if (unlikely(print_event_info->sql_mode != sql_mode)) { - fprintf(file,"SET @@session.sql_mode=%lu;\n",(ulong)sql_mode); + fprintf(file,"SET @@session.sql_mode=%lu%s\n", + (ulong)sql_mode, print_event_info->delimiter); print_event_info->sql_mode= sql_mode; } } if (print_event_info->auto_increment_increment != auto_increment_increment || print_event_info->auto_increment_offset != auto_increment_offset) { - fprintf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu;\n", - auto_increment_increment,auto_increment_offset); + fprintf(file,"SET @@session.auto_increment_increment=%lu, @@session.auto_increment_offset=%lu%s\n", + auto_increment_increment,auto_increment_offset, + print_event_info->delimiter); print_event_info->auto_increment_increment= auto_increment_increment; print_event_info->auto_increment_offset= auto_increment_offset; } @@ -1598,16 +1601,19 @@ void Query_log_event::print_query_header(FILE* file, CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); if (cs_info) { - fprintf(file, "/*!\\C %s */;\n", cs_info->csname); /* for mysql client */ + /* for mysql client */ + fprintf(file, "/*!\\C %s */%s\n", + cs_info->csname, print_event_info->delimiter); } fprintf(file,"SET " "@@session.character_set_client=%d," "@@session.collation_connection=%d," "@@session.collation_server=%d" - ";\n", + "%s\n", uint2korr(charset), uint2korr(charset+2), - uint2korr(charset+4)); + uint2korr(charset+4), + print_event_info->delimiter); memcpy(print_event_info->charset, charset, 6); } } @@ -1615,7 +1621,8 @@ void Query_log_event::print_query_header(FILE* file, { if (bcmp(print_event_info->time_zone_str, time_zone_str, time_zone_len+1)) { - fprintf(file,"SET @@session.time_zone='%s';\n", time_zone_str); + fprintf(file,"SET @@session.time_zone='%s'%s\n", + time_zone_str, print_event_info->delimiter); memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1); } } @@ -1626,7 +1633,7 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) { print_query_header(file, print_event_info); my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME)); - fputs(";\n", file); + fprintf(file, "%s\n", print_event_info->delimiter); } #endif /* MYSQL_CLIENT */ @@ -1980,9 +1987,9 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info) and rollback unfinished transaction. Probably this can be done with RESET CONNECTION (syntax to be defined). */ - fprintf(file,"RESET CONNECTION;\n"); + fprintf(file,"RESET CONNECTION%s\n", print_event_info->delimiter); #else - fprintf(file,"ROLLBACK;\n"); + fprintf(file,"ROLLBACK%s\n", print_event_info->delimiter); #endif } fflush(file); @@ -2716,13 +2723,14 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info, } if (db && db[0] && different_db) - fprintf(file, "%suse %s;\n", + fprintf(file, "%suse %s%s\n", commented ? "# " : "", - db); + db, print_event_info->delimiter); if (flags & LOG_EVENT_THREAD_SPECIFIC_F) - fprintf(file,"%sSET @@session.pseudo_thread_id=%lu;\n", - commented ? "# " : "", (ulong)thread_id); + fprintf(file,"%sSET @@session.pseudo_thread_id=%lu%s\n", + commented ? "# " : "", (ulong)thread_id, + print_event_info->delimiter); fprintf(file, "%sLOAD DATA ", commented ? "# " : ""); if (check_fname_outside_temp_buf()) @@ -2774,7 +2782,7 @@ void Load_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info, fputc(')', file); } - fprintf(file, ";\n"); + fprintf(file, "%s\n", print_event_info->delimiter); DBUG_VOID_RETURN; } #endif /* MYSQL_CLIENT */ @@ -3351,7 +3359,8 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) msg="INVALID_INT"; break; } - fprintf(file, "%s=%s;\n", msg, llstr(val,llbuff)); + fprintf(file, "%s=%s%s\n", + msg, llstr(val,llbuff), print_event_info->delimiter); fflush(file); } #endif @@ -3426,8 +3435,9 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) print_header(file, print_event_info); fprintf(file, "\tRand\n"); } - fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n", - llstr(seed1, llbuff),llstr(seed2, llbuff2)); + fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s%s\n", + llstr(seed1, llbuff),llstr(seed2, llbuff2), + print_event_info->delimiter); fflush(file); } #endif /* MYSQL_CLIENT */ @@ -3499,7 +3509,7 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) fprintf(file, "\tXid = %s\n", buf); fflush(file); } - fprintf(file, "COMMIT;\n"); + fprintf(file, "COMMIT%s\n", print_event_info->delimiter); } #endif /* MYSQL_CLIENT */ @@ -3700,7 +3710,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) if (is_null) { - fprintf(file, ":=NULL;\n"); + fprintf(file, ":=NULL%s\n", print_event_info->delimiter); } else { @@ -3708,12 +3718,12 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) case REAL_RESULT: double real_val; float8get(real_val, val); - fprintf(file, ":=%.14g;\n", real_val); + fprintf(file, ":=%.14g%s\n", real_val, print_event_info->delimiter); break; case INT_RESULT: char int_buf[22]; longlong10_to_str(uint8korr(val), int_buf, -10); - fprintf(file, ":=%s;\n", int_buf); + fprintf(file, ":=%s%s\n", int_buf, print_event_info->delimiter); break; case DECIMAL_RESULT: { @@ -3729,7 +3739,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) bin2decimal(val+2, &dec, precision, scale); decimal2string(&dec, str_buf, &str_len, 0, 0, 0); str_buf[str_len]= 0; - fprintf(file, ":=%s;\n",str_buf); + fprintf(file, ":=%s%s\n",str_buf, print_event_info->delimiter); break; } case STRING_RESULT: @@ -3765,9 +3775,10 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) Generate an unusable command (=> syntax error) is probably the best thing we can do here. */ - fprintf(file, ":=???;\n"); + fprintf(file, ":=???%s\n", print_event_info->delimiter); else - fprintf(file, ":=_%s %s COLLATE `%s`;\n", cs->csname, hex_str, cs->name); + fprintf(file, ":=_%s %s COLLATE `%s`%s\n", + cs->csname, hex_str, cs->name, print_event_info->delimiter); my_afree(hex_str); } break; @@ -4866,12 +4877,12 @@ void Execute_load_query_log_event::print(FILE* file, fprintf(file, " INTO"); my_fwrite(file, (byte*) query + fn_pos_end, q_len-fn_pos_end, MYF(MY_NABP | MY_WME)); - fprintf(file, ";\n"); + fprintf(file, "%s\n", print_event_info->delimiter); } else { my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME)); - fprintf(file, ";\n"); + fprintf(file, "%s\n", print_event_info->delimiter); } if (!print_event_info->short_form) diff --git a/sql/log_event.h b/sql/log_event.h index 247e1962776..d5da90c0458 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -519,12 +519,14 @@ typedef struct st_print_event_info bzero(db, sizeof(db)); bzero(charset, sizeof(charset)); bzero(time_zone_str, sizeof(time_zone_str)); + strcpy(delimiter, ";"); } /* Settings on how to print the events */ bool short_form; my_off_t hexdump_from; uint8 common_header_len; + char delimiter[16]; } PRINT_EVENT_INFO; #endif From dcde1be17d1467c582d75d13968e0b8ab4f44611 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 30 Nov 2006 11:08:23 +0400 Subject: [PATCH 014/160] Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES Problem: ``SET PASSWORD FOR foo@localhost'' was written into binary log using double quites: ``SET PASSWORD FOR "foo"@"localhost"...''. If sql_mode was set to ANSI_QUOTES, parser on slave considered "foo" and "localhost" as identifiers instead of strigns constants, so it failed to parse, generated syntax error and slave then stopped. Fix: changing binary log entries to use single quotes: ``SET PASSWORD FOR 'foo'@'localhost'...'' not to depend on ANSI_QUOTES. --- mysql-test/r/rpl_do_grant.result | 11 +++++++++++ mysql-test/t/rpl_do_grant.test | 16 ++++++++++++++++ sql/sql_acl.cc | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result index ff3e059503c..fe6ef3c26bc 100644 --- a/mysql-test/r/rpl_do_grant.result +++ b/mysql-test/r/rpl_do_grant.result @@ -20,6 +20,17 @@ set password for rpl_do_grant@localhost=password("does it work?"); select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; password<>_binary'' 1 +update mysql.user set password='' where user='rpl_do_grant'; +flush privileges; +select password<>'' from mysql.user where user='rpl_do_grant'; +password<>'' +0 +set sql_mode='ANSI_QUOTES'; +set password for rpl_do_grant@localhost=password('does it work?'); +set sql_mode=''; +select password<>'' from mysql.user where user='rpl_do_grant'; +password<>'' +1 delete from mysql.user where user=_binary'rpl_do_grant'; delete from mysql.db where user=_binary'rpl_do_grant'; flush privileges; diff --git a/mysql-test/t/rpl_do_grant.test b/mysql-test/t/rpl_do_grant.test index 54287a67657..4a9c1554630 100644 --- a/mysql-test/t/rpl_do_grant.test +++ b/mysql-test/t/rpl_do_grant.test @@ -33,6 +33,22 @@ connection slave; sync_with_master; select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant'; +# +# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES +# +connection master; +update mysql.user set password='' where user='rpl_do_grant'; +flush privileges; +select password<>'' from mysql.user where user='rpl_do_grant'; +set sql_mode='ANSI_QUOTES'; +set password for rpl_do_grant@localhost=password('does it work?'); +set sql_mode=''; +save_master_pos; +connection slave; +sync_with_master; +select password<>'' from mysql.user where user='rpl_do_grant'; + + # clear what we have done, to not influence other tests. connection master; delete from mysql.user where user=_binary'rpl_do_grant'; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 724cf88d373..be5591ce3d7 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1498,7 +1498,7 @@ bool change_password(THD *thd, const char *host, const char *user, { query_length= my_sprintf(buff, - (buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"", + (buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", acl_user->user ? acl_user->user : "", acl_user->host.hostname ? acl_user->host.hostname : "", new_password)); From 8f59d9917a3de76f0aef89d71c8b33c5f8846b35 Mon Sep 17 00:00:00 2001 From: "guilhem@gbichot3.local" <> Date: Mon, 4 Dec 2006 15:57:56 +0100 Subject: [PATCH 015/160] Work around slow my_atomic-t test on hpux11: decrease number of iterations on this platform --- unittest/mysys/my_atomic-t.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c index fe93b0942ce..25f00f3ff87 100644 --- a/unittest/mysys/my_atomic-t.c +++ b/unittest/mysys/my_atomic-t.c @@ -174,9 +174,15 @@ int main() pthread_cond_init(&cond, 0); my_atomic_rwlock_init(&rwl); - test_atomic("my_atomic_add32", test_atomic_add_handler, 100,10000); - test_atomic("my_atomic_swap32", test_atomic_swap_handler, 100,10000); - test_atomic("my_atomic_cas32", test_atomic_cas_handler, 100,10000); +#ifdef HPUX11 +#define CYCLES 1000 +#else +#define CYCLES 10000 +#endif +#define THREADS 100 + test_atomic("my_atomic_add32", test_atomic_add_handler, THREADS, CYCLES); + test_atomic("my_atomic_swap32", test_atomic_swap_handler, THREADS, CYCLES); + test_atomic("my_atomic_cas32", test_atomic_cas_handler, THREADS, CYCLES); /* workaround until we know why it crashes randomly on some machine From 224660d14acb702c57ff0f31a7722413cdd5a31b Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 5 Dec 2006 13:45:21 +0400 Subject: [PATCH 016/160] Bug#22645 LC_TIME_NAMES: Statement not replicated Problem: replication of LC_TIME_NAMES didn't work. Thus, INSERTS or UPDATES using date_format() always worked with en_US on the slave side. Fix: adding ONE_SHOT implementation for LC_TIME_NAMES. --- mysql-test/r/rpl_locale.result | 16 + mysql-test/r/variables.result | 57 ++ mysql-test/t/rpl_locale.test | 22 + mysql-test/t/variables.test | 44 ++ sql/log.cc | 15 + sql/mysql_priv.h | 2 + sql/set_var.cc | 35 +- sql/set_var.h | 8 +- sql/sql_locale.cc | 1245 +++++++++++++++++++++++++++++--- sql/sql_parse.cc | 1 + 10 files changed, 1315 insertions(+), 130 deletions(-) create mode 100644 mysql-test/r/rpl_locale.result create mode 100644 mysql-test/t/rpl_locale.test diff --git a/mysql-test/r/rpl_locale.result b/mysql-test/r/rpl_locale.result new file mode 100644 index 00000000000..5de5bab9a0b --- /dev/null +++ b/mysql-test/r/rpl_locale.result @@ -0,0 +1,16 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table t1 (s1 char(10)); +set lc_time_names= 'de_DE'; +insert into t1 values (date_format('2001-01-01','%W')); +select * from t1; +s1 +Montag +select * from t1; +s1 +Montag +drop table t1; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 0aa7ea7f83c..14f1eb7d306 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -499,6 +499,63 @@ set names latin1; select @@have_innodb; @@have_innodb # +*** Various tests with LC_TIME_NAMES +*** LC_TIME_NAMES: testing case insensitivity +set @@lc_time_names='ru_ru'; +select @@lc_time_names; +@@lc_time_names +ru_RU +*** LC_TIME_NAMES: testing with a user variable +set @lc='JA_JP'; +set @@lc_time_names=@lc; +select @@lc_time_names; +@@lc_time_names +ja_JP +*** LC_TIME_NAMES: testing with string expressions +set lc_time_names=concat('de','_','DE'); +select @@lc_time_names; +@@lc_time_names +de_DE +set lc_time_names=concat('de','+','DE'); +ERROR HY000: Unknown locale: 'de+DE' +select @@lc_time_names; +@@lc_time_names +de_DE +LC_TIME_NAMES: testing with numeric expressions +set @@lc_time_names=1+2; +select @@lc_time_names; +@@lc_time_names +sv_SE +set @@lc_time_names=1/0; +ERROR 42000: Incorrect argument type to variable 'lc_time_names' +select @@lc_time_names; +@@lc_time_names +sv_SE +set lc_time_names=en_US; +LC_TIME_NAMES: testing NULL and a negative number: +set lc_time_names=NULL; +ERROR 42000: Variable 'lc_time_names' can't be set to the value of 'NULL' +set lc_time_names=-1; +ERROR HY000: Unknown locale: '-1' +select @@lc_time_names; +@@lc_time_names +en_US +LC_TIME_NAMES: testing locale with the last ID: +set lc_time_names=108; +select @@lc_time_names; +@@lc_time_names +zh_HK +LC_TIME_NAMES: testing a number beyond the valid ID range: +set lc_time_names=109; +ERROR HY000: Unknown locale: '109' +select @@lc_time_names; +@@lc_time_names +zh_HK +LC_TIME_NAMES: testing that 0 is en_US: +set lc_time_names=0; +select @@lc_time_names; +@@lc_time_names +en_US set @test = @@query_prealloc_size; set @@query_prealloc_size = @test; select @@query_prealloc_size = @test; diff --git a/mysql-test/t/rpl_locale.test b/mysql-test/t/rpl_locale.test new file mode 100644 index 00000000000..530a3d77636 --- /dev/null +++ b/mysql-test/t/rpl_locale.test @@ -0,0 +1,22 @@ +# Replication of locale variables + +source include/master-slave.inc; + +# +# Bug#22645 LC_TIME_NAMES: Statement not replicated +# +connection master; +create table t1 (s1 char(10)); +set lc_time_names= 'de_DE'; +insert into t1 values (date_format('2001-01-01','%W')); +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection master; +drop table t1; +sync_slave_with_master; + +# End of 4.1 tests + + diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 8322c0f84bd..808dc0973d4 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -396,6 +396,50 @@ set names latin1; --replace_column 1 # select @@have_innodb; +# +# Tests for lc_time_names +# Note, when adding new locales, please fix ID accordingly: +# - to test the last ID (currently 108) +# - and the next after the last (currently 109) +# +--echo *** Various tests with LC_TIME_NAMES +--echo *** LC_TIME_NAMES: testing case insensitivity +set @@lc_time_names='ru_ru'; +select @@lc_time_names; +--echo *** LC_TIME_NAMES: testing with a user variable +set @lc='JA_JP'; +set @@lc_time_names=@lc; +select @@lc_time_names; +--echo *** LC_TIME_NAMES: testing with string expressions +set lc_time_names=concat('de','_','DE'); +select @@lc_time_names; +--error 1105 +set lc_time_names=concat('de','+','DE'); +select @@lc_time_names; +--echo LC_TIME_NAMES: testing with numeric expressions +set @@lc_time_names=1+2; +select @@lc_time_names; +--error 1232 +set @@lc_time_names=1/0; +select @@lc_time_names; +set lc_time_names=en_US; +--echo LC_TIME_NAMES: testing NULL and a negative number: +--error 1231 +set lc_time_names=NULL; +--error 1105 +set lc_time_names=-1; +select @@lc_time_names; +--echo LC_TIME_NAMES: testing locale with the last ID: +set lc_time_names=108; +select @@lc_time_names; +--echo LC_TIME_NAMES: testing a number beyond the valid ID range: +--error 1105 +set lc_time_names=109; +select @@lc_time_names; +--echo LC_TIME_NAMES: testing that 0 is en_US: +set lc_time_names=0; +select @@lc_time_names; + # # Bug #13334: query_prealloc_size default less than minimum # diff --git a/sql/log.cc b/sql/log.cc index 7e97bfd0712..b91ec2b3dee 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1350,6 +1350,21 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u", if (e.write(file)) goto err; } + /* + Use the same ONE_SHOT trick for making replication of lc_time_names. + */ + if (thd->variables.lc_time_names->number) // Not en_US + { + char buf[32]; + uint length= my_snprintf(buf, sizeof(buf), + "SET ONE_SHOT LC_TIME_NAMES=%u", + (uint) thd->variables.lc_time_names->number); + Query_log_event e(thd, buf, length, 0, FALSE); + e.set_log_pos(this); + e.error_code= 0; // This statement cannot fail (see [1]). + if (e.write(file)) + goto err; + } #endif if (thd->last_insert_id_used) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8d6cdebe1f7..51fd22f2943 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -71,6 +71,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; typedef struct my_locale_st { + uint number; const char *name; const char *description; const bool is_ascii; @@ -84,6 +85,7 @@ extern MY_LOCALE my_locale_en_US; extern MY_LOCALE *my_locales[]; MY_LOCALE *my_locale_by_name(const char *name); +MY_LOCALE *my_locale_by_number(uint number); /*************************************************************************** Configuration parameters diff --git a/sql/set_var.cc b/sql/set_var.cc index 4433b6bf7d8..3de003ea16c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2576,19 +2576,38 @@ void sys_var_thd_time_zone::set_default(THD *thd, enum_var_type type) bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var) { - char *locale_str =var->value->str_value.c_ptr(); - MY_LOCALE *locale_match= my_locale_by_name(locale_str); + MY_LOCALE *locale_match; - if(locale_match == NULL) + if (var->value->result_type() == INT_RESULT) { - my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), locale_str); - return 1; + if (!(locale_match= my_locale_by_number((uint) var->value->val_int()))) + { + char buf[20]; + int10_to_str((int) var->value->val_int(), buf, -10); + my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), buf); + return 1; + } } - else + else // STRING_RESULT { - var->save_result.locale_value= locale_match; - return 0; + char buff[6]; + String str(buff, sizeof(buff), &my_charset_latin1), *res; + if (!(res=var->value->val_str(&str))) + { + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL"); + return 1; + } + const char *locale_str= res->c_ptr(); + if (!(locale_match= my_locale_by_name(locale_str))) + { + my_printf_error(ER_UNKNOWN_ERROR, + "Unknown locale: '%s'", MYF(0), locale_str); + return 1; + } } + + var->save_result.locale_value= locale_match; + return 0; } diff --git a/sql/set_var.h b/sql/set_var.h index 1ae3a18111f..78b34963e9d 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -764,12 +764,16 @@ class sys_var_thd_lc_time_names :public sys_var_thd public: sys_var_thd_lc_time_names(const char *name_arg): sys_var_thd(name_arg) - {} + { +#if MYSQL_VERSION_ID < 50000 + no_support_one_shot= 0; +#endif + } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } bool check_update_type(Item_result type) { - return type != STRING_RESULT; /* Only accept strings */ + return ((type != STRING_RESULT) && (type != INT_RESULT)); } bool check_default(enum_var_type type) { return 0; } bool update(THD *thd, set_var *var); diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index 9dae55e4508..1f60c61ed46 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -24,17 +24,6 @@ #include "mysql_priv.h" -MY_LOCALE *my_locale_by_name(const char *name) -{ - MY_LOCALE **locale; - for( locale= my_locales; *locale != NULL; locale++) - { - if(!strcmp((*locale)->name, name)) - return *locale; - } - return NULL; -} - /***** LOCALE BEGIN ar_AE: Arabic - United Arab Emirates *****/ static const char *my_locale_month_names_ar_AE[13] = {"يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر", NullS }; @@ -53,7 +42,16 @@ static TYPELIB my_locale_typelib_day_names_ar_AE = static TYPELIB my_locale_typelib_ab_day_names_ar_AE = { array_elements(my_locale_ab_day_names_ar_AE)-1, "", my_locale_ab_day_names_ar_AE, NULL }; MY_LOCALE my_locale_ar_AE= - { "ar_AE", "Arabic - United Arab Emirates", FALSE, &my_locale_typelib_month_names_ar_AE, &my_locale_typelib_ab_month_names_ar_AE, &my_locale_typelib_day_names_ar_AE, &my_locale_typelib_ab_day_names_ar_AE }; +{ + 6, + "ar_AE", + "Arabic - United Arab Emirates", + FALSE, + &my_locale_typelib_month_names_ar_AE, + &my_locale_typelib_ab_month_names_ar_AE, + &my_locale_typelib_day_names_ar_AE, + &my_locale_typelib_ab_day_names_ar_AE +}; /***** LOCALE END ar_AE *****/ /***** LOCALE BEGIN ar_BH: Arabic - Bahrain *****/ @@ -74,7 +72,16 @@ static TYPELIB my_locale_typelib_day_names_ar_BH = static TYPELIB my_locale_typelib_ab_day_names_ar_BH = { array_elements(my_locale_ab_day_names_ar_BH)-1, "", my_locale_ab_day_names_ar_BH, NULL }; MY_LOCALE my_locale_ar_BH= - { "ar_BH", "Arabic - Bahrain", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 7, + "ar_BH", + "Arabic - Bahrain", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_BH *****/ /***** LOCALE BEGIN ar_JO: Arabic - Jordan *****/ @@ -95,7 +102,16 @@ static TYPELIB my_locale_typelib_day_names_ar_JO = static TYPELIB my_locale_typelib_ab_day_names_ar_JO = { array_elements(my_locale_ab_day_names_ar_JO)-1, "", my_locale_ab_day_names_ar_JO, NULL }; MY_LOCALE my_locale_ar_JO= - { "ar_JO", "Arabic - Jordan", FALSE, &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, &my_locale_typelib_ab_day_names_ar_JO }; +{ + 8, + "ar_JO", + "Arabic - Jordan", + FALSE, + &my_locale_typelib_month_names_ar_JO, + &my_locale_typelib_ab_month_names_ar_JO, + &my_locale_typelib_day_names_ar_JO, + &my_locale_typelib_ab_day_names_ar_JO +}; /***** LOCALE END ar_JO *****/ /***** LOCALE BEGIN ar_SA: Arabic - Saudi Arabia *****/ @@ -116,7 +132,16 @@ static TYPELIB my_locale_typelib_day_names_ar_SA = static TYPELIB my_locale_typelib_ab_day_names_ar_SA = { array_elements(my_locale_ab_day_names_ar_SA)-1, "", my_locale_ab_day_names_ar_SA, NULL }; MY_LOCALE my_locale_ar_SA= - { "ar_SA", "Arabic - Saudi Arabia", FALSE, &my_locale_typelib_month_names_ar_SA, &my_locale_typelib_ab_month_names_ar_SA, &my_locale_typelib_day_names_ar_SA, &my_locale_typelib_ab_day_names_ar_SA }; +{ + 9, + "ar_SA", + "Arabic - Saudi Arabia", + FALSE, + &my_locale_typelib_month_names_ar_SA, + &my_locale_typelib_ab_month_names_ar_SA, + &my_locale_typelib_day_names_ar_SA, + &my_locale_typelib_ab_day_names_ar_SA +}; /***** LOCALE END ar_SA *****/ /***** LOCALE BEGIN ar_SY: Arabic - Syria *****/ @@ -137,7 +162,16 @@ static TYPELIB my_locale_typelib_day_names_ar_SY = static TYPELIB my_locale_typelib_ab_day_names_ar_SY = { array_elements(my_locale_ab_day_names_ar_SY)-1, "", my_locale_ab_day_names_ar_SY, NULL }; MY_LOCALE my_locale_ar_SY= - { "ar_SY", "Arabic - Syria", FALSE, &my_locale_typelib_month_names_ar_SY, &my_locale_typelib_ab_month_names_ar_SY, &my_locale_typelib_day_names_ar_SY, &my_locale_typelib_ab_day_names_ar_SY }; +{ + 10, + "ar_SY", + "Arabic - Syria", + FALSE, + &my_locale_typelib_month_names_ar_SY, + &my_locale_typelib_ab_month_names_ar_SY, + &my_locale_typelib_day_names_ar_SY, + &my_locale_typelib_ab_day_names_ar_SY +}; /***** LOCALE END ar_SY *****/ /***** LOCALE BEGIN be_BY: Belarusian - Belarus *****/ @@ -158,7 +192,16 @@ static TYPELIB my_locale_typelib_day_names_be_BY = static TYPELIB my_locale_typelib_ab_day_names_be_BY = { array_elements(my_locale_ab_day_names_be_BY)-1, "", my_locale_ab_day_names_be_BY, NULL }; MY_LOCALE my_locale_be_BY= - { "be_BY", "Belarusian - Belarus", FALSE, &my_locale_typelib_month_names_be_BY, &my_locale_typelib_ab_month_names_be_BY, &my_locale_typelib_day_names_be_BY, &my_locale_typelib_ab_day_names_be_BY }; +{ + 11, + "be_BY", + "Belarusian - Belarus", + FALSE, + &my_locale_typelib_month_names_be_BY, + &my_locale_typelib_ab_month_names_be_BY, + &my_locale_typelib_day_names_be_BY, + &my_locale_typelib_ab_day_names_be_BY +}; /***** LOCALE END be_BY *****/ /***** LOCALE BEGIN bg_BG: Bulgarian - Bulgaria *****/ @@ -179,7 +222,16 @@ static TYPELIB my_locale_typelib_day_names_bg_BG = static TYPELIB my_locale_typelib_ab_day_names_bg_BG = { array_elements(my_locale_ab_day_names_bg_BG)-1, "", my_locale_ab_day_names_bg_BG, NULL }; MY_LOCALE my_locale_bg_BG= - { "bg_BG", "Bulgarian - Bulgaria", FALSE, &my_locale_typelib_month_names_bg_BG, &my_locale_typelib_ab_month_names_bg_BG, &my_locale_typelib_day_names_bg_BG, &my_locale_typelib_ab_day_names_bg_BG }; +{ + 12, + "bg_BG", + "Bulgarian - Bulgaria", + FALSE, + &my_locale_typelib_month_names_bg_BG, + &my_locale_typelib_ab_month_names_bg_BG, + &my_locale_typelib_day_names_bg_BG, + &my_locale_typelib_ab_day_names_bg_BG +}; /***** LOCALE END bg_BG *****/ /***** LOCALE BEGIN ca_ES: Catalan - Catalan *****/ @@ -200,7 +252,16 @@ static TYPELIB my_locale_typelib_day_names_ca_ES = static TYPELIB my_locale_typelib_ab_day_names_ca_ES = { array_elements(my_locale_ab_day_names_ca_ES)-1, "", my_locale_ab_day_names_ca_ES, NULL }; MY_LOCALE my_locale_ca_ES= - { "ca_ES", "Catalan - Catalan", FALSE, &my_locale_typelib_month_names_ca_ES, &my_locale_typelib_ab_month_names_ca_ES, &my_locale_typelib_day_names_ca_ES, &my_locale_typelib_ab_day_names_ca_ES }; +{ + 13, + "ca_ES", + "Catalan - Catalan", + FALSE, + &my_locale_typelib_month_names_ca_ES, + &my_locale_typelib_ab_month_names_ca_ES, + &my_locale_typelib_day_names_ca_ES, + &my_locale_typelib_ab_day_names_ca_ES +}; /***** LOCALE END ca_ES *****/ /***** LOCALE BEGIN cs_CZ: Czech - Czech Republic *****/ @@ -221,7 +282,16 @@ static TYPELIB my_locale_typelib_day_names_cs_CZ = static TYPELIB my_locale_typelib_ab_day_names_cs_CZ = { array_elements(my_locale_ab_day_names_cs_CZ)-1, "", my_locale_ab_day_names_cs_CZ, NULL }; MY_LOCALE my_locale_cs_CZ= - { "cs_CZ", "Czech - Czech Republic", FALSE, &my_locale_typelib_month_names_cs_CZ, &my_locale_typelib_ab_month_names_cs_CZ, &my_locale_typelib_day_names_cs_CZ, &my_locale_typelib_ab_day_names_cs_CZ }; +{ + 14, + "cs_CZ", + "Czech - Czech Republic", + FALSE, + &my_locale_typelib_month_names_cs_CZ, + &my_locale_typelib_ab_month_names_cs_CZ, + &my_locale_typelib_day_names_cs_CZ, + &my_locale_typelib_ab_day_names_cs_CZ +}; /***** LOCALE END cs_CZ *****/ /***** LOCALE BEGIN da_DK: Danish - Denmark *****/ @@ -242,7 +312,16 @@ static TYPELIB my_locale_typelib_day_names_da_DK = static TYPELIB my_locale_typelib_ab_day_names_da_DK = { array_elements(my_locale_ab_day_names_da_DK)-1, "", my_locale_ab_day_names_da_DK, NULL }; MY_LOCALE my_locale_da_DK= - { "da_DK", "Danish - Denmark", FALSE, &my_locale_typelib_month_names_da_DK, &my_locale_typelib_ab_month_names_da_DK, &my_locale_typelib_day_names_da_DK, &my_locale_typelib_ab_day_names_da_DK }; +{ + 15, + "da_DK", + "Danish - Denmark", + FALSE, + &my_locale_typelib_month_names_da_DK, + &my_locale_typelib_ab_month_names_da_DK, + &my_locale_typelib_day_names_da_DK, + &my_locale_typelib_ab_day_names_da_DK +}; /***** LOCALE END da_DK *****/ /***** LOCALE BEGIN de_AT: German - Austria *****/ @@ -263,7 +342,16 @@ static TYPELIB my_locale_typelib_day_names_de_AT = static TYPELIB my_locale_typelib_ab_day_names_de_AT = { array_elements(my_locale_ab_day_names_de_AT)-1, "", my_locale_ab_day_names_de_AT, NULL }; MY_LOCALE my_locale_de_AT= - { "de_AT", "German - Austria", FALSE, &my_locale_typelib_month_names_de_AT, &my_locale_typelib_ab_month_names_de_AT, &my_locale_typelib_day_names_de_AT, &my_locale_typelib_ab_day_names_de_AT }; +{ + 16, + "de_AT", + "German - Austria", + FALSE, + &my_locale_typelib_month_names_de_AT, + &my_locale_typelib_ab_month_names_de_AT, + &my_locale_typelib_day_names_de_AT, + &my_locale_typelib_ab_day_names_de_AT +}; /***** LOCALE END de_AT *****/ /***** LOCALE BEGIN de_DE: German - Germany *****/ @@ -284,7 +372,16 @@ static TYPELIB my_locale_typelib_day_names_de_DE = static TYPELIB my_locale_typelib_ab_day_names_de_DE = { array_elements(my_locale_ab_day_names_de_DE)-1, "", my_locale_ab_day_names_de_DE, NULL }; MY_LOCALE my_locale_de_DE= - { "de_DE", "German - Germany", FALSE, &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE }; +{ + 4, + "de_DE", + "German - Germany", + FALSE, + &my_locale_typelib_month_names_de_DE, + &my_locale_typelib_ab_month_names_de_DE, + &my_locale_typelib_day_names_de_DE, + &my_locale_typelib_ab_day_names_de_DE +}; /***** LOCALE END de_DE *****/ /***** LOCALE BEGIN en_US: English - United States *****/ @@ -305,7 +402,16 @@ static TYPELIB my_locale_typelib_day_names_en_US = static TYPELIB my_locale_typelib_ab_day_names_en_US = { array_elements(my_locale_ab_day_names_en_US)-1, "", my_locale_ab_day_names_en_US, NULL }; MY_LOCALE my_locale_en_US= - { "en_US", "English - United States", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 0, + "en_US", + "English - United States", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_US *****/ /***** LOCALE BEGIN es_ES: Spanish - Spain *****/ @@ -326,7 +432,16 @@ static TYPELIB my_locale_typelib_day_names_es_ES = static TYPELIB my_locale_typelib_ab_day_names_es_ES = { array_elements(my_locale_ab_day_names_es_ES)-1, "", my_locale_ab_day_names_es_ES, NULL }; MY_LOCALE my_locale_es_ES= - { "es_ES", "Spanish - Spain", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 17, + "es_ES", + "Spanish - Spain", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_ES *****/ /***** LOCALE BEGIN et_EE: Estonian - Estonia *****/ @@ -347,7 +462,16 @@ static TYPELIB my_locale_typelib_day_names_et_EE = static TYPELIB my_locale_typelib_ab_day_names_et_EE = { array_elements(my_locale_ab_day_names_et_EE)-1, "", my_locale_ab_day_names_et_EE, NULL }; MY_LOCALE my_locale_et_EE= - { "et_EE", "Estonian - Estonia", FALSE, &my_locale_typelib_month_names_et_EE, &my_locale_typelib_ab_month_names_et_EE, &my_locale_typelib_day_names_et_EE, &my_locale_typelib_ab_day_names_et_EE }; +{ + 18, + "et_EE", + "Estonian - Estonia", + FALSE, + &my_locale_typelib_month_names_et_EE, + &my_locale_typelib_ab_month_names_et_EE, + &my_locale_typelib_day_names_et_EE, + &my_locale_typelib_ab_day_names_et_EE +}; /***** LOCALE END et_EE *****/ /***** LOCALE BEGIN eu_ES: Basque - Basque *****/ @@ -368,7 +492,16 @@ static TYPELIB my_locale_typelib_day_names_eu_ES = static TYPELIB my_locale_typelib_ab_day_names_eu_ES = { array_elements(my_locale_ab_day_names_eu_ES)-1, "", my_locale_ab_day_names_eu_ES, NULL }; MY_LOCALE my_locale_eu_ES= - { "eu_ES", "Basque - Basque", TRUE, &my_locale_typelib_month_names_eu_ES, &my_locale_typelib_ab_month_names_eu_ES, &my_locale_typelib_day_names_eu_ES, &my_locale_typelib_ab_day_names_eu_ES }; +{ + 19, + "eu_ES", + "Basque - Basque", + TRUE, + &my_locale_typelib_month_names_eu_ES, + &my_locale_typelib_ab_month_names_eu_ES, + &my_locale_typelib_day_names_eu_ES, + &my_locale_typelib_ab_day_names_eu_ES +}; /***** LOCALE END eu_ES *****/ /***** LOCALE BEGIN fi_FI: Finnish - Finland *****/ @@ -389,7 +522,16 @@ static TYPELIB my_locale_typelib_day_names_fi_FI = static TYPELIB my_locale_typelib_ab_day_names_fi_FI = { array_elements(my_locale_ab_day_names_fi_FI)-1, "", my_locale_ab_day_names_fi_FI, NULL }; MY_LOCALE my_locale_fi_FI= - { "fi_FI", "Finnish - Finland", FALSE, &my_locale_typelib_month_names_fi_FI, &my_locale_typelib_ab_month_names_fi_FI, &my_locale_typelib_day_names_fi_FI, &my_locale_typelib_ab_day_names_fi_FI }; +{ + 20, + "fi_FI", + "Finnish - Finland", + FALSE, + &my_locale_typelib_month_names_fi_FI, + &my_locale_typelib_ab_month_names_fi_FI, + &my_locale_typelib_day_names_fi_FI, + &my_locale_typelib_ab_day_names_fi_FI +}; /***** LOCALE END fi_FI *****/ /***** LOCALE BEGIN fo_FO: Faroese - Faroe Islands *****/ @@ -410,7 +552,16 @@ static TYPELIB my_locale_typelib_day_names_fo_FO = static TYPELIB my_locale_typelib_ab_day_names_fo_FO = { array_elements(my_locale_ab_day_names_fo_FO)-1, "", my_locale_ab_day_names_fo_FO, NULL }; MY_LOCALE my_locale_fo_FO= - { "fo_FO", "Faroese - Faroe Islands", FALSE, &my_locale_typelib_month_names_fo_FO, &my_locale_typelib_ab_month_names_fo_FO, &my_locale_typelib_day_names_fo_FO, &my_locale_typelib_ab_day_names_fo_FO }; +{ + 21, + "fo_FO", + "Faroese - Faroe Islands", + FALSE, + &my_locale_typelib_month_names_fo_FO, + &my_locale_typelib_ab_month_names_fo_FO, + &my_locale_typelib_day_names_fo_FO, + &my_locale_typelib_ab_day_names_fo_FO +}; /***** LOCALE END fo_FO *****/ /***** LOCALE BEGIN fr_FR: French - France *****/ @@ -431,7 +582,16 @@ static TYPELIB my_locale_typelib_day_names_fr_FR = static TYPELIB my_locale_typelib_ab_day_names_fr_FR = { array_elements(my_locale_ab_day_names_fr_FR)-1, "", my_locale_ab_day_names_fr_FR, NULL }; MY_LOCALE my_locale_fr_FR= - { "fr_FR", "French - France", FALSE, &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR }; +{ + 5, + "fr_FR", + "French - France", + FALSE, + &my_locale_typelib_month_names_fr_FR, + &my_locale_typelib_ab_month_names_fr_FR, + &my_locale_typelib_day_names_fr_FR, + &my_locale_typelib_ab_day_names_fr_FR +}; /***** LOCALE END fr_FR *****/ /***** LOCALE BEGIN gl_ES: Galician - Galician *****/ @@ -452,7 +612,16 @@ static TYPELIB my_locale_typelib_day_names_gl_ES = static TYPELIB my_locale_typelib_ab_day_names_gl_ES = { array_elements(my_locale_ab_day_names_gl_ES)-1, "", my_locale_ab_day_names_gl_ES, NULL }; MY_LOCALE my_locale_gl_ES= - { "gl_ES", "Galician - Galician", FALSE, &my_locale_typelib_month_names_gl_ES, &my_locale_typelib_ab_month_names_gl_ES, &my_locale_typelib_day_names_gl_ES, &my_locale_typelib_ab_day_names_gl_ES }; +{ + 22, + "gl_ES", + "Galician - Galician", + FALSE, + &my_locale_typelib_month_names_gl_ES, + &my_locale_typelib_ab_month_names_gl_ES, + &my_locale_typelib_day_names_gl_ES, + &my_locale_typelib_ab_day_names_gl_ES +}; /***** LOCALE END gl_ES *****/ /***** LOCALE BEGIN gu_IN: Gujarati - India *****/ @@ -473,7 +642,16 @@ static TYPELIB my_locale_typelib_day_names_gu_IN = static TYPELIB my_locale_typelib_ab_day_names_gu_IN = { array_elements(my_locale_ab_day_names_gu_IN)-1, "", my_locale_ab_day_names_gu_IN, NULL }; MY_LOCALE my_locale_gu_IN= - { "gu_IN", "Gujarati - India", FALSE, &my_locale_typelib_month_names_gu_IN, &my_locale_typelib_ab_month_names_gu_IN, &my_locale_typelib_day_names_gu_IN, &my_locale_typelib_ab_day_names_gu_IN }; +{ + 23, + "gu_IN", + "Gujarati - India", + FALSE, + &my_locale_typelib_month_names_gu_IN, + &my_locale_typelib_ab_month_names_gu_IN, + &my_locale_typelib_day_names_gu_IN, + &my_locale_typelib_ab_day_names_gu_IN +}; /***** LOCALE END gu_IN *****/ /***** LOCALE BEGIN he_IL: Hebrew - Israel *****/ @@ -494,7 +672,16 @@ static TYPELIB my_locale_typelib_day_names_he_IL = static TYPELIB my_locale_typelib_ab_day_names_he_IL = { array_elements(my_locale_ab_day_names_he_IL)-1, "", my_locale_ab_day_names_he_IL, NULL }; MY_LOCALE my_locale_he_IL= - { "he_IL", "Hebrew - Israel", FALSE, &my_locale_typelib_month_names_he_IL, &my_locale_typelib_ab_month_names_he_IL, &my_locale_typelib_day_names_he_IL, &my_locale_typelib_ab_day_names_he_IL }; +{ + 24, + "he_IL", + "Hebrew - Israel", + FALSE, + &my_locale_typelib_month_names_he_IL, + &my_locale_typelib_ab_month_names_he_IL, + &my_locale_typelib_day_names_he_IL, + &my_locale_typelib_ab_day_names_he_IL +}; /***** LOCALE END he_IL *****/ /***** LOCALE BEGIN hi_IN: Hindi - India *****/ @@ -515,7 +702,16 @@ static TYPELIB my_locale_typelib_day_names_hi_IN = static TYPELIB my_locale_typelib_ab_day_names_hi_IN = { array_elements(my_locale_ab_day_names_hi_IN)-1, "", my_locale_ab_day_names_hi_IN, NULL }; MY_LOCALE my_locale_hi_IN= - { "hi_IN", "Hindi - India", FALSE, &my_locale_typelib_month_names_hi_IN, &my_locale_typelib_ab_month_names_hi_IN, &my_locale_typelib_day_names_hi_IN, &my_locale_typelib_ab_day_names_hi_IN }; +{ + 25, + "hi_IN", + "Hindi - India", + FALSE, + &my_locale_typelib_month_names_hi_IN, + &my_locale_typelib_ab_month_names_hi_IN, + &my_locale_typelib_day_names_hi_IN, + &my_locale_typelib_ab_day_names_hi_IN +}; /***** LOCALE END hi_IN *****/ /***** LOCALE BEGIN hr_HR: Croatian - Croatia *****/ @@ -536,7 +732,16 @@ static TYPELIB my_locale_typelib_day_names_hr_HR = static TYPELIB my_locale_typelib_ab_day_names_hr_HR = { array_elements(my_locale_ab_day_names_hr_HR)-1, "", my_locale_ab_day_names_hr_HR, NULL }; MY_LOCALE my_locale_hr_HR= - { "hr_HR", "Croatian - Croatia", FALSE, &my_locale_typelib_month_names_hr_HR, &my_locale_typelib_ab_month_names_hr_HR, &my_locale_typelib_day_names_hr_HR, &my_locale_typelib_ab_day_names_hr_HR }; +{ + 26, + "hr_HR", + "Croatian - Croatia", + FALSE, + &my_locale_typelib_month_names_hr_HR, + &my_locale_typelib_ab_month_names_hr_HR, + &my_locale_typelib_day_names_hr_HR, + &my_locale_typelib_ab_day_names_hr_HR +}; /***** LOCALE END hr_HR *****/ /***** LOCALE BEGIN hu_HU: Hungarian - Hungary *****/ @@ -557,7 +762,16 @@ static TYPELIB my_locale_typelib_day_names_hu_HU = static TYPELIB my_locale_typelib_ab_day_names_hu_HU = { array_elements(my_locale_ab_day_names_hu_HU)-1, "", my_locale_ab_day_names_hu_HU, NULL }; MY_LOCALE my_locale_hu_HU= - { "hu_HU", "Hungarian - Hungary", FALSE, &my_locale_typelib_month_names_hu_HU, &my_locale_typelib_ab_month_names_hu_HU, &my_locale_typelib_day_names_hu_HU, &my_locale_typelib_ab_day_names_hu_HU }; +{ + 27, + "hu_HU", + "Hungarian - Hungary", + FALSE, + &my_locale_typelib_month_names_hu_HU, + &my_locale_typelib_ab_month_names_hu_HU, + &my_locale_typelib_day_names_hu_HU, + &my_locale_typelib_ab_day_names_hu_HU +}; /***** LOCALE END hu_HU *****/ /***** LOCALE BEGIN id_ID: Indonesian - Indonesia *****/ @@ -578,7 +792,16 @@ static TYPELIB my_locale_typelib_day_names_id_ID = static TYPELIB my_locale_typelib_ab_day_names_id_ID = { array_elements(my_locale_ab_day_names_id_ID)-1, "", my_locale_ab_day_names_id_ID, NULL }; MY_LOCALE my_locale_id_ID= - { "id_ID", "Indonesian - Indonesia", TRUE, &my_locale_typelib_month_names_id_ID, &my_locale_typelib_ab_month_names_id_ID, &my_locale_typelib_day_names_id_ID, &my_locale_typelib_ab_day_names_id_ID }; +{ + 28, + "id_ID", + "Indonesian - Indonesia", + TRUE, + &my_locale_typelib_month_names_id_ID, + &my_locale_typelib_ab_month_names_id_ID, + &my_locale_typelib_day_names_id_ID, + &my_locale_typelib_ab_day_names_id_ID +}; /***** LOCALE END id_ID *****/ /***** LOCALE BEGIN is_IS: Icelandic - Iceland *****/ @@ -599,7 +822,16 @@ static TYPELIB my_locale_typelib_day_names_is_IS = static TYPELIB my_locale_typelib_ab_day_names_is_IS = { array_elements(my_locale_ab_day_names_is_IS)-1, "", my_locale_ab_day_names_is_IS, NULL }; MY_LOCALE my_locale_is_IS= - { "is_IS", "Icelandic - Iceland", FALSE, &my_locale_typelib_month_names_is_IS, &my_locale_typelib_ab_month_names_is_IS, &my_locale_typelib_day_names_is_IS, &my_locale_typelib_ab_day_names_is_IS }; +{ + 29, + "is_IS", + "Icelandic - Iceland", + FALSE, + &my_locale_typelib_month_names_is_IS, + &my_locale_typelib_ab_month_names_is_IS, + &my_locale_typelib_day_names_is_IS, + &my_locale_typelib_ab_day_names_is_IS +}; /***** LOCALE END is_IS *****/ /***** LOCALE BEGIN it_CH: Italian - Switzerland *****/ @@ -620,7 +852,16 @@ static TYPELIB my_locale_typelib_day_names_it_CH = static TYPELIB my_locale_typelib_ab_day_names_it_CH = { array_elements(my_locale_ab_day_names_it_CH)-1, "", my_locale_ab_day_names_it_CH, NULL }; MY_LOCALE my_locale_it_CH= - { "it_CH", "Italian - Switzerland", FALSE, &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, &my_locale_typelib_ab_day_names_it_CH }; +{ + 30, + "it_CH", + "Italian - Switzerland", + FALSE, + &my_locale_typelib_month_names_it_CH, + &my_locale_typelib_ab_month_names_it_CH, + &my_locale_typelib_day_names_it_CH, + &my_locale_typelib_ab_day_names_it_CH +}; /***** LOCALE END it_CH *****/ /***** LOCALE BEGIN ja_JP: Japanese - Japan *****/ @@ -641,7 +882,16 @@ static TYPELIB my_locale_typelib_day_names_ja_JP = static TYPELIB my_locale_typelib_ab_day_names_ja_JP = { array_elements(my_locale_ab_day_names_ja_JP)-1, "", my_locale_ab_day_names_ja_JP, NULL }; MY_LOCALE my_locale_ja_JP= - { "ja_JP", "Japanese - Japan", FALSE, &my_locale_typelib_month_names_ja_JP, &my_locale_typelib_ab_month_names_ja_JP, &my_locale_typelib_day_names_ja_JP, &my_locale_typelib_ab_day_names_ja_JP }; +{ + 2, + "ja_JP", + "Japanese - Japan", + FALSE, + &my_locale_typelib_month_names_ja_JP, + &my_locale_typelib_ab_month_names_ja_JP, + &my_locale_typelib_day_names_ja_JP, + &my_locale_typelib_ab_day_names_ja_JP +}; /***** LOCALE END ja_JP *****/ /***** LOCALE BEGIN ko_KR: Korean - Korea *****/ @@ -662,7 +912,16 @@ static TYPELIB my_locale_typelib_day_names_ko_KR = static TYPELIB my_locale_typelib_ab_day_names_ko_KR = { array_elements(my_locale_ab_day_names_ko_KR)-1, "", my_locale_ab_day_names_ko_KR, NULL }; MY_LOCALE my_locale_ko_KR= - { "ko_KR", "Korean - Korea", FALSE, &my_locale_typelib_month_names_ko_KR, &my_locale_typelib_ab_month_names_ko_KR, &my_locale_typelib_day_names_ko_KR, &my_locale_typelib_ab_day_names_ko_KR }; +{ + 31, + "ko_KR", + "Korean - Korea", + FALSE, + &my_locale_typelib_month_names_ko_KR, + &my_locale_typelib_ab_month_names_ko_KR, + &my_locale_typelib_day_names_ko_KR, + &my_locale_typelib_ab_day_names_ko_KR +}; /***** LOCALE END ko_KR *****/ /***** LOCALE BEGIN lt_LT: Lithuanian - Lithuania *****/ @@ -683,7 +942,16 @@ static TYPELIB my_locale_typelib_day_names_lt_LT = static TYPELIB my_locale_typelib_ab_day_names_lt_LT = { array_elements(my_locale_ab_day_names_lt_LT)-1, "", my_locale_ab_day_names_lt_LT, NULL }; MY_LOCALE my_locale_lt_LT= - { "lt_LT", "Lithuanian - Lithuania", FALSE, &my_locale_typelib_month_names_lt_LT, &my_locale_typelib_ab_month_names_lt_LT, &my_locale_typelib_day_names_lt_LT, &my_locale_typelib_ab_day_names_lt_LT }; +{ + 32, + "lt_LT", + "Lithuanian - Lithuania", + FALSE, + &my_locale_typelib_month_names_lt_LT, + &my_locale_typelib_ab_month_names_lt_LT, + &my_locale_typelib_day_names_lt_LT, + &my_locale_typelib_ab_day_names_lt_LT +}; /***** LOCALE END lt_LT *****/ /***** LOCALE BEGIN lv_LV: Latvian - Latvia *****/ @@ -704,7 +972,16 @@ static TYPELIB my_locale_typelib_day_names_lv_LV = static TYPELIB my_locale_typelib_ab_day_names_lv_LV = { array_elements(my_locale_ab_day_names_lv_LV)-1, "", my_locale_ab_day_names_lv_LV, NULL }; MY_LOCALE my_locale_lv_LV= - { "lv_LV", "Latvian - Latvia", FALSE, &my_locale_typelib_month_names_lv_LV, &my_locale_typelib_ab_month_names_lv_LV, &my_locale_typelib_day_names_lv_LV, &my_locale_typelib_ab_day_names_lv_LV }; +{ + 33, + "lv_LV", + "Latvian - Latvia", + FALSE, + &my_locale_typelib_month_names_lv_LV, + &my_locale_typelib_ab_month_names_lv_LV, + &my_locale_typelib_day_names_lv_LV, + &my_locale_typelib_ab_day_names_lv_LV +}; /***** LOCALE END lv_LV *****/ /***** LOCALE BEGIN mk_MK: Macedonian - FYROM *****/ @@ -725,7 +1002,16 @@ static TYPELIB my_locale_typelib_day_names_mk_MK = static TYPELIB my_locale_typelib_ab_day_names_mk_MK = { array_elements(my_locale_ab_day_names_mk_MK)-1, "", my_locale_ab_day_names_mk_MK, NULL }; MY_LOCALE my_locale_mk_MK= - { "mk_MK", "Macedonian - FYROM", FALSE, &my_locale_typelib_month_names_mk_MK, &my_locale_typelib_ab_month_names_mk_MK, &my_locale_typelib_day_names_mk_MK, &my_locale_typelib_ab_day_names_mk_MK }; +{ + 34, + "mk_MK", + "Macedonian - FYROM", + FALSE, + &my_locale_typelib_month_names_mk_MK, + &my_locale_typelib_ab_month_names_mk_MK, + &my_locale_typelib_day_names_mk_MK, + &my_locale_typelib_ab_day_names_mk_MK +}; /***** LOCALE END mk_MK *****/ /***** LOCALE BEGIN mn_MN: Mongolia - Mongolian *****/ @@ -746,7 +1032,16 @@ static TYPELIB my_locale_typelib_day_names_mn_MN = static TYPELIB my_locale_typelib_ab_day_names_mn_MN = { array_elements(my_locale_ab_day_names_mn_MN)-1, "", my_locale_ab_day_names_mn_MN, NULL }; MY_LOCALE my_locale_mn_MN= - { "mn_MN", "Mongolia - Mongolian", FALSE, &my_locale_typelib_month_names_mn_MN, &my_locale_typelib_ab_month_names_mn_MN, &my_locale_typelib_day_names_mn_MN, &my_locale_typelib_ab_day_names_mn_MN }; +{ + 35, + "mn_MN", + "Mongolia - Mongolian", + FALSE, + &my_locale_typelib_month_names_mn_MN, + &my_locale_typelib_ab_month_names_mn_MN, + &my_locale_typelib_day_names_mn_MN, + &my_locale_typelib_ab_day_names_mn_MN +}; /***** LOCALE END mn_MN *****/ /***** LOCALE BEGIN ms_MY: Malay - Malaysia *****/ @@ -767,7 +1062,16 @@ static TYPELIB my_locale_typelib_day_names_ms_MY = static TYPELIB my_locale_typelib_ab_day_names_ms_MY = { array_elements(my_locale_ab_day_names_ms_MY)-1, "", my_locale_ab_day_names_ms_MY, NULL }; MY_LOCALE my_locale_ms_MY= - { "ms_MY", "Malay - Malaysia", TRUE, &my_locale_typelib_month_names_ms_MY, &my_locale_typelib_ab_month_names_ms_MY, &my_locale_typelib_day_names_ms_MY, &my_locale_typelib_ab_day_names_ms_MY }; +{ + 36, + "ms_MY", + "Malay - Malaysia", + TRUE, + &my_locale_typelib_month_names_ms_MY, + &my_locale_typelib_ab_month_names_ms_MY, + &my_locale_typelib_day_names_ms_MY, + &my_locale_typelib_ab_day_names_ms_MY +}; /***** LOCALE END ms_MY *****/ /***** LOCALE BEGIN nb_NO: Norwegian(Bokml) - Norway *****/ @@ -788,7 +1092,16 @@ static TYPELIB my_locale_typelib_day_names_nb_NO = static TYPELIB my_locale_typelib_ab_day_names_nb_NO = { array_elements(my_locale_ab_day_names_nb_NO)-1, "", my_locale_ab_day_names_nb_NO, NULL }; MY_LOCALE my_locale_nb_NO= - { "nb_NO", "Norwegian(Bokml) - Norway", FALSE, &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, &my_locale_typelib_ab_day_names_nb_NO }; +{ + 37, + "nb_NO", + "Norwegian(Bokml) - Norway", + FALSE, + &my_locale_typelib_month_names_nb_NO, + &my_locale_typelib_ab_month_names_nb_NO, + &my_locale_typelib_day_names_nb_NO, + &my_locale_typelib_ab_day_names_nb_NO +}; /***** LOCALE END nb_NO *****/ /***** LOCALE BEGIN nl_NL: Dutch - The Netherlands *****/ @@ -809,7 +1122,16 @@ static TYPELIB my_locale_typelib_day_names_nl_NL = static TYPELIB my_locale_typelib_ab_day_names_nl_NL = { array_elements(my_locale_ab_day_names_nl_NL)-1, "", my_locale_ab_day_names_nl_NL, NULL }; MY_LOCALE my_locale_nl_NL= - { "nl_NL", "Dutch - The Netherlands", TRUE, &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, &my_locale_typelib_ab_day_names_nl_NL }; +{ + 38, + "nl_NL", + "Dutch - The Netherlands", + TRUE, + &my_locale_typelib_month_names_nl_NL, + &my_locale_typelib_ab_month_names_nl_NL, + &my_locale_typelib_day_names_nl_NL, + &my_locale_typelib_ab_day_names_nl_NL +}; /***** LOCALE END nl_NL *****/ /***** LOCALE BEGIN pl_PL: Polish - Poland *****/ @@ -830,7 +1152,16 @@ static TYPELIB my_locale_typelib_day_names_pl_PL = static TYPELIB my_locale_typelib_ab_day_names_pl_PL = { array_elements(my_locale_ab_day_names_pl_PL)-1, "", my_locale_ab_day_names_pl_PL, NULL }; MY_LOCALE my_locale_pl_PL= - { "pl_PL", "Polish - Poland", FALSE, &my_locale_typelib_month_names_pl_PL, &my_locale_typelib_ab_month_names_pl_PL, &my_locale_typelib_day_names_pl_PL, &my_locale_typelib_ab_day_names_pl_PL }; +{ + 39, + "pl_PL", + "Polish - Poland", + FALSE, + &my_locale_typelib_month_names_pl_PL, + &my_locale_typelib_ab_month_names_pl_PL, + &my_locale_typelib_day_names_pl_PL, + &my_locale_typelib_ab_day_names_pl_PL +}; /***** LOCALE END pl_PL *****/ /***** LOCALE BEGIN pt_BR: Portugese - Brazil *****/ @@ -851,7 +1182,16 @@ static TYPELIB my_locale_typelib_day_names_pt_BR = static TYPELIB my_locale_typelib_ab_day_names_pt_BR = { array_elements(my_locale_ab_day_names_pt_BR)-1, "", my_locale_ab_day_names_pt_BR, NULL }; MY_LOCALE my_locale_pt_BR= - { "pt_BR", "Portugese - Brazil", FALSE, &my_locale_typelib_month_names_pt_BR, &my_locale_typelib_ab_month_names_pt_BR, &my_locale_typelib_day_names_pt_BR, &my_locale_typelib_ab_day_names_pt_BR }; +{ + 40, + "pt_BR", + "Portugese - Brazil", + FALSE, + &my_locale_typelib_month_names_pt_BR, + &my_locale_typelib_ab_month_names_pt_BR, + &my_locale_typelib_day_names_pt_BR, + &my_locale_typelib_ab_day_names_pt_BR +}; /***** LOCALE END pt_BR *****/ /***** LOCALE BEGIN pt_PT: Portugese - Portugal *****/ @@ -872,7 +1212,16 @@ static TYPELIB my_locale_typelib_day_names_pt_PT = static TYPELIB my_locale_typelib_ab_day_names_pt_PT = { array_elements(my_locale_ab_day_names_pt_PT)-1, "", my_locale_ab_day_names_pt_PT, NULL }; MY_LOCALE my_locale_pt_PT= - { "pt_PT", "Portugese - Portugal", FALSE, &my_locale_typelib_month_names_pt_PT, &my_locale_typelib_ab_month_names_pt_PT, &my_locale_typelib_day_names_pt_PT, &my_locale_typelib_ab_day_names_pt_PT }; +{ + 41, + "pt_PT", + "Portugese - Portugal", + FALSE, + &my_locale_typelib_month_names_pt_PT, + &my_locale_typelib_ab_month_names_pt_PT, + &my_locale_typelib_day_names_pt_PT, + &my_locale_typelib_ab_day_names_pt_PT +}; /***** LOCALE END pt_PT *****/ /***** LOCALE BEGIN ro_RO: Romanian - Romania *****/ @@ -893,7 +1242,16 @@ static TYPELIB my_locale_typelib_day_names_ro_RO = static TYPELIB my_locale_typelib_ab_day_names_ro_RO = { array_elements(my_locale_ab_day_names_ro_RO)-1, "", my_locale_ab_day_names_ro_RO, NULL }; MY_LOCALE my_locale_ro_RO= - { "ro_RO", "Romanian - Romania", FALSE, &my_locale_typelib_month_names_ro_RO, &my_locale_typelib_ab_month_names_ro_RO, &my_locale_typelib_day_names_ro_RO, &my_locale_typelib_ab_day_names_ro_RO }; +{ + 42, + "ro_RO", + "Romanian - Romania", + FALSE, + &my_locale_typelib_month_names_ro_RO, + &my_locale_typelib_ab_month_names_ro_RO, + &my_locale_typelib_day_names_ro_RO, + &my_locale_typelib_ab_day_names_ro_RO +}; /***** LOCALE END ro_RO *****/ /***** LOCALE BEGIN ru_RU: Russian - Russia *****/ @@ -914,7 +1272,16 @@ static TYPELIB my_locale_typelib_day_names_ru_RU = static TYPELIB my_locale_typelib_ab_day_names_ru_RU = { array_elements(my_locale_ab_day_names_ru_RU)-1, "", my_locale_ab_day_names_ru_RU, NULL }; MY_LOCALE my_locale_ru_RU= - { "ru_RU", "Russian - Russia", FALSE, &my_locale_typelib_month_names_ru_RU, &my_locale_typelib_ab_month_names_ru_RU, &my_locale_typelib_day_names_ru_RU, &my_locale_typelib_ab_day_names_ru_RU }; +{ + 43, + "ru_RU", + "Russian - Russia", + FALSE, + &my_locale_typelib_month_names_ru_RU, + &my_locale_typelib_ab_month_names_ru_RU, + &my_locale_typelib_day_names_ru_RU, + &my_locale_typelib_ab_day_names_ru_RU +}; /***** LOCALE END ru_RU *****/ /***** LOCALE BEGIN ru_UA: Russian - Ukraine *****/ @@ -935,7 +1302,16 @@ static TYPELIB my_locale_typelib_day_names_ru_UA = static TYPELIB my_locale_typelib_ab_day_names_ru_UA = { array_elements(my_locale_ab_day_names_ru_UA)-1, "", my_locale_ab_day_names_ru_UA, NULL }; MY_LOCALE my_locale_ru_UA= - { "ru_UA", "Russian - Ukraine", FALSE, &my_locale_typelib_month_names_ru_UA, &my_locale_typelib_ab_month_names_ru_UA, &my_locale_typelib_day_names_ru_UA, &my_locale_typelib_ab_day_names_ru_UA }; +{ + 44, + "ru_UA", + "Russian - Ukraine", + FALSE, + &my_locale_typelib_month_names_ru_UA, + &my_locale_typelib_ab_month_names_ru_UA, + &my_locale_typelib_day_names_ru_UA, + &my_locale_typelib_ab_day_names_ru_UA +}; /***** LOCALE END ru_UA *****/ /***** LOCALE BEGIN sk_SK: Slovak - Slovakia *****/ @@ -956,7 +1332,16 @@ static TYPELIB my_locale_typelib_day_names_sk_SK = static TYPELIB my_locale_typelib_ab_day_names_sk_SK = { array_elements(my_locale_ab_day_names_sk_SK)-1, "", my_locale_ab_day_names_sk_SK, NULL }; MY_LOCALE my_locale_sk_SK= - { "sk_SK", "Slovak - Slovakia", FALSE, &my_locale_typelib_month_names_sk_SK, &my_locale_typelib_ab_month_names_sk_SK, &my_locale_typelib_day_names_sk_SK, &my_locale_typelib_ab_day_names_sk_SK }; +{ + 45, + "sk_SK", + "Slovak - Slovakia", + FALSE, + &my_locale_typelib_month_names_sk_SK, + &my_locale_typelib_ab_month_names_sk_SK, + &my_locale_typelib_day_names_sk_SK, + &my_locale_typelib_ab_day_names_sk_SK +}; /***** LOCALE END sk_SK *****/ /***** LOCALE BEGIN sl_SI: Slovenian - Slovenia *****/ @@ -977,7 +1362,16 @@ static TYPELIB my_locale_typelib_day_names_sl_SI = static TYPELIB my_locale_typelib_ab_day_names_sl_SI = { array_elements(my_locale_ab_day_names_sl_SI)-1, "", my_locale_ab_day_names_sl_SI, NULL }; MY_LOCALE my_locale_sl_SI= - { "sl_SI", "Slovenian - Slovenia", FALSE, &my_locale_typelib_month_names_sl_SI, &my_locale_typelib_ab_month_names_sl_SI, &my_locale_typelib_day_names_sl_SI, &my_locale_typelib_ab_day_names_sl_SI }; +{ + 46, + "sl_SI", + "Slovenian - Slovenia", + FALSE, + &my_locale_typelib_month_names_sl_SI, + &my_locale_typelib_ab_month_names_sl_SI, + &my_locale_typelib_day_names_sl_SI, + &my_locale_typelib_ab_day_names_sl_SI +}; /***** LOCALE END sl_SI *****/ /***** LOCALE BEGIN sq_AL: Albanian - Albania *****/ @@ -998,7 +1392,16 @@ static TYPELIB my_locale_typelib_day_names_sq_AL = static TYPELIB my_locale_typelib_ab_day_names_sq_AL = { array_elements(my_locale_ab_day_names_sq_AL)-1, "", my_locale_ab_day_names_sq_AL, NULL }; MY_LOCALE my_locale_sq_AL= - { "sq_AL", "Albanian - Albania", FALSE, &my_locale_typelib_month_names_sq_AL, &my_locale_typelib_ab_month_names_sq_AL, &my_locale_typelib_day_names_sq_AL, &my_locale_typelib_ab_day_names_sq_AL }; +{ + 47, + "sq_AL", + "Albanian - Albania", + FALSE, + &my_locale_typelib_month_names_sq_AL, + &my_locale_typelib_ab_month_names_sq_AL, + &my_locale_typelib_day_names_sq_AL, + &my_locale_typelib_ab_day_names_sq_AL +}; /***** LOCALE END sq_AL *****/ /***** LOCALE BEGIN sr_YU: Servian - Yugoslavia *****/ @@ -1019,7 +1422,16 @@ static TYPELIB my_locale_typelib_day_names_sr_YU = static TYPELIB my_locale_typelib_ab_day_names_sr_YU = { array_elements(my_locale_ab_day_names_sr_YU)-1, "", my_locale_ab_day_names_sr_YU, NULL }; MY_LOCALE my_locale_sr_YU= - { "sr_YU", "Servian - Yugoslavia", FALSE, &my_locale_typelib_month_names_sr_YU, &my_locale_typelib_ab_month_names_sr_YU, &my_locale_typelib_day_names_sr_YU, &my_locale_typelib_ab_day_names_sr_YU }; +{ + 48, + "sr_YU", + "Servian - Yugoslavia", + FALSE, + &my_locale_typelib_month_names_sr_YU, + &my_locale_typelib_ab_month_names_sr_YU, + &my_locale_typelib_day_names_sr_YU, + &my_locale_typelib_ab_day_names_sr_YU +}; /***** LOCALE END sr_YU *****/ /***** LOCALE BEGIN sv_SE: Swedish - Sweden *****/ @@ -1040,7 +1452,16 @@ static TYPELIB my_locale_typelib_day_names_sv_SE = static TYPELIB my_locale_typelib_ab_day_names_sv_SE = { array_elements(my_locale_ab_day_names_sv_SE)-1, "", my_locale_ab_day_names_sv_SE, NULL }; MY_LOCALE my_locale_sv_SE= - { "sv_SE", "Swedish - Sweden", FALSE, &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, &my_locale_typelib_ab_day_names_sv_SE }; +{ + 3, + "sv_SE", + "Swedish - Sweden", + FALSE, + &my_locale_typelib_month_names_sv_SE, + &my_locale_typelib_ab_month_names_sv_SE, + &my_locale_typelib_day_names_sv_SE, + &my_locale_typelib_ab_day_names_sv_SE +}; /***** LOCALE END sv_SE *****/ /***** LOCALE BEGIN ta_IN: Tamil - India *****/ @@ -1061,7 +1482,16 @@ static TYPELIB my_locale_typelib_day_names_ta_IN = static TYPELIB my_locale_typelib_ab_day_names_ta_IN = { array_elements(my_locale_ab_day_names_ta_IN)-1, "", my_locale_ab_day_names_ta_IN, NULL }; MY_LOCALE my_locale_ta_IN= - { "ta_IN", "Tamil - India", FALSE, &my_locale_typelib_month_names_ta_IN, &my_locale_typelib_ab_month_names_ta_IN, &my_locale_typelib_day_names_ta_IN, &my_locale_typelib_ab_day_names_ta_IN }; +{ + 49, + "ta_IN", + "Tamil - India", + FALSE, + &my_locale_typelib_month_names_ta_IN, + &my_locale_typelib_ab_month_names_ta_IN, + &my_locale_typelib_day_names_ta_IN, + &my_locale_typelib_ab_day_names_ta_IN +}; /***** LOCALE END ta_IN *****/ /***** LOCALE BEGIN te_IN: Telugu - India *****/ @@ -1082,7 +1512,16 @@ static TYPELIB my_locale_typelib_day_names_te_IN = static TYPELIB my_locale_typelib_ab_day_names_te_IN = { array_elements(my_locale_ab_day_names_te_IN)-1, "", my_locale_ab_day_names_te_IN, NULL }; MY_LOCALE my_locale_te_IN= - { "te_IN", "Telugu - India", FALSE, &my_locale_typelib_month_names_te_IN, &my_locale_typelib_ab_month_names_te_IN, &my_locale_typelib_day_names_te_IN, &my_locale_typelib_ab_day_names_te_IN }; +{ + 50, + "te_IN", + "Telugu - India", + FALSE, + &my_locale_typelib_month_names_te_IN, + &my_locale_typelib_ab_month_names_te_IN, + &my_locale_typelib_day_names_te_IN, + &my_locale_typelib_ab_day_names_te_IN +}; /***** LOCALE END te_IN *****/ /***** LOCALE BEGIN th_TH: Thai - Thailand *****/ @@ -1103,7 +1542,16 @@ static TYPELIB my_locale_typelib_day_names_th_TH = static TYPELIB my_locale_typelib_ab_day_names_th_TH = { array_elements(my_locale_ab_day_names_th_TH)-1, "", my_locale_ab_day_names_th_TH, NULL }; MY_LOCALE my_locale_th_TH= - { "th_TH", "Thai - Thailand", FALSE, &my_locale_typelib_month_names_th_TH, &my_locale_typelib_ab_month_names_th_TH, &my_locale_typelib_day_names_th_TH, &my_locale_typelib_ab_day_names_th_TH }; +{ + 51, + "th_TH", + "Thai - Thailand", + FALSE, + &my_locale_typelib_month_names_th_TH, + &my_locale_typelib_ab_month_names_th_TH, + &my_locale_typelib_day_names_th_TH, + &my_locale_typelib_ab_day_names_th_TH +}; /***** LOCALE END th_TH *****/ /***** LOCALE BEGIN tr_TR: Turkish - Turkey *****/ @@ -1124,7 +1572,16 @@ static TYPELIB my_locale_typelib_day_names_tr_TR = static TYPELIB my_locale_typelib_ab_day_names_tr_TR = { array_elements(my_locale_ab_day_names_tr_TR)-1, "", my_locale_ab_day_names_tr_TR, NULL }; MY_LOCALE my_locale_tr_TR= - { "tr_TR", "Turkish - Turkey", FALSE, &my_locale_typelib_month_names_tr_TR, &my_locale_typelib_ab_month_names_tr_TR, &my_locale_typelib_day_names_tr_TR, &my_locale_typelib_ab_day_names_tr_TR }; +{ + 52, + "tr_TR", + "Turkish - Turkey", + FALSE, + &my_locale_typelib_month_names_tr_TR, + &my_locale_typelib_ab_month_names_tr_TR, + &my_locale_typelib_day_names_tr_TR, + &my_locale_typelib_ab_day_names_tr_TR +}; /***** LOCALE END tr_TR *****/ /***** LOCALE BEGIN uk_UA: Ukrainian - Ukraine *****/ @@ -1145,7 +1602,16 @@ static TYPELIB my_locale_typelib_day_names_uk_UA = static TYPELIB my_locale_typelib_ab_day_names_uk_UA = { array_elements(my_locale_ab_day_names_uk_UA)-1, "", my_locale_ab_day_names_uk_UA, NULL }; MY_LOCALE my_locale_uk_UA= - { "uk_UA", "Ukrainian - Ukraine", FALSE, &my_locale_typelib_month_names_uk_UA, &my_locale_typelib_ab_month_names_uk_UA, &my_locale_typelib_day_names_uk_UA, &my_locale_typelib_ab_day_names_uk_UA }; +{ + 53, + "uk_UA", + "Ukrainian - Ukraine", + FALSE, + &my_locale_typelib_month_names_uk_UA, + &my_locale_typelib_ab_month_names_uk_UA, + &my_locale_typelib_day_names_uk_UA, + &my_locale_typelib_ab_day_names_uk_UA +}; /***** LOCALE END uk_UA *****/ /***** LOCALE BEGIN ur_PK: Urdu - Pakistan *****/ @@ -1166,7 +1632,16 @@ static TYPELIB my_locale_typelib_day_names_ur_PK = static TYPELIB my_locale_typelib_ab_day_names_ur_PK = { array_elements(my_locale_ab_day_names_ur_PK)-1, "", my_locale_ab_day_names_ur_PK, NULL }; MY_LOCALE my_locale_ur_PK= - { "ur_PK", "Urdu - Pakistan", FALSE, &my_locale_typelib_month_names_ur_PK, &my_locale_typelib_ab_month_names_ur_PK, &my_locale_typelib_day_names_ur_PK, &my_locale_typelib_ab_day_names_ur_PK }; +{ + 54, + "ur_PK", + "Urdu - Pakistan", + FALSE, + &my_locale_typelib_month_names_ur_PK, + &my_locale_typelib_ab_month_names_ur_PK, + &my_locale_typelib_day_names_ur_PK, + &my_locale_typelib_ab_day_names_ur_PK +}; /***** LOCALE END ur_PK *****/ /***** LOCALE BEGIN vi_VN: Vietnamese - Vietnam *****/ @@ -1187,7 +1662,16 @@ static TYPELIB my_locale_typelib_day_names_vi_VN = static TYPELIB my_locale_typelib_ab_day_names_vi_VN = { array_elements(my_locale_ab_day_names_vi_VN)-1, "", my_locale_ab_day_names_vi_VN, NULL }; MY_LOCALE my_locale_vi_VN= - { "vi_VN", "Vietnamese - Vietnam", FALSE, &my_locale_typelib_month_names_vi_VN, &my_locale_typelib_ab_month_names_vi_VN, &my_locale_typelib_day_names_vi_VN, &my_locale_typelib_ab_day_names_vi_VN }; +{ + 55, + "vi_VN", + "Vietnamese - Vietnam", + FALSE, + &my_locale_typelib_month_names_vi_VN, + &my_locale_typelib_ab_month_names_vi_VN, + &my_locale_typelib_day_names_vi_VN, + &my_locale_typelib_ab_day_names_vi_VN +}; /***** LOCALE END vi_VN *****/ /***** LOCALE BEGIN zh_CN: Chinese - Peoples Republic of China *****/ @@ -1208,7 +1692,16 @@ static TYPELIB my_locale_typelib_day_names_zh_CN = static TYPELIB my_locale_typelib_ab_day_names_zh_CN = { array_elements(my_locale_ab_day_names_zh_CN)-1, "", my_locale_ab_day_names_zh_CN, NULL }; MY_LOCALE my_locale_zh_CN= - { "zh_CN", "Chinese - Peoples Republic of China", FALSE, &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, &my_locale_typelib_ab_day_names_zh_CN }; +{ + 56, + "zh_CN", + "Chinese - Peoples Republic of China", + FALSE, + &my_locale_typelib_month_names_zh_CN, + &my_locale_typelib_ab_month_names_zh_CN, + &my_locale_typelib_day_names_zh_CN, + &my_locale_typelib_ab_day_names_zh_CN +}; /***** LOCALE END zh_CN *****/ /***** LOCALE BEGIN zh_TW: Chinese - Taiwan *****/ @@ -1229,269 +1722,753 @@ static TYPELIB my_locale_typelib_day_names_zh_TW = static TYPELIB my_locale_typelib_ab_day_names_zh_TW = { array_elements(my_locale_ab_day_names_zh_TW)-1, "", my_locale_ab_day_names_zh_TW, NULL }; MY_LOCALE my_locale_zh_TW= - { "zh_TW", "Chinese - Taiwan", FALSE, &my_locale_typelib_month_names_zh_TW, &my_locale_typelib_ab_month_names_zh_TW, &my_locale_typelib_day_names_zh_TW, &my_locale_typelib_ab_day_names_zh_TW }; +{ + 57, + "zh_TW", + "Chinese - Taiwan", + FALSE, + &my_locale_typelib_month_names_zh_TW, + &my_locale_typelib_ab_month_names_zh_TW, + &my_locale_typelib_day_names_zh_TW, + &my_locale_typelib_ab_day_names_zh_TW +}; /***** LOCALE END zh_TW *****/ /***** LOCALE BEGIN ar_DZ: Arabic - Algeria *****/ MY_LOCALE my_locale_ar_DZ= - { "ar_DZ", "Arabic - Algeria", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 58, + "ar_DZ", + "Arabic - Algeria", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_DZ *****/ /***** LOCALE BEGIN ar_EG: Arabic - Egypt *****/ MY_LOCALE my_locale_ar_EG= - { "ar_EG", "Arabic - Egypt", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 59, + "ar_EG", + "Arabic - Egypt", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_EG *****/ /***** LOCALE BEGIN ar_IN: Arabic - Iran *****/ MY_LOCALE my_locale_ar_IN= - { "ar_IN", "Arabic - Iran", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 60, + "ar_IN", + "Arabic - Iran", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_IN *****/ /***** LOCALE BEGIN ar_IQ: Arabic - Iraq *****/ MY_LOCALE my_locale_ar_IQ= - { "ar_IQ", "Arabic - Iraq", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 61, + "ar_IQ", + "Arabic - Iraq", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_IQ *****/ /***** LOCALE BEGIN ar_KW: Arabic - Kuwait *****/ MY_LOCALE my_locale_ar_KW= - { "ar_KW", "Arabic - Kuwait", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 62, + "ar_KW", + "Arabic - Kuwait", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_KW *****/ /***** LOCALE BEGIN ar_LB: Arabic - Lebanon *****/ MY_LOCALE my_locale_ar_LB= - { "ar_LB", "Arabic - Lebanon", FALSE, &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, &my_locale_typelib_ab_day_names_ar_JO }; +{ + 63, + "ar_LB", + "Arabic - Lebanon", + FALSE, + &my_locale_typelib_month_names_ar_JO, + &my_locale_typelib_ab_month_names_ar_JO, + &my_locale_typelib_day_names_ar_JO, + &my_locale_typelib_ab_day_names_ar_JO +}; /***** LOCALE END ar_LB *****/ /***** LOCALE BEGIN ar_LY: Arabic - Libya *****/ MY_LOCALE my_locale_ar_LY= - { "ar_LY", "Arabic - Libya", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 64, + "ar_LY", + "Arabic - Libya", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_LY *****/ /***** LOCALE BEGIN ar_MA: Arabic - Morocco *****/ MY_LOCALE my_locale_ar_MA= - { "ar_MA", "Arabic - Morocco", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 65, + "ar_MA", + "Arabic - Morocco", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_MA *****/ /***** LOCALE BEGIN ar_OM: Arabic - Oman *****/ MY_LOCALE my_locale_ar_OM= - { "ar_OM", "Arabic - Oman", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 66, + "ar_OM", + "Arabic - Oman", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_OM *****/ /***** LOCALE BEGIN ar_QA: Arabic - Qatar *****/ MY_LOCALE my_locale_ar_QA= - { "ar_QA", "Arabic - Qatar", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 67, + "ar_QA", + "Arabic - Qatar", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_QA *****/ /***** LOCALE BEGIN ar_SD: Arabic - Sudan *****/ MY_LOCALE my_locale_ar_SD= - { "ar_SD", "Arabic - Sudan", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 68, + "ar_SD", + "Arabic - Sudan", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_SD *****/ /***** LOCALE BEGIN ar_TN: Arabic - Tunisia *****/ MY_LOCALE my_locale_ar_TN= - { "ar_TN", "Arabic - Tunisia", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 69, + "ar_TN", + "Arabic - Tunisia", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_TN *****/ /***** LOCALE BEGIN ar_YE: Arabic - Yemen *****/ MY_LOCALE my_locale_ar_YE= - { "ar_YE", "Arabic - Yemen", FALSE, &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH }; +{ + 70, + "ar_YE", + "Arabic - Yemen", + FALSE, + &my_locale_typelib_month_names_ar_BH, + &my_locale_typelib_ab_month_names_ar_BH, + &my_locale_typelib_day_names_ar_BH, + &my_locale_typelib_ab_day_names_ar_BH +}; /***** LOCALE END ar_YE *****/ /***** LOCALE BEGIN de_BE: German - Belgium *****/ MY_LOCALE my_locale_de_BE= - { "de_BE", "German - Belgium", FALSE, &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE }; +{ + 71, + "de_BE", + "German - Belgium", + FALSE, + &my_locale_typelib_month_names_de_DE, + &my_locale_typelib_ab_month_names_de_DE, + &my_locale_typelib_day_names_de_DE, + &my_locale_typelib_ab_day_names_de_DE +}; /***** LOCALE END de_BE *****/ /***** LOCALE BEGIN de_CH: German - Switzerland *****/ MY_LOCALE my_locale_de_CH= - { "de_CH", "German - Switzerland", FALSE, &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE }; +{ + 72, + "de_CH", + "German - Switzerland", + FALSE, + &my_locale_typelib_month_names_de_DE, + &my_locale_typelib_ab_month_names_de_DE, + &my_locale_typelib_day_names_de_DE, + &my_locale_typelib_ab_day_names_de_DE +}; /***** LOCALE END de_CH *****/ /***** LOCALE BEGIN de_LU: German - Luxembourg *****/ MY_LOCALE my_locale_de_LU= - { "de_LU", "German - Luxembourg", FALSE, &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE }; +{ + 73, + "de_LU", + "German - Luxembourg", + FALSE, + &my_locale_typelib_month_names_de_DE, + &my_locale_typelib_ab_month_names_de_DE, + &my_locale_typelib_day_names_de_DE, + &my_locale_typelib_ab_day_names_de_DE +}; /***** LOCALE END de_LU *****/ /***** LOCALE BEGIN en_AU: English - Australia *****/ MY_LOCALE my_locale_en_AU= - { "en_AU", "English - Australia", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 74, + "en_AU", + "English - Australia", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_AU *****/ /***** LOCALE BEGIN en_CA: English - Canada *****/ MY_LOCALE my_locale_en_CA= - { "en_CA", "English - Canada", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 75, + "en_CA", + "English - Canada", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_CA *****/ /***** LOCALE BEGIN en_GB: English - United Kingdom *****/ MY_LOCALE my_locale_en_GB= - { "en_GB", "English - United Kingdom", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 1, + "en_GB", + "English - United Kingdom", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_GB *****/ /***** LOCALE BEGIN en_IN: English - India *****/ MY_LOCALE my_locale_en_IN= - { "en_IN", "English - India", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 76, + "en_IN", + "English - India", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_IN *****/ /***** LOCALE BEGIN en_NZ: English - New Zealand *****/ MY_LOCALE my_locale_en_NZ= - { "en_NZ", "English - New Zealand", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 77, + "en_NZ", + "English - New Zealand", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_NZ *****/ /***** LOCALE BEGIN en_PH: English - Philippines *****/ MY_LOCALE my_locale_en_PH= - { "en_PH", "English - Philippines", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 78, + "en_PH", + "English - Philippines", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_PH *****/ /***** LOCALE BEGIN en_ZA: English - South Africa *****/ MY_LOCALE my_locale_en_ZA= - { "en_ZA", "English - South Africa", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 79, + "en_ZA", + "English - South Africa", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_ZA *****/ /***** LOCALE BEGIN en_ZW: English - Zimbabwe *****/ MY_LOCALE my_locale_en_ZW= - { "en_ZW", "English - Zimbabwe", TRUE, &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US }; +{ + 80, + "en_ZW", + "English - Zimbabwe", + TRUE, + &my_locale_typelib_month_names_en_US, + &my_locale_typelib_ab_month_names_en_US, + &my_locale_typelib_day_names_en_US, + &my_locale_typelib_ab_day_names_en_US +}; /***** LOCALE END en_ZW *****/ /***** LOCALE BEGIN es_AR: Spanish - Argentina *****/ MY_LOCALE my_locale_es_AR= - { "es_AR", "Spanish - Argentina", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 81, + "es_AR", + "Spanish - Argentina", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_AR *****/ /***** LOCALE BEGIN es_BO: Spanish - Bolivia *****/ MY_LOCALE my_locale_es_BO= - { "es_BO", "Spanish - Bolivia", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 82, + "es_BO", + "Spanish - Bolivia", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_BO *****/ /***** LOCALE BEGIN es_CL: Spanish - Chile *****/ MY_LOCALE my_locale_es_CL= - { "es_CL", "Spanish - Chile", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 83, + "es_CL", + "Spanish - Chile", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_CL *****/ /***** LOCALE BEGIN es_CO: Spanish - Columbia *****/ MY_LOCALE my_locale_es_CO= - { "es_CO", "Spanish - Columbia", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 84, + "es_CO", + "Spanish - Columbia", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_CO *****/ /***** LOCALE BEGIN es_CR: Spanish - Costa Rica *****/ MY_LOCALE my_locale_es_CR= - { "es_CR", "Spanish - Costa Rica", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 85, + "es_CR", + "Spanish - Costa Rica", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_CR *****/ /***** LOCALE BEGIN es_DO: Spanish - Dominican Republic *****/ MY_LOCALE my_locale_es_DO= - { "es_DO", "Spanish - Dominican Republic", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 86, + "es_DO", + "Spanish - Dominican Republic", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_DO *****/ /***** LOCALE BEGIN es_EC: Spanish - Ecuador *****/ MY_LOCALE my_locale_es_EC= - { "es_EC", "Spanish - Ecuador", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 87, + "es_EC", + "Spanish - Ecuador", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_EC *****/ /***** LOCALE BEGIN es_GT: Spanish - Guatemala *****/ MY_LOCALE my_locale_es_GT= - { "es_GT", "Spanish - Guatemala", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 88, + "es_GT", + "Spanish - Guatemala", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_GT *****/ /***** LOCALE BEGIN es_HN: Spanish - Honduras *****/ MY_LOCALE my_locale_es_HN= - { "es_HN", "Spanish - Honduras", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 89, + "es_HN", + "Spanish - Honduras", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_HN *****/ /***** LOCALE BEGIN es_MX: Spanish - Mexico *****/ MY_LOCALE my_locale_es_MX= - { "es_MX", "Spanish - Mexico", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 90, + "es_MX", + "Spanish - Mexico", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_MX *****/ /***** LOCALE BEGIN es_NI: Spanish - Nicaragua *****/ MY_LOCALE my_locale_es_NI= - { "es_NI", "Spanish - Nicaragua", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 91, + "es_NI", + "Spanish - Nicaragua", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_NI *****/ /***** LOCALE BEGIN es_PA: Spanish - Panama *****/ MY_LOCALE my_locale_es_PA= - { "es_PA", "Spanish - Panama", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 92, + "es_PA", + "Spanish - Panama", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_PA *****/ /***** LOCALE BEGIN es_PE: Spanish - Peru *****/ MY_LOCALE my_locale_es_PE= - { "es_PE", "Spanish - Peru", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 93, + "es_PE", + "Spanish - Peru", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_PE *****/ /***** LOCALE BEGIN es_PR: Spanish - Puerto Rico *****/ MY_LOCALE my_locale_es_PR= - { "es_PR", "Spanish - Puerto Rico", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 94, + "es_PR", + "Spanish - Puerto Rico", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_PR *****/ /***** LOCALE BEGIN es_PY: Spanish - Paraguay *****/ MY_LOCALE my_locale_es_PY= - { "es_PY", "Spanish - Paraguay", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 95, + "es_PY", + "Spanish - Paraguay", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_PY *****/ /***** LOCALE BEGIN es_SV: Spanish - El Salvador *****/ MY_LOCALE my_locale_es_SV= - { "es_SV", "Spanish - El Salvador", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 96, + "es_SV", + "Spanish - El Salvador", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_SV *****/ /***** LOCALE BEGIN es_US: Spanish - United States *****/ MY_LOCALE my_locale_es_US= - { "es_US", "Spanish - United States", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 97, + "es_US", + "Spanish - United States", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_US *****/ /***** LOCALE BEGIN es_UY: Spanish - Uruguay *****/ MY_LOCALE my_locale_es_UY= - { "es_UY", "Spanish - Uruguay", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 98, + "es_UY", + "Spanish - Uruguay", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_UY *****/ /***** LOCALE BEGIN es_VE: Spanish - Venezuela *****/ MY_LOCALE my_locale_es_VE= - { "es_VE", "Spanish - Venezuela", FALSE, &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES }; +{ + 99, + "es_VE", + "Spanish - Venezuela", + FALSE, + &my_locale_typelib_month_names_es_ES, + &my_locale_typelib_ab_month_names_es_ES, + &my_locale_typelib_day_names_es_ES, + &my_locale_typelib_ab_day_names_es_ES +}; /***** LOCALE END es_VE *****/ /***** LOCALE BEGIN fr_BE: French - Belgium *****/ MY_LOCALE my_locale_fr_BE= - { "fr_BE", "French - Belgium", FALSE, &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR }; +{ + 100, + "fr_BE", + "French - Belgium", + FALSE, + &my_locale_typelib_month_names_fr_FR, + &my_locale_typelib_ab_month_names_fr_FR, + &my_locale_typelib_day_names_fr_FR, + &my_locale_typelib_ab_day_names_fr_FR +}; /***** LOCALE END fr_BE *****/ /***** LOCALE BEGIN fr_CA: French - Canada *****/ MY_LOCALE my_locale_fr_CA= - { "fr_CA", "French - Canada", FALSE, &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR }; +{ + 101, + "fr_CA", + "French - Canada", + FALSE, + &my_locale_typelib_month_names_fr_FR, + &my_locale_typelib_ab_month_names_fr_FR, + &my_locale_typelib_day_names_fr_FR, + &my_locale_typelib_ab_day_names_fr_FR +}; /***** LOCALE END fr_CA *****/ /***** LOCALE BEGIN fr_CH: French - Switzerland *****/ MY_LOCALE my_locale_fr_CH= - { "fr_CH", "French - Switzerland", FALSE, &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR }; +{ + 102, + "fr_CH", + "French - Switzerland", + FALSE, + &my_locale_typelib_month_names_fr_FR, + &my_locale_typelib_ab_month_names_fr_FR, + &my_locale_typelib_day_names_fr_FR, + &my_locale_typelib_ab_day_names_fr_FR +}; /***** LOCALE END fr_CH *****/ /***** LOCALE BEGIN fr_LU: French - Luxembourg *****/ MY_LOCALE my_locale_fr_LU= - { "fr_LU", "French - Luxembourg", FALSE, &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR }; +{ + 103, + "fr_LU", + "French - Luxembourg", + FALSE, + &my_locale_typelib_month_names_fr_FR, + &my_locale_typelib_ab_month_names_fr_FR, + &my_locale_typelib_day_names_fr_FR, + &my_locale_typelib_ab_day_names_fr_FR +}; /***** LOCALE END fr_LU *****/ /***** LOCALE BEGIN it_IT: Italian - Italy *****/ MY_LOCALE my_locale_it_IT= - { "it_IT", "Italian - Italy", FALSE, &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, &my_locale_typelib_ab_day_names_it_CH }; +{ + 104, + "it_IT", + "Italian - Italy", + FALSE, + &my_locale_typelib_month_names_it_CH, + &my_locale_typelib_ab_month_names_it_CH, + &my_locale_typelib_day_names_it_CH, + &my_locale_typelib_ab_day_names_it_CH +}; /***** LOCALE END it_IT *****/ /***** LOCALE BEGIN nl_BE: Dutch - Belgium *****/ MY_LOCALE my_locale_nl_BE= - { "nl_BE", "Dutch - Belgium", TRUE, &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, &my_locale_typelib_ab_day_names_nl_NL }; +{ + 105, + "nl_BE", + "Dutch - Belgium", + TRUE, + &my_locale_typelib_month_names_nl_NL, + &my_locale_typelib_ab_month_names_nl_NL, + &my_locale_typelib_day_names_nl_NL, + &my_locale_typelib_ab_day_names_nl_NL +}; /***** LOCALE END nl_BE *****/ /***** LOCALE BEGIN no_NO: Norwegian - Norway *****/ MY_LOCALE my_locale_no_NO= - { "no_NO", "Norwegian - Norway", FALSE, &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, &my_locale_typelib_ab_day_names_nb_NO }; +{ + 106, + "no_NO", + "Norwegian - Norway", + FALSE, + &my_locale_typelib_month_names_nb_NO, + &my_locale_typelib_ab_month_names_nb_NO, + &my_locale_typelib_day_names_nb_NO, + &my_locale_typelib_ab_day_names_nb_NO +}; /***** LOCALE END no_NO *****/ /***** LOCALE BEGIN sv_FI: Swedish - Finland *****/ MY_LOCALE my_locale_sv_FI= - { "sv_FI", "Swedish - Finland", FALSE, &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, &my_locale_typelib_ab_day_names_sv_SE }; +{ + 107, + "sv_FI", + "Swedish - Finland", + FALSE, + &my_locale_typelib_month_names_sv_SE, + &my_locale_typelib_ab_month_names_sv_SE, + &my_locale_typelib_day_names_sv_SE, + &my_locale_typelib_ab_day_names_sv_SE +}; /***** LOCALE END sv_FI *****/ /***** LOCALE BEGIN zh_HK: Chinese - Hong Kong SAR *****/ MY_LOCALE my_locale_zh_HK= - { "zh_HK", "Chinese - Hong Kong SAR", FALSE, &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, &my_locale_typelib_ab_day_names_zh_CN }; +{ + 108, + "zh_HK", + "Chinese - Hong Kong SAR", + FALSE, + &my_locale_typelib_month_names_zh_CN, + &my_locale_typelib_ab_month_names_zh_CN, + &my_locale_typelib_day_names_zh_CN, + &my_locale_typelib_ab_day_names_zh_CN +}; /***** LOCALE END zh_HK *****/ + +/* + The list of all locales. + Note, locales must be ordered according to their + numbers to make my_locale_by_number() work fast. + Some debug asserts below check this. +*/ MY_LOCALE *my_locales[]= { &my_locale_en_US, @@ -1605,3 +2582,31 @@ MY_LOCALE *my_locales[]= &my_locale_zh_HK, NULL }; + + +MY_LOCALE *my_locale_by_number(uint number) +{ + MY_LOCALE *locale; + if (number >= array_elements(my_locales) - 1) + return NULL; + locale= my_locales[number]; + // Check that locale is on its correct position in the array + DBUG_ASSERT(locale == my_locales[locale->number]); + return locale; +} + + +MY_LOCALE *my_locale_by_name(const char *name) +{ + MY_LOCALE **locale; + for (locale= my_locales; *locale != NULL; locale++) + { + if (!my_strcasecmp(&my_charset_latin1, (*locale)->name, name)) + { + // Check that locale is on its correct position in the array + DBUG_ASSERT((*locale) == my_locales[(*locale)->number]); + return *locale; + } + } + return NULL; +} diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cb2fa0f7014..c675d2a5523 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1958,6 +1958,7 @@ static void reset_one_shot_variables(THD *thd) thd->update_charset(); thd->variables.time_zone= global_system_variables.time_zone; + thd->variables.lc_time_names= &my_locale_en_US; thd->one_shot_set= 0; } From 033516c5714e255878028f0ed4f0a8b6ffc90162 Mon Sep 17 00:00:00 2001 From: "mats@romeo.(none)" <> Date: Tue, 5 Dec 2006 10:46:03 +0100 Subject: [PATCH 017/160] BUG#24490 (segfault inside unpack_row at Field_bit_as_char::set_default()): Field_bit::set_default() did not check the bit_len, hence used the undefined bit_ptr, causing a crash. The patch adds a check that bit_len > 0 before following the bit_ptr. --- .../extra/rpl_tests/rpl_row_tabledefs.test | 40 +++++++------- mysql-test/r/rpl_row_tabledefs_2myisam.result | 52 +++++++++---------- mysql-test/r/rpl_row_tabledefs_3innodb.result | 52 +++++++++---------- .../t/rpl_row_tabledefs_3innodb-slave.opt | 1 + sql/field.cc | 9 ++-- sql/field.h | 7 +++ sql/log_event.cc | 13 +++-- 7 files changed, 94 insertions(+), 80 deletions(-) create mode 100644 mysql-test/t/rpl_row_tabledefs_3innodb-slave.opt diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 54c14594cf4..c50a5613386 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -80,28 +80,28 @@ INSERT INTO t1_bit VALUES (1,2); INSERT INTO t1_bit VALUES (2,5); INSERT INTO t1_char VALUES (1,2); INSERT INTO t1_char VALUES (2,5); -SELECT * FROM t1_int; -SELECT * FROM t1_bit; -SELECT * FROM t1_char; +SELECT * FROM t1_int ORDER BY a; +SELECT * FROM t1_bit ORDER BY a; +SELECT * FROM t1_char ORDER BY a; --echo **** On Slave **** sync_slave_with_master; -SELECT a,b,x FROM t1_int; -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; -SELECT a,b,x FROM t1_char; +SELECT a,b,x FROM t1_int ORDER BY a; +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; +SELECT a,b,x FROM t1_char ORDER BY a; --echo **** On Master **** connection master; UPDATE t1_int SET b=2*b WHERE a=2; UPDATE t1_char SET b=2*b WHERE a=2; UPDATE t1_bit SET b=2*b WHERE a=2; -SELECT * FROM t1_int; -SELECT * FROM t1_bit; -SELECT * FROM t1_char; +SELECT * FROM t1_int ORDER BY a; +SELECT * FROM t1_bit ORDER BY a; +SELECT * FROM t1_char ORDER BY a; --echo **** On Slave **** sync_slave_with_master; -SELECT a,b,x FROM t1_int; -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; -SELECT a,b,x FROM t1_char; +SELECT a,b,x FROM t1_int ORDER BY a; +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; +SELECT a,b,x FROM t1_char ORDER BY a; # Each of these inserts should generate an error and stop the slave @@ -188,11 +188,11 @@ sync_slave_with_master; connection master; INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); -SELECT * FROM t7; -SELECT * FROM t8; +SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; sync_slave_with_master; -SELECT * FROM t7; -SELECT * FROM t8; +SELECT * FROM t7 ORDER BY a; +SELECT * FROM t8 ORDER BY a; # We will now try to update and then delete a row on the master where # the extra field on the slave does not have a default value. This @@ -216,20 +216,20 @@ INSERT INTO t1_nodef VALUES (2,4,6); --echo **** On Master **** connection master; UPDATE t1_nodef SET b=2*b WHERE a=1; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; --echo **** On Slave **** sync_slave_with_master; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; --echo **** On Master **** connection master; DELETE FROM t1_nodef WHERE a=2; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; --echo **** On Slave **** sync_slave_with_master; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; --echo **** Cleanup **** connection master; diff --git a/mysql-test/r/rpl_row_tabledefs_2myisam.result b/mysql-test/r/rpl_row_tabledefs_2myisam.result index ae792a5dc2a..ea2fc234c44 100644 --- a/mysql-test/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/r/rpl_row_tabledefs_2myisam.result @@ -46,60 +46,60 @@ INSERT INTO t1_bit VALUES (1,2); INSERT INTO t1_bit VALUES (2,5); INSERT INTO t1_char VALUES (1,2); INSERT INTO t1_char VALUES (2,5); -SELECT * FROM t1_int; +SELECT * FROM t1_int ORDER BY a; a b 1 2 2 5 -SELECT * FROM t1_bit; +SELECT * FROM t1_bit ORDER BY a; a b 1 2 2 5 -SELECT * FROM t1_char; +SELECT * FROM t1_char ORDER BY a; a b 1 2 2 5 **** On Slave **** -SELECT a,b,x FROM t1_int; +SELECT a,b,x FROM t1_int ORDER BY a; a b x -2 5 4711 1 2 42 -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; +2 5 4711 +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; a b HEX(x) HEX(y) HEX(z) -2 5 5 1C 1 1 2 3 15 2 -SELECT a,b,x FROM t1_char; +2 5 5 1C 1 +SELECT a,b,x FROM t1_char ORDER BY a; a b x -2 5 Foo is a bar 1 2 Just a test +2 5 Foo is a bar **** On Master **** UPDATE t1_int SET b=2*b WHERE a=2; UPDATE t1_char SET b=2*b WHERE a=2; UPDATE t1_bit SET b=2*b WHERE a=2; -SELECT * FROM t1_int; +SELECT * FROM t1_int ORDER BY a; a b 1 2 2 10 -SELECT * FROM t1_bit; +SELECT * FROM t1_bit ORDER BY a; a b 1 2 2 10 -SELECT * FROM t1_char; +SELECT * FROM t1_char ORDER BY a; a b 1 2 2 10 **** On Slave **** -SELECT a,b,x FROM t1_int; +SELECT a,b,x FROM t1_int ORDER BY a; a b x -2 10 4711 1 2 42 -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; +2 10 4711 +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; a b HEX(x) HEX(y) HEX(z) -2 10 5 1C 1 1 2 3 15 2 -SELECT a,b,x FROM t1_char; +2 10 5 1C 1 +SELECT a,b,x FROM t1_char ORDER BY a; a b x -2 10 Foo is a bar 1 2 Just a test +2 10 Foo is a bar INSERT INTO t9 VALUES (2); INSERT INTO t1_nodef VALUES (1,2); SHOW SLAVE STATUS; @@ -327,22 +327,22 @@ Master_SSL_Key Seconds_Behind_Master # INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); -SELECT * FROM t7; +SELECT * FROM t7 ORDER BY a; a 1 2 3 -SELECT * FROM t8; +SELECT * FROM t8 ORDER BY a; a 1 2 3 -SELECT * FROM t7; +SELECT * FROM t7 ORDER BY a; a e1 e2 e3 e4 e5 e6 e7 e8 1 NULL NULL NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL NULL NULL NULL NULL NULL 3 NULL NULL NULL NULL NULL NULL NULL NULL -SELECT * FROM t8; +SELECT * FROM t8 ORDER BY a; a e1 e2 e3 e4 e5 e6 e7 e8 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 @@ -358,22 +358,22 @@ INSERT INTO t1_nodef VALUES (1,2,3); INSERT INTO t1_nodef VALUES (2,4,6); **** On Master **** UPDATE t1_nodef SET b=2*b WHERE a=1; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b 1 4 2 4 **** On Slave **** -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b x 1 4 3 2 4 6 **** On Master **** DELETE FROM t1_nodef WHERE a=2; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b 1 4 **** On Slave **** -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b x 1 4 3 **** Cleanup **** diff --git a/mysql-test/r/rpl_row_tabledefs_3innodb.result b/mysql-test/r/rpl_row_tabledefs_3innodb.result index b7f0b7b15e2..9eeadc171f8 100644 --- a/mysql-test/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/r/rpl_row_tabledefs_3innodb.result @@ -46,60 +46,60 @@ INSERT INTO t1_bit VALUES (1,2); INSERT INTO t1_bit VALUES (2,5); INSERT INTO t1_char VALUES (1,2); INSERT INTO t1_char VALUES (2,5); -SELECT * FROM t1_int; +SELECT * FROM t1_int ORDER BY a; a b 1 2 2 5 -SELECT * FROM t1_bit; +SELECT * FROM t1_bit ORDER BY a; a b 1 2 2 5 -SELECT * FROM t1_char; +SELECT * FROM t1_char ORDER BY a; a b 1 2 2 5 **** On Slave **** -SELECT a,b,x FROM t1_int; +SELECT a,b,x FROM t1_int ORDER BY a; a b x -2 5 4711 1 2 42 -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; +2 5 4711 +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; a b HEX(x) HEX(y) HEX(z) -2 5 5 1C 1 1 2 3 15 2 -SELECT a,b,x FROM t1_char; +2 5 5 1C 1 +SELECT a,b,x FROM t1_char ORDER BY a; a b x -2 5 Foo is a bar 1 2 Just a test +2 5 Foo is a bar **** On Master **** UPDATE t1_int SET b=2*b WHERE a=2; UPDATE t1_char SET b=2*b WHERE a=2; UPDATE t1_bit SET b=2*b WHERE a=2; -SELECT * FROM t1_int; +SELECT * FROM t1_int ORDER BY a; a b 1 2 2 10 -SELECT * FROM t1_bit; +SELECT * FROM t1_bit ORDER BY a; a b 1 2 2 10 -SELECT * FROM t1_char; +SELECT * FROM t1_char ORDER BY a; a b 1 2 2 10 **** On Slave **** -SELECT a,b,x FROM t1_int; +SELECT a,b,x FROM t1_int ORDER BY a; a b x -2 10 4711 1 2 42 -SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit; +2 10 4711 +SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; a b HEX(x) HEX(y) HEX(z) -2 10 5 1C 1 1 2 3 15 2 -SELECT a,b,x FROM t1_char; +2 10 5 1C 1 +SELECT a,b,x FROM t1_char ORDER BY a; a b x -2 10 Foo is a bar 1 2 Just a test +2 10 Foo is a bar INSERT INTO t9 VALUES (2); INSERT INTO t1_nodef VALUES (1,2); SHOW SLAVE STATUS; @@ -327,22 +327,22 @@ Master_SSL_Key Seconds_Behind_Master # INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); -SELECT * FROM t7; +SELECT * FROM t7 ORDER BY a; a 1 2 3 -SELECT * FROM t8; +SELECT * FROM t8 ORDER BY a; a 1 2 3 -SELECT * FROM t7; +SELECT * FROM t7 ORDER BY a; a e1 e2 e3 e4 e5 e6 e7 e8 1 NULL NULL NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL NULL NULL NULL NULL NULL 3 NULL NULL NULL NULL NULL NULL NULL NULL -SELECT * FROM t8; +SELECT * FROM t8 ORDER BY a; a e1 e2 e3 e4 e5 e6 e7 e8 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 @@ -358,22 +358,22 @@ INSERT INTO t1_nodef VALUES (1,2,3); INSERT INTO t1_nodef VALUES (2,4,6); **** On Master **** UPDATE t1_nodef SET b=2*b WHERE a=1; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b 1 4 2 4 **** On Slave **** -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b x 1 4 3 2 4 6 **** On Master **** DELETE FROM t1_nodef WHERE a=2; -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b 1 4 **** On Slave **** -SELECT * FROM t1_nodef; +SELECT * FROM t1_nodef ORDER BY a; a b x 1 4 3 **** Cleanup **** diff --git a/mysql-test/t/rpl_row_tabledefs_3innodb-slave.opt b/mysql-test/t/rpl_row_tabledefs_3innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_tabledefs_3innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/sql/field.cc b/sql/field.cc index 1e42a53e45a..fcd5ed6f84f 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8455,9 +8455,12 @@ const char *Field_bit::unpack(char *to, const char *from) void Field_bit::set_default() { - my_ptrdiff_t const offset= table->s->default_values - table->record[0]; - uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len); - set_rec_bits(bits, bit_ptr, bit_ofs, bit_len); + if (bit_len > 0) + { + my_ptrdiff_t const offset= table->s->default_values - table->record[0]; + uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len); + set_rec_bits(bits, bit_ptr, bit_ofs, bit_len); + } Field::set_default(); } diff --git a/sql/field.h b/sql/field.h index f0cd9cc6f03..dc7af4aa4d2 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1488,6 +1488,13 @@ private: }; +/** + BIT field represented as chars for non-MyISAM tables. + + @todo The inheritance relationship is backwards since Field_bit is + an extended version of Field_bit_as_char and not the other way + around. Hence, we should refactor it to fix the hierarchy order. + */ class Field_bit_as_char: public Field_bit { public: Field_bit_as_char(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, diff --git a/sql/log_event.cc b/sql/log_event.cc index 7bb4a72edfa..f5ddaf12d6d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6578,10 +6578,13 @@ copy_extra_record_fields(TABLE *table, case FIELD_TYPE_BIT: Field_bit *f= static_cast(*field_ptr); - my_ptrdiff_t const offset= table->record[1] - table->record[0]; - uchar const bits= - get_rec_bits(f->bit_ptr + offset, f->bit_ofs, f->bit_len); - set_rec_bits(bits, f->bit_ptr, f->bit_ofs, f->bit_len); + if (f->bit_len > 0) + { + my_ptrdiff_t const offset= table->record[1] - table->record[0]; + uchar const bits= + get_rec_bits(f->bit_ptr + offset, f->bit_ofs, f->bit_len); + set_rec_bits(bits, f->bit_ptr, f->bit_ofs, f->bit_len); + } break; } } @@ -6682,7 +6685,7 @@ replace_record(THD *thd, TABLE *table, present on the master from table->record[1], if there are any. */ copy_extra_record_fields(table, master_reclength, master_fields); - + /* REPLACE is defined as either INSERT or DELETE + INSERT. If possible, we can replace it with an UPDATE, but that will not From 7c1b675e721ce3775a342dc7e812c0a1a1c06fb2 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 5 Dec 2006 16:01:21 +0400 Subject: [PATCH 018/160] Merging bug#22645 "LC_TIME_NAMES: Statement not replicated" from 4.1. --- mysql-test/t/disabled.def | 1 + sql/mysql_priv.h | 4 +- sql/sql_locale.cc | 654 +++++++++++++++++++------------------- 3 files changed, 331 insertions(+), 328 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index eaea7c710b0..bff70a306b3 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,5 +11,6 @@ ############################################################################## ndb_load : Bug#17233 +rpl_locale : Bug#22645 user_limits : Bug#23921 random failure of user_limits.test diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 6fe3c0ea653..27d29413865 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -118,9 +118,11 @@ typedef struct my_locale_st TYPELIB *day_names; TYPELIB *ab_day_names; #ifdef __cplusplus - my_locale_st(const char *name_par, const char *descr_par, bool is_ascii_par, + my_locale_st(uint number_par, + const char *name_par, const char *descr_par, bool is_ascii_par, TYPELIB *month_names_par, TYPELIB *ab_month_names_par, TYPELIB *day_names_par, TYPELIB *ab_day_names_par) : + number(number_par), name(name_par), description(descr_par), is_ascii(is_ascii_par), month_names(month_names_par), ab_month_names(ab_month_names_par), day_names(day_names_par), ab_day_names(ab_day_names_par) diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index 1f60c61ed46..3645ddb82cb 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -41,8 +41,8 @@ static TYPELIB my_locale_typelib_day_names_ar_AE = { array_elements(my_locale_day_names_ar_AE)-1, "", my_locale_day_names_ar_AE, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ar_AE = { array_elements(my_locale_ab_day_names_ar_AE)-1, "", my_locale_ab_day_names_ar_AE, NULL }; -MY_LOCALE my_locale_ar_AE= -{ +MY_LOCALE my_locale_ar_AE +( 6, "ar_AE", "Arabic - United Arab Emirates", @@ -51,7 +51,7 @@ MY_LOCALE my_locale_ar_AE= &my_locale_typelib_ab_month_names_ar_AE, &my_locale_typelib_day_names_ar_AE, &my_locale_typelib_ab_day_names_ar_AE -}; +); /***** LOCALE END ar_AE *****/ /***** LOCALE BEGIN ar_BH: Arabic - Bahrain *****/ @@ -71,8 +71,8 @@ static TYPELIB my_locale_typelib_day_names_ar_BH = { array_elements(my_locale_day_names_ar_BH)-1, "", my_locale_day_names_ar_BH, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ar_BH = { array_elements(my_locale_ab_day_names_ar_BH)-1, "", my_locale_ab_day_names_ar_BH, NULL }; -MY_LOCALE my_locale_ar_BH= -{ +MY_LOCALE my_locale_ar_BH +( 7, "ar_BH", "Arabic - Bahrain", @@ -81,7 +81,7 @@ MY_LOCALE my_locale_ar_BH= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_BH *****/ /***** LOCALE BEGIN ar_JO: Arabic - Jordan *****/ @@ -101,8 +101,8 @@ static TYPELIB my_locale_typelib_day_names_ar_JO = { array_elements(my_locale_day_names_ar_JO)-1, "", my_locale_day_names_ar_JO, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ar_JO = { array_elements(my_locale_ab_day_names_ar_JO)-1, "", my_locale_ab_day_names_ar_JO, NULL }; -MY_LOCALE my_locale_ar_JO= -{ +MY_LOCALE my_locale_ar_JO +( 8, "ar_JO", "Arabic - Jordan", @@ -111,7 +111,7 @@ MY_LOCALE my_locale_ar_JO= &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, &my_locale_typelib_ab_day_names_ar_JO -}; +); /***** LOCALE END ar_JO *****/ /***** LOCALE BEGIN ar_SA: Arabic - Saudi Arabia *****/ @@ -131,8 +131,8 @@ static TYPELIB my_locale_typelib_day_names_ar_SA = { array_elements(my_locale_day_names_ar_SA)-1, "", my_locale_day_names_ar_SA, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ar_SA = { array_elements(my_locale_ab_day_names_ar_SA)-1, "", my_locale_ab_day_names_ar_SA, NULL }; -MY_LOCALE my_locale_ar_SA= -{ +MY_LOCALE my_locale_ar_SA +( 9, "ar_SA", "Arabic - Saudi Arabia", @@ -141,7 +141,7 @@ MY_LOCALE my_locale_ar_SA= &my_locale_typelib_ab_month_names_ar_SA, &my_locale_typelib_day_names_ar_SA, &my_locale_typelib_ab_day_names_ar_SA -}; +); /***** LOCALE END ar_SA *****/ /***** LOCALE BEGIN ar_SY: Arabic - Syria *****/ @@ -161,8 +161,8 @@ static TYPELIB my_locale_typelib_day_names_ar_SY = { array_elements(my_locale_day_names_ar_SY)-1, "", my_locale_day_names_ar_SY, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ar_SY = { array_elements(my_locale_ab_day_names_ar_SY)-1, "", my_locale_ab_day_names_ar_SY, NULL }; -MY_LOCALE my_locale_ar_SY= -{ +MY_LOCALE my_locale_ar_SY +( 10, "ar_SY", "Arabic - Syria", @@ -171,7 +171,7 @@ MY_LOCALE my_locale_ar_SY= &my_locale_typelib_ab_month_names_ar_SY, &my_locale_typelib_day_names_ar_SY, &my_locale_typelib_ab_day_names_ar_SY -}; +); /***** LOCALE END ar_SY *****/ /***** LOCALE BEGIN be_BY: Belarusian - Belarus *****/ @@ -191,8 +191,8 @@ static TYPELIB my_locale_typelib_day_names_be_BY = { array_elements(my_locale_day_names_be_BY)-1, "", my_locale_day_names_be_BY, NULL }; static TYPELIB my_locale_typelib_ab_day_names_be_BY = { array_elements(my_locale_ab_day_names_be_BY)-1, "", my_locale_ab_day_names_be_BY, NULL }; -MY_LOCALE my_locale_be_BY= -{ +MY_LOCALE my_locale_be_BY +( 11, "be_BY", "Belarusian - Belarus", @@ -201,7 +201,7 @@ MY_LOCALE my_locale_be_BY= &my_locale_typelib_ab_month_names_be_BY, &my_locale_typelib_day_names_be_BY, &my_locale_typelib_ab_day_names_be_BY -}; +); /***** LOCALE END be_BY *****/ /***** LOCALE BEGIN bg_BG: Bulgarian - Bulgaria *****/ @@ -221,8 +221,8 @@ static TYPELIB my_locale_typelib_day_names_bg_BG = { array_elements(my_locale_day_names_bg_BG)-1, "", my_locale_day_names_bg_BG, NULL }; static TYPELIB my_locale_typelib_ab_day_names_bg_BG = { array_elements(my_locale_ab_day_names_bg_BG)-1, "", my_locale_ab_day_names_bg_BG, NULL }; -MY_LOCALE my_locale_bg_BG= -{ +MY_LOCALE my_locale_bg_BG +( 12, "bg_BG", "Bulgarian - Bulgaria", @@ -231,7 +231,7 @@ MY_LOCALE my_locale_bg_BG= &my_locale_typelib_ab_month_names_bg_BG, &my_locale_typelib_day_names_bg_BG, &my_locale_typelib_ab_day_names_bg_BG -}; +); /***** LOCALE END bg_BG *****/ /***** LOCALE BEGIN ca_ES: Catalan - Catalan *****/ @@ -251,8 +251,8 @@ static TYPELIB my_locale_typelib_day_names_ca_ES = { array_elements(my_locale_day_names_ca_ES)-1, "", my_locale_day_names_ca_ES, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ca_ES = { array_elements(my_locale_ab_day_names_ca_ES)-1, "", my_locale_ab_day_names_ca_ES, NULL }; -MY_LOCALE my_locale_ca_ES= -{ +MY_LOCALE my_locale_ca_ES +( 13, "ca_ES", "Catalan - Catalan", @@ -261,7 +261,7 @@ MY_LOCALE my_locale_ca_ES= &my_locale_typelib_ab_month_names_ca_ES, &my_locale_typelib_day_names_ca_ES, &my_locale_typelib_ab_day_names_ca_ES -}; +); /***** LOCALE END ca_ES *****/ /***** LOCALE BEGIN cs_CZ: Czech - Czech Republic *****/ @@ -281,8 +281,8 @@ static TYPELIB my_locale_typelib_day_names_cs_CZ = { array_elements(my_locale_day_names_cs_CZ)-1, "", my_locale_day_names_cs_CZ, NULL }; static TYPELIB my_locale_typelib_ab_day_names_cs_CZ = { array_elements(my_locale_ab_day_names_cs_CZ)-1, "", my_locale_ab_day_names_cs_CZ, NULL }; -MY_LOCALE my_locale_cs_CZ= -{ +MY_LOCALE my_locale_cs_CZ +( 14, "cs_CZ", "Czech - Czech Republic", @@ -291,7 +291,7 @@ MY_LOCALE my_locale_cs_CZ= &my_locale_typelib_ab_month_names_cs_CZ, &my_locale_typelib_day_names_cs_CZ, &my_locale_typelib_ab_day_names_cs_CZ -}; +); /***** LOCALE END cs_CZ *****/ /***** LOCALE BEGIN da_DK: Danish - Denmark *****/ @@ -311,8 +311,8 @@ static TYPELIB my_locale_typelib_day_names_da_DK = { array_elements(my_locale_day_names_da_DK)-1, "", my_locale_day_names_da_DK, NULL }; static TYPELIB my_locale_typelib_ab_day_names_da_DK = { array_elements(my_locale_ab_day_names_da_DK)-1, "", my_locale_ab_day_names_da_DK, NULL }; -MY_LOCALE my_locale_da_DK= -{ +MY_LOCALE my_locale_da_DK +( 15, "da_DK", "Danish - Denmark", @@ -321,7 +321,7 @@ MY_LOCALE my_locale_da_DK= &my_locale_typelib_ab_month_names_da_DK, &my_locale_typelib_day_names_da_DK, &my_locale_typelib_ab_day_names_da_DK -}; +); /***** LOCALE END da_DK *****/ /***** LOCALE BEGIN de_AT: German - Austria *****/ @@ -341,8 +341,8 @@ static TYPELIB my_locale_typelib_day_names_de_AT = { array_elements(my_locale_day_names_de_AT)-1, "", my_locale_day_names_de_AT, NULL }; static TYPELIB my_locale_typelib_ab_day_names_de_AT = { array_elements(my_locale_ab_day_names_de_AT)-1, "", my_locale_ab_day_names_de_AT, NULL }; -MY_LOCALE my_locale_de_AT= -{ +MY_LOCALE my_locale_de_AT +( 16, "de_AT", "German - Austria", @@ -351,7 +351,7 @@ MY_LOCALE my_locale_de_AT= &my_locale_typelib_ab_month_names_de_AT, &my_locale_typelib_day_names_de_AT, &my_locale_typelib_ab_day_names_de_AT -}; +); /***** LOCALE END de_AT *****/ /***** LOCALE BEGIN de_DE: German - Germany *****/ @@ -371,8 +371,8 @@ static TYPELIB my_locale_typelib_day_names_de_DE = { array_elements(my_locale_day_names_de_DE)-1, "", my_locale_day_names_de_DE, NULL }; static TYPELIB my_locale_typelib_ab_day_names_de_DE = { array_elements(my_locale_ab_day_names_de_DE)-1, "", my_locale_ab_day_names_de_DE, NULL }; -MY_LOCALE my_locale_de_DE= -{ +MY_LOCALE my_locale_de_DE +( 4, "de_DE", "German - Germany", @@ -381,7 +381,7 @@ MY_LOCALE my_locale_de_DE= &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE -}; +); /***** LOCALE END de_DE *****/ /***** LOCALE BEGIN en_US: English - United States *****/ @@ -401,8 +401,8 @@ static TYPELIB my_locale_typelib_day_names_en_US = { array_elements(my_locale_day_names_en_US)-1, "", my_locale_day_names_en_US, NULL }; static TYPELIB my_locale_typelib_ab_day_names_en_US = { array_elements(my_locale_ab_day_names_en_US)-1, "", my_locale_ab_day_names_en_US, NULL }; -MY_LOCALE my_locale_en_US= -{ +MY_LOCALE my_locale_en_US +( 0, "en_US", "English - United States", @@ -411,7 +411,7 @@ MY_LOCALE my_locale_en_US= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_US *****/ /***** LOCALE BEGIN es_ES: Spanish - Spain *****/ @@ -431,8 +431,8 @@ static TYPELIB my_locale_typelib_day_names_es_ES = { array_elements(my_locale_day_names_es_ES)-1, "", my_locale_day_names_es_ES, NULL }; static TYPELIB my_locale_typelib_ab_day_names_es_ES = { array_elements(my_locale_ab_day_names_es_ES)-1, "", my_locale_ab_day_names_es_ES, NULL }; -MY_LOCALE my_locale_es_ES= -{ +MY_LOCALE my_locale_es_ES +( 17, "es_ES", "Spanish - Spain", @@ -441,7 +441,7 @@ MY_LOCALE my_locale_es_ES= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_ES *****/ /***** LOCALE BEGIN et_EE: Estonian - Estonia *****/ @@ -461,8 +461,8 @@ static TYPELIB my_locale_typelib_day_names_et_EE = { array_elements(my_locale_day_names_et_EE)-1, "", my_locale_day_names_et_EE, NULL }; static TYPELIB my_locale_typelib_ab_day_names_et_EE = { array_elements(my_locale_ab_day_names_et_EE)-1, "", my_locale_ab_day_names_et_EE, NULL }; -MY_LOCALE my_locale_et_EE= -{ +MY_LOCALE my_locale_et_EE +( 18, "et_EE", "Estonian - Estonia", @@ -471,7 +471,7 @@ MY_LOCALE my_locale_et_EE= &my_locale_typelib_ab_month_names_et_EE, &my_locale_typelib_day_names_et_EE, &my_locale_typelib_ab_day_names_et_EE -}; +); /***** LOCALE END et_EE *****/ /***** LOCALE BEGIN eu_ES: Basque - Basque *****/ @@ -491,8 +491,8 @@ static TYPELIB my_locale_typelib_day_names_eu_ES = { array_elements(my_locale_day_names_eu_ES)-1, "", my_locale_day_names_eu_ES, NULL }; static TYPELIB my_locale_typelib_ab_day_names_eu_ES = { array_elements(my_locale_ab_day_names_eu_ES)-1, "", my_locale_ab_day_names_eu_ES, NULL }; -MY_LOCALE my_locale_eu_ES= -{ +MY_LOCALE my_locale_eu_ES +( 19, "eu_ES", "Basque - Basque", @@ -501,7 +501,7 @@ MY_LOCALE my_locale_eu_ES= &my_locale_typelib_ab_month_names_eu_ES, &my_locale_typelib_day_names_eu_ES, &my_locale_typelib_ab_day_names_eu_ES -}; +); /***** LOCALE END eu_ES *****/ /***** LOCALE BEGIN fi_FI: Finnish - Finland *****/ @@ -521,8 +521,8 @@ static TYPELIB my_locale_typelib_day_names_fi_FI = { array_elements(my_locale_day_names_fi_FI)-1, "", my_locale_day_names_fi_FI, NULL }; static TYPELIB my_locale_typelib_ab_day_names_fi_FI = { array_elements(my_locale_ab_day_names_fi_FI)-1, "", my_locale_ab_day_names_fi_FI, NULL }; -MY_LOCALE my_locale_fi_FI= -{ +MY_LOCALE my_locale_fi_FI +( 20, "fi_FI", "Finnish - Finland", @@ -531,7 +531,7 @@ MY_LOCALE my_locale_fi_FI= &my_locale_typelib_ab_month_names_fi_FI, &my_locale_typelib_day_names_fi_FI, &my_locale_typelib_ab_day_names_fi_FI -}; +); /***** LOCALE END fi_FI *****/ /***** LOCALE BEGIN fo_FO: Faroese - Faroe Islands *****/ @@ -551,8 +551,8 @@ static TYPELIB my_locale_typelib_day_names_fo_FO = { array_elements(my_locale_day_names_fo_FO)-1, "", my_locale_day_names_fo_FO, NULL }; static TYPELIB my_locale_typelib_ab_day_names_fo_FO = { array_elements(my_locale_ab_day_names_fo_FO)-1, "", my_locale_ab_day_names_fo_FO, NULL }; -MY_LOCALE my_locale_fo_FO= -{ +MY_LOCALE my_locale_fo_FO +( 21, "fo_FO", "Faroese - Faroe Islands", @@ -561,7 +561,7 @@ MY_LOCALE my_locale_fo_FO= &my_locale_typelib_ab_month_names_fo_FO, &my_locale_typelib_day_names_fo_FO, &my_locale_typelib_ab_day_names_fo_FO -}; +); /***** LOCALE END fo_FO *****/ /***** LOCALE BEGIN fr_FR: French - France *****/ @@ -581,8 +581,8 @@ static TYPELIB my_locale_typelib_day_names_fr_FR = { array_elements(my_locale_day_names_fr_FR)-1, "", my_locale_day_names_fr_FR, NULL }; static TYPELIB my_locale_typelib_ab_day_names_fr_FR = { array_elements(my_locale_ab_day_names_fr_FR)-1, "", my_locale_ab_day_names_fr_FR, NULL }; -MY_LOCALE my_locale_fr_FR= -{ +MY_LOCALE my_locale_fr_FR +( 5, "fr_FR", "French - France", @@ -591,7 +591,7 @@ MY_LOCALE my_locale_fr_FR= &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR -}; +); /***** LOCALE END fr_FR *****/ /***** LOCALE BEGIN gl_ES: Galician - Galician *****/ @@ -611,8 +611,8 @@ static TYPELIB my_locale_typelib_day_names_gl_ES = { array_elements(my_locale_day_names_gl_ES)-1, "", my_locale_day_names_gl_ES, NULL }; static TYPELIB my_locale_typelib_ab_day_names_gl_ES = { array_elements(my_locale_ab_day_names_gl_ES)-1, "", my_locale_ab_day_names_gl_ES, NULL }; -MY_LOCALE my_locale_gl_ES= -{ +MY_LOCALE my_locale_gl_ES +( 22, "gl_ES", "Galician - Galician", @@ -621,7 +621,7 @@ MY_LOCALE my_locale_gl_ES= &my_locale_typelib_ab_month_names_gl_ES, &my_locale_typelib_day_names_gl_ES, &my_locale_typelib_ab_day_names_gl_ES -}; +); /***** LOCALE END gl_ES *****/ /***** LOCALE BEGIN gu_IN: Gujarati - India *****/ @@ -641,8 +641,8 @@ static TYPELIB my_locale_typelib_day_names_gu_IN = { array_elements(my_locale_day_names_gu_IN)-1, "", my_locale_day_names_gu_IN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_gu_IN = { array_elements(my_locale_ab_day_names_gu_IN)-1, "", my_locale_ab_day_names_gu_IN, NULL }; -MY_LOCALE my_locale_gu_IN= -{ +MY_LOCALE my_locale_gu_IN +( 23, "gu_IN", "Gujarati - India", @@ -651,7 +651,7 @@ MY_LOCALE my_locale_gu_IN= &my_locale_typelib_ab_month_names_gu_IN, &my_locale_typelib_day_names_gu_IN, &my_locale_typelib_ab_day_names_gu_IN -}; +); /***** LOCALE END gu_IN *****/ /***** LOCALE BEGIN he_IL: Hebrew - Israel *****/ @@ -671,8 +671,8 @@ static TYPELIB my_locale_typelib_day_names_he_IL = { array_elements(my_locale_day_names_he_IL)-1, "", my_locale_day_names_he_IL, NULL }; static TYPELIB my_locale_typelib_ab_day_names_he_IL = { array_elements(my_locale_ab_day_names_he_IL)-1, "", my_locale_ab_day_names_he_IL, NULL }; -MY_LOCALE my_locale_he_IL= -{ +MY_LOCALE my_locale_he_IL +( 24, "he_IL", "Hebrew - Israel", @@ -681,7 +681,7 @@ MY_LOCALE my_locale_he_IL= &my_locale_typelib_ab_month_names_he_IL, &my_locale_typelib_day_names_he_IL, &my_locale_typelib_ab_day_names_he_IL -}; +); /***** LOCALE END he_IL *****/ /***** LOCALE BEGIN hi_IN: Hindi - India *****/ @@ -701,8 +701,8 @@ static TYPELIB my_locale_typelib_day_names_hi_IN = { array_elements(my_locale_day_names_hi_IN)-1, "", my_locale_day_names_hi_IN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_hi_IN = { array_elements(my_locale_ab_day_names_hi_IN)-1, "", my_locale_ab_day_names_hi_IN, NULL }; -MY_LOCALE my_locale_hi_IN= -{ +MY_LOCALE my_locale_hi_IN +( 25, "hi_IN", "Hindi - India", @@ -711,7 +711,7 @@ MY_LOCALE my_locale_hi_IN= &my_locale_typelib_ab_month_names_hi_IN, &my_locale_typelib_day_names_hi_IN, &my_locale_typelib_ab_day_names_hi_IN -}; +); /***** LOCALE END hi_IN *****/ /***** LOCALE BEGIN hr_HR: Croatian - Croatia *****/ @@ -731,8 +731,8 @@ static TYPELIB my_locale_typelib_day_names_hr_HR = { array_elements(my_locale_day_names_hr_HR)-1, "", my_locale_day_names_hr_HR, NULL }; static TYPELIB my_locale_typelib_ab_day_names_hr_HR = { array_elements(my_locale_ab_day_names_hr_HR)-1, "", my_locale_ab_day_names_hr_HR, NULL }; -MY_LOCALE my_locale_hr_HR= -{ +MY_LOCALE my_locale_hr_HR +( 26, "hr_HR", "Croatian - Croatia", @@ -741,7 +741,7 @@ MY_LOCALE my_locale_hr_HR= &my_locale_typelib_ab_month_names_hr_HR, &my_locale_typelib_day_names_hr_HR, &my_locale_typelib_ab_day_names_hr_HR -}; +); /***** LOCALE END hr_HR *****/ /***** LOCALE BEGIN hu_HU: Hungarian - Hungary *****/ @@ -761,8 +761,8 @@ static TYPELIB my_locale_typelib_day_names_hu_HU = { array_elements(my_locale_day_names_hu_HU)-1, "", my_locale_day_names_hu_HU, NULL }; static TYPELIB my_locale_typelib_ab_day_names_hu_HU = { array_elements(my_locale_ab_day_names_hu_HU)-1, "", my_locale_ab_day_names_hu_HU, NULL }; -MY_LOCALE my_locale_hu_HU= -{ +MY_LOCALE my_locale_hu_HU +( 27, "hu_HU", "Hungarian - Hungary", @@ -771,7 +771,7 @@ MY_LOCALE my_locale_hu_HU= &my_locale_typelib_ab_month_names_hu_HU, &my_locale_typelib_day_names_hu_HU, &my_locale_typelib_ab_day_names_hu_HU -}; +); /***** LOCALE END hu_HU *****/ /***** LOCALE BEGIN id_ID: Indonesian - Indonesia *****/ @@ -791,8 +791,8 @@ static TYPELIB my_locale_typelib_day_names_id_ID = { array_elements(my_locale_day_names_id_ID)-1, "", my_locale_day_names_id_ID, NULL }; static TYPELIB my_locale_typelib_ab_day_names_id_ID = { array_elements(my_locale_ab_day_names_id_ID)-1, "", my_locale_ab_day_names_id_ID, NULL }; -MY_LOCALE my_locale_id_ID= -{ +MY_LOCALE my_locale_id_ID +( 28, "id_ID", "Indonesian - Indonesia", @@ -801,7 +801,7 @@ MY_LOCALE my_locale_id_ID= &my_locale_typelib_ab_month_names_id_ID, &my_locale_typelib_day_names_id_ID, &my_locale_typelib_ab_day_names_id_ID -}; +); /***** LOCALE END id_ID *****/ /***** LOCALE BEGIN is_IS: Icelandic - Iceland *****/ @@ -821,8 +821,8 @@ static TYPELIB my_locale_typelib_day_names_is_IS = { array_elements(my_locale_day_names_is_IS)-1, "", my_locale_day_names_is_IS, NULL }; static TYPELIB my_locale_typelib_ab_day_names_is_IS = { array_elements(my_locale_ab_day_names_is_IS)-1, "", my_locale_ab_day_names_is_IS, NULL }; -MY_LOCALE my_locale_is_IS= -{ +MY_LOCALE my_locale_is_IS +( 29, "is_IS", "Icelandic - Iceland", @@ -831,7 +831,7 @@ MY_LOCALE my_locale_is_IS= &my_locale_typelib_ab_month_names_is_IS, &my_locale_typelib_day_names_is_IS, &my_locale_typelib_ab_day_names_is_IS -}; +); /***** LOCALE END is_IS *****/ /***** LOCALE BEGIN it_CH: Italian - Switzerland *****/ @@ -851,8 +851,8 @@ static TYPELIB my_locale_typelib_day_names_it_CH = { array_elements(my_locale_day_names_it_CH)-1, "", my_locale_day_names_it_CH, NULL }; static TYPELIB my_locale_typelib_ab_day_names_it_CH = { array_elements(my_locale_ab_day_names_it_CH)-1, "", my_locale_ab_day_names_it_CH, NULL }; -MY_LOCALE my_locale_it_CH= -{ +MY_LOCALE my_locale_it_CH +( 30, "it_CH", "Italian - Switzerland", @@ -861,7 +861,7 @@ MY_LOCALE my_locale_it_CH= &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, &my_locale_typelib_ab_day_names_it_CH -}; +); /***** LOCALE END it_CH *****/ /***** LOCALE BEGIN ja_JP: Japanese - Japan *****/ @@ -881,8 +881,8 @@ static TYPELIB my_locale_typelib_day_names_ja_JP = { array_elements(my_locale_day_names_ja_JP)-1, "", my_locale_day_names_ja_JP, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ja_JP = { array_elements(my_locale_ab_day_names_ja_JP)-1, "", my_locale_ab_day_names_ja_JP, NULL }; -MY_LOCALE my_locale_ja_JP= -{ +MY_LOCALE my_locale_ja_JP +( 2, "ja_JP", "Japanese - Japan", @@ -891,7 +891,7 @@ MY_LOCALE my_locale_ja_JP= &my_locale_typelib_ab_month_names_ja_JP, &my_locale_typelib_day_names_ja_JP, &my_locale_typelib_ab_day_names_ja_JP -}; +); /***** LOCALE END ja_JP *****/ /***** LOCALE BEGIN ko_KR: Korean - Korea *****/ @@ -911,8 +911,8 @@ static TYPELIB my_locale_typelib_day_names_ko_KR = { array_elements(my_locale_day_names_ko_KR)-1, "", my_locale_day_names_ko_KR, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ko_KR = { array_elements(my_locale_ab_day_names_ko_KR)-1, "", my_locale_ab_day_names_ko_KR, NULL }; -MY_LOCALE my_locale_ko_KR= -{ +MY_LOCALE my_locale_ko_KR +( 31, "ko_KR", "Korean - Korea", @@ -921,7 +921,7 @@ MY_LOCALE my_locale_ko_KR= &my_locale_typelib_ab_month_names_ko_KR, &my_locale_typelib_day_names_ko_KR, &my_locale_typelib_ab_day_names_ko_KR -}; +); /***** LOCALE END ko_KR *****/ /***** LOCALE BEGIN lt_LT: Lithuanian - Lithuania *****/ @@ -941,8 +941,8 @@ static TYPELIB my_locale_typelib_day_names_lt_LT = { array_elements(my_locale_day_names_lt_LT)-1, "", my_locale_day_names_lt_LT, NULL }; static TYPELIB my_locale_typelib_ab_day_names_lt_LT = { array_elements(my_locale_ab_day_names_lt_LT)-1, "", my_locale_ab_day_names_lt_LT, NULL }; -MY_LOCALE my_locale_lt_LT= -{ +MY_LOCALE my_locale_lt_LT +( 32, "lt_LT", "Lithuanian - Lithuania", @@ -951,7 +951,7 @@ MY_LOCALE my_locale_lt_LT= &my_locale_typelib_ab_month_names_lt_LT, &my_locale_typelib_day_names_lt_LT, &my_locale_typelib_ab_day_names_lt_LT -}; +); /***** LOCALE END lt_LT *****/ /***** LOCALE BEGIN lv_LV: Latvian - Latvia *****/ @@ -971,8 +971,8 @@ static TYPELIB my_locale_typelib_day_names_lv_LV = { array_elements(my_locale_day_names_lv_LV)-1, "", my_locale_day_names_lv_LV, NULL }; static TYPELIB my_locale_typelib_ab_day_names_lv_LV = { array_elements(my_locale_ab_day_names_lv_LV)-1, "", my_locale_ab_day_names_lv_LV, NULL }; -MY_LOCALE my_locale_lv_LV= -{ +MY_LOCALE my_locale_lv_LV +( 33, "lv_LV", "Latvian - Latvia", @@ -981,7 +981,7 @@ MY_LOCALE my_locale_lv_LV= &my_locale_typelib_ab_month_names_lv_LV, &my_locale_typelib_day_names_lv_LV, &my_locale_typelib_ab_day_names_lv_LV -}; +); /***** LOCALE END lv_LV *****/ /***** LOCALE BEGIN mk_MK: Macedonian - FYROM *****/ @@ -1001,8 +1001,8 @@ static TYPELIB my_locale_typelib_day_names_mk_MK = { array_elements(my_locale_day_names_mk_MK)-1, "", my_locale_day_names_mk_MK, NULL }; static TYPELIB my_locale_typelib_ab_day_names_mk_MK = { array_elements(my_locale_ab_day_names_mk_MK)-1, "", my_locale_ab_day_names_mk_MK, NULL }; -MY_LOCALE my_locale_mk_MK= -{ +MY_LOCALE my_locale_mk_MK +( 34, "mk_MK", "Macedonian - FYROM", @@ -1011,7 +1011,7 @@ MY_LOCALE my_locale_mk_MK= &my_locale_typelib_ab_month_names_mk_MK, &my_locale_typelib_day_names_mk_MK, &my_locale_typelib_ab_day_names_mk_MK -}; +); /***** LOCALE END mk_MK *****/ /***** LOCALE BEGIN mn_MN: Mongolia - Mongolian *****/ @@ -1031,8 +1031,8 @@ static TYPELIB my_locale_typelib_day_names_mn_MN = { array_elements(my_locale_day_names_mn_MN)-1, "", my_locale_day_names_mn_MN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_mn_MN = { array_elements(my_locale_ab_day_names_mn_MN)-1, "", my_locale_ab_day_names_mn_MN, NULL }; -MY_LOCALE my_locale_mn_MN= -{ +MY_LOCALE my_locale_mn_MN +( 35, "mn_MN", "Mongolia - Mongolian", @@ -1041,7 +1041,7 @@ MY_LOCALE my_locale_mn_MN= &my_locale_typelib_ab_month_names_mn_MN, &my_locale_typelib_day_names_mn_MN, &my_locale_typelib_ab_day_names_mn_MN -}; +); /***** LOCALE END mn_MN *****/ /***** LOCALE BEGIN ms_MY: Malay - Malaysia *****/ @@ -1061,8 +1061,8 @@ static TYPELIB my_locale_typelib_day_names_ms_MY = { array_elements(my_locale_day_names_ms_MY)-1, "", my_locale_day_names_ms_MY, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ms_MY = { array_elements(my_locale_ab_day_names_ms_MY)-1, "", my_locale_ab_day_names_ms_MY, NULL }; -MY_LOCALE my_locale_ms_MY= -{ +MY_LOCALE my_locale_ms_MY +( 36, "ms_MY", "Malay - Malaysia", @@ -1071,7 +1071,7 @@ MY_LOCALE my_locale_ms_MY= &my_locale_typelib_ab_month_names_ms_MY, &my_locale_typelib_day_names_ms_MY, &my_locale_typelib_ab_day_names_ms_MY -}; +); /***** LOCALE END ms_MY *****/ /***** LOCALE BEGIN nb_NO: Norwegian(Bokml) - Norway *****/ @@ -1091,8 +1091,8 @@ static TYPELIB my_locale_typelib_day_names_nb_NO = { array_elements(my_locale_day_names_nb_NO)-1, "", my_locale_day_names_nb_NO, NULL }; static TYPELIB my_locale_typelib_ab_day_names_nb_NO = { array_elements(my_locale_ab_day_names_nb_NO)-1, "", my_locale_ab_day_names_nb_NO, NULL }; -MY_LOCALE my_locale_nb_NO= -{ +MY_LOCALE my_locale_nb_NO +( 37, "nb_NO", "Norwegian(Bokml) - Norway", @@ -1101,7 +1101,7 @@ MY_LOCALE my_locale_nb_NO= &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, &my_locale_typelib_ab_day_names_nb_NO -}; +); /***** LOCALE END nb_NO *****/ /***** LOCALE BEGIN nl_NL: Dutch - The Netherlands *****/ @@ -1121,8 +1121,8 @@ static TYPELIB my_locale_typelib_day_names_nl_NL = { array_elements(my_locale_day_names_nl_NL)-1, "", my_locale_day_names_nl_NL, NULL }; static TYPELIB my_locale_typelib_ab_day_names_nl_NL = { array_elements(my_locale_ab_day_names_nl_NL)-1, "", my_locale_ab_day_names_nl_NL, NULL }; -MY_LOCALE my_locale_nl_NL= -{ +MY_LOCALE my_locale_nl_NL +( 38, "nl_NL", "Dutch - The Netherlands", @@ -1131,7 +1131,7 @@ MY_LOCALE my_locale_nl_NL= &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, &my_locale_typelib_ab_day_names_nl_NL -}; +); /***** LOCALE END nl_NL *****/ /***** LOCALE BEGIN pl_PL: Polish - Poland *****/ @@ -1151,8 +1151,8 @@ static TYPELIB my_locale_typelib_day_names_pl_PL = { array_elements(my_locale_day_names_pl_PL)-1, "", my_locale_day_names_pl_PL, NULL }; static TYPELIB my_locale_typelib_ab_day_names_pl_PL = { array_elements(my_locale_ab_day_names_pl_PL)-1, "", my_locale_ab_day_names_pl_PL, NULL }; -MY_LOCALE my_locale_pl_PL= -{ +MY_LOCALE my_locale_pl_PL +( 39, "pl_PL", "Polish - Poland", @@ -1161,7 +1161,7 @@ MY_LOCALE my_locale_pl_PL= &my_locale_typelib_ab_month_names_pl_PL, &my_locale_typelib_day_names_pl_PL, &my_locale_typelib_ab_day_names_pl_PL -}; +); /***** LOCALE END pl_PL *****/ /***** LOCALE BEGIN pt_BR: Portugese - Brazil *****/ @@ -1181,8 +1181,8 @@ static TYPELIB my_locale_typelib_day_names_pt_BR = { array_elements(my_locale_day_names_pt_BR)-1, "", my_locale_day_names_pt_BR, NULL }; static TYPELIB my_locale_typelib_ab_day_names_pt_BR = { array_elements(my_locale_ab_day_names_pt_BR)-1, "", my_locale_ab_day_names_pt_BR, NULL }; -MY_LOCALE my_locale_pt_BR= -{ +MY_LOCALE my_locale_pt_BR +( 40, "pt_BR", "Portugese - Brazil", @@ -1191,7 +1191,7 @@ MY_LOCALE my_locale_pt_BR= &my_locale_typelib_ab_month_names_pt_BR, &my_locale_typelib_day_names_pt_BR, &my_locale_typelib_ab_day_names_pt_BR -}; +); /***** LOCALE END pt_BR *****/ /***** LOCALE BEGIN pt_PT: Portugese - Portugal *****/ @@ -1211,8 +1211,8 @@ static TYPELIB my_locale_typelib_day_names_pt_PT = { array_elements(my_locale_day_names_pt_PT)-1, "", my_locale_day_names_pt_PT, NULL }; static TYPELIB my_locale_typelib_ab_day_names_pt_PT = { array_elements(my_locale_ab_day_names_pt_PT)-1, "", my_locale_ab_day_names_pt_PT, NULL }; -MY_LOCALE my_locale_pt_PT= -{ +MY_LOCALE my_locale_pt_PT +( 41, "pt_PT", "Portugese - Portugal", @@ -1221,7 +1221,7 @@ MY_LOCALE my_locale_pt_PT= &my_locale_typelib_ab_month_names_pt_PT, &my_locale_typelib_day_names_pt_PT, &my_locale_typelib_ab_day_names_pt_PT -}; +); /***** LOCALE END pt_PT *****/ /***** LOCALE BEGIN ro_RO: Romanian - Romania *****/ @@ -1241,8 +1241,8 @@ static TYPELIB my_locale_typelib_day_names_ro_RO = { array_elements(my_locale_day_names_ro_RO)-1, "", my_locale_day_names_ro_RO, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ro_RO = { array_elements(my_locale_ab_day_names_ro_RO)-1, "", my_locale_ab_day_names_ro_RO, NULL }; -MY_LOCALE my_locale_ro_RO= -{ +MY_LOCALE my_locale_ro_RO +( 42, "ro_RO", "Romanian - Romania", @@ -1251,7 +1251,7 @@ MY_LOCALE my_locale_ro_RO= &my_locale_typelib_ab_month_names_ro_RO, &my_locale_typelib_day_names_ro_RO, &my_locale_typelib_ab_day_names_ro_RO -}; +); /***** LOCALE END ro_RO *****/ /***** LOCALE BEGIN ru_RU: Russian - Russia *****/ @@ -1271,8 +1271,8 @@ static TYPELIB my_locale_typelib_day_names_ru_RU = { array_elements(my_locale_day_names_ru_RU)-1, "", my_locale_day_names_ru_RU, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ru_RU = { array_elements(my_locale_ab_day_names_ru_RU)-1, "", my_locale_ab_day_names_ru_RU, NULL }; -MY_LOCALE my_locale_ru_RU= -{ +MY_LOCALE my_locale_ru_RU +( 43, "ru_RU", "Russian - Russia", @@ -1281,7 +1281,7 @@ MY_LOCALE my_locale_ru_RU= &my_locale_typelib_ab_month_names_ru_RU, &my_locale_typelib_day_names_ru_RU, &my_locale_typelib_ab_day_names_ru_RU -}; +); /***** LOCALE END ru_RU *****/ /***** LOCALE BEGIN ru_UA: Russian - Ukraine *****/ @@ -1301,8 +1301,8 @@ static TYPELIB my_locale_typelib_day_names_ru_UA = { array_elements(my_locale_day_names_ru_UA)-1, "", my_locale_day_names_ru_UA, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ru_UA = { array_elements(my_locale_ab_day_names_ru_UA)-1, "", my_locale_ab_day_names_ru_UA, NULL }; -MY_LOCALE my_locale_ru_UA= -{ +MY_LOCALE my_locale_ru_UA +( 44, "ru_UA", "Russian - Ukraine", @@ -1311,7 +1311,7 @@ MY_LOCALE my_locale_ru_UA= &my_locale_typelib_ab_month_names_ru_UA, &my_locale_typelib_day_names_ru_UA, &my_locale_typelib_ab_day_names_ru_UA -}; +); /***** LOCALE END ru_UA *****/ /***** LOCALE BEGIN sk_SK: Slovak - Slovakia *****/ @@ -1331,8 +1331,8 @@ static TYPELIB my_locale_typelib_day_names_sk_SK = { array_elements(my_locale_day_names_sk_SK)-1, "", my_locale_day_names_sk_SK, NULL }; static TYPELIB my_locale_typelib_ab_day_names_sk_SK = { array_elements(my_locale_ab_day_names_sk_SK)-1, "", my_locale_ab_day_names_sk_SK, NULL }; -MY_LOCALE my_locale_sk_SK= -{ +MY_LOCALE my_locale_sk_SK +( 45, "sk_SK", "Slovak - Slovakia", @@ -1341,7 +1341,7 @@ MY_LOCALE my_locale_sk_SK= &my_locale_typelib_ab_month_names_sk_SK, &my_locale_typelib_day_names_sk_SK, &my_locale_typelib_ab_day_names_sk_SK -}; +); /***** LOCALE END sk_SK *****/ /***** LOCALE BEGIN sl_SI: Slovenian - Slovenia *****/ @@ -1361,8 +1361,8 @@ static TYPELIB my_locale_typelib_day_names_sl_SI = { array_elements(my_locale_day_names_sl_SI)-1, "", my_locale_day_names_sl_SI, NULL }; static TYPELIB my_locale_typelib_ab_day_names_sl_SI = { array_elements(my_locale_ab_day_names_sl_SI)-1, "", my_locale_ab_day_names_sl_SI, NULL }; -MY_LOCALE my_locale_sl_SI= -{ +MY_LOCALE my_locale_sl_SI +( 46, "sl_SI", "Slovenian - Slovenia", @@ -1371,7 +1371,7 @@ MY_LOCALE my_locale_sl_SI= &my_locale_typelib_ab_month_names_sl_SI, &my_locale_typelib_day_names_sl_SI, &my_locale_typelib_ab_day_names_sl_SI -}; +); /***** LOCALE END sl_SI *****/ /***** LOCALE BEGIN sq_AL: Albanian - Albania *****/ @@ -1391,8 +1391,8 @@ static TYPELIB my_locale_typelib_day_names_sq_AL = { array_elements(my_locale_day_names_sq_AL)-1, "", my_locale_day_names_sq_AL, NULL }; static TYPELIB my_locale_typelib_ab_day_names_sq_AL = { array_elements(my_locale_ab_day_names_sq_AL)-1, "", my_locale_ab_day_names_sq_AL, NULL }; -MY_LOCALE my_locale_sq_AL= -{ +MY_LOCALE my_locale_sq_AL +( 47, "sq_AL", "Albanian - Albania", @@ -1401,7 +1401,7 @@ MY_LOCALE my_locale_sq_AL= &my_locale_typelib_ab_month_names_sq_AL, &my_locale_typelib_day_names_sq_AL, &my_locale_typelib_ab_day_names_sq_AL -}; +); /***** LOCALE END sq_AL *****/ /***** LOCALE BEGIN sr_YU: Servian - Yugoslavia *****/ @@ -1421,8 +1421,8 @@ static TYPELIB my_locale_typelib_day_names_sr_YU = { array_elements(my_locale_day_names_sr_YU)-1, "", my_locale_day_names_sr_YU, NULL }; static TYPELIB my_locale_typelib_ab_day_names_sr_YU = { array_elements(my_locale_ab_day_names_sr_YU)-1, "", my_locale_ab_day_names_sr_YU, NULL }; -MY_LOCALE my_locale_sr_YU= -{ +MY_LOCALE my_locale_sr_YU +( 48, "sr_YU", "Servian - Yugoslavia", @@ -1431,7 +1431,7 @@ MY_LOCALE my_locale_sr_YU= &my_locale_typelib_ab_month_names_sr_YU, &my_locale_typelib_day_names_sr_YU, &my_locale_typelib_ab_day_names_sr_YU -}; +); /***** LOCALE END sr_YU *****/ /***** LOCALE BEGIN sv_SE: Swedish - Sweden *****/ @@ -1451,8 +1451,8 @@ static TYPELIB my_locale_typelib_day_names_sv_SE = { array_elements(my_locale_day_names_sv_SE)-1, "", my_locale_day_names_sv_SE, NULL }; static TYPELIB my_locale_typelib_ab_day_names_sv_SE = { array_elements(my_locale_ab_day_names_sv_SE)-1, "", my_locale_ab_day_names_sv_SE, NULL }; -MY_LOCALE my_locale_sv_SE= -{ +MY_LOCALE my_locale_sv_SE +( 3, "sv_SE", "Swedish - Sweden", @@ -1461,7 +1461,7 @@ MY_LOCALE my_locale_sv_SE= &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, &my_locale_typelib_ab_day_names_sv_SE -}; +); /***** LOCALE END sv_SE *****/ /***** LOCALE BEGIN ta_IN: Tamil - India *****/ @@ -1481,8 +1481,8 @@ static TYPELIB my_locale_typelib_day_names_ta_IN = { array_elements(my_locale_day_names_ta_IN)-1, "", my_locale_day_names_ta_IN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ta_IN = { array_elements(my_locale_ab_day_names_ta_IN)-1, "", my_locale_ab_day_names_ta_IN, NULL }; -MY_LOCALE my_locale_ta_IN= -{ +MY_LOCALE my_locale_ta_IN +( 49, "ta_IN", "Tamil - India", @@ -1491,7 +1491,7 @@ MY_LOCALE my_locale_ta_IN= &my_locale_typelib_ab_month_names_ta_IN, &my_locale_typelib_day_names_ta_IN, &my_locale_typelib_ab_day_names_ta_IN -}; +); /***** LOCALE END ta_IN *****/ /***** LOCALE BEGIN te_IN: Telugu - India *****/ @@ -1511,8 +1511,8 @@ static TYPELIB my_locale_typelib_day_names_te_IN = { array_elements(my_locale_day_names_te_IN)-1, "", my_locale_day_names_te_IN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_te_IN = { array_elements(my_locale_ab_day_names_te_IN)-1, "", my_locale_ab_day_names_te_IN, NULL }; -MY_LOCALE my_locale_te_IN= -{ +MY_LOCALE my_locale_te_IN +( 50, "te_IN", "Telugu - India", @@ -1521,7 +1521,7 @@ MY_LOCALE my_locale_te_IN= &my_locale_typelib_ab_month_names_te_IN, &my_locale_typelib_day_names_te_IN, &my_locale_typelib_ab_day_names_te_IN -}; +); /***** LOCALE END te_IN *****/ /***** LOCALE BEGIN th_TH: Thai - Thailand *****/ @@ -1541,8 +1541,8 @@ static TYPELIB my_locale_typelib_day_names_th_TH = { array_elements(my_locale_day_names_th_TH)-1, "", my_locale_day_names_th_TH, NULL }; static TYPELIB my_locale_typelib_ab_day_names_th_TH = { array_elements(my_locale_ab_day_names_th_TH)-1, "", my_locale_ab_day_names_th_TH, NULL }; -MY_LOCALE my_locale_th_TH= -{ +MY_LOCALE my_locale_th_TH +( 51, "th_TH", "Thai - Thailand", @@ -1551,7 +1551,7 @@ MY_LOCALE my_locale_th_TH= &my_locale_typelib_ab_month_names_th_TH, &my_locale_typelib_day_names_th_TH, &my_locale_typelib_ab_day_names_th_TH -}; +); /***** LOCALE END th_TH *****/ /***** LOCALE BEGIN tr_TR: Turkish - Turkey *****/ @@ -1571,8 +1571,8 @@ static TYPELIB my_locale_typelib_day_names_tr_TR = { array_elements(my_locale_day_names_tr_TR)-1, "", my_locale_day_names_tr_TR, NULL }; static TYPELIB my_locale_typelib_ab_day_names_tr_TR = { array_elements(my_locale_ab_day_names_tr_TR)-1, "", my_locale_ab_day_names_tr_TR, NULL }; -MY_LOCALE my_locale_tr_TR= -{ +MY_LOCALE my_locale_tr_TR +( 52, "tr_TR", "Turkish - Turkey", @@ -1581,7 +1581,7 @@ MY_LOCALE my_locale_tr_TR= &my_locale_typelib_ab_month_names_tr_TR, &my_locale_typelib_day_names_tr_TR, &my_locale_typelib_ab_day_names_tr_TR -}; +); /***** LOCALE END tr_TR *****/ /***** LOCALE BEGIN uk_UA: Ukrainian - Ukraine *****/ @@ -1601,8 +1601,8 @@ static TYPELIB my_locale_typelib_day_names_uk_UA = { array_elements(my_locale_day_names_uk_UA)-1, "", my_locale_day_names_uk_UA, NULL }; static TYPELIB my_locale_typelib_ab_day_names_uk_UA = { array_elements(my_locale_ab_day_names_uk_UA)-1, "", my_locale_ab_day_names_uk_UA, NULL }; -MY_LOCALE my_locale_uk_UA= -{ +MY_LOCALE my_locale_uk_UA +( 53, "uk_UA", "Ukrainian - Ukraine", @@ -1611,7 +1611,7 @@ MY_LOCALE my_locale_uk_UA= &my_locale_typelib_ab_month_names_uk_UA, &my_locale_typelib_day_names_uk_UA, &my_locale_typelib_ab_day_names_uk_UA -}; +); /***** LOCALE END uk_UA *****/ /***** LOCALE BEGIN ur_PK: Urdu - Pakistan *****/ @@ -1631,8 +1631,8 @@ static TYPELIB my_locale_typelib_day_names_ur_PK = { array_elements(my_locale_day_names_ur_PK)-1, "", my_locale_day_names_ur_PK, NULL }; static TYPELIB my_locale_typelib_ab_day_names_ur_PK = { array_elements(my_locale_ab_day_names_ur_PK)-1, "", my_locale_ab_day_names_ur_PK, NULL }; -MY_LOCALE my_locale_ur_PK= -{ +MY_LOCALE my_locale_ur_PK +( 54, "ur_PK", "Urdu - Pakistan", @@ -1641,7 +1641,7 @@ MY_LOCALE my_locale_ur_PK= &my_locale_typelib_ab_month_names_ur_PK, &my_locale_typelib_day_names_ur_PK, &my_locale_typelib_ab_day_names_ur_PK -}; +); /***** LOCALE END ur_PK *****/ /***** LOCALE BEGIN vi_VN: Vietnamese - Vietnam *****/ @@ -1661,8 +1661,8 @@ static TYPELIB my_locale_typelib_day_names_vi_VN = { array_elements(my_locale_day_names_vi_VN)-1, "", my_locale_day_names_vi_VN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_vi_VN = { array_elements(my_locale_ab_day_names_vi_VN)-1, "", my_locale_ab_day_names_vi_VN, NULL }; -MY_LOCALE my_locale_vi_VN= -{ +MY_LOCALE my_locale_vi_VN +( 55, "vi_VN", "Vietnamese - Vietnam", @@ -1671,7 +1671,7 @@ MY_LOCALE my_locale_vi_VN= &my_locale_typelib_ab_month_names_vi_VN, &my_locale_typelib_day_names_vi_VN, &my_locale_typelib_ab_day_names_vi_VN -}; +); /***** LOCALE END vi_VN *****/ /***** LOCALE BEGIN zh_CN: Chinese - Peoples Republic of China *****/ @@ -1691,8 +1691,8 @@ static TYPELIB my_locale_typelib_day_names_zh_CN = { array_elements(my_locale_day_names_zh_CN)-1, "", my_locale_day_names_zh_CN, NULL }; static TYPELIB my_locale_typelib_ab_day_names_zh_CN = { array_elements(my_locale_ab_day_names_zh_CN)-1, "", my_locale_ab_day_names_zh_CN, NULL }; -MY_LOCALE my_locale_zh_CN= -{ +MY_LOCALE my_locale_zh_CN +( 56, "zh_CN", "Chinese - Peoples Republic of China", @@ -1701,7 +1701,7 @@ MY_LOCALE my_locale_zh_CN= &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, &my_locale_typelib_ab_day_names_zh_CN -}; +); /***** LOCALE END zh_CN *****/ /***** LOCALE BEGIN zh_TW: Chinese - Taiwan *****/ @@ -1721,8 +1721,8 @@ static TYPELIB my_locale_typelib_day_names_zh_TW = { array_elements(my_locale_day_names_zh_TW)-1, "", my_locale_day_names_zh_TW, NULL }; static TYPELIB my_locale_typelib_ab_day_names_zh_TW = { array_elements(my_locale_ab_day_names_zh_TW)-1, "", my_locale_ab_day_names_zh_TW, NULL }; -MY_LOCALE my_locale_zh_TW= -{ +MY_LOCALE my_locale_zh_TW +( 57, "zh_TW", "Chinese - Taiwan", @@ -1731,12 +1731,12 @@ MY_LOCALE my_locale_zh_TW= &my_locale_typelib_ab_month_names_zh_TW, &my_locale_typelib_day_names_zh_TW, &my_locale_typelib_ab_day_names_zh_TW -}; +); /***** LOCALE END zh_TW *****/ /***** LOCALE BEGIN ar_DZ: Arabic - Algeria *****/ -MY_LOCALE my_locale_ar_DZ= -{ +MY_LOCALE my_locale_ar_DZ +( 58, "ar_DZ", "Arabic - Algeria", @@ -1745,12 +1745,12 @@ MY_LOCALE my_locale_ar_DZ= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_DZ *****/ /***** LOCALE BEGIN ar_EG: Arabic - Egypt *****/ -MY_LOCALE my_locale_ar_EG= -{ +MY_LOCALE my_locale_ar_EG +( 59, "ar_EG", "Arabic - Egypt", @@ -1759,12 +1759,12 @@ MY_LOCALE my_locale_ar_EG= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_EG *****/ /***** LOCALE BEGIN ar_IN: Arabic - Iran *****/ -MY_LOCALE my_locale_ar_IN= -{ +MY_LOCALE my_locale_ar_IN +( 60, "ar_IN", "Arabic - Iran", @@ -1773,12 +1773,12 @@ MY_LOCALE my_locale_ar_IN= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_IN *****/ /***** LOCALE BEGIN ar_IQ: Arabic - Iraq *****/ -MY_LOCALE my_locale_ar_IQ= -{ +MY_LOCALE my_locale_ar_IQ +( 61, "ar_IQ", "Arabic - Iraq", @@ -1787,12 +1787,12 @@ MY_LOCALE my_locale_ar_IQ= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_IQ *****/ /***** LOCALE BEGIN ar_KW: Arabic - Kuwait *****/ -MY_LOCALE my_locale_ar_KW= -{ +MY_LOCALE my_locale_ar_KW +( 62, "ar_KW", "Arabic - Kuwait", @@ -1801,12 +1801,12 @@ MY_LOCALE my_locale_ar_KW= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_KW *****/ /***** LOCALE BEGIN ar_LB: Arabic - Lebanon *****/ -MY_LOCALE my_locale_ar_LB= -{ +MY_LOCALE my_locale_ar_LB +( 63, "ar_LB", "Arabic - Lebanon", @@ -1815,12 +1815,12 @@ MY_LOCALE my_locale_ar_LB= &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, &my_locale_typelib_ab_day_names_ar_JO -}; +); /***** LOCALE END ar_LB *****/ /***** LOCALE BEGIN ar_LY: Arabic - Libya *****/ -MY_LOCALE my_locale_ar_LY= -{ +MY_LOCALE my_locale_ar_LY +( 64, "ar_LY", "Arabic - Libya", @@ -1829,12 +1829,12 @@ MY_LOCALE my_locale_ar_LY= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_LY *****/ /***** LOCALE BEGIN ar_MA: Arabic - Morocco *****/ -MY_LOCALE my_locale_ar_MA= -{ +MY_LOCALE my_locale_ar_MA +( 65, "ar_MA", "Arabic - Morocco", @@ -1843,12 +1843,12 @@ MY_LOCALE my_locale_ar_MA= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_MA *****/ /***** LOCALE BEGIN ar_OM: Arabic - Oman *****/ -MY_LOCALE my_locale_ar_OM= -{ +MY_LOCALE my_locale_ar_OM +( 66, "ar_OM", "Arabic - Oman", @@ -1857,12 +1857,12 @@ MY_LOCALE my_locale_ar_OM= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_OM *****/ /***** LOCALE BEGIN ar_QA: Arabic - Qatar *****/ -MY_LOCALE my_locale_ar_QA= -{ +MY_LOCALE my_locale_ar_QA +( 67, "ar_QA", "Arabic - Qatar", @@ -1871,12 +1871,12 @@ MY_LOCALE my_locale_ar_QA= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_QA *****/ /***** LOCALE BEGIN ar_SD: Arabic - Sudan *****/ -MY_LOCALE my_locale_ar_SD= -{ +MY_LOCALE my_locale_ar_SD +( 68, "ar_SD", "Arabic - Sudan", @@ -1885,12 +1885,12 @@ MY_LOCALE my_locale_ar_SD= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_SD *****/ /***** LOCALE BEGIN ar_TN: Arabic - Tunisia *****/ -MY_LOCALE my_locale_ar_TN= -{ +MY_LOCALE my_locale_ar_TN +( 69, "ar_TN", "Arabic - Tunisia", @@ -1899,12 +1899,12 @@ MY_LOCALE my_locale_ar_TN= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_TN *****/ /***** LOCALE BEGIN ar_YE: Arabic - Yemen *****/ -MY_LOCALE my_locale_ar_YE= -{ +MY_LOCALE my_locale_ar_YE +( 70, "ar_YE", "Arabic - Yemen", @@ -1913,12 +1913,12 @@ MY_LOCALE my_locale_ar_YE= &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, &my_locale_typelib_ab_day_names_ar_BH -}; +); /***** LOCALE END ar_YE *****/ /***** LOCALE BEGIN de_BE: German - Belgium *****/ -MY_LOCALE my_locale_de_BE= -{ +MY_LOCALE my_locale_de_BE +( 71, "de_BE", "German - Belgium", @@ -1927,12 +1927,12 @@ MY_LOCALE my_locale_de_BE= &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE -}; +); /***** LOCALE END de_BE *****/ /***** LOCALE BEGIN de_CH: German - Switzerland *****/ -MY_LOCALE my_locale_de_CH= -{ +MY_LOCALE my_locale_de_CH +( 72, "de_CH", "German - Switzerland", @@ -1941,12 +1941,12 @@ MY_LOCALE my_locale_de_CH= &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE -}; +); /***** LOCALE END de_CH *****/ /***** LOCALE BEGIN de_LU: German - Luxembourg *****/ -MY_LOCALE my_locale_de_LU= -{ +MY_LOCALE my_locale_de_LU +( 73, "de_LU", "German - Luxembourg", @@ -1955,12 +1955,12 @@ MY_LOCALE my_locale_de_LU= &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, &my_locale_typelib_ab_day_names_de_DE -}; +); /***** LOCALE END de_LU *****/ /***** LOCALE BEGIN en_AU: English - Australia *****/ -MY_LOCALE my_locale_en_AU= -{ +MY_LOCALE my_locale_en_AU +( 74, "en_AU", "English - Australia", @@ -1969,12 +1969,12 @@ MY_LOCALE my_locale_en_AU= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_AU *****/ /***** LOCALE BEGIN en_CA: English - Canada *****/ -MY_LOCALE my_locale_en_CA= -{ +MY_LOCALE my_locale_en_CA +( 75, "en_CA", "English - Canada", @@ -1983,12 +1983,12 @@ MY_LOCALE my_locale_en_CA= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_CA *****/ /***** LOCALE BEGIN en_GB: English - United Kingdom *****/ -MY_LOCALE my_locale_en_GB= -{ +MY_LOCALE my_locale_en_GB +( 1, "en_GB", "English - United Kingdom", @@ -1997,12 +1997,12 @@ MY_LOCALE my_locale_en_GB= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_GB *****/ /***** LOCALE BEGIN en_IN: English - India *****/ -MY_LOCALE my_locale_en_IN= -{ +MY_LOCALE my_locale_en_IN +( 76, "en_IN", "English - India", @@ -2011,12 +2011,12 @@ MY_LOCALE my_locale_en_IN= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_IN *****/ /***** LOCALE BEGIN en_NZ: English - New Zealand *****/ -MY_LOCALE my_locale_en_NZ= -{ +MY_LOCALE my_locale_en_NZ +( 77, "en_NZ", "English - New Zealand", @@ -2025,12 +2025,12 @@ MY_LOCALE my_locale_en_NZ= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_NZ *****/ /***** LOCALE BEGIN en_PH: English - Philippines *****/ -MY_LOCALE my_locale_en_PH= -{ +MY_LOCALE my_locale_en_PH +( 78, "en_PH", "English - Philippines", @@ -2039,12 +2039,12 @@ MY_LOCALE my_locale_en_PH= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_PH *****/ /***** LOCALE BEGIN en_ZA: English - South Africa *****/ -MY_LOCALE my_locale_en_ZA= -{ +MY_LOCALE my_locale_en_ZA +( 79, "en_ZA", "English - South Africa", @@ -2053,12 +2053,12 @@ MY_LOCALE my_locale_en_ZA= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_ZA *****/ /***** LOCALE BEGIN en_ZW: English - Zimbabwe *****/ -MY_LOCALE my_locale_en_ZW= -{ +MY_LOCALE my_locale_en_ZW +( 80, "en_ZW", "English - Zimbabwe", @@ -2067,12 +2067,12 @@ MY_LOCALE my_locale_en_ZW= &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, &my_locale_typelib_ab_day_names_en_US -}; +); /***** LOCALE END en_ZW *****/ /***** LOCALE BEGIN es_AR: Spanish - Argentina *****/ -MY_LOCALE my_locale_es_AR= -{ +MY_LOCALE my_locale_es_AR +( 81, "es_AR", "Spanish - Argentina", @@ -2081,12 +2081,12 @@ MY_LOCALE my_locale_es_AR= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_AR *****/ /***** LOCALE BEGIN es_BO: Spanish - Bolivia *****/ -MY_LOCALE my_locale_es_BO= -{ +MY_LOCALE my_locale_es_BO +( 82, "es_BO", "Spanish - Bolivia", @@ -2095,12 +2095,12 @@ MY_LOCALE my_locale_es_BO= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_BO *****/ /***** LOCALE BEGIN es_CL: Spanish - Chile *****/ -MY_LOCALE my_locale_es_CL= -{ +MY_LOCALE my_locale_es_CL +( 83, "es_CL", "Spanish - Chile", @@ -2109,12 +2109,12 @@ MY_LOCALE my_locale_es_CL= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_CL *****/ /***** LOCALE BEGIN es_CO: Spanish - Columbia *****/ -MY_LOCALE my_locale_es_CO= -{ +MY_LOCALE my_locale_es_CO +( 84, "es_CO", "Spanish - Columbia", @@ -2123,12 +2123,12 @@ MY_LOCALE my_locale_es_CO= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_CO *****/ /***** LOCALE BEGIN es_CR: Spanish - Costa Rica *****/ -MY_LOCALE my_locale_es_CR= -{ +MY_LOCALE my_locale_es_CR +( 85, "es_CR", "Spanish - Costa Rica", @@ -2137,12 +2137,12 @@ MY_LOCALE my_locale_es_CR= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_CR *****/ /***** LOCALE BEGIN es_DO: Spanish - Dominican Republic *****/ -MY_LOCALE my_locale_es_DO= -{ +MY_LOCALE my_locale_es_DO +( 86, "es_DO", "Spanish - Dominican Republic", @@ -2151,12 +2151,12 @@ MY_LOCALE my_locale_es_DO= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_DO *****/ /***** LOCALE BEGIN es_EC: Spanish - Ecuador *****/ -MY_LOCALE my_locale_es_EC= -{ +MY_LOCALE my_locale_es_EC +( 87, "es_EC", "Spanish - Ecuador", @@ -2165,12 +2165,12 @@ MY_LOCALE my_locale_es_EC= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_EC *****/ /***** LOCALE BEGIN es_GT: Spanish - Guatemala *****/ -MY_LOCALE my_locale_es_GT= -{ +MY_LOCALE my_locale_es_GT +( 88, "es_GT", "Spanish - Guatemala", @@ -2179,12 +2179,12 @@ MY_LOCALE my_locale_es_GT= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_GT *****/ /***** LOCALE BEGIN es_HN: Spanish - Honduras *****/ -MY_LOCALE my_locale_es_HN= -{ +MY_LOCALE my_locale_es_HN +( 89, "es_HN", "Spanish - Honduras", @@ -2193,12 +2193,12 @@ MY_LOCALE my_locale_es_HN= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_HN *****/ /***** LOCALE BEGIN es_MX: Spanish - Mexico *****/ -MY_LOCALE my_locale_es_MX= -{ +MY_LOCALE my_locale_es_MX +( 90, "es_MX", "Spanish - Mexico", @@ -2207,12 +2207,12 @@ MY_LOCALE my_locale_es_MX= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_MX *****/ /***** LOCALE BEGIN es_NI: Spanish - Nicaragua *****/ -MY_LOCALE my_locale_es_NI= -{ +MY_LOCALE my_locale_es_NI +( 91, "es_NI", "Spanish - Nicaragua", @@ -2221,12 +2221,12 @@ MY_LOCALE my_locale_es_NI= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_NI *****/ /***** LOCALE BEGIN es_PA: Spanish - Panama *****/ -MY_LOCALE my_locale_es_PA= -{ +MY_LOCALE my_locale_es_PA +( 92, "es_PA", "Spanish - Panama", @@ -2235,12 +2235,12 @@ MY_LOCALE my_locale_es_PA= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_PA *****/ /***** LOCALE BEGIN es_PE: Spanish - Peru *****/ -MY_LOCALE my_locale_es_PE= -{ +MY_LOCALE my_locale_es_PE +( 93, "es_PE", "Spanish - Peru", @@ -2249,12 +2249,12 @@ MY_LOCALE my_locale_es_PE= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_PE *****/ /***** LOCALE BEGIN es_PR: Spanish - Puerto Rico *****/ -MY_LOCALE my_locale_es_PR= -{ +MY_LOCALE my_locale_es_PR +( 94, "es_PR", "Spanish - Puerto Rico", @@ -2263,12 +2263,12 @@ MY_LOCALE my_locale_es_PR= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_PR *****/ /***** LOCALE BEGIN es_PY: Spanish - Paraguay *****/ -MY_LOCALE my_locale_es_PY= -{ +MY_LOCALE my_locale_es_PY +( 95, "es_PY", "Spanish - Paraguay", @@ -2277,12 +2277,12 @@ MY_LOCALE my_locale_es_PY= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_PY *****/ /***** LOCALE BEGIN es_SV: Spanish - El Salvador *****/ -MY_LOCALE my_locale_es_SV= -{ +MY_LOCALE my_locale_es_SV +( 96, "es_SV", "Spanish - El Salvador", @@ -2291,12 +2291,12 @@ MY_LOCALE my_locale_es_SV= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_SV *****/ /***** LOCALE BEGIN es_US: Spanish - United States *****/ -MY_LOCALE my_locale_es_US= -{ +MY_LOCALE my_locale_es_US +( 97, "es_US", "Spanish - United States", @@ -2305,12 +2305,12 @@ MY_LOCALE my_locale_es_US= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_US *****/ /***** LOCALE BEGIN es_UY: Spanish - Uruguay *****/ -MY_LOCALE my_locale_es_UY= -{ +MY_LOCALE my_locale_es_UY +( 98, "es_UY", "Spanish - Uruguay", @@ -2319,12 +2319,12 @@ MY_LOCALE my_locale_es_UY= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_UY *****/ /***** LOCALE BEGIN es_VE: Spanish - Venezuela *****/ -MY_LOCALE my_locale_es_VE= -{ +MY_LOCALE my_locale_es_VE +( 99, "es_VE", "Spanish - Venezuela", @@ -2333,12 +2333,12 @@ MY_LOCALE my_locale_es_VE= &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, &my_locale_typelib_ab_day_names_es_ES -}; +); /***** LOCALE END es_VE *****/ /***** LOCALE BEGIN fr_BE: French - Belgium *****/ -MY_LOCALE my_locale_fr_BE= -{ +MY_LOCALE my_locale_fr_BE +( 100, "fr_BE", "French - Belgium", @@ -2347,12 +2347,12 @@ MY_LOCALE my_locale_fr_BE= &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR -}; +); /***** LOCALE END fr_BE *****/ /***** LOCALE BEGIN fr_CA: French - Canada *****/ -MY_LOCALE my_locale_fr_CA= -{ +MY_LOCALE my_locale_fr_CA +( 101, "fr_CA", "French - Canada", @@ -2361,12 +2361,12 @@ MY_LOCALE my_locale_fr_CA= &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR -}; +); /***** LOCALE END fr_CA *****/ /***** LOCALE BEGIN fr_CH: French - Switzerland *****/ -MY_LOCALE my_locale_fr_CH= -{ +MY_LOCALE my_locale_fr_CH +( 102, "fr_CH", "French - Switzerland", @@ -2375,12 +2375,12 @@ MY_LOCALE my_locale_fr_CH= &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR -}; +); /***** LOCALE END fr_CH *****/ /***** LOCALE BEGIN fr_LU: French - Luxembourg *****/ -MY_LOCALE my_locale_fr_LU= -{ +MY_LOCALE my_locale_fr_LU +( 103, "fr_LU", "French - Luxembourg", @@ -2389,12 +2389,12 @@ MY_LOCALE my_locale_fr_LU= &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, &my_locale_typelib_ab_day_names_fr_FR -}; +); /***** LOCALE END fr_LU *****/ /***** LOCALE BEGIN it_IT: Italian - Italy *****/ -MY_LOCALE my_locale_it_IT= -{ +MY_LOCALE my_locale_it_IT +( 104, "it_IT", "Italian - Italy", @@ -2403,12 +2403,12 @@ MY_LOCALE my_locale_it_IT= &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, &my_locale_typelib_ab_day_names_it_CH -}; +); /***** LOCALE END it_IT *****/ /***** LOCALE BEGIN nl_BE: Dutch - Belgium *****/ -MY_LOCALE my_locale_nl_BE= -{ +MY_LOCALE my_locale_nl_BE +( 105, "nl_BE", "Dutch - Belgium", @@ -2417,12 +2417,12 @@ MY_LOCALE my_locale_nl_BE= &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, &my_locale_typelib_ab_day_names_nl_NL -}; +); /***** LOCALE END nl_BE *****/ /***** LOCALE BEGIN no_NO: Norwegian - Norway *****/ -MY_LOCALE my_locale_no_NO= -{ +MY_LOCALE my_locale_no_NO +( 106, "no_NO", "Norwegian - Norway", @@ -2431,12 +2431,12 @@ MY_LOCALE my_locale_no_NO= &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, &my_locale_typelib_ab_day_names_nb_NO -}; +); /***** LOCALE END no_NO *****/ /***** LOCALE BEGIN sv_FI: Swedish - Finland *****/ -MY_LOCALE my_locale_sv_FI= -{ +MY_LOCALE my_locale_sv_FI +( 107, "sv_FI", "Swedish - Finland", @@ -2445,12 +2445,12 @@ MY_LOCALE my_locale_sv_FI= &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, &my_locale_typelib_ab_day_names_sv_SE -}; +); /***** LOCALE END sv_FI *****/ /***** LOCALE BEGIN zh_HK: Chinese - Hong Kong SAR *****/ -MY_LOCALE my_locale_zh_HK= -{ +MY_LOCALE my_locale_zh_HK +( 108, "zh_HK", "Chinese - Hong Kong SAR", @@ -2459,7 +2459,7 @@ MY_LOCALE my_locale_zh_HK= &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, &my_locale_typelib_ab_day_names_zh_CN -}; +); /***** LOCALE END zh_HK *****/ From 0b5696b82b8c60ebdb70fd267f32479d0bb96ab5 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Wed, 6 Dec 2006 16:32:12 +0400 Subject: [PATCH 019/160] Fix for bug #22533: Traditional: Too-long bit value not rejected. Problem: storing >=8 byte hexadecimal values we don't check data. Fix: check if the data fits the {u}longlong range. --- mysql-test/r/select.result | 17 +++++++++++++++++ mysql-test/t/range.test | 4 ++-- mysql-test/t/select.test | 13 ++++++++++++- sql/item.cc | 25 +++++++++++++++++++------ 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index f09143fcaa6..6dc971a953c 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2819,3 +2819,20 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; min(key1) 0.37619999051094 DROP TABLE t1,t2; +create table t1(a bigint unsigned, b bigint); +insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), +(0x10000000000000000, 0x10000000000000000), +(0x8fffffffffffffff, 0x8fffffffffffffff); +Warnings: +Warning 1264 Data truncated; out of range for column 'a' at row 1 +Warning 1264 Data truncated; out of range for column 'b' at row 1 +Warning 1264 Data truncated; out of range for column 'a' at row 2 +Warning 1264 Data truncated; out of range for column 'b' at row 2 +Warning 1264 Data truncated; out of range for column 'b' at row 3 +select hex(a), hex(b) from t1; +hex(a) hex(b) +FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +drop table t1; +End of 4.1 tests diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 245178d7d4a..6d3b2fb52ee 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -400,8 +400,8 @@ select count(*) from t1 where x = 18446744073709551601; create table t2 (x bigint not null); -insert into t2(x) values (0xfffffffffffffff0); -insert into t2(x) values (0xfffffffffffffff1); +insert into t2(x) values (-16); +insert into t2(x) values (-15); select * from t2; select count(*) from t2 where x>0; select count(*) from t2 where x=0; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 3f9fb59d26f..0dc179e9b4b 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2342,4 +2342,15 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; DROP TABLE t1,t2; --enable_ps_protocol -# End of 4.1 tests +# +# Bug #22533: storing large hex strings +# + +create table t1(a bigint unsigned, b bigint); +insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), + (0x10000000000000000, 0x10000000000000000), + (0x8fffffffffffffff, 0x8fffffffffffffff); +select hex(a), hex(b) from t1; +drop table t1; + +--echo End of 4.1 tests diff --git a/sql/item.cc b/sql/item.cc index 94f0a24fcc3..30f34f9ec3b 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2340,18 +2340,31 @@ longlong Item_varbinary::val_int() int Item_varbinary::save_in_field(Field *field, bool no_conversions) { - int error; field->set_notnull(); if (field->result_type() == STRING_RESULT) + return field->store(str_value.ptr(), str_value.length(), + collation.collation); + + ulonglong nr; + uint32 length= str_value.length(); + if (length > 8) { - error=field->store(str_value.ptr(),str_value.length(),collation.collation); + nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX; + goto warn; } - else + nr= (ulonglong) val_int(); + if ((length == 8) && !(field->flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX)) { - longlong nr=val_int(); - error=field->store(nr); + nr= LONGLONG_MAX; + goto warn; } - return error; + return field->store((longlong) nr); + +warn: + if (!field->store((longlong) nr)) + field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, + 1); + return 1; } From 07ee2594e5ee739a3ee35347bbca7f56556427c8 Mon Sep 17 00:00:00 2001 From: "jpipes@shakedown.(none)" <> Date: Wed, 6 Dec 2006 19:13:00 -0500 Subject: [PATCH 020/160] Fix for Bug #20246 (enum mysql_enum_shutdown_level not well-defined in mysql_com.h) MYSQL_VERSION_ID is tested before it has been defined. This leads to a warning when compiling with -Wundef and it also will break the internal logic of mysql_com.h as soon as MYSQL_VERSION_ID exceeds 50000. The fix entailed a simple re-ordering of included files in mysql.h --- include/mysql.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mysql.h b/include/mysql.h index 55ef6ee6d10..d0b8f57903d 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -65,9 +65,9 @@ typedef int my_socket; #endif /* my_socket_defined */ #endif /* _global_h */ +#include "mysql_version.h" #include "mysql_com.h" #include "mysql_time.h" -#include "mysql_version.h" #include "typelib.h" #include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ From b66f34bd19bb5a6c32e84bf86f9af56df0f0e99b Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 7 Dec 2006 09:31:53 +0400 Subject: [PATCH 021/160] Bug#22645 LC_TIME_NAMES: Statement not replicated Implementing event based replication of LC_TIME_NAMES for 5.0 (as a replacement of previously made ONE_SHOT replication) --- mysql-test/r/mysqlbinlog.result | 20 ++++++++++++++++++ mysql-test/r/rpl_locale.result | 4 ++++ mysql-test/t/disabled.def | 1 - mysql-test/t/mysqlbinlog.test | 19 +++++++++++++++++ mysql-test/t/rpl_locale.test | 2 ++ sql/log_event.cc | 37 ++++++++++++++++++++++++++++++--- sql/log_event.h | 7 ++++++- 7 files changed, 85 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index c3be791b523..0b8e84188ef 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -194,4 +194,24 @@ select * from t5 /* must be (1),(1) */; a 1 1 +flush logs; +drop table if exists t5; +create table t5 (c1 int, c2 varchar(128) character set latin1 not null); +insert into t5 values (1, date_format('2001-01-01','%W')); +set lc_time_names=de_DE; +insert into t5 values (2, date_format('2001-01-01','%W')); +set lc_time_names=en_US; +insert into t5 values (3, date_format('2001-01-01','%W')); +select * from t5 order by c1; +c1 c2 +1 Monday +2 Montag +3 Monday +flush logs; +drop table t5; +select * from t5 order by c1; +c1 c2 +1 Monday +2 Montag +3 Monday drop table t1, t2, t03, t04, t3, t4, t5; diff --git a/mysql-test/r/rpl_locale.result b/mysql-test/r/rpl_locale.result index 5de5bab9a0b..b7396084663 100644 --- a/mysql-test/r/rpl_locale.result +++ b/mysql-test/r/rpl_locale.result @@ -7,10 +7,14 @@ start slave; create table t1 (s1 char(10)); set lc_time_names= 'de_DE'; insert into t1 values (date_format('2001-01-01','%W')); +set lc_time_names= 'en_US'; +insert into t1 values (date_format('2001-01-01','%W')); select * from t1; s1 Montag +Monday select * from t1; s1 Montag +Monday drop table t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index bff70a306b3..eaea7c710b0 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,6 +11,5 @@ ############################################################################## ndb_load : Bug#17233 -rpl_locale : Bug#22645 user_limits : Bug#23921 random failure of user_limits.test diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 0691cb7c76b..c2fe0e3e8e0 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -134,6 +134,25 @@ flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL select * from t5 /* must be (1),(1) */; +# +# Bug#22645 LC_TIME_NAMES: Statement not replicated +# Check that a dump created by mysqlbinlog reproduces +# lc_time_names dependent values correctly +# +flush logs; +drop table if exists t5; +create table t5 (c1 int, c2 varchar(128) character set latin1 not null); +insert into t5 values (1, date_format('2001-01-01','%W')); +set lc_time_names=de_DE; +insert into t5 values (2, date_format('2001-01-01','%W')); +set lc_time_names=en_US; +insert into t5 values (3, date_format('2001-01-01','%W')); +select * from t5 order by c1; +flush logs; +drop table t5; +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL +select * from t5 order by c1; + # clean up drop table t1, t2, t03, t04, t3, t4, t5; diff --git a/mysql-test/t/rpl_locale.test b/mysql-test/t/rpl_locale.test index 530a3d77636..2f2d637e1b4 100644 --- a/mysql-test/t/rpl_locale.test +++ b/mysql-test/t/rpl_locale.test @@ -9,6 +9,8 @@ connection master; create table t1 (s1 char(10)); set lc_time_names= 'de_DE'; insert into t1 values (date_format('2001-01-01','%W')); +set lc_time_names= 'en_US'; +insert into t1 values (date_format('2001-01-01','%W')); select * from t1; sync_slave_with_master; connection slave; diff --git a/sql/log_event.cc b/sql/log_event.cc index 30490f75c0f..9eea2387e54 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1088,7 +1088,8 @@ bool Query_log_event::write(IO_CACHE* file) 1+1+FN_REFLEN+ // code of catalog and catalog length and catalog 1+4+ // code of autoinc and the 2 autoinc variables 1+6+ // code of charset and charset - 1+1+MAX_TIME_ZONE_NAME_LENGTH // code of tz and tz length and tz name + 1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name + 1+2 // code of lc_time_names and lc_time_names ], *start, *start_of_status; ulong event_length; @@ -1200,6 +1201,13 @@ bool Query_log_event::write(IO_CACHE* file) memcpy(start, time_zone_str, time_zone_len); start+= time_zone_len; } + if (lc_time_names_number) + { + DBUG_ASSERT(lc_time_names_number <= 0xFFFF); + *start++= Q_LC_TIME_NAMES_CODE; + int2store(start, lc_time_names_number); + start+= 2; + } /* Here there could be code like if (command-line-option-which-says-"log_this_variable" && inited) @@ -1264,7 +1272,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, flags2_inited(1), sql_mode_inited(1), charset_inited(1), sql_mode(thd_arg->variables.sql_mode), auto_increment_increment(thd_arg->variables.auto_increment_increment), - auto_increment_offset(thd_arg->variables.auto_increment_offset) + auto_increment_offset(thd_arg->variables.auto_increment_offset), + lc_time_names_number(thd_arg->variables.lc_time_names->number) { time_t end_time; time(&end_time); @@ -1334,7 +1343,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, db(NullS), catalog_len(0), status_vars_len(0), flags2_inited(0), sql_mode_inited(0), charset_inited(0), auto_increment_increment(1), auto_increment_offset(1), - time_zone_len(0) + time_zone_len(0), lc_time_names_number(0) { ulong data_len; uint32 tmp; @@ -1435,6 +1444,10 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, pos+= catalog_len+2; // leap over end 0 catalog_nz= 0; // catalog has end 0 in event break; + case Q_LC_TIME_NAMES_CODE: + lc_time_names_number= uint2korr(pos); + pos+= 2; + break; default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -1619,6 +1632,11 @@ void Query_log_event::print_query_header(FILE* file, memcpy(print_event_info->time_zone_str, time_zone_str, time_zone_len+1); } } + if (lc_time_names_number != print_event_info->lc_time_names_number) + { + fprintf(file, "SET @@session.lc_time_names=%d;\n", lc_time_names_number); + print_event_info->lc_time_names_number= lc_time_names_number; + } } @@ -1771,6 +1789,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, goto compare_errors; } } + if (lc_time_names_number) + { + if (!(thd->variables.lc_time_names= + my_locale_by_number(lc_time_names_number))) + { + my_printf_error(ER_UNKNOWN_ERROR, + "Unknown locale: '%d'", MYF(0), lc_time_names_number); + thd->variables.lc_time_names= &my_locale_en_US; + goto compare_errors; + } + } + else + thd->variables.lc_time_names= &my_locale_en_US; /* Execute the query (note that we bypass dispatch_command()) */ mysql_parse(thd, thd->query, thd->query_length); diff --git a/sql/log_event.h b/sql/log_event.h index 247e1962776..18be3c761b6 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -271,6 +271,8 @@ struct sql_ex_info */ #define Q_CATALOG_NZ_CODE 6 +#define Q_LC_TIME_NAMES_CODE 7 + /* Intvar event post-header */ #define I_TYPE_OFFSET 0 @@ -507,9 +509,11 @@ typedef struct st_print_event_info bool charset_inited; char charset[6]; // 3 variables, each of them storable in 2 bytes char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; + uint lc_time_names_number; st_print_event_info() :flags2_inited(0), sql_mode_inited(0), - auto_increment_increment(1),auto_increment_offset(1), charset_inited(0) + auto_increment_increment(1),auto_increment_offset(1), charset_inited(0), + lc_time_names_number(0) { /* Currently we only use static PRINT_EVENT_INFO objects, so zeroed at @@ -784,6 +788,7 @@ public: char charset[6]; uint time_zone_len; /* 0 means uninited */ const char *time_zone_str; + uint lc_time_names_number; /* 0 means en_US */ #ifndef MYSQL_CLIENT From 9f36c1c286ebf411ef3eda0a88ab563c18898edd Mon Sep 17 00:00:00 2001 From: "cbell/Chuck@suse.vabb.com" <> Date: Thu, 7 Dec 2006 09:18:35 -0500 Subject: [PATCH 022/160] WL#3618 - Remove HAVE_ROW_BASED_REPLICATION from source code. Please see worklog for details on files changed. --- config/ac-macros/ha_ndbcluster.m4 | 5 +-- config/ac-macros/replication.m4 | 30 -------------- configure.in | 1 - include/config-win.h | 1 - include/my_global.h | 3 -- libmysqld/CMakeLists.txt | 3 +- mysql-test/extra/rpl_tests/rpl_row_basic.test | 1 - mysql-test/extra/rpl_tests/rpl_truncate.test | 1 - mysql-test/include/have_row_based.inc | 4 -- mysql-test/include/not_row_based.inc | 4 -- mysql-test/r/have_row_based.require | 2 - mysql-test/r/not_row_based.require | 2 - mysql-test/t/rpl_rbr_to_sbr.test | 1 - mysql-test/t/rpl_row_basic_11bugs.test | 1 - mysql-test/t/rpl_row_basic_8partition.test | 1 - mysql-test/t/rpl_row_max_relay_size.test | 1 - mysql-test/t/rpl_switch_stm_row_mixed.test | 1 - sql/CMakeLists.txt | 3 +- sql/handler.cc | 8 ---- sql/item_create.cc | 4 -- sql/log.cc | 30 +------------- sql/log.h | 2 - sql/log_event.cc | 17 ++++---- sql/log_event.h | 10 ++--- sql/mysql_priv.h | 3 -- sql/mysqld.cc | 40 ------------------- sql/rpl_injector.cc | 3 -- sql/rpl_injector.h | 2 - sql/set_var.cc | 9 ----- sql/set_var.h | 4 -- sql/sp_head.cc | 2 - sql/sp_head.h | 2 - sql/sql_base.cc | 6 --- sql/sql_class.cc | 17 -------- sql/sql_class.h | 15 ------- sql/sql_insert.cc | 9 ----- sql/sql_lex.cc | 2 - sql/sql_lex.h | 2 - sql/sql_load.cc | 2 - sql/sql_view.cc | 2 - sql/table.cc | 5 --- 41 files changed, 15 insertions(+), 246 deletions(-) delete mode 100644 config/ac-macros/replication.m4 delete mode 100644 mysql-test/include/have_row_based.inc delete mode 100644 mysql-test/include/not_row_based.inc delete mode 100644 mysql-test/r/have_row_based.require delete mode 100644 mysql-test/r/not_row_based.require diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index a722f8f1d7d..1e82a7d7ce1 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -229,10 +229,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ if test X"$ndb_binlog" = Xdefault || test X"$ndb_binlog" = Xyes then - if test X"$have_row_based" = Xyes - then - have_ndb_binlog="yes" - fi + have_ndb_binlog="yes" fi if test X"$have_ndb_binlog" = Xyes diff --git a/config/ac-macros/replication.m4 b/config/ac-macros/replication.m4 deleted file mode 100644 index babfa000a82..00000000000 --- a/config/ac-macros/replication.m4 +++ /dev/null @@ -1,30 +0,0 @@ -dnl This file contains configuration parameters for replication. - -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_REPLICATION -dnl Sets HAVE_ROW_BASED_REPLICATION if --with-row-based-replication is used -dnl --------------------------------------------------------------------------- - -AC_DEFUN([MYSQL_CHECK_REPLICATION], [ - AC_ARG_WITH([row-based-replication], - AC_HELP_STRING([--without-row-based-replication], - [Don't include row-based replication]), - [row_based="$withval"], - [row_based=yes]) - AC_MSG_CHECKING([for row-based replication]) - - case "$row_based" in - yes ) - AC_DEFINE([WITH_ROW_BASED_REPLICATION], [1], [Define to have row-based replication]) - AC_MSG_RESULT([-- including row-based replication]) - [have_row_based=yes] - ;; - * ) - AC_MSG_RESULT([-- not including row-based replication]) - [have_row_based=no] - ;; - esac -]) -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_REPLICATION -dnl --------------------------------------------------------------------------- diff --git a/configure.in b/configure.in index b858f62927a..18fc1b5292e 100644 --- a/configure.in +++ b/configure.in @@ -2154,7 +2154,6 @@ AC_MSG_RESULT("$netinet_inc") MYSQL_CHECK_BIG_TABLES MYSQL_CHECK_MAX_INDEXES -MYSQL_CHECK_REPLICATION MYSQL_CHECK_VIO MYSQL_CHECK_SSL diff --git a/include/config-win.h b/include/config-win.h index 5290cf83896..4f48e410a33 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -436,7 +436,6 @@ inline double ulonglong2double(ulonglong value) #define HAVE_SPATIAL 1 #define HAVE_RTREE_KEYS 1 -#define HAVE_ROW_BASED_REPLICATION 1 #define HAVE_OPENSSL 1 #define HAVE_YASSL 1 diff --git a/include/my_global.h b/include/my_global.h index a7ec41068b3..c06982c78ed 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -79,9 +79,6 @@ #endif /* _WIN32... */ #ifndef EMBEDDED_LIBRARY -#ifdef WITH_ROW_BASED_REPLICATION -#define HAVE_ROW_BASED_REPLICATION 1 -#endif #ifdef WITH_NDB_BINLOG #define HAVE_NDB_BINLOG 1 #endif diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index d752d905568..c80501c29ca 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -3,8 +3,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") # Need to set USE_TLS, since __declspec(thread) approach to thread local # storage does not work properly in DLLs. -ADD_DEFINITIONS(-DUSE_TLS -DHAVE_ROW_BASED_REPLICATION -DMYSQL_SERVER - -DEMBEDDED_LIBRARY) +ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_SERVER -DEMBEDDED_LIBRARY) # The old Windows build method used renamed (.cc -> .cpp) source files, fails # in #include in lib_sql.cc. So disable that using the USING_CMAKE define. diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test index ea2c4c1688c..c2001091b45 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -1,4 +1,3 @@ ---source include/have_row_based.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc diff --git a/mysql-test/extra/rpl_tests/rpl_truncate.test b/mysql-test/extra/rpl_tests/rpl_truncate.test index 37fd9fbc064..bca53336514 100644 --- a/mysql-test/extra/rpl_tests/rpl_truncate.test +++ b/mysql-test/extra/rpl_tests/rpl_truncate.test @@ -7,7 +7,6 @@ # # Author(s): Mats Kindahl ---source include/have_row_based.inc --source include/master-slave.inc let $format = STATEMENT; diff --git a/mysql-test/include/have_row_based.inc b/mysql-test/include/have_row_based.inc deleted file mode 100644 index 23771fde5cc..00000000000 --- a/mysql-test/include/have_row_based.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/have_row_based.require -disable_query_log; -show variables like "have_row_based_replication"; -enable_query_log; diff --git a/mysql-test/include/not_row_based.inc b/mysql-test/include/not_row_based.inc deleted file mode 100644 index 22f40bdceb0..00000000000 --- a/mysql-test/include/not_row_based.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/not_row_based.require -disable_query_log; -show variables like "have_row_based_replication"; -enable_query_log; diff --git a/mysql-test/r/have_row_based.require b/mysql-test/r/have_row_based.require deleted file mode 100644 index c71451a95c3..00000000000 --- a/mysql-test/r/have_row_based.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_row_based_replication YES diff --git a/mysql-test/r/not_row_based.require b/mysql-test/r/not_row_based.require deleted file mode 100644 index e30e73320fb..00000000000 --- a/mysql-test/r/not_row_based.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_row_based_replication NO diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test index 0c5368197b3..379b1edec02 100644 --- a/mysql-test/t/rpl_rbr_to_sbr.test +++ b/mysql-test/t/rpl_rbr_to_sbr.test @@ -1,4 +1,3 @@ --- source include/have_row_based.inc -- source include/have_binlog_format_mixed_or_statement.inc -- source include/not_ndb_default.inc -- source include/master-slave.inc diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test index 37bfd01e260..5b28af75d33 100644 --- a/mysql-test/t/rpl_row_basic_11bugs.test +++ b/mysql-test/t/rpl_row_basic_11bugs.test @@ -1,4 +1,3 @@ ---source include/have_row_based.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/t/rpl_row_basic_8partition.test b/mysql-test/t/rpl_row_basic_8partition.test index f262ef05c58..687b3bc785d 100644 --- a/mysql-test/t/rpl_row_basic_8partition.test +++ b/mysql-test/t/rpl_row_basic_8partition.test @@ -7,7 +7,6 @@ # partition tables with same engine (MyISAM) in both ends. # ############################################################ ---source include/have_row_based.inc --source include/have_binlog_format_row.inc --source include/have_partition.inc --source include/not_ndb_default.inc diff --git a/mysql-test/t/rpl_row_max_relay_size.test b/mysql-test/t/rpl_row_max_relay_size.test index eb3f63db8aa..a0be59e44a7 100644 --- a/mysql-test/t/rpl_row_max_relay_size.test +++ b/mysql-test/t/rpl_row_max_relay_size.test @@ -5,7 +5,6 @@ # Requires statement logging -- source include/not_ndb_default.inc --- source include/have_row_based.inc SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; -- source extra/rpl_tests/rpl_max_relay_size.test diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test index d345b62b8eb..ccd505941c8 100644 --- a/mysql-test/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/t/rpl_switch_stm_row_mixed.test @@ -1,4 +1,3 @@ --- source include/have_row_based.inc -- source include/not_ndb_default.inc -- source include/master-slave.inc diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 4cdc4c01c4e..69754924b4d 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -22,8 +22,7 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc ${PROJECT_SOURCE_DIR}/include/sql_state.h PROPERTIES GENERATED 1) -ADD_DEFINITIONS(-DHAVE_ROW_BASED_REPLICATION -DMYSQL_SERVER - -D_CONSOLE -DHAVE_DLOPEN) +ADD_DEFINITIONS(-DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN) ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc diff --git a/sql/handler.cc b/sql/handler.cc index f16876f2ffd..8d4f4aec428 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3455,7 +3455,6 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) - table is not mysql.event */ -#ifdef HAVE_ROW_BASED_REPLICATION /* The Sun compiler cannot instantiate the template below if this is declared static, but it works by putting it into an anonymous namespace. */ @@ -3608,7 +3607,6 @@ namespace binlog_log_row(TABLE *, const byte *, const byte *); } -#endif /* HAVE_ROW_BASED_REPLICATION */ int handler::ha_external_lock(THD *thd, int lock_type) { @@ -3649,10 +3647,8 @@ int handler::ha_write_row(byte *buf) int error; if (unlikely(error= write_row(buf))) return error; -#ifdef HAVE_ROW_BASED_REPLICATION if (unlikely(error= binlog_log_row(table, 0, buf))) return error; -#endif return 0; } @@ -3668,10 +3664,8 @@ int handler::ha_update_row(const byte *old_data, byte *new_data) if (unlikely(error= update_row(old_data, new_data))) return error; -#ifdef HAVE_ROW_BASED_REPLICATION if (unlikely(error= binlog_log_row(table, old_data, new_data))) return error; -#endif return 0; } @@ -3680,10 +3674,8 @@ int handler::ha_delete_row(const byte *buf) int error; if (unlikely(error= delete_row(buf))) return error; -#ifdef HAVE_ROW_BASED_REPLICATION if (unlikely(error= binlog_log_row(table, buf, 0))) return error; -#endif return 0; } diff --git a/sql/item_create.cc b/sql/item_create.cc index 7722ce28d4a..05802a22b9c 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -2288,9 +2288,7 @@ Create_udf_func::create(THD *thd, udf_func *udf, List *item_list) if (item_list != NULL) arg_count= item_list->elements; -#ifdef HAVE_ROW_BASED_REPLICATION thd->lex->binlog_row_based_if_mixed= TRUE; -#endif DBUG_ASSERT( (udf->type == UDFTYPE_FUNCTION) || (udf->type == UDFTYPE_AGGREGATE)); @@ -4446,9 +4444,7 @@ Create_func_uuid Create_func_uuid::s_singleton; Item* Create_func_uuid::create(THD *thd) { -#ifdef HAVE_ROW_BASED_REPLICATION thd->lex->binlog_row_based_if_mixed= TRUE; -#endif return new (thd->mem_root) Item_func_uuid(); } diff --git a/sql/log.cc b/sql/log.cc index 620445aecfa..cfca0a94ff0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -87,18 +87,14 @@ char *make_default_log_name(char *buff,const char* log_ext) class binlog_trx_data { public: binlog_trx_data() -#ifdef HAVE_ROW_BASED_REPLICATION : m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF) -#endif { trans_log.end_of_file= max_binlog_cache_size; } ~binlog_trx_data() { -#ifdef HAVE_ROW_BASED_REPLICATION DBUG_ASSERT(pending() == NULL); -#endif close_cached_file(&trans_log); } @@ -108,11 +104,7 @@ public: bool empty() const { -#ifdef HAVE_ROW_BASED_REPLICATION return pending() == NULL && my_b_tell(&trans_log) == 0; -#else - return my_b_tell(&trans_log) == 0; -#endif } /* @@ -121,10 +113,8 @@ public: */ void truncate(my_off_t pos) { -#ifdef HAVE_ROW_BASED_REPLICATION delete pending(); set_pending(0); -#endif reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0); } @@ -135,13 +125,10 @@ public: void reset() { if (!empty()) truncate(0); -#ifdef HAVE_ROW_BASED_REPLICATION before_stmt_pos= MY_OFF_T_UNDEF; -#endif trans_log.end_of_file= max_binlog_cache_size; } -#ifdef HAVE_ROW_BASED_REPLICATION Rows_log_event *pending() const { return m_pending; @@ -151,12 +138,10 @@ public: { m_pending= pending; } -#endif IO_CACHE trans_log; // The transaction cache private: -#ifdef HAVE_ROW_BASED_REPLICATION /* Pending binrows event. This event is the event where the rows are currently written. @@ -168,7 +153,6 @@ public: Binlog position before the start of the current statement. */ my_off_t before_stmt_pos; -#endif }; handlerton *binlog_hton; @@ -1468,9 +1452,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, were, we would have to ensure that we're not ending a statement inside a stored function. */ -#ifdef HAVE_ROW_BASED_REPLICATION thd->binlog_flush_pending_rows_event(TRUE); -#endif /* We write the transaction cache to the binary log if either we're committing the entire transaction, or if we are doing an @@ -1480,13 +1462,11 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, { error= mysql_bin_log.write(thd, &trx_data->trans_log, end_ev); trx_data->reset(); -#ifdef HAVE_ROW_BASED_REPLICATION /* We need to step the table map version after writing the transaction cache to disk. */ mysql_bin_log.update_table_map_version(); -#endif statistic_increment(binlog_cache_use, &LOCK_status); if (trans_log->disk_writes != 0) { @@ -1495,7 +1475,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, } } } -#ifdef HAVE_ROW_BASED_REPLICATION else { /* @@ -1518,7 +1497,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, */ mysql_bin_log.update_table_map_version(); } -#endif DBUG_RETURN(error); } @@ -3385,7 +3363,6 @@ int THD::binlog_setup_trx_data() DBUG_RETURN(0); } -#ifdef HAVE_ROW_BASED_REPLICATION /* Function to start a statement and optionally a transaction for the binary log. @@ -3593,7 +3570,6 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, DBUG_RETURN(error); } -#endif /*HAVE_ROW_BASED_REPLICATION*/ /* Write an event to the binary log @@ -3626,11 +3602,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) we are inside a stored function, we do not end the statement since this will close all tables on the slave. */ -#ifdef HAVE_ROW_BASED_REPLICATION bool const end_stmt= thd->prelocked_mode && thd->lex->requires_prelocking(); thd->binlog_flush_pending_rows_event(end_stmt); -#endif /*HAVE_ROW_BASED_REPLICATION*/ pthread_mutex_lock(&LOCK_log); @@ -3660,7 +3634,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) } #endif /* HAVE_REPLICATION */ -#if defined(USING_TRANSACTIONS) && defined(HAVE_ROW_BASED_REPLICATION) +#if defined(USING_TRANSACTIONS) /* Should we write to the binlog cache or to the binlog on disk? Write to the binlog cache if: @@ -3695,7 +3669,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) LOCK_log. */ } -#endif /* USING_TRANSACTIONS && HAVE_ROW_BASED_REPLICATION */ +#endif /* USING_TRANSACTIONS */ DBUG_PRINT("info",("event type: %d",event_info->get_type_code())); /* diff --git a/sql/log.h b/sql/log.h index f39b52f5db2..66a388d7017 100644 --- a/sql/log.h +++ b/sql/log.h @@ -601,14 +601,12 @@ public: enum enum_binlog_format { BINLOG_FORMAT_STMT= 0, // statement-based -#ifdef HAVE_ROW_BASED_REPLICATION BINLOG_FORMAT_ROW= 1, // row_based /* statement-based except for cases where only row-based can work (UUID() etc): */ BINLOG_FORMAT_MIXED= 2, -#endif /* This value is last, after the end of binlog_format_typelib: it has no corresponding cell in this typelib. We use this value to be able to know if diff --git a/sql/log_event.cc b/sql/log_event.cc index 7bb4a72edfa..4822daf5fe8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -994,7 +994,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, case FORMAT_DESCRIPTION_EVENT: ev = new Format_description_log_event(buf, event_len, description_event); break; -#if defined(HAVE_REPLICATION) && defined(HAVE_ROW_BASED_REPLICATION) +#if defined(HAVE_REPLICATION) case WRITE_ROWS_EVENT: ev = new Write_rows_log_event(buf, event_len, description_event); break; @@ -5287,8 +5287,6 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format) } -#ifdef HAVE_ROW_BASED_REPLICATION - /************************************************************************** Rows_log_event member functions **************************************************************************/ @@ -5553,8 +5551,8 @@ unpack_row(RELAY_LOG_INFO *rli, if (bitmap_is_set(cols, field_ptr - begin_ptr)) { - DBUG_ASSERT(table->record[0] <= f->ptr); - DBUG_ASSERT(f->ptr < table->record[0] + table->s->reclength + (f->pack_length_in_rec() == 0)); + DBUG_ASSERT((char *)table->record[0] <= f->ptr); + DBUG_ASSERT(f->ptr < (char *)table->record[0] + table->s->reclength + (f->pack_length_in_rec() == 0)); f->move_field_offset(offset); DBUG_PRINT("info", ("unpacking column '%s' to 0x%lx", f->field_name, f->ptr)); @@ -6838,8 +6836,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", (char *)table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", (char *)table->record[1], table->s->reclength); #endif /* @@ -6865,8 +6863,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", (char *)table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", (char *)table->record[1], table->s->reclength); #endif /* Below is a minor "optimization". If the key (i.e., key number @@ -7279,4 +7277,3 @@ void Update_rows_log_event::print(FILE *file, } #endif -#endif /* defined(HAVE_ROW_BASED_REPLICATION) */ diff --git a/sql/log_event.h b/sql/log_event.h index c3f015e723c..8ffbfa7743c 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1689,8 +1689,6 @@ public: #endif char *str_to_hex(char *to, const char *from, uint len); -#ifdef HAVE_ROW_BASED_REPLICATION - /***************************************************************************** Table map log event class @@ -2019,7 +2017,7 @@ public: Write_rows_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); #endif -#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION) +#if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, MY_BITMAP *cols, @@ -2084,7 +2082,7 @@ public: const Format_description_log_event *description_event); #endif -#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION) +#if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, MY_BITMAP *cols, @@ -2154,7 +2152,7 @@ public: Delete_rows_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); #endif -#if !defined(MYSQL_CLIENT) && defined(HAVE_ROW_BASED_REPLICATION) +#if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, MY_BITMAP *cols, @@ -2188,6 +2186,4 @@ private: #endif }; -#endif /* HAVE_ROW_BASED_REPLICATION */ - #endif /* _log_event_h */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e30da1f2f0b..63303b3e04d 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1557,9 +1557,7 @@ extern ulong query_buff_size, thread_stack; extern ulong max_prepared_stmt_count, prepared_stmt_count; extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit; extern ulong max_binlog_size, max_relay_log_size; -#ifdef HAVE_ROW_BASED_REPLICATION extern ulong opt_binlog_rows_event_max_size; -#endif extern ulong rpl_recovery_rank, thread_cache_size; extern ulong back_log; extern ulong specialflag, current_pid; @@ -1664,7 +1662,6 @@ extern handlerton *partition_hton; extern handlerton *myisam_hton; extern handlerton *heap_hton; -extern SHOW_COMP_OPTION have_row_based_replication; extern SHOW_COMP_OPTION have_openssl, have_symlink, have_dlopen; extern SHOW_COMP_OPTION have_query_cache; extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d5d155d0072..84ed32f72f4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -28,9 +28,7 @@ #include "../storage/myisam/ha_myisam.h" -#ifdef HAVE_ROW_BASED_REPLICATION #include "rpl_injector.h" -#endif #ifdef WITH_INNOBASE_STORAGE_ENGINE #define OPT_INNODB_DEFAULT 1 @@ -437,12 +435,8 @@ volatile bool mqh_used = 0; my_bool opt_noacl; my_bool sp_automatic_privileges= 1; -#ifdef HAVE_ROW_BASED_REPLICATION ulong opt_binlog_rows_event_max_size; const char *binlog_format_names[]= {"STATEMENT", "ROW", "MIXED", NullS}; -#else -const char *binlog_format_names[]= {"STATEMENT", NullS}; -#endif TYPELIB binlog_format_typelib= { array_elements(binlog_format_names)-1,"", binlog_format_names, NULL }; @@ -554,7 +548,6 @@ CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *national_charset_info, *table_alias_charset; CHARSET_INFO *character_set_filesystem; -SHOW_COMP_OPTION have_row_based_replication; SHOW_COMP_OPTION have_openssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_crypt, have_compress; @@ -1162,9 +1155,7 @@ void clean_up(bool print_message) what they have that is dependent on the binlog */ ha_binlog_end(current_thd); -#ifdef HAVE_ROW_BASED_REPLICATION injector::free_instance(); -#endif mysql_bin_log.cleanup(); #ifdef HAVE_REPLICATION @@ -3149,11 +3140,7 @@ with --log-bin instead."); } if (global_system_variables.binlog_format == BINLOG_FORMAT_UNSPEC) { -#if defined(HAVE_ROW_BASED_REPLICATION) global_system_variables.binlog_format= BINLOG_FORMAT_MIXED; -#else - global_system_variables.binlog_format= BINLOG_FORMAT_STMT; -#endif } /* Check that we have not let the format to unspecified at this point */ @@ -4691,9 +4678,7 @@ enum options_mysqld #ifndef DBUG_OFF OPT_BINLOG_SHOW_XID, #endif -#ifdef HAVE_ROW_BASED_REPLICATION OPT_BINLOG_ROWS_EVENT_MAX_SIZE, -#endif OPT_WANT_CORE, OPT_CONCURRENT_INSERT, OPT_MEMLOCK, OPT_MYISAM_RECOVER, OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, @@ -4903,7 +4888,6 @@ struct my_option my_long_options[] = (gptr*) &my_bind_addr_str, (gptr*) &my_bind_addr_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"binlog_format", OPT_BINLOG_FORMAT, -#ifdef HAVE_ROW_BASED_REPLICATION "Tell the master the form of binary logging to use: either 'row' for " "row-based binary logging, or 'statement' for statement-based binary " "logging, or 'mixed'. 'mixed' is statement-based binary logging except " @@ -4912,18 +4896,9 @@ struct my_option my_long_options[] = "those, row-based binary logging is automatically used. " #ifdef HAVE_NDB_BINLOG "If ndbcluster is enabled, the default is 'row'." -#endif -#else - "Tell the master the form of binary logging to use: this build " - "supports only statement-based binary logging, so only 'statement' is " - "a legal value." #endif , 0, 0, 0, GET_STR, REQUIRED_ARG, -#ifdef HAVE_ROW_BASED_REPLICATION BINLOG_FORMAT_MIXED -#else - BINLOG_FORMAT_STMT -#endif , 0, 0, 0, 0, 0 }, {"binlog-do-db", OPT_BINLOG_DO_DB, "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", @@ -4931,7 +4906,6 @@ struct my_option my_long_options[] = {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB, "Tells the master that updates to the given database should not be logged tothe binary log.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_ROW_BASED_REPLICATION {"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE, "The maximum size of a row-based binary log event in bytes. Rows will be " "grouped into events smaller than this size if possible. " @@ -4943,7 +4917,6 @@ struct my_option my_long_options[] = /* sub_size */ 0, /* block_size */ 256, /* app_type */ 0 }, -#endif {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE, @@ -5204,11 +5177,9 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite, "If equal to 0 (the default), then when --log-bin is used, creation of " "a stored function (or trigger) is allowed only to users having the SUPER privilege " "and only if this stored function (trigger) may not break binary logging." -#ifdef HAVE_ROW_BASED_REPLICATION "Note that if ALL connections to this server ALWAYS use row-based binary " "logging, the security issues do not exist and the binary logging cannot " "break, so you can safely set this to 1." -#endif ,(gptr*) &trust_function_creators, (gptr*) &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-error", OPT_ERROR_LOG_FILE, "Error log file.", @@ -7056,11 +7027,6 @@ static void mysql_init_variables(void) #else have_partition_db= SHOW_OPTION_NO; #endif -#ifdef HAVE_ROW_BASED_REPLICATION - have_row_based_replication= SHOW_OPTION_YES; -#else - have_row_based_replication= SHOW_OPTION_NO; -#endif #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE have_ndbcluster=SHOW_OPTION_DISABLED; global_system_variables.ndb_index_stat_enable=FALSE; @@ -7291,7 +7257,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int id; if ((id= find_type(argument, &binlog_format_typelib, 2)) <= 0) { -#ifdef HAVE_ROW_BASED_REPLICATION fprintf(stderr, "Unknown binary log format: '%s' " "(should be one of '%s', '%s', '%s')\n", @@ -7299,11 +7264,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), binlog_format_names[BINLOG_FORMAT_STMT], binlog_format_names[BINLOG_FORMAT_ROW], binlog_format_names[BINLOG_FORMAT_MIXED]); -#else - fprintf(stderr, - "Unknown binary log format: '%s' (only legal value is '%s')\n", - argument, binlog_format_names[BINLOG_FORMAT_STMT]); -#endif exit(1); } global_system_variables.binlog_format= id-1; diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 3a0fca4dfa5..eba6d24d557 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -17,7 +17,6 @@ #include "mysql_priv.h" #include "rpl_injector.h" -#ifdef HAVE_ROW_BASED_REPLICATION /* injector::transaction - member definitions @@ -191,5 +190,3 @@ void injector::new_trans(THD *thd, injector::transaction *ptr) DBUG_VOID_RETURN; } - -#endif diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 48df30e8ac8..95f93f0681b 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -21,7 +21,6 @@ /* Pull in 'byte', 'my_off_t', and 'uint32' */ #include -#ifdef HAVE_ROW_BASED_REPLICATION #include /* Forward declarations */ @@ -331,5 +330,4 @@ private: */ }; -#endif /* HAVE_ROW_BASED_REPLICATION */ #endif /* INJECTOR_H */ diff --git a/sql/set_var.cc b/sql/set_var.cc index 5590e71c810..f2a0313dd93 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -682,7 +682,6 @@ sys_var_have_variable sys_have_query_cache("have_query_cache", &have_query_cache); sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys); sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink); -sys_var_have_variable sys_have_row_based_replication("have_row_based_replication",&have_row_based_replication); /* Global read-only variable describing server license */ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE)); @@ -809,7 +808,6 @@ SHOW_VAR init_vars[]= { {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE}, {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE}, {sys_have_query_cache.name, (char*) &have_query_cache, SHOW_HAVE}, - {sys_have_row_based_replication.name, (char*) &have_row_based_replication, SHOW_HAVE}, {sys_have_rtree_keys.name, (char*) &have_rtree_keys, SHOW_HAVE}, {sys_have_symlink.name, (char*) &have_symlink, SHOW_HAVE}, {"init_connect", (char*) &sys_init_connect, SHOW_SYS}, @@ -1324,10 +1322,6 @@ bool sys_var_thd_binlog_format::is_readonly() const If we don't have row-based replication compiled in, the variable is always read-only. */ -#ifndef HAVE_ROW_BASED_REPLICATION - my_error(ER_RBR_NOT_AVAILABLE, MYF(0)); - return 1; -#else if ((thd->variables.binlog_format == BINLOG_FORMAT_ROW) && thd->temporary_tables) { @@ -1352,16 +1346,13 @@ bool sys_var_thd_binlog_format::is_readonly() const return 1; } #endif /* HAVE_NDB_BINLOG */ -#endif /* HAVE_ROW_BASED_REPLICATION */ return sys_var_thd_enum::is_readonly(); } void fix_binlog_format_after_update(THD *thd, enum_var_type type) { -#ifdef HAVE_ROW_BASED_REPLICATION thd->reset_current_stmt_binlog_row_based(); -#endif /*HAVE_ROW_BASED_REPLICATION*/ } diff --git a/sql/set_var.h b/sql/set_var.h index 01669b378e1..6135fdee159 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -940,9 +940,7 @@ public: } }; -#ifdef HAVE_ROW_BASED_REPLICATION extern void fix_binlog_format_after_update(THD *thd, enum_var_type type); -#endif class sys_var_thd_binlog_format :public sys_var_thd_enum { @@ -950,9 +948,7 @@ public: sys_var_thd_binlog_format(const char *name_arg, ulong SV::*offset_arg) :sys_var_thd_enum(name_arg, offset_arg, &binlog_format_typelib -#ifdef HAVE_ROW_BASED_REPLICATION , fix_binlog_format_after_update -#endif ) {}; bool is_readonly() const; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 48c24248bc5..dfce2879ea7 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1850,7 +1850,6 @@ sp_head::restore_lex(THD *thd) oldlex->next_state= sublex->next_state; oldlex->trg_table_fields.push_back(&sublex->trg_table_fields); -#ifdef HAVE_ROW_BASED_REPLICATION /* If this substatement needs row-based, the entire routine does too (we cannot switch from statement-based to row-based only for this @@ -1858,7 +1857,6 @@ sp_head::restore_lex(THD *thd) */ if (sublex->binlog_row_based_if_mixed) m_flags|= BINLOG_ROW_BASED_IF_MIXED; -#endif /* Add routines which are used by statement to respective set for diff --git a/sql/sp_head.h b/sql/sp_head.h index 41ed5256840..f1efb1d195e 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -362,7 +362,6 @@ public: */ void propagate_attributes(LEX *lex) { -#ifdef HAVE_ROW_BASED_REPLICATION /* If this routine needs row-based binary logging, the entire top statement too (we cannot switch from statement-based to row-based only for this @@ -371,7 +370,6 @@ public: */ if (m_flags & BINLOG_ROW_BASED_IF_MIXED) lex->binlog_row_based_if_mixed= TRUE; -#endif } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 28bc1e9dcbf..76280471a99 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1064,9 +1064,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived) handled either before writing a query log event (inside binlog_query()) or when preparing a pending event. */ -#ifdef HAVE_ROW_BASED_REPLICATION thd->binlog_flush_pending_rows_event(TRUE); -#endif /*HAVE_ROW_BASED_REPLICATION*/ mysql_unlock_tables(thd, thd->lock); thd->lock=0; } @@ -3312,13 +3310,11 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) *need_reopen= FALSE; -#ifdef HAVE_ROW_BASED_REPLICATION /* CREATE ... SELECT UUID() locks no tables, we have to test here. */ if (thd->lex->binlog_row_based_if_mixed) thd->set_current_stmt_binlog_row_based_if_mixed(); -#endif /*HAVE_ROW_BASED_REPLICATION*/ if (!tables && !thd->lex->requires_prelocking()) DBUG_RETURN(0); @@ -3350,7 +3346,6 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) { thd->in_lock_tables=1; thd->options|= OPTION_TABLE_LOCK; -#ifdef HAVE_ROW_BASED_REPLICATION /* If we have >= 2 different tables to update with auto_inc columns, statement-based binlogging won't work. We can solve this problem in @@ -3362,7 +3357,6 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) thd->lex->binlog_row_based_if_mixed= TRUE; thd->set_current_stmt_binlog_row_based_if_mixed(); } -#endif } if (! (thd->lock= mysql_lock_tables(thd, start, (uint) (ptr - start), diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 20acb28bc77..5f4a00be710 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -204,9 +204,7 @@ THD::THD() Open_tables_state(refresh_version), rli_fake(0), lock_id(&main_lock_id), user_time(0), in_sub_stmt(0), -#ifdef HAVE_ROW_BASED_REPLICATION binlog_table_maps(0), -#endif /*HAVE_ROW_BASED_REPLICATION*/ global_read_lock(0), is_fatal_error(0), rand_used(0), time_zone_used(0), arg_of_last_insert_id_function(FALSE), @@ -267,9 +265,7 @@ THD::THD() system_thread= NON_SYSTEM_THREAD; cleanup_done= abort_on_warning= no_warnings_for_error= 0; peer_port= 0; // For SHOW PROCESSLIST -#ifdef HAVE_ROW_BASED_REPLICATION transaction.m_pending_rows_event= 0; -#endif #ifdef __WIN__ real_id = 0; #endif @@ -349,9 +345,7 @@ void THD::init(void) bzero((char*) warn_count, sizeof(warn_count)); total_warn_count= 0; update_charset(); -#ifdef HAVE_ROW_BASED_REPLICATION reset_current_stmt_binlog_row_based(); -#endif /*HAVE_ROW_BASED_REPLICATION*/ bzero((char *) &status_var, sizeof(status_var)); variables.lc_time_names = &my_locale_en_US; } @@ -2334,7 +2328,6 @@ void xid_cache_delete(XID_STATE *xid_state) */ #ifndef MYSQL_CLIENT -#ifdef HAVE_ROW_BASED_REPLICATION /* Template member function for ensuring that there is an rows log @@ -2825,8 +2818,6 @@ void THD::binlog_delete_pending_rows_event() } } -#endif /* HAVE_ROW_BASED_REPLICATION */ - /* Member function that will log query, either row-based or statement-based depending on the value of the 'current_stmt_binlog_row_based' @@ -2867,18 +2858,14 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, If we are in prelocked mode, the flushing will be done inside the top-most close_thread_tables(). */ -#ifdef HAVE_ROW_BASED_REPLICATION if (this->prelocked_mode == NON_PRELOCKED) if (int error= binlog_flush_pending_rows_event(TRUE)) DBUG_RETURN(error); -#endif /*HAVE_ROW_BASED_REPLICATION*/ switch (qtype) { case THD::ROW_QUERY_TYPE: -#ifdef HAVE_ROW_BASED_REPLICATION if (current_stmt_binlog_row_based) DBUG_RETURN(0); -#endif /* Otherwise, we fall through */ case THD::MYSQL_QUERY_TYPE: /* @@ -2896,9 +2883,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, */ { Query_log_event qinfo(this, query, query_len, is_trans, suppress_use); -#ifdef HAVE_ROW_BASED_REPLICATION qinfo.flags|= LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F; -#endif /* Binlog table maps will be irrelevant after a Query_log_event (they are just removed on the slave side) so after the query @@ -2906,9 +2891,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, table maps were written. */ int error= mysql_bin_log.write(&qinfo); -#ifdef HAVE_ROW_BASED_REPLICATION binlog_table_maps= 0; -#endif /*HAVE_ROW_BASED_REPLICATION*/ DBUG_RETURN(error); } break; diff --git a/sql/sql_class.h b/sql/sql_class.h index 2cf7de5ee9e..fb64086c957 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -930,8 +930,6 @@ public: #ifndef MYSQL_CLIENT int binlog_setup_trx_data(); -#ifdef HAVE_ROW_BASED_REPLICATION - /* Public interface to write RBR events to the binlog */ @@ -985,7 +983,6 @@ public: uint get_binlog_table_maps() const { return binlog_table_maps; } -#endif /* HAVE_ROW_BASED_REPLICATION */ #endif /* MYSQL_CLIENT */ #ifndef MYSQL_CLIENT @@ -1024,9 +1021,7 @@ public: XID xid; // transaction identifier enum xa_states xa_state; // used by external XA only XID_STATE xid_state; -#ifdef HAVE_ROW_BASED_REPLICATION Rows_log_event *m_pending_rows_event; -#endif /* Tables changed in transaction (that must be invalidated in query cache). @@ -1533,7 +1528,6 @@ public: void restore_active_arena(Query_arena *set, Query_arena *backup); inline void set_current_stmt_binlog_row_based_if_mixed() { -#ifdef HAVE_ROW_BASED_REPLICATION /* If in a stored/function trigger, the caller should already have done the change. We test in_sub_stmt to prevent introducing bugs where people @@ -1546,23 +1540,17 @@ public: if ((variables.binlog_format == BINLOG_FORMAT_MIXED) && (in_sub_stmt == 0)) current_stmt_binlog_row_based= TRUE; -#endif } inline void set_current_stmt_binlog_row_based() { -#ifdef HAVE_ROW_BASED_REPLICATION current_stmt_binlog_row_based= TRUE; -#endif } inline void clear_current_stmt_binlog_row_based() { -#ifdef HAVE_ROW_BASED_REPLICATION current_stmt_binlog_row_based= FALSE; -#endif } inline void reset_current_stmt_binlog_row_based() { -#ifdef HAVE_ROW_BASED_REPLICATION /* If there are temporary tables, don't reset back to statement-based. Indeed it could be that: @@ -1586,9 +1574,6 @@ public: current_stmt_binlog_row_based= test(variables.binlog_format == BINLOG_FORMAT_ROW); } -#else - current_stmt_binlog_row_based= FALSE; -#endif } /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index dcb4152f64f..39740f30d47 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2279,7 +2279,6 @@ bool delayed_insert::handle_inserts(void) thd.proc_info=0; pthread_mutex_unlock(&mutex); -#ifdef HAVE_ROW_BASED_REPLICATION /* We need to flush the pending event when using row-based replication since the flushing normally done in binlog_query() is @@ -2294,7 +2293,6 @@ bool delayed_insert::handle_inserts(void) */ if (thd.current_stmt_binlog_row_based) thd.binlog_flush_pending_rows_event(TRUE); -#endif /* HAVE_ROW_BASED_REPLICATION */ if ((error=table->file->extra(HA_EXTRA_NO_CACHE))) { // This shouldn't happen @@ -2948,7 +2946,6 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) DBUG_ENTER("select_create::prepare"); TABLEOP_HOOKS *hook_ptr= NULL; -#ifdef HAVE_ROW_BASED_REPLICATION class MY_HOOKS : public TABLEOP_HOOKS { public: MY_HOOKS(select_create *x) : ptr(x) { } @@ -2970,11 +2967,9 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) MY_HOOKS hooks(this); hook_ptr= &hooks; -#endif unit= u; -#ifdef HAVE_ROW_BASED_REPLICATION /* Start a statement transaction before the create if we are creating a non-temporary table and are using row-based replication for the @@ -2985,7 +2980,6 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) { thd->binlog_start_trans_and_stmt(); } -#endif if (!(table= create_table_from_items(thd, create_info, create_table, extra_fields, keys, &values, @@ -3029,8 +3023,6 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) DBUG_RETURN(0); } - -#ifdef HAVE_ROW_BASED_REPLICATION void select_create::binlog_show_create_table(TABLE **tables, uint count) { @@ -3071,7 +3063,6 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) /* is_trans */ TRUE, /* suppress_use */ FALSE); } -#endif // HAVE_ROW_BASED_REPLICATION void select_create::store_values(List &values) { diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c35ef4079d3..ce2059fec45 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1658,9 +1658,7 @@ void Query_tables_list::reset_query_tables_list(bool init) sroutines_list.empty(); sroutines_list_own_last= sroutines_list.next; sroutines_list_own_elements= 0; -#ifdef HAVE_ROW_BASED_REPLICATION binlog_row_based_if_mixed= FALSE; -#endif } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7e09675cb0a..4572ccb6365 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -811,7 +811,6 @@ public: byte **sroutines_list_own_last; uint sroutines_list_own_elements; -#ifdef HAVE_ROW_BASED_REPLICATION /* Tells if the parsing stage detected that some items require row-based binlogging to give a reliable binlog/replication, or if we will use @@ -819,7 +818,6 @@ public: binlogging. */ bool binlog_row_based_if_mixed; -#endif /* These constructor and destructor serve for creation/destruction diff --git a/sql/sql_load.cc b/sql/sql_load.cc index b85610eaa6f..9f75b52daef 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -465,7 +465,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, #ifndef EMBEDDED_LIBRARY if (mysql_bin_log.is_open()) { -#ifdef HAVE_ROW_BASED_REPLICATION /* We need to do the job that is normally done inside binlog_query() here, which is to ensure that the pending event @@ -477,7 +476,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (thd->current_stmt_binlog_row_based) thd->binlog_flush_pending_rows_event(true); else -#endif { /* As already explained above, we need to call end_io_cache() or the last diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 98226c1651b..01ea87ee8c4 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1090,14 +1090,12 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, table->next_global= view_tables; } -#ifdef HAVE_ROW_BASED_REPLICATION /* If the view's body needs row-based binlogging (e.g. the VIEW is created from SELECT UUID()), the top statement also needs it. */ if (lex->binlog_row_based_if_mixed) old_lex->binlog_row_based_if_mixed= TRUE; -#endif bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE && lex->can_be_merged()); TABLE_LIST *view_main_select_tables; diff --git a/sql/table.cc b/sql/table.cc index 7f80b95c954..4d4bc836cc3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -123,7 +123,6 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, share->version= refresh_version; share->flush_version= flush_version; -#ifdef HAVE_ROW_BASED_REPLICATION /* This constant is used to mark that no table map version has been assigned. No arithmetic is done on the value: it will be @@ -141,8 +140,6 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, share->table_map_id= ~0UL; share->cached_row_logging_check= -1; -#endif - memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root)); pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST); pthread_cond_init(&share->cond, NULL); @@ -194,7 +191,6 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key, share->path.length= share->normalized_path.length= strlen(path); share->frm_version= FRM_VER_TRUE_VARCHAR; -#ifdef HAVE_ROW_BASED_REPLICATION /* Temporary tables are not replicated, but we set up these fields anyway to be able to catch errors. @@ -202,7 +198,6 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key, share->table_map_version= ~(ulonglong)0; share->table_map_id= ~0UL; share->cached_row_logging_check= -1; -#endif DBUG_VOID_RETURN; } From ecbb4eb987c50060e8f33be9857de35168035d65 Mon Sep 17 00:00:00 2001 From: "Kristofer.Pettersson@naruto." <> Date: Thu, 7 Dec 2006 17:01:00 +0100 Subject: [PATCH 023/160] Bug#17498 failed to put data file in custom directory use "data directory" option - Using DATA/INDEX DIRECTORY option on Windows put data/index file into default directory because the OS doesn't support readlink(). - The procedure for changing data/index file directory is different under Windows. - With this fix we report a warning if DATA/INDEX option is used, but OS doesn't support readlink(). --- mysql-test/r/windows.result | 6 ++++++ mysql-test/t/windows.test | 9 +++++++++ sql/sql_parse.cc | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result index 039c5b1476e..1702fd28c18 100644 --- a/mysql-test/r/windows.result +++ b/mysql-test/r/windows.result @@ -6,3 +6,9 @@ use prn; ERROR 42000: Unknown database 'prn' create table nu (a int); drop table nu; +drop table if exists t1; +CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM; +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +drop table t1; diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test index d6bcfeb8cb3..b5377a9b9b0 100644 --- a/mysql-test/t/windows.test +++ b/mysql-test/t/windows.test @@ -17,4 +17,13 @@ use prn; create table nu (a int); drop table nu; +# +# Bug17489: ailed to put data file in custom directory use "data directory" option +# +--disable_warnings +drop table if exists t1; +--enable_warnings +CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM; +drop table t1; + # End of 4.1 tests diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cb2fa0f7014..9f443fae215 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2485,6 +2485,12 @@ mysql_execute_command(THD *thd) goto unsent_create_error; #ifndef HAVE_READLINK + if (lex->create_info.data_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "DATA DIRECTORY option ignored"); + if (lex->create_info.index_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "INDEX DIRECTORY option ignored"); lex->create_info.data_file_name=lex->create_info.index_file_name=0; #else /* Fix names if symlinked tables */ From 38346fa9da4256fe69452c4fd9b8c403025991bd Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Thu, 7 Dec 2006 12:53:32 -0500 Subject: [PATCH 024/160] Having MYSQL_VERSION_ID defined correctly made this KILL_QUERY enum item visible. This is a forwards-incompatible change. --- include/mysql_h.ic | 1 + 1 file changed, 1 insertion(+) diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 0e546acef92..286c42500ec 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -575,6 +575,7 @@ enum mysql_enum_shutdown_level SHUTDOWN_WAIT_UPDATES = (unsigned char)((1 << 3)), SHUTDOWN_WAIT_ALL_BUFFERS = ((unsigned char)((1 << 3)) << 1), SHUTDOWN_WAIT_CRITICAL_BUFFERS = (((unsigned char)((1 << 3)) << 1) + 1), + KILL_QUERY = 254, KILL_CONNECTION = 255, }; # 154 "mysql.h" From 19725c0b37bac1abc98000aca0d16ace05b929e0 Mon Sep 17 00:00:00 2001 From: "cbell/Chuck@suse.vabb.com" <> Date: Thu, 7 Dec 2006 15:00:01 -0500 Subject: [PATCH 025/160] WL#3618 Minor correction to configure script to remove the replication.m4 script. --- configure.in | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.in b/configure.in index 18fc1b5292e..fe596b27860 100644 --- a/configure.in +++ b/configure.in @@ -35,7 +35,6 @@ sinclude(config/ac-macros/ha_ndbcluster.m4) sinclude(config/ac-macros/large_file.m4) sinclude(config/ac-macros/misc.m4) sinclude(config/ac-macros/readline.m4) -sinclude(config/ac-macros/replication.m4) sinclude(config/ac-macros/ssl.m4) sinclude(config/ac-macros/zlib.m4) From 90072e69b3270409fc1caf988db774ab1f4e04a9 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Fri, 8 Dec 2006 02:20:09 +0300 Subject: [PATCH 026/160] A fix and test cases for Bug#4968 "Stored procedure crash if cursor opened on altered table" Bug#19733 "Repeated alter, or repeated create/drop, fails" Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from stored procedure." Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing" Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server" Test cases for bugs 4968, 19733, 6895 will be added in 5.0. Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE statements in stored routines or as prepared statements caused incorrect results (and crashes in versions prior to 5.0.25). In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options). The problem of bugs 4968, 19733, 19282 and 6895 was that functions mysql_prepare_table, mysql_create_table and mysql_alter_table were not re-execution friendly: during their operation they used to modify contents of LEX (members create_info, alter_info, key_list, create_list), thus making the LEX unusable for the next execution. In particular, these functions removed processed columns and keys from create_list, key_list and drop_list. Search the code in sql_table.cc for drop_it.remove() and similar patterns to find evidence. The fix is to supply to these functions a usable copy of each of the above structures at every re-execution of an SQL statement. To simplify memory management, LEX::key_list and LEX::create_list were added to LEX::alter_info, a fresh copy of which is created for every execution. The problem of crashing bug 22060 stemmed from the fact that the above metnioned functions were not only modifying HA_CREATE_INFO structure in LEX, but also were changing it to point to areas in volatile memory of the execution memory root. The patch solves this problem by creating and using an on-stack copy of HA_CREATE_INFO (note that code in 5.1 already creates and uses a copy of this structure in mysql_create_table()/alter_table(), but this approach didn't work well for CREATE TABLE SELECT statement). --- mysql-test/r/ps.result | 67 ++++++++ mysql-test/t/ps.test | 72 ++++++++ sql/mysql_priv.h | 19 +-- sql/sql_class.h | 19 ++- sql/sql_insert.cc | 2 +- sql/sql_lex.cc | 12 ++ sql/sql_lex.h | 56 ++++++- sql/sql_list.h | 74 ++++++-- sql/sql_parse.cc | 206 ++++++++++++----------- sql/sql_show.cc | 2 +- sql/sql_table.cc | 373 +++++++++++------------------------------ sql/sql_yacc.yy | 50 +++--- 12 files changed, 511 insertions(+), 441 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 94c51fdc18b..0d6b01f3481 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1035,4 +1035,71 @@ EXECUTE stmt USING @a; 0 0 DEALLOCATE PREPARE stmt; DROP TABLE t1; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (i INT); +PREPARE st_19182 +FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1"; +EXECUTE st_19182; +DESC t2; +Field Type Null Key Default Extra +j int(11) YES MUL NULL +i int(11) YES MUL NULL +DROP TABLE t2; +EXECUTE st_19182; +DESC t2; +Field Type Null Key Default Extra +j int(11) YES MUL NULL +i int(11) YES MUL NULL +DEALLOCATE PREPARE st_19182; +DROP TABLE t2, t1; +drop database if exists mysqltest; +drop table if exists t1, t2; +create database mysqltest character set utf8; +prepare stmt1 from "create table mysqltest.t1 (c char(10))"; +prepare stmt2 from "create table mysqltest.t2 select 'test'"; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +show create table mysqltest.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `test` char(4) character set latin1 NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table mysqltest.t1; +drop table mysqltest.t2; +alter database mysqltest character set latin1; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) character set utf8 default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table mysqltest.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `test` char(4) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop database mysqltest; +deallocate prepare stmt1; +deallocate prepare stmt2; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +deallocate prepare stmt; End of 4.1 tests. diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index fbeaaa494e0..cd6c0667898 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1068,5 +1068,77 @@ EXECUTE stmt USING @a; DEALLOCATE PREPARE stmt; DROP TABLE t1; +# +# Bug#19182: CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work +# from stored procedure. +# +# The cause of a bug was that cached LEX::create_list was modified, +# and then together with LEX::key_list was reset. +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +CREATE TABLE t1 (i INT); + +PREPARE st_19182 +FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1"; + +EXECUTE st_19182; +DESC t2; + +DROP TABLE t2; + +# Check that on second execution we don't loose 'j' column and the keys +# on 'i' and 'j' columns. +EXECUTE st_19182; +DESC t2; + +DEALLOCATE PREPARE st_19182; +DROP TABLE t2, t1; + +# +# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server" +# +# Code which implemented CREATE/ALTER TABLE and CREATE DATABASE +# statement modified HA_CREATE_INFO structure in LEX, making these +# statements PS/SP-unsafe (their re-execution might have resulted +# in incorrect results). +# +--disable_warnings +drop database if exists mysqltest; +drop table if exists t1, t2; +--enable_warnings +# CREATE TABLE and CREATE TABLE ... SELECT +create database mysqltest character set utf8; +prepare stmt1 from "create table mysqltest.t1 (c char(10))"; +prepare stmt2 from "create table mysqltest.t2 select 'test'"; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +show create table mysqltest.t2; +drop table mysqltest.t1; +drop table mysqltest.t2; +alter database mysqltest character set latin1; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +show create table mysqltest.t2; +drop database mysqltest; +deallocate prepare stmt1; +deallocate prepare stmt2; +# CREATE TABLE with DATA DIRECTORY option +--disable_query_log +eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; +--enable_query_log +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +deallocate prepare stmt; +# --echo End of 4.1 tests. diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8d6cdebe1f7..0a14f947554 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -563,25 +563,22 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, uint &key_count, int select_field_count); int mysql_create_table(THD *thd,const char *db, const char *table_name, HA_CREATE_INFO *create_info, - List &fields, List &keys, + Alter_info *alter_info, bool tmp_table, uint select_field_count); TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, const char *db, const char *name, - List *extra_fields, - List *keys, + Alter_info *alter_info, List *items, MYSQL_LOCK **lock); int mysql_alter_table(THD *thd, char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, - List &fields, - List &keys, + Alter_info *alter_info, uint order_num, ORDER *order, enum enum_duplicates handle_duplicates, - bool ignore, - ALTER_INFO *alter_info, bool do_send_ok=1); -int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok); + bool ignore); +int mysql_recreate_table(THD *thd, TABLE_LIST *table_list); int mysql_create_like_table(THD *thd, TABLE_LIST *table, HA_CREATE_INFO *create_info, Table_ident *src_table); @@ -590,9 +587,6 @@ bool mysql_rename_table(enum db_type base, const char * old_name, const char *new_db, const char * new_name); -int mysql_create_index(THD *thd, TABLE_LIST *table_list, List &keys); -int mysql_drop_index(THD *thd, TABLE_LIST *table_list, - ALTER_INFO *alter_info); int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, TABLE_LIST *update_table_list, Item **conds, uint order_num, ORDER *order); @@ -679,7 +673,8 @@ int get_quote_char_for_identifier(THD *thd, const char *name, uint length); void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1); int mysqld_show_create(THD *thd, TABLE_LIST *table_list); -int mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create); +int mysqld_show_create_db(THD *thd, char *dbname, + const HA_CREATE_INFO *create); void mysqld_list_processes(THD *thd,const char *user,bool verbose); int mysqld_show_status(THD *thd); diff --git a/sql/sql_class.h b/sql/sql_class.h index 16abfe2b6b6..8ecbaf7e5a7 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1293,20 +1293,21 @@ class select_create: public select_insert { ORDER *group; const char *db; const char *name; - List *extra_fields; - List *keys; HA_CREATE_INFO *create_info; + Alter_info *alter_info; MYSQL_LOCK *lock; Field **field; public: select_create(const char *db_name, const char *table_name, - HA_CREATE_INFO *create_info_par, - List &fields_par, - List &keys_par, - List &select_fields,enum_duplicates duplic, bool ignore) - :select_insert (NULL, &select_fields, duplic, ignore), db(db_name), - name(table_name), extra_fields(&fields_par),keys(&keys_par), - create_info(create_info_par), lock(0) + HA_CREATE_INFO *create_info_arg, + Alter_info *alter_info_arg, + List &select_fields, + enum_duplicates duplic, bool ignore) + :select_insert(NULL, &select_fields, duplic, ignore), + db(db_name), name(table_name), + create_info(create_info_arg), + alter_info(alter_info_arg), + lock(0) {} int prepare(List &list, SELECT_LEX_UNIT *u); void store_values(List &values); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 43c7e5d456f..394a80c4efb 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1808,7 +1808,7 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) unit= u; table= create_table_from_items(thd, create_info, db, name, - extra_fields, keys, &values, &lock); + alter_info, &values, &lock); if (!table) DBUG_RETURN(-1); // abort() deletes table diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index dfe406c351e..270fdb3f20a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1015,6 +1015,18 @@ int yylex(void *arg, void *yythd) } } + +Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) + :drop_list(rhs.drop_list, mem_root), + alter_list(rhs.alter_list, mem_root), + key_list(rhs.key_list, mem_root), + create_list(rhs.create_list, mem_root), + flags(rhs.flags), + keys_onoff(rhs.keys_onoff), + tablespace_op(rhs.tablespace_op), + is_simple(rhs.is_simple) +{} + /* st_select_lex structures initialisations */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 12f89202e2d..7faeb8046c7 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -571,19 +571,61 @@ typedef class st_select_lex SELECT_LEX; #define ALTER_ORDER 64 #define ALTER_OPTIONS 128 -typedef struct st_alter_info +/** + @brief Parsing data for CREATE or ALTER TABLE. + + This structure contains a list of columns or indexes to be created, + altered or dropped. +*/ + +class Alter_info { +public: List drop_list; List alter_list; + List key_list; + List create_list; uint flags; enum enum_enable_or_disable keys_onoff; enum tablespace_op_type tablespace_op; bool is_simple; - st_alter_info(){clear();} - void clear(){keys_onoff= LEAVE_AS_IS;tablespace_op= NO_TABLESPACE_OP;} - void reset(){drop_list.empty();alter_list.empty();clear();} -} ALTER_INFO; + Alter_info() : + flags(0), + keys_onoff(LEAVE_AS_IS), + tablespace_op(NO_TABLESPACE_OP), + is_simple(1) + {} + void reset() + { + drop_list.empty(); + alter_list.empty(); + key_list.empty(); + create_list.empty(); + flags= 0; + keys_onoff= LEAVE_AS_IS; + tablespace_op= NO_TABLESPACE_OP; + is_simple= 1; + } + /** + Construct a copy of this object to be used for mysql_alter_table + and mysql_create_table. Historically, these two functions modify + their Alter_info arguments. This behaviour breaks re-execution of + prepared statements and stored procedures and is compensated by + always supplying a copy of Alter_info to these functions. + The constructed copy still shares key Key, Alter_drop, create_field + and Alter_column elements of the lists - these structures are not + modified and thus are not copied. + + @note You need to use check thd->is_fatal_error for out + of memory condition after calling this function. + */ + Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root); +private: + Alter_info &operator=(const Alter_info &rhs); // not implemented + Alter_info(const Alter_info &rhs); // not implemented +}; + /* The state of the lex parsing. This is saved in the THD struct */ @@ -620,8 +662,6 @@ typedef struct st_lex List interval_list; List users_list; List columns; - List key_list; - List create_list; List *insert_list,field_list,value_list,update_list; List many_values; List var_list; @@ -654,7 +694,7 @@ typedef struct st_lex bool derived_tables; bool safe_to_cache_query; bool subqueries, ignore; - ALTER_INFO alter_info; + Alter_info alter_info; /* Prepared statements SQL syntax:*/ LEX_STRING prepared_stmt_name; /* Statement name (in all queries) */ /* diff --git a/sql/sql_list.h b/sql/sql_list.h index e799ecf3d6e..47379ab1ddf 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -66,21 +66,24 @@ public: pointer. */ -class list_node :public Sql_alloc + +/** + list_node - a node of a single-linked list. + @note We never call a destructor for instances of this class. +*/ + +struct list_node :public Sql_alloc { -public: list_node *next; void *info; list_node(void *info_par,list_node *next_par) :next(next_par),info(info_par) - {} + {} list_node() /* For end_of_list */ - { - info=0; - next= this; - } - friend class base_list; - friend class base_list_iterator; + { + info= 0; + next= this; + } }; @@ -96,11 +99,56 @@ public: inline void empty() { elements=0; first= &end_of_list; last=&first;} inline base_list() { empty(); } + /** + This is a shallow copy constructor that implicitly passes the ownership + from the source list to the new instance. The old instance is not + updated, so both objects end up sharing the same nodes. If one of + the instances then adds or removes a node, the other becomes out of + sync ('last' pointer), while still operational. Some old code uses and + relies on this behaviour. This logic is quite tricky: please do not use + it in any new code. + */ inline base_list(const base_list &tmp) :Sql_alloc() { - elements=tmp.elements; - first=tmp.first; - last=tmp.last; + elements= tmp.elements; + first= tmp.first; + last= elements ? tmp.last : &first; + } + /** + Construct a deep copy of the argument in memory root mem_root. + The elements themselves are copied by pointer. + */ + inline base_list(const base_list &rhs, MEM_ROOT *mem_root) + { + if (rhs.elements) + { + /* + It's okay to allocate an array of nodes at once: we never + call a destructor for list_node objects anyway. + */ + first= (list_node*) alloc_root(mem_root, + sizeof(list_node) * rhs.elements); + if (first) + { + elements= rhs.elements; + list_node *dst= first; + list_node *src= rhs.first; + for (; dst < first + elements - 1; dst++, src= src->next) + { + dst->info= src->info; + dst->next= dst + 1; + } + /* Copy the last node */ + dst->info= src->info; + dst->next= &end_of_list; + /* Setup 'last' member */ + last= &dst->next; + return; + } + } + elements= 0; + first= &end_of_list; + last= &first; } inline base_list(bool error) { } inline bool push_back(void *info) @@ -327,6 +375,8 @@ template class List :public base_list public: inline List() :base_list() {} inline List(const List &tmp) :base_list(tmp) {} + inline List(const List &tmp, MEM_ROOT *mem_root) : + base_list(tmp, mem_root) {} inline bool push_back(T *a) { return base_list::push_back(a); } inline bool push_front(T *a) { return base_list::push_front(a); } inline T* head() {return (T*) base_list::head(); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cb2fa0f7014..426a65ed3df 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2478,6 +2478,22 @@ mysql_execute_command(THD *thd) } /* Skip first table, which is the table we are creating */ TABLE_LIST *create_table, *create_table_local; + /* + Code below (especially in mysql_create_table() and select_create + methods) may modify HA_CREATE_INFO structure in LEX, so we have to + use a copy of this structure to make execution prepared statement- + safe. A shallow copy is enough as this code won't modify any memory + referenced from this structure. + */ + HA_CREATE_INFO create_info(lex->create_info); + Alter_info alter_info(lex->alter_info, thd->mem_root); + + if (thd->is_fatal_error) + { + /* out of memory when creating a copy of alter_info */ + res= 1; + goto unsent_create_error; + } tables= lex->unlink_first_table(tables, &create_table, &create_table_local); @@ -2485,12 +2501,12 @@ mysql_execute_command(THD *thd) goto unsent_create_error; #ifndef HAVE_READLINK - lex->create_info.data_file_name=lex->create_info.index_file_name=0; + create_info.data_file_name= create_info.index_file_name= NULL; #else /* Fix names if symlinked tables */ - if (append_file_to_dir(thd, &lex->create_info.data_file_name, + if (append_file_to_dir(thd, &create_info.data_file_name, create_table->real_name) || - append_file_to_dir(thd,&lex->create_info.index_file_name, + append_file_to_dir(thd, &create_info.index_file_name, create_table->real_name)) { res=-1; @@ -2501,14 +2517,14 @@ mysql_execute_command(THD *thd) If we are using SET CHARSET without DEFAULT, add an implicite DEFAULT to not confuse old users. (This may change). */ - if ((lex->create_info.used_fields & + if ((create_info.used_fields & (HA_CREATE_USED_DEFAULT_CHARSET | HA_CREATE_USED_CHARSET)) == HA_CREATE_USED_CHARSET) { - lex->create_info.used_fields&= ~HA_CREATE_USED_CHARSET; - lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; - lex->create_info.default_table_charset= lex->create_info.table_charset; - lex->create_info.table_charset= 0; + create_info.used_fields&= ~HA_CREATE_USED_CHARSET; + create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; + create_info.default_table_charset= create_info.table_charset; + create_info.table_charset= 0; } /* The create-select command will open and read-lock the select table @@ -2542,11 +2558,14 @@ mysql_execute_command(THD *thd) if (!(res=open_and_lock_tables(thd,tables))) { res= -1; // If error + /* + select_create is currently not re-execution friendly and + needs to be created for every execution of a PS/SP. + */ if ((result=new select_create(create_table->db, create_table->real_name, - &lex->create_info, - lex->create_list, - lex->key_list, + &create_info, + &alter_info, select_lex->item_list, lex->duplicates, lex->ignore))) { @@ -2558,22 +2577,18 @@ mysql_execute_command(THD *thd) res=handle_select(thd, lex, result); select_lex->resolve_mode= SELECT_LEX::NOMATTER_MODE; } - //reset for PS - lex->create_list.empty(); - lex->key_list.empty(); } } else // regular create { if (lex->name) - res= mysql_create_like_table(thd, create_table, &lex->create_info, + res= mysql_create_like_table(thd, create_table, &create_info, (Table_ident *)lex->name); else { - res= mysql_create_table(thd,create_table->db, - create_table->real_name, &lex->create_info, - lex->create_list, - lex->key_list,0,0); + res= mysql_create_table(thd, create_table->db, + create_table->real_name, &create_info, + &alter_info, 0, 0); } if (!res) send_ok(thd); @@ -2591,15 +2606,48 @@ unsent_create_error: break; } case SQLCOM_CREATE_INDEX: + /* Fall through */ + case SQLCOM_DROP_INDEX: + /* + CREATE INDEX and DROP INDEX are implemented by calling ALTER + TABLE with proper arguments. This isn't very fast but it + should work for most cases. + + In the future ALTER TABLE will notice that only added + indexes and create these one by one for the existing table + without having to do a full rebuild. + + One should normally create all indexes with CREATE TABLE or + ALTER TABLE. + */ + { + Alter_info alter_info(lex->alter_info, thd->mem_root); + HA_CREATE_INFO create_info; + + if (thd->is_fatal_error) /* out of memory creating a copy of alter_info*/ + goto error; + if (check_one_table_access(thd, INDEX_ACL, tables)) goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; if (end_active_trans(thd)) - res= -1; - else - res = mysql_create_index(thd, tables, lex->key_list); - break; + goto error; + /* + Currently CREATE INDEX or DROP INDEX cause a full table rebuild + and thus classify as slow administrative statements just like + ALTER TABLE. + */ + thd->enable_slow_log= opt_log_slow_admin_statements; + bzero((char*) &create_info, sizeof(create_info)); + create_info.db_type= DB_TYPE_DEFAULT; + create_info.default_table_charset= thd->variables.collation_database; + + res= mysql_alter_table(thd, tables->db, tables->real_name, + &create_info, tables, &alter_info, + 0, (ORDER*)0, DUP_ERROR, 0); + break; + } #ifdef HAVE_REPLICATION case SQLCOM_SLAVE_START: { @@ -2642,6 +2690,17 @@ unsent_create_error: #else { ulong priv=0; + /* + Code in mysql_alter_table() may modify its HA_CREATE_INFO argument, + so we have to use a copy of this structure to make execution + prepared statement- safe. A shallow copy is enough as no memory + referenced from this structure will be modified. + */ + HA_CREATE_INFO create_info(lex->create_info); + Alter_info alter_info(lex->alter_info, thd->mem_root); + + if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */ + goto error; if (lex->name && (!lex->name[0] || strlen(lex->name) > NAME_LEN)) { net_printf(thd, ER_WRONG_TABLE_NAME, lex->name); @@ -2655,7 +2714,7 @@ unsent_create_error: default database if the new name is not explicitly qualified by a database. (Bug #11493) */ - if (lex->alter_info.flags & ALTER_RENAME) + if (alter_info.flags & ALTER_RENAME) { if (! thd->db) { @@ -2671,7 +2730,7 @@ unsent_create_error: check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0)|| check_merge_table_access(thd, tables->db, (TABLE_LIST *) - lex->create_info.merge_list.first)) + create_info.merge_list.first)) goto error; /* purecov: inspected */ if (grant_option) { @@ -2690,26 +2749,26 @@ unsent_create_error: } } /* Don't yet allow changing of symlinks with ALTER TABLE */ - if (lex->create_info.data_file_name) + if (create_info.data_file_name) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, "DATA DIRECTORY option ignored"); - if (lex->create_info.index_file_name) + if (create_info.index_file_name) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, "INDEX DIRECTORY option ignored"); - lex->create_info.data_file_name=lex->create_info.index_file_name=0; + create_info.data_file_name= create_info.index_file_name= NULL; /* ALTER TABLE ends previous transaction */ if (end_active_trans(thd)) res= -1; else { thd->enable_slow_log= opt_log_slow_admin_statements; - res= mysql_alter_table(thd, select_lex->db, lex->name, - &lex->create_info, - tables, lex->create_list, - lex->key_list, - select_lex->order_list.elements, + res= mysql_alter_table(thd, select_lex->db, lex->name, + &create_info, + tables, + &alter_info, + select_lex->order_list.elements, (ORDER *) select_lex->order_list.first, - lex->duplicates, lex->ignore, &lex->alter_info); + lex->duplicates, lex->ignore); } break; } @@ -2846,7 +2905,7 @@ unsent_create_error: goto error; /* purecov: inspected */ thd->enable_slow_log= opt_log_slow_admin_statements; res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ? - mysql_recreate_table(thd, tables, 1) : + mysql_recreate_table(thd, tables) : mysql_optimize_table(thd, tables, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) @@ -3123,14 +3182,6 @@ unsent_create_error: res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary); } break; - case SQLCOM_DROP_INDEX: - if (check_one_table_access(thd, INDEX_ACL, tables)) - goto error; /* purecov: inspected */ - if (end_active_trans(thd)) - res= -1; - else - res = mysql_drop_index(thd, tables, &lex->alter_info); - break; case SQLCOM_SHOW_DATABASES: #if defined(DONT_ALLOW_SHOW_COMMANDS) send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ @@ -3363,6 +3414,12 @@ purposes internal to the MySQL server", MYF(0)); break; case SQLCOM_CREATE_DB: { + /* + As mysql_create_db() may modify HA_CREATE_INFO structure passed to + it, we need to use a copy of LEX::create_info to make execution + prepared statement- safe. + */ + HA_CREATE_INFO create_info(lex->create_info); if (end_active_trans(thd)) { res= -1; @@ -3393,7 +3450,7 @@ purposes internal to the MySQL server", MYF(0)); if (check_access(thd,CREATE_ACL,lex->name,0,1,0)) break; res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name), - &lex->create_info, 0); + &create_info, 0); break; } case SQLCOM_DROP_DB: @@ -4443,15 +4500,17 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, if (type_modifier & PRI_KEY_FLAG) { lex->col_list.push_back(new key_part_spec(field_name,0)); - lex->key_list.push_back(new Key(Key::PRIMARY, NullS, HA_KEY_ALG_UNDEF, - 0, lex->col_list)); + lex->alter_info.key_list.push_back(new Key(Key::PRIMARY, NullS, + HA_KEY_ALG_UNDEF, 0, + lex->col_list)); lex->col_list.empty(); } if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG)) { lex->col_list.push_back(new key_part_spec(field_name,0)); - lex->key_list.push_back(new Key(Key::UNIQUE, NullS, HA_KEY_ALG_UNDEF, 0, - lex->col_list)); + lex->alter_info.key_list.push_back(new Key(Key::UNIQUE, NullS, + HA_KEY_ALG_UNDEF, 0, + lex->col_list)); lex->col_list.empty(); } @@ -4778,7 +4837,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type, new_field->sql_type, new_field->length); new_field->char_length= new_field->length; - lex->create_list.push_back(new_field); + lex->alter_info.create_list.push_back(new_field); lex->last_field=new_field; DBUG_RETURN(0); } @@ -5458,55 +5517,6 @@ Item * all_any_subquery_creator(Item *left_expr, } -/* - CREATE INDEX and DROP INDEX are implemented by calling ALTER TABLE with - the proper arguments. This isn't very fast but it should work for most - cases. - - In the future ALTER TABLE will notice that only added indexes - and create these one by one for the existing table without having to do - a full rebuild. - - One should normally create all indexes with CREATE TABLE or ALTER TABLE. -*/ - -int mysql_create_index(THD *thd, TABLE_LIST *table_list, List &keys) -{ - List fields; - ALTER_INFO alter_info; - alter_info.flags= ALTER_ADD_INDEX; - alter_info.is_simple= 0; - HA_CREATE_INFO create_info; - DBUG_ENTER("mysql_create_index"); - bzero((char*) &create_info,sizeof(create_info)); - create_info.db_type=DB_TYPE_DEFAULT; - create_info.default_table_charset= thd->variables.collation_database; - DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, - &create_info, table_list, - fields, keys, 0, (ORDER*)0, - DUP_ERROR, 0, &alter_info)); -} - - -int mysql_drop_index(THD *thd, TABLE_LIST *table_list, ALTER_INFO *alter_info) -{ - List fields; - List keys; - HA_CREATE_INFO create_info; - DBUG_ENTER("mysql_drop_index"); - bzero((char*) &create_info,sizeof(create_info)); - create_info.db_type=DB_TYPE_DEFAULT; - create_info.default_table_charset= thd->variables.collation_database; - alter_info->clear(); - alter_info->flags= ALTER_DROP_INDEX; - alter_info->is_simple= 0; - DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name, - &create_info, table_list, - fields, keys, 0, (ORDER*)0, - DUP_ERROR, 0, alter_info)); -} - - /* Multi update query pre-check diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 41e145790e9..494c10f6e6b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -845,7 +845,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) } int mysqld_show_create_db(THD *thd, char *dbname, - HA_CREATE_INFO *create_info) + const HA_CREATE_INFO *create_info) { int length; char path[FN_REFLEN]; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index da66b556b5e..4a11cad0da8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -455,8 +455,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval, mysql_prepare_table() thd Thread object create_info Create information (like MAX_ROWS) - fields List of fields to create - keys List of keys to create + alter_info List of columns and indexes to create DESCRIPTION Prepares the table and key structures for table creation. @@ -467,8 +466,8 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval, */ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, - List &fields, - List &keys, bool tmp_table, uint &db_options, + Alter_info *alter_info, + bool tmp_table, uint &db_options, handler *file, KEY *&key_info_buffer, uint *key_count, int select_field_count) { @@ -481,10 +480,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, int timestamps= 0, timestamps_with_niladic= 0; int field_no,dup_no; int select_field_pos,auto_increment=0; + List_iterator it(alter_info->create_list); + List_iterator it2(alter_info->create_list); DBUG_ENTER("mysql_prepare_table"); - List_iterator it(fields),it2(fields); - select_field_pos=fields.elements - select_field_count; + select_field_pos= alter_info->create_list.elements - select_field_count; null_fields=blob_columns=0; for (field_no=0; (sql_field=it++) ; field_no++) @@ -882,7 +882,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, /* Create keys */ - List_iterator key_iterator(keys), key_iterator2(keys); + List_iterator key_iterator(alter_info->key_list); + List_iterator key_iterator2(alter_info->key_list); uint key_parts=0, fk_key_count=0; bool primary_key=0,unique_key=0; Key *key, *key2; @@ -1332,23 +1333,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, SYNOPSIS mysql_create_table() - thd Thread object - db Database - table_name Table name - create_info Create information (like MAX_ROWS) - fields List of fields to create - keys List of keys to create - tmp_table Set to 1 if this is an internal temporary table - (From ALTER TABLE) + thd Thread object + db Database + table_name Table name + create_info [in/out] Create information (like MAX_ROWS) + alter_info [in/out] List of columns and indexes to create + tmp_table Set to 1 if this is an internal temporary table + (From ALTER TABLE) DESCRIPTION - If one creates a temporary table, this is automaticly opened + If one creates a temporary table, this is automatically opened no_log is needed for the case of CREATE ... SELECT, as the logging will be done later in sql_insert.cc select_field_count is also used for CREATE ... SELECT, and must be zero for standard create of table. + Note that structures passed as 'create_info' and 'alter_info' parameters + may be modified by this function. It is responsibility of the caller to + make a copy of create_info in order to provide correct execution in + prepared statements/stored routines. + RETURN VALUES 0 ok -1 error @@ -1356,8 +1361,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, int mysql_create_table(THD *thd,const char *db, const char *table_name, HA_CREATE_INFO *create_info, - List &fields, - List &keys,bool tmp_table, + Alter_info *alter_info, + bool tmp_table, uint select_field_count) { char path[FN_REFLEN]; @@ -1370,7 +1375,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, DBUG_ENTER("mysql_create_table"); /* Check for duplicate fields and check type of table to create */ - if (!fields.elements) + if (!alter_info->create_list.elements) { my_error(ER_TABLE_MUST_HAVE_COLUMNS,MYF(0)); DBUG_RETURN(-1); @@ -1422,10 +1427,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, create_info->default_table_charset= db_info.default_table_charset; } - if (mysql_prepare_table(thd, create_info, fields, - keys, tmp_table, db_options, file, - key_info_buffer, &key_count, - select_field_count)) + if (mysql_prepare_table(thd, create_info, alter_info, tmp_table, + db_options, file, + key_info_buffer, &key_count, + select_field_count)) DBUG_RETURN(-1); /* Check if table exists */ @@ -1502,8 +1507,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, create_info->table_options=db_options; if (rea_create_table(thd, path, db, table_name, - create_info, fields, key_count, - key_info_buffer)) + create_info, alter_info->create_list, + key_count, key_info_buffer)) goto end; if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { @@ -1591,8 +1596,7 @@ make_unique_key_name(const char *field_name,KEY *start,KEY *end) TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, const char *db, const char *name, - List *extra_fields, - List *keys, + Alter_info *alter_info, List *items, MYSQL_LOCK **lock) { @@ -1626,7 +1630,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, ((Item_field *)item)->field : (Field*) 0)))) DBUG_RETURN(0); - extra_fields->push_back(cr_field); + alter_info->create_list.push_back(cr_field); } /* create and lock table */ /* QQ: create and open should be done atomic ! */ @@ -1640,8 +1644,8 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, open_table(). */ tmp_disable_binlog(thd); - if (!mysql_create_table(thd,db,name,create_info,*extra_fields, - *keys,0,select_field_count)) + if (!mysql_create_table(thd, db, name, create_info, alter_info, + 0, select_field_count)) { if (!(table=open_table(thd,db,name,name,(bool*) 0))) quick_rm_table(create_info->db_type,db,table_case_name(create_info,name)); @@ -2145,6 +2149,7 @@ send_result_message: case HA_ADMIN_TRY_ALTER: { + my_bool save_no_send_ok= thd->net.no_send_ok; /* This is currently used only by InnoDB. ha_innobase::optimize() answers "try with alter", so here we close the table, do an ALTER TABLE, @@ -2154,7 +2159,9 @@ send_result_message: TABLE_LIST *save_next= table->next; table->next= 0; tmp_disable_binlog(thd); // binlogging is done by caller if wanted - result_code= mysql_recreate_table(thd, table, 0); + thd->net.no_send_ok= TRUE; + result_code= mysql_recreate_table(thd, table); + thd->net.no_send_ok= save_no_send_ok; reenable_binlog(thd); close_thread_tables(thd); if (!result_code) // recreation went ok @@ -2634,219 +2641,25 @@ err: } -#ifdef NOT_USED -/* - CREATE INDEX and DROP INDEX are implemented by calling ALTER TABLE with - the proper arguments. This isn't very fast but it should work for most - cases. - One should normally create all indexes with CREATE TABLE or ALTER TABLE. -*/ - -int mysql_create_indexes(THD *thd, TABLE_LIST *table_list, List &keys) -{ - List fields; - List drop; - List alter; - HA_CREATE_INFO create_info; - int rc; - uint idx; - uint db_options; - uint key_count; - TABLE *table; - Field **f_ptr; - KEY *key_info_buffer; - char path[FN_REFLEN+1]; - DBUG_ENTER("mysql_create_index"); - - /* - Try to use online generation of index. - This requires that all indexes can be created online. - Otherwise, the old alter table procedure is executed. - - Open the table to have access to the correct table handler. - */ - if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) - DBUG_RETURN(-1); - - /* - The add_index method takes an array of KEY structs for the new indexes. - Preparing a new table structure generates this array. - It needs a list with all fields of the table, which does not need to - be correct in every respect. The field names are important. - */ - for (f_ptr= table->field; *f_ptr; f_ptr++) - { - create_field *c_fld= new create_field(*f_ptr, *f_ptr); - c_fld->unireg_check= Field::NONE; /*avoid multiple auto_increments*/ - fields.push_back(c_fld); - } - bzero((char*) &create_info,sizeof(create_info)); - create_info.db_type=DB_TYPE_DEFAULT; - create_info.default_table_charset= thd->variables.collation_database; - db_options= 0; - if (mysql_prepare_table(thd, &create_info, fields, - keys, /*tmp_table*/ 0, db_options, table->file, - key_info_buffer, key_count, - /*select_field_count*/ 0)) - DBUG_RETURN(-1); - - /* - Check if all keys can be generated with the add_index method. - If anyone cannot, then take the old way. - */ - for (idx=0; idx< key_count; idx++) - { - DBUG_PRINT("info", ("creating index %s", key_info_buffer[idx].name)); - if (!(table->file->index_ddl_flags(key_info_buffer+idx)& - (HA_DDL_ONLINE| HA_DDL_WITH_LOCK))) - break ; - } - if ((idx < key_count)|| !key_count) - { - /* Re-initialize the create_info, which was changed by prepare table. */ - bzero((char*) &create_info,sizeof(create_info)); - create_info.db_type=DB_TYPE_DEFAULT; - create_info.default_table_charset= thd->variables.collation_database; - /* Cleanup the fields list. We do not want to create existing fields. */ - fields.delete_elements(); - if (real_alter_table(thd, table_list->db, table_list->real_name, - &create_info, table_list, table, - fields, keys, drop, alter, 0, (ORDER*)0, - ALTER_ADD_INDEX, DUP_ERROR)) - /* Don't need to free((gptr) key_info_buffer);*/ - DBUG_RETURN(-1); - } - else - { - if (table->file->add_index(table, key_info_buffer, key_count)|| - build_table_path(path, sizeof(path), table_list->db, - (lower_case_table_names == 2) ? - table_list->alias : table_list->real_name, - reg_ext) == 0 || - mysql_create_frm(thd, path, &create_info, - fields, key_count, key_info_buffer, table->file)) - /* don't need to free((gptr) key_info_buffer);*/ - DBUG_RETURN(-1); - } - /* don't need to free((gptr) key_info_buffer);*/ - DBUG_RETURN(0); -} - - -int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list, - List &drop) -{ - List fields; - List keys; - List alter; - HA_CREATE_INFO create_info; - uint idx; - uint db_options; - uint key_count; - uint *key_numbers; - TABLE *table; - Field **f_ptr; - KEY *key_info; - KEY *key_info_buffer; - char path[FN_REFLEN]; - DBUG_ENTER("mysql_drop_index"); - - /* - Try to use online generation of index. - This requires that all indexes can be created online. - Otherwise, the old alter table procedure is executed. - - Open the table to have access to the correct table handler. - */ - if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) - DBUG_RETURN(-1); - - /* - The drop_index method takes an array of key numbers. - It cannot get more entries than keys in the table. - */ - key_numbers= (uint*) thd->alloc(sizeof(uint*)*table->keys); - key_count= 0; - - /* - Get the number of each key and check if it can be created online. - */ - List_iterator drop_it(drop); - Alter_drop *drop_key; - while ((drop_key= drop_it++)) - { - /* Find the key in the table. */ - key_info=table->key_info; - for (idx=0; idx< table->keys; idx++, key_info++) - { - if (!my_strcasecmp(system_charset_info, key_info->name, drop_key->name)) - break; - } - if (idx>= table->keys) - { - my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), drop_key->name); - /*don't need to free((gptr) key_numbers);*/ - DBUG_RETURN(-1); - } - /* - Check if the key can be generated with the add_index method. - If anyone cannot, then take the old way. - */ - DBUG_PRINT("info", ("dropping index %s", table->key_info[idx].name)); - if (!(table->file->index_ddl_flags(table->key_info+idx)& - (HA_DDL_ONLINE| HA_DDL_WITH_LOCK))) - break ; - key_numbers[key_count++]= idx; - } - - bzero((char*) &create_info,sizeof(create_info)); - create_info.db_type=DB_TYPE_DEFAULT; - create_info.default_table_charset= thd->variables.collation_database; - - if ((drop_key)|| (drop.elements<= 0)) - { - if (real_alter_table(thd, table_list->db, table_list->real_name, - &create_info, table_list, table, - fields, keys, drop, alter, 0, (ORDER*)0, - ALTER_DROP_INDEX, DUP_ERROR)) - /*don't need to free((gptr) key_numbers);*/ - DBUG_RETURN(-1); - } - else - { - db_options= 0; - if (table->file->drop_index(table, key_numbers, key_count)|| - mysql_prepare_table(thd, &create_info, fields, - keys, /*tmp_table*/ 0, db_options, table->file, - key_info_buffer, key_count, - /*select_field_count*/ 0)|| - build_table_path(path, sizeof(path), table_list->db, - (lower_case_table_names == 2) ? - table_list->alias : table_list->real_name, - reg_ext) == 0 || - mysql_create_frm(thd, path, &create_info, - fields, key_count, key_info_buffer, table->file)) - /*don't need to free((gptr) key_numbers);*/ - DBUG_RETURN(-1); - } - - /*don't need to free((gptr) key_numbers);*/ - DBUG_RETURN(0); -} -#endif /* NOT_USED */ /* Alter table + + + NOTE + The structures passed as 'create_info' and 'alter_info' parameters may + be modified by this function. It is responsibility of the caller to make + a copy of create_info in order to provide correct execution in prepared + statements/stored routines. */ int mysql_alter_table(THD *thd,char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, - List &fields, List &keys, + Alter_info *alter_info, uint order_num, ORDER *order, - enum enum_duplicates handle_duplicates, bool ignore, - ALTER_INFO *alter_info, bool do_send_ok) + enum enum_duplicates handle_duplicates, bool ignore) { TABLE *table,*new_table; int error; @@ -3008,8 +2821,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } - if (do_send_ok) - send_ok(thd); + send_ok(thd); } else if (error > 0) { @@ -3035,10 +2847,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, restore_record(table,default_values); // Empty record for DEFAULT List_iterator drop_it(alter_info->drop_list); - List_iterator def_it(fields); + List_iterator def_it(alter_info->create_list); List_iterator alter_it(alter_info->alter_list); - List create_list; // Add new fields here - List key_list; // Add new keys here + Alter_info new_info; // Add new columns and indexes here create_field *def; /* @@ -3084,13 +2895,13 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, def->field=field; if (!def->after) { - create_list.push_back(def); + new_info.create_list.push_back(def); def_it.remove(); } } else { // Use old field value - create_list.push_back(def=new create_field(field,field)); + new_info.create_list.push_back(def= new create_field(field, field)); alter_it.rewind(); // Change default if ALTER Alter_column *alter; while ((alter=alter_it++)) @@ -3111,7 +2922,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } } def_it.rewind(); - List_iterator find_it(create_list); + List_iterator find_it(new_info.create_list); while ((def=def_it++)) // Add new columns { if (def->change && ! def->field) @@ -3120,9 +2931,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, DBUG_RETURN(-1); } if (!def->after) - create_list.push_back(def); + new_info.create_list.push_back(def); else if (def->after == first_keyword) - create_list.push_front(def); + new_info.create_list.push_front(def); else { create_field *find; @@ -3146,7 +2957,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, table_name); DBUG_RETURN(-1); } - if (!create_list.elements) + if (!new_info.create_list.elements) { my_error(ER_CANT_REMOVE_ALL_FIELDS,MYF(0)); DBUG_RETURN(-1); @@ -3157,8 +2968,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, for which some fields exists. */ - List_iterator key_it(keys); - List_iterator field_it(create_list); + List_iterator key_it(alter_info->key_list); + List_iterator field_it(new_info.create_list); List key_parts; KEY *key_info=table->key_info; @@ -3216,24 +3027,37 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, key_part_length)); } if (key_parts.elements) - key_list.push_back(new Key(key_info->flags & HA_SPATIAL ? Key::SPATIAL : - (key_info->flags & HA_NOSAME ? - (!my_strcasecmp(system_charset_info, - key_name, primary_key_name) ? - Key::PRIMARY : Key::UNIQUE) : - (key_info->flags & HA_FULLTEXT ? - Key::FULLTEXT : Key::MULTIPLE)), - key_name, - key_info->algorithm, - test(key_info->flags & HA_GENERATED_KEY), - key_parts)); + { + Key *key; + enum Key::Keytype key_type; + + if (key_info->flags & HA_SPATIAL) + key_type= Key::SPATIAL; + else if (key_info->flags & HA_NOSAME) + { + if (! my_strcasecmp(system_charset_info, key_name, primary_key_name)) + key_type= Key::PRIMARY; + else + key_type= Key::UNIQUE; + } + else if (key_info->flags & HA_FULLTEXT) + key_type= Key::FULLTEXT; + else + key_type= Key::MULTIPLE; + + key= new Key(key_type, key_name, + key_info->algorithm, + test(key_info->flags & HA_GENERATED_KEY), + key_parts); + new_info.key_list.push_back(key); + } } { Key *key; while ((key=key_it++)) // Add new keys { if (key->type != Key::FOREIGN_KEY) - key_list.push_back(key); + new_info.key_list.push_back(key); if (key->name && !my_strcasecmp(system_charset_info,key->name,primary_key_name)) { @@ -3337,7 +3161,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, /* We don't log the statement, it will be logged later. */ tmp_disable_binlog(thd); error= mysql_create_table(thd, new_db, tmp_name, - create_info,create_list,key_list,1,0); + create_info, &new_info, 1, 0); reenable_binlog(thd); if (error) DBUG_RETURN(error); @@ -3366,9 +3190,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, next_insert_id=thd->next_insert_id; // Remember for loggin copied=deleted=0; if (!new_table->is_view) - error=copy_data_between_tables(table,new_table,create_list, - handle_duplicates, ignore, - order_num, order, &copied, &deleted); + error= copy_data_between_tables(table, new_table, new_info.create_list, + handle_duplicates, ignore, + order_num, order, &copied, &deleted); thd->last_insert_id=next_insert_id; // Needed for correct log thd->count_cuted_fields= CHECK_FIELD_IGNORE; @@ -3574,8 +3398,7 @@ end_temporary: my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO), (ulong) (copied + deleted), (ulong) deleted, (ulong) thd->cuted_fields); - if (do_send_ok) - send_ok(thd,copied+deleted,0L,tmp_name); + send_ok(thd, copied + deleted, 0L, tmp_name); thd->some_tables_deleted=0; DBUG_RETURN(0); @@ -3760,30 +3583,26 @@ copy_data_between_tables(TABLE *from,TABLE *to, mysql_recreate_table() thd Thread handler tables Tables to recreate - do_send_ok If we should send_ok() or leave it to caller RETURN Like mysql_alter_table(). */ -int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, - bool do_send_ok) +int mysql_recreate_table(THD *thd, TABLE_LIST *table_list) { - DBUG_ENTER("mysql_recreate_table"); LEX *lex= thd->lex; HA_CREATE_INFO create_info; - lex->create_list.empty(); - lex->key_list.empty(); - lex->col_list.empty(); - lex->alter_info.reset(); - lex->alter_info.is_simple= 0; // Force full recreate + Alter_info alter_info; + + DBUG_ENTER("mysql_recreate_table"); + bzero((char*) &create_info,sizeof(create_info)); create_info.db_type=DB_TYPE_DEFAULT; create_info.row_type=ROW_TYPE_DEFAULT; create_info.default_table_charset=default_charset_info; + alter_info.is_simple= 0; // Force full recreate DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info, - table_list, lex->create_list, - lex->key_list, 0, (ORDER *) 0, - DUP_ERROR, 0, &lex->alter_info, do_send_ok)); + table_list, &alter_info, + 0, (ORDER *) 0, DUP_ERROR, 0)); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c6f4307f1ea..30283a47b21 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1021,8 +1021,7 @@ create: TL_READ_NO_INSERT: TL_READ))) YYABORT; - lex->create_list.empty(); - lex->key_list.empty(); + lex->alter_info.reset(); lex->col_list.empty(); lex->change=NullS; bzero((char*) &lex->create_info,sizeof(lex->create_info)); @@ -1040,16 +1039,18 @@ create: if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL, TL_OPTION_UPDATING)) YYABORT; - lex->create_list.empty(); - lex->key_list.empty(); + lex->alter_info.reset(); + lex->alter_info.is_simple= 0; + lex->alter_info.flags= ALTER_ADD_INDEX; lex->col_list.empty(); lex->change=NullS; } '(' key_list ')' { LEX *lex=Lex; + Key *key= new Key($2, $4.str, $5, 0, lex->col_list); - lex->key_list.push_back(new Key($2,$4.str, $5, 0, lex->col_list)); + lex->alter_info.key_list.push_back(key); lex->col_list.empty(); } | CREATE DATABASE opt_if_not_exists ident @@ -1305,29 +1306,34 @@ key_def: key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; - lex->key_list.push_back(new Key($1,$2, $3, 0, lex->col_list)); + Key *key= new Key($1, $2, $3, 0, lex->col_list); + lex->alter_info.key_list.push_back(key); + lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' { LEX *lex=Lex; const char *key_name= $3 ? $3:$1; - lex->key_list.push_back(new Key($2, key_name, $4, 0, - lex->col_list)); + Key *key= new Key($2, key_name, $4, 0, lex->col_list); + lex->alter_info.key_list.push_back(key); lex->col_list.empty(); /* Alloced by sql_alloc */ } | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references { LEX *lex=Lex; - lex->key_list.push_back(new foreign_key($4 ? $4:$1, lex->col_list, - $8, - lex->ref_list, - lex->fk_delete_opt, - lex->fk_update_opt, - lex->fk_match_option)); - lex->key_list.push_back(new Key(Key::MULTIPLE, $4 ? $4 : $1, - HA_KEY_ALG_UNDEF, 1, - lex->col_list)); + const char *key_name= $4 ? $4 : $1; + Key *key= new foreign_key(key_name, lex->col_list, + $8, + lex->ref_list, + lex->fk_delete_opt, + lex->fk_update_opt, + lex->fk_match_option); + lex->alter_info.key_list.push_back(key); + key= new Key(Key::MULTIPLE, key_name, + HA_KEY_ALG_UNDEF, 1, + lex->col_list); + lex->alter_info.key_list.push_back(key); lex->col_list.empty(); /* Alloced by sql_alloc */ } | constraint opt_check_constraint @@ -1850,8 +1856,6 @@ alter: if (!lex->select_lex.add_table_to_list(thd, $4, NULL, TL_OPTION_UPDATING)) YYABORT; - lex->create_list.empty(); - lex->key_list.empty(); lex->col_list.empty(); lex->select_lex.init_order(); lex->select_lex.db=lex->name=0; @@ -1859,9 +1863,7 @@ alter: lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.default_table_charset= NULL; lex->create_info.row_type= ROW_TYPE_NOT_USED; - lex->alter_info.reset(); - lex->alter_info.is_simple= 1; - lex->alter_info.flags= 0; + lex->alter_info.reset(); } alter_list {} @@ -4030,7 +4032,9 @@ drop: { LEX *lex=Lex; lex->sql_command= SQLCOM_DROP_INDEX; - lex->alter_info.drop_list.empty(); + lex->alter_info.reset(); + lex->alter_info.is_simple= 0; + lex->alter_info.flags= ALTER_DROP_INDEX; lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, $3.str)); if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, From 5d7af856f769a77b398de64597458eca252ef43c Mon Sep 17 00:00:00 2001 From: "rafal@quant.(none)" <> Date: Fri, 8 Dec 2006 11:41:12 +0100 Subject: [PATCH 027/160] BUG#24507 (rpl_log.test crash slave): The problem was located to lie inside current NPTL pthread_exit() implementation. Race conditions in this code can lead to segmentation fault. Hovewer, this can happen only in a race between first thread calling pthread_exit() and other threads. Workaround implemented in this patch spawns a dummy thread, which exits immediately, during thread lib initialization. This will exclude segment violations when further threads exit. --- include/my_pthread.h | 20 ++++++++++++++++++++ mysys/my_thr_init.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/include/my_pthread.h b/include/my_pthread.h index 3e4388413e0..8051d75c59e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -31,6 +31,26 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ +/* + BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. + + If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug + report will be implemented inside my_thread_global_init() in my_thr_init.c. + + This amounts to spawning a dummy thread which does nothing but executes + pthread_exit(0). + + This bug is fixed in version 2.5 of glibc library. + + TODO: Remove this code when fixed versions of glibc6 are in common use. + */ + +#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && + defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 ) +#define NPTL_PTHREAD_EXIT_BUG 1 +#endif + + #if defined(__WIN__) || defined(OS2) #ifdef OS2 diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 4d23d01cd82..6663af986dd 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -44,6 +44,23 @@ pthread_mutexattr_t my_fast_mutexattr; pthread_mutexattr_t my_errorcheck_mutexattr; #endif +#ifdef NPTL_PTHREAD_EXIT_BUG /* see my_pthread.h */ + +/* + Dummy thread spawned in my_thread_global_init() below to avoid + race conditions in NPTL pthread_exit code. +*/ + +static +pthread_handler_t nptl_pthread_exit_hack_handler(void *arg) +{ + /* Do nothing! */ + pthread_exit(0); + return 0; +} + +#endif + /* initialize thread environment @@ -62,6 +79,28 @@ my_bool my_thread_global_init(void) fprintf(stderr,"Can't initialize threads: error %d\n",errno); return 1; } + +#ifdef NPTL_PTHREAD_EXIT_BUG + +/* + BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. + + To avoid a possible segmentation fault during concurrent executions of + pthread_exit(), a dummy thread is spawned which initializes internal variables + of pthread lib. See bug description for thoroughfull explanation. + + TODO: Remove this code when fixed versions of glibc6 are in common use. +*/ + + pthread_t dummy_thread; + pthread_attr_t dummy_thread_attr; + + pthread_attr_init(&dummy_thread_attr); + pthread_attr_setdetachstate(&dummy_thread_attr,PTHREAD_CREATE_DETACHED); + + pthread_create(&dummy_thread,&dummy_thread_attr,nptl_pthread_exit_hack_handler,NULL); + +#endif #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP /* From c57bde5ff1dd4f80222860371392801341304a68 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Fri, 8 Dec 2006 15:13:12 +0400 Subject: [PATCH 028/160] After merge fix --- mysql-test/r/binlog_stm_ctype_ucs.result | 20 ++++++------ mysql-test/r/rpl_timezone.result | 32 ------------------- .../t/binlog_stm_mix_innodb_myisam.test | 2 +- 3 files changed, 12 insertions(+), 42 deletions(-) diff --git a/mysql-test/r/binlog_stm_ctype_ucs.result b/mysql-test/r/binlog_stm_ctype_ucs.result index 61ca21d4058..c9d33b4051e 100644 --- a/mysql-test/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/r/binlog_stm_ctype_ucs.result @@ -9,15 +9,17 @@ master-bin.000001 102 User var 1 142 @`v`=_ucs2 0x006100620063 COLLATE ucs2_gene master-bin.000001 142 Query 1 231 use `test`; insert into t2 values (@v) /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`; -use test; -SET TIMESTAMP=10000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -insert into t2 values (@v); +DELIMITER /*!*/; +ROLLBACK/*!*/; +SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; +use test/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +insert into t2 values (@v)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index b9b6a3e5c44..4ad6afa8c94 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -39,38 +39,6 @@ SELECT * FROM t1 ORDER BY n; t n 2004-01-01 00:00:00 5 2004-06-11 09:39:02 6 -select * from t1; -t -2004-01-01 00:00:00 -2004-06-11 09:39:02 -/*!40019 SET @@session.max_insert_delayed_threads=0*/; -/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -DELIMITER /*!*/; -ROLLBACK/*!*/; -use test/*!*/; -SET TIMESTAMP=100000000/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; -SET @@session.sql_mode=0/*!*/; -/*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; -create table t1 (t timestamp)/*!*/; -SET TIMESTAMP=100000000/*!*/; -create table t2 (t char(32))/*!*/; -SET TIMESTAMP=100000000/*!*/; -SET @@session.time_zone='Europe/Moscow'/*!*/; -insert into t1 values ('20050101000000'), ('20050611093902')/*!*/; -SET TIMESTAMP=100000000/*!*/; -SET @@session.time_zone='UTC'/*!*/; -insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; -SET TIMESTAMP=100000000/*!*/; -delete from t1/*!*/; -SET TIMESTAMP=100000000/*!*/; -SET @@session.time_zone='Europe/Moscow'/*!*/; -insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; -DELIMITER ; -# End of log file -ROLLBACK /* added by mysqlbinlog */; -/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; delete from t1; set time_zone='UTC'; load data infile '../std_data_ln/rpl_timezone2.dat' into table t1; diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test index cb6516a3a2f..3dab9b44187 100644 --- a/mysql-test/t/binlog_stm_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test @@ -18,6 +18,6 @@ eval select is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; From 0b41593db60e0670f27a76b8144e42e70e1589a8 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 12:13:43 +0100 Subject: [PATCH 029/160] Fix problems with "make dist" and running from "binary dist" --- mysql-test/Makefile.am | 2 +- scripts/make_binary_distribution.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 72998d786b9..341afac1c9a 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -98,7 +98,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index a6a2f1e3b49..ec1c6b70bb6 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -245,7 +245,7 @@ $CP mysql-test/t/*.def $BASE/mysql-test/t $CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ - mysql-test/std_data/*.cnf \ + mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ $BASE/mysql-test/std_data $CP mysql-test/t/*.test mysql-test/t/*.imtest \ mysql-test/t/*.disabled mysql-test/t/*.opt \ From 8b6e5d4dfae202a2ae9abb29496efc22656f38c8 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 13:37:40 +0100 Subject: [PATCH 030/160] Backport fix for mysqladmin on windows test failure --- mysql-test/t/mysqladmin.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test index 7c016fd7416..850abc1ee69 100644 --- a/mysql-test/t/mysqladmin.test +++ b/mysql-test/t/mysqladmin.test @@ -15,7 +15,7 @@ database=db1 EOF ---replace_regex /\/.*mysqladmin/mysqladmin/ +--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/ --error 7 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 @@ -27,6 +27,6 @@ EOF loose-database=db2 EOF ---replace_regex /Warning: .*mysqladmin/Warning: mysqladmin/ +--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/ --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 From 40927c0cb2a84743957f431f28e4d1b0f4dd6d51 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 16:08:54 +0100 Subject: [PATCH 031/160] Bug#24498 Stack overflow in mysqltest - Thanks to Vasil Dimov for the patch! --- client/mysqltest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index c6cbf6aabe0..ac186a7361e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1240,7 +1240,9 @@ void var_set(const char *var_name, const char *var_name_end, v->int_dirty= 0; v->str_val_len= strlen(v->str_val); } - strxmov(buf, v->name, "=", v->str_val, NullS); + my_snprintf(buf, sizeof(buf), "%.*s=%.*s", + v->name_len, v->name, + v->str_val_len, v->str_val); if (!(v->env_s= my_strdup(buf, MYF(MY_WME)))) die("Out of memory"); putenv(v->env_s); From 9064723d1b64e7ad806864831722783a8e3f7b8d Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 16:43:50 +0100 Subject: [PATCH 032/160] Bug#19410 Test 'kill' fails on Windows + SCO - Use "mysql_field_count" to determine if there is a need to call "mysql_store_result" --- client/mysqltest.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index ac186a7361e..3d9344fb098 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4680,10 +4680,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, } /* - Store the result. If res is NULL, use mysql_field_count to - determine if that was expected + Store the result of the query if it will return any fields */ - if (!(res= mysql_store_result(mysql)) && mysql_field_count(mysql)) + if (mysql_field_count(mysql) && ((res= mysql_store_result(mysql)) == 0)) { handle_error(command, mysql_errno(mysql), mysql_error(mysql), mysql_sqlstate(mysql), ds); @@ -4735,7 +4734,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, } if (res) + { mysql_free_result(res); + res= 0; + } counter++; } while (!(err= mysql_next_result(mysql))); if (err > 0) From 3e43b86329017a1d5b3c26a252bcfff619a8b219 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 16:48:49 +0100 Subject: [PATCH 033/160] Add missing space --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 3d9344fb098..ad7124601ab 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -4804,7 +4804,7 @@ void handle_error(struct st_command *command, err_errno, err_error); /* Abort the run of this test, pass the failed query as reason */ - abort_not_supported_test("Query '%s' failed, required functionality" \ + abort_not_supported_test("Query '%s' failed, required functionality " \ "not supported", command->query); } From 9636ead18d64231a9f743baea3715889b6930f5e Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 8 Dec 2006 17:09:07 +0100 Subject: [PATCH 034/160] Bug#19410 Test 'kill' fails on Windows + SCO --- mysql-test/t/kill.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 50c4239b45e..1cf871d5f9f 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -70,11 +70,14 @@ insert into t2 select id from t1; create table t3 (kill_id int); insert into t3 values(connection_id()); +connect (conn2, localhost, root,,); +connection conn2; + +connection conn1; -- disable_result_log send select id from t1 where id in (select distinct id from t2); -- enable_result_log -connect (conn2, localhost, root,,); connection conn2; select ((@id := kill_id) - kill_id) from t3; -- sleep 1 From c82cd4a46eea3e44f948bf48c9175ef6883d5f95 Mon Sep 17 00:00:00 2001 From: "rafal@quant.(none)" <> Date: Fri, 8 Dec 2006 19:23:12 +0100 Subject: [PATCH 035/160] Minor fix --- include/my_pthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index 8051d75c59e..24f3fd62b8e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -45,7 +45,7 @@ extern "C" { TODO: Remove this code when fixed versions of glibc6 are in common use. */ -#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && +#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \ defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 ) #define NPTL_PTHREAD_EXIT_BUG 1 #endif From a58d08513bc814fc2513a4d5c0ab6f7b3c82264b Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Fri, 8 Dec 2006 16:17:46 -0700 Subject: [PATCH 036/160] Makefile.am - test* targets are identical (as much as possible) to 5.0 & 5.1 versions - use @PERL@ ./mysql-test-run.pl, instead of depending on /usr/bin/perl location - PHONY: target includes all test targets --- Makefile.am | 55 +++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Makefile.am b/Makefile.am index 36175ce55e4..70ed8fa7bfe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -95,7 +95,11 @@ dist-hook: tags: support-files/build-tags -.PHONY: init-db bin-dist + +.PHONY: init-db bin-dist \ + test test-force test-full test-force-full test-force-mem \ + test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \ + test-ps test-ns # Target 'test' will run the regression test suite using the built server. # @@ -105,36 +109,33 @@ tags: # will then calculate the various port numbers it needs from this, # making sure each user use different ports. -test: +test-ps: cd mysql-test ; \ - ./mysql-test-run && \ - ./mysql-test-run --ps-protocol + @PERL@ ./mysql-test-run.pl $(force) --ps-protocol + +test-ns: + cd mysql-test ; \ + @PERL@ ./mysql-test-run.pl $(force) + +test: test-ns test-ps + +# To ease script-writing, although in 4.1 it is identical to 'test' +test-full: test test-force: - cd mysql-test; \ - ./mysql-test-run --force && \ - ./mysql-test-run --ps-protocol --force + $(MAKE) force=--force test -test-force-mem: - cd mysql-test; \ - ./mysql-test-run --force --mem && \ - ./mysql-test-run --ps-protocol --force --mem - - -# We are testing a new Perl version of the test script -test-pl: - cd mysql-test; \ - ./mysql-test-run.pl && \ - ./mysql-test-run.pl --ps-protocol - -test-force-pl: - cd mysql-test; \ - ./mysql-test-run.pl --force && \ - ./mysql-test-run.pl --ps-protocol --force +test-force-full: + $(MAKE) force=--force test-full #used by autopush.pl to run memory based tests -test-force-pl-mem: - cd mysql-test; \ - ./mysql-test-run.pl --force --mem && \ - ./mysql-test-run.pl --ps-protocol --force --mem +test-force-mem: + $(MAKE) 'force=--force --mem' test + +# Keep these for a while +test-pl: test +test-full-pl: test-full +test-force-pl: test-force +test-force-pl-mem: test-force-mem +test-force-full-pl: test-force-full From 4e34f77c857e246df4a3c806bace6dcb60fc7a62 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 11 Dec 2006 11:25:45 +0100 Subject: [PATCH 037/160] Bug#23735 mysqlbinlog client fails when reading binlog from stdin - Windows opens stdin in text mode by default. Certain characters such as CTRL-Z are interpeted as events and the read() method will stop. CTRL-Z is the EOF marker in Windows. to get past this you have to open stdin in binary mode. Setmode() is used to set stdin in binary mode. Errors on setting this mode result in halting the function and printing an error message to stderr. --- client/mysqlbinlog.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index ff4e0b5a5cf..102c665031d 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1310,6 +1310,25 @@ static int dump_local_log_entries(const char* logname) } else // reading from stdin; { + /* + Bug fix: #23735 + Author: Chuck Bell + Description: + Windows opens stdin in text mode by default. Certain characters + such as CTRL-Z are interpeted as events and the read() method + will stop. CTRL-Z is the EOF marker in Windows. to get past this + you have to open stdin in binary mode. Setmode() is used to set + stdin in binary mode. Errors on setting this mode result in + halting the function and printing an error message to stderr. + */ +#if defined (__WIN__) || (_WIN64) + if (_setmode(fileno(stdin), O_BINARY) == -1) + { + fprintf(stderr, "Could not set binary mode on stdin.\n"); + return 1; + } +#endif + if (init_io_cache(file, fileno(stdin), 0, READ_CACHE, (my_off_t) 0, 0, MYF(MY_WME | MY_NABP | MY_DONT_CHECK_FILESIZE))) return 1; From 510c9627e15f99528b01e1d8e42c100e2d09a1d1 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 11 Dec 2006 12:06:12 +0100 Subject: [PATCH 038/160] Fix merge error in mysql-test/Makefile.am --- mysql-test/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 341afac1c9a..eff2ae740f5 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -98,7 +98,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data - $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(distdir)/std_data + $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib From 531cae29dec9597b493b0b05dcba846927f3b6be Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Mon, 11 Dec 2006 15:08:04 +0400 Subject: [PATCH 039/160] After merge fix for bug N20396 --- mysql-test/r/binlog_row_ctype_ucs.result | 4 +- mysql-test/r/rpl_row_mysqlbinlog.result | 94 +++++++++++++----------- 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result index 5feb17cde13..15af685559a 100644 --- a/mysql-test/r/binlog_row_ctype_ucs.result +++ b/mysql-test/r/binlog_row_ctype_ucs.result @@ -9,7 +9,9 @@ master-bin.000001 102 Table_map 1 141 table_id: # (test.t2) master-bin.000001 141 Write_rows 1 231 table_id: # flags: STMT_END_F /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; +DELIMITER /*!*/; +ROLLBACK/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; diff --git a/mysql-test/r/rpl_row_mysqlbinlog.result b/mysql-test/r/rpl_row_mysqlbinlog.result index 374f2d3ee82..c9f46e73cfd 100644 --- a/mysql-test/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/r/rpl_row_mysqlbinlog.result @@ -154,13 +154,15 @@ c1 c3 c4 c5 --- Test 2 position test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -168,20 +170,22 @@ ROLLBACK /* added by mysqlbinlog */; --- Test 3 First Remote test -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -DROP TABLE IF EXISTS t1,t2,t3; -SET TIMESTAMP=1000000000; -CREATE TABLE t1(word VARCHAR(20)); -SET TIMESTAMP=1000000000; -CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); -SET TIMESTAMP=1000000000; -CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +DROP TABLE IF EXISTS t1,t2,t3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t1(word VARCHAR(20))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -189,6 +193,8 @@ ROLLBACK /* added by mysqlbinlog */; --- Test 5 LOAD DATA -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -196,20 +202,22 @@ ROLLBACK /* added by mysqlbinlog */; --- Test 6 reading stdin -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -ROLLBACK; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -DROP TABLE IF EXISTS t1,t2,t3; -SET TIMESTAMP=1000000000; -CREATE TABLE t1(word VARCHAR(20)); -SET TIMESTAMP=1000000000; -CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); -SET TIMESTAMP=1000000000; -CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +DELIMITER /*!*/; +ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +DROP TABLE IF EXISTS t1,t2,t3/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t1(word VARCHAR(20))/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY)/*!*/; +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; @@ -217,13 +225,15 @@ ROLLBACK /* added by mysqlbinlog */; --- Test 7 reading stdin w/position -- /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -use test; -SET TIMESTAMP=1000000000; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; -SET @@session.sql_mode=0; -/*!\C latin1 */; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; -CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); +DELIMITER /*!*/; +use test/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)/*!*/; +DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; From ba6d2bbf64e68ec7a061cbb96bcd76df81be8d4b Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 11 Dec 2006 12:16:20 +0100 Subject: [PATCH 040/160] Pass --no-defaults to embedded server to avoid that it reads any defaults file --- mysql-test/mysql-test-run.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 5002f778da5..bfc5fc36b32 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3432,11 +3432,10 @@ sub mysqld_arguments ($$$$$) { if ( $glob_use_embedded_server ) { $prefix= "--server-arg="; - } else { - # We can't pass embedded server --no-defaults - mtr_add_arg($args, "--no-defaults"); } + mtr_add_arg($args, "%s--no-defaults", $prefix); + mtr_add_arg($args, "%s--console", $prefix); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); From 0068e13e2fae2e1e0121cebc06bc0262d978b433 Mon Sep 17 00:00:00 2001 From: "Kristofer.Pettersson@naruto." <> Date: Mon, 11 Dec 2006 12:33:42 +0100 Subject: [PATCH 041/160] Bug#17489 failed to put data file in custom directory use "data directory" option - Updated result file to fit test case automerge. --- mysql-test/r/windows.result | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result index e8c3c81a44e..7472b724f47 100644 --- a/mysql-test/r/windows.result +++ b/mysql-test/r/windows.result @@ -6,6 +6,12 @@ use prn; ERROR 42000: Unknown database 'prn' create table nu (a int); drop table nu; +drop table if exists t1; +CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM; +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +drop table t1; create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll'; call proc_1(); ERROR HY000: No paths allowed for shared library From c4d1d10e4b2971872ba5a1ef96296fed1ca9c5fe Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Mon, 11 Dec 2006 17:08:10 +0400 Subject: [PATCH 042/160] after merge fix for bug N20396 --- mysql-test/r/binlog_row_mix_innodb_myisam.result | 4 ++-- mysql-test/t/binlog_row_mix_innodb_myisam.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result index e063d7371a9..bd4e74f51a6 100644 --- a/mysql-test/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result @@ -407,8 +407,8 @@ is not null; is not null 1 select -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test index e04d53a2209..baaf6b98090 100644 --- a/mysql-test/t/binlog_row_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test @@ -26,6 +26,6 @@ eval select is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select -@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; From 8a7ea3c744eff9f87095bd53a45aa1ecc2f6c94c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 11 Dec 2006 15:39:15 +0100 Subject: [PATCH 043/160] Bug#20225 mysqltest runs in an endless loop when trying to start rpl_sys test suite - Add printout in safe_connect indicating that mysqltest is in a loop waiting for connection to mysqld. Will be printed when --verbose is passed as argument to mysqltest --- client/mysqltest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/mysqltest.c b/client/mysqltest.c index ad7124601ab..6f0a1ba3498 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2970,7 +2970,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR || mysql_errno(mysql) == CR_CONNECTION_ERROR) && failed_attempts < opt_max_connect_retries) + { + verbose_msg("Connect attempt %d/%d failed: %d: %s", failed_attempts, + opt_max_connect_retries, mysql_errno(mysql), + mysql_error(mysql)); my_sleep(connection_retry_sleep); + } else { if (failed_attempts > 0) From eb1c28014245e1e3bf6c8343780e2047250a7d61 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 11 Dec 2006 16:43:21 +0100 Subject: [PATCH 044/160] Wait for INSERT DELAYED to finish i.e sleep in while loop until "select count" is one more. --- mysql-test/r/archive.result | 6 ++++++ mysql-test/t/archive.test | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 3be1cdcf15a..f73a80dde65 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -11120,7 +11120,13 @@ auto fld1 companynr fld3 fld4 fld5 fld6 2 011401 37 breaking dreaded Steinberg W 3 011402 37 Romans scholastics jarring 4 011403 37 intercepted audiology tinily +SELECT COUNT(auto) FROM t2; +COUNT(auto) +1213 INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); +SELECT COUNT(auto) FROM t2; +COUNT(auto) +1214 ALTER TABLE t2 DROP COLUMN fld6; SHOW CREATE TABLE t2; Table Create Table diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index f712a770712..80533f21311 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1345,10 +1345,14 @@ SELECT * FROM t2; CHECK TABLE t2; SELECT * FROM t2; - -# Just test syntax, we will never know if the output is right or wrong -# Must be the last test +# Test INSERT DELAYED and wait until the table has one more record +SELECT COUNT(auto) FROM t2; INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); +while (`SELECT COUNT(auto)!=1214 FROM t2`) +{ + sleep 0.1; +} +SELECT COUNT(auto) FROM t2; # Adding test for alter table ALTER TABLE t2 DROP COLUMN fld6; From 92f1c7623635adeeab08a58d83179e6b62a0b240 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Tue, 12 Dec 2006 01:50:12 +0300 Subject: [PATCH 045/160] Post-merge fixes for Bug#4968 "Stored procedure crash if cursor opened on altered table" and Bug#19733 "Repeated alter, or repeated create/drop, fails" --- mysql-test/r/ps.result | 282 ++++++++--------------------------------- mysql-test/r/sp.result | 17 +++ mysql-test/t/ps.test | 72 +++++++++++ mysql-test/t/sp.test | 28 ++++ sql/sql_insert.cc | 15 +-- sql/sql_lex.cc | 3 +- sql/sql_parse.cc | 24 ++-- sql/sql_table.cc | 20 +-- sql/sql_yacc.yy | 4 +- 9 files changed, 203 insertions(+), 262 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 7e5919af1b9..b54d31ecc99 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1055,230 +1055,6 @@ EXECUTE stmt USING @a; 0 0 DEALLOCATE PREPARE stmt; DROP TABLE t1; -ERROR HY000: Unknown error -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 0 -set global max_prepared_stmt_count=1; -prepare stmt from "select 1"; -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 1 -prepare stmt1 from "select 1"; -ERROR HY000: Unknown error -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 1 -deallocate prepare stmt; -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 0 -prepare stmt from "select 1"; -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 1 -prepare stmt from "select 2"; -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 1 -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 1 -select @@max_prepared_stmt_count; -@@max_prepared_stmt_count -1 -set global max_prepared_stmt_count=0; -prepare stmt from "select 1"; -ERROR HY000: Unknown error -execute stmt; -ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 0 -prepare stmt from "select 1"; -ERROR HY000: Unknown error -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 0 -set global max_prepared_stmt_count=3; -select @@max_prepared_stmt_count; -@@max_prepared_stmt_count -3 -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 0 -prepare stmt from "select 1"; -prepare stmt from "select 2"; -prepare stmt1 from "select 3"; -prepare stmt2 from "select 4"; -ERROR HY000: Unknown error -prepare stmt2 from "select 4"; -ERROR HY000: Unknown error -select @@max_prepared_stmt_count; -@@max_prepared_stmt_count -3 -show status like 'prepared_stmt_count'; -Variable_name Value -Prepared_stmt_count 3 -deallocate prepare stmt; -set global max_prepared_stmt_count= @old_max_prepared_stmt_count; -drop table if exists t1; -create temporary table if not exists t1 (a1 int); -prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"; -drop temporary table t1; -create temporary table if not exists t1 (a1 int); -execute stmt; -drop temporary table t1; -create temporary table if not exists t1 (a1 int); -execute stmt; -drop temporary table t1; -create temporary table if not exists t1 (a1 int); -execute stmt; -drop temporary table t1; -deallocate prepare stmt; -CREATE TABLE t1( -ID int(10) unsigned NOT NULL auto_increment, -Member_ID varchar(15) NOT NULL default '', -Action varchar(12) NOT NULL, -Action_Date datetime NOT NULL, -Track varchar(15) default NULL, -User varchar(12) default NULL, -Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update -CURRENT_TIMESTAMP, -PRIMARY KEY (ID), -KEY Action (Action), -KEY Action_Date (Action_Date) -); -INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES -('111111', 'Disenrolled', '2006-03-01', 'CAD' ), -('111111', 'Enrolled', '2006-03-01', 'CAD' ), -('111111', 'Disenrolled', '2006-07-03', 'CAD' ), -('222222', 'Enrolled', '2006-03-07', 'CAD' ), -('222222', 'Enrolled', '2006-03-07', 'CHF' ), -('222222', 'Disenrolled', '2006-08-02', 'CHF' ), -('333333', 'Enrolled', '2006-03-01', 'CAD' ), -('333333', 'Disenrolled', '2006-03-01', 'CAD' ), -('444444', 'Enrolled', '2006-03-01', 'CAD' ), -('555555', 'Disenrolled', '2006-03-01', 'CAD' ), -('555555', 'Enrolled', '2006-07-21', 'CAD' ), -('555555', 'Disenrolled', '2006-03-01', 'CHF' ), -('666666', 'Enrolled', '2006-02-09', 'CAD' ), -('666666', 'Enrolled', '2006-05-12', 'CHF' ), -('666666', 'Disenrolled', '2006-06-01', 'CAD' ); -PREPARE STMT FROM -"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1 - WHERE Member_ID=? AND Action='Enrolled' AND - (Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1 - WHERE Member_ID=? - GROUP BY Track - HAVING Track>='CAD' AND - MAX(Action_Date)>'2006-03-01')"; -SET @id='111111'; -EXECUTE STMT USING @id,@id; -GROUP_CONCAT(Track SEPARATOR ', ') -NULL -SET @id='222222'; -EXECUTE STMT USING @id,@id; -GROUP_CONCAT(Track SEPARATOR ', ') -CAD -DEALLOCATE PREPARE STMT; -DROP TABLE t1; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (i INT, INDEX(i)); -INSERT INTO t1 VALUES (1); -PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(COUNT(i) = 1) COUNT(i) -0 0 -SET @a = 1; -EXECUTE stmt USING @a; -(COUNT(i) = 1) COUNT(i) -1 1 -SET @a = 0; -EXECUTE stmt USING @a; -(COUNT(i) = 1) COUNT(i) -0 0 -PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(AVG(i) = 1) AVG(i) -NULL NULL -SET @a = 1; -EXECUTE stmt USING @a; -(AVG(i) = 1) AVG(i) -1 1.0000 -SET @a = 0; -EXECUTE stmt USING @a; -(AVG(i) = 1) AVG(i) -NULL NULL -PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(VARIANCE(i) = 1) VARIANCE(i) -NULL NULL -SET @a = 1; -EXECUTE stmt USING @a; -(VARIANCE(i) = 1) VARIANCE(i) -0 0.0000 -SET @a = 0; -EXECUTE stmt USING @a; -(VARIANCE(i) = 1) VARIANCE(i) -NULL NULL -PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(STDDEV(i) = 1) STDDEV(i) -NULL NULL -SET @a = 1; -EXECUTE stmt USING @a; -(STDDEV(i) = 1) STDDEV(i) -0 0.0000 -SET @a = 0; -EXECUTE stmt USING @a; -(STDDEV(i) = 1) STDDEV(i) -NULL NULL -PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_OR(i) = 1) BIT_OR(i) -0 0 -SET @a = 1; -EXECUTE stmt USING @a; -(BIT_OR(i) = 1) BIT_OR(i) -1 1 -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_OR(i) = 1) BIT_OR(i) -0 0 -PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_AND(i) = 1) BIT_AND(i) -0 18446744073709551615 -SET @a = 1; -EXECUTE stmt USING @a; -(BIT_AND(i) = 1) BIT_AND(i) -1 1 -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_AND(i) = 1) BIT_AND(i) -0 18446744073709551615 -PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?"; -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_XOR(i) = 1) BIT_XOR(i) -0 0 -SET @a = 1; -EXECUTE stmt USING @a; -(BIT_XOR(i) = 1) BIT_XOR(i) -1 1 -SET @a = 0; -EXECUTE stmt USING @a; -(BIT_XOR(i) = 1) BIT_XOR(i) -0 0 -DEALLOCATE PREPARE stmt; -DROP TABLE t1; DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (i INT); PREPARE st_19182 @@ -1311,7 +1087,7 @@ t1 CREATE TABLE `t1` ( show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( - `test` char(4) character set latin1 NOT NULL default '' + `test` varchar(4) character set latin1 NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 drop table mysqltest.t1; drop table mysqltest.t2; @@ -1326,7 +1102,7 @@ t1 CREATE TABLE `t1` ( show create table mysqltest.t2; Table Create Table t2 CREATE TABLE `t2` ( - `test` char(4) NOT NULL default '' + `test` varchar(4) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop database mysqltest; deallocate prepare stmt1; @@ -1336,14 +1112,14 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; execute stmt; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; deallocate prepare stmt; End of 4.1 tests. @@ -1787,4 +1563,54 @@ Variable_name Value Slow_queries 1 deallocate prepare no_index; deallocate prepare sq; +drop table if exists t1; +create table t1 (s1 char(20)); +prepare stmt from "alter table t1 modify s1 int"; +execute stmt; +execute stmt; +drop table t1; +deallocate prepare stmt; +drop table if exists t1; +create table t1 (a int, b int); +prepare s_6895 from "alter table t1 drop column b"; +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +deallocate prepare s_6895; +drop table t1; +create table t1 (i int primary key auto_increment) comment='comment for table t1'; +create table t2 (i int, j int, k int); +prepare stmt from "alter table t1 auto_increment=100"; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL auto_increment, + PRIMARY KEY (`i`) +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +flush tables; +select * from t2; +i j k +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL auto_increment, + PRIMARY KEY (`i`) +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +deallocate prepare stmt; +drop table t1, t2; End of 5.0 tests. diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 1bb4b3a405b..50ffe55ec02 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5626,5 +5626,22 @@ Called B Called B drop procedure proc_21462_a| drop procedure proc_21462_b| +drop table if exists t3| +drop procedure if exists proc_bug19733| +create table t3 (s1 int)| +create procedure proc_bug19733() +begin +declare v int default 0; +while v < 100 do +create index i on t3 (s1); +drop index i on t3; +set v = v + 1; +end while; +end| +call proc_bug19733()| +call proc_bug19733()| +call proc_bug19733()| +drop procedure proc_bug19733| +drop table t3| End of 5.0 tests drop table t1,t2; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 9afb5c5ba59..e70ceeec077 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1610,4 +1610,76 @@ execute sq; deallocate prepare no_index; deallocate prepare sq; +# +# Bug#4968 "Stored procedure crash if cursor opened on altered table" +# The bug is not repeatable any more after the fix for +# Bug#15217 "Bug #15217 Using a SP cursor on a table created with PREPARE +# fails with weird error", however ALTER TABLE is not re-execution friendly +# and that caused a valgrind warning. Check that the warning is gone. +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (s1 char(20)); +prepare stmt from "alter table t1 modify s1 int"; +execute stmt; +execute stmt; +drop table t1; +deallocate prepare stmt; + +# +# Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing" +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, b int); +prepare s_6895 from "alter table t1 drop column b"; +execute s_6895; +show columns from t1; +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +deallocate prepare s_6895; +drop table t1; + +# +# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server" +# +# 5.0 part of the test. +# + +# ALTER TABLE +create table t1 (i int primary key auto_increment) comment='comment for table t1'; +create table t2 (i int, j int, k int); +prepare stmt from "alter table t1 auto_increment=100"; +execute stmt; +show create table t1; +# Let us trash table-cache's memory +flush tables; +select * from t2; +execute stmt; +show create table t1; +deallocate prepare stmt; +drop table t1, t2; +# 5.1 part of the test. +# CREATE DATABASE +#set @old_character_set_server= @@character_set_server; +#set @@character_set_server= latin1; +#prepare stmt from "create database mysqltest"; +#execute stmt; +#show create database mysqltest; +#drop database mysqltest; +#set @@character_set_server= utf8; +#execute stmt; +#show create database mysqltest; +#drop database mysqltest; +#deallocate prepare stmt; +#set @@character_set_server= @old_character_set_server; + --echo End of 5.0 tests. diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index fc6e8714a65..c0a5f69fd7c 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -6587,6 +6587,34 @@ call proc_21462_b(1)| drop procedure proc_21462_a| drop procedure proc_21462_b| + +# +# Bug#19733 "Repeated alter, or repeated create/drop, fails" +# Check that CREATE/DROP INDEX is re-execution friendly. +# +--disable_warnings +drop table if exists t3| +drop procedure if exists proc_bug19733| +--enable_warnings +create table t3 (s1 int)| + +create procedure proc_bug19733() +begin + declare v int default 0; + while v < 100 do + create index i on t3 (s1); + drop index i on t3; + set v = v + 1; + end while; +end| + +call proc_bug19733()| +call proc_bug19733()| +call proc_bug19733()| + +drop procedure proc_bug19733| +drop table t3| + --echo End of 5.0 tests diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 79e91dc4cb1..24c8e9863dd 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2620,11 +2620,11 @@ bool select_insert::send_eof() temporary table flag) create_table in Pointer to TABLE_LIST object providing database and name for table to be created or to be open - extra_fields in/out Initial list of fields for table to be created - keys in List of keys for table to be created + alter_info in/out Initial list of columns and indexes for the table + to be created items in List of items which should be used to produce rest of fields for the table (corresponding fields will - be added to the end of 'extra_fields' list) + be added to the end of alter_info->create_list) lock out Pointer to the MYSQL_LOCK object for table created (open) will be returned in this parameter. Since this table is not included in THD::lock caller is @@ -2646,8 +2646,8 @@ bool select_insert::send_eof() static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, TABLE_LIST *create_table, - List *extra_fields, - List *keys, List *items, + Alter_info *alter_info, + List *items, MYSQL_LOCK **lock) { TABLE tmp_table; // Used during 'create_field()' @@ -2686,7 +2686,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, DBUG_RETURN(0); if (item->maybe_null) cr_field->flags &= ~NOT_NULL_FLAG; - extra_fields->push_back(cr_field); + alter_info->create_list.push_back(cr_field); } /* create and lock table @@ -2707,8 +2707,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, { tmp_disable_binlog(thd); if (!mysql_create_table(thd, create_table->db, create_table->table_name, - create_info, *extra_fields, *keys, 0, - select_field_count)) + create_info, alter_info, 0, select_field_count)) { /* If we are here in prelocked mode we either create temporary table diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e063db58488..46fa205a25c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1062,8 +1062,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) create_list(rhs.create_list, mem_root), flags(rhs.flags), keys_onoff(rhs.keys_onoff), - tablespace_op(rhs.tablespace_op), - is_simple(rhs.is_simple) + tablespace_op(rhs.tablespace_op) {} diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index aa69e3133fc..8cf6e84fc2c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2908,12 +2908,13 @@ mysql_execute_command(THD *thd) { /* out of memory when creating a copy of alter_info */ res= 1; - goto unsent_create_error; + goto end_with_restore_list; } if ((res= create_table_precheck(thd, select_tables, create_table))) goto end_with_restore_list; + #ifndef HAVE_READLINK create_info.data_file_name= create_info.index_file_name= NULL; #else @@ -2969,7 +2970,7 @@ mysql_execute_command(THD *thd) Is table which we are changing used somewhere in other parts of query */ - if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) + if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE)) { TABLE_LIST *duplicate; if ((duplicate= unique_table(thd, create_table, select_tables))) @@ -2980,10 +2981,10 @@ mysql_execute_command(THD *thd) } } /* If we create merge table, we have to test tables in merge, too */ - if (lex->create_info.used_fields & HA_CREATE_USED_UNION) + if (create_info.used_fields & HA_CREATE_USED_UNION) { TABLE_LIST *tab; - for (tab= (TABLE_LIST*) lex->create_info.merge_list.first; + for (tab= (TABLE_LIST*) create_info.merge_list.first; tab; tab= tab->next_local) { @@ -3021,7 +3022,7 @@ mysql_execute_command(THD *thd) /* regular create */ if (lex->name) res= mysql_create_like_table(thd, create_table, &create_info, - (Table_ident *)lex->name); + (Table_ident *)lex->name); else { res= mysql_create_table(thd, create_table->db, @@ -3075,9 +3076,9 @@ end_with_restore_list: create_info.db_type= DB_TYPE_DEFAULT; create_info.default_table_charset= thd->variables.collation_database; - res= mysql_alter_table(thd, first_table->db, first_table->real_name, + res= mysql_alter_table(thd, first_table->db, first_table->table_name, &create_info, first_table, &alter_info, - 0, (ORDER*)0, DUP_ERROR, 0); + 0, (ORDER*) 0, 0); break; } #ifdef HAVE_REPLICATION @@ -3820,6 +3821,7 @@ end_with_restore_list: break; } #endif + if (check_access(thd,CREATE_ACL,lex->name,0,1,0,is_schema_db(lex->name))) break; res= mysql_create_db(thd,(lower_case_table_names == 2 ? alias : lex->name), @@ -4507,7 +4509,7 @@ end_with_restore_list: goto error; } - my_bool nsok= thd->net.no_send_ok; + my_bool save_no_send_ok= thd->net.no_send_ok; thd->net.no_send_ok= TRUE; if (sp->m_flags & sp_head::MULTI_RESULTS) { @@ -4518,7 +4520,7 @@ end_with_restore_list: back */ my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str); - thd->net.no_send_ok= nsok; + thd->net.no_send_ok= save_no_send_ok; goto error; } /* @@ -4534,7 +4536,7 @@ end_with_restore_list: if (check_routine_access(thd, EXECUTE_ACL, sp->m_db.str, sp->m_name.str, TRUE, FALSE)) { - thd->net.no_send_ok= nsok; + thd->net.no_send_ok= save_no_send_ok; goto error; } #endif @@ -4561,7 +4563,7 @@ end_with_restore_list: thd->variables.select_limit= select_limit; - thd->net.no_send_ok= nsok; + thd->net.no_send_ok= save_no_send_ok; thd->server_status&= ~bits_to_be_cleared; if (!res) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 56691821ce1..8207a3b7909 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1569,7 +1569,7 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field) create_info [in/out] Create information (like MAX_ROWS) alter_info [in/out] List of columns and indexes to create internal_tmp_table Set to 1 if this is an internal temporary table - (From ALTER TABLE) + (From ALTER TABLE) DESCRIPTION If one creates a temporary table, this is automatically opened @@ -1592,7 +1592,7 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field) bool mysql_create_table(THD *thd,const char *db, const char *table_name, HA_CREATE_INFO *create_info, Alter_info *alter_info, - List &keys,bool internal_tmp_table, + bool internal_tmp_table, uint select_field_count) { char path[FN_REFLEN]; @@ -2327,9 +2327,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, (table->table->file->ha_check_for_upgrade(check_opt) == HA_ADMIN_NEEDS_ALTER)) { + my_bool save_no_send_ok= thd->net.no_send_ok; close_thread_tables(thd); tmp_disable_binlog(thd); // binlogging is done by caller if wanted - result_code= mysql_recreate_table(thd, table, 0); + thd->net.no_send_ok= TRUE; + result_code= mysql_recreate_table(thd, table); + thd->net.no_send_ok= save_no_send_ok; reenable_binlog(thd); goto send_result; } @@ -2956,8 +2959,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, HA_CREATE_INFO *create_info, TABLE_LIST *table_list, Alter_info *alter_info, - uint order_num, ORDER *order, - bool ignore) + uint order_num, ORDER *order, bool ignore) { TABLE *table,*new_table=0; int error; @@ -3565,7 +3567,7 @@ view_err: { tmp_disable_binlog(thd); error= mysql_create_table(thd, new_db, tmp_name, - create_info,alter_info, 1, 0); + create_info, &new_info, 1, 0); reenable_binlog(thd); if (error) DBUG_RETURN(error); @@ -4021,20 +4023,18 @@ copy_data_between_tables(TABLE *from,TABLE *to, Like mysql_alter_table(). */ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list) -int mysql_recreate_table(THD *thd, TABLE_LIST *table_list) { - LEX *lex= thd->lex; HA_CREATE_INFO create_info; Alter_info alter_info; DBUG_ENTER("mysql_recreate_table"); - bzero((char*) &create_info,sizeof(create_info)); + bzero((char*) &create_info, sizeof(create_info)); create_info.db_type=DB_TYPE_DEFAULT; create_info.row_type=ROW_TYPE_NOT_USED; create_info.default_table_charset=default_charset_info; /* Force alter table to recreate table */ - lex->alter_info.flags= ALTER_CHANGE_COLUMN; + alter_info.flags= ALTER_CHANGE_COLUMN; DBUG_RETURN(mysql_alter_table(thd, NullS, NullS, &create_info, table_list, &alter_info, 0, (ORDER *) 0, 0)); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 719d48af33f..abaed88af57 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1190,7 +1190,6 @@ create: TL_OPTION_UPDATING)) YYABORT; lex->alter_info.reset(); - lex->alter_info.is_simple= 0; lex->alter_info.flags= ALTER_ADD_INDEX; lex->col_list.empty(); lex->change=NullS; @@ -3313,7 +3312,7 @@ alter: lex->create_info.db_type= DB_TYPE_DEFAULT; lex->create_info.default_table_charset= NULL; lex->create_info.row_type= ROW_TYPE_NOT_USED; - lex->alter_info.reset(); + lex->alter_info.reset(); } alter_list {} @@ -6076,7 +6075,6 @@ drop: LEX *lex=Lex; lex->sql_command= SQLCOM_DROP_INDEX; lex->alter_info.reset(); - lex->alter_info.is_simple= 0; lex->alter_info.flags= ALTER_DROP_INDEX; lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, $3.str)); From 8bc9d6dd41c4c718456700b3c4f24828ecc66ac9 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 12 Dec 2006 12:28:02 +0100 Subject: [PATCH 046/160] Improve error message that describes waitpid($pid) returned unexpected result --- mysql-test/lib/mtr_process.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index cf0dc0dc6f8..9cf013d4e9d 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -220,7 +220,8 @@ sub spawn_parent_impl { my $ret_pid= waitpid($pid,0); if ( $ret_pid != $pid ) { - mtr_error("$path ($pid) got lost somehow"); + mtr_error("waitpid($pid, 0) returned $ret_pid " . + "when waiting for '$path'"); } return mtr_process_exit_status($?); From 9eb8a3fbeeb9ef8daaf5669facbe710c3fea7de7 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 13 Dec 2006 23:30:20 +0100 Subject: [PATCH 047/160] change all auto_ptr in yaSSL to mySTL since some lack reset --- extra/yassl/src/ssl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index ec2e99adecb..aa98465069c 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -122,7 +122,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) EVP_BytesToKey(info.name, "MD5", info.iv, (byte*)password, passwordSz, 1, key, iv); - STL::auto_ptr cipher; + mySTL::auto_ptr cipher; if (strncmp(info.name, "DES-CBC", 7) == 0) cipher.reset(NEW_YS DES); else if (strncmp(info.name, "DES-EDE3-CBC", 13) == 0) @@ -138,7 +138,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) return SSL_BAD_FILE; } cipher->set_decryptKey(key, info.iv); - STL::auto_ptr newx(NEW_YS x509(x->get_length())); + mySTL::auto_ptr newx(NEW_YS x509(x->get_length())); cipher->decrypt(newx->use_buffer(), x->get_buffer(), x->get_length()); ysDelete(x); From ba6529d7dd7af92e71fefea9fa170cbeba6ebd39 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 14 Dec 2006 14:05:25 +0400 Subject: [PATCH 048/160] Bug#17642 mysqlbinlog: Restore from row-based binlog fails Problem: mysqlbinlog_base64 failed sporadically. Reason: Missing "flush logs" before running $MYSQL_BINLOG, which could start dumping the log file before server has finished writting into it. Fix: - implementing --force-if-open option to "mysqlbinlog" - adding --disable-force-if-open to make $MYSQL_BINLOG fail on non-closed log files, to garantee that nobody will forget "flush logs" in the future. - adding "flush logs" into all affected tests. --- client/mysqlbinlog.cc | 21 +++++++++++++++++++ mysql-test/mysql-test-run.pl | 2 +- .../r/binlog_row_mix_innodb_myisam.result | 1 + .../r/binlog_stm_mix_innodb_myisam.result | 1 + mysql-test/r/mysqlbinlog.result | 2 ++ mysql-test/r/mysqlbinlog2.result | 1 + mysql-test/r/mysqlbinlog_base64.result | 1 + mysql-test/r/user_var-binlog.result | 1 + .../t/binlog_row_mix_innodb_myisam.test | 1 + .../t/binlog_stm_mix_innodb_myisam.test | 1 + mysql-test/t/mysqlbinlog.test | 15 +++++++++++-- mysql-test/t/mysqlbinlog2.test | 1 + mysql-test/t/mysqlbinlog_base64.test | 1 + mysql-test/t/user_var-binlog.test | 1 + 14 files changed, 47 insertions(+), 3 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index d1dcaa9f538..e3a49adf7dd 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -67,6 +67,7 @@ static bool opt_hexdump= 0; static bool opt_base64_output= 0; static const char* database= 0; static my_bool force_opt= 0, short_form= 0, remote_opt= 0, info_flag; +static my_bool force_if_open_opt= 1; static ulonglong offset = 0; static const char* host = 0; static int port= 0; @@ -86,6 +87,7 @@ static short binlog_flags = 0; static MYSQL* mysql = NULL; static const char* dirname_for_local_load= 0; static bool stop_passed= 0; +static my_bool file_not_closed_error= 0; /* check_header() will set the pointer below. @@ -648,6 +650,12 @@ Create_file event for file_id: %u\n",exv->file_id); later. */ ev= 0; + if (!force_if_open_opt && + (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)) + { + file_not_closed_error= 1; + DBUG_RETURN(1); + } break; case BEGIN_LOAD_QUERY_EVENT: ev->print(result_file, print_event_info); @@ -727,6 +735,9 @@ static struct my_option my_long_options[] = "already have. NOTE: you will need a SUPER privilege to use this option.", (gptr*) &disable_log_bin, (gptr*) &disable_log_bin, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"force-if-open", 'F', "Force if binlog was not closed properly.", + (gptr*) &force_if_open_opt, (gptr*) &force_if_open_opt, 0, GET_BOOL, NO_ARG, + 1, 0, 0, 0, 0, 0}, {"force-read", 'f', "Force reading unknown binlog events.", (gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1564,6 +1575,16 @@ int main(int argc, char** argv) my_free_open_file_info(); /* We cannot free DBUG, it is used in global destructors after exit(). */ my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG); + + if (file_not_closed_error) + { + fprintf(stderr, +"\nError: attempting to dump binlog '%s' which was not closed properly.\n" +"Most probably mysqld is still writting it, or crashed.\n" +"Your current options specify --disable-force-if-open\n" +"which means to abort on this problem.\n" +"You can rerun using --force-if-open to ignore this problem.\n\n", argv[-1]); + } exit(exit_value); DBUG_RETURN(exit_value); // Keep compilers happy } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 73755cd2df9..5df98fd865f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1849,7 +1849,7 @@ sub environment_setup () { # ---------------------------------------------------- my $cmdline_mysqlbinlog= "$exe_mysqlbinlog" . - " --no-defaults --debug-info --local-load=$opt_tmpdir"; + " --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir"; if ( $mysql_version_id >= 50000 ) { $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result index bd4e74f51a6..185ca33d4db 100644 --- a/mysql-test/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result @@ -400,6 +400,7 @@ insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 +flush logs; select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; diff --git a/mysql-test/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/r/binlog_stm_mix_innodb_myisam.result index 360c8c4a811..23f4e50826a 100644 --- a/mysql-test/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_stm_mix_innodb_myisam.result @@ -367,6 +367,7 @@ insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 +flush logs; select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 0c8c7efc6b0..febf567e48c 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -210,6 +210,7 @@ select HEX(f) from t4; HEX(f) 835C flush logs; +flush logs; select * from t5 /* must be (1),(1) */; a 1 @@ -250,3 +251,4 @@ call p1(); 1 drop procedure p1; drop table t1, t2, t03, t04, t3, t4, t5; +flush logs; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index 51ca19654c7..e76ab71fd54 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -170,6 +170,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; --- Local with 2 binlogs on command line -- +flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result index c31dbee56c6..33047a8774d 100644 --- a/mysql-test/r/mysqlbinlog_base64.result +++ b/mysql-test/r/mysqlbinlog_base64.result @@ -6,6 +6,7 @@ update t1 set a=a+2 where a=2; update t1 set a=a+2 where a=3; create table t2 (word varchar(20)); load data infile '../std_data_ln/words.dat' into table t2; +flush logs; drop table t1; drop table t2; select * from t1; diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 79a0f010c09..1c50289a85d 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -13,6 +13,7 @@ master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@`a b`) master-bin.000001 # User var 1 # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci master-bin.000001 # User var 1 # @`var2`=_binary 0x61 COLLATE binary master-bin.000001 # Query 1 # use `test`; insert into t1 values (@var1),(@var2) +flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test index baaf6b98090..b131e5350af 100644 --- a/mysql-test/t/binlog_row_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test @@ -19,6 +19,7 @@ # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) +flush logs; --exec $MYSQL_BINLOG --start-position=516 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test index 3dab9b44187..8d7399b918e 100644 --- a/mysql-test/t/binlog_stm_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test @@ -11,6 +11,7 @@ # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) +flush logs; --exec $MYSQL_BINLOG --start-position=551 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index a76bb9a2757..dc9a58c222d 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -133,6 +133,7 @@ flush logs; # resulted binlog, parly consisting of multi-byte utf8 chars, # must be digestable for both client and server. In 4.1 the client # should use default-character-set same as the server. +flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL select * from t5 /* must be (1),(1) */; @@ -155,8 +156,8 @@ call p1(); drop procedure p1; --error 1305 call p1(); ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL call p1(); drop procedure p1; @@ -164,3 +165,13 @@ drop procedure p1; drop table t1, t2, t03, t04, t3, t4, t5; # End of 5.0 tests + +# +# Test --disable-force-if-open and --force-if-open +# +flush logs; +--error 1 +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null + +# End of 5.1 tests diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 69cd5d90453..85a678055d4 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -72,6 +72,7 @@ select "--- Local with 2 binlogs on command line --" as ""; # This is to verify that some options apply only to first, or last binlog +flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 --disable_query_log diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test index 66aaff83254..1ca018218b2 100644 --- a/mysql-test/t/mysqlbinlog_base64.test +++ b/mysql-test/t/mysqlbinlog_base64.test @@ -15,6 +15,7 @@ load data infile '../std_data_ln/words.dat' into table t2; # # Save binlog # +flush logs; --exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql # diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index 6615e48ca42..ce1a476eb43 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -20,6 +20,7 @@ show binlog events from 102; # absolutely need variables names to be quoted and strings to be # escaped). --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 drop table t1; From 29f72a0ba1b24ce48806753f44ff725896fbec19 Mon Sep 17 00:00:00 2001 From: "thek@kpdesk.mysql.com" <> Date: Thu, 14 Dec 2006 13:23:31 +0100 Subject: [PATCH 049/160] Bug#17498 failed to put data file in custom directory use "data directory" option - When this bug was corrected it changed the behavior for data/index directory in the myisam test case. - This patch moves the OS depending tests to a non-windows test file. --- mysql-test/r/myisam.result | 21 --------------------- mysql-test/r/symlink.result | 21 +++++++++++++++++++++ mysql-test/t/myisam.test | 37 ------------------------------------- mysql-test/t/symlink.test | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 05f72b22ed1..36356351601 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -797,24 +797,3 @@ a b xxxxxxxxx bbbbbb xxxxxxxxx bbbbbb DROP TABLE t1; -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -create table t1 (a int) engine=myisam select 42 a; -select * from t1; -a -9 -select * from t1; -a -99 -select * from t1; -a -42 -drop table t1; diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index f6779689133..b104ce50a56 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -102,3 +102,24 @@ t1 CREATE TABLE `t1` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' +create table t1 (a int) engine=myisam select 42 a; +select * from t1; +a +9 +select * from t1; +a +99 +select * from t1; +a +42 +drop table t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index a62a6487882..6254ff83a2f 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -762,41 +762,4 @@ UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; SELECT * FROM t1; DROP TABLE t1; -# -# Bug#8706 - temporary table with data directory option fails -# -connect (session1,localhost,root,,); -connect (session2,localhost,root,,); - -connection session1; -disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a; -enable_query_log; -# If running test suite with a non standard tmp dir, the "show create table" -# will print "DATA_DIRECTORY=". Use replace_result to mask it out ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -show create table t1; - -connection session2; -disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a; -enable_query_log; -# If running test suite with a non standard tmp dir, the "show create table" -# will print "DATA_DIRECTORY=". Use replace_result to mask it out ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -show create table t1; - -connection default; -create table t1 (a int) engine=myisam select 42 a; - -connection session1; -select * from t1; -disconnect session1; -connection session2; -select * from t1; -disconnect session2; -connection default; -select * from t1; -drop table t1; - # End of 4.1 tests diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index c0c1db3d553..201a2866c4f 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -133,4 +133,41 @@ enable_query_log; show create table t1; drop table t1; +# +# Bug#8706 - temporary table with data directory option fails +# +connect (session1,localhost,root,,); +connect (session2,localhost,root,,); + +connection session1; +disable_query_log; +eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a; +enable_query_log; +# If running test suite with a non standard tmp dir, the "show create table" +# will print "DATA_DIRECTORY=". Use replace_result to mask it out +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +show create table t1; + +connection session2; +disable_query_log; +eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a; +enable_query_log; +# If running test suite with a non standard tmp dir, the "show create table" +# will print "DATA_DIRECTORY=". Use replace_result to mask it out +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +show create table t1; + +connection default; +create table t1 (a int) engine=myisam select 42 a; + +connection session1; +select * from t1; +disconnect session1; +connection session2; +select * from t1; +disconnect session2; +connection default; +select * from t1; +drop table t1; + # End of 4.1 tests From cfdec2ca1eb18bc05478d3323ec1c9aa2d06a5b1 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Thu, 14 Dec 2006 16:31:23 +0400 Subject: [PATCH 050/160] After merge fix for bug N22645 --- mysql-test/t/mysqlbinlog.test | 4 ++-- sql/log_event.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index eeed508f474..b2bda247cd7 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -171,8 +171,8 @@ call p1(); drop procedure p1; --error 1305 call p1(); ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 | $MYSQL call p1(); drop procedure p1; diff --git a/sql/log_event.cc b/sql/log_event.cc index da4fa2566ac..2c6dfff3db3 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1089,7 +1089,7 @@ bool Query_log_event::write(IO_CACHE* file) 1+4+ // code of autoinc and the 2 autoinc variables 1+6+ // code of charset and charset 1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name - 1+2 // code of lc_time_names and lc_time_names + 1+2 // code of lc_time_names and lc_time_names_number ], *start, *start_of_status; ulong event_length; From 7e60087441bddebab63f78d24006747365cf95fb Mon Sep 17 00:00:00 2001 From: "thek@kpdesk.mysql.com" <> Date: Thu, 14 Dec 2006 13:45:17 +0100 Subject: [PATCH 051/160] Bug#17498 failed to put data file in custom directory use "data directory" option Merged 4.1->5.0. Updated myisam.test --- mysql-test/r/myisam.result | 13 ------------- mysql-test/t/myisam.test | 34 ---------------------------------- 2 files changed, 47 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 2ea317754ec..b9e656de6be 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1608,16 +1608,3 @@ create table t3 (c1 int) engine=myisam pack_keys=default; create table t4 (c1 int) engine=myisam pack_keys=2; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1 drop table t1, t2, t3; -show create table t1; -show create table t1; -create table t1 (a int) engine=myisam select 42 a; -select * from t1; -a -9 -select * from t1; -a -99 -select * from t1; -a -42 -drop table t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d785002abdd..90b71a30c27 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -969,39 +969,5 @@ create table t3 (c1 int) engine=myisam pack_keys=default; --error 1064 create table t4 (c1 int) engine=myisam pack_keys=2; drop table t1, t2, t3; -# -# Bug#8706 - temporary table with data directory option fails -# -connect (session1,localhost,root,,); -connect (session2,localhost,root,,); - -connection session1; -disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/tmp" select 9 a; -enable_query_log; -disable_result_log; -show create table t1; -enable_result_log; - -connection session2; -disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/tmp" select 99 a; -enable_query_log; -disable_result_log; -show create table t1; -enable_result_log; - -connection default; -create table t1 (a int) engine=myisam select 42 a; - -connection session1; -select * from t1; -disconnect session1; -connection session2; -select * from t1; -disconnect session2; -connection default; -select * from t1; -drop table t1; # End of 4.1 tests From 4722743cae0e19a3025d688e87a17159ba4a0b73 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.myoffice.izhnet.ru" <> Date: Thu, 14 Dec 2006 17:48:32 +0400 Subject: [PATCH 052/160] After merge fix for Bug N22645 --- mysql-test/t/disabled.def | 1 - sql/log_event.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 09e91f434d5..c36ac1bd168 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -21,7 +21,6 @@ rpl_ndb_sync : Problem with cluster/def/schema table that is in std_ partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open -rpl_locale : Bug#22645 2006-12-05 bar rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated rpl_ndb_2myisam : BUG#19227 Seems to pass currently rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD diff --git a/sql/log_event.cc b/sql/log_event.cc index 699fea3b357..fbfb81fb46c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1844,7 +1844,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, } if (lc_time_names_number != print_event_info->lc_time_names_number) { - fprintf(file, "SET @@session.lc_time_names=%d;\n", lc_time_names_number); + my_b_printf(file, "SET @@session.lc_time_names=%d;\n", lc_time_names_number); print_event_info->lc_time_names_number= lc_time_names_number; } } From c41e307d85ba9399eb219fa5718ba8ab5af847c3 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Thu, 14 Dec 2006 15:23:44 +0100 Subject: [PATCH 053/160] BUG#24687 func_misc test fails on win64 - Use same precision (milliseconds) for all time functions used when calculating time for pthread_cond_timedwait - Use 'GetSystemTimeAsFileTime' for both start and curr time --- include/config-win.h | 1 - include/my_global.h | 36 +---------- include/my_pthread.h | 79 ++++++++++++++++++++--- mysys/my_wincond.c | 28 ++++++-- server-tools/instance-manager/guardian.cc | 5 +- server-tools/instance-manager/instance.cc | 5 +- 6 files changed, 96 insertions(+), 58 deletions(-) diff --git a/include/config-win.h b/include/config-win.h index 75133ddc837..3c76dee40a1 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -249,7 +249,6 @@ inline double ulonglong2double(ulonglong value) #define tell(A) _telli64(A) #endif -#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; } #define STACK_DIRECTION -1 diff --git a/include/my_global.h b/include/my_global.h index 7c072b2fc5c..d297f6f543c 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1010,41 +1010,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ -#ifdef HAVE_TIMESPEC_TS_SEC -#ifndef set_timespec -#define set_timespec(ABSTIME,SEC) \ -{ \ - (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \ - (ABSTIME).ts_nsec=0; \ -} -#endif /* !set_timespec */ -#ifndef set_timespec_nsec -#define set_timespec_nsec(ABSTIME,NSEC) \ -{ \ - ulonglong now= my_getsystime() + (NSEC/100); \ - (ABSTIME).ts_sec= (now / ULL(10000000)); \ - (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ -} -#endif /* !set_timespec_nsec */ -#else -#ifndef set_timespec -#define set_timespec(ABSTIME,SEC) \ -{\ - struct timeval tv;\ - gettimeofday(&tv,0);\ - (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ - (ABSTIME).tv_nsec=tv.tv_usec*1000;\ -} -#endif /* !set_timespec */ -#ifndef set_timespec_nsec -#define set_timespec_nsec(ABSTIME,NSEC) \ -{\ - ulonglong now= my_getsystime() + (NSEC/100); \ - (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \ - (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ -} -#endif /* !set_timespec_nsec */ -#endif /* HAVE_TIMESPEC_TS_SEC */ + /* Define-funktions for reading and storing in machine independent format diff --git a/include/my_pthread.h b/include/my_pthread.h index 300291610d3..ebba0ab32e1 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -69,14 +69,6 @@ typedef struct { #endif } pthread_cond_t; - -#ifndef OS2 -struct timespec { /* For pthread_cond_timedwait() */ - time_t tv_sec; - long tv_nsec; -}; -#endif - typedef int pthread_mutexattr_t; #define win_pthread_self my_thread_var->pthread_self #ifdef OS2 @@ -87,6 +79,34 @@ typedef void * (_Optlink *pthread_handler)(void *); typedef void * (__cdecl *pthread_handler)(void *); #endif +/* + Struct and macros to be used in combination with the + windows implementation of pthread_cond_timedwait +*/ + +/* + Declare a union to make sure FILETIME is properly aligned + so it can be used directly as a 64 bit value. The value + stored is in 100ns units. + */ + union ft64 { + FILETIME ft; + __int64 i64; + }; +struct timespec { + union ft64 start; + /* The max timeout value in millisecond for pthread_cond_timedwait */ + long timeout_msec; +}; +#define set_timespec(ABSTIME,SEC) { \ + GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ + (ABSTIME).timeout_msec= (long)((SEC)*1000); \ +} +#define set_timespec_nsec(ABSTIME,NSEC) { \ + GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ + (ABSTIME).timeout_msec= (long)((NSEC)/1000000); \ +} + void win_pthread_init(void); int win_pthread_setspecific(void *A,void *B,uint length); int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *); @@ -164,8 +184,6 @@ extern int pthread_mutex_destroy (pthread_mutex_t *); #define pthread_condattr_init(A) #define pthread_condattr_destroy(A) -/*Irena: compiler does not like this: */ -/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */ #define my_pthread_getprio(thread_id) pthread_dummy(0) #elif defined(HAVE_UNIXWARE7_THREADS) @@ -473,6 +491,47 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size); int my_pthread_mutex_trylock(pthread_mutex_t *mutex); #endif +/* + The defines set_timespec and set_timespec_nsec should be used + for calculating an absolute time at which + pthread_cond_timedwait should timeout +*/ +#ifdef HAVE_TIMESPEC_TS_SEC +#ifndef set_timespec +#define set_timespec(ABSTIME,SEC) \ +{ \ + (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \ + (ABSTIME).ts_nsec=0; \ +} +#endif /* !set_timespec */ +#ifndef set_timespec_nsec +#define set_timespec_nsec(ABSTIME,NSEC) \ +{ \ + ulonglong now= my_getsystime() + (NSEC/100); \ + (ABSTIME).ts_sec= (now / ULL(10000000)); \ + (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ +} +#endif /* !set_timespec_nsec */ +#else +#ifndef set_timespec +#define set_timespec(ABSTIME,SEC) \ +{\ + struct timeval tv;\ + gettimeofday(&tv,0);\ + (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ + (ABSTIME).tv_nsec=tv.tv_usec*1000;\ +} +#endif /* !set_timespec */ +#ifndef set_timespec_nsec +#define set_timespec_nsec(ABSTIME,NSEC) \ +{\ + ulonglong now= my_getsystime() + (NSEC/100); \ + (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \ + (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ +} +#endif /* !set_timespec_nsec */ +#endif /* HAVE_TIMESPEC_TS_SEC */ + /* safe_mutex adds checking to mutex for easier debugging */ #if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index 8c497e8f250..327addff2cc 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -54,14 +54,30 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *abstime) { - struct _timeb curtime; int result; - long timeout; - _ftime(&curtime); - timeout= ((long) (abstime->tv_sec - curtime.time)*1000L + - (long)((abstime->tv_nsec/1000) - curtime.millitm)/1000L); - if (timeout < 0) /* Some safety */ + long timeout; + union ft64 now; + + GetSystemTimeAsFileTime(&now.ft); + + /* + - subtract start time from current time(values are in 100ns units + - convert to millisec by dividing with 10000 + - subtract time since start from max timeout + */ + timeout= abstime->timeout_msec - (long)((now.i64 - abstime->start.i64) / 10000); + + /* Don't allow the timeout to be negative */ + if (timeout < 0) timeout = 0L; + + /* + Make sure the calucated time does not exceed original timeout + value which could cause "wait for ever" if system time changes + */ + if (timeout > abstime->timeout_msec) + timeout= abstime->timeout_msec; + InterlockedIncrement(&cond->waiting); LeaveCriticalSection(mutex); result=WaitForSingleObject(cond->semaphore,timeout); diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc index 0a037b5b98a..9fabb1923a8 100644 --- a/server-tools/instance-manager/guardian.cc +++ b/server-tools/instance-manager/guardian.cc @@ -228,9 +228,8 @@ void Guardian_thread::run() node= node->next; } - timeout.tv_sec= time(NULL) + monitoring_interval; - timeout.tv_nsec= 0; - + set_timespec(timeout, monitoring_interval); + /* check the loop predicate before sleeping */ if (!(shutdown_requested && (!(guarded_instances)))) thread_registry.cond_timedwait(&thread_info, &COND_guardian, diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index daa8082ef2f..39793b9a234 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -476,10 +476,9 @@ int Instance::stop() waitchild= options.shutdown_delay_val; kill_instance(SIGTERM); - /* sleep on condition to wait for SIGCHLD */ - timeout.tv_sec= time(NULL) + waitchild; - timeout.tv_nsec= 0; + /* sleep on condition to wait for SIGCHLD */ + set_timespec(timeout, waitchild); if (pthread_mutex_lock(&LOCK_instance)) return ER_STOP_INSTANCE; From 4162e009cb2fc4dc72f35c15bda34768bfaf2807 Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Thu, 14 Dec 2006 20:58:07 +0300 Subject: [PATCH 054/160] Fix for bug #24117 "server crash on a FETCH with a cursor on a table which is not in the table cache" Problem: When creating a temporary field for a temporary table in create_tmp_field_from_field(), a resulting field is created as an exact copy of an original one (in Field::new_field()). However, Field_enum and Field_set contain a pointer (typelib) to memory allocated in the parent table's MEM_ROOT, which under some circumstances may be deallocated later by the time a temporary table is used. Solution: Override the new_field() method for Field_enum and Field_set and create a separate copy of the typelib structure in there. --- include/typelib.h | 3 +++ mysql-test/r/sp.result | 16 +++++++++++++ mysql-test/t/sp.test | 24 ++++++++++++++++++++ mysys/typelib.c | 51 ++++++++++++++++++++++++++++++++++++++++++ sql/field.cc | 10 +++++++++ sql/field.h | 1 + 6 files changed, 105 insertions(+) diff --git a/include/typelib.h b/include/typelib.h index 4d6a90ad51e..fe19f1001d4 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -18,6 +18,8 @@ #ifndef _typelib_h #define _typelib_h +#include "my_alloc.h" + typedef struct st_typelib { /* Different types saved here */ unsigned int count; /* How many types */ const char *name; /* Name of typelib */ @@ -28,6 +30,7 @@ typedef struct st_typelib { /* Different types saved here */ extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name); extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); +extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); extern TYPELIB sql_protocol_typelib; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 9db4325aea2..793abb417fb 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5708,4 +5708,20 @@ DROP TABLE bug23760, bug23760_log| DROP PROCEDURE bug23760_update_log| DROP PROCEDURE bug23760_test_row_count| DROP FUNCTION bug23760_rc_test| +DROP PROCEDURE IF EXISTS bug24117| +DROP TABLE IF EXISTS t3| +CREATE TABLE t3(c1 ENUM('abc'))| +INSERT INTO t3 VALUES('abc')| +CREATE PROCEDURE bug24117() +BEGIN +DECLARE t3c1 ENUM('abc'); +DECLARE mycursor CURSOR FOR SELECT c1 FROM t3; +OPEN mycursor; +FLUSH TABLES; +FETCH mycursor INTO t3c1; +CLOSE mycursor; +END| +CALL bug24117()| +DROP PROCEDURE bug24117| +DROP TABLE t3| drop table t1,t2; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 524ee9cf66c..95bb9f7c376 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -6662,6 +6662,30 @@ DROP PROCEDURE bug23760_update_log| DROP PROCEDURE bug23760_test_row_count| DROP FUNCTION bug23760_rc_test| +# +# BUG#24117: server crash on a FETCH with a cursor on a table which is not in +# the table cache +# + +--disable_warnings +DROP PROCEDURE IF EXISTS bug24117| +DROP TABLE IF EXISTS t3| +--enable_warnings +CREATE TABLE t3(c1 ENUM('abc'))| +INSERT INTO t3 VALUES('abc')| +CREATE PROCEDURE bug24117() +BEGIN + DECLARE t3c1 ENUM('abc'); + DECLARE mycursor CURSOR FOR SELECT c1 FROM t3; + OPEN mycursor; + FLUSH TABLES; + FETCH mycursor INTO t3c1; + CLOSE mycursor; +END| +CALL bug24117()| +DROP PROCEDURE bug24117| +DROP TABLE t3| + # # NOTE: The delimiter is `|`, and not `;`. It is changed to `;` # at the end of the file! diff --git a/mysys/typelib.c b/mysys/typelib.c index 90a093b0b32..230a2989cbd 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -119,3 +119,54 @@ const char *get_type(TYPELIB *typelib, uint nr) return(typelib->type_names[nr]); return "?"; } + + +/* + Create a copy of a specified TYPELIB structure. + + SYNOPSIS + copy_typelib() + root pointer to a MEM_ROOT object for allocations + from pointer to a source TYPELIB structure + + RETURN + pointer to the new TYPELIB structure on successful copy, or + NULL otherwise +*/ + +TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from) +{ + TYPELIB *to; + uint i; + + if (!from) + return NULL; + + if (!(to= (TYPELIB*) alloc_root(root, sizeof(TYPELIB)))) + return NULL; + + if (!(to->type_names= (const char **) + alloc_root(root, (sizeof(char *) + sizeof(int)) * (from->count + 1)))) + return NULL; + to->type_lengths= (unsigned int *)(to->type_names + from->count + 1); + to->count= from->count; + if (from->name) + { + if (!(to->name= strdup_root(root, from->name))) + return NULL; + } + else + to->name= NULL; + + for (i= 0; i < from->count; i++) + { + if (!(to->type_names[i]= strmake_root(root, from->type_names[i], + from->type_lengths[i]))) + return NULL; + to->type_lengths[i]= from->type_lengths[i]; + } + to->type_names[to->count]= NULL; + to->type_lengths[to->count]= 0; + + return to; +} diff --git a/sql/field.cc b/sql/field.cc index ec97bc92d24..684ce5602d4 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7672,6 +7672,16 @@ void Field_enum::sql_type(String &res) const } +Field *Field_enum::new_field(MEM_ROOT *root, struct st_table *new_table, + bool keep_type) +{ + Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type); + if (res) + res->typelib= copy_typelib(root, typelib); + return res; +} + + /* set type. This is a string which can have a collection of different values. diff --git a/sql/field.h b/sql/field.h index b79c2bf77a8..01b05d886a8 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1277,6 +1277,7 @@ public: { flags|=ENUM_FLAG; } + Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); enum_field_types type() const { return FIELD_TYPE_STRING; } enum Item_result cmp_type () const { return INT_RESULT; } enum Item_result cast_to_int_type () const { return INT_RESULT; } From bad9af4f58a73124928d19df9031ba35a3d5923e Mon Sep 17 00:00:00 2001 From: "jpipes@shakedown.(none)" <> Date: Thu, 14 Dec 2006 14:54:59 -0500 Subject: [PATCH 055/160] Fix for Bug#21970. The mysql-test-run-shell.sh script was improperly evaluating an expression for setting up multiple masters. This fix adds the `expr $MASTER_MYPORT + 1` construct to the offending line in order for the expression to evaluate properly and produce 9307 instead of the string "9306+1" --- mysql-test/mysql-test-run-shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh index 544721cf40d..92c64260112 100644 --- a/mysql-test/mysql-test-run-shell.sh +++ b/mysql-test/mysql-test-run-shell.sh @@ -1793,7 +1793,7 @@ then $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 - $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT+1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 + $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $MASTER_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --host=$hostname --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 $MYSQLADMIN --no-defaults --host=$hostname --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1 sleep_until_file_deleted 0 $MASTER_MYPID From 54e7d71477b673db69538219ab5419d1fda33283 Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Thu, 14 Dec 2006 12:18:36 -0800 Subject: [PATCH 056/160] Change permissions on $mysql_unix_port_dir if we create it so that everyone can access it. --- scripts/mysqld_safe.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index c655910dc2c..c867d15a389 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -195,6 +195,7 @@ if [ ! -d $mysql_unix_port_dir ] then mkdir $mysql_unix_port_dir chown $user $mysql_unix_port_dir + chmod 755 $mysql_unix_port_dir fi # Use the mysqld-max binary by default if the user doesn't specify a binary From 110b8af30396ba92efad2d51eb4ed82914903332 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 14 Dec 2006 21:48:08 +0100 Subject: [PATCH 057/160] Put the DBUG_DUMP inside ifdef DEBUG_DATA_PACKETS --- sql/net_serv.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index e84b2266e82..3037007ae35 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -597,7 +597,10 @@ net_real_write(NET *net,const char *packet,ulong len) } #endif /* HAVE_COMPRESS */ - /* DBUG_DUMP("net",packet,len); */ +#ifdef DEBUG_DATA_PACKETS + DBUG_DUMP("data",packet,len); +#endif + #ifndef NO_ALARM thr_alarm_init(&alarmed); if (net_blocking) From 1feb18872125f3b275ed35609a5fdcfceed7ac06 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Thu, 14 Dec 2006 15:36:45 -0700 Subject: [PATCH 058/160] include/my_pthread.h: Fix botched merge - add struct timespec and set_timespec(), etc. --- include/my_pthread.h | 71 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index b3d84e70d6a..d44fd97c318 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -66,6 +66,34 @@ typedef int pthread_mutexattr_t; #define pthread_handler_t EXTERNC void * __cdecl typedef void * (__cdecl *pthread_handler)(void *); +/* + Struct and macros to be used in combination with the + windows implementation of pthread_cond_timedwait +*/ + +/* + Declare a union to make sure FILETIME is properly aligned + so it can be used directly as a 64 bit value. The value + stored is in 100ns units. + */ + union ft64 { + FILETIME ft; + __int64 i64; + }; +struct timespec { + union ft64 start; + /* The max timeout value in millisecond for pthread_cond_timedwait */ + long timeout_msec; +}; +#define set_timespec(ABSTIME,SEC) { \ + GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ + (ABSTIME).timeout_msec= (long)((SEC)*1000); \ +} +#define set_timespec_nsec(ABSTIME,NSEC) { \ + GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ + (ABSTIME).timeout_msec= (long)((NSEC)/1000000); \ +} + void win_pthread_init(void); int win_pthread_setspecific(void *A,void *B,uint length); int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *); @@ -141,8 +169,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ #define pthread_condattr_init(A) #define pthread_condattr_destroy(A) -/*Irena: compiler does not like this: */ -/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */ #define my_pthread_getprio(thread_id) pthread_dummy(0) #else /* Normal threads */ @@ -367,6 +393,47 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size); int my_pthread_mutex_trylock(pthread_mutex_t *mutex); #endif +/* + The defines set_timespec and set_timespec_nsec should be used + for calculating an absolute time at which + pthread_cond_timedwait should timeout +*/ +#ifdef HAVE_TIMESPEC_TS_SEC +#ifndef set_timespec +#define set_timespec(ABSTIME,SEC) \ +{ \ + (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \ + (ABSTIME).ts_nsec=0; \ +} +#endif /* !set_timespec */ +#ifndef set_timespec_nsec +#define set_timespec_nsec(ABSTIME,NSEC) \ +{ \ + ulonglong now= my_getsystime() + (NSEC/100); \ + (ABSTIME).ts_sec= (now / ULL(10000000)); \ + (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ +} +#endif /* !set_timespec_nsec */ +#else +#ifndef set_timespec +#define set_timespec(ABSTIME,SEC) \ +{\ + struct timeval tv;\ + gettimeofday(&tv,0);\ + (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ + (ABSTIME).tv_nsec=tv.tv_usec*1000;\ +} +#endif /* !set_timespec */ +#ifndef set_timespec_nsec +#define set_timespec_nsec(ABSTIME,NSEC) \ +{\ + ulonglong now= my_getsystime() + (NSEC/100); \ + (ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \ + (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ +} +#endif /* !set_timespec_nsec */ +#endif /* HAVE_TIMESPEC_TS_SEC */ + /* safe_mutex adds checking to mutex for easier debugging */ #if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) From 82db3278aa364a12beaacbe2d567e250edf02d6f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 15 Dec 2006 00:09:56 +0100 Subject: [PATCH 059/160] Add support for loading example plugin and add plugin.test --- mysql-test/include/have_example_plugin.inc | 16 ++++++++++ mysql-test/include/have_udf.inc | 2 +- mysql-test/mysql-test-run.pl | 30 +++++++++++++++---- ...f.require => have_dynamic_loading.require} | 0 mysql-test/r/have_example_plugin.require | 2 ++ mysql-test/r/plugin.result | 15 ++++++++++ mysql-test/t/plugin.test | 26 ++++++++++++++++ 7 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 mysql-test/include/have_example_plugin.inc rename mysql-test/r/{have_udf.require => have_dynamic_loading.require} (100%) create mode 100644 mysql-test/r/have_example_plugin.require create mode 100644 mysql-test/r/plugin.result create mode 100644 mysql-test/t/plugin.test diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc new file mode 100644 index 00000000000..b84f6d2f161 --- /dev/null +++ b/mysql-test/include/have_example_plugin.inc @@ -0,0 +1,16 @@ +# +# Check if server has support for loading udf's +# i.e it will support dlopen +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like "have_dynamic_loading"; +enable_query_log; + +# +# Check if the variable EXAMPLE_PLUGIN is set +# +--require r/have_example_plugin.require +disable_query_log; +eval select LENGTH("$EXAMPLE_PLUGIN") > 0 as "have_example_plugin"; +enable_query_log; diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 42b9942f74d..068ce9026e0 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -2,7 +2,7 @@ # Check if server has support for loading udf's # i.e it will support dlopen # ---require r/have_udf.require +--require r/have_dynamic_loading.require disable_query_log; show variables like "have_dynamic_loading"; enable_query_log; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c8ed0ecb6fb..0c5c0f2b3fa 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -159,6 +159,7 @@ our $exe_im; our $exe_my_print_defaults; our $exe_perror; our $lib_udf_example; +our $lib_example_plugin; our $exe_libtool; our $opt_bench= 0; @@ -1493,6 +1494,11 @@ sub executable_setup () { mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), "$glob_basedir/sql/.libs/udf_example.so",); + # Look for the ha_example library + $lib_example_plugin= + mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), + "$glob_basedir/storage/example/.libs/ha_example.so",); + # Look for mysqltest executable if ( $glob_use_embedded_server ) { @@ -1648,6 +1654,14 @@ sub environment_setup () { push(@ld_library_paths, dirname($lib_udf_example)); } + # -------------------------------------------------------------------------- + # Add the path where mysqld will find ha_example.so + # -------------------------------------------------------------------------- + if ( $lib_example_plugin ) + { + push(@ld_library_paths, dirname($lib_example_plugin)); + } + # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost # impossible to add correct supressions, that means if "/usr/lib/debug" @@ -1922,10 +1936,11 @@ sub environment_setup () { $ENV{'UDF_EXAMPLE_LIB'}= ($lib_udf_example ? basename($lib_udf_example) : ""); - $ENV{'LD_LIBRARY_PATH'}= - ($lib_udf_example ? dirname($lib_udf_example) : "") . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); - + # ---------------------------------------------------- + # Add the path where mysqld will find ha_example.so + # ---------------------------------------------------- + $ENV{'EXAMPLE_PLUGIN'}= + ($lib_example_plugin ? basename($lib_example_plugin) : ""); # ---------------------------------------------------- # We are nice and report a bit about our settings @@ -3609,6 +3624,9 @@ sub mysqld_arguments ($$$$$) { # Turn on logging, will be sent to tables mtr_add_arg($args, "%s--log=", $prefix); } + + mtr_add_arg($args, "%s--plugin_dir=%s", $prefix, + dirname($lib_example_plugin)); } if ( $type eq 'slave' ) @@ -4480,7 +4498,9 @@ sub run_mysqltest ($) { } else # component_id == mysqld { - mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); +# mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); +mtr_add_arg($args, "--host=127.0.0.1"); + mtr_add_arg($args, "--port=%d", $master->[0]->{'port'}); mtr_add_arg($args, "--database=test"); mtr_add_arg($args, "--user=%s", $opt_user); diff --git a/mysql-test/r/have_udf.require b/mysql-test/r/have_dynamic_loading.require similarity index 100% rename from mysql-test/r/have_udf.require rename to mysql-test/r/have_dynamic_loading.require diff --git a/mysql-test/r/have_example_plugin.require b/mysql-test/r/have_example_plugin.require new file mode 100644 index 00000000000..291b8231cbb --- /dev/null +++ b/mysql-test/r/have_example_plugin.require @@ -0,0 +1,2 @@ +have_example_plugin +1 diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result new file mode 100644 index 00000000000..44641858fca --- /dev/null +++ b/mysql-test/r/plugin.result @@ -0,0 +1,15 @@ +CREATE TABLE t1(a int) ENGINE=EXAMPLE; +Warnings: +Error 1286 Unknown table engine 'EXAMPLE' +DROP TABLE t1; +INSTALL PLUGIN example SONAME 'ha_example.so'; +INSTALL PLUGIN EXAMPLE SONAME 'ha_example.so'; +ERROR HY000: Function 'EXAMPLE' already exists +UNINSTALL PLUGIN example; +INSTALL PLUGIN example SONAME 'ha_example.so'; +CREATE TABLE t1(a int) ENGINE=EXAMPLE; +SELECT * FROM t1; +a +DROP TABLE t1; +UNINSTALL PLUGIN non_exist; +ERROR 42000: PLUGIN non_exist does not exist diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test new file mode 100644 index 00000000000..80c1de00b8e --- /dev/null +++ b/mysql-test/t/plugin.test @@ -0,0 +1,26 @@ +--source include/have_example_plugin.inc + +CREATE TABLE t1(a int) ENGINE=EXAMPLE; +DROP TABLE t1; + +INSTALL PLUGIN example SONAME 'ha_example.so'; +--error 1125 +INSTALL PLUGIN EXAMPLE SONAME 'ha_example.so'; + +UNINSTALL PLUGIN example; + +INSTALL PLUGIN example SONAME 'ha_example.so'; + +CREATE TABLE t1(a int) ENGINE=EXAMPLE; + +# Let's do some advanced ops with the example engine :) +SELECT * FROM t1; + +DROP TABLE t1; + +# Waiting for fix to BUG#22694 +#UNINSTALL PLUGIN example; +#UNINSTALL PLUGIN EXAMPLE; + +--error 1305 +UNINSTALL PLUGIN non_exist; From 8e5be1ad976d7dccb529680c9b74703f898491b3 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Thu, 14 Dec 2006 16:23:54 -0700 Subject: [PATCH 060/160] myisam.result: a test was moved from the .test file, but the results were not updated. --- mysql-test/r/myisam.result | 22 +--------------------- mysql-test/r/symlink.result | 1 + mysql-test/t/myisam.test | 3 ++- mysql-test/t/symlink.test | 2 +- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index b34c127595f..0fd14b08a41 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -923,24 +923,4 @@ SET @@myisam_repair_threads=1; SHOW VARIABLES LIKE 'myisam_repair%'; Variable_name Value myisam_repair_threads 1 -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -create table t1 (a int) engine=myisam select 42 a; -select * from t1; -a -9 -select * from t1; -a -99 -select * from t1; -a -42 -drop table t1; +End of 4.1 tests diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index b104ce50a56..bc7d3275754 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -123,3 +123,4 @@ select * from t1; a 42 drop table t1; +End of 4.1 tests diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 89ace0ee838..082f9c1f844 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -854,4 +854,5 @@ DROP TABLE t1; # SET @@myisam_repair_threads=1; SHOW VARIABLES LIKE 'myisam_repair%'; -# End of 4.1 tests + +--echo End of 4.1 tests diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 201a2866c4f..23fd779ee13 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -170,4 +170,4 @@ connection default; select * from t1; drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests From 17fb4c5cbda4b96e69653e58c2f7daeab204baa0 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Thu, 14 Dec 2006 17:47:55 -0700 Subject: [PATCH 061/160] Post-merge fix to symlink.result --- mysql-test/r/symlink.result | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index a85f14782ef..1589f98a8af 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -133,3 +133,4 @@ a 42 drop table t1; End of 4.1 tests +End of 5.0 tests From 24dfe0b0b40304a2cc2619a4b3dbc846b5428929 Mon Sep 17 00:00:00 2001 From: "thek@kpdesk.mysql.com" <> Date: Fri, 15 Dec 2006 07:56:01 +0100 Subject: [PATCH 062/160] Bug#17498 failed to put data file in custom directory use "data directory" option - Result file was not properly committed. - Update result file to match the new test case. --- mysql-test/r/myisam.result | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index b34c127595f..1af927d32f0 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -923,24 +923,3 @@ SET @@myisam_repair_threads=1; SHOW VARIABLES LIKE 'myisam_repair%'; Variable_name Value myisam_repair_threads 1 -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -show create table t1; -Table Create Table -t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' -create table t1 (a int) engine=myisam select 42 a; -select * from t1; -a -9 -select * from t1; -a -99 -select * from t1; -a -42 -drop table t1; From fe341ad904493610bc6f698ec3999a091f4e7bfc Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Fri, 15 Dec 2006 10:41:24 +0100 Subject: [PATCH 063/160] Add macro for retrieving sec part of "struct timespec" Use macros for working with "struct timespec" in event_queue.cc Fix merge problem --- include/my_pthread.h | 12 +++++++----- sql/event_queue.cc | 9 ++++----- sql/log_event.cc | 14 +++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index d44fd97c318..98072c304fa 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -56,11 +56,6 @@ typedef struct { } pthread_cond_t; -struct timespec { /* For pthread_cond_timedwait() */ - time_t tv_sec; - long tv_nsec; -}; - typedef int pthread_mutexattr_t; #define win_pthread_self my_thread_var->pthread_self #define pthread_handler_t EXTERNC void * __cdecl @@ -93,6 +88,7 @@ struct timespec { GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ (ABSTIME).timeout_msec= (long)((NSEC)/1000000); \ } +#define get_timespec_sec(ABSTIME) ((((ABSTIME).start.i64 / 10000) + (ABSTIME).timeout_msec ) / 1000) void win_pthread_init(void); int win_pthread_setspecific(void *A,void *B,uint length); @@ -414,6 +410,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ } #endif /* !set_timespec_nsec */ +#ifndef get_timespec_sec +#define get_timespec_sec(ABSTIME) (ABSTIME).ts_sec +#endif /* !get_timespec_sec */ #else #ifndef set_timespec #define set_timespec(ABSTIME,SEC) \ @@ -432,6 +431,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ } #endif /* !set_timespec_nsec */ +#ifndef get_timespec_sec +#define get_timespec_sec(ABSTIME) (ABSTIME).tv_sec +#endif /* !get_timespec_sec */ #endif /* HAVE_TIMESPEC_TS_SEC */ /* safe_mutex adds checking to mutex for easier debugging */ diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 7ec665fcd5f..879235c3e49 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -719,7 +719,6 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) *job_data= NULL; DBUG_ENTER("Event_queue::get_top_for_execution_if_time"); - top_time.tv_nsec= 0; LOCK_QUEUE_DATA(); for (;;) { @@ -732,12 +731,12 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) if (queue.elements) { top= ((Event_queue_element*) queue_element(&queue, 0)); - top_time.tv_sec= sec_since_epoch_TIME(&top->execute_at); + set_timespec(top_time, sec_since_epoch_TIME(&top->execute_at)); abstime= &top_time; } - if (!abstime || abstime->tv_sec > now) + if (!abstime || get_timespec_sec(*abstime) > now) { const char *msg; if (abstime) @@ -816,8 +815,8 @@ end: if (to_free) delete top; - DBUG_PRINT("info", ("returning %d et_new: 0x%lx abstime.tv_sec: %ld ", - ret, (long) *job_data, abstime ? abstime->tv_sec : 0)); + DBUG_PRINT("info", ("returning %d et_new: 0x%lx get_timespec_sec(abstime): %ld ", + ret, (long) *job_data, abstime ? get_timespec_sec(*abstime) : 0)); if (*job_data) DBUG_PRINT("info", ("db: %s name: %s definer=%s", (*job_data)->dbname.str, diff --git a/sql/log_event.cc b/sql/log_event.cc index 44cba324a02..8fc65c1a717 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5558,9 +5558,9 @@ unpack_row(RELAY_LOG_INFO *rli, if (bitmap_is_set(cols, field_ptr - begin_ptr)) { - DBUG_ASSERT(table->record[0] <= f->ptr); - DBUG_ASSERT(f->ptr < (table->record[0] + table->s->reclength + - (f->pack_length_in_rec() == 0))); + DBUG_ASSERT((char*)table->record[0] <= f->ptr); + DBUG_ASSERT(f->ptr < (char*)(table->record[0] + table->s->reclength + + (f->pack_length_in_rec() == 0))); DBUG_PRINT("info", ("unpacking column '%s' to 0x%lx", f->field_name, (long) f->ptr)); @@ -6843,8 +6843,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", (const char*)table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", (const char*)table->record[1], table->s->reclength); #endif /* @@ -6870,8 +6870,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) trigger false warnings. */ #ifndef HAVE_purify - DBUG_DUMP("table->record[0]", table->record[0], table->s->reclength); - DBUG_DUMP("table->record[1]", table->record[1], table->s->reclength); + DBUG_DUMP("table->record[0]", (const char*)table->record[0], table->s->reclength); + DBUG_DUMP("table->record[1]", (const char*)table->record[1], table->s->reclength); #endif /* Below is a minor "optimization". If the key (i.e., key number From 5a31bff73dae1c73227a3439bde882246aa244eb Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Fri, 15 Dec 2006 10:45:25 +0100 Subject: [PATCH 064/160] Fix VC++ warning about extra ; delimiter --- storage/federated/ha_federated.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 7330a19b791..3a15837fe65 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2808,7 +2808,7 @@ static int federated_commit(handlerton *hton, THD *thd, bool all) if (old) old->trx_next= NULL; error= ptr->connection_commit(); - if (error && !return_val); + if (error && !return_val) return_val= error; } thd->ha_data[hton->slot]= NULL; From 8187397f8ef0c9ee724954847a98c958432fbd01 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 15 Dec 2006 12:54:40 +0100 Subject: [PATCH 065/160] Remove junk --- mysql-test/mysql-test-run.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 0c5c0f2b3fa..88de5398619 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4498,9 +4498,7 @@ sub run_mysqltest ($) { } else # component_id == mysqld { -# mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); -mtr_add_arg($args, "--host=127.0.0.1"); - + mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); mtr_add_arg($args, "--port=%d", $master->[0]->{'port'}); mtr_add_arg($args, "--database=test"); mtr_add_arg($args, "--user=%s", $opt_user); From da5e006dda575aca3442d66f8949cf9f0a81b8c1 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 15 Dec 2006 13:23:45 +0100 Subject: [PATCH 066/160] Bug#19209 Test 'rpl_openssl' hangs on Windows - Remove check not to run on windows. --- mysql-test/t/rpl_openssl.test | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test index af70a1a9453..7d769ad448e 100644 --- a/mysql-test/t/rpl_openssl.test +++ b/mysql-test/t/rpl_openssl.test @@ -1,7 +1,3 @@ -# TODO: THIS TEST DOES NOT WORK ON WINDOWS -# This should be fixed. ---source include/not_windows.inc - source include/have_openssl.inc; source include/master-slave.inc; From a246eb39bb4699eb6ba12349fa1a5f70058e29f0 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 15 Dec 2006 15:05:50 +0100 Subject: [PATCH 067/160] Bug#24997 warnings test case failure - Move the specific test case to a separate file that is run only if we have a disabled handler. --- mysql-test/r/warnings.result | 7 ------- mysql-test/r/warnings_engine_disabled.result | 7 +++++++ mysql-test/t/warnings.test | 6 ------ .../t/warnings_engine_disabled-master.opt | 1 + mysql-test/t/warnings_engine_disabled.test | 19 +++++++++++++++++++ 5 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 mysql-test/r/warnings_engine_disabled.result create mode 100644 mysql-test/t/warnings_engine_disabled-master.opt create mode 100644 mysql-test/t/warnings_engine_disabled.test diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d03c5ed2f54..88341c2f0b8 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -166,13 +166,6 @@ show variables like 'max_error_count'; Variable_name Value max_error_count 10 drop table t1; -create table t1 (id int) engine=NDB; -Warnings: -Warning 1266 Using storage engine MyISAM for table 't1' -alter table t1 engine=NDB; -Warnings: -Warning 1266 Using storage engine MyISAM for table 't1' -drop table t1; set table_type=MYISAM; Warnings: Warning 1541 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead diff --git a/mysql-test/r/warnings_engine_disabled.result b/mysql-test/r/warnings_engine_disabled.result new file mode 100644 index 00000000000..aa6170a60a7 --- /dev/null +++ b/mysql-test/r/warnings_engine_disabled.result @@ -0,0 +1,7 @@ +create table t1 (id int) engine=NDB; +Warnings: +Warning 1266 Using storage engine MyISAM for table 't1' +alter table t1 engine=NDB; +Warnings: +Warning 1266 Using storage engine MyISAM for table 't1' +drop table t1; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index eb5a24a8604..18ca0c96eb8 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -109,12 +109,6 @@ show variables like 'max_error_count'; set max_error_count=10; show variables like 'max_error_count'; -# -# Test for handler type -# -drop table t1; -create table t1 (id int) engine=NDB; -alter table t1 engine=NDB; drop table t1; # diff --git a/mysql-test/t/warnings_engine_disabled-master.opt b/mysql-test/t/warnings_engine_disabled-master.opt new file mode 100644 index 00000000000..99837e4a4cb --- /dev/null +++ b/mysql-test/t/warnings_engine_disabled-master.opt @@ -0,0 +1 @@ +--loose-skip-ndb diff --git a/mysql-test/t/warnings_engine_disabled.test b/mysql-test/t/warnings_engine_disabled.test new file mode 100644 index 00000000000..0b09cff7b1e --- /dev/null +++ b/mysql-test/t/warnings_engine_disabled.test @@ -0,0 +1,19 @@ +# +# Only run this test with a compiled in but disabled +# engine +# +disable_query_log; +--require r/true.require +select support = 'Disabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +enable_query_log; + + +# +# Test for handler type, will select MyISAM and print a warning +# about that - since NDB is disabled +# +create table t1 (id int) engine=NDB; +alter table t1 engine=NDB; +drop table t1; + + From 30deafa958e7e9e95abf5e70f54a2ceedd87b443 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Fri, 15 Dec 2006 17:47:20 +0100 Subject: [PATCH 068/160] Calculate offset for wait time passed to set_timespec Pass different msg if waiting on empty queue --- sql/event_queue.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 879235c3e49..53fa4f6b5cd 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -731,7 +731,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) if (queue.elements) { top= ((Event_queue_element*) queue_element(&queue, 0)); - set_timespec(top_time, sec_since_epoch_TIME(&top->execute_at)); + set_timespec(top_time, + sec_since_epoch_TIME(&top->execute_at) - now); abstime= &top_time; } @@ -747,7 +748,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) else { set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME); - msg= queue_wait_msg; + msg= queue_empty_msg; } cond_wait(thd, abstime, msg, SCHED_FUNC, __LINE__); From 3da37d3fa2d1f5db00afbff25006821e19e7e2cd Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Fri, 15 Dec 2006 10:57:58 -0800 Subject: [PATCH 069/160] Added support for sensible-editor from Debian, instead of emacs. --- scripts/mysqlbug.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh index 6aed140b79d..880ab248a90 100644 --- a/scripts/mysqlbug.sh +++ b/scripts/mysqlbug.sh @@ -132,7 +132,13 @@ if test -z "$VISUAL" then if test -z "$EDITOR" then - EDIT=emacs + # Honor debian sensible-editor + if test -x "/usr/bin/sensible-editor" + then + EDIT=/usr/bin/sensible-editor + else + EDIT=emacs + fi else EDIT="$EDITOR" fi From 57baef9584dd30cc3e0cb6bb62a26c6b1726d0d4 Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Fri, 15 Dec 2006 12:25:09 -0800 Subject: [PATCH 070/160] Added support for /etc/mysql after /etc in the search path for my.cnf bug #25104 --- mysys/default.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mysys/default.c b/mysys/default.c index 6e40c48d82a..1d71399ef71 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -49,6 +49,7 @@ const char *default_directories[]= { "sys:/etc/", #else "/etc/", +"/etc/mysql/", #endif #ifdef DATADIR DATADIR, From 265370f5c3a324c7d063739d6c0b42c1a746dc1b Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Fri, 15 Dec 2006 12:34:36 -0800 Subject: [PATCH 071/160] Added /etc/mysql to my.cnf search path after /etc. bug #25104 --- mysys/default.c | 10 ++++++---- scripts/mysqld_multi.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mysys/default.c b/mysys/default.c index d93f4135e73..a147163e938 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -979,10 +979,11 @@ static uint my_get_system_windows_directory(char *buffer, uint size) Everywhere else, this is: 1. /etc/ - 2. getenv(DEFAULT_HOME_ENV) - 3. "" - 4. "~/" - 5. --sysconfdir= + 2. /etc/mysql/ + 3. getenv(DEFAULT_HOME_ENV) + 4. "" + 5. "~/" + 6. --sysconfdir= */ @@ -1008,6 +1009,7 @@ static void init_default_directories() *ptr++= env; #endif *ptr++= "/etc/"; + *ptr++= "/etc/mysql/"; #endif if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) *ptr++= env; diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 2dcc8dc7bc4..6ac31a00c75 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -472,6 +472,14 @@ sub find_groups { $data[$i] = $line; } + if (-f "/etc/mysql/my.cnf" && -r "/etc/mysql/my.cnf") + { + open(MY_CNF, ") && close(MY_CNF); + } + for (; ($line = shift @tmp); $i++) + { + $data[$i] = $line; + } if (defined($ENV{MYSQL_HOME}) && -f "$ENV{MYSQL_HOME}/my.cnf" && -r "$ENV{MYSQL_HOME}/my.cnf") { @@ -491,7 +499,7 @@ sub find_groups $data[$i] = $line; } } - chop @data; + chomp @data; # Make a list of the wanted group ids if (defined($raw_gids)) { From 373e280eb32cc78f9f5a55335d7a584832ffc1cd Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Fri, 15 Dec 2006 16:17:10 -0800 Subject: [PATCH 072/160] support /etc/mysql/my.cnf in mysqld_multi as well. --- scripts/mysqld_multi.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 4a6f380494f..b11dc7394bf 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -437,6 +437,14 @@ sub find_groups { $data[$i] = $line; } + if (-f "/etc/mysql/my.cnf" && -r "/etc/mysql/my.cnf") + { + open(MY_CNF, ") && close(MY_CNF); + } + for (; ($line = shift @tmp); $i++) + { + $data[$i] = $line; + } if (-f "$homedir/.my.cnf" && -r "$homedir/.my.cnf") { open(MY_CNF, "<$homedir/.my.cnf") && (@tmp=) && close(MY_CNF); @@ -446,7 +454,7 @@ sub find_groups $data[$i] = $line; } } - chop @data; + chomp @data; # Make a list of the wanted group ids if (defined($raw_gids)) { From d194a83b970823407f11c414f17ed9c075e51489 Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Fri, 15 Dec 2006 18:04:09 -0800 Subject: [PATCH 073/160] Changed config of mysqlmanager to use my.cnf search path. --- server-tools/instance-manager/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-tools/instance-manager/Makefile.am b/server-tools/instance-manager/Makefile.am index 2d2365caa44..59447e8d369 100644 --- a/server-tools/instance-manager/Makefile.am +++ b/server-tools/instance-manager/Makefile.am @@ -33,7 +33,7 @@ liboptions_la_CXXFLAGS= $(CXXFLAGS) \ -DDEFAULT_SOCKET_FILE_NAME="/tmp/mysqlmanager.sock" \ -DDEFAULT_PASSWORD_FILE_NAME="/etc/mysqlmanager.passwd" \ -DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \ - -DDEFAULT_CONFIG_FILE="/etc/my.cnf" \ + -DDEFAULT_CONFIG_FILE="my.cnf" \ -DPROTOCOL_VERSION=@PROTOCOL_VERSION@ liboptions_la_SOURCES= options.h options.cc priv.h priv.cc From 6cd4a816bcba1787ba34fe700efc75f1259bc156 Mon Sep 17 00:00:00 2001 From: "msvensson@maint1.mysql.com" <> Date: Mon, 18 Dec 2006 10:22:48 +0100 Subject: [PATCH 074/160] Use MYSQLTEST_VARDIR variable --- mysql-test/r/symlink.result | 4 ++-- mysql-test/t/symlink.test | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 1589f98a8af..4725bcc0ac9 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -115,12 +115,12 @@ show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' create table t1 (a int) engine=myisam select 42 a; select * from t1; a diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 7924f00a9c8..d79b6905224 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -147,20 +147,20 @@ connect (session2,localhost,root,,); connection session1; disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a; +eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a; enable_query_log; # If running test suite with a non standard tmp dir, the "show create table" # will print "DATA_DIRECTORY=". Use replace_result to mask it out ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR show create table t1; connection session2; disable_query_log; -eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a; +eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a; enable_query_log; # If running test suite with a non standard tmp dir, the "show create table" # will print "DATA_DIRECTORY=". Use replace_result to mask it out ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR show create table t1; connection default; From c3fb91b782816dc726217713afcfba97efd3a357 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Mon, 18 Dec 2006 11:09:47 +0100 Subject: [PATCH 075/160] Change windows pthread_cond_timedwait to use an absolute time value --- include/my_pthread.h | 14 ++++++++------ mysys/my_wincond.c | 19 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index ebba0ab32e1..631ca1d7c03 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -94,17 +94,19 @@ typedef void * (__cdecl *pthread_handler)(void *); __int64 i64; }; struct timespec { - union ft64 start; + union ft64 tv; /* The max timeout value in millisecond for pthread_cond_timedwait */ - long timeout_msec; + long max_timeout_msec; }; #define set_timespec(ABSTIME,SEC) { \ - GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ - (ABSTIME).timeout_msec= (long)((SEC)*1000); \ + GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \ + (ABSTIME).tv.i64+= (__int64)(SEC)*10000000; \ + (ABSTIME).max_timeout_msec= (long)((SEC)*1000); \ } #define set_timespec_nsec(ABSTIME,NSEC) { \ - GetSystemTimeAsFileTime(&((ABSTIME).start.ft)); \ - (ABSTIME).timeout_msec= (long)((NSEC)/1000000); \ + GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \ + (ABSTIME).tv.i64+= (__int64)(NSEC)/100; \ + (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \ } void win_pthread_init(void); diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index 327addff2cc..b56dacc135a 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -37,7 +37,7 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) int pthread_cond_destroy(pthread_cond_t *cond) { - return CloseHandle(cond->semaphore) ? 0 : EINVAL; + return CloseHandle(cond->semaphore) ? 0 : EINVAL; } @@ -51,6 +51,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) return 0 ; } + int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *abstime) { @@ -61,26 +62,26 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, GetSystemTimeAsFileTime(&now.ft); /* - - subtract start time from current time(values are in 100ns units + Calculate time left to abstime + - subtract start time from current time(values are in 100ns units) - convert to millisec by dividing with 10000 - - subtract time since start from max timeout */ - timeout= abstime->timeout_msec - (long)((now.i64 - abstime->start.i64) / 10000); + timeout= (long)((abstime->tv.i64 - now.i64) / 10000); /* Don't allow the timeout to be negative */ if (timeout < 0) - timeout = 0L; + timeout= 0L; /* - Make sure the calucated time does not exceed original timeout + Make sure the calucated timeout does not exceed original timeout value which could cause "wait for ever" if system time changes */ - if (timeout > abstime->timeout_msec) - timeout= abstime->timeout_msec; + if (timeout > abstime->max_timeout_msec) + timeout= abstime->max_timeout_msec; InterlockedIncrement(&cond->waiting); LeaveCriticalSection(mutex); - result=WaitForSingleObject(cond->semaphore,timeout); + result= WaitForSingleObject(cond->semaphore,timeout); InterlockedDecrement(&cond->waiting); EnterCriticalSection(mutex); From 395a0167c188d41c0d4cbd082b502e8c34da4afd Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Mon, 18 Dec 2006 12:00:35 +0100 Subject: [PATCH 076/160] Reorganize the wait for event to be scheduled loop Only use "set_timespec" when there is a need to use it --- sql/event_queue.cc | 68 ++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 879235c3e49..14a6a0dfa93 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -699,10 +699,7 @@ static const char *queue_wait_msg= "Waiting for next activation"; RETURN VALUE FALSE No error. If *job_data==NULL then top not elligible for execution. - Could be that there is no top. If abstime->tv_sec is set to value - greater than zero then use abstime with pthread_cond_timedwait(). - If abstime->tv_sec is zero then sleep with pthread_cond_wait(). - abstime->tv_nsec is always zero. + Could be that there is no top. TRUE Error */ @@ -712,7 +709,6 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) { bool ret= FALSE; struct timespec top_time; - struct timespec *abstime; Event_queue_element *top= NULL; bool to_free= FALSE; bool to_drop= FALSE; @@ -724,43 +720,40 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) { int res; - thd->end_time(); - time_t now= thd->query_start(); - abstime= NULL; - - if (queue.elements) + /* Break loop if thd has been killed */ + if (thd->killed) { - top= ((Event_queue_element*) queue_element(&queue, 0)); - set_timespec(top_time, sec_since_epoch_TIME(&top->execute_at)); - - abstime= &top_time; + DBUG_PRINT("info", ("thd->killed=%d", thd->killed)); + goto end; } - if (!abstime || get_timespec_sec(*abstime) > now) + if (!queue.elements) { - const char *msg; - if (abstime) - { - next_activation_at= top->execute_at; - msg= queue_wait_msg; - } - else - { - set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME); - msg= queue_wait_msg; - } + /* There are no events in the queue */ + set_zero_time(&next_activation_at, MYSQL_TIMESTAMP_DATETIME); - cond_wait(thd, abstime, msg, SCHED_FUNC, __LINE__); - if (thd->killed) - { - DBUG_PRINT("info", ("thd->killed=%d", thd->killed)); - goto end; - } + /* Wait on condition until signaled. Release LOCK_queue while waiting. */ + cond_wait(thd, NULL, queue_empty_msg, SCHED_FUNC, __LINE__); + + continue; + } + + top= ((Event_queue_element*) queue_element(&queue, 0)); + + thd->end_time(); /* Get current time */ + + time_t seconds_to_next_event= + sec_since_epoch_TIME(&top->execute_at) - thd->query_start(); + next_activation_at= top->execute_at; + if (seconds_to_next_event > 0) + { /* - The queue could have been emptied. Therefore it's safe to start from - the beginning. Moreover, this way we will get also the new top, if - the element at the top has been changed. + Not yet time for top event, wait on condition with + time or until signaled. Release LOCK_queue while waiting. */ + set_timespec(top_time, seconds_to_next_event); + cond_wait(thd, &top_time, queue_wait_msg, SCHED_FUNC, __LINE__); + continue; } @@ -802,7 +795,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd, Event_job_data **job_data) else queue_replaced(&queue); - dbug_dump_queue(now); + dbug_dump_queue(thd->query_start()); break; } end: @@ -815,8 +808,7 @@ end: if (to_free) delete top; - DBUG_PRINT("info", ("returning %d et_new: 0x%lx get_timespec_sec(abstime): %ld ", - ret, (long) *job_data, abstime ? get_timespec_sec(*abstime) : 0)); + DBUG_PRINT("info", ("returning %d et_new: 0x%lx ", ret, (long) *job_data)); if (*job_data) DBUG_PRINT("info", ("db: %s name: %s definer=%s", (*job_data)->dbname.str, From fc45754fb0095f7eb888ef773c862677ec42d3ef Mon Sep 17 00:00:00 2001 From: "msvensson@shellback." <> Date: Mon, 18 Dec 2006 14:12:19 +0100 Subject: [PATCH 077/160] Update function description for Event_queue::get_top_for_execution_if_time --- sql/event_queue.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 14a6a0dfa93..efd309e30e2 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -693,9 +693,7 @@ static const char *queue_wait_msg= "Waiting for next activation"; SYNOPSIS Event_queue::get_top_for_execution_if_time() thd [in] Thread - now [in] Current timestamp job_data [out] The object to execute - abstime [out] Time to sleep RETURN VALUE FALSE No error. If *job_data==NULL then top not elligible for execution. From b1eeb52cdad6fb043f4e6da8601b26fb6474571e Mon Sep 17 00:00:00 2001 From: "msvensson@maint1.mysql.com" <> Date: Mon, 18 Dec 2006 14:38:12 +0100 Subject: [PATCH 078/160] Merge fix of updated test result --- mysql-test/r/symlink.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index a4e010705a6..8ffe88acfa4 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -114,12 +114,12 @@ drop table t1; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL + `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( - `a` int(11) default NULL + `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' create table t1 (a int) engine=myisam select 42 a; select * from t1; From 09591de344344d0aaf28e11d794ed2c2fda4c5a3 Mon Sep 17 00:00:00 2001 From: "mtaylor@qualinost.(none)" <> Date: Mon, 18 Dec 2006 21:12:01 -0800 Subject: [PATCH 079/160] Search through options to find where the slow query log actually is. --- scripts/mysqldumpslow.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index ccb006f692d..ff82a35ec3f 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -40,6 +40,7 @@ unless (@ARGV) { warn "basedir=$basedir\n" if $opt{v}; my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; + my $slowlog = ($defaults =~ m/--log-slow-queries=(.*)/)[0]; if (!$datadir or $opt{i}) { # determine the datadir from the instances section of /etc/my.cnf, if any my $instances = `my_print_defaults instances`; @@ -55,8 +56,13 @@ unless (@ARGV) { warn "datadir=$datadir\n" if $opt{v}; } - @ARGV = <$datadir/$opt{h}-slow.log>; - die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV; + if ( -f $slowlog ) { + @ARGV = ($slowlog); + die "Can't find '$slowlog'\n" unless @ARGV; + } else { + @ARGV = <$datadir/$opt{h}-slow.log>; + die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV; + } } warn "\nReading mysql slow query log from @ARGV\n"; From 6a304f3fc19fd4dcde5bb9c0c580b8f0f77dd439 Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Tue, 19 Dec 2006 11:21:14 +0300 Subject: [PATCH 080/160] Added copy_typelib() declaration to make ABI compatibility test happy --- include/mysql_h.ic | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 0e546acef92..7aec1e8a627 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -36,6 +36,8 @@ enum mysql_status; typedef struct st_mysql_rows MYSQL_ROWS; # 24 "my_list.h" typedef struct st_list LIST; +# 35 "my_alloc.h" +typedef struct st_mem_root MEM_ROOT; # 251 "mysql.h" typedef struct st_mysql MYSQL; # 653 "mysql.h" @@ -60,7 +62,7 @@ typedef struct st_mysql_stmt MYSQL_STMT; typedef struct character_set MY_CHARSET_INFO; # 180 "mysql_com.h" typedef struct st_net NET; -# 21 "typelib.h" +# 23 "typelib.h" typedef struct st_typelib TYPELIB; # 170 "mysql_com.h" typedef struct st_vio Vio; @@ -76,8 +78,6 @@ typedef int my_socket; typedef unsigned long long int my_ulonglong; # 144 "mysql.h" typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; -# 35 "my_alloc.h" -typedef struct st_mem_root MEM_ROOT; # 145 "mysql.h" typedef struct st_mysql_data MYSQL_DATA; # 750 "mysql.h" @@ -419,7 +419,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned my_bool report_error; my_bool return_errno; }; -# 21 "typelib.h" +# 23 "typelib.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib { unsigned int count; @@ -630,9 +630,11 @@ enum mysql_status extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); # 416 "mysql_com.h" extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); +# 33 "typelib.h" +extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); # 411 "mysql_com.h" extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); -# 28 "typelib.h" +# 30 "typelib.h" extern int find_type(char * x, TYPELIB * typelib, unsigned int); # 425 "mysql_com.h" extern void get_salt_from_password(unsigned char * res, char const * password); @@ -640,7 +642,7 @@ extern void get_salt_from_password(unsigned char * res, char const * password); extern void get_salt_from_password_323(unsigned long int * res, char const * password); # 431 "mysql_com.h" extern char * get_tty_password(char * opt_message); -# 30 "typelib.h" +# 32 "typelib.h" extern char const * get_type(TYPELIB * typelib, unsigned int); # 413 "mysql_com.h" extern void hash_password(unsigned long int * to, char const * password, unsigned int); @@ -668,7 +670,7 @@ extern void make_password_from_salt_323(char * to, unsigned long int const * sal extern void make_scrambled_password(char * to, char const * password); # 414 "mysql_com.h" extern void make_scrambled_password_323(char * to, char const * password); -# 29 "typelib.h" +# 31 "typelib.h" extern void make_type(char * to, unsigned int, TYPELIB * typelib); # 437 "mysql_com.h" extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int); @@ -962,5 +964,5 @@ extern void randominit(struct rand_struct *, unsigned long int, unsigned long in extern void scramble(char * to, char const * message, char const * password); # 415 "mysql_com.h" extern void scramble_323(char * to, char const * message, char const * password); -# 32 "typelib.h" +# 35 "typelib.h" extern TYPELIB sql_protocol_typelib; From 221be0084e02597b9f885673d9b5122199fbd9af Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Tue, 19 Dec 2006 12:21:41 +0300 Subject: [PATCH 081/160] Added copy_typelib() declaration to make ABI compatibility test happy --- include/mysql_h.ic | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 51cbb1fb7eb..a4149e74b56 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -36,6 +36,8 @@ enum mysql_status; typedef struct st_mysql_rows MYSQL_ROWS; # 24 "my_list.h" typedef struct st_list LIST; +# 35 "my_alloc.h" +typedef struct st_mem_root MEM_ROOT; # 251 "mysql.h" typedef struct st_mysql MYSQL; # 653 "mysql.h" @@ -60,7 +62,7 @@ typedef struct st_mysql_stmt MYSQL_STMT; typedef struct character_set MY_CHARSET_INFO; # 184 "mysql_com.h" typedef struct st_net NET; -# 21 "typelib.h" +# 23 "typelib.h" typedef struct st_typelib TYPELIB; # 174 "mysql_com.h" typedef struct st_vio Vio; @@ -76,8 +78,6 @@ typedef int my_socket; typedef unsigned long long int my_ulonglong; # 144 "mysql.h" typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; -# 35 "my_alloc.h" -typedef struct st_mem_root MEM_ROOT; # 145 "mysql.h" typedef struct st_mysql_data MYSQL_DATA; # 750 "mysql.h" @@ -172,6 +172,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned struct st_mysql_methods const * methods; void * thd; my_bool * unbuffered_fetch_owner; + char * info_buffer; }; # 653 "mysql.h" struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_bind @@ -419,7 +420,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned my_bool report_error; my_bool return_errno; }; -# 21 "typelib.h" +# 23 "typelib.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib { unsigned int count; @@ -631,9 +632,11 @@ enum mysql_status extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); # 420 "mysql_com.h" extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); +# 33 "typelib.h" +extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); # 415 "mysql_com.h" extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); -# 28 "typelib.h" +# 30 "typelib.h" extern int find_type(char * x, TYPELIB * typelib, unsigned int); # 429 "mysql_com.h" extern void get_salt_from_password(unsigned char * res, char const * password); @@ -641,7 +644,7 @@ extern void get_salt_from_password(unsigned char * res, char const * password); extern void get_salt_from_password_323(unsigned long int * res, char const * password); # 435 "mysql_com.h" extern char * get_tty_password(char const * opt_message); -# 30 "typelib.h" +# 32 "typelib.h" extern char const * get_type(TYPELIB * typelib, unsigned int); # 417 "mysql_com.h" extern void hash_password(unsigned long int * to, char const * password, unsigned int); @@ -667,7 +670,7 @@ extern void make_password_from_salt_323(char * to, unsigned long int const * sal extern void make_scrambled_password(char * to, char const * password); # 418 "mysql_com.h" extern void make_scrambled_password_323(char * to, char const * password); -# 29 "typelib.h" +# 31 "typelib.h" extern void make_type(char * to, unsigned int, TYPELIB * typelib); # 358 "mysql_com.h" extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); @@ -957,5 +960,5 @@ extern void randominit(struct rand_struct *, unsigned long int, unsigned long in extern void scramble(char * to, char const * message, char const * password); # 419 "mysql_com.h" extern void scramble_323(char * to, char const * message, char const * password); -# 32 "typelib.h" +# 35 "typelib.h" extern TYPELIB sql_protocol_typelib; From ba7a03759bb4d70d951138fda64cab87d1f95e61 Mon Sep 17 00:00:00 2001 From: "anozdrin/alik@alik." <> Date: Tue, 19 Dec 2006 15:32:02 +0300 Subject: [PATCH 082/160] Fix for BUG#24293: '\Z' token is not handled correctly in views. If SELECT-part of CREATE VIEW statement contains '\Z', it is not handled correctly. The problem was in String::print(). Symbol with code 032 (26) is replaced with '\z', which is not supported by the lexer. The fix is to replace the symbol with '\Z'. --- mysql-test/r/view.result | 9 +++++++++ mysql-test/t/view.test | 15 +++++++++++++++ sql/sql_string.cc | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 81711f95ae6..caa494c26b3 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3014,4 +3014,13 @@ i j 6 3 DROP VIEW v1, v2; DROP TABLE t1; +DROP VIEW IF EXISTS v1; +CREATE VIEW v1 AS SELECT 'The\ZEnd'; +SELECT * FROM v1; +TheEnd +TheEnd +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd` +DROP VIEW v1; End of 5.0 tests. diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 8473458ae15..a34a1ba117d 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2960,4 +2960,19 @@ DROP VIEW v1, v2; DROP TABLE t1; +# +# BUG#24293: '\Z' token is not handled correctly in views +# + +--disable_warnings +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE VIEW v1 AS SELECT 'The\ZEnd'; +SELECT * FROM v1; + +SHOW CREATE VIEW v1; + +DROP VIEW v1; + --echo End of 5.0 tests. diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 85ff1fddc45..10ce72e9b9f 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -1033,8 +1033,8 @@ void String::print(String *str) case '\r': str->append(STRING_WITH_LEN("\\r")); break; - case 26: //Ctrl-Z - str->append(STRING_WITH_LEN("\\z")); + case '\032': // Ctrl-Z + str->append(STRING_WITH_LEN("\\Z")); break; default: str->append(c); From be0368c230fc9eafe64745102e42a930e8bd40ce Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 20 Dec 2006 16:53:06 +0100 Subject: [PATCH 083/160] Add possibility to activate --mark-progress of mysqltest --- mysql-test/mysql-test-run.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index bfc5fc36b32..cf7e819809b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -222,6 +222,7 @@ our $opt_ndbconnectstring_slave; our $opt_record; our $opt_report_features; our $opt_check_testcases; +our $opt_mark_progress; our $opt_skip; our $opt_skip_rpl; @@ -555,6 +556,7 @@ sub command_line_setup () { # Test case authoring 'record' => \$opt_record, 'check-testcases' => \$opt_check_testcases, + 'mark-progress' => \$opt_mark_progress, # Extra options used when starting mysqld 'mysqld=s' => \@opt_extra_mysqld_opt, @@ -4375,6 +4377,10 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); + # Log line number and time for each line in .test file + mtr_add_arg($args, "--mark-progress") + if $opt_mark_progress; + if ($tinfo->{'component_id'} eq 'im') { mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'}); @@ -4828,6 +4834,7 @@ Options for test case authoring record TESTNAME (Re)genereate the result file for TESTNAME check-testcases Check testcases for sideeffects + mark-progress Log line number and elapsed time to .progress Options that pass on options From 5ccd3608d59e8a19978212337fb755b5c22d0631 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 20 Dec 2006 16:54:37 +0100 Subject: [PATCH 084/160] When running with --valgrind and --debug send all the output from mysqld and valgrind to tracefile. --- mysql-test/mysql-test-run.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index cf7e819809b..a866030bdf8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1217,6 +1217,19 @@ sub command_line_setup () { $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; + + if ( $opt_valgrind and $opt_debug ) + { + # When both --valgrind and --debug is selected, send + # all output to the trace file, making it possible to + # see the exact location where valgrind complains + foreach my $mysqld (@{$master}, @{$slave}) + { + my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : ""; + $mysqld->{path_myerr}= + "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace"; + } + } } sub datadir_list_setup () { From da6773f97b1b7066680629178a8648095256afde Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 20 Dec 2006 23:44:53 +0100 Subject: [PATCH 085/160] Count number of masters the test is actually using and only start as many as neeeded --- mysql-test/lib/mtr_cases.pl | 7 ++----- mysql-test/mysql-test-run.pl | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 9e943fec9ef..a00d06d2e60 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -288,6 +288,7 @@ sub collect_one_test_case($$$$$$$) { $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work $tinfo->{'slave_num'}= 0; # Default, no slave + $tinfo->{'master_num'}= 1; # Default, 1 master if ( defined mtr_match_prefix($tname,"rpl") ) { if ( $::opt_skip_rpl ) @@ -297,13 +298,8 @@ sub collect_one_test_case($$$$$$$) { return; } - $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave - if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' ) - { - # $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange - } } if ( defined mtr_match_prefix($tname,"federated") ) @@ -582,6 +578,7 @@ our @tags= ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1], + ["include/have_multi_ndb.inc", "master_num", 2], ["require_manager", "require_manager", 1], ); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a866030bdf8..b3a7427c359 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -227,6 +227,7 @@ our $opt_mark_progress; our $opt_skip; our $opt_skip_rpl; our $max_slave_num= 0; +our $max_master_num= 0; our $use_innodb; our $opt_skip_test; our $opt_skip_im; @@ -404,6 +405,15 @@ sub main () { $max_slave_num= $test->{slave_num}; mtr_error("Too many slaves") if $max_slave_num > 3; } + + # Count max number of masters used by a test case + if ( $test->{master_num} > $max_master_num) + { + $max_master_num= $test->{master_num}; + mtr_error("Too many masters") if $max_master_num > 2; + mtr_error("Too few masters") if $max_master_num < 1; + } + $use_innodb||= $test->{'innodb_test'}; } @@ -1235,9 +1245,10 @@ sub command_line_setup () { sub datadir_list_setup () { # Make a list of all data_dirs - @data_dir_lst = ( - $master->[0]->{'path_myddir'}, - $master->[1]->{'path_myddir'}); + for (my $idx= 0; $idx < $max_master_num; $idx++) + { + push(@data_dir_lst, $master->[$idx]->{'path_myddir'}); + } for (my $idx= 0; $idx < $max_slave_num; $idx++) { @@ -2644,8 +2655,10 @@ sub mysql_install_db () { install_db('master', $master->[0]->{'path_myddir'}); - # FIXME check if testcase really is using second master - copy_install_db('master', $master->[1]->{'path_myddir'}); + if ($max_master_num) + { + copy_install_db('master', $master->[1]->{'path_myddir'}); + } # Install the number of slave databses needed for (my $idx= 0; $idx < $max_slave_num; $idx++) @@ -4179,7 +4192,8 @@ sub run_testcase_start_servers($) { } - if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} ) + if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and + $tinfo->{'master_num'} > 1 ) { # Test needs cluster, start an extra mysqld connected to cluster From be9ffb12da78f157793b4d7445b98ca732aa42da Mon Sep 17 00:00:00 2001 From: "mats@romeo.(none)" <> Date: Thu, 21 Dec 2006 09:29:02 +0100 Subject: [PATCH 086/160] BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' from log): When row-based logging is used, the CREATE-SELECT is written as two parts: as a CREATE TABLE statement and as the rows for the table. For both transactional and non-transactional tables, the CREATE TABLE statement was written to the transaction cache, as were the rows, and on statement end, the entire transaction cache was written to the binary log if the table was non-transactional. For transactional tables, the events were kept in the transaction cache until end of transaction (or statement that were not part of a transaction). For the case when AUTOCOMMIT=0 and we are creating a transactional table using a create select, we would then keep the CREATE TABLE statement and the rows for the CREATE-SELECT, while executing the following statements. On a rollback, the transaction cache would then be cleared, which would also remove the CREATE TABLE statement. Hence no table would be created on the slave, while there is an empty table on the master. This relates to BUG#22865 where the table being created exists on the master, but not on the slave during insertion of rows into the newly created table. This occurs since the CREATE TABLE statement were still in the transaction cache until the statement finished executing, and possibly longer if the table was transactional. This patch changes the behaviour of the CREATE-SELECT statement by adding an implicit commit at the end of the statement when creating non-temporary tables. Hence, non-temporary tables will be written to the binary log on completion, and in the even of AUTOCOMMIT=0, a new transaction will be started. Temporary tables do not commit an ongoing transaction: neither as a pre- not a post-commit. The events for both transactional and non-transactional tables are saved in the transaction cache, and written to the binary log at end of the statement. --- mysql-test/r/rpl_row_create_table.result | 191 +++++++++++++++++++- mysql-test/t/rpl_row_create_table-slave.opt | 1 + mysql-test/t/rpl_row_create_table.test | 125 ++++++++++++- sql/log.cc | 158 +++++++++++++--- sql/log.h | 2 + sql/log_event.h | 12 +- sql/mysql_priv.h | 66 +++---- sql/slave.cc | 6 + sql/sql_class.h | 2 + sql/sql_insert.cc | 94 ++++++++-- 10 files changed, 564 insertions(+), 93 deletions(-) create mode 100644 mysql-test/t/rpl_row_create_table-slave.opt diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result index 03388f59b8c..8f587fb5796 100644 --- a/mysql-test/r/rpl_row_create_table.result +++ b/mysql-test/r/rpl_row_create_table.result @@ -127,7 +127,7 @@ NULL 5 10 NULL 6 12 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 1256; +SHOW BINLOG EVENTS FROM 1118; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -212,3 +212,192 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; +STOP SLAVE; +SET GLOBAL storage_engine=@storage_engine; +START SLAVE; +================ BUG#22864 ================ +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; +SET AUTOCOMMIT=0; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 ENGINE=INNODB SELECT * FROM t1; +ROLLBACK; +CREATE TABLE t3 ENGINE=INNODB SELECT * FROM t1; +INSERT INTO t3 VALUES (4),(5),(6); +ROLLBACK; +CREATE TABLE t4 ENGINE=INNODB SELECT * FROM t1; +INSERT INTO t1 VALUES (4),(5),(6); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SHOW TABLES; +Tables_in_test +t1 +t2 +t3 +t4 +SELECT TABLE_NAME,ENGINE +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME LIKE 't_' +ORDER BY TABLE_NAME; +TABLE_NAME ENGINE +t1 MyISAM +t2 InnoDB +t3 InnoDB +t4 InnoDB +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +5 +6 +SELECT * FROM t2 ORDER BY a; +a +1 +2 +3 +SELECT * FROM t3 ORDER BY a; +a +1 +2 +3 +SELECT * FROM t4 ORDER BY a; +a +1 +2 +3 +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # +master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) +master-bin.000001 227 Write_rows 1 271 table_id: # flags: STMT_END_F +master-bin.000001 271 Query 1 339 use `test`; BEGIN +master-bin.000001 339 Query 1 125 use `test`; CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB +master-bin.000001 464 Table_map 1 164 table_id: # (test.t2) +master-bin.000001 503 Write_rows 1 208 table_id: # flags: STMT_END_F +master-bin.000001 547 Xid 1 574 COMMIT /* XID */ +master-bin.000001 574 Query 1 642 use `test`; BEGIN +master-bin.000001 642 Query 1 125 use `test`; CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB +master-bin.000001 767 Table_map 1 164 table_id: # (test.t3) +master-bin.000001 806 Write_rows 1 208 table_id: # flags: STMT_END_F +master-bin.000001 850 Xid 1 877 COMMIT /* XID */ +master-bin.000001 877 Query 1 945 use `test`; BEGIN +master-bin.000001 945 Query 1 125 use `test`; CREATE TABLE `t4` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB +master-bin.000001 1070 Table_map 1 164 table_id: # (test.t4) +master-bin.000001 1109 Write_rows 1 208 table_id: # flags: STMT_END_F +master-bin.000001 1153 Xid 1 1180 COMMIT /* XID */ +master-bin.000001 1180 Table_map 1 1219 table_id: # (test.t1) +master-bin.000001 1219 Write_rows 1 1263 table_id: # flags: STMT_END_F +SHOW TABLES; +Tables_in_test +t1 +t2 +t3 +t4 +SELECT TABLE_NAME,ENGINE +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME LIKE 't_' +ORDER BY TABLE_NAME; +TABLE_NAME ENGINE +t1 MyISAM +t2 InnoDB +t3 InnoDB +t4 InnoDB +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +5 +6 +SELECT * FROM t2 ORDER BY a; +a +1 +2 +3 +SELECT * FROM t3 ORDER BY a; +a +1 +2 +3 +SELECT * FROM t4 ORDER BY a; +a +1 +2 +3 +DROP TABLE IF EXISTS t1,t2,t3,t4; +SET AUTOCOMMIT=1; +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 (a INT) ENGINE=INNODB; +BEGIN; +INSERT INTO t2 SELECT a*a FROM t1; +CREATE TEMPORARY TABLE tt1 +SELECT a+1 AS a +FROM t1 +WHERE a MOD 2 = 1; +INSERT INTO t2 SELECT a+2 FROM tt1; +COMMIT; +SELECT * FROM t2 ORDER BY a; +a +1 +4 +4 +6 +9 +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # +master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) +master-bin.000001 227 Write_rows 1 271 table_id: # flags: STMT_END_F +master-bin.000001 271 Query 1 371 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB +master-bin.000001 371 Query 1 439 use `test`; BEGIN +master-bin.000001 439 Table_map 1 39 table_id: # (test.t2) +master-bin.000001 478 Write_rows 1 83 table_id: # flags: STMT_END_F +master-bin.000001 522 Table_map 1 122 table_id: # (test.t2) +master-bin.000001 561 Write_rows 1 161 table_id: # flags: STMT_END_F +master-bin.000001 600 Xid 1 627 COMMIT /* XID */ +SELECT * FROM t2 ORDER BY a; +a +1 +4 +4 +6 +9 +TRUNCATE TABLE t2; +BEGIN; +INSERT INTO t2 SELECT a*a FROM t1; +CREATE TEMPORARY TABLE tt2 +SELECT a+1 AS a +FROM t1 +WHERE a MOD 2 = 1; +INSERT INTO t2 SELECT a+2 FROM tt2; +ROLLBACK; +SELECT * FROM t2 ORDER BY a; +a +SHOW BINLOG EVENTS FROM 627; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 627 Query 1 80 use `test`; TRUNCATE TABLE t2 +master-bin.000001 707 Xid 1 734 COMMIT /* XID */ +SELECT * FROM t2 ORDER BY a; +a +DROP TABLE t1,t2; diff --git a/mysql-test/t/rpl_row_create_table-slave.opt b/mysql-test/t/rpl_row_create_table-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_create_table-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test index 3a711e5b496..6accf0c8bef 100644 --- a/mysql-test/t/rpl_row_create_table.test +++ b/mysql-test/t/rpl_row_create_table.test @@ -2,6 +2,10 @@ --source include/have_binlog_format_row.inc --source include/master-slave.inc +--source include/have_innodb.inc +connection slave; +--source include/have_innodb.inc +connection master; # Bug#18326: Do not lock table for writing during prepare of statement # The use of the ps protocol causes extra table maps in the binlog, so @@ -31,7 +35,7 @@ CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; --replace_column 1 # 4 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --query_vertical SHOW BINLOG EVENTS FROM 212 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 @@ -66,8 +70,8 @@ connection master; --error 1062 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log ---replace_regex /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1256; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 1118; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -75,7 +79,7 @@ CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log ---replace_regex /table_id: [0-9]+/table_id: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS FROM 1118; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -86,7 +90,7 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); BEGIN; INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; ---replace_regex /table_id: [0-9]+/table_id: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS FROM 1314; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; @@ -101,7 +105,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1; --echo **** On Master **** --query_vertical SHOW CREATE TABLE t8 --query_vertical SHOW CREATE TABLE t9 ---replace_regex /table_id: [0-9]+/table_id: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS FROM 1410; sync_slave_with_master; --echo **** On Slave **** @@ -109,12 +113,117 @@ sync_slave_with_master; --query_vertical SHOW CREATE TABLE t9 connection master; ---disable_query_log DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; sync_slave_with_master; # Here we reset the value of the default storage engine STOP SLAVE; SET GLOBAL storage_engine=@storage_engine; START SLAVE; ---enable_query_log --enable_ps_protocol + +# BUG#22864 (Rollback following CREATE ... SELECT discards 'CREATE +# table' from log): +--echo ================ BUG#22864 ================ +connection slave; +STOP SLAVE; +RESET SLAVE; +connection master; +RESET MASTER; +connection slave; +START SLAVE; +connection master; +SET AUTOCOMMIT=0; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +CREATE TABLE t2 ENGINE=INNODB SELECT * FROM t1; +ROLLBACK; + +CREATE TABLE t3 ENGINE=INNODB SELECT * FROM t1; +INSERT INTO t3 VALUES (4),(5),(6); +ROLLBACK; + +CREATE TABLE t4 ENGINE=INNODB SELECT * FROM t1; +INSERT INTO t1 VALUES (4),(5),(6); +ROLLBACK; + +SHOW TABLES; +SELECT TABLE_NAME,ENGINE + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME LIKE 't_' +ORDER BY TABLE_NAME; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t3 ORDER BY a; +SELECT * FROM t4 ORDER BY a; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS; +sync_slave_with_master; +SHOW TABLES; +SELECT TABLE_NAME,ENGINE + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME LIKE 't_' +ORDER BY TABLE_NAME; +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t3 ORDER BY a; +SELECT * FROM t4 ORDER BY a; + +connection master; +DROP TABLE IF EXISTS t1,t2,t3,t4; +SET AUTOCOMMIT=1; +sync_slave_with_master; + +# Some tests with temporary tables +connection slave; +STOP SLAVE; +RESET SLAVE; + +connection master; +RESET MASTER; + +connection slave; +START SLAVE; + +connection master; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +CREATE TABLE t2 (a INT) ENGINE=INNODB; + +BEGIN; +INSERT INTO t2 SELECT a*a FROM t1; +CREATE TEMPORARY TABLE tt1 +SELECT a+1 AS a + FROM t1 + WHERE a MOD 2 = 1; +INSERT INTO t2 SELECT a+2 FROM tt1; +COMMIT; + +SELECT * FROM t2 ORDER BY a; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS; +sync_slave_with_master; +SELECT * FROM t2 ORDER BY a; + +connection master; +TRUNCATE TABLE t2; + +BEGIN; +INSERT INTO t2 SELECT a*a FROM t1; +CREATE TEMPORARY TABLE tt2 +SELECT a+1 AS a + FROM t1 + WHERE a MOD 2 = 1; +INSERT INTO t2 SELECT a+2 FROM tt2; +ROLLBACK; + +SELECT * FROM t2 ORDER BY a; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ +SHOW BINLOG EVENTS FROM 627; +sync_slave_with_master; +SELECT * FROM t2 ORDER BY a; + +connection master; +DROP TABLE t1,t2; +sync_slave_with_master; diff --git a/sql/log.cc b/sql/log.cc index a1ed9bd6df3..1bb1b9a33e6 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -81,6 +81,41 @@ char *make_default_log_name(char *buff,const char* log_ext) MYF(MY_UNPACK_FILENAME|MY_APPEND_EXT)); } +/* + Helper class to hold a mutex for the duration of the + block. + + Eliminates the need for explicit unlocking of mutexes on, e.g., + error returns. On passing a null pointer, the sentry will not do + anything. + */ +class Mutex_sentry +{ +public: + Mutex_sentry(pthread_mutex_t *mutex) + : m_mutex(mutex) + { + if (m_mutex) + pthread_mutex_lock(mutex); + } + + ~Mutex_sentry() + { + if (m_mutex) + pthread_mutex_unlock(m_mutex); +#ifndef DBUG_OFF + m_mutex= 0; +#endif + } + +private: + pthread_mutex_t *m_mutex; + + // It's not allowed to copy this object in any way + Mutex_sentry(Mutex_sentry const&); + void operator=(Mutex_sentry const&); +}; + /* Helper class to store binary log transaction data. */ @@ -121,11 +156,17 @@ public: */ void truncate(my_off_t pos) { + DBUG_PRINT("info", ("truncating to position %lu", pos)); + DBUG_PRINT("info", ("before_stmt_pos=%lu", pos)); #ifdef HAVE_ROW_BASED_REPLICATION delete pending(); set_pending(0); #endif reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0); +#ifdef HAVE_ROW_BASED_REPLICATION + if (pos < before_stmt_pos) + before_stmt_pos= MY_OFF_T_UNDEF; +#endif } /* @@ -1416,12 +1457,11 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, If rolling back a statement in a transaction, we truncate the transaction cache to remove the statement. - */ if (all || !(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) trx_data->reset(); - else - trx_data->truncate(trx_data->before_stmt_pos); // ...statement + else // ...statement + trx_data->truncate(trx_data->before_stmt_pos); /* We need to step the table map version on a rollback to ensure @@ -2010,7 +2050,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, goto err; /* command_type, thread_id */ - length= my_snprintf(buff, 32, "%5ld ", thread_id); + length= my_snprintf(buff, 32, "%5ld ", static_cast(thread_id)); if (my_b_write(&log_file, (byte*) buff, length)) goto err; @@ -3338,18 +3378,7 @@ THD::binlog_start_trans_and_stmt() if (trx_data == NULL || trx_data->before_stmt_pos == MY_OFF_T_UNDEF) { - /* - The call to binlog_trans_log_savepos() might create the trx_data - structure, if it didn't exist before, so we save the position - into an auto variable and then write it into the transaction - data for the binary log (i.e., trx_data). - */ - my_off_t pos= 0; - binlog_trans_log_savepos(this, &pos); - trx_data= (binlog_trx_data*) ha_data[binlog_hton->slot]; - - trx_data->before_stmt_pos= pos; - + this->binlog_set_stmt_begin(); if (options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) trans_register_ha(this, TRUE, binlog_hton); trans_register_ha(this, FALSE, binlog_hton); @@ -3357,6 +3386,51 @@ THD::binlog_start_trans_and_stmt() DBUG_VOID_RETURN; } +void THD::binlog_set_stmt_begin() { + binlog_trx_data *trx_data= + (binlog_trx_data*) ha_data[binlog_hton->slot]; + + /* + The call to binlog_trans_log_savepos() might create the trx_data + structure, if it didn't exist before, so we save the position + into an auto variable and then write it into the transaction + data for the binary log (i.e., trx_data). + */ + my_off_t pos= 0; + binlog_trans_log_savepos(this, &pos); + trx_data= (binlog_trx_data*) ha_data[binlog_hton->slot]; + trx_data->before_stmt_pos= pos; +} + +int THD::binlog_flush_transaction_cache() +{ + DBUG_ENTER("binlog_flush_transaction_cache"); + binlog_trx_data *trx_data= (binlog_trx_data*) ha_data[binlog_hton->slot]; + DBUG_PRINT("enter", ("trx_data=0x%lu", trx_data)); + if (trx_data) + DBUG_PRINT("enter", ("trx_data->before_stmt_pos=%u", + trx_data->before_stmt_pos)); + + /* + Write the transaction cache to the binary log. We don't flush and + sync the log file since we don't know if more will be written to + it. If the caller want the log file sync:ed, the caller has to do + it. + + The transaction data is only reset upon a successful write of the + cache to the binary log. + */ + + if (trx_data && likely(mysql_bin_log.is_open())) { + if (int error= mysql_bin_log.write_cache(&trx_data->trans_log, true, true)) + DBUG_RETURN(error); + trx_data->reset(); + } + + DBUG_RETURN(0); +} + + /* Write a table map to the binary log. */ @@ -3767,6 +3841,40 @@ uint MYSQL_BIN_LOG::next_file_id() } +/* + Write the contents of a cache to the binary log. + + SYNOPSIS + write_cache() + cache Cache to write to the binary log + lock_log True if the LOCK_log mutex should be aquired, false otherwise + sync_log True if the log should be flushed and sync:ed + + DESCRIPTION + Write the contents of the cache to the binary log. The cache will + be reset as a READ_CACHE to be able to read the contents from it. + */ + +int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log) +{ + Mutex_sentry sentry(lock_log ? &LOCK_log : NULL); + + if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) + return ER_ERROR_ON_WRITE; + uint bytes= my_b_bytes_in_cache(cache); + do + { + if (my_b_write(&log_file, cache->read_pos, bytes)) + return ER_ERROR_ON_WRITE; + cache->read_pos= cache->read_end; + } while ((bytes= my_b_fill(cache))); + + if (sync_log) + flush_and_sync(); + + return 0; // All OK +} + /* Write a cached log entry to the binary log @@ -3774,6 +3882,8 @@ uint MYSQL_BIN_LOG::next_file_id() write() thd cache The cache to copy to the binlog + commit_event The commit event to print after writing the + contents of the cache. NOTE - We only come here if there is something in the cache. @@ -3833,20 +3943,10 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) if (qinfo.write(&log_file)) goto err; } - /* Read from the file used to cache the queries .*/ - if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0)) - goto err; - length=my_b_bytes_in_cache(cache); - DBUG_EXECUTE_IF("half_binlogged_transaction", length-=100;); - do - { - /* Write data to the binary log file */ - if (my_b_write(&log_file, cache->read_pos, length)) - goto err; - cache->read_pos=cache->read_end; // Mark buffer used up - DBUG_EXECUTE_IF("half_binlogged_transaction", goto DBUG_skip_commit;); - } while ((length=my_b_fill(cache))); + if ((write_error= write_cache(cache, false, false))) + goto err; + if (commit_event && commit_event->write(&log_file)) goto err; #ifndef DBUG_OFF diff --git a/sql/log.h b/sql/log.h index 8f75601f02b..d82065ce0ff 100644 --- a/sql/log.h +++ b/sql/log.h @@ -338,6 +338,8 @@ public: bool write(Log_event* event_info); // binary log write bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event); + int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync); + void start_union_events(THD *thd); void stop_union_events(THD *thd); bool is_query_in_union(THD *thd, query_id_t query_id_param); diff --git a/sql/log_event.h b/sql/log_event.h index 81ce2f18b4d..41e0f8aed46 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -405,12 +405,18 @@ struct sql_ex_info either, as the manual says (because a too big in-memory temp table is automatically written to disk). */ -#define OPTIONS_WRITTEN_TO_BIN_LOG (OPTION_AUTO_IS_NULL | \ -OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS) +#define OPTIONS_WRITTEN_TO_BIN_LOG \ + (OPTION_AUTO_IS_NULL | OPTION_NO_FOREIGN_KEY_CHECKS | \ + OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT) -#if OPTIONS_WRITTEN_TO_BIN_LOG != ((1L << 14) | (1L << 26) | (1L << 27)) +/* Shouldn't be defined before */ +#define EXPECTED_OPTIONS \ + ((ULL(1) << 14) | (ULL(1) << 26) | (ULL(1) << 27) | (ULL(1) << 19)) + +#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS #error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values! #endif +#undef EXPECTED_OPTIONS /* You shouldn't use this one */ enum Log_event_type { diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 339ca9d965a..5e0d24a5c1f 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -296,54 +296,54 @@ MY_LOCALE *my_locale_by_name(const char *name); TODO: separate three contexts above, move them to separate bitfields. */ -#define SELECT_DISTINCT (LL(1) << 0) // SELECT, user -#define SELECT_STRAIGHT_JOIN (LL(1) << 1) // SELECT, user -#define SELECT_DESCRIBE (LL(1) << 2) // SELECT, user -#define SELECT_SMALL_RESULT (LL(1) << 3) // SELECT, user -#define SELECT_BIG_RESULT (LL(1) << 4) // SELECT, user -#define OPTION_FOUND_ROWS (LL(1) << 5) // SELECT, user -#define OPTION_TO_QUERY_CACHE (LL(1) << 6) // SELECT, user -#define SELECT_NO_JOIN_CACHE (LL(1) << 7) // intern -#define OPTION_BIG_TABLES (LL(1) << 8) // THD, user -#define OPTION_BIG_SELECTS (LL(1) << 9) // THD, user -#define OPTION_LOG_OFF (LL(1) << 10) // THD, user -#define OPTION_QUOTE_SHOW_CREATE (LL(1) << 11) // THD, user -#define TMP_TABLE_ALL_COLUMNS (LL(1) << 12) // SELECT, intern -#define OPTION_WARNINGS (LL(1) << 13) // THD, user -#define OPTION_AUTO_IS_NULL (LL(1) << 14) // THD, user, binlog -#define OPTION_FOUND_COMMENT (LL(1) << 15) // SELECT, intern, parser -#define OPTION_SAFE_UPDATES (LL(1) << 16) // THD, user -#define OPTION_BUFFER_RESULT (LL(1) << 17) // SELECT, user -#define OPTION_BIN_LOG (LL(1) << 18) // THD, user -#define OPTION_NOT_AUTOCOMMIT (LL(1) << 19) // THD, user -#define OPTION_BEGIN (LL(1) << 20) // THD, intern -#define OPTION_TABLE_LOCK (LL(1) << 21) // THD, intern -#define OPTION_QUICK (LL(1) << 22) // SELECT (for DELETE) -#define OPTION_KEEP_LOG (LL(1) << 23) // Keep binlog on rollback +#define SELECT_DISTINCT (ULL(1) << 0) // SELECT, user +#define SELECT_STRAIGHT_JOIN (ULL(1) << 1) // SELECT, user +#define SELECT_DESCRIBE (ULL(1) << 2) // SELECT, user +#define SELECT_SMALL_RESULT (ULL(1) << 3) // SELECT, user +#define SELECT_BIG_RESULT (ULL(1) << 4) // SELECT, user +#define OPTION_FOUND_ROWS (ULL(1) << 5) // SELECT, user +#define OPTION_TO_QUERY_CACHE (ULL(1) << 6) // SELECT, user +#define SELECT_NO_JOIN_CACHE (ULL(1) << 7) // intern +#define OPTION_BIG_TABLES (ULL(1) << 8) // THD, user +#define OPTION_BIG_SELECTS (ULL(1) << 9) // THD, user +#define OPTION_LOG_OFF (ULL(1) << 10) // THD, user +#define OPTION_QUOTE_SHOW_CREATE (ULL(1) << 11) // THD, user +#define TMP_TABLE_ALL_COLUMNS (ULL(1) << 12) // SELECT, intern +#define OPTION_WARNINGS (ULL(1) << 13) // THD, user +#define OPTION_AUTO_IS_NULL (ULL(1) << 14) // THD, user, binlog +#define OPTION_FOUND_COMMENT (ULL(1) << 15) // SELECT, intern, parser +#define OPTION_SAFE_UPDATES (ULL(1) << 16) // THD, user +#define OPTION_BUFFER_RESULT (ULL(1) << 17) // SELECT, user +#define OPTION_BIN_LOG (ULL(1) << 18) // THD, user +#define OPTION_NOT_AUTOCOMMIT (ULL(1) << 19) // THD, user +#define OPTION_BEGIN (ULL(1) << 20) // THD, intern +#define OPTION_TABLE_LOCK (ULL(1) << 21) // THD, intern +#define OPTION_QUICK (ULL(1) << 22) // SELECT (for DELETE) +#define OPTION_KEEP_LOG (ULL(1) << 23) // Keep binlog on rollback /* The following is used to detect a conflict with DISTINCT */ -#define SELECT_ALL (LL(1) << 24) // SELECT, user, parser +#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser /* Set if we are updating a non-transaction safe table */ -#define OPTION_STATUS_NO_TRANS_UPDATE (LL(1) << 25) // THD, intern +#define OPTION_STATUS_NO_TRANS_UPDATE (ULL(1) << 25) // THD, intern /* The following can be set when importing tables in a 'wrong order' to suppress foreign key checks */ -#define OPTION_NO_FOREIGN_KEY_CHECKS (LL(1) << 26) // THD, user, binlog +#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog /* The following speeds up inserts to InnoDB tables by suppressing unique key checks in some cases */ -#define OPTION_RELAXED_UNIQUE_CHECKS (LL(1) << 27) // THD, user, binlog -#define SELECT_NO_UNLOCK (LL(1) << 28) // SELECT, intern -#define OPTION_SCHEMA_TABLE (LL(1) << 29) // SELECT, intern +#define OPTION_RELAXED_UNIQUE_CHECKS (ULL(1) << 27) // THD, user, binlog +#define SELECT_NO_UNLOCK (ULL(1) << 28) // SELECT, intern +#define OPTION_SCHEMA_TABLE (ULL(1) << 29) // SELECT, intern /* Flag set if setup_tables already done */ -#define OPTION_SETUP_TABLES_DONE (LL(1) << 30) // intern +#define OPTION_SETUP_TABLES_DONE (ULL(1) << 30) // intern /* If not set then the thread will ignore all warnings with level notes. */ -#define OPTION_SQL_NOTES (LL(1) << 31) // THD, user +#define OPTION_SQL_NOTES (ULL(1) << 31) // THD, user /* Force the used temporary table to be a MyISAM table (because we will use fulltext functions when reading from it. */ -#define TMP_TABLE_FORCE_MYISAM (LL(1) << 32) +#define TMP_TABLE_FORCE_MYISAM (ULL(1) << 32) /* Maximum length of time zone name that we support diff --git a/sql/slave.cc b/sql/slave.cc index 1852ff68070..493d867a618 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -31,6 +31,8 @@ #include "rpl_tblmap.h" +#define FLAGSTR(V,F) ((V)&(F)?#F" ":"") + #define MAX_SLAVE_RETRY_PAUSE 5 bool use_slave_mask = 0; MY_BITMAP slave_error_mask; @@ -3153,6 +3155,10 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) if (!ev->when) ev->when = time(NULL); ev->thd = thd; // because up to this point, ev->thd == 0 + DBUG_PRINT("info", ("thd->options={ %s%s}", + FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), + FLAGSTR(thd->options, OPTION_BEGIN))); + exec_res = ev->exec_event(rli); DBUG_PRINT("info", ("exec_event result = %d", exec_res)); DBUG_ASSERT(rli->sql_thd==thd); diff --git a/sql/sql_class.h b/sql/sql_class.h index 95283ec2fc8..28d60c03c06 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -931,6 +931,8 @@ public: Public interface to write RBR events to the binlog */ void binlog_start_trans_and_stmt(); + int binlog_flush_transaction_cache(); + void binlog_set_stmt_begin(); int binlog_write_table_map(TABLE *table, bool is_transactional); int binlog_write_row(TABLE* table, bool is_transactional, MY_BITMAP const* cols, my_size_t colcnt, diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 4dcbf9af4a0..7779adbf303 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2640,8 +2640,7 @@ void select_insert::send_error(uint errcode,const char *err) If the creation of the table failed (due to a syntax error, for example), no table will have been opened and therefore 'table' will be NULL. In that case, we still need to execute the rollback - and the end of the function to truncate the binary log, but we can - skip all the intermediate steps. + and the end of the function. */ if (table) { @@ -2672,10 +2671,8 @@ void select_insert::send_error(uint errcode,const char *err) if (!table->file->has_transactions()) { if (mysql_bin_log.is_open()) - { thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, table->file->has_transactions(), FALSE); - } if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table && !can_rollback_data()) thd->options|= OPTION_STATUS_NO_TRANS_UPDATE; @@ -2943,6 +2940,24 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) TABLEOP_HOOKS *hook_ptr= NULL; #ifdef HAVE_ROW_BASED_REPLICATION + /* + For row-based replication, the CREATE-SELECT statement is written + in two pieces: the first one contain the CREATE TABLE statement + necessary to create the table and the second part contain the rows + that should go into the table. + + For non-temporary tables, the start of the CREATE-SELECT + implicitly commits the previous transaction, and all events + forming the statement will be stored the transaction cache. At end + of the statement, the entire statement is committed as a + transaction, and all events are written to the binary log. + + On the master, the table is locked for the duration of the + statement, but since the CREATE part is replicated as a simple + statement, there is no way to lock the table for accesses on the + slave. Hence, we have to hold on to the CREATE part of the + statement until the statement has finished. + */ class MY_HOOKS : public TABLEOP_HOOKS { public: MY_HOOKS(select_create *x) : ptr(x) { } @@ -2952,7 +2967,7 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) { TABLE const *const table = *tables; if (ptr->get_thd()->current_stmt_binlog_row_based && - table->s->tmp_table == NO_TMP_TABLE && + !table->s->tmp_table && !ptr->get_create_info()->table_existed) { ptr->binlog_show_create_table(tables, count); @@ -2970,9 +2985,9 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) #ifdef HAVE_ROW_BASED_REPLICATION /* - Start a statement transaction before the create if we are creating - a non-temporary table and are using row-based replication for the - statement. + Start a statement transaction before the create if we are using + row-based replication for the statement. If we are creating a + temporary table, we need to start a statement transaction. */ if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0 && thd->current_stmt_binlog_row_based) @@ -3076,13 +3091,35 @@ void select_create::store_values(List &values) void select_create::send_error(uint errcode,const char *err) { + DBUG_ENTER("select_create::send_error"); + + DBUG_PRINT("info", + ("Current statement %s row-based", + thd->current_stmt_binlog_row_based ? "is" : "is NOT")); + DBUG_PRINT("info", + ("Current table (at 0x%lu) %s a temporary (or non-existant) table", + table, + table && !table->s->tmp_table ? "is NOT" : "is")); + DBUG_PRINT("info", + ("Table %s prior to executing this statement", + get_create_info()->table_existed ? "existed" : "did not exist")); + /* - Disable binlog, because we "roll back" partial inserts in ::abort - by removing the table, even for non-transactional tables. + This will execute any rollbacks that are necessary before writing + the transcation cache. + + We disable the binary log since nothing should be written to the + binary log. This disabling is important, since we potentially do + a "roll back" of non-transactional tables by removing the table, + and the actual rollback might generate events that should not be + written to the binary log. + */ tmp_disable_binlog(thd); select_insert::send_error(errcode, err); reenable_binlog(thd); + + DBUG_VOID_RETURN; } @@ -3093,6 +3130,14 @@ bool select_create::send_eof() abort(); else { + /* + Do an implicit commit at end of statement for non-temporary + tables. This can fail, but we should unlock the table + nevertheless. + */ + if (!table->s->tmp_table) + ha_commit(thd); // Can fail, but we proceed anyway + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); VOID(pthread_mutex_lock(&LOCK_open)); @@ -3111,12 +3156,31 @@ bool select_create::send_eof() void select_create::abort() { + DBUG_ENTER("select_create::abort"); VOID(pthread_mutex_lock(&LOCK_open)); + + /* + We roll back the statement, including truncating the transaction + cache of the binary log, if the statement failed. + + We roll back the statement prior to deleting the table and prior + to releasing the lock on the table, since there might be potential + for failure if the rollback is executed after the drop or after + unlocking the table. + + We also roll back the statement regardless of whether the creation + of the table succeeded or not, since we need to reset the binary + log state. + */ + if (thd->current_stmt_binlog_row_based) + ha_rollback_stmt(thd); + if (thd->extra_lock) { mysql_unlock_tables(thd, thd->extra_lock); thd->extra_lock=0; } + if (table) { table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); @@ -3128,17 +3192,8 @@ void select_create::abort() table->s->version= 0; hash_delete(&open_cache,(byte*) table); if (!create_info->table_existed) - { quick_rm_table(table_type, create_table->db, create_table->table_name, 0); - /* - We roll back the statement, including truncating the - transaction cache of the binary log, if the statement - failed. - */ - if (thd->current_stmt_binlog_row_based) - ha_rollback_stmt(thd); - } /* Tell threads waiting for refresh that something has happened */ if (version != refresh_version) broadcast_refresh(); @@ -3148,6 +3203,7 @@ void select_create::abort() table=0; // Safety } VOID(pthread_mutex_unlock(&LOCK_open)); + DBUG_VOID_RETURN; } From 945c35eee9654f317c179d3ba9edbc72d604ff17 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 00:05:40 +0100 Subject: [PATCH 087/160] Bug#24148 regression tests hang with SSL enabled - Don't call SSL_shutdown a second time --- vio/viossl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vio/viossl.c b/vio/viossl.c index f436262a3ce..806f6fc356a 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -126,12 +126,16 @@ int vio_ssl_close(Vio *vio) { switch ((r= SSL_shutdown(ssl))) { - case 1: /* Shutdown successful */ + case 1: + /* Shutdown successful */ + break; + case 0: + /* + Shutdown not yet finished - since the socket is going to + be closed there is no need to call SSL_shutdown() a second + time to wait for the other side to respond + */ break; - case 0: /* Shutdown not yet finished, call it again */ - if ((r= SSL_shutdown(ssl) >= 0)) - break; - /* Fallthrough */ default: /* Shutdown failed */ DBUG_PRINT("vio_error", ("SSL_shutdown() failed, error: %d", SSL_get_error(ssl, r))); From 2e744d564498345e7863afcac9fd9c05a1c58055 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 00:38:34 +0100 Subject: [PATCH 088/160] Bug #23125 [patch] trigger test fails when run as root - Skip tests using chmod when running as root --- mysql-test/t/information_schema_chmod.test | 4 ++-- mysql-test/t/mysqltest.test | 3 +++ mysql-test/t/rpl_rotate_logs.test | 8 +++++--- mysql-test/t/trigger.test | 14 ++++++++++---- mysql-test/t/varbinary.test | 4 ++++ 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test index c7ea2b03890..38586ab8b67 100644 --- a/mysql-test/t/information_schema_chmod.test +++ b/mysql-test/t/information_schema_chmod.test @@ -17,7 +17,7 @@ # create database mysqltest; create table mysqltest.t1(a int); ---exec chmod -r $MYSQLTEST_VARDIR/master-data/mysqltest +chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest; select table_schema from information_schema.tables where table_schema='mysqltest'; ---exec chmod +r $MYSQLTEST_VARDIR/master-data/mysqltest +exec chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest; drop database mysqltest; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index c06d51d9d49..7da84543e6d 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1,6 +1,9 @@ # This test should work in embedded server after mysqltest is fixed -- source include/not_embedded.inc +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + # ============================================================================ # # Test of mysqltest itself diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index ee49f92910a..39a810aa021 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -17,8 +17,10 @@ connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); drop table if exists t1, t2, t3, t4; --enable_warnings connect (slave,localhost,root,,test,$SLAVE_MYPORT,slave.sock); -system cat /dev/null > $MYSQLTEST_VARDIR/slave-data/master.info; -system chmod 000 $MYSQLTEST_VARDIR/slave-data/master.info; +# Create empty file +write_file $MYSQLTEST_VARDIR/slave-data/master.info; +EOF +chmod 0000 $MYSQLTEST_VARDIR/slave-data/master.info; connection slave; --disable_warnings drop table if exists t1, t2, t3, t4; @@ -29,7 +31,7 @@ drop table if exists t1, t2, t3, t4; --replace_result $MYSQL_TEST_DIR TESTDIR --error 1105,1105,29 start slave; -system chmod 600 $MYSQLTEST_VARDIR/slave-data/master.info; +chmod 0600 $MYSQLTEST_VARDIR/slave-data/master.info; # It will fail again because the file is empty so the slave cannot get valuable # info about how to connect to the master from it (failure in # init_strvar_from_file() in init_master_info()). diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index a9395c12a63..2bb2292e5b8 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1,3 +1,7 @@ +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + + # # Basic triggers test # @@ -1138,8 +1142,10 @@ select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; # Trick which makes update of second .TRN file impossible -system echo dummy >$MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; -system chmod 000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +write_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +dummy +EOF +chmod 0000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; --error 1 rename table t1 to t2; # 't1' should be still there and triggers should work correctly @@ -1148,8 +1154,8 @@ select @a, @b; select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; -system chmod 600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; -system rm $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +chmod 0600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +remove_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; # Let us check that updates to .TRN files were rolled back too drop trigger t1_bi; drop trigger t1_ai; diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index 0e45bfb5e1b..2f0c1c83e84 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -1,3 +1,7 @@ +# This test uses chmod, can't be run with root permissions +-- source include/not_as_root.inc + + # Initialise --disable_warnings drop table if exists t1; From f495b5f92300f662fffc51cb1a55e3d2d8baf387 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Fri, 22 Dec 2006 11:43:04 +0400 Subject: [PATCH 089/160] After merge fix --- mysql-test/t/mysqlbinlog.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index db5c4efe8ad..ad6a16810c5 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -153,7 +153,7 @@ insert into t5 values (3, date_format('2001-01-01','%W')); select * from t5 order by c1; flush logs; drop table t5; ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL select * from t5 order by c1; # # Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails @@ -174,8 +174,8 @@ call p1(); drop procedure p1; --error 1305 call p1(); ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 | $MYSQL +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010 +--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010 | $MYSQL call p1(); drop procedure p1; @@ -189,7 +189,7 @@ drop table t1, t2, t03, t04, t3, t4, t5; # flush logs; --error 1 ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null ---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null +--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null # End of 5.1 tests From 73d82523a3862016589299d69de8271529d0338d Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 09:59:41 +0100 Subject: [PATCH 090/160] Set default number of masters to 1 --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b3a7427c359..eb4a07b1efa 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -227,7 +227,7 @@ our $opt_mark_progress; our $opt_skip; our $opt_skip_rpl; our $max_slave_num= 0; -our $max_master_num= 0; +our $max_master_num= 1; our $use_innodb; our $opt_skip_test; our $opt_skip_im; From 0af60de724dcab23ce6e5d052e8fa3210c1881ed Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 10:20:20 +0100 Subject: [PATCH 091/160] Cset exclude: msvensson@neptunus.(none)|ChangeSet|20061215122345|24188 --- mysql-test/t/rpl_openssl.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test index 7d769ad448e..af70a1a9453 100644 --- a/mysql-test/t/rpl_openssl.test +++ b/mysql-test/t/rpl_openssl.test @@ -1,3 +1,7 @@ +# TODO: THIS TEST DOES NOT WORK ON WINDOWS +# This should be fixed. +--source include/not_windows.inc + source include/have_openssl.inc; source include/master-slave.inc; From 751c90ad8cbb1e3a719fcefb37ec3cc567d63582 Mon Sep 17 00:00:00 2001 From: "mats@romeo.(none)" <> Date: Fri, 22 Dec 2006 12:09:44 +0100 Subject: [PATCH 092/160] BUG#22864 (CREATE-SELECT does not work correctly): Post-merge fixes. --- sql/log.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 06b8396fbd9..801b2849121 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -148,7 +148,6 @@ public: */ void truncate(my_off_t pos) { -#ifdef HAVE_ROW_BASED_REPLICATION DBUG_PRINT("info", ("truncating to position %lu", pos)); DBUG_PRINT("info", ("before_stmt_pos=%lu", pos)); delete pending(); @@ -156,7 +155,6 @@ public: reinit_io_cache(&trans_log, WRITE_CACHE, pos, 0, 0); if (pos < before_stmt_pos) before_stmt_pos= MY_OFF_T_UNDEF; -#endif } /* From c3b6f11091377595ee77f12cec4587bd0a8b803b Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 12:35:06 +0100 Subject: [PATCH 093/160] Potential use of NULL pointer in 'plugin_for_each_with_mask', check pointer before referencing it. --- sql/sql_plugin.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 9ff88b2054a..0b203002dec 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -985,7 +985,7 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, { rw_rdlock(&THR_LOCK_plugin); for (uint i=idx; i < total; i++) - if (plugins[i]->state & state_mask) + if (plugins[i] && plugins[i]->state & state_mask) plugins[i]=0; rw_unlock(&THR_LOCK_plugin); } From 86a9ad6883325e2034887984bc1dc0fcc9423092 Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Fri, 22 Dec 2006 15:30:37 +0300 Subject: [PATCH 094/160] Fix for the bug #24037 "Lossy Hebrew to Unicode conversion". Added definitions for the following Hebrew characters as specified by the ISO/IEC 8859-8:1999: LEFT-TO-RIGHT MARK (LRM) RIGHT-TO-LEFT MARK (RLM) --- mysql-test/r/ctype_hebrew.result | 11 +++++++++++ mysql-test/t/ctype_hebrew.test | 16 ++++++++++++++++ sql/share/charsets/hebrew.xml | 4 ++-- strings/conf_to_src.c | 9 ++++++++- strings/ctype-extra.c | 16 ++++++++++++---- 5 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 mysql-test/r/ctype_hebrew.result create mode 100644 mysql-test/t/ctype_hebrew.test diff --git a/mysql-test/r/ctype_hebrew.result b/mysql-test/r/ctype_hebrew.result new file mode 100644 index 00000000000..d938b2e47f3 --- /dev/null +++ b/mysql-test/r/ctype_hebrew.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS t1; +SET NAMES hebrew; +CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew; +INSERT INTO t1 VALUES (0xFD),(0xFE); +ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; +SELECT HEX(a) FROM t1; +HEX(a) +E2808E +E2808F +DROP TABLE t1; +End of 4.1 tests diff --git a/mysql-test/t/ctype_hebrew.test b/mysql-test/t/ctype_hebrew.test new file mode 100644 index 00000000000..f786d05141d --- /dev/null +++ b/mysql-test/t/ctype_hebrew.test @@ -0,0 +1,16 @@ +# +# BUG #24037: Lossy Hebrew to Unicode conversion +# +# Test if LRM and RLM characters are correctly converted to UTF-8 +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +SET NAMES hebrew; +CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew; +INSERT INTO t1 VALUES (0xFD),(0xFE); +ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +--echo End of 4.1 tests diff --git a/sql/share/charsets/hebrew.xml b/sql/share/charsets/hebrew.xml index 5bcf222a728..981f308bfb5 100644 --- a/sql/share/charsets/hebrew.xml +++ b/sql/share/charsets/hebrew.xml @@ -40,7 +40,7 @@ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 - 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 + 02 02 02 02 02 02 02 02 02 02 02 00 00 20 20 00 @@ -106,7 +106,7 @@ 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF -05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 +05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 200E 200F 0000 diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index 505bf154bec..b0b943df02a 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -270,7 +270,14 @@ main(int argc, char **argv __attribute__((unused))) } } - + fprintf(f, "/*\n"); + fprintf(f, " This file was generated by the conf_to_src utility. " + "Do not edit it directly,\n"); + fprintf(f, " edit the XML definitions in sql/share/charsets/ instead.\n\n"); + fprintf(f, " To re-generate, run the following in the strings/ " + "directory:\n"); + fprintf(f, " ./conf_to_src ../sql/share/charsets/ > FILE\n"); + fprintf(f, "*/\n\n"); fprintf(f,"#include \n"); fprintf(f,"#include \n\n"); diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index b680b69028c..63d33086a2e 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -1,3 +1,11 @@ +/* + This file was generated by the conf_to_src utility. Do not edit it directly, + edit the XML definitions in sql/share/charsets/ instead. + + To re-generate, run the following in the strings/ directory: + ./conf_to_src ../sql/share/charsets/ > FILE +*/ + #include #include @@ -1169,7 +1177,7 @@ uchar ctype_hebrew_general_ci[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, -0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00 +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00 }; uchar to_lower_hebrew_general_ci[] = { @@ -1261,7 +1269,7 @@ uint16 to_uni_hebrew_general_ci[] = { 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, -0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 +0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000 }; #endif @@ -5100,7 +5108,7 @@ uchar ctype_hebrew_bin[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, -0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00 +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00 }; uchar to_lower_hebrew_bin[] = { @@ -5173,7 +5181,7 @@ uint16 to_uni_hebrew_bin[] = { 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, -0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 +0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000 }; #endif From 70b2f28f555de600931483e885398631043367fe Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 13:34:23 +0100 Subject: [PATCH 095/160] Wait for mysqld connected to NDB to come out of read only mode --- mysql-test/include/have_multi_ndb.inc | 4 ++++ mysql-test/include/have_ndb.inc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mysql-test/include/have_multi_ndb.inc b/mysql-test/include/have_multi_ndb.inc index 218a6852c41..819518b2674 100644 --- a/mysql-test/include/have_multi_ndb.inc +++ b/mysql-test/include/have_multi_ndb.inc @@ -24,5 +24,9 @@ flush tables; select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; +# Check should be here as well... +# # Check that second master mysqld has come out of redonly mode +# --source include/ndb_not_readonly.inc + # Set the default connection to 'server1' connection server1; diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index 8cbeab07a4f..77857106488 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -4,4 +4,8 @@ disable_query_log; select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; +# Check that master mysqld has come out of redonly mode +--source include/ndb_not_readonly.inc + + From 4563cb45f26de5856b1e0dd38cc1a09a83ae076e Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 22 Dec 2006 13:57:33 +0100 Subject: [PATCH 096/160] Add the missing file --- mysql-test/include/ndb_not_readonly.inc | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 mysql-test/include/ndb_not_readonly.inc diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc new file mode 100644 index 00000000000..df67dced8ab --- /dev/null +++ b/mysql-test/include/ndb_not_readonly.inc @@ -0,0 +1,31 @@ +# Check that server has come out ot readonly mode +--disable_query_log +let $counter= 100; +let $mysql_errno= 1; +while ($mysql_errno) +{ + --error 0, 1005 + create table check_read_only(a int) engine=NDB; + sleep 0.1; + if (!$counter) + { + die("Failed while waiting for mysqld to come out of readonly mode"); + } + dec $counter; +} + +let $counter= 100; +let $mysql_errno= 1; +while ($mysql_errno) +{ + --error 0, 1036 + insert into check_read_only values(1); + sleep 0.1; + if (!$counter) + { + die("Failed while waiting for mysqld to come out of readonly mode"); + } + dec $counter; +} +drop table check_read_only; +--enable_query_log From 50726b2322edac8e93489fcb5ef75a5634222d44 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 22 Dec 2006 15:37:37 -0500 Subject: [PATCH 097/160] Bug#22555: STDDEV yields positive result for groups with only one row When only one row was present, the subtraction of nearly the same number resulted in catastropic cancellation, introducing an error in the VARIANCE calculation near 1e-15. That was sqrt()ed to get STDDEV, the error was escallated to near 1e-8. The simple fix of testing for a row count of 1 and forcing that to yield 0.0 is insufficient, as two rows of the same value should also have a variance of 0.0, yet the error would be about the same. So, this patch changes the formula that computes the VARIANCE to be one that is not subject to catastrophic cancellation. In addition, it now uses only (faster-than-decimal) floating point numbers to calculate, and renders that to other types on demand. --- BitKeeper/etc/collapsed | 1 + mysql-test/r/func_group.result | 268 ++++++++++++++++++++++++ mysql-test/t/func_group.test | 92 +++++++++ sql/item_sum.cc | 360 +++++++++++---------------------- sql/item_sum.h | 20 +- 5 files changed, 496 insertions(+), 245 deletions(-) diff --git a/BitKeeper/etc/collapsed b/BitKeeper/etc/collapsed index ddaafba882c..837a8997495 100644 --- a/BitKeeper/etc/collapsed +++ b/BitKeeper/etc/collapsed @@ -19,3 +19,4 @@ 454f8960jsVT_kMKJtZ9OCgXoba0xQ 4554a95d7txO1DuO9G3nAizI3SkFAA 4554b3722d71SbPiI2Gx-RhbZjmuIQ +45771031yRCoM_ZfONdYchPvVEgLRg diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index c6117053a60..53ca15200da 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1029,3 +1029,271 @@ t1 CREATE TABLE `t1` ( `stddev(0)` double(8,4) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +create table bug22555 (i smallint primary key auto_increment, s1 smallint, s2 smallint, e decimal(30,10), o double); +insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571); +select std(s1/s2) from bug22555 group by i; +std(s1/s2) +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +0.00000000 +select std(e) from bug22555 group by i; +std(e) +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +0.00000000000000 +select std(o) from bug22555 group by i; +std(o) +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +drop table bug22555; +create table bug22555 (i smallint, s1 smallint, s2 smallint, o1 double, o2 double, e1 decimal, e2 decimal); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +select i, count(*) from bug22555 group by i; +i count(*) +1 1 +2 1 +3 1 +select std(s1/s2) from bug22555 where i=1; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 where i=2; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 where i=3; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 where i=1 group by i; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 where i=2 group by i; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 where i=3 group by i; +std(s1/s2) +0.00000000 +select std(s1/s2) from bug22555 group by i order by i; +std(s1/s2) +0.00000000 +0.00000000 +0.00000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 1 0 +2 1 0 +3 1 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 1 0.00000000 +2 1 0.00000000 +3 1 0.00000000 +set @saved_div_precision_increment=@@div_precision_increment; +set div_precision_increment=19; +select i, count(*), variance(s1/s2) from bug22555 group by i order by i; +i count(*) variance(s1/s2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), variance(o1/o2) from bug22555 group by i order by i; +i count(*) variance(o1/o2) +1 1 0 +2 1 0 +3 1 0 +select i, count(*), variance(e1/e2) from bug22555 group by i order by i; +i count(*) variance(e1/e2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +i count(*) std(s1/s2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 1 0 +2 1 0 +3 1 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +set div_precision_increment=20; +select i, count(*), variance(s1/s2) from bug22555 group by i order by i; +i count(*) variance(s1/s2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), variance(o1/o2) from bug22555 group by i order by i; +i count(*) variance(o1/o2) +1 1 0 +2 1 0 +3 1 0 +select i, count(*), variance(e1/e2) from bug22555 group by i order by i; +i count(*) variance(e1/e2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +i count(*) std(s1/s2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 1 0 +2 1 0 +3 1 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 1 0.000000000000000000000000000000 +2 1 0.000000000000000000000000000000 +3 1 0.000000000000000000000000000000 +set @@div_precision_increment=@saved_div_precision_increment; +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +i count(*) std(s1/s2) +1 4 0.00000000 +2 4 0.00000000 +3 4 0.00000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 4 0 +2 4 0 +3 4 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 4 0.00000000 +2 4 0.00000000 +3 4 0.00000000 +select std(s1/s2) from bug22555; +std(s1/s2) +0.21325764 +select std(o1/o2) from bug22555; +std(o1/o2) +0.21325763586649 +select std(e1/e2) from bug22555; +std(e1/e2) +0.21325764 +set @saved_div_precision_increment=@@div_precision_increment; +set div_precision_increment=19; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +i count(*) std(s1/s2) +1 4 0.000000000000000000000000000000 +2 4 0.000000000000000000000000000000 +3 4 0.000000000000000000000000000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 4 0 +2 4 0 +3 4 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 4 0.000000000000000000000000000000 +2 4 0.000000000000000000000000000000 +3 4 0.000000000000000000000000000000 +select std(s1/s2) from bug22555; +std(s1/s2) +0.213257635866493405751853629226 +select std(o1/o2) from bug22555; +std(o1/o2) +0.21325763586649 +select std(e1/e2) from bug22555; +std(e1/e2) +0.213257635866493405751853629226 +set div_precision_increment=20; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +i count(*) std(s1/s2) +1 4 0.000000000000000000000000000000 +2 4 0.000000000000000000000000000000 +3 4 0.000000000000000000000000000000 +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +i count(*) std(o1/o2) +1 4 0 +2 4 0 +3 4 0 +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +i count(*) std(e1/e2) +1 4 0.000000000000000000000000000000 +2 4 0.000000000000000000000000000000 +3 4 0.000000000000000000000000000000 +select std(s1/s2) from bug22555; +std(s1/s2) +0.213257635866493405751853629226 +select std(o1/o2) from bug22555; +std(o1/o2) +0.21325763586649 +select std(e1/e2) from bug22555; +std(e1/e2) +0.213257635866493405751853629226 +set @@div_precision_increment=@saved_div_precision_increment; +drop table bug22555; +create table bug22555 (s smallint, o double, e decimal); +insert into bug22555 values (1,1,1),(2,2,2),(3,3,3),(6,6,6),(7,7,7); +select var_samp(s), var_pop(s) from bug22555; +var_samp(s) var_pop(s) +6.7000 5.3600 +select var_samp(o), var_pop(o) from bug22555; +var_samp(o) var_pop(o) +6.7 5.36 +select var_samp(e), var_pop(e) from bug22555; +var_samp(e) var_pop(e) +6.7000 5.3600 +drop table bug22555; +create table bug22555 (s smallint, o double, e decimal); +insert into bug22555 values (null,null,null),(null,null,null); +select var_samp(s) as 'null', var_pop(s) as 'null' from bug22555; +null null +NULL NULL +select var_samp(o) as 'null', var_pop(o) as 'null' from bug22555; +null null +NULL NULL +select var_samp(e) as 'null', var_pop(e) as 'null' from bug22555; +null null +NULL NULL +insert into bug22555 values (1,1,1); +select var_samp(s) as 'null', var_pop(s) as '0' from bug22555; +null 0 +NULL 0.0000 +select var_samp(o) as 'null', var_pop(o) as '0' from bug22555; +null 0 +NULL 0 +select var_samp(e) as 'null', var_pop(e) as '0' from bug22555; +null 0 +NULL 0.0000 +insert into bug22555 values (2,2,2); +select var_samp(s) as '0.5', var_pop(s) as '0.25' from bug22555; +0.5 0.25 +0.5000 0.2500 +select var_samp(o) as '0.5', var_pop(o) as '0.25' from bug22555; +0.5 0.25 +0.5 0.25 +select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555; +0.5 0.25 +0.5000 0.2500 +drop table bug22555; +End 5.0 tests. diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 079d107fad8..e54da7341a3 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -700,3 +700,95 @@ create table t1 select stddev(0); show create table t1; drop table t1; + +# +# Bug#22555: STDDEV yields positive result for groups with only one row +# + +create table bug22555 (i smallint primary key auto_increment, s1 smallint, s2 smallint, e decimal(30,10), o double); +insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571); +select std(s1/s2) from bug22555 group by i; +select std(e) from bug22555 group by i; +select std(o) from bug22555 group by i; +drop table bug22555; + +create table bug22555 (i smallint, s1 smallint, s2 smallint, o1 double, o2 double, e1 decimal, e2 decimal); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +select i, count(*) from bug22555 group by i; +select std(s1/s2) from bug22555 where i=1; +select std(s1/s2) from bug22555 where i=2; +select std(s1/s2) from bug22555 where i=3; +select std(s1/s2) from bug22555 where i=1 group by i; +select std(s1/s2) from bug22555 where i=2 group by i; +select std(s1/s2) from bug22555 where i=3 group by i; +select std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +set @saved_div_precision_increment=@@div_precision_increment; +set div_precision_increment=19; +select i, count(*), variance(s1/s2) from bug22555 group by i order by i; +select i, count(*), variance(o1/o2) from bug22555 group by i order by i; +select i, count(*), variance(e1/e2) from bug22555 group by i order by i; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +set div_precision_increment=20; +select i, count(*), variance(s1/s2) from bug22555 group by i order by i; +select i, count(*), variance(o1/o2) from bug22555 group by i order by i; +select i, count(*), variance(e1/e2) from bug22555 group by i order by i; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +set @@div_precision_increment=@saved_div_precision_increment; +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); +insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76); + +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +select std(s1/s2) from bug22555; +select std(o1/o2) from bug22555; +select std(e1/e2) from bug22555; +set @saved_div_precision_increment=@@div_precision_increment; +set div_precision_increment=19; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +select std(s1/s2) from bug22555; +select std(o1/o2) from bug22555; +select std(e1/e2) from bug22555; +set div_precision_increment=20; +select i, count(*), std(s1/s2) from bug22555 group by i order by i; +select i, count(*), std(o1/o2) from bug22555 group by i order by i; +select i, count(*), std(e1/e2) from bug22555 group by i order by i; +select std(s1/s2) from bug22555; +select std(o1/o2) from bug22555; +select std(e1/e2) from bug22555; +set @@div_precision_increment=@saved_div_precision_increment; +drop table bug22555; + +create table bug22555 (s smallint, o double, e decimal); +insert into bug22555 values (1,1,1),(2,2,2),(3,3,3),(6,6,6),(7,7,7); +select var_samp(s), var_pop(s) from bug22555; +select var_samp(o), var_pop(o) from bug22555; +select var_samp(e), var_pop(e) from bug22555; +drop table bug22555; + +create table bug22555 (s smallint, o double, e decimal); +insert into bug22555 values (null,null,null),(null,null,null); +select var_samp(s) as 'null', var_pop(s) as 'null' from bug22555; +select var_samp(o) as 'null', var_pop(o) as 'null' from bug22555; +select var_samp(e) as 'null', var_pop(e) as 'null' from bug22555; +insert into bug22555 values (1,1,1); +select var_samp(s) as 'null', var_pop(s) as '0' from bug22555; +select var_samp(o) as 'null', var_pop(o) as '0' from bug22555; +select var_samp(e) as 'null', var_pop(e) as '0' from bug22555; +insert into bug22555 values (2,2,2); +select var_samp(s) as '0.5', var_pop(s) as '0.25' from bug22555; +select var_samp(o) as '0.5', var_pop(o) as '0.25' from bug22555; +select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555; +drop table bug22555; + +### +--echo End 5.0 tests. diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 77c6e17607f..3b2a10ad666 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1098,7 +1098,7 @@ Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table, { /* We must store both value and counter in the temporary table in one field. - The easyest way is to do this is to store both value in a string + The easiest way is to do this is to store both value in a string and unpack on access. */ return new Field_string(((hybrid_type == DECIMAL_RESULT) ? @@ -1172,8 +1172,9 @@ String *Item_sum_avg::val_str(String *str) double Item_sum_std::val_real() { DBUG_ASSERT(fixed == 1); - double tmp= Item_sum_variance::val_real(); - return tmp <= 0.0 ? 0.0 : sqrt(tmp); + double nr= Item_sum_variance::val_real(); + DBUG_ASSERT(nr >= 0.0); + return sqrt(nr); } Item *Item_sum_std::copy_or_same(THD* thd) @@ -1187,40 +1188,77 @@ Item *Item_sum_std::copy_or_same(THD* thd) */ -Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item): - Item_sum_num(thd, item), hybrid_type(item->hybrid_type), - cur_dec(item->cur_dec), count(item->count), sample(item->sample), - prec_increment(item->prec_increment) +/** + Variance implementation for floating-point implementations, without + catastrophic cancellation, from Knuth's _TAoCP_, 3rd ed, volume 2, pg232. + This alters the value at m, s, and increments count. +*/ + +/* + These two functions are used by the Item_sum_variance and the + Item_variance_field classes, which are unrelated, and each need to calculate + variance. The difference between the two classes is that the first is used + for a mundane SELECT, while the latter is used in a GROUPing SELECT. +*/ +static void variance_fp_recurrence_next(double *m, double *s, ulonglong *count, double nr) { - if (hybrid_type == DECIMAL_RESULT) + *count += 1; + + if (*count == 1) { - memcpy(dec_sum, item->dec_sum, sizeof(item->dec_sum)); - memcpy(dec_sqr, item->dec_sqr, sizeof(item->dec_sqr)); - for (int i=0; i<2; i++) - { - dec_sum[i].fix_buffer_pointer(); - dec_sqr[i].fix_buffer_pointer(); - } + *m= nr; + *s= 0; } else { - sum= item->sum; - sum_sqr= item->sum_sqr; + double m_kminusone= *m; + *m= m_kminusone + (nr - m_kminusone) / (double) *count; + *s= *s + (nr - m_kminusone) * (nr - *m); } } +static double variance_fp_recurrence_result(double s, ulonglong count, bool is_sample_variance) +{ + if (count == 1) + return 0.0; + + if (is_sample_variance) + return s / (count - 1); + + /* else, is a population variance */ + return s / count; +} + + +Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item): + Item_sum_num(thd, item), hybrid_type(item->hybrid_type), + count(item->count), sample(item->sample), + prec_increment(item->prec_increment) +{ + recurrence_m= item->recurrence_m; + recurrence_s= item->recurrence_s; +} + + void Item_sum_variance::fix_length_and_dec() { DBUG_ENTER("Item_sum_variance::fix_length_and_dec"); maybe_null= null_value= 1; prec_increment= current_thd->variables.div_precincrement; + + /* + According to the SQL2003 standard (Part 2, Foundations; sec 10.9, + aggregate function; paragraph 7h of Syntax Rules), "the declared + type of the result is an implementation-defined aproximate numeric + type. + */ + hybrid_type= REAL_RESULT; + switch (args[0]->result_type()) { case REAL_RESULT: case STRING_RESULT: decimals= min(args[0]->decimals + 4, NOT_FIXED_DEC); - hybrid_type= REAL_RESULT; - sum= 0.0; break; case INT_RESULT: case DECIMAL_RESULT: @@ -1229,37 +1267,14 @@ void Item_sum_variance::fix_length_and_dec() decimals= min(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE); max_length= my_decimal_precision_to_length(precision, decimals, unsigned_flag); - cur_dec= 0; - hybrid_type= DECIMAL_RESULT; - my_decimal_set_zero(dec_sum); - my_decimal_set_zero(dec_sqr); - /* - The maxium value to usable for variance is DECIMAL_MAX_LENGTH/2 - becasue we need to be able to calculate in dec_bin_size1 - column_value * column_value - */ - f_scale0= args[0]->decimals; - f_precision0= min(args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS, - DECIMAL_MAX_PRECISION); - f_scale1= min(args[0]->decimals * 2, DECIMAL_MAX_SCALE); - f_precision1= min(args[0]->decimal_precision()*2 + DECIMAL_LONGLONG_DIGITS, - DECIMAL_MAX_PRECISION); - dec_bin_size0= my_decimal_get_binary_size(f_precision0, f_scale0); - dec_bin_size1= my_decimal_get_binary_size(f_precision1, f_scale1); break; } case ROW_RESULT: default: DBUG_ASSERT(0); } - DBUG_PRINT("info", ("Type: %s (%d, %d)", - (hybrid_type == REAL_RESULT ? "REAL_RESULT" : - hybrid_type == DECIMAL_RESULT ? "DECIMAL_RESULT" : - hybrid_type == INT_RESULT ? "INT_RESULT" : - "--ILLEGAL!!!--"), - max_length, - (int)decimals)); + DBUG_PRINT("info", ("Type: REAL_RESULT (%d, %d)", max_length, (int)decimals)); DBUG_VOID_RETURN; } @@ -1270,6 +1285,11 @@ Item *Item_sum_variance::copy_or_same(THD* thd) } +/** + Create a new field to match the type of value we're expected to yield. + If we're grouping, then we need some space to serialize variables into, to + pass around. +*/ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, uint convert_blob_len) { @@ -1277,13 +1297,10 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, { /* We must store both value and counter in the temporary table in one field. - The easyest way is to do this is to store both value in a string + The easiest way is to do this is to store both value in a string and unpack on access. */ - return new Field_string(((hybrid_type == DECIMAL_RESULT) ? - dec_bin_size0 + dec_bin_size1 : - sizeof(double)*2) + sizeof(longlong), - 0, name, table, &my_charset_bin); + return new Field_string(sizeof(double)*2 + sizeof(longlong), 0, name, table, &my_charset_bin); } return new Field_double(max_length, maybe_null,name,table,decimals); } @@ -1291,90 +1308,51 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, void Item_sum_variance::clear() { - if (hybrid_type == DECIMAL_RESULT) - { - my_decimal_set_zero(dec_sum); - my_decimal_set_zero(dec_sqr); - cur_dec= 0; - } - else - sum=sum_sqr=0.0; - count=0; + count= 0; } bool Item_sum_variance::add() { - if (hybrid_type == DECIMAL_RESULT) - { - my_decimal dec_buf, *dec= args[0]->val_decimal(&dec_buf); - my_decimal sqr_buf; - if (!args[0]->null_value) - { - count++; - int next_dec= cur_dec ^ 1; - my_decimal_mul(E_DEC_FATAL_ERROR, &sqr_buf, dec, dec); - my_decimal_add(E_DEC_FATAL_ERROR, dec_sqr+next_dec, - dec_sqr+cur_dec, &sqr_buf); - my_decimal_add(E_DEC_FATAL_ERROR, dec_sum+next_dec, - dec_sum+cur_dec, dec); - cur_dec= next_dec; - } - } - else - { - double nr= args[0]->val_real(); - if (!args[0]->null_value) - { - sum+=nr; - sum_sqr+=nr*nr; - count++; - } - } + /* + Why use a temporary variable? We don't know if it is null until we + evaluate it, which has the side-effect of setting null_value . + */ + double nr= args[0]->val_real(); + + if (!args[0]->null_value) + variance_fp_recurrence_next(&recurrence_m, &recurrence_s, &count, nr); return 0; } double Item_sum_variance::val_real() { DBUG_ASSERT(fixed == 1); - if (hybrid_type == DECIMAL_RESULT) - return val_real_from_decimal(); + /* + 'sample' is a 1/0 boolean value. If it is 1/true, id est this is a sample + variance call, then we should set nullness when the count of the items + is one or zero. If it's zero, i.e. a population variance, then we only + set nullness when the count is zero. + + Another way to read it is that 'sample' is the numerical threshhold, at and + below which a 'count' number of items is called NULL. + */ + DBUG_ASSERT((sample == 0) || (sample == 1)); if (count <= sample) { null_value=1; return 0.0; } + null_value=0; - /* Avoid problems when the precision isn't good enough */ - double tmp=ulonglong2double(count); - double tmp2= (sum_sqr - sum*sum/tmp)/(tmp - (double)sample); - return tmp2 <= 0.0 ? 0.0 : tmp2; + return variance_fp_recurrence_result(recurrence_s, count, sample); } my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf) { - my_decimal count_buf, count1_buf, sum_sqr_buf; - DBUG_ASSERT(fixed ==1 ); - if (hybrid_type == REAL_RESULT) - return val_decimal_from_real(dec_buf); - - if (count <= sample) - { - null_value= 1; - return 0; - } - null_value= 0; - int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &count_buf); - int2my_decimal(E_DEC_FATAL_ERROR, count-sample, 0, &count1_buf); - my_decimal_mul(E_DEC_FATAL_ERROR, &sum_sqr_buf, - dec_sum+cur_dec, dec_sum+cur_dec); - my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, - &sum_sqr_buf, &count_buf, prec_increment); - my_decimal_sub(E_DEC_FATAL_ERROR, &sum_sqr_buf, dec_sqr+cur_dec, dec_buf); - my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, - &sum_sqr_buf, &count1_buf, prec_increment); - return dec_buf; + DBUG_ASSERT(fixed == 1); + return val_decimal_from_real(dec_buf); } @@ -1383,89 +1361,44 @@ void Item_sum_variance::reset_field() double nr; char *res= result_field->ptr; - if (hybrid_type == DECIMAL_RESULT) - { - my_decimal value, *arg_dec, *arg2_dec; - longlong tmp; - - arg_dec= args[0]->val_decimal(&value); - if (args[0]->null_value) - { - arg_dec= arg2_dec= &decimal_zero; - tmp= 0; - } - else - { - my_decimal_mul(E_DEC_FATAL_ERROR, dec_sum, arg_dec, arg_dec); - arg2_dec= dec_sum; - tmp= 1; - } - my_decimal2binary(E_DEC_FATAL_ERROR, arg_dec, - res, f_precision0, f_scale0); - my_decimal2binary(E_DEC_FATAL_ERROR, arg2_dec, - res+dec_bin_size0, f_precision1, f_scale1); - res+= dec_bin_size0 + dec_bin_size1; - int8store(res,tmp); - return; - } - nr= args[0]->val_real(); + nr= args[0]->val_real(); /* sets null_value as side-effect */ if (args[0]->null_value) bzero(res,sizeof(double)*2+sizeof(longlong)); else { - longlong tmp; - float8store(res,nr); - nr*=nr; - float8store(res+sizeof(double),nr); - tmp= 1; - int8store(res+sizeof(double)*2,tmp); + /* Serialize format is (double)m, (double)s, (longlong)count */ + ulonglong tmp_count; + double tmp_s; + float8store(res, nr); /* recurrence variable m */ + tmp_s= 0.0; + float8store(res + sizeof(double), tmp_s); + tmp_count= 1; + int8store(res + sizeof(double)*2, tmp_count); } } void Item_sum_variance::update_field() { - longlong field_count; + ulonglong field_count; char *res=result_field->ptr; - if (hybrid_type == DECIMAL_RESULT) - { - my_decimal value, *arg_val= args[0]->val_decimal(&value); - if (!args[0]->null_value) - { - binary2my_decimal(E_DEC_FATAL_ERROR, res, - dec_sum+1, f_precision0, f_scale0); - binary2my_decimal(E_DEC_FATAL_ERROR, res+dec_bin_size0, - dec_sqr+1, f_precision1, f_scale1); - field_count= sint8korr(res + (dec_bin_size0 + dec_bin_size1)); - my_decimal_add(E_DEC_FATAL_ERROR, dec_sum, arg_val, dec_sum+1); - my_decimal_mul(E_DEC_FATAL_ERROR, dec_sum+1, arg_val, arg_val); - my_decimal_add(E_DEC_FATAL_ERROR, dec_sqr, dec_sqr+1, dec_sum+1); - field_count++; - my_decimal2binary(E_DEC_FATAL_ERROR, dec_sum, - res, f_precision0, f_scale0); - my_decimal2binary(E_DEC_FATAL_ERROR, dec_sqr, - res+dec_bin_size0, f_precision1, f_scale1); - res+= dec_bin_size0 + dec_bin_size1; - int8store(res, field_count); - } - return; - } - double nr,old_nr,old_sqr; - float8get(old_nr, res); - float8get(old_sqr, res+sizeof(double)); + double nr= args[0]->val_real(); /* sets null_value as side-effect */ + + if (args[0]->null_value) + return; + + /* Serialize format is (double)m, (double)s, (longlong)count */ + double field_recurrence_m, field_recurrence_s; + float8get(field_recurrence_m, res); + float8get(field_recurrence_s, res + sizeof(double)); field_count=sint8korr(res+sizeof(double)*2); - nr= args[0]->val_real(); - if (!args[0]->null_value) - { - old_nr+=nr; - old_sqr+=nr*nr; - field_count++; - } - float8store(res,old_nr); - float8store(res+sizeof(double),old_sqr); + variance_fp_recurrence_next(&field_recurrence_m, &field_recurrence_s, &field_count, nr); + + float8store(res, field_recurrence_m); + float8store(res + sizeof(double), field_recurrence_s); res+= sizeof(double)*2; int8store(res,field_count); } @@ -2295,25 +2228,9 @@ double Item_std_field::val_real() { double nr; // fix_fields() never calls for this Item - if (hybrid_type == REAL_RESULT) - { - /* - We can't call Item_variance_field::val_real() on a DECIMAL_RESULT - as this would call Item_std_field::val_decimal() and we would - calculate sqrt() twice - */ - nr= Item_variance_field::val_real(); - } - else - { - my_decimal dec_buf,*dec; - dec= Item_variance_field::val_decimal(&dec_buf); - if (!dec) - nr= 0.0; // NULL; Return 0.0 - else - my_decimal2double(E_DEC_FATAL_ERROR, dec, &nr); - } - return nr <= 0.0 ? 0.0 : sqrt(nr); + nr= Item_variance_field::val_real(); + DBUG_ASSERT(nr >= 0.0); + return sqrt(nr); } @@ -2327,11 +2244,13 @@ my_decimal *Item_std_field::val_decimal(my_decimal *dec_buf) double nr; if (hybrid_type == REAL_RESULT) return val_decimal_from_real(dec_buf); + dec= Item_variance_field::val_decimal(dec_buf); if (!dec) return 0; my_decimal2double(E_DEC_FATAL_ERROR, dec, &nr); - nr= nr <= 0.0 ? 0.0 : sqrt(nr); + DBUG_ASSERT(nr >= 0.0); + nr= sqrt(nr); double2my_decimal(E_DEC_FATAL_ERROR, nr, &tmp_dec); my_decimal_round(E_DEC_FATAL_ERROR, &tmp_dec, decimals, FALSE, dec_buf); return dec_buf; @@ -2366,52 +2285,15 @@ double Item_variance_field::val_real() if (hybrid_type == DECIMAL_RESULT) return val_real_from_decimal(); - double sum,sum_sqr; - longlong count; - float8get(sum,field->ptr); - float8get(sum_sqr,(field->ptr+sizeof(double))); + double recurrence_s; + ulonglong count; + float8get(recurrence_s, (field->ptr + sizeof(double))); count=sint8korr(field->ptr+sizeof(double)*2); if ((null_value= (count <= sample))) return 0.0; - double tmp= (double) count; - double tmp2= (sum_sqr - sum*sum/tmp)/(tmp - (double)sample); - return tmp2 <= 0.0 ? 0.0 : tmp2; -} - - -String *Item_variance_field::val_str(String *str) -{ - if (hybrid_type == DECIMAL_RESULT) - return val_string_from_decimal(str); - return val_string_from_real(str); -} - - -my_decimal *Item_variance_field::val_decimal(my_decimal *dec_buf) -{ - // fix_fields() never calls for this Item - if (hybrid_type == REAL_RESULT) - return val_decimal_from_real(dec_buf); - - longlong count= sint8korr(field->ptr+dec_bin_size0+dec_bin_size1); - if ((null_value= (count <= sample))) - return 0; - - my_decimal dec_count, dec1_count, dec_sum, dec_sqr, tmp; - int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &dec_count); - int2my_decimal(E_DEC_FATAL_ERROR, count-sample, 0, &dec1_count); - binary2my_decimal(E_DEC_FATAL_ERROR, field->ptr, - &dec_sum, f_precision0, f_scale0); - binary2my_decimal(E_DEC_FATAL_ERROR, field->ptr+dec_bin_size0, - &dec_sqr, f_precision1, f_scale1); - my_decimal_mul(E_DEC_FATAL_ERROR, &tmp, &dec_sum, &dec_sum); - my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, &tmp, &dec_count, prec_increment); - my_decimal_sub(E_DEC_FATAL_ERROR, &dec_sum, &dec_sqr, dec_buf); - my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, - &dec_sum, &dec1_count, prec_increment); - return dec_buf; + return variance_fp_recurrence_result(recurrence_s, count, sample); } diff --git a/sql/item_sum.h b/sql/item_sum.h index fe7edd76ecf..989e72654fe 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -665,8 +665,10 @@ public: double val_real(); longlong val_int() { /* can't be fix_fields()ed */ return (longlong) rint(val_real()); } - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); + String *val_str(String *str) + { return val_string_from_real(str); } + my_decimal *val_decimal(my_decimal *dec_buf) + { return val_decimal_from_real(dec_buf); } bool is_null() { (void) val_int(); return null_value; } enum_field_types field_type() const { @@ -688,6 +690,14 @@ public: = (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) = = (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) = = (sum(ai^2) - sum(a)^2/count(a))/count(a) + +But, this falls prey to catastrophic cancellation. Instead, use the recurrence formulas + + M_{1} = x_{1}, ~ M_{k} = M_{k-1} + (x_{k} - M_{k-1}) / k newline + S_{1} = 0, ~ S_{k} = S_{k-1} + (x_{k} - M_{k-1}) times (x_{k} - M_{k}) newline + for 2 <= k <= n newline + ital variance = S_{n} / (n-1) + */ class Item_sum_variance : public Item_sum_num @@ -696,9 +706,8 @@ class Item_sum_variance : public Item_sum_num public: Item_result hybrid_type; - double sum, sum_sqr; - my_decimal dec_sum[2], dec_sqr[2]; int cur_dec; + double recurrence_m, recurrence_s; /* Used in recurrence relation. */ ulonglong count; uint f_precision0, f_scale0; uint f_precision1, f_scale1; @@ -707,7 +716,7 @@ public: uint prec_increment; Item_sum_variance(Item *item_par, uint sample_arg) :Item_sum_num(item_par), - hybrid_type(REAL_RESULT), cur_dec(0), count(0), sample(sample_arg) + hybrid_type(REAL_RESULT), count(0), sample(sample_arg) {} Item_sum_variance(THD *thd, Item_sum_variance *item); enum Sumfunctype sum_func () const { return VARIANCE_FUNC; } @@ -727,7 +736,6 @@ public: enum Item_result result_type () const { return REAL_RESULT; } void cleanup() { - cur_dec= 0; count= 0; Item_sum_num::cleanup(); } From 1176caa58d2ee6bbbb6ebe6c0969317c5ae84055 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 22 Dec 2006 21:35:40 -0500 Subject: [PATCH 098/160] Fixed error in merge. --- sql/item_sum.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 714ccbf99f0..6c791cdd1f4 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1338,7 +1338,7 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, field= new Field_double(max_length, maybe_null, name, decimals); if (field != NULL) - field->init(table) + field->init(table); return field; } From 828121bd6d3e2fc3fbbde554fbf5182517698bb8 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Tue, 26 Dec 2006 12:42:54 -0700 Subject: [PATCH 099/160] In func_group.test, round the results of std() for some calls, because Windows' sqrt() function appears to return fewer "significant" digits than the Unix implementations. This is for bug #22555. --- mysql-test/r/func_group.result | 24 ++++++++++++------------ mysql-test/t/func_group.test | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 9ae031fe600..d18837aed41 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1216,15 +1216,15 @@ i count(*) std(e1/e2) 1 4 0.000000000000000000000000000000 2 4 0.000000000000000000000000000000 3 4 0.000000000000000000000000000000 -select std(s1/s2) from bug22555; -std(s1/s2) -0.213257635866493405751853629226 +select round(std(s1/s2), 17) from bug22555; +round(std(s1/s2), 17) +0.21325763586649341 select std(o1/o2) from bug22555; std(o1/o2) 0.21325763586649 -select std(e1/e2) from bug22555; -std(e1/e2) -0.213257635866493405751853629226 +select round(std(e1/e2), 17) from bug22555; +round(std(e1/e2), 17) +0.21325763586649341 set div_precision_increment=20; select i, count(*), std(s1/s2) from bug22555 group by i order by i; i count(*) std(s1/s2) @@ -1241,15 +1241,15 @@ i count(*) std(e1/e2) 1 4 0.000000000000000000000000000000 2 4 0.000000000000000000000000000000 3 4 0.000000000000000000000000000000 -select std(s1/s2) from bug22555; -std(s1/s2) -0.213257635866493405751853629226 +select round(std(s1/s2), 17) from bug22555; +round(std(s1/s2), 17) +0.21325763586649341 select std(o1/o2) from bug22555; std(o1/o2) 0.21325763586649 -select std(e1/e2) from bug22555; -std(e1/e2) -0.213257635866493405751853629226 +select round(std(e1/e2), 17) from bug22555; +round(std(e1/e2), 17) +0.21325763586649341 set @@div_precision_increment=@saved_div_precision_increment; drop table bug22555; create table bug22555 (s smallint, o double, e decimal); diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 49fab85d894..a3b3fceaec5 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -757,16 +757,16 @@ set div_precision_increment=19; select i, count(*), std(s1/s2) from bug22555 group by i order by i; select i, count(*), std(o1/o2) from bug22555 group by i order by i; select i, count(*), std(e1/e2) from bug22555 group by i order by i; -select std(s1/s2) from bug22555; +select round(std(s1/s2), 17) from bug22555; select std(o1/o2) from bug22555; -select std(e1/e2) from bug22555; +select round(std(e1/e2), 17) from bug22555; set div_precision_increment=20; select i, count(*), std(s1/s2) from bug22555 group by i order by i; select i, count(*), std(o1/o2) from bug22555 group by i order by i; select i, count(*), std(e1/e2) from bug22555 group by i order by i; -select std(s1/s2) from bug22555; +select round(std(s1/s2), 17) from bug22555; select std(o1/o2) from bug22555; -select std(e1/e2) from bug22555; +select round(std(e1/e2), 17) from bug22555; set @@div_precision_increment=@saved_div_precision_increment; drop table bug22555; From b918a98242b30a6d499d35b3443ac120c0697526 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 29 Dec 2006 16:00:51 +0400 Subject: [PATCH 100/160] After merge fix. Adding "flush logs" to fix test failure. --- mysql-test/extra/binlog_tests/ctype_ucs_binlog.test | 1 + mysql-test/r/binlog_row_ctype_ucs.result | 1 + mysql-test/r/binlog_stm_ctype_ucs.result | 1 + 3 files changed, 3 insertions(+) diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index afe594b8d36..fcf39e38163 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -14,6 +14,7 @@ show binlog events from 102; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be # escaped). +flush logs; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 drop table t2; diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result index 15af685559a..4eeff79e13a 100644 --- a/mysql-test/r/binlog_row_ctype_ucs.result +++ b/mysql-test/r/binlog_row_ctype_ucs.result @@ -7,6 +7,7 @@ show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 Table_map 1 141 table_id: # (test.t2) master-bin.000001 141 Write_rows 1 231 table_id: # flags: STMT_END_F +flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; diff --git a/mysql-test/r/binlog_stm_ctype_ucs.result b/mysql-test/r/binlog_stm_ctype_ucs.result index c9d33b4051e..76f3a3b06b9 100644 --- a/mysql-test/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/r/binlog_stm_ctype_ucs.result @@ -7,6 +7,7 @@ show binlog events from 102; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 102 User var 1 142 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci master-bin.000001 142 Query 1 231 use `test`; insert into t2 values (@v) +flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; From 2c039cccb60ec4e9758938b929550056fb77840b Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 29 Dec 2006 16:42:16 +0400 Subject: [PATCH 101/160] log_event.cc: After merge fix --- sql/log_event.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 2c6dfff3db3..1311f659af2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1642,7 +1642,8 @@ void Query_log_event::print_query_header(FILE* file, } if (lc_time_names_number != print_event_info->lc_time_names_number) { - fprintf(file, "SET @@session.lc_time_names=%d;\n", lc_time_names_number); + fprintf(file, "SET @@session.lc_time_names=%d%s\n", + lc_time_names_number, print_event_info->delimiter); print_event_info->lc_time_names_number= lc_time_names_number; } } From 3f20de5145cf65bba2eb47c4b0cace361b6e62b5 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 29 Dec 2006 17:12:59 +0400 Subject: [PATCH 102/160] After merge fix: Adding "flush log" before running mysqlbinlog. --- mysql-test/extra/rpl_tests/rpl_stm_charset.test | 1 + mysql-test/r/rpl_stm_charset.result | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test index 10b4310127f..5657b06e88f 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test @@ -156,6 +156,7 @@ select hex(c1), hex(c2) from t1; connection master; # Let's have a look at generated SETs. +flush logs; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 drop table t1; diff --git a/mysql-test/r/rpl_stm_charset.result b/mysql-test/r/rpl_stm_charset.result index 7f4a732eb53..f1691608bc7 100644 --- a/mysql-test/r/rpl_stm_charset.result +++ b/mysql-test/r/rpl_stm_charset.result @@ -174,6 +174,7 @@ CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 select hex(c1), hex(c2) from t1; hex(c1) hex(c2) CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 +flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; From ee120139ab34a8f4ed4105745afd1d4be0348aec Mon Sep 17 00:00:00 2001 From: "cmiller@calliope.local.cmiller/calliope.local" <> Date: Fri, 29 Dec 2006 16:07:33 -0500 Subject: [PATCH 103/160] Bug#23950: misplaced code in mysqld.cc, main() Moved MY_INIT() to top of main(), where it should be. --- sql/mysqld.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d6031504799..eb344f852e2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3476,6 +3476,9 @@ int win_main(int argc, char **argv) int main(int argc, char **argv) #endif { + MY_INIT(argv[0]); // init my_sys library & pthreads + /* nothing should come before this line ^^^ */ + rpl_filter= new Rpl_filter; binlog_filter= new Rpl_filter; if (!rpl_filter || !binlog_filter) @@ -3484,8 +3487,6 @@ int main(int argc, char **argv) exit(1); } - MY_INIT(argv[0]); // init my_sys library & pthreads - /* Perform basic logger initialization logger. Should be called after MY_INIT, as it initializes mutexes. Log tables are inited later. From 0c181b078684a44dd6d64fa4dcbe9aab1a0d8b78 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Tue, 2 Jan 2007 12:56:48 -0500 Subject: [PATCH 104/160] Bug#23950: misplaced code in mysqld.cc, main() We should initialize before anything else. --- sql/mysqld.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 95de1f91ecf..bcae6fd2ec8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3339,8 +3339,10 @@ int win_main(int argc, char **argv) int main(int argc, char **argv) #endif { - DEBUGGER_OFF; MY_INIT(argv[0]); // init my_sys library & pthreads + /* ^^^ Nothing should be before this line! */ + + DEBUGGER_OFF; #ifdef _CUSTOMSTARTUPCONFIG_ if (_cust_check_startup()) From ba77051e104a976d6f6c446c3645d63e1dbd77f9 Mon Sep 17 00:00:00 2001 From: "bteam/mysqldev@mysql.com/production.mysql.com" <> Date: Wed, 3 Jan 2007 12:08:59 +0100 Subject: [PATCH 105/160] Raise version number after cloning 4.0.28 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 0be3bcf0406..a5b1d4f7277 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.28) +AM_INIT_AUTOMAKE(mysql, 4.0.29) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From e2876ecce4dd6dee189aa5b71c8875979e56f6b2 Mon Sep 17 00:00:00 2001 From: "andrey@example.com" <> Date: Wed, 3 Jan 2007 14:09:31 +0100 Subject: [PATCH 106/160] fix for bug #18981 event_logs_tests failure On loaded boxes it is possible a INSERT with sleep of 1.5s to take more time. --- mysql-test/r/events_logs_tests.result | 11 +++++++---- mysql-test/t/events_logs_tests.test | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/events_logs_tests.result b/mysql-test/r/events_logs_tests.result index 335ca848387..1efd3fa602e 100644 --- a/mysql-test/r/events_logs_tests.result +++ b/mysql-test/r/events_logs_tests.result @@ -59,6 +59,7 @@ SELECT * FROM slow_event_test; slo_val val SET SESSION long_query_time=1; SET GLOBAL event_scheduler=on; +SET GLOBAL long_query_time=20; CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5); "Sleep some more time than the actual event run will take" SHOW VARIABLES LIKE 'event_scheduler'; @@ -67,20 +68,22 @@ event_scheduler ON "Check our table. Should see 1 row" SELECT * FROM slow_event_test; slo_val val -4 0 -"Check slow log. Should not see anything because 1.5 is under the threshold of 300 for GLOBAL, though over SESSION which is 2" +20 0 +"Check slow log. Should not see anything because 1.5 is under the threshold of 20 for GLOBAL, though over SESSION which is 1" +"This should show that the GLOBAL value is regarded and not the SESSION one of the current connection" SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; user_host query_time db sql_text +"Another test to show that GLOBAL is regarded and not SESSION." "This should go to the slow log" -DROP EVENT long_event; SET SESSION long_query_time=10; +DROP EVENT long_event; SET GLOBAL long_query_time=1; CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2); "Sleep some more time than the actual event run will take" "Check our table. Should see 2 rows" SELECT * FROM slow_event_test; slo_val val -4 0 +20 0 1 0 "Check slow log. Should see 1 row because 4 is over the threshold of 3 for GLOBAL, though under SESSION which is 10" SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test index aee16595ef9..e45fea1dfad 100644 --- a/mysql-test/t/events_logs_tests.test +++ b/mysql-test/t/events_logs_tests.test @@ -72,17 +72,20 @@ SET SESSION long_query_time=1; SELECT * FROM slow_event_test; SET SESSION long_query_time=1; SET GLOBAL event_scheduler=on; +SET GLOBAL long_query_time=20; CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5); --echo "Sleep some more time than the actual event run will take" --sleep 2 SHOW VARIABLES LIKE 'event_scheduler'; --echo "Check our table. Should see 1 row" SELECT * FROM slow_event_test; ---echo "Check slow log. Should not see anything because 1.5 is under the threshold of 300 for GLOBAL, though over SESSION which is 2" +--echo "Check slow log. Should not see anything because 1.5 is under the threshold of 20 for GLOBAL, though over SESSION which is 1" +--echo "This should show that the GLOBAL value is regarded and not the SESSION one of the current connection" SELECT user_host, query_time, db, sql_text FROM mysql.slow_log; +--echo "Another test to show that GLOBAL is regarded and not SESSION." --echo "This should go to the slow log" -DROP EVENT long_event; SET SESSION long_query_time=10; +DROP EVENT long_event; SET GLOBAL long_query_time=1; CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2); --echo "Sleep some more time than the actual event run will take" From 236000ae6689c345d71e837c2b1b95f91c656e5b Mon Sep 17 00:00:00 2001 From: "malff/marcsql@weblab.(none)" <> Date: Wed, 3 Jan 2007 11:47:01 -0700 Subject: [PATCH 107/160] Bug#6298 (LIMIT #, -1 no longer works to set start with no end limit) With MySQL 3.23 and 4.0, the syntax 'LIMIT N, -1' is accepted, and returns all the rows located after row N. This behavior, however, is not the intended result, and defeats the purpose of LIMIT, which is to constrain the size of a result set. With MySQL 4.1 and later, this construct is correctly detected as a syntax error. This fix does not change the production code, and only adds a new test case to improve test coverage in this area, to enforce in the test suite the intended behavior. --- mysql-test/r/select.result | 6 ++++++ mysql-test/t/select.test | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 44063c1e890..a7f6f638966 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -3611,3 +3611,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range si,ai si 5 NULL 2 Using where 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where DROP TABLE t1,t2,t3; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a int); +INSERT into t1 values (1), (2), (3); +SELECT * FROM t1 LIMIT 2, -1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 +DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 0c82cef867f..332389220f6 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3092,3 +3092,23 @@ SELECT t3.a FROM t1,t2,t3 t3.c IN ('bb','ee'); DROP TABLE t1,t2,t3; + +# +# Bug#6298: LIMIT #, -1 no longer works to set start with no end limit +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a int); +INSERT into t1 values (1), (2), (3); + +# LIMIT N, -1 was accepted by accident in 4.0, but was not intended. +# This test verifies that this illegal construct is now properly detected. + +--error ER_PARSE_ERROR +SELECT * FROM t1 LIMIT 2, -1; + +DROP TABLE t1; + From b54f20f865a1b396b778c99e2f05e359d00fe371 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Sat, 6 Jan 2007 12:34:16 -0500 Subject: [PATCH 108/160] A writability test in a prereq file polluted the binlog. Reset the info after using those files. --- mysql-test/t/ndb_binlog_ignore_db.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/ndb_binlog_ignore_db.test b/mysql-test/t/ndb_binlog_ignore_db.test index a4090bbb62b..a99dfd940ad 100644 --- a/mysql-test/t/ndb_binlog_ignore_db.test +++ b/mysql-test/t/ndb_binlog_ignore_db.test @@ -1,5 +1,6 @@ -- source include/have_ndb.inc -- source include/have_binlog_format_row.inc +reset master; --disable_warnings drop table if exists t1; From 95e73e66f099e403c5ab79ac285eea910c8f4ed7 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Sat, 6 Jan 2007 18:32:55 -0500 Subject: [PATCH 109/160] Use relative dates so that the tests don't fail when the year changes. --- mysql-test/r/view.result | 6 +++--- mysql-test/t/view.test | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 4bc122cc97b..794274e1927 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2675,9 +2675,9 @@ lName varchar(25) NOT NULL, DOB date NOT NULL, uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1(fName, lName, DOB) VALUES -('Hank', 'Hill', '1964-09-29'), -('Tom', 'Adams', '1908-02-14'), -('Homer', 'Simpson', '1968-03-05'); +('Alice', 'Hill', date_sub(curdate(), interval 15271 day)), +('Bob', 'Adams', date_sub(curdate(), interval 33600 day)), +('Carol', 'Simpson', date_sub(curdate(), interval 13700 day)); CREATE VIEW v1 AS SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 7175db1db4e..6e3c01b66b5 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2544,9 +2544,9 @@ CREATE TABLE t1( uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1(fName, lName, DOB) VALUES - ('Hank', 'Hill', '1964-09-29'), - ('Tom', 'Adams', '1908-02-14'), - ('Homer', 'Simpson', '1968-03-05'); + ('Alice', 'Hill', date_sub(curdate(), interval 15271 day)), + ('Bob', 'Adams', date_sub(curdate(), interval 33600 day)), + ('Carol', 'Simpson', date_sub(curdate(), interval 13700 day)); CREATE VIEW v1 AS SELECT (year(now())-year(DOB)) AS Age From 1942fd0a499736a9d56744a145bb246da5b955c3 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Sat, 6 Jan 2007 18:40:43 -0500 Subject: [PATCH 110/160] Forgot to add result file to changeset. :( --- mysql-test/r/ndb_binlog_ignore_db.result | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/r/ndb_binlog_ignore_db.result b/mysql-test/r/ndb_binlog_ignore_db.result index 8dc2c1ff1f8..952d048ad8d 100644 --- a/mysql-test/r/ndb_binlog_ignore_db.result +++ b/mysql-test/r/ndb_binlog_ignore_db.result @@ -1,3 +1,4 @@ +reset master; drop table if exists t1; drop database if exists mysqltest; create database mysqltest; From 993f325d378f96deb7aeae9279f8c01f60e59695 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Sun, 7 Jan 2007 12:21:42 -0500 Subject: [PATCH 111/160] Post-merge cleanup and fix minor BUILD/... "="-equality syntax error. --- BUILD/SETUP.sh | 2 +- mysql-test/r/view.result | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index dfbf1547517..1f62ffe7c26 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -183,7 +183,7 @@ fi # (http://samba.org/ccache) is installed, use it. # We use 'grep' and hope 'grep' will work as expected # (returns 0 if finds lines) -if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" == "1" +if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1" then echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 5773c51803d..794274e1927 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2686,12 +2686,12 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; Age -43 -39 +42 +38 SELECT * FROM v1; Age -43 -39 +42 +38 DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx'); From 3e760410a0d7b3db9ded319b86950663760705da Mon Sep 17 00:00:00 2001 From: "guilhem@gbichot3.local" <> Date: Mon, 8 Jan 2007 22:01:06 +0100 Subject: [PATCH 112/160] Fix for BUG#19725 "Calls to SF in other database are not replicated correctly in some cases". In short, calls to a stored function located in another database than the default database, may fail to replicate if the call was made by SET, SELECT, or DO. Longer: when a stored function is called from a statement which does not go to binlog ("SET @a=somedb.myfunc()", "SELECT somedb.myfunc()", "DO somedb.myfunc()"), this crafted statement is binlogged: "SELECT myfunc();" (accompanied with a mention of the default database if there is one). So, if "somedb" is not the default database, the slave would fail to find myfunc(). The fix is to specify the function's database name in the crafted binlogged statement, like this: "SELECT somedb.myfunc();". Test added in rpl_sp.test. --- mysql-test/r/rpl_sp.result | 269 +++++++++++++++++++++---------------- mysql-test/t/rpl_sp.test | 50 +++++-- sql/sp_head.cc | 2 + 3 files changed, 198 insertions(+), 123 deletions(-) diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index a0464e97e28..0fe1b4b908e 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -269,107 +269,6 @@ insert into t1 values (1); select * from t1; a 1 -show binlog events in 'master-bin.000001' from 98; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest1 -master-bin.000001 # Query 1 # create database mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() -begin -declare b int; -set b = 8; -insert into t1 values (b); -insert into t1 values (unix_timestamp()); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() -select * from mysqltest1.t1 -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3() -deterministic -insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4() -deterministic -begin -insert into t2 values(3); -insert into t1 values (5); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4() -deterministic -begin -insert into t2 values(20),(20); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int -deterministic -begin -insert into t1 values (x); -return x+2; -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() -returns int -no sql -begin -return unix_timestamp(); -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2() -returns int -no sql -begin -return unix_timestamp(); -end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3() -returns int -not deterministic -reads sql data -begin -return 0; -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int -begin -insert into t2 values(x),(x); -return 10; -end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) select * from t1; a 1 @@ -465,9 +364,6 @@ RETURN 0 DROP PROCEDURE p1; DROP FUNCTION f1; drop table t1; -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=0; -reset master; drop database if exists mysqltest; drop database if exists mysqltest2; create database mysqltest; @@ -476,16 +372,163 @@ use mysqltest2; create table t ( t integer ); create procedure mysqltest.test() begin end; insert into t values ( 1 ); -show binlog events in 'master-bin.000001' from 98; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 98 Query 1 199 drop database if exists mysqltest -master-bin.000001 199 Query 1 302 drop database if exists mysqltest2 -master-bin.000001 302 Query 1 395 create database mysqltest -master-bin.000001 395 Query 1 490 create database mysqltest2 -master-bin.000001 490 Query 1 587 use `mysqltest2`; create table t ( t integer ) -master-bin.000001 587 Query 1 726 use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end -master-bin.000001 726 Query 1 821 use `mysqltest2`; insert into t values ( 1 ) create procedure `\\`.test() begin end; ERROR 42000: Incorrect database name '\\' +create function f1 () returns int +begin +insert into t values (1); +return 0; +end| +use mysqltest; +set @a:= mysqltest2.f1(); +show binlog events in 'master-bin.000001' from 98; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # drop database if exists mysqltest1 +master-bin.000001 # Query 1 # create database mysqltest1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() +select * from mysqltest1.t1 +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql +master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) +master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3() +deterministic +insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4() +deterministic +begin +insert into t2 values(3); +insert into t1 values (5); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4() +deterministic +begin +insert into t2 values(20),(20); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) +returns int +deterministic +begin +insert into t1 values (x); +return x+2; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3() +returns int +not deterministic +reads sql data +begin +return 0; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) +returns int +begin +insert into t2 values(x),(x); +return 10; +end +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100) +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +not deterministic +reads sql data +select * from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # drop database mysqltest1 +master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function f1() returns int reads sql data +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end +master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1()) +master-bin.000001 # Query 1 # use `test`; drop view v1 +master-bin.000001 # Query 1 # use `test`; drop function f1 +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1 +master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10)) +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10)) +INSERT INTO t1 VALUES(arg) +master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test')) +master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0 +master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1 +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # drop database if exists mysqltest +master-bin.000001 # Query 1 # drop database if exists mysqltest2 +master-bin.000001 # Query 1 # create database mysqltest +master-bin.000001 # Query 1 # create database mysqltest2 +master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer ) +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end +master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 ) +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int +begin +insert into t values (1); +return 0; +end +master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`() +set global log_bin_trust_function_creators=0; +set global log_bin_trust_function_creators=0; drop database mysqltest; drop database mysqltest2; diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index 373b895a7c1..fc17c5615ef 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -338,12 +338,13 @@ delete from t1; drop trigger trg; insert into t1 values (1); select * from t1; ---replace_column 2 # 5 # -show binlog events in 'master-bin.000001' from 98; sync_slave_with_master; select * from t1; +# ********************** PART 4 : RELATED FIXED BUGS *************** + + # # Test for bug #13969 "Routines which are replicated from master can't be # executed on slave". @@ -520,15 +521,11 @@ connection master; drop table t1; sync_slave_with_master; -# Restore log_bin_trust_function_creators to original value -set global log_bin_trust_function_creators=0; -connection master; -set global log_bin_trust_function_creators=0; # # Bug22043: MySQL don't add "USE " before "DROP PROCEDURE IF EXISTS" # + connection master; -reset master; --disable_warnings drop database if exists mysqltest; drop database if exists mysqltest2; @@ -539,11 +536,44 @@ use mysqltest2; create table t ( t integer ); create procedure mysqltest.test() begin end; insert into t values ( 1 ); -show binlog events in 'master-bin.000001' from 98; --error ER_WRONG_DB_NAME create procedure `\\`.test() begin end; + +# +# BUG#19725: Calls to stored function in other database are not +# replicated correctly in some cases +# + +connection master; +delimiter |; +create function f1 () returns int +begin + insert into t values (1); + return 0; +end| +delimiter ;| +sync_slave_with_master; +# Let us test if we don't forget to binlog the function's database +connection master; +use mysqltest; +set @a:= mysqltest2.f1(); +sync_slave_with_master; +connection master; + + +# Final inspection which verifies how all statements of this test file +# were written to the binary log. +--replace_column 2 # 5 # +show binlog events in 'master-bin.000001' from 98; + + +# Restore log_bin_trust_function_creators to its original value. +# This is a cleanup for all parts above where we tested stored +# functions and triggers. +set global log_bin_trust_function_creators=0; +connection master; +set global log_bin_trust_function_creators=0; + # Clean up drop database mysqltest; drop database mysqltest2; - - diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 6cb6514a46f..962a56a6dcf 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1450,6 +1450,8 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, { binlog_buf.length(0); binlog_buf.append(STRING_WITH_LEN("SELECT ")); + append_identifier(thd, &binlog_buf, m_db.str, m_db.length); + binlog_buf.append('.'); append_identifier(thd, &binlog_buf, m_name.str, m_name.length); binlog_buf.append('('); for (arg_no= 0; arg_no < argcount; arg_no++) From 6712c0963dd2e7355908ad40c7e0328ac7987812 Mon Sep 17 00:00:00 2001 From: "guilhem@gbichot3.local" <> Date: Mon, 8 Jan 2007 23:52:21 +0100 Subject: [PATCH 113/160] Manual merge of the fix for BUG#19725 "Calls to SF in other database are not replicated correctly in some cases", from 5.0. In short, calls to a stored function located in another database than the default database, may fail to replicate if the call was made by SET, SELECT, or DO. sp_head.cc automerged, only the test and test's result had to be hand-merged. --- mysql-test/r/rpl_sp.result | 271 +++++++++++-------- mysql-test/r/rpl_switch_stm_row_mixed.result | 16 +- mysql-test/t/rpl_sp.test | 53 +++- 3 files changed, 207 insertions(+), 133 deletions(-) diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index fe54b1cbeb4..ee1517b290d 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -269,107 +269,6 @@ insert into t1 values (1); select * from t1; a 1 -show binlog events in 'master-bin.000001' from 102; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest1 -master-bin.000001 # Query 1 # create database mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() -begin -declare b int; -set b = 8; -insert into t1 values (b); -insert into t1 values (unix_timestamp()); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() -select * from mysqltest1.t1 -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3() -deterministic -insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4() -deterministic -begin -insert into t2 values(3); -insert into t1 values (5); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4() -deterministic -begin -insert into t2 values(20),(20); -end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int -deterministic -begin -insert into t1 values (x); -return x+2; -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() -returns int -no sql -begin -return unix_timestamp(); -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2() -returns int -no sql -begin -return unix_timestamp(); -end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3() -returns int -not deterministic -reads sql data -begin -return 0; -end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) -returns int -begin -insert into t2 values(x),(x); -return 10; -end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) select * from t1; a 1 @@ -465,10 +364,6 @@ RETURN 0 DROP PROCEDURE p1; DROP FUNCTION f1; drop table t1; -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=0; -End of 5.0 tests -reset master; drop database if exists mysqltest; drop database if exists mysqltest2; create database mysqltest; @@ -477,17 +372,165 @@ use mysqltest2; create table t ( t integer ); create procedure mysqltest.test() begin end; insert into t values ( 1 ); -show binlog events in 'master-bin.000001' from 102; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Query 1 203 drop database if exists mysqltest -master-bin.000001 203 Query 1 306 drop database if exists mysqltest2 -master-bin.000001 306 Query 1 399 create database mysqltest -master-bin.000001 399 Query 1 494 create database mysqltest2 -master-bin.000001 494 Query 1 591 use `mysqltest2`; create table t ( t integer ) -master-bin.000001 591 Query 1 730 use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end -master-bin.000001 730 Query 1 825 use `mysqltest2`; insert into t values ( 1 ) create procedure `\\`.test() begin end; ERROR 42000: Unknown database '\\' +create function f1 () returns int +begin +insert into t values (1); +return 0; +end| +use mysqltest; +set @a:= mysqltest2.f1(); +show binlog events in 'master-bin.000001' from 102; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # drop database if exists mysqltest1 +master-bin.000001 # Query 1 # create database mysqltest1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() +select * from mysqltest1.t1 +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql +master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 +master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) +master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo3() +deterministic +insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` procedure foo4() +deterministic +begin +insert into t2 values(3); +insert into t1 values (5); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4() +deterministic +begin +insert into t2 values(20),(20); +end +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) +returns int +deterministic +begin +insert into t1 values (x); +return x+2; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` function fn2() +returns int +no sql +begin +return unix_timestamp(); +end +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn3() +returns int +not deterministic +reads sql data +begin +return 0; +end +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 +master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn1(x int) +returns int +begin +insert into t2 values(x),(x); +return 10; +end +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100) +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg +master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +not deterministic +reads sql data +select * from t1 +master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query 1 # drop database mysqltest1 +master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function f1() returns int reads sql data +begin +declare var integer; +declare c cursor for select a from v1; +open c; +fetch c into var; +close c; +return var; +end +master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1()) +master-bin.000001 # Query 1 # use `test`; drop view v1 +master-bin.000001 # Query 1 # use `test`; drop function f1 +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1 +master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10)) +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1(arg VARCHAR(10)) +INSERT INTO t1 VALUES(arg) +master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test')) +master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE p1() SET @a = 1 +master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION f1() RETURNS INT RETURN 0 +master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1 +master-bin.000001 # Query 1 # use `test`; drop table t1 +master-bin.000001 # Query 1 # drop database if exists mysqltest +master-bin.000001 # Query 1 # drop database if exists mysqltest2 +master-bin.000001 # Query 1 # create database mysqltest +master-bin.000001 # Query 1 # create database mysqltest2 +master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer ) +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` procedure mysqltest.test() begin end +master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 ) +master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` function f1 () returns int +begin +insert into t values (1); +return 0; +end +master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`() +set global log_bin_trust_function_creators=0; +set global log_bin_trust_function_creators=0; drop database mysqltest; drop database mysqltest2; +End of 5.0 tests End of 5.1 tests diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index 047bfe53704..258adc83b04 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -559,7 +559,7 @@ begin insert into t2 select x; return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `foo6`(_latin1'foo6_1_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) @@ -620,7 +620,7 @@ master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f`(_latin1'try_45_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1 master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) @@ -660,9 +660,9 @@ set y = (select count(*) from t2); return y; end master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f1`(_latin1'try_53_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f2`(_latin1'try_54_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row begin @@ -869,7 +869,7 @@ begin insert into t2 select x; return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `foo6`(_latin1'foo6_1_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) @@ -930,7 +930,7 @@ master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f`(_latin1'try_45_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1 master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) @@ -970,9 +970,9 @@ set y = (select count(*) from t2); return y; end master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f1`(_latin1'try_53_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `f2`(_latin1'try_54_') +master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row begin diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index 3a93a6608cd..9a1960db647 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -343,13 +343,13 @@ delete from t1; drop trigger trg; insert into t1 values (1); select * from t1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events in 'master-bin.000001' from 102; sync_slave_with_master; select * from t1; +# ********************** PART 4 : RELATED FIXED BUGS *************** + + # # Test for bug #13969 "Routines which are replicated from master can't be # executed on slave". @@ -522,17 +522,11 @@ connection master; drop table t1; sync_slave_with_master; -# Restore log_bin_trust_function_creators to original value -set global log_bin_trust_function_creators=0; -connection master; -set global log_bin_trust_function_creators=0; ---echo End of 5.0 tests - # # Bug22043: MySQL don't add "USE " before "DROP PROCEDURE IF EXISTS" # + connection master; -reset master; --disable_warnings drop database if exists mysqltest; drop database if exists mysqltest2; @@ -543,12 +537,49 @@ use mysqltest2; create table t ( t integer ); create procedure mysqltest.test() begin end; insert into t values ( 1 ); -show binlog events in 'master-bin.000001' from 102; --error ER_BAD_DB_ERROR create procedure `\\`.test() begin end; + +# +# BUG#19725: Calls to stored function in other database are not +# replicated correctly in some cases +# + +connection master; +delimiter |; +create function f1 () returns int +begin + insert into t values (1); + return 0; +end| +delimiter ;| +sync_slave_with_master; +# Let us test if we don't forget to binlog the function's database +connection master; +use mysqltest; +set @a:= mysqltest2.f1(); +sync_slave_with_master; +connection master; + + +# Final inspection which verifies how all statements of this test file +# were written to the binary log. +--replace_column 2 # 5 # +--replace_regex /table_id: [0-9]+/table_id: #/ +show binlog events in 'master-bin.000001' from 102; + + +# Restore log_bin_trust_function_creators to its original value. +# This is a cleanup for all parts above where we tested stored +# functions and triggers. +set global log_bin_trust_function_creators=0; +connection master; +set global log_bin_trust_function_creators=0; + # Clean up drop database mysqltest; drop database mysqltest2; +--echo End of 5.0 tests --echo End of 5.1 tests From 34122240cf5fbf4ddc86ff02cf2b7584d0ec81fa Mon Sep 17 00:00:00 2001 From: "tnurnberg@mysql.com/sin.azundris.com" <> Date: Tue, 9 Jan 2007 20:23:12 +0100 Subject: [PATCH 114/160] Bug#24660: "enum" field type definition problem ENUMs weren't allowed to have character 0xff, a perfectly good character in many locales. This was circumvented by mapping 0xff in ENUMs to ',', thereby prevent actual commas from being used (because they too would get converted to 0xff on load). Now if 0xff makes an appearance, we find a character not used in the enum and use that as a separator. If no such character exists, we throw an error. Any solution would have broken some sort of existing behaviour. This solution should serve both fractions (those with 0xff and those with ',' in their enums), but WILL REQUIRE A DUMP/RESTORE CYCLE FROM THOSE WITH 0xff IN THEIR ENUMS. :-/ That is, mysqldump with their current server, and restore when upgrading to one with this patch. (port of the original 4.1 patch. incorporates some suggestions by kaamos.) --- mysql-test/r/type_enum.result | 26 +++++++++++++++ mysql-test/t/type_enum.test | 24 +++++++++++++- sql/table.cc | 11 ------- sql/unireg.cc | 61 +++++++++++++++++++++++------------ 4 files changed, 89 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index b7db1d95587..70ef98af420 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1754,3 +1754,29 @@ t1 CREATE TABLE `t1` ( `f2` enum('') DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +End of 4.1 tests +create table t1(russian enum('E','F','EF','FE') NOT NULL DEFAULT'E'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `russian` enum('E','F','EF','FE') NOT NULL DEFAULT 'E' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `denormal` enum('E','F','E,F','F,E') NOT NULL DEFAULT 'E' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1(russian_deviant enum('E','F','EF','F,E') NOT NULL DEFAULT'E'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `russian_deviant` enum('E','F','EF','F,E') NOT NULL DEFAULT 'E' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ',' +  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz')); +ERROR 42000: Field separator argument is not what is expected; check the manual +End of 5.1 tests diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 68f5664c36d..9be1b7fa10f 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -136,4 +136,26 @@ alter table t1 add f2 enum(0xFFFF); show create table t1; drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests + +# +# Bug#24660 "enum" field type definition problem +# +create table t1(russian enum('E','F','EF','FE') NOT NULL DEFAULT'E'); +show create table t1; +drop table t1; + +create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E'); +show create table t1; +drop table t1; + +create table t1(russian_deviant enum('E','F','EF','F,E') NOT NULL DEFAULT'E'); +show create table t1; +drop table t1; + +# ER_WRONG_FIELD_TERMINATORS +--error 1083 +create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ',' +  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz')); + +--echo End of 5.1 tests diff --git a/sql/table.cc b/sql/table.cc index e4e087b0e64..4896645c140 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -803,17 +803,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { char *val= (char*) interval->type_names[count]; interval->type_lengths[count]= strlen(val); - /* - Replace all ',' symbols with NAMES_SEP_CHAR. - See the comment in unireg.cc, pack_fields() function - for details. - */ - for (uint cnt= 0 ; cnt < interval->type_lengths[count] ; cnt++) - { - char c= val[cnt]; - if (c == ',') - val[cnt]= NAMES_SEP_CHAR; - } } interval->type_lengths[count]= 0; } diff --git a/sql/unireg.cc b/sql/unireg.cc index 2699cafa7b7..10741240940 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -788,29 +788,48 @@ static bool pack_fields(File file, List &create_fields, { if (field->interval_id > int_count) { - int_count=field->interval_id; - tmp.append(NAMES_SEP_CHAR); - for (const char **pos=field->interval->type_names ; *pos ; pos++) - { - char *val= (char*) *pos; - uint str_len= strlen(val); - /* - Note, hack: in old frm NAMES_SEP_CHAR is used to separate - names in the interval (ENUM/SET). To allow names to contain - NAMES_SEP_CHAR, we replace it with a comma before writing frm. - Backward conversion is done during frm file opening, - See table.cc, openfrm() function - */ - for (uint cnt= 0 ; cnt < str_len ; cnt++) + unsigned char sep= 0; + unsigned char occ[256]; + uint i; + unsigned char *val= NULL; + + bzero(occ, sizeof(occ)); + + for (i=0; (val= (unsigned char*) field->interval->type_names[i]); i++) + for (uint j = 0; j < field->interval->type_lengths[i]; j++) + occ[(unsigned int) (val[j])]= 1; + + if (!occ[(unsigned char)NAMES_SEP_CHAR]) + sep= (unsigned char) NAMES_SEP_CHAR; + else if (!occ[(unsigned int)',']) + sep= ','; + else + { + for (uint i=1; i<256; i++) { - char c= val[cnt]; - if (c == NAMES_SEP_CHAR) - val[cnt]= ','; + if(!occ[i]) + { + sep= i; + break; + } } - tmp.append(*pos); - tmp.append(NAMES_SEP_CHAR); - } - tmp.append('\0'); // End of intervall + + if(!sep) /* disaster, enum uses all characters, none left as separator */ + { + my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS), + MYF(0)); + DBUG_RETURN(1); + } + } + + int_count= field->interval_id; + tmp.append(sep); + for (const char **pos=field->interval->type_names ; *pos ; pos++) + { + tmp.append(*pos); + tmp.append(sep); + } + tmp.append('\0'); // End of intervall } } if (my_write(file,(byte*) tmp.ptr(),tmp.length(),MYF_RW)) From 20036a42b8c8724ae4635b36bc8fc87042e15b45 Mon Sep 17 00:00:00 2001 From: "cbell/Chuck@suse.vabb.com" <> Date: Wed, 10 Jan 2007 12:20:13 -0500 Subject: [PATCH 115/160] BUG#22645 - LC_TIME_NAMES: Statement not replicated This patch is an additional code change to the get_str_len_and_pointer method in log_events.cc. This change is necessary to correct a problem encountered on 64-bit SUSE where the auto_increment_* variables were being overwritten. The change corrects a cast mismatch which caused the problem. --- sql/log_event.cc | 65 +++++++++++++++++++++++++++--------------------- sql/log_event.h | 9 ++++++- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 80f79bc2698..0d517952fe8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1516,18 +1516,27 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, /* 2 utility functions for the next method */ -static void get_str_len_and_pointer(const char **dst, const char **src, uint *len) + +/* + Get the pointer for a string (src) that contains the length in + the first byte. Set the output string (dst) to the string value + and place the length of the string in the byte after the string. +*/ +static void get_str_len_and_pointer(const Log_event::Byte **src, + const char **dst, + uint *len) { if ((*len= **src)) - *dst= *src + 1; // Will be copied later - (*src)+= *len+1; + *dst= (char *)*src + 1; // Will be copied later + (*src)+= *len + 1; } - -static void copy_str_and_move(char **dst, const char **src, uint len) +static void copy_str_and_move(const char **src, + Log_event::Byte **dst, + uint len) { memcpy(*dst, *src, len); - *src= *dst; + *src= (const char *)*dst; (*dst)+= len; *(*dst)++= 0; } @@ -1550,8 +1559,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, ulong data_len; uint32 tmp; uint8 common_header_len, post_header_len; - char *start; - const char *end; + Log_event::Byte *start; + const Log_event::Byte *end; bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); @@ -1597,9 +1606,9 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, /* variable-part: the status vars; only in MySQL 5.0 */ - start= (char*) (buf+post_header_len); - end= (const char*) (start+status_vars_len); - for (const uchar* pos= (const uchar*) start; pos < (const uchar*) end;) + start= (Log_event::Byte*) (buf+post_header_len); + end= (const Log_event::Byte*) (start+status_vars_len); + for (const Log_event::Byte* pos= start; pos < end;) { switch (*pos++) { case Q_FLAGS2_CODE: @@ -1621,7 +1630,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, break; } case Q_CATALOG_NZ_CODE: - get_str_len_and_pointer(&catalog, (const char **)(&pos), &catalog_len); + get_str_len_and_pointer(&pos, &catalog, &catalog_len); break; case Q_AUTO_INCREMENT: auto_increment_increment= uint2korr(pos); @@ -1637,7 +1646,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, } case Q_TIME_ZONE_CODE: { - get_str_len_and_pointer(&time_zone_str, (const char **)(&pos), &time_zone_len); + get_str_len_and_pointer(&pos, &time_zone_str, &time_zone_len); break; } case Q_CATALOG_CODE: /* for 5.0.x where 0<=x<=3 masters */ @@ -1659,38 +1668,38 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, } #if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE) - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1 + - QUERY_CACHE_FLAGS_SIZE + - db_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1 + + QUERY_CACHE_FLAGS_SIZE + + db_len + 1, + MYF(MY_WME)))) #else - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1, + MYF(MY_WME)))) #endif DBUG_VOID_RETURN; if (catalog_len) // If catalog is given { if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3. - copy_str_and_move(&start, &catalog, catalog_len); + copy_str_and_move(&catalog, &start, catalog_len); else { memcpy(start, catalog, catalog_len+1); // copy end 0 - catalog= start; + catalog= (const char *)start; start+= catalog_len+1; } } if (time_zone_len) - copy_str_and_move(&start, &time_zone_str, time_zone_len); + copy_str_and_move(&time_zone_str, &start, time_zone_len); /* A 2nd variable part; this is common to all versions */ memcpy((char*) start, end, data_len); // Copy db and query start[data_len]= '\0'; // End query with \0 (For safetly) - db= start; - query= start + db_len + 1; + db= (char *)start; + query= (char *)(start + db_len + 1); q_len= data_len - db_len -1; DBUG_VOID_RETURN; } diff --git a/sql/log_event.h b/sql/log_event.h index 5a7959a01cc..a587b982aa7 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -587,6 +587,13 @@ typedef struct st_print_event_info class Log_event { public: + /* + The following type definition is to be used whenever data is placed + and manipulated in a common buffer. Use this typedef for buffers + that contain data containing binary and character data. + */ + typedef unsigned char Byte; + /* The offset in the log where this event originally appeared (it is preserved in relay logs, making SHOW SLAVE STATUS able to print @@ -768,7 +775,7 @@ public: class Query_log_event: public Log_event { protected: - char* data_buf; + Log_event::Byte* data_buf; public: const char* query; const char* catalog; From 183c67598010f177b7fcf6043dd28ff8d709fdf4 Mon Sep 17 00:00:00 2001 From: "cbell/Chuck@suse.vabb.com" <> Date: Wed, 10 Jan 2007 13:45:41 -0500 Subject: [PATCH 116/160] BUG#22645 - LC_TIME_NAMES: Statement not replicated This patch is an additional code change to the get_str_len_and_pointer method in log_events.cc. This change is necessary to correct a problem encountered on 64-bit SUSE where the auto_increment_* variables were being overwritten. The change corrects a cast mismatch which caused the problem. --- sql/log_event.cc | 65 +++++++++++++++++++++++++++--------------------- sql/log_event.h | 9 ++++++- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 1311f659af2..b5f4822a5a2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1315,23 +1315,30 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, /* 2 utility functions for the next method */ -static void get_str_len_and_pointer(const char **dst, const char **src, uint *len) +/* + Get the pointer for a string (src) that contains the length in + the first byte. Set the output string (dst) to the string value + and place the length of the string in the byte after the string. +*/ +static void get_str_len_and_pointer(const Log_event::Byte **src, + const char **dst, + uint *len) { if ((*len= **src)) - *dst= *src + 1; // Will be copied later - (*src)+= *len+1; + *dst= (char *)*src + 1; // Will be copied later + (*src)+= *len + 1; } - -static void copy_str_and_move(char **dst, const char **src, uint len) +static void copy_str_and_move(const char **src, + Log_event::Byte **dst, + uint len) { memcpy(*dst, *src, len); - *src= *dst; + *src= (const char *)*dst; (*dst)+= len; *(*dst)++= 0; } - /* Query_log_event::Query_log_event() This is used by the SQL slave thread to prepare the event before execution. @@ -1349,8 +1356,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, ulong data_len; uint32 tmp; uint8 common_header_len, post_header_len; - char *start; - const char *end; + Log_event::Byte *start; + const Log_event::Byte *end; bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); @@ -1396,9 +1403,9 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, /* variable-part: the status vars; only in MySQL 5.0 */ - start= (char*) (buf+post_header_len); - end= (const char*) (start+status_vars_len); - for (const uchar* pos= (const uchar*) start; pos < (const uchar*) end;) + start= (Log_event::Byte*) (buf+post_header_len); + end= (const Log_event::Byte*) (start+status_vars_len); + for (const Log_event::Byte* pos= start; pos < end;) { switch (*pos++) { case Q_FLAGS2_CODE: @@ -1420,7 +1427,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, break; } case Q_CATALOG_NZ_CODE: - get_str_len_and_pointer(&catalog, (const char **)(&pos), &catalog_len); + get_str_len_and_pointer(&pos, &catalog, &catalog_len); break; case Q_AUTO_INCREMENT: auto_increment_increment= uint2korr(pos); @@ -1436,7 +1443,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, } case Q_TIME_ZONE_CODE: { - get_str_len_and_pointer(&time_zone_str, (const char **)(&pos), &time_zone_len); + get_str_len_and_pointer(&pos, &time_zone_str, &time_zone_len); break; } case Q_CATALOG_CODE: /* for 5.0.x where 0<=x<=3 masters */ @@ -1458,38 +1465,38 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, } #if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE) - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1 + - QUERY_CACHE_FLAGS_SIZE + - db_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1 + + QUERY_CACHE_FLAGS_SIZE + + db_len + 1, + MYF(MY_WME)))) #else - if (!(start= data_buf = (char*) my_malloc(catalog_len + 1 + - time_zone_len + 1 + - data_len + 1, - MYF(MY_WME)))) + if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + + time_zone_len + 1 + + data_len + 1, + MYF(MY_WME)))) #endif DBUG_VOID_RETURN; if (catalog_len) // If catalog is given { if (likely(catalog_nz)) // true except if event comes from 5.0.0|1|2|3. - copy_str_and_move(&start, &catalog, catalog_len); + copy_str_and_move(&catalog, &start, catalog_len); else { memcpy(start, catalog, catalog_len+1); // copy end 0 - catalog= start; + catalog= (const char *)start; start+= catalog_len+1; } } if (time_zone_len) - copy_str_and_move(&start, &time_zone_str, time_zone_len); + copy_str_and_move(&time_zone_str, &start, time_zone_len); /* A 2nd variable part; this is common to all versions */ memcpy((char*) start, end, data_len); // Copy db and query start[data_len]= '\0'; // End query with \0 (For safetly) - db= start; - query= start + db_len + 1; + db= (char *)start; + query= (char *)(start + db_len + 1); q_len= data_len - db_len -1; DBUG_VOID_RETURN; } diff --git a/sql/log_event.h b/sql/log_event.h index a44e3476c41..9c2e7c5f7ea 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -546,6 +546,13 @@ typedef struct st_print_event_info class Log_event { public: + /* + The following type definition is to be used whenever data is placed + and manipulated in a common buffer. Use this typedef for buffers + that contain data containing binary and character data. + */ + typedef unsigned char Byte; + /* The offset in the log where this event originally appeared (it is preserved in relay logs, making SHOW SLAVE STATUS able to print @@ -719,7 +726,7 @@ public: class Query_log_event: public Log_event { protected: - char* data_buf; + Log_event::Byte* data_buf; public: const char* query; const char* catalog; From 270752654eaa57d759044484095a77a568c7e0cc Mon Sep 17 00:00:00 2001 From: "Kristofer.Pettersson@naruto." <> Date: Thu, 11 Jan 2007 09:40:17 +0100 Subject: [PATCH 117/160] Bug#24751 - Possible infinit loop in init_io_cache() when insufficient memory - When cache memory can't be allocated size is recaclulated using 3/4 of the requested memory. This number is rounded up to the nearest min_cache step. However with the previous implementation the new cache size might become bigger than requested because of this rounding and thus we get an infinit loop. - This patch fixes this problem by ensuring that the new cache size always will be smaller on the second and subsequent iterations until we reach min_cache. --- mysys/mf_iocache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index b17df3da260..a91002d3b4c 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -199,11 +199,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, if (type != READ_NET && type != WRITE_NET) { /* Retry allocating memory in smaller blocks until we get one */ + cachesize=(uint) ((ulong) (cachesize + min_cache-1) & + (ulong) ~(min_cache-1)); for (;;) { uint buffer_block; - cachesize=(uint) ((ulong) (cachesize + min_cache-1) & - (ulong) ~(min_cache-1)); if (cachesize < min_cache) cachesize = min_cache; buffer_block = cachesize; @@ -222,7 +222,8 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, } if (cachesize == min_cache) DBUG_RETURN(2); /* Can't alloc cache */ - cachesize= (uint) ((long) cachesize*3/4); /* Try with less memory */ + /* Try with less memory */ + cachesize= (uint) ((ulong) cachesize*3/4 & (ulong)~(min_cache-1)); } } From 2706b3d7374c7a4db23a4078d0bf6ed7cc39fbd9 Mon Sep 17 00:00:00 2001 From: "cmiller@221.54.57.10.in-addr.arpa.cmiller/221.54.57.10.in-addr.arpa" <> Date: Thu, 11 Jan 2007 14:54:03 -0500 Subject: [PATCH 118/160] Revert to old behavior. Including code to verify that a cluster is not readonly seems like a good idea, but the test suite isn't expecting those statements in some places. Figure out how we want to use this code later. --- mysql-test/include/have_ndb.inc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index 77857106488..adb8a657c6c 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -4,8 +4,3 @@ disable_query_log; select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; -# Check that master mysqld has come out of redonly mode ---source include/ndb_not_readonly.inc - - - From 5ee04ffa083dcba4197a47617ff53f25ff509f4c Mon Sep 17 00:00:00 2001 From: "aelkin/elkin@dsl-hkibras-fe36f900-97.dhcp.inet.fi" <> Date: Thu, 11 Jan 2007 23:59:12 +0200 Subject: [PATCH 119/160] Bug #24998 rpl_row_delayed_ins.test fails in pushbuild The test uses show binlog event which is not deterministic due to the single insert delayed query can generate up to number of inserted rows row-events pair (table_map + Write_row) The solution is to leave the current binlogging behaviour as it is and change the test as spliting arguments of insert delayed query. Note, that such fix was applied earlier for binlog_insert_delayed.test : https://intranet.mysql.com/secure/apps/irclog.php?channel=22&start_time=2006-09-27 There are no tests with insert delayed and show binlog events combination requiring this fix. --- mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index 2059717b225..0e235f8838f 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -7,7 +7,9 @@ connection master; let $VERSION=`select version()`; eval create table t1(a int not null primary key) engine=$engine_type; -insert delayed into t1 values (1),(2),(3); +insert delayed into t1 values (1); +insert delayed into t1 values (2); +insert delayed into t1 values (3); flush tables; SELECT * FROM t1 ORDER BY a; sync_slave_with_master; From 86890b89190181aff4b58c4110584f29ffaccf75 Mon Sep 17 00:00:00 2001 From: "mmj@tiger.mmj.dk" <> Date: Fri, 12 Jan 2007 01:04:39 +0100 Subject: [PATCH 120/160] mysql_explain_log.sh: Patch from Paul DuBois for better help messages --- scripts/mysql_explain_log.sh | 106 ++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/scripts/mysql_explain_log.sh b/scripts/mysql_explain_log.sh index ad23a42451f..a549817db5a 100644 --- a/scripts/mysql_explain_log.sh +++ b/scripts/mysql_explain_log.sh @@ -21,9 +21,6 @@ use DBI; use Getopt::Long; $Getopt::Long::ignorecase=0; -print "explain_log provided by http://www.mobile.de\n"; -print "=========== ================================\n"; - my $Param={}; $Param->{host}=''; @@ -32,16 +29,28 @@ $Param->{password}=''; $Param->{PrintError}=0; $Param->{socket}=''; -if (!GetOptions ('date|d:i' => \$Param->{ViewDate}, +my $help; + +if (!GetOptions ( + 'date|d:i' => \$Param->{ViewDate}, 'host|h:s' => \$Param->{host}, 'user|u:s' => \$Param->{user}, 'password|p:s' => \$Param->{password}, 'printerror|e:s' => \$Param->{PrintError}, 'socket|s:s' => \$Param->{socket}, + 'help|h' => \$help, )) { ShowOptions(); + exit(0); } -else { +if (defined ($help)) { + ShowOptions(); + exit(0); +} + + print "explain_log provided by http://www.mobile.de\n"; + print "=========== ================================\n"; + $Param->{UpdateCount} = 0; $Param->{SelectCount} = 0; $Param->{IdxUseCount} = 0; @@ -245,7 +254,6 @@ else { print "Finished: \t".localtime(time)."\n"; } -} ########################################################################### @@ -323,21 +331,26 @@ sub ShowOptions { print < Date: Sun, 14 Jan 2007 19:15:59 +0200 Subject: [PATCH 121/160] Bug#24998 rpl_row_delayed_ins.test fails in pushbuild forgotten to push changed results --- mysql-test/r/rpl_row_delayed_ins.result | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/rpl_row_delayed_ins.result b/mysql-test/r/rpl_row_delayed_ins.result index 31fffeb59cc..21b251db193 100644 --- a/mysql-test/r/rpl_row_delayed_ins.result +++ b/mysql-test/r/rpl_row_delayed_ins.result @@ -5,7 +5,9 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1(a int not null primary key) engine=myisam; -insert delayed into t1 values (1),(2),(3); +insert delayed into t1 values (1); +insert delayed into t1 values (2); +insert delayed into t1 values (3); flush tables; SELECT * FROM t1 ORDER BY a; a @@ -19,8 +21,10 @@ master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null pri master-bin.000001 222 Table_map 1 261 table_id: # (test.t1) master-bin.000001 261 Write_rows 1 295 table_id: # flags: STMT_END_F master-bin.000001 295 Table_map 1 334 table_id: # (test.t1) -master-bin.000001 334 Write_rows 1 373 table_id: # flags: STMT_END_F -master-bin.000001 373 Query 1 448 use `test`; flush tables +master-bin.000001 334 Write_rows 1 368 table_id: # flags: STMT_END_F +master-bin.000001 368 Table_map 1 407 table_id: # (test.t1) +master-bin.000001 407 Write_rows 1 441 table_id: # flags: STMT_END_F +master-bin.000001 441 Query 1 516 use `test`; flush tables SELECT * FROM t1 ORDER BY a; a 1 From ab98cbc88a37aeafc1dede05ff241fcd61bc64ec Mon Sep 17 00:00:00 2001 From: "dlenev@mockturtle.local" <> Date: Mon, 15 Jan 2007 12:32:38 +0300 Subject: [PATCH 122/160] Fix for bug#20390 "SELECT FOR UPDATE does not release locks of untouched rows in full table scans". SELECT ... FOR UPDATE/LOCK IN SHARE MODE statements as well as UPDATE/DELETE statements which were executed using full table scan were not releasing locks on rows which didn't satisfy WHERE condition. This bug surfaced in 5.0 and affected NDB tables. (InnoDB tables intentionally don't support such unlocking in default mode). This problem occured because code implementing join didn't call handler::unlock_row() for rows which didn't satisfy part of condition attached to this particular table/level of nested loop. So we solve the problem adding this call. Note that we already had this call in place in 4.1 but it was lost (actually not quite correctly placed) when we have introduced nested joins. Also note that additional QA should be requested once this patch is pushed as interaction between handler::unlock_row() and many recent MySQL features such as subqueries, unions, views is not tested enough. --- mysql-test/r/ndb_lock.result | 35 ++++++++++++++++++++++++++ mysql-test/t/ndb_lock.test | 49 +++++++++++++++++++++++++++++++----- sql/sql_select.cc | 1 + 3 files changed, 79 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/ndb_lock.result b/mysql-test/r/ndb_lock.result index 2c212b9cfef..d5875cb4d47 100644 --- a/mysql-test/r/ndb_lock.result +++ b/mysql-test/r/ndb_lock.result @@ -87,11 +87,27 @@ x y z rollback; commit; begin; +select * from t1 where y = 'one' or y = 'three' for update; +x y z +# # # +# # # +begin; +select * from t1 where x = 2 for update; +x y z +2 two 2 +select * from t1 where x = 1 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +commit; +begin; select * from t1 where y = 'one' or y = 'three' order by x for update; x y z 1 one 1 3 three 3 begin; +select * from t1 where x = 2 for update; +x y z +2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; @@ -124,6 +140,22 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; +select * from t1 where y = 'one' or y = 'three' lock in share mode; +x y z +# # # +# # # +begin; +select * from t1 where y = 'one' lock in share mode; +x y z +1 one 1 +select * from t1 where x = 2 for update; +x y z +2 two 2 +select * from t1 where x = 1 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +rollback; +commit; +begin; select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; x y z 1 one 1 @@ -132,6 +164,9 @@ begin; select * from t1 where y = 'one' lock in share mode; x y z 1 one 1 +select * from t1 where x = 2 for update; +x y z +2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test index 48a8b77dcd7..8dc02dc20cb 100644 --- a/mysql-test/t/ndb_lock.test +++ b/mysql-test/t/ndb_lock.test @@ -102,16 +102,36 @@ connection con1; commit; # table scan +# +# Note that there are two distinct execution paths in which we unlock +# non-matching rows inspected during table scan - one that is used in +# case of filesort and one that used in rest of cases. Below we cover +# the latter (Bug #20390 "SELECT FOR UPDATE does not release locks of +# untouched rows in full table scans"). connection con1; begin; -select * from t1 where y = 'one' or y = 'three' order by x for update; +# We can't use "order by x" here as it will cause filesort +--replace_column 1 # 2 # 3 # +select * from t1 where y = 'one' or y = 'three' for update; connection con2; begin; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks -# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans -#select * from t1 where x = 2 for update; +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +# And now the test for case with filesort +begin; +select * from t1 where y = 'one' or y = 'three' order by x for update; +connection con2; +begin; +select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; @@ -157,15 +177,32 @@ commit; # table scan connection con1; begin; -select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; +# We can't use "order by x" here as it will cause filesort +--replace_column 1 # 2 # 3 # +select * from t1 where y = 'one' or y = 'three' lock in share mode; connection con2; begin; select * from t1 where y = 'one' lock in share mode; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks -# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans -#select * from t1 where x = 2 for update; +select * from t1 where x = 2 for update; +--error 1205 +select * from t1 where x = 1 for update; +rollback; + +connection con1; +commit; + +# And the same test for case with filesort +connection con1; +begin; +select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; + +connection con2; +begin; +select * from t1 where y = 'one' lock in share mode; +select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bcd7e8c4a9d..918533df724 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10387,6 +10387,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, */ join->examined_rows++; join->thd->row_count++; + join_tab->read_record.file->unlock_row(); } return NESTED_LOOP_OK; } From f10a24314d61c011b8a7c99f1db0c6f4d2e763e0 Mon Sep 17 00:00:00 2001 From: "iggy@recycle.(none)" <> Date: Mon, 15 Jan 2007 10:00:29 -0500 Subject: [PATCH 123/160] Bug#19424 InnoDB: Possibly a memory overrun of the buffer being freed (Win64) - Re-enabling optimization on all except innodb/mem/*. --- innobase/CMakeLists.txt | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/innobase/CMakeLists.txt b/innobase/CMakeLists.txt index c244364a800..ae6f1bf21e5 100755 --- a/innobase/CMakeLists.txt +++ b/innobase/CMakeLists.txt @@ -3,39 +3,9 @@ ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB) # Bug#19424 - InnoDB: Possibly a memory overrun of the buffer being freed (64-bit Visual C) -# Removing Win64 compiler optimizations for all innodb files. +# Removing Win64 compiler optimizations for all innodb/mem/* files. IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") - SET_SOURCE_FILES_PROPERTIES(btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c - buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c - data/data0data.c data/data0type.c - dict/dict0boot.c dict/dict0crea.c dict/dict0dict.c dict/dict0load.c dict/dict0mem.c - dyn/dyn0dyn.c - eval/eval0eval.c eval/eval0proc.c - fil/fil0fil.c - fsp/fsp0fsp.c - fut/fut0fut.c fut/fut0lst.c - ha/ha0ha.c ha/hash0hash.c - ibuf/ibuf0ibuf.c - pars/lexyy.c pars/pars0grm.c pars/pars0opt.c pars/pars0pars.c pars/pars0sym.c - lock/lock0lock.c - log/log0log.c log/log0recv.c - mach/mach0data.c - mem/mem0mem.c mem/mem0pool.c - mtr/mtr0log.c mtr/mtr0mtr.c - os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c - page/page0cur.c page/page0page.c - que/que0que.c - read/read0read.c - rem/rem0cmp.c rem/rem0rec.c - row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c - row/row0umod.c row/row0undo.c row/row0upd.c row/row0vers.c - srv/srv0que.c srv/srv0srv.c srv/srv0start.c - sync/sync0arr.c sync/sync0rw.c sync/sync0sync.c - thr/thr0loc.c - trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c - trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c - usr/usr0sess.c - ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c + SET_SOURCE_FILES_PROPERTIES(mem/mem0mem.c mem/mem0pool.c PROPERTIES COMPILE_FLAGS -Od) ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") @@ -71,7 +41,3 @@ ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c usr/usr0sess.c ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ) -# (Bug#19424) Removing Win64 compiler optimizations innobase project. -IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") - SET_TARGET_PROPERTIES(innobase PROPERTIES COMPILE_FLAGS "/Od") -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64") From b711c554f55627f590126996d85578bc9a68b38e Mon Sep 17 00:00:00 2001 From: "bteam/mysqldev@mysql.com/production.mysql.com" <> Date: Mon, 15 Jan 2007 16:57:22 +0100 Subject: [PATCH 124/160] Raise version number after cloning 5.0.34 --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 493fe8f174f..94bc85557df 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.34) +AM_INIT_AUTOMAKE(mysql, 5.0.36) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=34 +NDB_VERSION_BUILD=36 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From d49ac4fbb7c81a99505963ba7a93a66f7dd86f58 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Mon, 15 Jan 2007 23:25:16 +0300 Subject: [PATCH 125/160] A post-merge fix. --- sql/sql_parse.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 426a65ed3df..3e2e12ba310 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2641,6 +2641,7 @@ unsent_create_error: bzero((char*) &create_info, sizeof(create_info)); create_info.db_type= DB_TYPE_DEFAULT; + create_info.row_type= ROW_TYPE_NOT_USED; create_info.default_table_charset= thd->variables.collation_database; res= mysql_alter_table(thd, tables->db, tables->real_name, From 8540eac24aadccd9dd22e8a37ecdcaae8d350e66 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 15 Jan 2007 21:50:31 +0100 Subject: [PATCH 126/160] Cset exclude: cmiller@221.54.57.10.in-addr.arpa.cmiller/221.54.57.10.in-addr.arpa|ChangeSet|20070111195403|30218 --- mysql-test/include/have_ndb.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index adb8a657c6c..77857106488 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -4,3 +4,8 @@ disable_query_log; select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; +# Check that master mysqld has come out of redonly mode +--source include/ndb_not_readonly.inc + + + From f44d73a58d0d8232603d98ac14c08cc142538564 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 09:35:14 +0100 Subject: [PATCH 127/160] Always use two masters for ndb tests --- mysql-test/lib/mtr_cases.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index a00d06d2e60..8c2dbdec804 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -537,6 +537,8 @@ sub collect_one_test_case($$$$$$$) { $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; return; } + # Ndb tests run with two mysqld masters + $tinfo->{'master_num'}= 2; } else { @@ -552,7 +554,7 @@ sub collect_one_test_case($$$$$$$) { if ( $tinfo->{'innodb_test'} ) { - # This is a test that need inndob + # This is a test that need innodb if ( $::mysqld_variables{'innodb'} eq "FALSE" ) { # innodb is not supported, skip it @@ -578,7 +580,6 @@ our @tags= ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1], - ["include/have_multi_ndb.inc", "master_num", 2], ["require_manager", "require_manager", 1], ); From 52a19378d82f3e7c29759268902d6be54689006f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 09:38:09 +0100 Subject: [PATCH 128/160] Remove wait until not readonly --- mysql-test/include/have_ndb.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index 77857106488..c9603634508 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -4,8 +4,6 @@ disable_query_log; select support = 'Enabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; -# Check that master mysqld has come out of redonly mode ---source include/ndb_not_readonly.inc From 08cbe046707ce0b44ab042b2d718973a2c5d9ae1 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 09:47:03 +0100 Subject: [PATCH 129/160] Always use two masters for ndb tests Abandon attempt to only use one for some tests that don't use the second master --- mysql-test/lib/mtr_cases.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 5d051422c4c..22290a88d39 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -551,6 +551,8 @@ sub collect_one_test_case($$$$$$$) { $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; return; } + # Ndb tests run with two mysqld masters + $tinfo->{'master_num'}= 2; } else { @@ -566,7 +568,7 @@ sub collect_one_test_case($$$$$$$) { if ( $tinfo->{'innodb_test'} ) { - # This is a test that need inndob + # This is a test that need innodb if ( $::mysqld_variables{'innodb'} eq "FALSE" ) { # innodb is not supported, skip it @@ -592,7 +594,6 @@ our @tags= ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1], - ["include/have_multi_ndb.inc", "master_num", 2], ["require_manager", "require_manager", 1], ); From 1135806991d69cd634cd2ed819bafc0161aef549 Mon Sep 17 00:00:00 2001 From: "mats@romeo.(none)" <> Date: Tue, 16 Jan 2007 11:58:48 +0100 Subject: [PATCH 130/160] Post-merge fixes. --- sql/sql_insert.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index db89cc091d4..989b78f3517 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2919,9 +2919,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, save us from that ? */ table->reginfo.lock_type=TL_WRITE; -#ifdef HAVE_ROW_BASED_REPLICATION hooks->prelock(&table, 1); // Call prelock hooks -#endif if (! ((*lock)= mysql_lock_tables(thd, &table, 1, MYSQL_LOCK_IGNORE_FLUSH, ¬_used))) { From 25c53269ab1802041413758b6488ebd3967f7dd4 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Tue, 16 Jan 2007 12:46:48 +0100 Subject: [PATCH 131/160] configure.in : Fix a dependency problem for "extra/" which shows up only in RPM builds. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 493fe8f174f..e3bb541c9ec 100644 --- a/configure.in +++ b/configure.in @@ -2516,9 +2516,9 @@ linked_client_targets="linked_libmysql_sources" if test "$THREAD_SAFE_CLIENT" = "no" then - sql_client_dirs="strings regex mysys extra libmysql client" + sql_client_dirs="strings regex mysys dbug extra libmysql client" else - sql_client_dirs="strings regex mysys extra libmysql libmysql_r client" + sql_client_dirs="strings regex mysys dbug extra libmysql libmysql_r client" linked_client_targets="$linked_client_targets linked_libmysql_r_sources" AC_CONFIG_FILES(libmysql_r/Makefile) AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should be client be thread safe]) From f507bb2cb3d698435d13336a5ebd5ecf797a770e Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 13:39:42 +0100 Subject: [PATCH 132/160] Bug#15518 Reusing a stmt that has failed during prepare does not clear error - Always reset error when calling mysql_stmt_prepare a second time - Set stmt->state to MYSQL_STMT_INIT_DONE before closing prepared stmt in server. - Add test to mysql_client_test - Remove mysql_stmt_close in mysqltest after each query - Close all open statements in mysqltest if disable_ps_protocol is called. --- client/mysqltest.c | 25 +++++++++-- libmysql/libmysql.c | 14 ++++-- tests/mysql_client_test.c | 93 +++++++++++++++++++++++++++++++++++---- 3 files changed, 117 insertions(+), 15 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 005f204d571..b163b5887e4 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -719,6 +719,20 @@ void close_connections() } +void close_statements() +{ + struct st_connection *con; + DBUG_ENTER("close_statements"); + for (con= connections; con < next_con; con++) + { + if (con->stmt) + mysql_stmt_close(con->stmt); + con->stmt= 0; + } + DBUG_VOID_RETURN; +} + + void close_files() { DBUG_ENTER("close_files"); @@ -2855,6 +2869,10 @@ void do_close_connection(struct st_command *command) } } #endif + if (next_con->stmt) + mysql_stmt_close(next_con->stmt); + next_con->stmt= 0; + mysql_close(&con->mysql); if (con->util_mysql) mysql_close(con->util_mysql); @@ -5050,10 +5068,7 @@ end: */ var_set_errno(mysql_stmt_errno(stmt)); -#ifndef BUG15518_FIXED - mysql_stmt_close(stmt); - cur_con->stmt= NULL; -#endif + DBUG_VOID_RETURN; } @@ -5838,6 +5853,8 @@ int main(int argc, char **argv) break; case Q_DISABLE_PS_PROTOCOL: ps_protocol_enabled= 0; + /* Close any open statements */ + close_statements(); break; case Q_ENABLE_PS_PROTOCOL: ps_protocol_enabled= ps_protocol; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 6a592f64e49..a5dcb66f002 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2038,6 +2038,13 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length) DBUG_RETURN(1); } + /* + Reset the last error in any case: that would clear the statement + if the previous prepare failed. + */ + stmt->last_errno= 0; + stmt->last_error[0]= '\0'; + if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) { /* This is second prepare with another statement */ @@ -2051,23 +2058,24 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length) */ stmt->bind_param_done= stmt->bind_result_done= FALSE; stmt->param_count= stmt->field_count= 0; - stmt->last_errno= 0; - stmt->last_error[0]= '\0'; free_root(&stmt->mem_root, MYF(MY_KEEP_PREALLOC)); int4store(buff, stmt->stmt_id); + /* + Close statement in server + If there was a 'use' result from another statement, or from mysql_use_result it won't be freed in mysql_stmt_free_result and we should get 'Commands out of sync' here. */ + stmt->state= MYSQL_STMT_INIT_DONE; if (stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)) { set_stmt_errmsg(stmt, mysql->net.last_error, mysql->net.last_errno, mysql->net.sqlstate); DBUG_RETURN(1); } - stmt->state= MYSQL_STMT_INIT_DONE; } if (stmt_command(mysql, COM_STMT_PREPARE, query, length, stmt)) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index aa993230a7f..22aa1e6ef21 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11014,7 +11014,7 @@ static void test_view() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(1 == rc); + DIE_UNLESS(1 == rc); } mysql_stmt_close(stmt); @@ -11057,7 +11057,7 @@ static void test_view_where() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(4 == rc); + DIE_UNLESS(4 == rc); } mysql_stmt_close(stmt); @@ -11140,7 +11140,7 @@ static void test_view_2where() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(0 == rc); + DIE_UNLESS(0 == rc); mysql_stmt_close(stmt); @@ -11193,7 +11193,7 @@ static void test_view_star() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(0 == rc); + DIE_UNLESS(0 == rc); } mysql_stmt_close(stmt); @@ -11256,7 +11256,7 @@ static void test_view_insert() rc= mysql_stmt_execute(select_stmt); check_execute(select_stmt, rc); rowcount= (int)my_process_stmt_result(select_stmt); - assert((i+1) == rowcount); + DIE_UNLESS((i+1) == rowcount); } mysql_stmt_close(insert_stmt); mysql_stmt_close(select_stmt); @@ -11297,7 +11297,7 @@ static void test_left_join_view() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(3 == rc); + DIE_UNLESS(3 == rc); } mysql_stmt_close(stmt); @@ -11373,7 +11373,7 @@ static void test_view_insert_fields() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); rc= my_process_stmt_result(stmt); - assert(1 == rc); + DIE_UNLESS(1 == rc); mysql_stmt_close(stmt); rc= mysql_query(mysql, "DROP VIEW v1"); @@ -12851,6 +12851,82 @@ static void test_bug7990() DIE_UNLESS(!mysql_errno(mysql)); } +/* + Bug #15518 - Reusing a stmt that has failed during prepare + does not clear error +*/ + +static void test_bug15518() +{ + MYSQL_STMT *stmt; + MYSQL* mysql1; + int rc; + myheader("test_bug15518"); + + mysql1= mysql_init(NULL); + + if (!mysql_real_connect(mysql1, opt_host, opt_user, opt_password, + opt_db ? opt_db : "test", opt_port, opt_unix_socket, + CLIENT_MULTI_STATEMENTS)) + { + fprintf(stderr, "Failed to connect to the database\n"); + DIE_UNLESS(0); + } + + stmt= mysql_stmt_init(mysql1); + + /* + The prepare of foo should fail with errno 1064 since + it's not a valid query + */ + rc= mysql_stmt_prepare(stmt, "foo", 3); + if (!opt_silent) + fprintf(stdout, "rc: %d, mysql_stmt_errno: %d, mysql_errno: %d\n", + rc, mysql_stmt_errno(stmt), mysql_errno(mysql1)); + DIE_UNLESS(rc && mysql_stmt_errno(stmt) && mysql_errno(mysql1)); + + /* + Use the same stmt and reprepare with another query that + suceeds + */ + rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12); + if (!opt_silent) + fprintf(stdout, "rc: %d, mysql_stmt_errno: %d, mysql_errno: %d\n", + rc, mysql_stmt_errno(stmt), mysql_errno(mysql1)); + DIE_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql1)); + + mysql_stmt_close(stmt); + DIE_UNLESS(!mysql_errno(mysql1)); + + /* + part2, when connection to server has been closed + after first prepare + */ + stmt= mysql_stmt_init(mysql1); + rc= mysql_stmt_prepare(stmt, "foo", 3); + if (!opt_silent) + fprintf(stdout, "rc: %d, mysql_stmt_errno: %d, mysql_errno: %d\n", + rc, mysql_stmt_errno(stmt), mysql_errno(mysql1)); + DIE_UNLESS(rc && mysql_stmt_errno(stmt) && mysql_errno(mysql1)); + + /* Close connection to server */ + mysql_close(mysql1); + + /* + Use the same stmt and reprepare with another query that + suceeds. The prepare should fail with error 2013 since + connection to server has been closed. + */ + rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12); + if (!opt_silent) + fprintf(stdout, "rc: %d, mysql_stmt_errno: %d\n", + rc, mysql_stmt_errno(stmt)); + DIE_UNLESS(rc && mysql_stmt_errno(stmt)); + + mysql_stmt_close(stmt); + DIE_UNLESS(mysql_errno(mysql1)); +} + static void test_view_sp_list_fields() { @@ -15009,7 +15085,7 @@ static void test_bug17667() } else { - assert(0==1); + DIE_UNLESS(0==1); } } @@ -15588,6 +15664,7 @@ static struct my_tests_st my_tests[]= { { "test_bug15752", test_bug15752 }, { "test_bug21206", test_bug21206 }, { "test_bug21726", test_bug21726 }, + { "test_bug15518", test_bug15518 }, { 0, 0 } }; From ae03f5d382f127297a9799a221851288f6f73ae7 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 17:47:41 +0100 Subject: [PATCH 133/160] Don't reuse prepared statements if running with reconnect enabled --- client/mysqltest.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/mysqltest.c b/client/mysqltest.c index b163b5887e4..266c21d7880 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -5061,6 +5061,14 @@ end: dynstr_free(&ds_execute_warnings); } + + /* Close the statement if - no reconnect, need new prepare */ + if (mysql->reconnect) + { + mysql_stmt_close(stmt); + cur_con->stmt= NULL; + } + /* We save the return code (mysql_stmt_errno(stmt)) from the last call sent to the server into the mysqltest builtin variable $mysql_errno. This @@ -5864,6 +5872,8 @@ int main(int argc, char **argv) break; case Q_ENABLE_RECONNECT: set_reconnect(&cur_con->mysql, 1); + /* Close any open statements - no reconnect, need new prepare */ + close_statements(); break; case Q_DISABLE_PARSING: if (parsing_disabled == 0) From c36a5390e4731986ca212ee6fcc9410fa77405a9 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 16 Jan 2007 17:52:17 +0100 Subject: [PATCH 134/160] Update xid's as an effect of not closing the prepared statements all the time --- mysql-test/t/mix_innodb_myisam_binlog.test | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 66440f1236e..73b59409a90 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -29,7 +29,7 @@ insert into t2 select * from t1; commit; --replace_column 5 # ---replace_result "xid=15" "xid=8" +--replace_result "xid=14" "xid=8" show binlog events from 98; delete from t1; @@ -58,7 +58,7 @@ rollback to savepoint my_savepoint; commit; --replace_column 5 # ---replace_result "xid=48" "xid=25" +--replace_result "xid=47" "xid=25" show binlog events from 98; delete from t1; @@ -76,7 +76,7 @@ commit; select a from t1 order by a; # check that savepoints work :) --replace_column 5 # ---replace_result "xid=70" "xid=37" +--replace_result "xid=69" "xid=37" show binlog events from 98; # and when ROLLBACK is not explicit? @@ -109,7 +109,7 @@ insert into t1 values(9); insert into t2 select * from t1; --replace_column 5 # ---replace_result "xid=119" "xid=60" +--replace_result "xid=117" "xid=60" show binlog events from 98; # Check that when the query updat1ng the MyISAM table is the first in the @@ -122,13 +122,13 @@ insert into t1 values(10); # first make t1 non-empty begin; insert into t2 select * from t1; --replace_column 5 # ---replace_result "xid=133" "xid=66" +--replace_result "xid=131" "xid=66" show binlog events from 98; insert into t1 values(11); commit; --replace_column 5 # ---replace_result "xid=133" "xid=66" "xid=136" "xid=68" +--replace_result "xid=131" "xid=66" "xid=134" "xid=68" show binlog events from 98; @@ -147,7 +147,7 @@ insert into t2 select * from t1; commit; --replace_column 5 # ---replace_result "xid=155" "xid=78" +--replace_result "xid=153" "xid=78" show binlog events from 98; delete from t1; @@ -175,7 +175,7 @@ rollback to savepoint my_savepoint; commit; --replace_column 5 # ---replace_result "xid=187" "xid=94" +--replace_result "xid=185" "xid=94" show binlog events from 98; delete from t1; @@ -193,7 +193,7 @@ commit; select a from t1 order by a; # check that savepoints work :) --replace_column 5 # ---replace_result "xid=208" "xid=105" +--replace_result "xid=206" "xid=105" show binlog events from 98; # Test for BUG#5714, where a MyISAM update in the transaction used to @@ -254,7 +254,7 @@ disconnect con2; connection con3; select get_lock("lock1",60); --replace_column 5 # ---replace_result "xid=208" "xid=105" "xid=227" "xid=114" "xid=230" "xid=115" "xid=234" "xid=117" "xid=261" "xid=132" +--replace_result "xid=206" "xid=105" "xid=224" "xid=114" "xid=227" "xid=115" "xid=231" "xid=117" "xid=258" "xid=132" show binlog events from 98; do release_lock("lock1"); drop table t0,t2; From 51a2f5153f30e065195a1806952b6581ba515798 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Tue, 16 Jan 2007 21:23:52 +0300 Subject: [PATCH 135/160] A fix for the broken 4.1-runtime tree. --- mysql-test/t/backup.test | 1 + mysql-test/t/ps.test | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index b6b3ef1c060..0f1881368a9 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -51,5 +51,6 @@ unlock tables; connection con1; reap; drop table t5; +--system rm $MYSQLTEST_VARDIR/tmp/t?.* # End of 4.1 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index cd6c0667898..c963e59110f 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1127,7 +1127,12 @@ show create table mysqltest.t2; drop database mysqltest; deallocate prepare stmt1; deallocate prepare stmt2; +# # CREATE TABLE with DATA DIRECTORY option +# +# Protect ourselves from data left in tmp/ by a previos possibly failed +# test +--system rm -f $MYSQLTEST_VARDIR/tmp/t1.* --disable_query_log eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; --enable_query_log From 88bc918be6404e35ba4283861f6409fb801b3a4e Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Tue, 16 Jan 2007 20:01:17 +0100 Subject: [PATCH 136/160] myisam/mi_packrec.c Fix a compile error: Macro "DBUG_ENTER" must not follow an executable statement. --- myisam/mi_packrec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 37614cc1e1f..d45d6f8b16f 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -592,8 +592,8 @@ static uint copy_decode_table(uint16 *to_pos, uint offset, uint16 *decode_table) { uint prev_offset; - prev_offset= offset; DBUG_ENTER("copy_decode_table"); + prev_offset= offset; /* Descent on the left side. */ if (!(*decode_table & IS_CHAR)) From eee98226e729c1a258f6b77078b2b7bdf39c21a9 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Tue, 16 Jan 2007 19:17:17 -0500 Subject: [PATCH 137/160] Disabled "plugin". Very minor memory leak keeping tree red. --- mysql-test/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ce7bb345aad..8c2c4740f5e 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -38,4 +38,5 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results +plugin : Bug#25659 memory leak via "plugins" test From 29be5ce83641ff65adc7f2059efb0e5adec1079c Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Wed, 17 Jan 2007 11:51:52 +0100 Subject: [PATCH 138/160] Bug#25505 Myisam library compiler error on Windows --- myisam/mi_packrec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 5363a3ecf23..51b0222e876 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -590,8 +590,7 @@ static void fill_quick_table(uint16 *table, uint bits, uint max_bits, static uint copy_decode_table(uint16 *to_pos, uint offset, uint16 *decode_table) { - uint prev_offset; - prev_offset= offset; + uint prev_offset= offset; DBUG_ENTER("copy_decode_table"); /* Descent on the left side. */ From 175438819a5a2fbad5a9456d79bae9a65ae70bcf Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Wed, 17 Jan 2007 14:24:54 +0300 Subject: [PATCH 139/160] Fix a ps.test failure in 5.0-runtime tree. --- mysql-test/r/ps.result | 8 -------- mysql-test/t/ps.test | 13 +++++++++++-- sql/mysqld.cc | 10 ++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 7491c826527..21d8ba05acc 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1109,17 +1109,9 @@ deallocate prepare stmt1; deallocate prepare stmt2; execute stmt; show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; execute stmt; show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c` char(10) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; deallocate prepare stmt; End of 4.1 tests. diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index bddf6f57ed1..5f00aa60b11 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1175,12 +1175,21 @@ deallocate prepare stmt2; eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; --enable_query_log execute stmt; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +# +# DATA DIRECTORY option does not always work: if the operating +# system does not support symlinks, have_symlinks option is automatically +# disabled. +# In this case DATA DIRECTORY is silently ignored when +# creating a table, and is not output by SHOW CREATE TABLE. +# +--disable_result_log show create table t1; +--enable_result_log drop table t1; execute stmt; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_result_log show create table t1; +--enable_result_log drop table t1; deallocate prepare stmt; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b59962a5005..dbca7dae338 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -67,12 +67,6 @@ #define ONE_THREAD #endif -#ifdef HAVE_purify -#define IF_PURIFY(A,B) (A) -#else -#define IF_PURIFY(A,B) (B) -#endif - #if SIZEOF_CHARP == 4 #define MAX_MEM_TABLE_SIZE ~(ulong) 0 #else @@ -5434,7 +5428,7 @@ log and this option does nothing anymore.", #endif {"symbolic-links", 's', "Enable symbolic link support.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, - IF_PURIFY(0,1), 0, 0, 0, 0, 0}, + 1, 0, 0, 0, 0, 0}, {"sysdate-is-now", OPT_SYSDATE_IS_NOW, "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.", (gptr*) &global_system_variables.sysdate_is_now, @@ -5466,7 +5460,7 @@ log and this option does nothing anymore.", 0, 0, 0, 0, 0}, {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, - IF_PURIFY(0,1), 0, 0, 0, 0, 0}, + 1, 0, 0, 0, 0, 0}, {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Used with --help option for detailed help", From c4a86761b0651b13b989468064890e52697fa71b Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 17 Jan 2007 13:43:03 +0100 Subject: [PATCH 140/160] Replace the --exec in a while loop that causes 3400 executions of cygwin/bash on windows with a small perl script that does exactly the same. --- mysql-test/t/mysql.test | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 3d022eb27e4..829be665e09 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -145,21 +145,24 @@ drop table t1; # # Bug #19216: Client crashes on long SELECT # ---exec echo "select" > $MYSQLTEST_VARDIR/tmp/b19216.tmp -# 3400 * 20 makes 68000 columns that is more than the max number that can fit -# in a 16 bit number. -let $i= 3400; -while ($i) -{ - --exec echo "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'," >> $MYSQLTEST_VARDIR/tmp/b19216.tmp - dec $i; -} +# Create large SELECT +# - 3400 * 20 makes 68000 columns that is more than the +# max number that can fit in a 16 bit number. + +--perl +open(FILE,">","$ENV{'MYSQLTEST_VARDIR'}/tmp/b19216.tmp") or die; +print FILE "select\n"; +print FILE "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',\n" x 3400; +print FILE "'b';\n"; +close FILE; +EOF ---exec echo "'b';" >> $MYSQLTEST_VARDIR/tmp/b19216.tmp --disable_query_log --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null --enable_query_log +--remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp + # # Bug #20103: Escaping with backslash does not work # From 6399db740ea10e35a1116a89ba1ce33b3b9c0ec5 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Wed, 17 Jan 2007 15:46:30 +0300 Subject: [PATCH 141/160] Fix a failure of lowercase_tables2 test on powermacg5, introduced by the patch for Bug#4968 --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3e2e12ba310..6e1a8ba3abc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2500,6 +2500,7 @@ mysql_execute_command(THD *thd) if ((res= create_table_precheck(thd, tables, create_table))) goto unsent_create_error; + create_info.alias= create_table->alias; #ifndef HAVE_READLINK create_info.data_file_name= create_info.index_file_name= NULL; #else @@ -5800,7 +5801,6 @@ int create_table_precheck(THD *thd, TABLE_LIST *tables, want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ? CREATE_TMP_ACL : CREATE_ACL); - lex->create_info.alias= create_table->alias; if (check_access(thd, want_priv, create_table->db, &create_table->grant.privilege, 0, 0) || check_merge_table_access(thd, create_table->db, From 15c9d8a6c93924beb8b415329299d859879733e0 Mon Sep 17 00:00:00 2001 From: "kostja@bodhi.local" <> Date: Wed, 17 Jan 2007 20:46:09 +0300 Subject: [PATCH 142/160] Disable symlinks under valgrind builds (again), with a comment. --- sql/mysqld.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dbca7dae338..f107569c3cb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -67,6 +67,12 @@ #define ONE_THREAD #endif +#ifdef HAVE_purify +#define IF_PURIFY(A,B) (A) +#else +#define IF_PURIFY(A,B) (B) +#endif + #if SIZEOF_CHARP == 4 #define MAX_MEM_TABLE_SIZE ~(ulong) 0 #else @@ -5428,7 +5434,7 @@ log and this option does nothing anymore.", #endif {"symbolic-links", 's', "Enable symbolic link support.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, - 1, 0, 0, 0, 0, 0}, + IF_PURIFY(0,1), 0, 0, 0, 0, 0}, {"sysdate-is-now", OPT_SYSDATE_IS_NOW, "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.", (gptr*) &global_system_variables.sysdate_is_now, @@ -5460,7 +5466,12 @@ log and this option does nothing anymore.", 0, 0, 0, 0, 0}, {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.", (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, - 1, 0, 0, 0, 0, 0}, + /* + The system call realpath() produces warnings under valgrind and + purify. These are not suppressed: instead we disable symlinks + option if compiled with valgrind support. + */ + IF_PURIFY(0,1), 0, 0, 0, 0, 0}, {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Used with --help option for detailed help", From 332f9ff8b480fcec7259934b1a7b78f126bcaee1 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Wed, 17 Jan 2007 13:22:50 -0500 Subject: [PATCH 143/160] Bug#23721: compile fails: check-cpu mishandles cpu flags with \ hyphen in it (like ds-cpl). convert illegal chars in cpu flags to '_' for variable assignment --- BUILD/check-cpu | 2 +- BitKeeper/etc/collapsed | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index e207d12d972..5d8c9ef2df4 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -28,7 +28,7 @@ check_cpu () { fi # parse CPU flags - for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do + for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do eval cpu_flag_$flag=yes done else diff --git a/BitKeeper/etc/collapsed b/BitKeeper/etc/collapsed index 3b45bb4f30c..457d909ef74 100644 --- a/BitKeeper/etc/collapsed +++ b/BitKeeper/etc/collapsed @@ -3,3 +3,4 @@ 454f8960jsVT_kMKJtZ9OCgXoba0xQ 4554a95d7txO1DuO9G3nAizI3SkFAA 4554b3722d71SbPiI2Gx-RhbZjmuIQ +45ae6628gqKTsUFfnoNExadETVIkbA From abd057be56264aee6c9a6c399449d021571e18e4 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Wed, 17 Jan 2007 15:01:28 -0500 Subject: [PATCH 144/160] errmsg update from Stefan. --- sql/share/errmsg.txt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 1b9e1aa96ec..0f1c38973fa 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -950,7 +950,7 @@ ER_CON_COUNT_ERROR 08004 eng "Too many connections" jps "ڑ܂", est "Liiga palju samaaegseid hendusi" - fre "Trop de connections" + fre "Trop de connexions" ger "Zu viele Verbindungen" greek " ..." hun "Tul sok kapcsolat" @@ -1827,7 +1827,7 @@ ER_READY eng "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d" jps "%s: ", est "%s: ootab hendusi" - fre "%s: Prt pour des connections" + fre "%s: Prt pour des connexions" ger "%-.64s: Bereit fr Verbindungen.\nVersion: '%2' Socket: '%s' Port: %d" greek "%s: " hun "%s: kapcsolatra kesz" @@ -1950,7 +1950,7 @@ ER_IPSOCK_ERROR 08S01 eng "Can't create IP socket" jps "IP socket ܂", est "Ei suuda luua IP socketit" - fre "Ne peut crer la connection IP (socket)" + fre "Ne peut crer la connexion IP (socket)" ger "Kann IP-Socket nicht erzeugen" greek " IP socket" hun "Az IP socket nem hozhato letre" @@ -3031,7 +3031,7 @@ ER_HOST_IS_BLOCKED eng "Host '%-.64s' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" jps "Host '%-.64s' many connection error ̂߁Aۂ܂. 'mysqladmin flush-hosts' ʼnĂ", est "Masin '%-.64s' on blokeeritud hulgaliste hendusvigade tttu. Blokeeringu saab thistada 'mysqladmin flush-hosts' ksuga" - fre "L'hte '%-.64s' est bloqu cause d'un trop grand nombre d'erreur de connection. Dbloquer le par 'mysqladmin flush-hosts'" + fre "L'hte '%-.64s' est bloqu cause d'un trop grand nombre d'erreur de connexion. Dbloquer le par 'mysqladmin flush-hosts'" ger "Host '%-.64s' blockiert wegen zu vieler Verbindungsfehler. Aufheben der Blockierung mit 'mysqladmin flush-hosts'" greek " . 'mysqladmin flush-hosts'" hun "A '%-.64s' host blokkolodott, tul sok kapcsolodasi hiba miatt. Hasznalja a 'mysqladmin flush-hosts' parancsot" @@ -3533,7 +3533,7 @@ ER_NET_READ_ERROR_FROM_PIPE 08S01 nla "Kreeg leesfout van de verbindings pipe" eng "Got a read error from the connection pipe" est "Viga hendustoru lugemisel" - fre "Erreur de lecture reue du pipe de connection" + fre "Erreur de lecture reue du pipe de connexion" ger "Lese-Fehler bei einer Verbindungs-Pipe" hun "Olvasasi hiba a kapcsolat soran" ita "Rilevato un errore di lettura dalla pipe di connessione" @@ -4331,7 +4331,7 @@ ER_TOO_MANY_USER_CONNECTIONS 42000 nla "Gebruiker %-.64s heeft reeds meer dan 'max_user_connections' actieve verbindingen" eng "User %-.64s already has more than 'max_user_connections' active connections" est "Kasutajal %-.64s on juba rohkem hendusi kui lubatud 'max_user_connections' muutujaga" - fre "L'utilisateur %-.64s possde dj plus de 'max_user_connections' connections actives" + fre "L'utilisateur %-.64s possde dj plus de 'max_user_connections' connexions actives" ger "Benutzer '%-.64s' hat mehr als 'max_user_connections' aktive Verbindungen" ita "L'utente %-.64s ha gia' piu' di 'max_user_connections' connessioni attive" por "Usurio '%-.64s' j possui mais que o valor mximo de conexes (max_user_connections) ativas" @@ -6009,15 +6009,22 @@ ER_BAD_LOG_STATEMENT ger "Sie knnen eine Logtabelle nicht '%s', wenn Loggen angeschaltet ist" ER_NON_INSERTABLE_TABLE eng "The target table %-.100s of the %s is not insertable-into" + ger "Die Zieltabelle %-.100s von %s ist nicht einfgbar" ER_CANT_RENAME_LOG_TABLE eng "Cannot rename '%s'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to '%s'" + ger "Kann '%s' nicht umbenennen. Wenn Loggen angeschaltet ist, mssen beim Umbenennen zu/von einer Logtabelle zwei Tabellen angegeben werden: die Logtabelle zu einer Archivtabelle und eine weitere Tabelle zurck zu '%s'" ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 42000 eng "Incorrect parameter count in the call to native function '%-.64s'" + ger "Falsche Anzahl von Parametern beim Aufruf der nativen Funktion '%-.64s'" ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000 eng "Incorrect parameters in the call to native function '%-.64s'" + ger "Falscher Parameter beim Aufruf der nativen Funktion '%-.64s'" ER_WRONG_PARAMETERS_TO_STORED_FCT 42000 eng "Incorrect parameters in the call to stored function '%-.64s'" + ger "Falsche Parameter beim Aufruf der gespeicherten Funktion '%-.64s'" ER_NATIVE_FCT_NAME_COLLISION - eng "This function '%-.64s' has the same name as a native function." + eng "This function '%-.64s' has the same name as a native function" + ger "Die Funktion '%-.64s' hat denselben Namen wie eine native Funktion" ER_BINLOG_PURGE_EMFILE eng "Too many files opened, please execute the command again" + ger "Zu viele offene Dateien, bitte fhren Sie den Befehl noch einmal aus" From f2d4988c37afa398cd73b087bc3274f175c4f5b3 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Wed, 17 Jan 2007 18:15:35 -0500 Subject: [PATCH 145/160] errmsg change --- mysql-test/r/sp.result | 8 ++++---- mysql-test/r/sp_gis.result | 4 ++-- mysql-test/r/udf.result | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 82a333bfa4a..c2d86ebc42d 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5633,7 +5633,7 @@ drop function if exists pi; create function pi() returns varchar(50) return "pie, my favorite desert."; Warnings: -Note 1581 This function 'pi' has the same name as a native function. +Note 1581 This function 'pi' has the same name as a native function SET @save_sql_mode=@@sql_mode; SET SQL_MODE='IGNORE_SPACE'; select pi(), pi (); @@ -5682,15 +5682,15 @@ use test; create function `database`() returns varchar(50) return "Stored function database"; Warnings: -Note 1581 This function 'database' has the same name as a native function. +Note 1581 This function 'database' has the same name as a native function create function `current_user`() returns varchar(50) return "Stored function current_user"; Warnings: -Note 1581 This function 'current_user' has the same name as a native function. +Note 1581 This function 'current_user' has the same name as a native function create function md5(x varchar(50)) returns varchar(50) return "Stored function md5"; Warnings: -Note 1581 This function 'md5' has the same name as a native function. +Note 1581 This function 'md5' has the same name as a native function SET SQL_MODE='IGNORE_SPACE'; select database(), database (); database() database () diff --git a/mysql-test/r/sp_gis.result b/mysql-test/r/sp_gis.result index f46bcc90308..fddf2a6bc18 100644 --- a/mysql-test/r/sp_gis.result +++ b/mysql-test/r/sp_gis.result @@ -7,11 +7,11 @@ return 1; create function x() returns int return 2; Warnings: -Note 1581 This function 'x' has the same name as a native function. +Note 1581 This function 'x' has the same name as a native function create function y() returns int return 3; Warnings: -Note 1581 This function 'y' has the same name as a native function. +Note 1581 This function 'y' has the same name as a native function select a(); a() 1 diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index abc654c4b74..a55e69526ae 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -209,7 +209,7 @@ select abs(myfunc_double(3) AS wrong); ERROR 42000: Incorrect parameters in the call to native function 'abs' drop function if exists pi; CREATE FUNCTION pi RETURNS STRING SONAME "should_not_parse.so"; -ERROR HY000: This function 'pi' has the same name as a native function. +ERROR HY000: This function 'pi' has the same name as a native function DROP FUNCTION IF EXISTS metaphon; CREATE FUNCTION metaphon(a int) RETURNS int return 0; From 5c42e6838843b5210b2682f25bfb932f717eeb49 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Thu, 18 Jan 2007 10:51:29 +0400 Subject: [PATCH 146/160] after merge fix. --- mysql-test/r/select.result | 380 ++----------------------------------- sql/item.cc | 4 +- 2 files changed, 19 insertions(+), 365 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 92b9281e70e..dbc406b9a6c 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2811,6 +2811,23 @@ select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; min(key1) 0.37619999051094 DROP TABLE t1,t2; +create table t1(a bigint unsigned, b bigint); +insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), +(0x10000000000000000, 0x10000000000000000), +(0x8fffffffffffffff, 0x8fffffffffffffff); +Warnings: +Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value adjusted for column 'b' at row 1 +Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value adjusted for column 'b' at row 2 +Warning 1264 Out of range value adjusted for column 'b' at row 3 +select hex(a), hex(b) from t1; +hex(a) hex(b) +FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF +drop table t1; +End of 4.1 tests CREATE TABLE t1 ( K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', @@ -3200,179 +3217,6 @@ select count(*) from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id; count(*) 6 -<<<<<<< gca mysql-test/r/select.result 1.34.3.40 -t1 MyISAM 9 Dynamic 2 20 X X X X X X X X latin1_swedish_ci NULL -t11 MyISAM 9 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL -select 123 as a from t1 where f1 is null; -a -drop table t1,t11; -CREATE TABLE t1 (a INT, b INT); -(SELECT a, b AS c FROM t1) ORDER BY c+1; -a c -(SELECT a, b AS c FROM t1) ORDER BY b+1; -a c -SELECT a, b AS c FROM t1 ORDER BY c+1; -a c -SELECT a, b AS c FROM t1 ORDER BY b+1; -a c -drop table t1; -CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) ); -INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4); -CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, c INT ); -INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2), -(1,2,3); -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -1 10 2 -1 11 2 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c; -a b c d -1 10 4 -1 2 1 1 -1 2 2 1 -1 2 3 1 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -1 10 2 -1 11 2 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2,t1 -WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -DROP TABLE IF EXISTS t1, t2; -create table t1 (f1 int primary key, f2 int); -create table t2 (f3 int, f4 int, primary key(f3,f4)); -insert into t1 values (1,1); -insert into t2 values (1,1),(1,2); -select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1; -count(f2) >0 -1 -drop table t1,t2; -create table t1 (f1 int,f2 int); -insert into t1 values(1,1); -create table t2 (f3 int, f4 int, primary key(f3,f4)); -insert into t2 values(1,1); -select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); -f1 f2 -1 1 -drop table t1,t2; -CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c)); -insert into t1 values (1,0,0),(2,0,0); -CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a)); -insert into t2 values (1,'',''), (2,'',''); -CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b)); -insert into t3 values (1,1),(1,2); -explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 -where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and -t2.b like '%%' order by t2.b limit 0,1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort -1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) -DROP TABLE t1,t2,t3; -CREATE TABLE t1 (a int, INDEX idx(a)); -INSERT INTO t1 VALUES (2), (3), (1); -EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); -ERROR HY000: Key 'a' doesn't exist in table 't1' -EXPLAIN SELECT * FROM t1 FORCE INDEX (a); -ERROR HY000: Key 'a' doesn't exist in table 't1' -DROP TABLE t1; -CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL); -INSERT INTO t1 VALUES (10); -SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1; -i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01') -0 1 1 1 -DROP TABLE t1; -CREATE TABLE t1 (a int, b int); -INSERT INTO t1 VALUES (1,1), (2,1), (4,10); -CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b)); -INSERT INTO t2 VALUES (1,NULL), (2,10); -ALTER TABLE t1 ENABLE KEYS; -EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -a b a b -1 NULL 1 1 -1 NULL 2 1 -1 NULL 4 10 -2 10 4 10 -EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -a b a b -1 NULL 1 1 -1 NULL 2 1 -1 NULL 4 10 -2 10 4 10 -DROP TABLE IF EXISTS t1,t2; -CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1)); -CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2)); -INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941); -INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941); -explain select max(key1) from t1 where key1 <= 0.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key2) from t2 where key2 <= 1.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key1) from t1 where key1 >= 0.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key2) from t2 where key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key1), min(key2) from t1, t2 -where key1 <= 0.6158 and key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -select max(key1) from t1 where key1 <= 0.6158; -max(key1) -0.61580002307892 -select max(key2) from t2 where key2 <= 1.6158; -max(key2) -1.6158000230789 -select min(key1) from t1 where key1 >= 0.3762; -min(key1) -0.37619999051094 -select min(key2) from t2 where key2 >= 1.3762; -min(key2) -1.3761999607086 -select max(key1), min(key2) from t1, t2 -where key1 <= 0.6158 and key2 >= 1.3762; -max(key1) min(key2) -0.61580002307892 1.3761999607086 -select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -max(key1) -0.61580002307892 -select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -min(key1) -0.37619999051094 -DROP TABLE t1,t2; -<<<<<<< local mysql-test/r/select.result 1.143 drop table t1,t2,t3; create table t1 (a int); create table t2 (b int); @@ -3784,193 +3628,3 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range si,ai si 5 NULL 2 Using where 1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where DROP TABLE t1,t2,t3; -<<<<<<< remote mysql-test/r/select.result 1.34.3.41 -t1 MyISAM 9 Dynamic 2 20 X X X X X X X X latin1_swedish_ci NULL -t11 MyISAM 9 Dynamic 0 0 X X X X X X X X latin1_swedish_ci NULL -select 123 as a from t1 where f1 is null; -a -drop table t1,t11; -CREATE TABLE t1 (a INT, b INT); -(SELECT a, b AS c FROM t1) ORDER BY c+1; -a c -(SELECT a, b AS c FROM t1) ORDER BY b+1; -a c -SELECT a, b AS c FROM t1 ORDER BY c+1; -a c -SELECT a, b AS c FROM t1 ORDER BY b+1; -a c -drop table t1; -CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) ); -INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4); -CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, c INT ); -INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2), -(1,2,3); -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -1 10 2 -1 11 2 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c; -a b c d -1 10 4 -1 2 1 1 -1 2 2 1 -1 2 3 1 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2 LEFT JOIN -t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -1 10 2 -1 11 2 -SELECT t2.a, t2.b, IF(t1.b IS NULL,'',c) AS c, COUNT(*) AS d FROM t2,t1 -WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c; -a b c d -1 2 1 1 -1 2 2 1 -1 2 3 1 -DROP TABLE IF EXISTS t1, t2; -create table t1 (f1 int primary key, f2 int); -create table t2 (f3 int, f4 int, primary key(f3,f4)); -insert into t1 values (1,1); -insert into t2 values (1,1),(1,2); -select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1; -count(f2) >0 -1 -drop table t1,t2; -create table t1 (f1 int,f2 int); -insert into t1 values(1,1); -create table t2 (f3 int, f4 int, primary key(f3,f4)); -insert into t2 values(1,1); -select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); -f1 f2 -1 1 -drop table t1,t2; -CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c)); -insert into t1 values (1,0,0),(2,0,0); -CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a)); -insert into t2 values (1,'',''), (2,'',''); -CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b)); -insert into t3 values (1,1),(1,2); -explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 -where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and -t2.b like '%%' order by t2.b limit 0,1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using where; Using temporary; Using filesort -1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) -DROP TABLE t1,t2,t3; -CREATE TABLE t1 (a int, INDEX idx(a)); -INSERT INTO t1 VALUES (2), (3), (1); -EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); -ERROR HY000: Key 'a' doesn't exist in table 't1' -EXPLAIN SELECT * FROM t1 FORCE INDEX (a); -ERROR HY000: Key 'a' doesn't exist in table 't1' -DROP TABLE t1; -CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL); -INSERT INTO t1 VALUES (10); -SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1; -i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01') -0 1 1 1 -DROP TABLE t1; -CREATE TABLE t1 (a int, b int); -INSERT INTO t1 VALUES (1,1), (2,1), (4,10); -CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b)); -INSERT INTO t2 VALUES (1,NULL), (2,10); -ALTER TABLE t1 ENABLE KEYS; -EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -a b a b -1 NULL 1 1 -1 NULL 2 1 -1 NULL 4 10 -2 10 4 10 -EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -a b a b -1 NULL 1 1 -1 NULL 2 1 -1 NULL 4 10 -2 10 4 10 -DROP TABLE IF EXISTS t1,t2; -CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1)); -CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2)); -INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941); -INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941); -explain select max(key1) from t1 where key1 <= 0.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key2) from t2 where key2 <= 1.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key1) from t1 where key1 >= 0.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key2) from t2 where key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key1), min(key2) from t1, t2 -where key1 <= 0.6158 and key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -select max(key1) from t1 where key1 <= 0.6158; -max(key1) -0.61580002307892 -select max(key2) from t2 where key2 <= 1.6158; -max(key2) -1.6158000230789 -select min(key1) from t1 where key1 >= 0.3762; -min(key1) -0.37619999051094 -select min(key2) from t2 where key2 >= 1.3762; -min(key2) -1.3761999607086 -select max(key1), min(key2) from t1, t2 -where key1 <= 0.6158 and key2 >= 1.3762; -max(key1) min(key2) -0.61580002307892 1.3761999607086 -select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -max(key1) -0.61580002307892 -select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -min(key1) -0.37619999051094 -DROP TABLE t1,t2; -create table t1(a bigint unsigned, b bigint); -insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), -(0x10000000000000000, 0x10000000000000000), -(0x8fffffffffffffff, 0x8fffffffffffffff); -Warnings: -Warning 1264 Data truncated; out of range for column 'a' at row 1 -Warning 1264 Data truncated; out of range for column 'b' at row 1 -Warning 1264 Data truncated; out of range for column 'a' at row 2 -Warning 1264 Data truncated; out of range for column 'b' at row 2 -Warning 1264 Data truncated; out of range for column 'b' at row 3 -select hex(a), hex(b) from t1; -hex(a) hex(b) -FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF -FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF -8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF -drop table t1; -End of 4.1 tests ->>>>>>> diff --git a/sql/item.cc b/sql/item.cc index e5a888842ac..11bc5771b56 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4478,10 +4478,10 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions) nr= LONGLONG_MAX; goto warn; } - return field->store((longlong) nr); + return field->store((longlong) nr, TRUE); // Assume hex numbers are unsigned warn: - if (!field->store((longlong) nr)) + if (!field->store((longlong) nr, TRUE)) field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); return 1; From c57442d6d82d8a74105c949682d165513f0e9a21 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Thu, 18 Jan 2007 15:28:45 +0400 Subject: [PATCH 147/160] after merge fix. --- mysql-test/r/range.result | 4 ++-- mysql-test/r/type_bit.result | 2 +- mysql-test/r/type_bit_innodb.result | 2 +- sql/field.cc | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index c96173e74cc..9d2da82813f 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -521,8 +521,8 @@ select count(*) from t1 where x = 18446744073709551601; count(*) 1 create table t2 (x bigint not null); -insert into t2(x) values (cast(0xfffffffffffffff0+0 as signed)); -insert into t2(x) values (cast(0xfffffffffffffff1+0 as signed)); +insert into t2(x) values (-16); +insert into t2(x) values (-15); select * from t2; x -16 diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index bd58e83bb3f..5726501916c 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -568,7 +568,7 @@ create table t1 (a bit(7)); insert into t1 values (0x60); select * from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 a a 16 7 1 Y 0 0 63 +def test t1 t1 a a 16 7 1 Y 32 0 63 a ` drop table t1; diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result index 1f6857277bd..c4506231f27 100644 --- a/mysql-test/r/type_bit_innodb.result +++ b/mysql-test/r/type_bit_innodb.result @@ -406,7 +406,7 @@ create table t1 (a bit(7)) engine=innodb; insert into t1 values (0x60); select * from t1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def test t1 t1 a a 16 7 1 Y 0 0 63 +def test t1 t1 a a 16 7 1 Y 32 0 63 a ` drop table t1; diff --git a/sql/field.cc b/sql/field.cc index ec97bc92d24..41b30111488 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7865,6 +7865,7 @@ Field_bit::Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, bit_ptr(bit_ptr_arg), bit_ofs(bit_ofs_arg), bit_len(len_arg & 7), bytes_in_rec(len_arg / 8) { + flags|= UNSIGNED_FLAG; /* Ensure that Field::eq() can distinguish between two different bit fields. (two bit fields that are not null, may have same ptr and null_ptr) @@ -8104,6 +8105,7 @@ Field_bit_as_char::Field_bit_as_char(char *ptr_arg, uint32 len_arg, : Field_bit(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 0, 0, unireg_check_arg, field_name_arg, table_arg) { + flags|= UNSIGNED_FLAG; bit_len= 0; bytes_in_rec= (len_arg + 7) / 8; } From e08238266b73865f365049ee418ef68759b1c9fd Mon Sep 17 00:00:00 2001 From: "iggy@alf." <> Date: Thu, 18 Jan 2007 10:34:50 -0500 Subject: [PATCH 148/160] Bug#25408 5.1 Can't compile on Windows - DBUG_ENTER must be called before assignment on Windows and Netware. --- storage/myisam/mi_packrec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index ba16d2c8c9b..62e3dc363db 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -592,8 +592,8 @@ static uint copy_decode_table(uint16 *to_pos, uint offset, uint16 *decode_table) { uint prev_offset; - prev_offset= offset; DBUG_ENTER("copy_decode_table"); + prev_offset= offset; /* Descent on the left side. */ if (!(*decode_table & IS_CHAR)) From c3ab6de255c2b6b6977606f2f17296026ebb9988 Mon Sep 17 00:00:00 2001 From: "joerg/mysqldev@mysql.com/production.mysql.com" <> Date: Thu, 18 Jan 2007 16:41:32 +0100 Subject: [PATCH 149/160] Raise version number after cloning 4.0.29 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a5b1d4f7277..a59f1e30ab2 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 4.0.29) +AM_INIT_AUTOMAKE(mysql, 4.0.30) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 From ef5f757ac282528c0abc1a93df888e4c1350c467 Mon Sep 17 00:00:00 2001 From: "iggy@recycle.(none)" <> Date: Thu, 18 Jan 2007 11:38:05 -0500 Subject: [PATCH 150/160] Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces - Create space safe strings for system() calls in mysql_upgrade.exe --- client/mysql_upgrade.c | 77 +++++++++++++++++++++++++++++++----------- include/my_sys.h | 2 ++ mysys/string.c | 52 ++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 20 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index cce4b440be0..01e544af972 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -461,7 +461,12 @@ int main(int argc, char **argv) load_defaults("my", load_default_groups, &argc, &argv); - if (handle_options(&argc, &argv, my_long_options, get_one_option)) + /* + Must init_dynamic_string before handle_options because string is freed + at error label. + */ + if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN) || + handle_options(&argc, &argv, my_long_options, get_one_option)) { ret= 1; goto error; @@ -469,11 +474,6 @@ int main(int argc, char **argv) if (tty_password) opt_password= get_tty_password(NullS); - if (init_dynamic_string(&cmdline, NULL, 2 * FN_REFLEN + 128, FN_REFLEN)) - { - ret= 1; - goto error; - } if (!basedir) { my_getwd(path, sizeof(path), MYF(0)); @@ -556,17 +556,34 @@ int main(int argc, char **argv) goto error; } else - dynstr_set(&cmdline, path); + { +#ifdef __WIN__ + /* Windows requires an extra pair of quotes around the entire string. */ + dynstr_set(&cmdline, "\""); +#else + dynstr_set(&cmdline, ""); +#endif /* __WIN__ */ + dynstr_append_os_quoted(&cmdline, path, NullS); + } if (defaults_to_use) { - dynstr_append(&cmdline, " --defaults-extra-file="); - dynstr_append(&cmdline, defaults_to_use); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", + defaults_to_use, NullS); } - - dynstr_append(&cmdline, " --check-upgrade --all-databases" - " --auto-repair --user="); - dynstr_append(&cmdline, user); + + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--all-databases", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--auto-repair", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--user=", user, NullS); +#ifdef __WIN__ + dynstr_append(&cmdline, "\""); +#endif /* __WIN__ */ if (opt_verbose) printf("Running %s\n", cmdline.str); @@ -595,7 +612,15 @@ fix_priv_tables: goto error; } else - dynstr_set(&cmdline, path); + { +#ifdef __WIN__ + /* Windows requires an extra pair of quotes around the entire string. */ + dynstr_set(&cmdline, "\""); +#else + dynstr_set(&cmdline, ""); +#endif /* __WIN__ */ + dynstr_append_os_quoted(&cmdline, path, NullS); + } if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0), path, sizeof(path), @@ -617,13 +642,25 @@ fix_priv_tables: if (defaults_to_use) { - dynstr_append(&cmdline, " --defaults-extra-file="); - dynstr_append(&cmdline, defaults_to_use); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--defaults-extra-file=", + defaults_to_use, NullS); } - dynstr_append(&cmdline, " --force --no-auto-rehash --batch --user="); - dynstr_append(&cmdline, user); - dynstr_append(&cmdline, " mysql < "); - dynstr_append(&cmdline, script_line); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--force", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--no-auto-rehash", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--batch", NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--user=", user, NullS); + dynstr_append(&cmdline, " "); + dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS); + dynstr_append(&cmdline, " < "); + dynstr_append_os_quoted(&cmdline, script_line, NullS); +#ifdef __WIN__ + dynstr_append(&cmdline, "\""); +#endif /* __WIN__ */ if (opt_verbose) printf("Running %s\n", cmdline.str); diff --git a/include/my_sys.h b/include/my_sys.h index d19091a85e8..cbcc6cf7486 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -781,6 +781,8 @@ extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, uint length); +extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, + ...); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size); extern void dynstr_free(DYNAMIC_STRING *str); diff --git a/mysys/string.c b/mysys/string.c index dfd42d137dd..c5657cd430d 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -116,6 +116,58 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, } +/** Concatenates any number of strings, escapes any OS quote in the result then + * surround the whole affair in another set of quotes which is finally appended + * to specified DYNAMIC_STRING. This function is especially useful when + * building strings to be executed with the system() function. + * @param str Dynamic String which will have addtional strings appended. + * @param append String to be appended. + * @param ... Optional. Additional string(s) to be appended. + * + * @note The final argument in the list must be NullS even if no additional + * options are passed. + * + * @return True = Success. + */ +my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) +{ +#ifdef __WIN__ + char quote_str[]= "\""; +#else + char quote_str[]= "\'"; +#endif /* __WIN__ */ + my_bool ret= TRUE; + va_list dirty_text; + + ret&= dynstr_append(str, quote_str); /* Leading quote */ + va_start(dirty_text,append); + while (append != NullS) + { + char *cur_pos= append; + char *next_pos= cur_pos; + + /* Search for quote in each string and replace with escaped quote */ + while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0') + { + char *tmp_buff= my_malloc((next_pos - cur_pos) + 1, MYF(MY_ZEROFILL)); + strnmov(tmp_buff, cur_pos, (next_pos - cur_pos)); + ret&= dynstr_append(str, tmp_buff); + my_free((gptr)tmp_buff, MYF(0)); + + ret&= dynstr_append(str ,"\\"); + ret&= dynstr_append(str, quote_str); + cur_pos= next_pos + 1; + } + ret&= dynstr_append(str, cur_pos); + append= va_arg(dirty_text, char *); + } + va_end(dirty_text); + ret&= dynstr_append(str, quote_str); /* Trailing quote */ + + return ret; +} + + void dynstr_free(DYNAMIC_STRING *str) { if (str->str) From dac5bb381948c651f3a7bb496ddbdb4f619e0465 Mon Sep 17 00:00:00 2001 From: "tsmith@siva.hindu.god" <> Date: Thu, 18 Jan 2007 13:15:16 -0700 Subject: [PATCH 151/160] Makefile.am: Fix previous bad merge. Re-enable the test-ps target. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 0f3d7405856..798d1944fd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -122,6 +122,7 @@ tags: # will then calculate the various port numbers it needs from this, # making sure each user use different ports. +test-ps: @PERL@ ./mysql-test-run.pl $(force) --ps-protocol test-ns: From f5aab8b213d4598c486ff9be5b0c508f18be2fc8 Mon Sep 17 00:00:00 2001 From: "tsmith@siva.hindu.god" <> Date: Thu, 18 Jan 2007 13:26:26 -0700 Subject: [PATCH 152/160] ndb_types.test: sleep a bit longer, to ensure that timestamp > @now --- mysql-test/r/ndb_types.result | 1 + mysql-test/t/ndb_types.test | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/ndb_types.result b/mysql-test/r/ndb_types.result index 5afa9c57e38..6620ddc7c53 100644 --- a/mysql-test/r/ndb_types.result +++ b/mysql-test/r/ndb_types.result @@ -70,3 +70,4 @@ select time_stamp>@now from t1; time_stamp>@now 1 drop table t1; +End of 4.1 tests diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test index 1ca89447892..7b0b4972248 100644 --- a/mysql-test/t/ndb_types.test +++ b/mysql-test/t/ndb_types.test @@ -1,5 +1,5 @@ --- source include/have_ndb.inc --- source include/not_embedded.inc +--source include/have_ndb.inc +--source include/not_embedded.inc --disable_warnings DROP TABLE IF EXISTS t1; @@ -48,7 +48,7 @@ CREATE TABLE t1 ( ); set @now = now(); -sleep 1; +--sleep 1.5 insert into t1 (string,vstring,bin,vbin,tiny,short,medium,long_int,longlong, real_float,real_double, utiny, ushort, umedium,ulong,ulonglong, @@ -64,7 +64,7 @@ from t1; select time_stamp>@now from t1; set @now = now(); -sleep 1; +--sleep 1.5 update t1 set string="bbbb",vstring="bbbb",bin=0xBBBB,vbin=0xBBBB, tiny=-2,short=-2,medium=-2,long_int=-2,longlong=-2,real_float=2.2, real_double=2.2,utiny=2,ushort=2,umedium=2,ulong=2,ulonglong=2, @@ -79,4 +79,4 @@ select time_stamp>@now from t1; drop table t1; -# End of 4.1 tests +--echo End of 4.1 tests From d0a2f4d9b8561003965610b5bff2e5587d58992a Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Thu, 18 Jan 2007 18:02:58 -0500 Subject: [PATCH 153/160] Fix merge problem. --- sql/sql_parse.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 535d314e34e..1b7cf2a342d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2955,10 +2955,10 @@ mysql_execute_command(THD *thd) goto end_with_restore_list; #ifndef HAVE_READLINK - if (create_info.data_file_name) + if (lex->create_info.data_file_name) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, "DATA DIRECTORY option ignored"); - if (create_info.index_file_name) + if (lex->create_info.index_file_name) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, "INDEX DIRECTORY option ignored"); lex->create_info.data_file_name=lex->create_info.index_file_name=0; From ad4253048186ee78a3e2a3b4018fa7dbe8118e19 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Fri, 19 Jan 2007 12:15:44 +0400 Subject: [PATCH 154/160] after merge fix. --- mysql-test/r/select.result | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index b53dfe32ddd..cf84f197c8e 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2816,11 +2816,11 @@ insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), (0x10000000000000000, 0x10000000000000000), (0x8fffffffffffffff, 0x8fffffffffffffff); Warnings: -Warning 1264 Out of range value adjusted for column 'a' at row 1 -Warning 1264 Out of range value adjusted for column 'b' at row 1 -Warning 1264 Out of range value adjusted for column 'a' at row 2 -Warning 1264 Out of range value adjusted for column 'b' at row 2 -Warning 1264 Out of range value adjusted for column 'b' at row 3 +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'b' at row 2 +Warning 1264 Out of range value for column 'b' at row 3 select hex(a), hex(b) from t1; hex(a) hex(b) FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF From 2c60829f3bbf769733dee521501a5a5f760c21e4 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.mysql.com" <> Date: Fri, 19 Jan 2007 11:07:20 +0100 Subject: [PATCH 155/160] Bug #15518 Reusing a stmt that has failed during prepare does not clear error - Additional patch removing check for mysql_errno on already closed mysql1 --- tests/mysql_client_test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 1937f74f797..792f955d729 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -12923,7 +12923,6 @@ static void test_bug15518() DIE_UNLESS(rc && mysql_stmt_errno(stmt)); mysql_stmt_close(stmt); - DIE_UNLESS(mysql_errno(mysql1)); } From 71a292cac1259cb5cd4df1118165c8a998041a76 Mon Sep 17 00:00:00 2001 From: "kaa@polly.local" <> Date: Fri, 19 Jan 2007 14:14:11 +0300 Subject: [PATCH 156/160] Fix for the bug #23814 "mysqlimport crashes" mysqlimport.c declared the opt_use_threads variable as my_bool, but the corresponding option was defined as GET_UINT. The problem only occured on architectures with strict alignment rules. --- client/mysqlimport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 2d0c0188cb0..c9e21de1b2a 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -49,8 +49,8 @@ static char *add_load_option(char *ptr,const char *object, static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0, replace=0,silent=0,ignore=0,opt_compress=0, opt_low_priority= 0, tty_password= 0; -static my_bool opt_use_threads= 0, info_flag= 0; -static uint opt_local_file=0; +static my_bool info_flag= 0; +static uint opt_use_threads=0, opt_local_file=0; static char *opt_password=0, *current_user=0, *current_host=0, *current_db=0, *fields_terminated=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, From a8ff939d83c509142f932872db40c00a0963046a Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 19 Jan 2007 08:56:06 -0500 Subject: [PATCH 157/160] The rpl tree added a test case, and another source added a warning, and combined, they add a platform-specific warning. The warnings are not the goal of the test, in any case. --- mysql-test/t/ps.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 5f00aa60b11..bac7357b163 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1172,7 +1172,9 @@ deallocate prepare stmt2; # test --system rm -f $MYSQLTEST_VARDIR/tmp/t1.* --disable_query_log +--disable_warnings eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; +--enable_warnings --enable_query_log execute stmt; # From 20faa77a5f87e10785ad02566492855711916785 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 19 Jan 2007 10:33:07 -0500 Subject: [PATCH 158/160] Rearrange disable_warnings to enclose the warning emitters properly. --- mysql-test/t/ps.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index bac7357b163..749864c1f59 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1171,10 +1171,9 @@ deallocate prepare stmt2; # Protect ourselves from data left in tmp/ by a previos possibly failed # test --system rm -f $MYSQLTEST_VARDIR/tmp/t1.* ---disable_query_log --disable_warnings +--disable_query_log eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; ---enable_warnings --enable_query_log execute stmt; # @@ -1192,6 +1191,7 @@ execute stmt; --disable_result_log show create table t1; --enable_result_log +--enable_warnings drop table t1; deallocate prepare stmt; From 80e1798521925ca2d72e70615cf3613e3b87bdd4 Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Fri, 19 Jan 2007 11:30:40 -0500 Subject: [PATCH 159/160] Add missing version delimiter. --- mysql-test/t/ps.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index ad0e6405f36..34f9a6fb699 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1118,6 +1118,8 @@ EXECUTE stmt USING @a; DEALLOCATE PREPARE stmt; DROP TABLE t1; +--echo End of 4.1 tests. + ############################# 5.0 tests start ################################ # From d3e6cb6b3b529d01779d8304db94fd9f0c983f2f Mon Sep 17 00:00:00 2001 From: "iggy@recycle.(none)" <> Date: Fri, 19 Jan 2007 13:09:48 -0500 Subject: [PATCH 160/160] Bug#22807 mysql_upgrade fails when called with a basedir-path containing spaces - Corrected compiler warnings and performance problems with new dynstr_append_os_quoted function. --- mysys/string.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/mysys/string.c b/mysys/string.c index c5657cd430d..97a799a82b5 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -132,37 +132,35 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) { #ifdef __WIN__ - char quote_str[]= "\""; + const char *quote_str= "\""; + const uint quote_len= 1; #else - char quote_str[]= "\'"; + const char *quote_str= "\'"; + const uint quote_len= 1; #endif /* __WIN__ */ my_bool ret= TRUE; va_list dirty_text; - ret&= dynstr_append(str, quote_str); /* Leading quote */ - va_start(dirty_text,append); + ret&= dynstr_append_mem(str, quote_str, quote_len); /* Leading quote */ + va_start(dirty_text, append); while (append != NullS) { - char *cur_pos= append; - char *next_pos= cur_pos; + const char *cur_pos= append; + const char *next_pos= cur_pos; /* Search for quote in each string and replace with escaped quote */ while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0') { - char *tmp_buff= my_malloc((next_pos - cur_pos) + 1, MYF(MY_ZEROFILL)); - strnmov(tmp_buff, cur_pos, (next_pos - cur_pos)); - ret&= dynstr_append(str, tmp_buff); - my_free((gptr)tmp_buff, MYF(0)); - - ret&= dynstr_append(str ,"\\"); - ret&= dynstr_append(str, quote_str); + ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str ,"\\", 1); + ret&= dynstr_append_mem(str, quote_str, quote_len); cur_pos= next_pos + 1; } - ret&= dynstr_append(str, cur_pos); + ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); append= va_arg(dirty_text, char *); } va_end(dirty_text); - ret&= dynstr_append(str, quote_str); /* Trailing quote */ + ret&= dynstr_append_mem(str, quote_str, quote_len); /* Trailing quote */ return ret; }