From 7f84f426c8fdb37b660d0f687a03f9a48dc846c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 10 Nov 2007 11:03:07 +0100 Subject: [PATCH 1/4] Adding build scripts for Solaris 10 on AMD64. BUILD/compile-solaris-amd64: Changing build script to be in line with the other build scripts using GCC. BUILD/compile-solaris-amd64-debug: Adding build script for Solaris 10 on AMD64. BUILD/compile-solaris-amd64-forte-debug: Adding build script for Solaris 10 on AMD64. BUILD/compile-solaris-amd64-forte: Adding build script for Solaris 10 on AMD64. --- BUILD/compile-solaris-amd64 | 61 ++++--------------------- BUILD/compile-solaris-amd64-debug | 10 ++++ BUILD/compile-solaris-amd64-forte | 52 +++++++++++++++++++++ BUILD/compile-solaris-amd64-forte-debug | 54 ++++++++++++++++++++++ 4 files changed, 124 insertions(+), 53 deletions(-) create mode 100644 BUILD/compile-solaris-amd64-debug create mode 100644 BUILD/compile-solaris-amd64-forte create mode 100644 BUILD/compile-solaris-amd64-forte-debug diff --git a/BUILD/compile-solaris-amd64 b/BUILD/compile-solaris-amd64 index f128fb12973..9204170b908 100755 --- a/BUILD/compile-solaris-amd64 +++ b/BUILD/compile-solaris-amd64 @@ -1,55 +1,10 @@ -#!/usr/bin/bash - -function _find_mysql_root () ( - while [ "x$PWD" != "x/" ]; do - # Check if some directories are present - if [ -d BUILD -a -d sql -a -d mysys ]; then - echo "$PWD" - return 0 - fi - cd .. - done - return 1 -) - -make -k clean || true -/bin/rm -f */.deps/*.P config.cache - +#! /bin/sh path=`dirname $0` -. "$path/autorun.sh" - -warning_flags="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused" -compiler_flags="-g -O3 -fno-omit-frame-pointer" +. "$path/SETUP.sh" +amd64_cflags="-m64 -mtune=athlon64" +extra_flags="$amd64_cflags $max_cflags" +c_warnings="$c_warnings" +cxx_warnings="$cxx_warnings" +extra_configs="$amd64_configs $debug_configs $max_configs --enable-thread-safe-client" -export CC CXX CFLAGS CXXFLAGS LDFLAGS LIBS -CC="gcc" -CXX="gcc" -CFLAGS="$warning_flags $compiler_flags" -CXXFLAGS="" -LDFLAGS="-O3 -g -static-libgcc" -LIBS=-lmtmalloc -root=$(_find_mysql_root) - -$root/configure \ - --prefix=/usr/local/mysql \ - --localstatedir=/usr/local/mysql/data \ - --libexecdir=/usr/local/mysql/bin \ - --with-extra-charsets=complex \ - --enable-thread-safe-client \ - --enable-local-infile \ - --with-zlib-dir=bundled \ - --with-big-tables \ - --with-readline \ - --with-archive-storage-engine \ - --with-named-curses=-lcurses \ - --with-big-tables \ - --with-innodb \ - --with-berkeley-db \ - --with-example-storage-engine \ - --with-blackhole-storage-engine \ - --with-ndbcluster \ - --with-federated-storage-engine \ - --with-csv-storage-engine \ - --with-ssl \ - --with-embedded-server \ - --disable-shared +. "$path/FINISH.sh" diff --git a/BUILD/compile-solaris-amd64-debug b/BUILD/compile-solaris-amd64-debug new file mode 100644 index 00000000000..ad1c298907f --- /dev/null +++ b/BUILD/compile-solaris-amd64-debug @@ -0,0 +1,10 @@ +#! /bin/sh +path=`dirname $0` +. "$path/SETUP.sh" +amd64_cflags="-m64 -mtune=athlon64" +extra_flags="$amd64_cflags $debug_cflags $max_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$amd64_configs $debug_configs $max_configs --enable-thread-safe-client" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-solaris-amd64-forte b/BUILD/compile-solaris-amd64-forte new file mode 100644 index 00000000000..63aceb16c04 --- /dev/null +++ b/BUILD/compile-solaris-amd64-forte @@ -0,0 +1,52 @@ +#! /bin/sh + +gmake -k clean || true +/bin/rm -f */.deps/*.P config.cache + +path=`dirname $0` +. "$path/autorun.sh" + +# For "optimal" code for this computer add -fast to EXTRA +# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT + +EXTRA_64_BIT="-xarch=amd64" +EXTRA="-fast" + +# +# The following should not need to be touched +# + +export CC CXX CFLAGS CXXFLAGS +STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT" +ASFLAGS="$EXTRA_64_BIT" +CC=cc-5.0 +CFLAGS="-Xa -xstrconst $STD" +CXX=CC +CXXFLAGS="-noex $STD" +./configure \ + --prefix=/usr/local/mysql \ + --localstatedir=/usr/local/mysql/data \ + --libexecdir=/usr/local/mysql/bin \ + --with-extra-charsets=complex \ + --enable-thread-safe-client \ + --enable-local-infile \ + --with-zlib-dir=bundled \ + --with-big-tables \ + --with-readline \ + --with-archive-storage-engine \ + --with-named-curses=-lcurses \ + --with-big-tables \ + --with-innodb \ + --with-example-storage-engine \ + --with-blackhole-storage-engine \ + --with-federated-storage-engine \ + --with-csv-storage-engine \ + --with-ssl \ + --enable-assembler + +# Not including: +# --with-ndbcluster +# --with-berkeley-db + +gmake -j4 +test $? = 0 && make test diff --git a/BUILD/compile-solaris-amd64-forte-debug b/BUILD/compile-solaris-amd64-forte-debug new file mode 100644 index 00000000000..8e3ade9b429 --- /dev/null +++ b/BUILD/compile-solaris-amd64-forte-debug @@ -0,0 +1,54 @@ +#! /bin/sh + +gmake -k clean || true +/bin/rm -f */.deps/*.P config.cache + +path=`dirname $0` +. "$path/autorun.sh" + +# To compile 64 bit, add -xarch=amd64 to EXTRA_64_BIT +EXTRA_64_BIT="-xarch=amd64" + +# For "optimal" code for this computer add -fast to EXTRA. Note that +# this causes problem with debugging the program since -fast implies +# -xO5. +EXTRA="" + +# +# The following should not need to be touched +# + +export CC CXX CFLAGS CXXFLAGS +STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT $debug_cflags" +ASFLAGS="$EXTRA_64_BIT" +CC=cc-5.0 +CFLAGS="-Xa -xstrconst $STD" +CXX=CC +CXXFLAGS="-noex $STD" +./configure \ + --prefix=/usr/local/mysql \ + --localstatedir=/usr/local/mysql/data \ + --libexecdir=/usr/local/mysql/bin \ + --with-extra-charsets=complex \ + --enable-thread-safe-client \ + --enable-local-infile \ + --with-zlib-dir=bundled \ + --with-big-tables \ + --with-readline \ + --with-archive-storage-engine \ + --with-named-curses=-lcurses \ + --with-big-tables \ + --with-innodb \ + --with-example-storage-engine \ + --with-blackhole-storage-engine \ + --with-federated-storage-engine \ + --with-csv-storage-engine \ + --with-ssl \ + --with-debug \ + --enable-assembler + +# Not including: +# --with-ndbcluster +# --with-berkeley-db + +gmake -j4 From df35f2c353c4453f3b5dbe56bb6ef4935312ffb7 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Dec 2007 13:11:40 +0800 Subject: [PATCH 2/4] Bug#30998 Drop View breaks replication if view does not exist When executing drop view statement on the master, the statement is written into bin-log without checking for possible errors, so the statement would always be bin-logged with error code cleared even if some error might occur, for example, some of the views being dropped does not exist. This would cause failure on the slave. Writing bin-log after check for errors, if at least one view has been dropped the query is bin-logged possible with an error. sql/sql_view.cc: Writing bin-log after check for errors, if at least one view has been dropped the query is bin-logged possible with an error. mysql-test/r/rpl_drop_view.result: Add test result for bug#30998 mysql-test/t/rpl_drop_view.test: Add test for bug#30998 --- mysql-test/r/rpl_drop_view.result | 27 ++++++++++++++++++++++++ mysql-test/t/rpl_drop_view.test | 31 ++++++++++++++++++++++++++++ sql/sql_view.cc | 34 ++++++++++++++++++------------- 3 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 mysql-test/r/rpl_drop_view.result create mode 100644 mysql-test/t/rpl_drop_view.test diff --git a/mysql-test/r/rpl_drop_view.result b/mysql-test/r/rpl_drop_view.result new file mode 100644 index 00000000000..ef625464881 --- /dev/null +++ b/mysql-test/r/rpl_drop_view.result @@ -0,0 +1,27 @@ +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, t2; +drop view if exists v1, v2, v3, not_exist_view; +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +drop view not_exist_view; +ERROR 42S02: Unknown table 'not_exist_view' +drop view v1, not_exist_view; +ERROR 42S02: Unknown table 'not_exist_view' +select * from v1; +ERROR 42S02: Table 'test.v1' doesn't exist +drop view v2, v3; +select * from v1; +ERROR 42S02: Table 'test.v1' doesn't exist +select * from v2; +ERROR 42S02: Table 'test.v2' doesn't exist +select * from v3; +ERROR 42S02: Table 'test.v3' doesn't exist diff --git a/mysql-test/t/rpl_drop_view.test b/mysql-test/t/rpl_drop_view.test new file mode 100644 index 00000000000..8d826b8214d --- /dev/null +++ b/mysql-test/t/rpl_drop_view.test @@ -0,0 +1,31 @@ +# test case for bug#30998 +# Drop View breaks replication if view does not exist +# + +source include/master-slave.inc; +--disable_warnings +drop table if exists t1, t2; +drop view if exists v1, v2, v3, not_exist_view; +--enable_warnings +create table t1 (a int); +create table t2 (b int); +create table t3 (c int); +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +--error 1051 +drop view not_exist_view; +--error 1051 +drop view v1, not_exist_view; +--error 1146 +select * from v1; +drop view v2, v3; +save_master_pos; +connection slave; +sync_with_master; +--error 1146 +select * from v1; +--error 1146 +select * from v2; +--error 1146 +select * from v3; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 297edd0d90d..dd0b92a06f8 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1424,6 +1424,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) String non_existant_views; char *wrong_object_db= NULL, *wrong_object_name= NULL; bool error= FALSE; + bool some_views_deleted= FALSE; + bool something_wrong= FALSE; VOID(pthread_mutex_lock(&LOCK_open)); for (view= views; view; view= view->next_local) @@ -1462,33 +1464,37 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) } if (my_delete(path, MYF(MY_WME))) error= TRUE; + some_views_deleted= TRUE; query_cache_invalidate3(thd, view, 0); sp_cache_invalidate(); } - if (mysql_bin_log.is_open()) + + if (wrong_object_name) { - thd->clear_error(); + my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name, + "VIEW"); + } + if (non_existant_views.length()) + { + my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr()); + } + + something_wrong= error || wrong_object_name || non_existant_views.length(); + if (some_views_deleted || !something_wrong) + { + if (!something_wrong) + thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); mysql_bin_log.write(&qinfo); } VOID(pthread_mutex_unlock(&LOCK_open)); - if (error) + if (something_wrong) { DBUG_RETURN(TRUE); } - if (wrong_object_name) - { - my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name, - "VIEW"); - DBUG_RETURN(TRUE); - } - if (non_existant_views.length()) - { - my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr()); - DBUG_RETURN(TRUE); - } + send_ok(thd); DBUG_RETURN(FALSE); } From c4faf61acd405231954943548de200c9dce78101 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Dec 2007 12:26:21 +0400 Subject: [PATCH 3/4] sql_string.cc: Fixing a wrong comment. sql/sql_string.cc: Fixing a wrong comment. --- sql/sql_string.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 9d7df73cd7a..278130db7bb 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -307,8 +307,8 @@ bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset, return TRUE; /* - Note, this is only safe for little-endian UCS-2. - If we add big-endian UCS-2 sometimes, this code + Note, this is only safe for big-endian UCS-2. + If we add little-endian UCS-2 sometimes, this code will be more complicated. But it's OK for now. */ bzero((char*) Ptr, offset); From 590350633c23d3d986e9d3c8745aa8f0bbb78105 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 15 Dec 2007 19:50:23 +0800 Subject: [PATCH 4/4] BUG#32205 Replaying statements from mysqlbinlog fails with a syntax error, replicates fine The reason of this bug is that when mysqlbinlog dumps a query, the query is written to output with a delimeter appended right after it, if the query string ends with a '--' comment, then the delimeter would be considered as part of the comment, if there are any statements after this query, then it will cause a syntax error. Start a newline before appending delimiter after a query string mysql-test/r/ctype_ucs_binlog.result: Update test result for BUG#32205 mysql-test/r/mix_innodb_myisam_binlog.result: Update test result for BUG#32205 mysql-test/r/mysqlbinlog.result: Update test result for BUG#32205 mysql-test/r/rpl_charset.result: Update test result for BUG#32205 mysql-test/r/rpl_timezone.result: Update test result for BUG#32205 mysql-test/r/user_var-binlog.result: Update test result for BUG#32205 mysql-test/t/mix_innodb_myisam_binlog.test: Fixed for BUG#32205 sql/log_event.cc: Start a newline before appending delimiter after a query string mysql-test/r/binlog_start_comment.result: Add test for BUG#32205 mysql-test/t/binlog_start_comment.test: Add test for BUG#32205 --- mysql-test/r/binlog_start_comment.result | 13 +++ mysql-test/r/ctype_ucs_binlog.result | 3 +- mysql-test/r/mix_innodb_myisam_binlog.result | 4 +- mysql-test/r/mysqlbinlog.result | 108 ++++++++++++------- mysql-test/r/rpl_charset.result | 69 ++++++++---- mysql-test/r/rpl_timezone.result | 18 ++-- mysql-test/r/user_var-binlog.result | 6 +- mysql-test/t/binlog_start_comment.test | 16 +++ mysql-test/t/mix_innodb_myisam_binlog.test | 2 +- sql/log_event.cc | 6 +- 10 files changed, 171 insertions(+), 74 deletions(-) create mode 100644 mysql-test/r/binlog_start_comment.result create mode 100644 mysql-test/t/binlog_start_comment.test diff --git a/mysql-test/r/binlog_start_comment.result b/mysql-test/r/binlog_start_comment.result new file mode 100644 index 00000000000..615c8ce695b --- /dev/null +++ b/mysql-test/r/binlog_start_comment.result @@ -0,0 +1,13 @@ +drop table if exists t1,t2; +create table t1 (word varchar(20)) -- create table t1; +create table t2 (word varchar(20)) -- create table t2; +load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; +insert into t2 values ("Ada"); +flush logs; +select * from t2; +word +Ada +flush logs; +select * from t2; +word +Ada diff --git a/mysql-test/r/ctype_ucs_binlog.result b/mysql-test/r/ctype_ucs_binlog.result index 2657bf60c04..721a1ae51b7 100644 --- a/mysql-test/r/ctype_ucs_binlog.result +++ b/mysql-test/r/ctype_ucs_binlog.result @@ -18,7 +18,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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)/*!*/; +insert into t2 values (@v) +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 89ee82e9655..fb69de508dc 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -275,9 +275,9 @@ is not null; is not null 1 select -@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", +@a like "%#%error_code=0%ROLLBACK\n/*!*/;%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\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; create temporary table tt (a int unique); diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 9f001c293de..ffaba7f7c42 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -23,24 +23,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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,t4,t5,t03,t04/*!*/; +drop table if exists t1,t2,t3,t4,t5,t03,t04 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create table t1 (word varchar(20))/*!*/; +create table t1 (word varchar(20)) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create table t2 (id int auto_increment not null primary key)/*!*/; +create table t2 (id int auto_increment not null primary key) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 values ("abirvalg")/*!*/; +insert into t1 values ("abirvalg") +/*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t2 values ()/*!*/; +insert into t2 values () +/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-0' INTO table t1/*!*/; +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/*!*/; +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/*!*/; +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/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-0' INTO table t1 +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -56,7 +65,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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")/*!*/; +insert into t1 values ("Alas") +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -83,7 +93,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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")/*!*/; +insert into t1 values ("Alas") +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -100,24 +111,33 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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,t4,t5,t03,t04/*!*/; +drop table if exists t1,t2,t3,t4,t5,t03,t04 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create table t1 (word varchar(20))/*!*/; +create table t1 (word varchar(20)) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create table t2 (id int auto_increment not null primary key)/*!*/; +create table t2 (id int auto_increment not null primary key) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 values ("abirvalg")/*!*/; +insert into t1 values ("abirvalg") +/*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t2 values ()/*!*/; +insert into t2 values () +/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-1-2' INTO table t1/*!*/; +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/*!*/; +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/*!*/; +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/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-4-2' INTO table t1 +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -133,7 +153,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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")/*!*/; +insert into t1 values ("Alas") +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -160,7 +181,8 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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")/*!*/; +insert into t1 values ("Alas") +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -173,9 +195,11 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; -BEGIN/*!*/; +BEGIN +/*!*/; SET TIMESTAMP=1108844555/*!*/; -insert t1 values (1)/*!*/; +insert t1 values (1) +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -185,9 +209,11 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; -BEGIN/*!*/; +BEGIN +/*!*/; SET TIMESTAMP=1108844555/*!*/; -insert t1 values (1)/*!*/; +insert t1 values (1) +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -245,7 +271,8 @@ SET @@session.character_set_client=8,@@session.collation_connection=8,@@session. CREATE DEFINER=`root`@`localhost` procedure p1() begin select 1; -end/*!*/; +end +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -287,27 +314,36 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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 varchar(64) character set utf8)/*!*/; +create table t1 (a varchar(64) character set utf8) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/; +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r +/*!*/; SET TIMESTAMP=1000000000/*!*/; -drop table t1/*!*/; +drop table t1 +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index 4b6d9f44a2b..c77818d34ee 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -183,78 +183,101 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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/*!*/; +drop database if exists mysqltest2 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -drop database if exists mysqltest3/*!*/; +drop database if exists mysqltest3 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create database mysqltest2 character set latin2/*!*/; +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/*!*/; +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/*!*/; +drop database mysqltest3 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -create database mysqltest3/*!*/; +create database mysqltest3 +/*!*/; use mysqltest2/*!*/; SET TIMESTAMP=1000000000/*!*/; -create table t1 (a int auto_increment primary key, b varchar(100))/*!*/; +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)/*!*/; +insert into t1 (b) values(@@character_set_server) +/*!*/; SET INSERT_ID=2/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(@@collation_server)/*!*/; +insert into t1 (b) values(@@collation_server) +/*!*/; SET INSERT_ID=3/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(@@character_set_client)/*!*/; +insert into t1 (b) values(@@character_set_client) +/*!*/; SET INSERT_ID=4/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(@@character_set_connection)/*!*/; +insert into t1 (b) values(@@character_set_connection) +/*!*/; SET INSERT_ID=5/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(@@collation_connection)/*!*/; +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/*!*/; +truncate table t1 +/*!*/; SET INSERT_ID=1/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(@@collation_connection)/*!*/; +insert into t1 (b) values(@@collation_connection) +/*!*/; SET INSERT_ID=2/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(LEAST("Müller","Muffler"))/*!*/; +insert into t1 (b) values(LEAST("Müller","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)/*!*/; +insert into t1 (b) values(@@collation_connection) +/*!*/; SET INSERT_ID=4/*!*/; SET TIMESTAMP=1000000000/*!*/; -insert into t1 (b) values(LEAST("Müller","Muffler"))/*!*/; +insert into t1 (b) values(LEAST("Müller","Muffler")) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -truncate table t1/*!*/; +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))/*!*/; +insert into t1 (b) values(collation(@a)) +/*!*/; SET TIMESTAMP=1000000000/*!*/; -drop database mysqltest2/*!*/; +drop database mysqltest2 +/*!*/; SET TIMESTAMP=1000000000/*!*/; -drop database mysqltest3/*!*/; +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))/*!*/; +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 ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ')/*!*/; +INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ') +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result index 7a18a26afd3..7a5d09ea6a7 100644 --- a/mysql-test/r/rpl_timezone.result +++ b/mysql-test/r/rpl_timezone.result @@ -52,20 +52,26 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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)/*!*/; +create table t1 (t timestamp) +/*!*/; SET TIMESTAMP=100000000/*!*/; -create table t2 (t char(32))/*!*/; +create table t2 (t char(32)) +/*!*/; SET TIMESTAMP=100000000/*!*/; SET @@session.time_zone='Europe/Moscow'/*!*/; -insert into t1 values ('20050101000000'), ('20050611093902')/*!*/; +insert into t1 values ('20050101000000'), ('20050611093902') +/*!*/; SET TIMESTAMP=100000000/*!*/; SET @@session.time_zone='UTC'/*!*/; -insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; +insert into t1 values ('20040101000000'), ('20040611093902') +/*!*/; SET TIMESTAMP=100000000/*!*/; -delete from t1/*!*/; +delete from t1 +/*!*/; SET TIMESTAMP=100000000/*!*/; SET @@session.time_zone='Europe/Moscow'/*!*/; -insert into t1 values ('20040101000000'), ('20040611093902')/*!*/; +insert into t1 values ('20040101000000'), ('20040611093902') +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 2b37a4b1d9a..b8df68b8f28 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -24,11 +24,13 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq 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`)/*!*/; +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)/*!*/; +insert into t1 values (@var1),(@var2) +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/t/binlog_start_comment.test b/mysql-test/t/binlog_start_comment.test new file mode 100644 index 00000000000..fe04af6077e --- /dev/null +++ b/mysql-test/t/binlog_start_comment.test @@ -0,0 +1,16 @@ +# Test case for bug#32205 Replaying statements from mysqlbinlog fails +# with a syntax error, replicates fine + +-- source include/have_log_bin.inc +--disable_warnings +drop table if exists t1,t2; +--enable_warnings +create table t1 (word varchar(20)) -- create table t1; +create table t2 (word varchar(20)) -- create table t2; +load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1; +insert into t2 values ("Ada"); +flush logs; +select * from t2; +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL +flush logs; +select * from t2; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index e0ce802254a..84151032f40 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -262,7 +262,7 @@ 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\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; diff --git a/sql/log_event.cc b/sql/log_event.cc index d22973d12a3..965dfb5f5cf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1862,7 +1862,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)); - fprintf(file, "%s\n", print_event_info->delimiter); + fprintf(file, "\n%s\n", print_event_info->delimiter); } #endif /* MYSQL_CLIENT */ @@ -5180,12 +5180,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, "%s\n", print_event_info->delimiter); + fprintf(file, "\n%s\n", print_event_info->delimiter); } else { my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME)); - fprintf(file, "%s\n", print_event_info->delimiter); + fprintf(file, "\n%s\n", print_event_info->delimiter); } if (!print_event_info->short_form)