From e291aab7da9587f742291e7cc5e10e568846066e Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Tue, 21 Oct 2008 14:18:38 +0200 Subject: Bug#39451 Debug builds broken with Sun Studio compiler Debug builds of MySQL 5.1, 6.0 with Sun Studio 12 broke because of use of gcc specific feature. The fix is to replace __FUNCTION__ with the corresponding character string --- sql/log.cc | 2 +- sql/sql_class.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 8ab2e892b27..fb8669a5731 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3779,7 +3779,7 @@ THD::binlog_set_pending_rows_event(Rows_log_event* ev) int MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd) { - DBUG_ENTER(__FUNCTION__); + DBUG_ENTER("MYSQL_BIN_LOG::remove_pending_rows_event"); binlog_trx_data *const trx_data= (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index abbb2de0a82..e63eed2d23c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3513,7 +3513,7 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans, int THD::binlog_remove_pending_rows_event(bool clear_maps) { - DBUG_ENTER(__FUNCTION__); + DBUG_ENTER("THD::binlog_remove_pending_rows_event"); if (!mysql_bin_log.is_open()) DBUG_RETURN(0); -- cgit v1.2.1 From bf5a6dcc6967845786ff58a9485b9f25c505fe9f Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Wed, 22 Oct 2008 16:00:45 +0200 Subject: BUG#39812: Make statement replication default for 5.1 (to match 5.0) Added test case to check the default value of @@binlog_format. mysql-test/t/binlog_format_basic.test: Added test case to verify the default binlog_format: it should be STATEMENT in 5.1 and MIXED in 6.0. --- mysql-test/r/binlog_format_basic.result | 3 +++ mysql-test/t/binlog_format_basic.test | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/mysql-test/r/binlog_format_basic.result b/mysql-test/r/binlog_format_basic.result index 3fee9bade7e..72ba35cd753 100644 --- a/mysql-test/r/binlog_format_basic.result +++ b/mysql-test/r/binlog_format_basic.result @@ -1,3 +1,6 @@ +SELECT @@GLOBAL.binlog_format; +@@GLOBAL.binlog_format +STATEMENT '#---------------------BS_STVARS_002_01----------------------#' SELECT COUNT(@@GLOBAL.binlog_format); COUNT(@@GLOBAL.binlog_format) diff --git a/mysql-test/t/binlog_format_basic.test b/mysql-test/t/binlog_format_basic.test index e9dfade8f56..819ad047c1b 100644 --- a/mysql-test/t/binlog_format_basic.test +++ b/mysql-test/t/binlog_format_basic.test @@ -22,6 +22,13 @@ # # ############################################################################### +################################################################### +# BUG#39812: Make statement replication default for 5.1 (to match 5.0) +# We just verify that the default binlog_format is STATEMENT in 5.1. +# In 6.0, it should be MIXED. +################################################################### +SELECT @@GLOBAL.binlog_format; + --echo '#---------------------BS_STVARS_002_01----------------------#' #################################################################### # Displaying default value # -- cgit v1.2.1 From 256f41edfe87bf92807d9c9500ae627a0045ef5e Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Fri, 24 Oct 2008 13:00:03 +0500 Subject: Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1 Problem: mysqld doesn't detect that enum data must be reinserted performing 'ALTER TABLE' in some cases. Fix: reinsert data altering an enum field if enum values are changed. mysql-test/r/alter_table.result: Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1 - test result. mysql-test/t/alter_table.test: Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1 - test case. sql/field.cc: Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1 - Field_enum::is_equal() introduced, which is called to detect that a field is changing by 'ALTER TABLE'. sql/field.h: Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1 - Field_enum::is_equal() introduced, which is called to detect that a field is changing by 'ALTER TABLE'. --- mysql-test/r/alter_table.result | 12 ++++++++++++ mysql-test/t/alter_table.test | 12 ++++++++++++ sql/field.cc | 35 +++++++++++++++++++++++++---------- sql/field.h | 2 ++ 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index d6986f4a956..c6be8f243fc 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1222,4 +1222,16 @@ ALTER TABLE t1 CHANGE d c varchar(10); affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; +CREATE TABLE t1(a INT AUTO_INCREMENT PRIMARY KEY, +b ENUM('a', 'b', 'c') NOT NULL); +INSERT INTO t1 (b) VALUES ('a'), ('c'), ('b'), ('b'), ('a'); +ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL; +SELECT * FROM t1; +a b +1 a +2 c +3 b +4 b +5 a +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 662f9095810..c45c89095fa 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -947,4 +947,16 @@ ALTER TABLE t1 CHANGE d c varchar(10); --disable_info DROP TABLE t1; + +# +# Bug #23113: Different behavior on altering ENUM fields between 5.0 and 5.1 +# +CREATE TABLE t1(a INT AUTO_INCREMENT PRIMARY KEY, + b ENUM('a', 'b', 'c') NOT NULL); +INSERT INTO t1 (b) VALUES ('a'), ('c'), ('b'), ('b'), ('a'); +ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL; +SELECT * FROM t1; +DROP TABLE t1; + + --echo End of 5.1 tests diff --git a/sql/field.cc b/sql/field.cc index 16bf0fdb070..a03beb4e8af 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8783,28 +8783,43 @@ bool Field::eq_def(Field *field) return 1; } + /** @return returns 1 if the fields are equally defined */ + bool Field_enum::eq_def(Field *field) { if (!Field::eq_def(field)) return 0; - TYPELIB *from_lib=((Field_enum*) field)->typelib; + return compare_enum_values(((Field_enum*) field)->typelib); +} - if (typelib->count < from_lib->count) - return 0; - for (uint i=0 ; i < from_lib->count ; i++) + +bool Field_enum::compare_enum_values(TYPELIB *values) +{ + if (typelib->count != values->count) + return FALSE; + for (uint i= 0; i < typelib->count; i++) if (my_strnncoll(field_charset, - (const uchar*)typelib->type_names[i], - strlen(typelib->type_names[i]), - (const uchar*)from_lib->type_names[i], - strlen(from_lib->type_names[i]))) - return 0; - return 1; + (const uchar*) typelib->type_names[i], + typelib->type_lengths[i], + (const uchar*) values->type_names[i], + values->type_lengths[i])) + return FALSE; + return TRUE; +} + + +uint Field_enum::is_equal(Create_field *new_field) +{ + if (!Field_str::is_equal(new_field)) + return 0; + return compare_enum_values(new_field->interval); } + /** @return returns 1 if the fields are equally defined diff --git a/sql/field.h b/sql/field.h index aa69fea6bdd..81905cc64ae 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1853,6 +1853,8 @@ public: CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; } private: int do_save_field_metadata(uchar *first_byte); + bool compare_enum_values(TYPELIB *values); + uint is_equal(Create_field *new_field); }; -- cgit v1.2.1