From e82647cd9cd67955d25406ecd37addeace4ba079 Mon Sep 17 00:00:00 2001 From: "dean@mysql.com" <> Date: Wed, 28 Sep 2005 19:03:35 -0500 Subject: [PATCH 01/13] Fix for BUG#13582. Theoretically possible to try to overallocate RAM in some fulltext queries. --- myisam/ft_nlq_search.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 7a506fd11c6..8460db61a36 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -266,7 +266,8 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, so if ndocs == 0, FT_INFO.doc[] must not be accessed. */ dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+ - sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1), + sizeof(FT_DOC)* + (int)(aio.dtree.elements_in_tree-1), MYF(0)); if (!dlist) goto err; From 90414dcaaf988e547c920a7ac3e6d722015f43a8 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Sat, 1 Oct 2005 11:56:01 +0400 Subject: [PATCH 02/13] BUG#13484: In ha_innobase::cmp_ref call Field::key_cmp() as this is the function that compares key images. --- mysql-test/r/index_merge_innodb.result | 57 ++++++++++++++++++++++++++ mysql-test/r/rowid_order_innodb.result | 2 +- mysql-test/t/index_merge_innodb.test | 44 ++++++++++++++++++++ sql/ha_innodb.cc | 2 +- 4 files changed, 103 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 81e5fa6767d..4dac5f3b62b 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -203,3 +203,60 @@ oid fk_bbk_niederlassung fk_wochentag uhrzeit_von uhrzeit_bis geloescht version 21 7 1 08:00:00 13:00:00 0 1 drop view v1; drop table t1; +CREATE TABLE t1( +t_cpac varchar(2) NOT NULL, +t_vers varchar(4) NOT NULL, +t_rele varchar(2) NOT NULL, +t_cust varchar(4) NOT NULL, +filler1 char(250) default NULL, +filler2 char(250) default NULL, +PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust), +UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele), +KEY IX_5 (t_vers,t_rele,t_cust) +) ENGINE=InnoDB; +insert into t1 values +('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''), +('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''), +('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''), +('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''), +('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''), +('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''), +('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''), +('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''), +('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''), +('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''), +('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''), +('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''), +('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''), +('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''), +('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''), +('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''), +('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''), +('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''), +('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''), +('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''), +('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''), +('wh','B61U','a ','stnd','',''); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t_cpac` varchar(2) NOT NULL, + `t_vers` varchar(4) NOT NULL, + `t_rele` varchar(2) NOT NULL, + `t_cust` varchar(4) NOT NULL, + `filler1` char(250) default NULL, + `filler2` char(250) default NULL, + PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`), + UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`), + KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'; +t_vers t_rele t_cust filler1 +7.6 a +7.6 a +select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6' + and t_rele='a' and t_cust = ' '; +t_vers t_rele t_cust filler1 +7.6 a +7.6 a +drop table t1; diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result index d55029f9064..f76002e9cb2 100644 --- a/mysql-test/r/rowid_order_innodb.result +++ b/mysql-test/r/rowid_order_innodb.result @@ -178,9 +178,9 @@ insert into t1 values ('','empt',2,2), ('dddd','d--d',2,2); select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; pk1 pk2 key1 key2 + empt 2 2 a a--a 2 2 bb b--b 2 2 ccc c--c 2 2 dddd d--d 2 2 - empt 2 2 drop table t1; diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index 3ed7d44981b..a48626a9ec3 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -204,3 +204,47 @@ and (zeit1.geloescht = 0); select * from v1 where oid = 21; drop view v1; drop table t1; +## +CREATE TABLE t1( + t_cpac varchar(2) NOT NULL, + t_vers varchar(4) NOT NULL, + t_rele varchar(2) NOT NULL, + t_cust varchar(4) NOT NULL, + filler1 char(250) default NULL, + filler2 char(250) default NULL, + PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust), + UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele), + KEY IX_5 (t_vers,t_rele,t_cust) +) ENGINE=InnoDB; + +insert into t1 values +('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''), +('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''), +('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''), +('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''), +('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''), +('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''), +('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''), +('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''), +('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''), +('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''), +('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''), +('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''), +('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''), +('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''), +('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''), +('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''), +('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''), +('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''), +('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''), +('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''), +('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''), +('wh','B61U','a ','stnd','',''); +show create table t1; + +select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'; +select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6' + and t_rele='a' and t_cust = ' '; + +drop table t1; + diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index de458785534..4119d5a2bad 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -7030,7 +7030,7 @@ ha_innobase::cmp_ref( (const char*)ref1, len1, (const char*)ref2, len2); } else { - result = field->cmp((const char*)ref1, + result = field->key_cmp((const char*)ref1, (const char*)ref2); } From fbc621e545e9134cd828e31f6ed4152622e06c90 Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Thu, 6 Oct 2005 19:51:08 +0500 Subject: [PATCH 03/13] Fix for bug#13605 'rpl_openssl' test hangs --- mysql-test/r/rpl_openssl.result | 6 +++--- mysql-test/t/rpl_openssl.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result index ad7251fd631..6c027c136d5 100644 --- a/mysql-test/r/rpl_openssl.result +++ b/mysql-test/r/rpl_openssl.result @@ -4,7 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -grant replication slave on *.* to replssl@'%' require ssl; +grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); stop slave; change master to master_user='replssl',master_password=''; @@ -20,11 +20,11 @@ t 1 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 289 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 289 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # +# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 295 slave-relay-bin.000001 108 master-bin.000001 Yes Yes 0 0 295 108 None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; drop table t1; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 337 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 337 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 343 slave-relay-bin.000001 96 master-bin.000001 Yes Yes 0 0 343 96 None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_openssl.test index a9138d1d46a..83a3a340e6d 100644 --- a/mysql-test/t/rpl_openssl.test +++ b/mysql-test/t/rpl_openssl.test @@ -7,7 +7,7 @@ source include/master-slave.inc; # creating replication user for whom ssl auth is required # preparing playground connection master; -grant replication slave on *.* to replssl@'%' require ssl; +grant replication slave on *.* to replssl@localhost require ssl; create table t1 (t int); save_master_pos; From 52181cc810ecf3d2103d7782055c14b7157aabcb Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Thu, 6 Oct 2005 18:00:23 +0200 Subject: [PATCH 04/13] make_binary_distribution.sh: Replaced --machine with --platform General code cleanup --- scripts/make_binary_distribution.sh | 220 +++++++++++++--------------- 1 file changed, 102 insertions(+), 118 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 3b8cc1ca12a..28db9eb249d 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -1,54 +1,50 @@ #!/bin/sh -# The default path should be /usr/local -# Get some info from configure -# chmod +x ./scripts/setsomevars +# This is a script to create a TAR or ZIP binary distribution out of a +# built source tree. The output file will be put at the top level of +# the source tree, as "mysql-....{tar.gz,zip}" +# +# The temporary directory path given to "--tmp=" has to be +# absolute and with no spaces. machine=@MACHINE_TYPE@ system=@SYSTEM_TYPE@ version=@VERSION@ -export machine system version -SOURCE=`pwd` +SOURCE=`pwd` CP="cp -p" MV="mv" STRIP=1 DEBUG=0 SILENT=0 -MACHINE= +PLATFORM="$system-$machine" TMP=/tmp SUFFIX="" NDBCLUSTER= -parse_arguments() { - for arg do - case "$arg" in - --debug) DEBUG=1;; - --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; - --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; - --no-strip) STRIP=0 ;; - --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;; - --silent) SILENT=1 ;; - --with-ndbcluster) NDBCLUSTER=1 ;; - *) - echo "Unknown argument '$arg'" - exit 1 - ;; - esac - done -} +for arg do + case "$arg" in + --debug) DEBUG=1;; + --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; + --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; + --no-strip) STRIP=0 ;; + --platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;; + --silent) SILENT=1 ;; + --with-ndbcluster) NDBCLUSTER=1 ;; + *) + echo "Unknown argument '$arg'" + exit 1 + ;; + esac +done -parse_arguments "$@" - -#make - -# This should really be integrated with automake and not duplicate the +# FIXME This should really be integrated with automake and not duplicate the # installation list. BASE=$TMP/my_dist$SUFFIX if [ -d $BASE ] ; then - rm -r -f $BASE + rm -rf $BASE fi BS="" @@ -77,23 +73,26 @@ if [ $BASE_SYSTEM != "netware" ] ; then chmod o-rwx $BASE/data $BASE/data/* fi -for i in ChangeLog \ - Docs/mysql.info -do - if [ -f $i ] - then - $CP $i $BASE/docs - fi -done +# Copy files if they exists, warn for those that don't +copyfileto() +{ + destdir=$1 + shift + for i ; do + if [ -f $i ] ; then + $CP $i $destdir + elif [ -d $i ] ; then + echo "Warning: Will not copy directory \"$i\"" + else + echo "Warning: Listed file not found \"$i\"" + fi + done +} -for i in COPYING COPYING.LIB README Docs/INSTALL-BINARY \ +copyfileto $BASE/docs ChangeLog Docs/mysql.info + +copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY \ EXCEPTIONS-CLIENT MySQLEULA.txt LICENSE.doc README.NW -do - if [ -f $i ] - then - $CP $i $BASE - fi -done # Non platform-specific bin dir files: BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ @@ -135,45 +134,27 @@ else "; fi -for i in $BIN_FILES -do - if [ -f $i ] - then - $CP $i $BASE/bin - fi -done +copyfileto $BASE/bin $BIN_FILES if [ x$STRIP = x1 ] ; then strip $BASE/bin/* fi # Copy not binary files -for i in sql/mysqld.sym.gz -do - if [ -f $i ] - then - $CP $i $BASE/bin - fi -done +copyfileto $BASE/bin sql/mysqld.sym.gz if [ $BASE_SYSTEM = "netware" ] ; then - $CP -r netware/*.pl $BASE/scripts + $CP netware/*.pl $BASE/scripts $CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl fi -for i in \ +copyfileto $BASE/lib \ libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* \ libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a \ libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \ mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \ libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \ libmysqld/libmysqld.a netware/libmysql.imp -do - if [ -f $i ] - then - $CP $i $BASE/lib - fi -done # convert the .a to .lib for NetWare if [ $BASE_SYSTEM = "netware" ] ; then @@ -184,7 +165,8 @@ if [ $BASE_SYSTEM = "netware" ] ; then done fi -$CP config.h include/* $BASE/include +copyfileto $BASE/include config.h include/* + rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h if [ $BASE_SYSTEM != "netware" ] ; then rm -f $BASE/include/config-netware.h @@ -199,45 +181,52 @@ if [ $BASE_SYSTEM != "netware" ] ; then fi fi -$CP support-files/* $BASE/support-files -$CP scripts/*.sql $BASE/share +copyfileto $BASE/support-files support-files/* + +copyfileto $BASE/share scripts/*.sql $CP -r sql/share/* $MYSQL_SHARE rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD -for i in mysql-test/mysql-test-run mysql-test/install_test_db \ +copyfileto $BASE/mysql-test \ + mysql-test/mysql-test-run mysql-test/install_test_db \ mysql-test/mysql-test-run.pl mysql-test/README \ netware/mysql_test_run.nlm netware/install_test_db.ncf -do - if [ -f $i ] - then - $CP $i $BASE/mysql-test - fi -done $CP mysql-test/lib/*.pl $BASE/mysql-test/lib $CP mysql-test/lib/*.sql $BASE/mysql-test/lib $CP mysql-test/include/*.inc $BASE/mysql-test/include -$CP mysql-test/std_data/*.dat mysql-test/std_data/*.*001 $BASE/mysql-test/std_data +$CP mysql-test/std_data/*.dat mysql-test/std_data/*.*001 \ + $BASE/mysql-test/std_data $CP mysql-test/std_data/des_key_file $BASE/mysql-test/std_data -$CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.slave-mi mysql-test/t/*.sh $BASE/mysql-test/t +$CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.slave-mi \ + mysql-test/t/*.sh $BASE/mysql-test/t $CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r if [ $BASE_SYSTEM != "netware" ] ; then chmod a+x $BASE/bin/* - $CP scripts/* $BASE/bin - $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ @HOSTNAME@ \@pkgdatadir\@ ./support-files < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db - $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \@HOSTNAME\@ @HOSTNAME@ < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server + copyfileto $BASE/bin scripts/* + $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \ + ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \ + @HOSTNAME@ \@pkgdatadir\@ ./support-files \ + < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db + $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \ + \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data \ + \@HOSTNAME\@ @HOSTNAME@ \ + < support-files/mysql.server.sh > $BASE/support-files/mysql.server $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe mv $BASE/support-files/binary-configure $BASE/configure - chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/support-files/mysql.server $BASE/configure + chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* \ + $BASE/support-files/mysql.server $BASE/configure $CP -r sql-bench/* $BASE/sql-bench rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la rm -f $BASE/bin/*.sql fi -rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh - +rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \ + $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \ + $BASE/bin/setsomevars $BASE/support-files/Makefile* \ + $BASE/support-files/*.sh # # Copy system dependent files @@ -245,8 +234,10 @@ rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_ if [ $BASE_SYSTEM = "netware" ] ; then echo "CREATE DATABASE mysql;" > $BASE/bin/init_db.sql echo "CREATE DATABASE test;" >> $BASE/bin/init_db.sql - sh ./scripts/mysql_create_system_tables.sh real "" "%" 0 >> $BASE/bin/init_db.sql - sh ./scripts/mysql_create_system_tables.sh test "" "%" 0 > $BASE/bin/test_db.sql + sh ./scripts/mysql_create_system_tables.sh real "" "%" 0 \ + >> $BASE/bin/init_db.sql + sh ./scripts/mysql_create_system_tables.sh test "" "%" 0 \ + > $BASE/bin/test_db.sql # cp ./netware/static_init_db.sql ./netware/init_db.sql # ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql fi @@ -271,9 +262,9 @@ fi (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld ) # Clean up if we did this from a bk tree -if [ -d $BASE/sql-bench/SCCS ] ; then - find $BASE/share -name SCCS -print | xargs rm -r -f - find $BASE/sql-bench -name SCCS -print | xargs rm -r -f +if [ -d $BASE/sql-bench/SCCS ] ; then + find $BASE/share -name SCCS -print | xargs rm -rf + find $BASE/sql-bench -name SCCS -print | xargs rm -rf fi # NDB Cluster @@ -288,36 +279,29 @@ if [ x$NDBCLUSTER = x1 ]; then rm -rf $BASE/ndb-stage fi -# Use the override --machine if present -if [ -n "$MACHINE" ] ; then - machine=$MACHINE -fi - # Change the distribution to a long descriptive name -NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX +NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$PLATFORM$SUFFIX # Print the platform name for build logs -echo "PLATFORM NAME: $system-$machine" +echo "PLATFORM NAME: $PLATFORM" BASE2=$TMP/$NEW_NAME -rm -r -f $BASE2 +rm -rf $BASE2 mv $BASE $BASE2 BASE=$BASE2 # # If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a # -if test "@GXX@" = "yes" +if [ x"@GXX@" = x"yes" ] then - cd $BASE/lib gcclib=`@CC@ --print-libgcc-file` - if test $? -ne 0 + if [ $? -ne 0 ] then print "Warning: Couldn't find libgcc.a!" else - $CP $gcclib libmygcc.a + $CP $gcclib $BASE/lib/libmygcc.a fi - cd $SOURCE fi #if we are debugging, do not do tar/gz @@ -328,7 +312,9 @@ fi # This is needed to prefere gnu tar instead of tar because tar can't # always handle long filenames -PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` +PATH_DIRS=`echo $PATH | \ + sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` + which_1 () { for cmd @@ -337,7 +323,7 @@ which_1 () do for file in $d/$cmd do - if test -x $file -a ! -d $file + if [ -x $file -a ! -d $file ] then echo $file exit 0 @@ -353,38 +339,36 @@ if [ $BASE_SYSTEM != "netware" ] ; then # # Create the result tar file # - + tar=`which_1 gnutar gtar` - if test "$?" = "1" -o "$tar" = "" + if [ "$?" = "1" -o x"$tar" = x"" ] then tar=tar fi - + echo "Using $tar to create archive" - cd $TMP - + OPT=cvf if [ x$SILENT = x1 ] ; then OPT=cf fi - - $tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME - cd $SOURCE - echo "Compressing archive" + + echo "Creating and compressing archive" rm -f $NEW_NAME.tar.gz - gzip -9 $NEW_NAME.tar + (cd $TMP ; $tar $OPT - $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz echo "$NEW_NAME.tar.gz created" + else # # Create a zip file for NetWare users # - cd $TMP - if test -e "$SOURCE/$NEW_NAME.zip"; then rm $SOURCE/$NEW_NAME.zip; fi - zip -r $SOURCE/$NEW_NAME.zip $NEW_NAME + rm -f $NEW_NAME.zip + (cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME) echo "$NEW_NAME.zip created" fi + echo "Removing temporary directory" -rm -r -f $BASE +rm -rf $BASE From 770b9ef34d2bec40844fa2f3c9090a3b71c5e68f Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Thu, 6 Oct 2005 22:09:15 +0300 Subject: [PATCH 05/13] Fixed a bug in argument sending to get_one_option. Fixed documentation for findopt(). Cleaned code a bit. --- mysys/my_getopt.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index e9e20fe4024..31ef21632b9 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -358,7 +358,8 @@ invalid value '%s'\n", continue; } get_one_option(optp->id, optp, - value ? (char*) "1" : disabled_my_option); + *((my_bool*) value) ? + (char*) "1" : disabled_my_option); continue; } argument= optend; @@ -599,16 +600,27 @@ static int setval(const struct my_option *opts, gptr *value, char *argument, return 0; } + /* - function: findopt + Find option - Arguments: opt_pattern, length of opt_pattern, opt_struct, first found - name (ffname) + SYNOPSIS + findopt() + optpat Prefix of option to find (with - or _) + length Length of optpat + opt_res Options + ffname Place for pointer to first found name - Go through all options in the my_option struct. Return number - of options found that match the pattern and in the argument - list the option found, if any. In case of ambiguous option, store - the name in ffname argument + IMPLEMENTATION + Go through all options in the my_option struct. Return number + of options found that match the pattern and in the argument + list the option found, if any. In case of ambiguous option, store + the name in ffname argument + + RETURN + 0 No matching options + # Number of matching options + ffname points to first matching option */ static int findopt(char *optpat, uint length, @@ -623,12 +635,21 @@ static int findopt(char *optpat, uint length, if (!getopt_compare_strings(opt->name, optpat, length)) /* match found */ { (*opt_res)= opt; - if (!count) - *ffname= (char *) opt->name; /* We only need to know one prev */ if (!opt->name[length]) /* Exact match */ return 1; - if (!count || strcmp(*ffname, opt->name)) /* Don't count synonyms */ + if (!count) + { + count= 1; + *ffname= (char *) opt->name; /* We only need to know one prev */ + } + else if (strcmp(*ffname, opt->name)) + { + /* + The above test is to not count same option twice + (see mysql.cc, option "help") + */ count++; + } } } return count; From 87016b438ccee0bec2de2c0b465b2e826eb65019 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Thu, 6 Oct 2005 22:57:13 +0200 Subject: [PATCH 06/13] make_binary_distribution.sh: Reintroduced --machine Better sh compatibility, "for i ; do" is not portable --- scripts/make_binary_distribution.sh | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 28db9eb249d..78842e7d9cf 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -17,10 +17,11 @@ MV="mv" STRIP=1 DEBUG=0 SILENT=0 -PLATFORM="$system-$machine" +MACHINE="" +PLATFORM="" TMP=/tmp SUFFIX="" -NDBCLUSTER= +NDBCLUSTER="" for arg do case "$arg" in @@ -28,6 +29,7 @@ for arg do --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; --no-strip) STRIP=0 ;; + --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;; --platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;; --silent) SILENT=1 ;; --with-ndbcluster) NDBCLUSTER=1 ;; @@ -38,6 +40,16 @@ for arg do esac done +if [ x"$MACHINE" != x"" ] ; then + machine=$MACHINE +fi + +if [ x"$PLATFORM" != x"" ] ; then + platform="$PLATFORM" +else + platform="$system-$machine" +fi + # FIXME This should really be integrated with automake and not duplicate the # installation list. @@ -78,7 +90,8 @@ copyfileto() { destdir=$1 shift - for i ; do + for i + do if [ -f $i ] ; then $CP $i $destdir elif [ -d $i ] ; then @@ -293,11 +306,9 @@ BASE=$BASE2 # If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a # -if [ x"@GXX@" = x"yes" ] -then +if [ x"@GXX@" = x"yes" ] ; then gcclib=`@CC@ --print-libgcc-file` - if [ $? -ne 0 ] - then + if [ $? -ne 0 ] ; then print "Warning: Couldn't find libgcc.a!" else $CP $gcclib $BASE/lib/libmygcc.a @@ -323,8 +334,7 @@ which_1 () do for file in $d/$cmd do - if [ -x $file -a ! -d $file ] - then + if [ -x $file -a ! -d $file ] ; then echo $file exit 0 fi @@ -341,8 +351,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then # tar=`which_1 gnutar gtar` - if [ "$?" = "1" -o x"$tar" = x"" ] - then + if [ "$?" = "1" -o x"$tar" = x"" ] ; then tar=tar fi From ae62a588179d8a80c2093ff4100b89c1898cb5ff Mon Sep 17 00:00:00 2001 From: "kent@mysql.com" <> Date: Fri, 7 Oct 2005 01:56:11 +0200 Subject: [PATCH 07/13] make_binary_distribution.sh: Corrected platform name output Services.cpp: Dont print null address (back port from 5.0) --- ndb/src/mgmsrv/Services.cpp | 2 +- scripts/make_binary_distribution.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp index bcc18d75b09..1a5b0592066 100644 --- a/ndb/src/mgmsrv/Services.cpp +++ b/ndb/src/mgmsrv/Services.cpp @@ -918,7 +918,7 @@ printNodeStatus(OutputStream *output, output->println("node.%d.dynamic_id: %d", nodeId, dynamicId); output->println("node.%d.node_group: %d", nodeId, nodeGroup); output->println("node.%d.connect_count: %d", nodeId, connectCount); - output->println("node.%d.address: %s", nodeId, address); + output->println("node.%d.address: %s", nodeId, address ? address : ""); } } diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 78842e7d9cf..0ab26f33c53 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -293,10 +293,10 @@ if [ x$NDBCLUSTER = x1 ]; then fi # Change the distribution to a long descriptive name -NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$PLATFORM$SUFFIX +NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$platform$SUFFIX # Print the platform name for build logs -echo "PLATFORM NAME: $PLATFORM" +echo "PLATFORM NAME: $platform" BASE2=$TMP/$NEW_NAME rm -rf $BASE2 From b2b8d8b276b62b1c8b63b2ebda4571b205b7f41e Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Fri, 7 Oct 2005 14:16:44 +0500 Subject: [PATCH 08/13] Fix for bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails allow select into outfile from I_S tables it is enough to add FILE_ACL for I_S tables only to 'check_table_access' function as we use 'any_db' for 'check_access' function in places where FILE_ACL is required --- mysql-test/t/outfile.test | 18 ++++++++++++++++++ sql/sql_parse.cc | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index a74bebe1460..37e96d9d38d 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -65,3 +65,21 @@ EXPLAIN DROP TABLE t1; # End of 4.1 tests + +# +# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails +# +disable_query_log; +eval SELECT * INTO OUTFILE "$MYSQL_TEST_DIR/var/tmp/outfile-test.4" +FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' +FROM information_schema.schemata LIMIT 0, 5; +# enable_query_log; +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4 + +use information_schema; +# disable_query_log; +eval SELECT * INTO OUTFILE "$MYSQL_TEST_DIR/var/tmp/outfile-test.4" +FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' +FROM schemata LIMIT 0, 5; +enable_query_log; +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4 diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 57b7c387ac9..b70409704a2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5002,7 +5002,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables, for (; tables; tables= tables->next_global) { if (tables->schema_table && - (want_access & ~(SELECT_ACL | EXTRA_ACL))) + (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) { if (!no_errors) my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), From a31a4d4b9bc3dff2ba0336b17c2ee051e04966fb Mon Sep 17 00:00:00 2001 From: "gluh@eagle.intranet.mysql.r18.ru" <> Date: Fri, 7 Oct 2005 15:09:44 +0500 Subject: [PATCH 09/13] after merge fix --- mysql-test/r/rpl_openssl.result | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result index cf63ff49ac2..d916e9f2c5c 100644 --- a/mysql-test/r/rpl_openssl.result +++ b/mysql-test/r/rpl_openssl.result @@ -20,12 +20,11 @@ t 1 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 404 # # master-bin.000001 Yes Yes 0 0 398 # None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # +# 127.0.0.1 replssl MASTER_MYPORT 1 master-bin.000001 398 # # master-bin.000001 Yes Yes 0 0 398 # None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; drop table t1; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 480 # # master-bin.000001 Yes Yes 0 0 474 # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # - +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 474 # # master-bin.000001 Yes Yes 0 0 474 # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem # From 54db9bab7c3152a98be23c9971bc091d8fd9af51 Mon Sep 17 00:00:00 2001 From: "petr@mysql.com" <> Date: Fri, 7 Oct 2005 20:25:51 +0400 Subject: [PATCH 10/13] fix compile failure (which shows up in cygwin environment) --- server-tools/instance-manager/mysql_connection.cc | 2 +- server-tools/instance-manager/user_map.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc index 4a32e95450e..f3c21f7da27 100644 --- a/server-tools/instance-manager/mysql_connection.cc +++ b/server-tools/instance-manager/mysql_connection.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION) -#pragma interface +#pragma implementation #endif #include "mysql_connection.h" diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc index d901d1ca5ec..9cb15307131 100644 --- a/server-tools/instance-manager/user_map.cc +++ b/server-tools/instance-manager/user_map.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #if defined(__GNUC__) && defined(USE_PRAGMA_IMPLEMENTATION) -#pragma interface +#pragma implementation #endif #include "user_map.h" From ae293f9ac53fd1acdba2b79729561a0f8d3e41d0 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 8 Oct 2005 14:46:04 +0200 Subject: [PATCH 11/13] Bug #10942 "deadlock with FLUSH TABLES WITH READ LOCK + STOP SLAVE" don't allow STOP SLAVE if global read lock is in taken --- mysql-test/r/rpl_flush_tables.result | 6 ++++++ mysql-test/t/rpl_flush_tables.test | 10 ++++++++++ sql/sql_parse.cc | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result index 70e4774a920..1bdb79fd0b1 100644 --- a/mysql-test/r/rpl_flush_tables.result +++ b/mysql-test/r/rpl_flush_tables.result @@ -38,3 +38,9 @@ master-bin.000001 461 Query 1 461 use `test`; rename table t1 to t5, t2 to t1 master-bin.000001 527 Query 1 527 use `test`; flush tables select * from t3; a +stop slave; +drop table t1; +flush tables with read lock; +start slave; +stop slave; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction diff --git a/mysql-test/t/rpl_flush_tables.test b/mysql-test/t/rpl_flush_tables.test index 04158aed9e0..378fa479f09 100644 --- a/mysql-test/t/rpl_flush_tables.test +++ b/mysql-test/t/rpl_flush_tables.test @@ -37,4 +37,14 @@ select * from t3; # Note that all this confusion may cause warnings 'table xx is open on rename' # in the .err files; these are not fatal and are not reported by mysql-test-run. +stop slave; +connection master; +drop table t1; +connection slave; +flush tables with read lock; +start slave; +sleep 1; +--error 1192 +stop slave; + # End of 4.1 tests diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5d233fd7be0..3a538a7629b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2601,7 +2601,7 @@ unsent_create_error: To prevent that, refuse SLAVE STOP if the client thread has locked tables */ - if (thd->locked_tables || thd->active_transaction()) + if (thd->locked_tables || thd->active_transaction() || thd->global_read_lock) { send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION); break; From e91712d9bbd43f2153ed0623a651844de45b7796 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 8 Oct 2005 16:39:55 +0200 Subject: [PATCH 12/13] pthread_handler_decl() changed to be ctags-friendly (and contain extern "C" when necessary) --- VC++Files/test1/mysql_thr.c | 4 +-- VC++Files/thr_test/thr_test.c | 4 +-- include/my_pthread.h | 11 ++++--- myisam/myisamdef.h | 2 +- myisam/sort.c | 2 +- mysys/my_os2thread.c | 2 +- mysys/my_winthread.c | 2 +- ndb/src/ndbapi/ndb_cluster_connection.cpp | 2 +- server-tools/instance-manager/guardian.cc | 7 +---- server-tools/instance-manager/guardian.h | 6 +--- server-tools/instance-manager/instance.cc | 7 +---- server-tools/instance-manager/listener.cc | 8 +---- server-tools/instance-manager/listener.h | 6 +--- .../instance-manager/mysql_connection.cc | 7 +---- .../instance-manager/mysql_connection.h | 7 +---- sql/ha_ndbcluster.cc | 5 ++-- sql/mysql_priv.h | 6 ++-- sql/mysqld.cc | 30 +++++++++---------- sql/repl_failsafe.cc | 2 +- sql/repl_failsafe.h | 2 +- sql/slave.cc | 10 +++---- sql/slave.h | 4 +-- sql/sql_class.h | 4 +-- sql/sql_insert.cc | 4 +-- sql/sql_manager.cc | 2 +- sql/sql_parse.cc | 4 +-- tools/mysqlmanager.c | 9 +++--- 27 files changed, 62 insertions(+), 97 deletions(-) diff --git a/VC++Files/test1/mysql_thr.c b/VC++Files/test1/mysql_thr.c index c2743cb8e4c..de1d936806e 100644 --- a/VC++Files/test1/mysql_thr.c +++ b/VC++Files/test1/mysql_thr.c @@ -33,7 +33,7 @@ typedef CRITICAL_SECTION pthread_mutex_t; #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A) -#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) +#define pthread_handler_t unsigned __cdecl * typedef unsigned (__cdecl *pthread_handler)(void *); #define pthread_self() GetCurrentThread() @@ -155,7 +155,7 @@ int _my_errno(void) ** The test program *****************************************************************************/ -pthread_handler_decl(test_thread,arg) +pthread_handler_t test_thread(void *arg) { MYSQL mysql; MYSQL_RES *res; diff --git a/VC++Files/thr_test/thr_test.c b/VC++Files/thr_test/thr_test.c index 3427eed8441..100fcb9c45e 100644 --- a/VC++Files/thr_test/thr_test.c +++ b/VC++Files/thr_test/thr_test.c @@ -44,7 +44,7 @@ typedef CRITICAL_SECTION pthread_mutex_t; #define pthread_mutex_lock(A) (EnterCriticalSection(A),0) #define pthread_mutex_unlock(A) LeaveCriticalSection(A) #define pthread_mutex_destroy(A) DeleteCriticalSection(A) -#define pthread_handler_decl(A,B) unsigned __cdecl A(void *B) +#define pthread_handler_t unsigned __cdecl * typedef unsigned (__cdecl *pthread_handler)(void *); #define pthread_self() GetCurrentThread() @@ -174,7 +174,7 @@ int _my_errno(void) ** The test program *****************************************************************************/ -pthread_handler_decl(test_thread,arg) +pthread_handler_t test_thread(void *arg) { pthread_mutex_lock(&LOCK_thread_count); thread_count--; diff --git a/include/my_pthread.h b/include/my_pthread.h index 057b71356db..1dd1ead7dfa 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -25,7 +25,10 @@ #endif #ifdef __cplusplus +#define EXTERN_C extern "C" extern "C" { +#else +#define EXTERN_C #endif /* __cplusplus */ #if defined(__WIN__) || defined(OS2) @@ -77,10 +80,10 @@ struct timespec { /* For pthread_cond_timedwait() */ typedef int pthread_mutexattr_t; #define win_pthread_self my_thread_var->pthread_self #ifdef OS2 -#define pthread_handler_decl(A,B) void * _Optlink A(void *B) +#define pthread_handler_t EXTERN_C void * _Optlink typedef void * (_Optlink *pthread_handler)(void *); #else -#define pthread_handler_decl(A,B) void * __cdecl A(void *B) +#define pthread_handler_t EXTERN_C void * __cdecl typedef void * (__cdecl *pthread_handler)(void *); #endif @@ -184,7 +187,7 @@ typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */ #define pthread_key_create(A,B) thr_keycreate((A),(B)) #define pthread_key_delete(A) thr_keydelete(A) -#define pthread_handler_decl(A,B) void *A(void *B) +#define pthread_handler_t EXTERN_C void * #define pthread_key(T,V) pthread_key_t V void * my_pthread_getspecific_imp(pthread_key_t key); @@ -262,7 +265,7 @@ extern int my_pthread_getprio(pthread_t thread_id); #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) #define pthread_detach_this_thread() -#define pthread_handler_decl(A,B) void *A(void *B) +#define pthread_handler_t EXTERN_C void * typedef void *(* pthread_handler)(void *); /* Test first for RTS or FSU threads */ diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 87a1b757d88..36328c9d9f1 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -728,7 +728,7 @@ int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); #ifdef THREAD -pthread_handler_decl(thr_find_all_keys,arg); +pthread_handler_t thr_find_all_keys(void *arg); #endif int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file); diff --git a/myisam/sort.c b/myisam/sort.c index fabd713ef45..6c718a0d453 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -307,7 +307,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, #ifdef THREAD /* Search after all keys and place them in a temp. file */ -pthread_handler_decl(thr_find_all_keys,arg) +pthread_handler_t thr_find_all_keys(void *arg) { MI_SORT_PARAM *info= (MI_SORT_PARAM*) arg; int error; diff --git a/mysys/my_os2thread.c b/mysys/my_os2thread.c index 0696f480a91..785ff07954d 100644 --- a/mysys/my_os2thread.c +++ b/mysys/my_os2thread.c @@ -51,7 +51,7 @@ void win_pthread_init(void) ** in the new thread. */ -static pthread_handler_decl(pthread_start,param) +pthread_handler_t pthread_start(void *param) { DBUG_ENTER("pthread_start"); pthread_handler func=((struct pthread_map *) param)->func; diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c index eebc07df180..8aaf3b1e31c 100644 --- a/mysys/my_winthread.c +++ b/mysys/my_winthread.c @@ -51,7 +51,7 @@ void win_pthread_init(void) ** in the new thread. */ -static pthread_handler_decl(pthread_start,param) +pthread_handler_t pthread_start(void *param) { pthread_handler func=((struct pthread_map *) param)->func; void *func_param=((struct pthread_map *) param)->param; diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index 7625da609b0..34079c3e35f 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -86,7 +86,7 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf, return 0; } -extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me) +pthread_handler_t run_ndb_cluster_connection_connect_thread(void *me) { g_run_connect_thread= 1; ((Ndb_cluster_connection_impl*) me)->connect_thread(); diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc index a4c0cef41b3..291b685ef1b 100644 --- a/server-tools/instance-manager/guardian.cc +++ b/server-tools/instance-manager/guardian.cc @@ -33,18 +33,13 @@ -C_MODE_START - -pthread_handler_decl(guardian, arg) +pthread_handler_t guardian(void *arg) { Guardian_thread *guardian_thread= (Guardian_thread *) arg; guardian_thread->run(); return 0; } -C_MODE_END - - Guardian_thread::Guardian_thread(Thread_registry &thread_registry_arg, Instance_map *instance_map_arg, uint monitoring_interval_arg) : diff --git a/server-tools/instance-manager/guardian.h b/server-tools/instance-manager/guardian.h index 16180e72dc9..16b4c373c91 100644 --- a/server-tools/instance-manager/guardian.h +++ b/server-tools/instance-manager/guardian.h @@ -31,11 +31,7 @@ class Instance_map; class Thread_registry; struct GUARD_NODE; -C_MODE_START - -pthread_handler_decl(guardian, arg); - -C_MODE_END +pthread_handler_t guardian(void *arg); struct Guardian_thread_args { diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 0c3c1aee5b4..ff3387334b6 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -43,8 +43,6 @@ typedef pid_t My_process_info; typedef PROCESS_INFORMATION My_process_info; #endif -C_MODE_START - /* Proxy thread is a simple way to avoid all pitfalls of the threads implementation in the OS (e.g. LinuxThreads). With such a thread we @@ -52,7 +50,7 @@ C_MODE_START to do it in a portable way. */ -pthread_handler_decl(proxy, arg) +pthread_handler_t proxy(void *arg) { Instance *instance= (Instance *) arg; start_and_monitor_instance(&instance->options, @@ -60,9 +58,6 @@ pthread_handler_decl(proxy, arg) return 0; } -C_MODE_END - - /* Wait for an instance diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc index a1c1a743c24..08c28dc9f7d 100644 --- a/server-tools/instance-manager/listener.cc +++ b/server-tools/instance-manager/listener.cc @@ -372,10 +372,7 @@ void Listener_thread::handle_new_mysql_connection(Vio *vio) } -C_MODE_START - - -pthread_handler_decl(listener, arg) +pthread_handler_t listener(void *arg) { Listener_thread_args *args= (Listener_thread_args *) arg; Listener_thread listener(*args); @@ -387,6 +384,3 @@ pthread_handler_decl(listener, arg) return 0; } - -C_MODE_END - diff --git a/server-tools/instance-manager/listener.h b/server-tools/instance-manager/listener.h index 3f5a80f1f53..e0ab5b8ef2b 100644 --- a/server-tools/instance-manager/listener.h +++ b/server-tools/instance-manager/listener.h @@ -24,11 +24,7 @@ #include -C_MODE_START - -pthread_handler_decl(listener, arg); - -C_MODE_END +pthread_handler_t listener(void *arg); class Thread_registry; struct Options; diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc index 4a32e95450e..e30e9cb42a0 100644 --- a/server-tools/instance-manager/mysql_connection.cc +++ b/server-tools/instance-manager/mysql_connection.cc @@ -364,9 +364,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command, } -C_MODE_START - -pthread_handler_decl(mysql_connection, arg) +pthread_handler_t mysql_connection(void *arg) { Mysql_connection_thread_args *args= (Mysql_connection_thread_args *) arg; Mysql_connection_thread mysql_connection_thread(*args); @@ -381,9 +379,6 @@ pthread_handler_decl(mysql_connection, arg) return 0; } -C_MODE_END - - /* vim: fdm=marker */ diff --git a/server-tools/instance-manager/mysql_connection.h b/server-tools/instance-manager/mysql_connection.h index 2ff55d81e57..492937b2198 100644 --- a/server-tools/instance-manager/mysql_connection.h +++ b/server-tools/instance-manager/mysql_connection.h @@ -24,12 +24,7 @@ #include -C_MODE_START - -pthread_handler_decl(mysql_connection, arg); - -C_MODE_END - +pthread_handler_t mysql_connection(void *arg); class Thread_registry; class User_map; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6f2c7670b88..7fe6d019fb5 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -121,7 +121,7 @@ static int ndb_get_table_statistics(Ndb*, const char *, static pthread_t ndb_util_thread; pthread_mutex_t LOCK_ndb_util_thread; pthread_cond_t COND_ndb_util_thread; -extern "C" pthread_handler_decl(ndb_util_thread_func, arg); +pthread_handler_t ndb_util_thread_func(void *arg); ulong ndb_cache_check_time; /* @@ -5926,8 +5926,7 @@ ha_ndbcluster::update_table_comment( // Utility thread main loop -extern "C" pthread_handler_decl(ndb_util_thread_func, - arg __attribute__((unused))) +pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) { THD *thd; /* needs to be first for thread_stack */ Ndb* ndb; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index c80e457d2bb..19ebceab719 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -610,8 +610,8 @@ bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); void init_max_user_conn(void); void init_update_queries(void); void free_max_user_conn(void); -extern "C" pthread_handler_decl(handle_one_connection,arg); -extern "C" pthread_handler_decl(handle_bootstrap,arg); +pthread_handler_t handle_one_connection(void *arg); +pthread_handler_t handle_bootstrap(void *arg); void end_thread(THD *thd,bool put_in_cache); void flush_thread_cache(); bool mysql_execute_command(THD *thd); @@ -1035,7 +1035,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info); extern ulong volatile manager_status; extern bool volatile manager_thread_in_use, mqh_used; extern pthread_t manager_thread; -extern "C" pthread_handler_decl(handle_manager, arg); +pthread_handler_t handle_manager(void *arg); /* sql_test.cc */ #ifndef DBUG_OFF diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 904b5ec78be..3c708bb8a1a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -587,25 +587,25 @@ struct st_VioSSLAcceptorFd *ssl_acceptor_fd; /* Function declarations */ static void start_signal_handler(void); -static pthread_handler_decl(signal_hand, arg); +pthread_handler_t signal_hand(void *arg); static void mysql_init_variables(void); static void get_options(int argc,char **argv); static void set_server_version(void); static int init_thread_environment(); static char *get_relative_path(const char *path); static void fix_paths(void); -extern "C" pthread_handler_decl(handle_connections_sockets,arg); -extern "C" pthread_handler_decl(kill_server_thread,arg); +pthread_handler_t handle_connections_sockets(void *arg); +pthread_handler_t kill_server_thread(void *arg); static void bootstrap(FILE *file); static void close_server_sock(); static bool read_init_file(char *file_name); #ifdef __NT__ -extern "C" pthread_handler_decl(handle_connections_namedpipes,arg); +pthread_handler_t handle_connections_namedpipes(void *arg); #endif #ifdef HAVE_SMEM -static pthread_handler_decl(handle_connections_shared_memory,arg); +pthread_handler_t handle_connections_shared_memory(void *arg); #endif -extern "C" pthread_handler_decl(handle_slave,arg); +pthread_handler_t handle_slave(void *arg); static ulong find_bit_type(const char *x, TYPELIB *bit_lib); static void clean_up(bool print_message); static void clean_up_mutexes(void); @@ -954,7 +954,7 @@ static void __cdecl kill_server(int sig_ptr) #if defined(USE_ONE_SIGNAL_HAND) || (defined(__NETWARE__) && defined(SIGNALS_DONT_BREAK_READ)) -extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused))) +pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) { my_thread_init(); // Initialize new thread kill_server(0); @@ -2388,7 +2388,7 @@ int uname(struct utsname *a) } -extern "C" pthread_handler_decl(handle_shutdown,arg) +pthread_handler_t handle_shutdown(void *arg) { MSG msg; my_thread_init(); @@ -2417,7 +2417,7 @@ int STDCALL handle_kill(ulong ctrl_type) #ifdef OS2 -extern "C" pthread_handler_decl(handle_shutdown,arg) +pthread_handler_t handle_shutdown(void *arg) { my_thread_init(); @@ -3731,8 +3731,7 @@ inline void kill_broken_server() /* Handle new connections and spawn new process to handle them */ #ifndef EMBEDDED_LIBRARY -extern "C" pthread_handler_decl(handle_connections_sockets, - arg __attribute__((unused))) +pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused))) { my_socket sock,new_sock; uint error_count=0; @@ -3946,7 +3945,7 @@ extern "C" pthread_handler_decl(handle_connections_sockets, #ifdef __NT__ -extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) +pthread_handler_t handle_connections_namedpipes(void *arg) { HANDLE hConnectedPipe; BOOL fConnected; @@ -4032,17 +4031,16 @@ extern "C" pthread_handler_decl(handle_connections_namedpipes,arg) Thread of shared memory's service SYNOPSIS - pthread_handler_decl() - handle_connections_shared_memory Thread handle + handle_connections_shared_memory() arg Arguments of thread */ #ifdef HAVE_SMEM -pthread_handler_decl(handle_connections_shared_memory,arg) +pthread_handler_t handle_connections_shared_memory(void *arg) { /* file-mapping object, use for create shared memory */ HANDLE handle_connect_file_map= 0; - char *handle_connect_map= 0; // pointer on shared memory + char *handle_connect_map= 0; // pointer on shared memory HANDLE event_connect_answer= 0; ulong smem_buffer_length= shared_memory_buffer_length + 4; ulong connect_number= 1; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index d4d26c2ccf1..792251e82c0 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -578,7 +578,7 @@ int find_recovery_captain(THD* thd, MYSQL* mysql) } -pthread_handler_decl(handle_failsafe_rpl,arg) +pthread_handler_t handle_failsafe_rpl(void *arg) { DBUG_ENTER("handle_failsafe_rpl"); THD *thd = new THD; diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index dfaacf557e8..19849e63af9 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -31,7 +31,7 @@ extern pthread_cond_t COND_rpl_status; extern TYPELIB rpl_role_typelib, rpl_status_typelib; extern const char* rpl_role_type[], *rpl_status_type[]; -pthread_handler_decl(handle_failsafe_rpl,arg); +pthread_handler_t handle_failsafe_rpl(void *arg); void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status); int find_recovery_captain(THD* thd, MYSQL* mysql); int update_slave_list(MYSQL* mysql, MASTER_INFO* mi); diff --git a/sql/slave.cc b/sql/slave.cc index b1763187d04..0e810b798f9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3325,7 +3325,7 @@ on this slave.\ /* Slave I/O Thread entry point */ -extern "C" pthread_handler_decl(handle_slave_io,arg) +pthread_handler_t handle_slave_io(void *arg) { THD *thd; // needs to be first for thread_stack MYSQL *mysql; @@ -3634,7 +3634,7 @@ err: #ifndef DBUG_OFF if (abort_slave_event_count && !events_till_abort) goto slave_begin; -#endif +#endif my_thread_end(); pthread_exit(0); DBUG_RETURN(0); // Can't return anything here @@ -3643,11 +3643,11 @@ err: /* Slave SQL Thread entry point */ -extern "C" pthread_handler_decl(handle_slave_sql,arg) +pthread_handler_t handle_slave_sql(void *arg) { THD *thd; /* needs to be first for thread_stack */ char llbuff[22],llbuff1[22]; - RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli; + RELAY_LOG_INFO* rli = &((MASTER_INFO*)arg)->rli; const char *errmsg; // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff @@ -3655,7 +3655,7 @@ extern "C" pthread_handler_decl(handle_slave_sql,arg) DBUG_ENTER("handle_slave_sql"); #ifndef DBUG_OFF -slave_begin: +slave_begin: #endif DBUG_ASSERT(rli->inited); diff --git a/sql/slave.h b/sql/slave.h index f8e784bfd17..cbb885ea48b 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -572,8 +572,8 @@ void set_slave_thread_options(THD* thd); void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli); void rotate_relay_log(MASTER_INFO* mi); -extern "C" pthread_handler_decl(handle_slave_io,arg); -extern "C" pthread_handler_decl(handle_slave_sql,arg); +pthread_handler_t handle_slave_io(void *arg); +pthread_handler_t handle_slave_sql(void *arg); extern bool volatile abort_loop; extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */ extern LIST master_list; diff --git a/sql/sql_class.h b/sql/sql_class.h index 7cbfc19123f..48a2837eb04 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1146,8 +1146,8 @@ public: thread is (and must remain, for now) the only responsible for freeing these 3 members. If you add members here, and you add code to set them in replication, don't forget to free_them_and_set_them_to_0 in replication - properly. For details see the 'err:' label of the pthread_handler_decl of - the slave SQL thread, in sql/slave.cc. + properly. For details see the 'err:' label of the handle_slave_sql() + in sql/slave.cc. */ char *db, *catalog; Security_context main_security_ctx; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index cc4b291b5d1..91af68cf37a 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -28,7 +28,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list); static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, bool ignore, char *query, uint query_length, bool log_on); static void end_delayed_insert(THD *thd); -extern "C" pthread_handler_decl(handle_delayed_insert,arg); +pthread_handler_t handle_delayed_insert(void *arg); static void unlink_blobs(register TABLE *table); #endif static bool check_view_insertability(THD *thd, TABLE_LIST *view); @@ -1691,7 +1691,7 @@ void kill_delayed_threads(void) * Create a new delayed insert thread */ -extern "C" pthread_handler_decl(handle_delayed_insert,arg) +pthread_handler_t handle_delayed_insert(void *arg) { delayed_insert *di=(delayed_insert*) arg; THD *thd= &di->thd; diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 0af6a80d4c2..34334d3a01d 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -32,7 +32,7 @@ pthread_t manager_thread; pthread_mutex_t LOCK_manager; pthread_cond_t COND_manager; -extern "C" pthread_handler_decl(handle_manager,arg __attribute__((unused))) +pthread_handler_t handle_manager(void *arg __attribute__((unused))) { int error = 0; ulong status; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 57b7c387ac9..39aad216b40 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1046,7 +1046,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, } -pthread_handler_decl(handle_one_connection,arg) +pthread_handler_t handle_one_connection(void *arg) { THD *thd=(THD*) arg; uint launch_time = @@ -1182,7 +1182,7 @@ end_thread: Used when creating the initial grant tables */ -extern "C" pthread_handler_decl(handle_bootstrap,arg) +pthread_handler_t handle_bootstrap(void *arg) { THD *thd=(THD*) arg; FILE *file=bootstrap_file; diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index 4a5c08be50a..4d507fc3d32 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -332,8 +332,8 @@ static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt, static int authenticate(struct manager_thd* thd); /* returns pointer to end of line */ static char* read_line(struct manager_thd* thd); -static pthread_handler_decl(process_connection, arg); -static pthread_handler_decl(process_launcher_messages, arg); +pthread_handler_t process_connection(void *arg); +pthread_handler_t process_launcher_messages(void *arg); static int exec_line(struct manager_thd* thd,char* buf,char* buf_end); #ifdef DO_STACKTRACE @@ -1089,8 +1089,7 @@ static void log_msg(const char* fmt, int msg_type, va_list args) pthread_mutex_unlock(&lock_log); } -static pthread_handler_decl(process_launcher_messages, - args __attribute__((unused))) +pthread_handler_t process_launcher_messages(void *arg __attribute__((unused))) { my_thread_init(); for (;!in_shutdown;) @@ -1146,7 +1145,7 @@ static pthread_handler_decl(process_launcher_messages, return 0; } -static pthread_handler_decl(process_connection,arg) +pthread_handler_t process_connection(void *arg) { struct manager_thd* thd = (struct manager_thd*)arg; my_thread_init(); From 2c7505b2638d13511db6eb27fc84dc1c37d6efde Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Sun, 9 Oct 2005 14:45:08 +0400 Subject: [PATCH 13/13] Remove protocol_cursor.cpp (no longer used) from sources Fix a compile failure --- VC++Files/libmysqld/libmysqld.dsp | 4 - VC++Files/sql/mysqld.dsp | 4 - sql/mysqld.cc | 2 +- sql/protocol_cursor.cc | 148 ------------------------------ 4 files changed, 1 insertion(+), 157 deletions(-) delete mode 100644 sql/protocol_cursor.cc diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp index 0fb3a645a48..137a361401f 100644 --- a/VC++Files/libmysqld/libmysqld.dsp +++ b/VC++Files/libmysqld/libmysqld.dsp @@ -396,10 +396,6 @@ SOURCE=..\sql\protocol.cpp # End Source File # Begin Source File -SOURCE=..\sql\protocol_cursor.cpp -# End Source File -# Begin Source File - SOURCE=..\sql\records.cpp # End Source File # Begin Source File diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 6db2aca8d1c..e682bb52f0d 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -1283,10 +1283,6 @@ SOURCE=.\protocol.cpp # End Source File # Begin Source File -SOURCE=.\protocol_cursor.cpp -# End Source File -# Begin Source File - SOURCE=.\records.cpp !IF "$(CFG)" == "mysqld - Win32 Release" diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3c708bb8a1a..54b77150dee 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2167,7 +2167,7 @@ static void start_signal_handler(void) /* This threads handles all signals and alarms */ /* ARGSUSED */ -static void *signal_hand(void *arg __attribute__((unused))) +pthread_handler_t signal_hand(void *arg __attribute__((unused))) { sigset_t set; int sig; diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc deleted file mode 100644 index 093a2bf2b90..00000000000 --- a/sql/protocol_cursor.cc +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (C) 2000-2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - Low level functions for storing data to be send to the MySQL client - The actual communction is handled by the net_xxx functions in net_serv.cc -*/ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mysql_priv.h" -#include - -bool Protocol_cursor::send_fields(List *list, uint flags) -{ - List_iterator_fast it(*list); - Item *item; - MYSQL_FIELD *client_field; - DBUG_ENTER("Protocol_cursor::send_fields"); - - if (prepare_for_send(list)) - return FALSE; - - fields= (MYSQL_FIELD *)alloc_root(alloc, sizeof(MYSQL_FIELD) * field_count); - if (!fields) - goto err; - - for (client_field= fields; (item= it++) ; client_field++) - { - Send_field server_field; - item->make_field(&server_field); - - client_field->db= strdup_root(alloc, server_field.db_name); - client_field->table= strdup_root(alloc, server_field.table_name); - client_field->name= strdup_root(alloc, server_field.col_name); - client_field->org_table= strdup_root(alloc, server_field.org_table_name); - client_field->org_name= strdup_root(alloc, server_field.org_col_name); - client_field->catalog= strdup_root(alloc, ""); - client_field->length= server_field.length; - client_field->type= server_field.type; - client_field->flags= server_field.flags; - client_field->decimals= server_field.decimals; - client_field->db_length= strlen(client_field->db); - client_field->table_length= strlen(client_field->table); - client_field->name_length= strlen(client_field->name); - client_field->org_name_length= strlen(client_field->org_name); - client_field->org_table_length= strlen(client_field->org_table); - client_field->catalog_length= 0; - client_field->charsetnr= server_field.charsetnr; - - if (INTERNAL_NUM_FIELD(client_field)) - client_field->flags|= NUM_FLAG; - - if (flags & (uint) Protocol::SEND_DEFAULTS) - { - char buff[80]; - String tmp(buff, sizeof(buff), default_charset_info), *res; - - if (!(res=item->val_str(&tmp))) - client_field->def= (char*) ""; - else - client_field->def= strmake_root(alloc, res->ptr(), res->length()); - } - else - client_field->def=0; - client_field->max_length= 0; - } - - DBUG_RETURN(FALSE); - -err: - my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), - MYF(0)); /* purecov: inspected */ - DBUG_RETURN(TRUE); /* purecov: inspected */ -} - - -/* Get the length of next field. Change parameter to point at fieldstart */ - -bool Protocol_cursor::write() -{ - byte *cp= (byte *)packet->ptr(); - byte *end_pos= (byte *)packet->ptr() + packet->length(); - ulong len; - MYSQL_FIELD *cur_field= fields; - MYSQL_FIELD *fields_end= fields + field_count; - MYSQL_ROWS *new_record; - byte **data_tmp; - byte *to; - - new_record= (MYSQL_ROWS *)alloc_root(alloc, - sizeof(MYSQL_ROWS) + (field_count + 2)*sizeof(char *) + packet->length()); - if (!new_record) - goto err; - data_tmp= (byte **)(new_record + 1); - new_record->data= (char **)data_tmp; - - to= (byte *)data_tmp + (field_count + 2)*sizeof(char *); - - for (; cur_field < fields_end; cur_field++, data_tmp++) - { - if ((len= net_field_length((uchar **)&cp)) == NULL_LENGTH) - { - *data_tmp= 0; - } - else - { - if ((long)len > (end_pos - cp)) - { - // TODO error signal send_error(thd, CR_MALFORMED_PACKET); - return TRUE; - } - *data_tmp= to; - memcpy(to,(char*) cp,len); - to[len]=0; - to+=len+1; - cp+=len; - if (cur_field->max_length < len) - cur_field->max_length=len; - } - } - data_tmp[0]= to; // Pointer to last used byte - data_tmp[1]= 0; - - *prev_record= new_record; - prev_record= &new_record->next; - new_record->next= NULL; - row_count++; - return FALSE; - err: - // TODO error signal send_error(thd, ER_OUT_OF_RESOURCES); - return TRUE; -}