Loading client/mysqlbinlog.cc +27 −11 Original line number Diff line number Diff line Loading @@ -93,8 +93,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, ...); Loading Loading @@ -949,8 +951,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; } Loading Loading @@ -1015,11 +1031,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; Loading Loading @@ -1142,7 +1158,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; Loading @@ -1161,7 +1177,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); Loading Loading @@ -1287,11 +1303,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; Loading Loading @@ -1363,7 +1379,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; Loading include/my_pthread.h +20 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,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 Loading mysql-test/r/ctype_cp932_binlog.result +3 −3 Original line number Diff line number Diff line Loading @@ -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 mysql-test/r/ctype_ucs_binlog.result +11 −9 Original line number Diff line number Diff line Loading @@ -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*/; Loading mysql-test/r/ctype_utf8.result +23 −1 Original line number Diff line number Diff line Loading @@ -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")` varbinary(10) 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") 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''); Loading Loading
client/mysqlbinlog.cc +27 −11 Original line number Diff line number Diff line Loading @@ -93,8 +93,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, ...); Loading Loading @@ -949,8 +951,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; } Loading Loading @@ -1015,11 +1031,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; Loading Loading @@ -1142,7 +1158,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; Loading @@ -1161,7 +1177,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); Loading Loading @@ -1287,11 +1303,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; Loading Loading @@ -1363,7 +1379,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; Loading
include/my_pthread.h +20 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,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 Loading
mysql-test/r/ctype_cp932_binlog.result +3 −3 Original line number Diff line number Diff line Loading @@ -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
mysql-test/r/ctype_ucs_binlog.result +11 −9 Original line number Diff line number Diff line Loading @@ -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*/; Loading
mysql-test/r/ctype_utf8.result +23 −1 Original line number Diff line number Diff line Loading @@ -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")` varbinary(10) 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") 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''); Loading