From f4e881999aebe77c28db2cf88a7728669a8d3a11 Mon Sep 17 00:00:00 2001 From: "mats@capulet.net" <> Date: Sat, 10 Nov 2007 11:03:07 +0100 Subject: [PATCH 1/3] Adding build scripts 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 c267a923a3c971689f5600879ed5aec3ae0bf3fe Mon Sep 17 00:00:00 2001 From: "hezx@hezx.(none)" <> Date: Mon, 3 Dec 2007 13:11:40 +0800 Subject: [PATCH 2/3] 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. --- 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 25debb1db6af54481a57ff29f584930864f37acd Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.myoffice.izhnet.ru" <> Date: Wed, 5 Dec 2007 12:26:21 +0400 Subject: [PATCH 3/3] 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);