diff options
-rwxr-xr-x | Build-tools/Bootstrap | 19 | ||||
-rw-r--r-- | Docs/Makefile.am | 4 | ||||
-rw-r--r-- | mysql-test/r/func_test.result | 5 | ||||
-rw-r--r-- | mysql-test/r/rpl_loaddata.result | 26 | ||||
-rw-r--r-- | mysql-test/r/rpl_reset_slave.result | 22 | ||||
-rw-r--r-- | mysql-test/r/type_date.result | 2 | ||||
-rw-r--r-- | mysql-test/t/func_test.test | 5 | ||||
-rw-r--r-- | mysql-test/t/rpl_loaddata.test | 53 | ||||
-rw-r--r-- | mysql-test/t/rpl_reset_slave.test | 26 | ||||
-rw-r--r-- | mysql-test/t/type_date.test | 1 | ||||
-rw-r--r-- | scripts/Makefile.am | 3 | ||||
-rwxr-xr-x | scripts/make_win_src_distribution.sh | 402 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 8 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 10 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 10 | ||||
-rw-r--r-- | sql/slave.cc | 40 | ||||
-rw-r--r-- | sql/slave.h | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 4 | ||||
-rw-r--r-- | sql/sql_repl.cc | 17 | ||||
-rw-r--r-- | sql/sql_table.cc | 3 | ||||
-rw-r--r-- | support-files/mysql.spec.sh | 23 |
21 files changed, 647 insertions, 38 deletions
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 20cd5a089bd..33eca958ae0 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -43,6 +43,7 @@ $opt_suffix= ""; $opt_test= undef; $opt_skip_check= undef; $opt_skip_manual= undef; +$opt_win_dist= undef; $version= "unknown"; $major=$minor=$release=0; @@ -62,7 +63,8 @@ GetOptions( "skip-manual", "suffix=s", "test|t", - "verbose|v" + "verbose|v", + "win-dist|w" ) || print_help(""); # @@ -303,7 +305,17 @@ $command= "make dist"; &run_command($command, "make dist failed!"); # -# Run "make distcheck" to verify the source archive +# Package the Windows source +# +if ($opt_win_dist) +{ + &logger ("Creating Windows source package"); + $command= "./scripts/make_win_src_distibution"; + &run_command($command, "make_win_src_distribution failed!"); +} + +# +# Run "make distcheck" to verify the source archive # if (!$opt_skip_check) { @@ -330,7 +342,7 @@ sub print_help print "ERROR: $message\n"; } print <<EOF; - + Usage: Bootstrap [options] <bk repository> Checks out (exports) a clear-text version of the given local BitKeeper @@ -376,6 +388,7 @@ Options: (e.g. "-20020518"). -t, --test Run the test suite after build -v, --verbose Be verbose +-w, --win-dist Also make Windows source distribution Example: diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 0beaa44c7eb..07dac2d9df1 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -41,10 +41,10 @@ paper: manual_a4.ps manual_letter.ps $(PDFMANUAL) # The Makefile contains the previous version so we can not use that include.texi: ../configure.in echo "@c This file is autogenerated by the Makefile" > $@ - echo -n "@set mysql_version " >> $@ + echo -n "@set mysqlversion " >> $@ grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> $@ - echo -n "@set default_port " >> $@ + echo -n "@set defaultport " >> $@ grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \ sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> $@ diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 8cfae44b9dd..e1c27daa9a7 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -46,6 +46,11 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; 1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL 0 1 1 0 NULL NULL NULL +create table t1 (a int); +insert t1 values (1); +select * from t1 where 1 xor 1; +a +drop table t1; select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 0 1 diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index b5154ca95cf..05bdad0fb84 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -25,3 +25,29 @@ drop table t3; create table t1(a int, b int, unique(b)); insert into t1 values(1,10); load data infile '../../std_data/rpl_loaddata.dat' into table t1; +set global sql_slave_skip_counter=1; +start slave; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352 +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +stop slave; +change master to master_user='test'; +change master to master_user='root'; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4 +set global sql_slave_skip_counter=1; +start slave; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +stop slave; +reset slave; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result new file mode 100644 index 00000000000..c1bc1e8e483 --- /dev/null +++ b/mysql-test/r/rpl_reset_slave.result @@ -0,0 +1,22 @@ +slave stop; +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; +slave start; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 +stop slave; +change master to master_user='test'; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4 +reset slave; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 +start slave; +show slave status; +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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 214328eab47..8dfe14bc1a2 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -32,6 +32,8 @@ datum 2000-01-02 2000-01-03 2000-01-04 +SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY; +datum DROP TABLE t1; CREATE TABLE t1 ( user_id char(10), diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index f5ad2e21c73..700fab97f5e 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -18,6 +18,11 @@ select -1.49 or -1.49,0.6 or 0.6; select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; +create table t1 (a int); +insert t1 values (1); +select * from t1 where 1 xor 1; +drop table t1; + # # Wrong usage of functions # diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index 96a4eb3fb76..0a07dd7549b 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -6,6 +6,9 @@ # # check if duplicate entries trigger an error (they should unless IGNORE or # REPLACE was used on the master) (bug 571). +# +# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and +# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986). source include/master-slave.inc; @@ -44,3 +47,53 @@ save_master_pos; connection slave; # The SQL slave thread should be stopped now. wait_for_slave_to_stop; + +# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START +# SLAVE, even though we are not executing any event (as sql_slave_skip_counter +# takes us directly to the end of the relay log). + +set global sql_slave_skip_counter=1; +start slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +# Trigger error again to test CHANGE MASTER + +connection master; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +save_master_pos; +connection slave; +# The SQL slave thread should be stopped now. +wait_for_slave_to_stop; + +# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS. +stop slave; +change master to master_user='test'; +change master to master_user='root'; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +# Trigger error again to test RESET SLAVE + +set global sql_slave_skip_counter=1; +start slave; +sync_with_master; +connection master; +set sql_log_bin=0; +delete from t1; +set sql_log_bin=1; +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +save_master_pos; +connection slave; +# The SQL slave thread should be stopped now. +wait_for_slave_to_stop; + +# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS. +stop slave; +reset slave; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; diff --git a/mysql-test/t/rpl_reset_slave.test b/mysql-test/t/rpl_reset_slave.test new file mode 100644 index 00000000000..9c58ac0c787 --- /dev/null +++ b/mysql-test/t/rpl_reset_slave.test @@ -0,0 +1,26 @@ +# See SHOW SLAVE STATUS displays well after RESET SLAVE (it should display the +# --master-* options from mysqld, as this is what is going to be used next time +# slave threads will be started). In bug 985, it displayed old values (of before +# RESET SLAVE). + +source include/master-slave.inc; +connection master; +save_master_pos; +connection slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +stop slave; +change master to master_user='test'; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +reset slave; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; + +start slave; +sync_with_master; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 68c2d55aac9..bd6d8c49c22 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -34,6 +34,7 @@ INSERT INTO t1 VALUES ( "2000-1-3" ); INSERT INTO t1 VALUES ( "2000-1-4" ); INSERT INTO t1 VALUES ( "2000-1-5" ); SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND "2000-1-4"; +SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY; DROP TABLE t1; # diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 8f17d8519b8..72fc73ef28b 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -17,6 +17,7 @@ ## Process this file with automake to create Makefile.in bin_SCRIPTS = @server_scripts@ \ + make_win_src_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ @@ -35,6 +36,7 @@ bin_SCRIPTS = @server_scripts@ \ mysqld_multi EXTRA_SCRIPTS = make_binary_distribution.sh \ + make_win_src_distribution.sh \ msql2mysql.sh \ mysql_config.sh \ mysql_fix_privilege_tables.sh \ @@ -64,6 +66,7 @@ pkgdata_DATA = make_binary_distribution # failures with it. CLEANFILES = @server_scripts@ \ make_binary_distribution \ + make_win_src_distribution \ msql2mysql \ mysql_config \ mysql_fix_privilege_tables \ diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh new file mode 100755 index 00000000000..8f8ee344e93 --- /dev/null +++ b/scripts/make_win_src_distribution.sh @@ -0,0 +1,402 @@ +#!/bin/sh + +# +# Script to create a Windows src package +# + +version=@VERSION@ +export version +SOURCE=`pwd` +CP="cp -p" + +DEBUG=0 +SILENT=0 +SUFFIX="" +DIRNAME="" +OUTTAR=0 + +# +# This script must run from MySQL top directory +# + +if [ ! -f scripts/make_win_src_distribution ]; then + echo "ERROR : You must run this script from the MySQL top-level directory" + exit 1 +fi + +# +# Check for source compilation/configuration +# + +if [ ! -f sql/sql_yacc.cc ]; then + echo "ERROR : Sorry, you must run this script after the complete build," + echo " hope you know what you are trying to do !!" + exit 1 +fi + +# +# Debug print of the status +# + +print_debug() +{ + for statement + do + if [ "$DEBUG" = "1" ] ; then + echo $statement + fi + done +} + +# +# Usage of the script +# + +show_usage() +{ + echo "MySQL utility script to create a Windows src package, and it takes" + echo "the following arguments:" + echo "" + echo " --debug Debug, without creating the package" + echo " --tmp Specify the temporary location" + echo " --suffix Suffix name for the package" + echo " --dirname Directory name to copy files (intermediate)" + echo " --silent Do not list verbosely files processed" + echo " --tar Create tar.gz package instead of .zip" + echo " --help Show this help message" + + exit 0 +} + +# +# Parse the input arguments +# + +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=;;"` ;; + --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;; + --silent) SILENT=1 ;; + --tar) OUTTAR=1 ;; + --help) show_usage ;; + *) + echo "Unknown argument '$arg'" + exit 1 + ;; + esac + done +} + +parse_arguments "$@" + +# +# Assign the tmp directory if it was set from the environment variables +# + +for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp +do + if [ "$i" ]; then + print_debug "Setting TMP to '$i'" + TMP=$i + break + fi +done + + +# + +# +# Create a tmp dest directory to copy files +# + +BASE=$TMP/my_win_dist$SUFFIX + +if [ -d $BASE ] ; then + print_debug "Destination directory '$BASE' already exists, deleting it" + rm -r -f $BASE +fi + +$CP -r $SOURCE/VC++Files $BASE +( +find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print +)|( + while read v + do + print_debug "Replacing LF -> CRLF from '$v'" + + # ^M -> type CTRL V + CTRL M + cat $v | sed 's/
//' | sed 's/$/
/' > $v.tmp + rm $v + mv $v.tmp $v + done +) + +# +# Move all error message files to root directory +# + +$CP -r $SOURCE/sql/share $BASE/ +rm -r -f "$BASE/share/Makefile" +rm -r -f "$BASE/share/Makefile.in" +rm -r -f "$BASE/share/Makefile.am" + +# +# Clean up if we did this from a bk tree +# + +if [ -d $BASE/SCCS ] +then + find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f +fi + +mkdir $BASE/Docs $BASE/extra $BASE/include + + +# +# Copy directory files +# + +copy_dir_files() +{ + for arg do + print_debug "Copying files from directory '$arg'" + cd $SOURCE/$arg + if [ ! -d $BASE/$arg ]; then + print_debug "Creating directory '$arg'" + mkdir $BASE/$arg + fi + for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \ + README INSTALL* LICENSE + do + if [ -f $i ] + then + $CP $SOURCE/$arg/$i $BASE/$arg/$i + fi + done + for i in *.cc + do + if [ -f $i ] + then + i=`echo $i | sed 's/.cc$//g'` + $CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp + fi + done + done +} + +# +# Copy directory contents recursively +# + +copy_dir_dirs() { + + for arg do + + basedir=$arg + + if [ ! -d $BASE/$arg ]; then + mkdir $BASE/$arg + fi + + copy_dir_files $arg + + cd $SOURCE/$arg/ + for i in * + do + if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then + copy_dir_files $basedir/$i + fi + done + done +} + +# +# Input directories to be copied +# + +for i in client dbug extra heap include isam \ + libmysql libmysqld merge myisam \ + myisammrg mysys regex sql strings \ + vio zlib +do + copy_dir_files $i +done + +# +# Input directories to be copied recursively +# + +for i in bdb innobase +do + copy_dir_dirs $i +done + +# +# Create dummy innobase configure header +# + +if [ -f $BASE/innobase/ib_config.h ]; then + rm -f $BASE/innobase/ib_config.h +fi +touch $BASE/innobase/ib_config.h + + +# +# Copy miscellaneous files +# + +cd $SOURCE +for i in COPYING ChangeLog README \ + INSTALL-SOURCE INSTALL-WIN \ + INSTALL-WIN-SOURCE \ + Docs/manual_toc.html Docs/manual.html \ + Docs/mysqld_error.txt Docs/INSTALL-BINARY + +do + print_debug "Copying file '$i'" + if [ -f $i ] + then + $CP $i $BASE/$i + fi +done + +# +# Fix some windows files +# + +./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp + +# +# Initialize the initial data directory +# + +if [ -f scripts/mysql_install_db ]; then + print_debug "Initializing the 'data' directory" + scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data +fi + +# +# Specify the distribution package name and copy it +# + +if test -z $DIRNAME +then + NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX +else + NEW_DIR_NAME=$DIRNAME +fi +NEW_NAME=$NEW_DIR_NAME-win-src + +BASE2=$TMP/$NEW_DIR_NAME +rm -r -f $BASE2 +mv $BASE $BASE2 +BASE=$BASE2 + +# +# If debugging, don't create a zip/tar/gz +# + +if [ "$DEBUG" = "1" ] ; then + echo "Please check the distribution files from $BASE" + echo "Exiting (without creating the package).." + exit +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' ` +which_1 () +{ + for cmd + do + for d in $PATH_DIRS + do + for file in $d/$cmd + do + if test -x $file -a ! -d $file + then + echo $file + exit 0 + fi + done + done + done + exit 1 +} + +# +# Create the result zip/tar file +# + +set_tarzip_options() +{ + for arg + do + if [ "$arg" = "tar" ]; then + ZIPFILE1=gnutar + ZIPFILE2=gtar + OPT=cvf + EXT=".tar" + NEED_COMPRESS=1 + if [ "$SILENT" = "1" ] ; then + OPT=cf + fi + else + ZIPFILE1=zip + ZIPFILE2="" + OPT="-r" + EXT=".zip" + NEED_COMPRESS=0 + if [ "$SILENT" = "1" ] ; then + OPT="$OPT -q" + fi + fi + done +} + +if [ "$OUTTAR" = "1" ]; then + set_tarzip_options 'tar' +else + set_tarzip_options 'zip' +fi + +tar=`which_1 $ZIPFILE1 $ZIPFILE2` +if test "$?" = "1" -o "$tar" = "" +then + print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'" + tar=tar + set_tarzip_options 'tar' +fi + +# +# Create the archive +# + +print_debug "Using $tar to create archive" + +cd $TMP + +rm -f $SOURCE/$NEW_NAME$EXT +$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME +cd $SOURCE + +if [ "$NEED_COMPRESS" = "1" ] +then + print_debug "Compressing archive" + gzip -9 $NEW_NAME$EXT + EXT="$EXT.gz" +fi + +print_debug "Removing temporary directory" +rm -r -f $BASE + +if [ "$SILENT" = "0" ] ; then + echo "$NEW_NAME$EXT created successfully !!" +fi +# End of script diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 64fdd0dfebb..ffb857933cd 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -107,7 +107,13 @@ then fi fi -hostname=`@HOSTNAME@` # Install this too in the user table +# Try to determine the fully qualified domain name (FQDN) +HOSTNAME="@HOSTNAME@" +if $HOSTNAME -f > /dev/null 2>&1 ; then + hostname=`$HOSTNAME -f` +else + hostname=`$HOSTNAME` +fi # Check if hostname is valid if test "$IN_RPM" -eq 0 -a $force -eq 0 diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 536ac9dc3d4..58c7ea8d00d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -28,7 +28,7 @@ public: Item_bool_func(Item *a) :Item_int_func(a) {} Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {} void fix_length_and_dec() { decimals=0; max_length=1; } - unsigned int size_of() { return sizeof(*this);} + unsigned int size_of() { return sizeof(*this);} }; class Item_bool_func2 :public Item_int_func @@ -595,7 +595,7 @@ public: void print(String *str); void split_sum_func(List<Item> &fields); friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); - unsigned int size_of() { return sizeof(*this);} + unsigned int size_of() { return sizeof(*this);} void top_level_item() { abort_on_null=1; } }; @@ -634,12 +634,18 @@ inline Item *and_conds(Item *a,Item *b) return cond; } +/* + XOR is Item_cond, not an Item_int_func bevause we could like to + optimize (a XOR b) later on. It's low prio, though +*/ class Item_cond_xor :public Item_cond { public: Item_cond_xor() :Item_cond() {} Item_cond_xor(Item *i1,Item *i2) :Item_cond(i1,i2) {} enum Functype functype() const { return COND_XOR_FUNC; } + /* TODO: remove the next line when implementing XOR optimization */ + enum Type type() const { return FUNC_ITEM; } longlong val_int(); const char *func_name() const { return "xor"; } }; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 84e7a44ac61..caea79314de 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1058,14 +1058,12 @@ String *Item_date_add_interval::val_str(String *str) longlong Item_date_add_interval::val_int() { TIME ltime; + longlong date; if (Item_date_add_interval::get_date(<ime,0)) return (longlong) 0; - return ((longlong) (((ulong) ltime.year)*10000L+ - (((uint) ltime.month)*100+ - (uint) ltime.day))*(longlong) 1000000L+ - (longlong) ((ulong) ((uint) ltime.hour)*10000L+ - (ulong) (((uint)ltime.minute)*100L+ - (uint) ltime.second))); + date = (ltime.year*100L + ltime.month)*100L + ltime.day; + return ltime.time_type == TIMESTAMP_DATE ? date : + ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second; } void Item_extract::fix_length_and_dec() diff --git a/sql/slave.cc b/sql/slave.cc index d7c8c6d5fd3..85a9bc0d49e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1478,6 +1478,27 @@ static int count_relay_log_space(RELAY_LOG_INFO* rli) DBUG_RETURN(0); } +void init_master_info_with_options(MASTER_INFO* mi) +{ + mi->master_log_name[0] = 0; + mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number + + if (master_host) + strmake(mi->host, master_host, sizeof(mi->host) - 1); + if (master_user) + strmake(mi->user, master_user, sizeof(mi->user) - 1); + if (master_password) + strmake(mi->password, master_password, HASH_PASSWORD_LENGTH); + mi->port = master_port; + mi->connect_retry = master_connect_retry; +} + +void clear_last_slave_error(RELAY_LOG_INFO* rli) +{ + //Clear the errors displayed by SHOW SLAVE STATUS + rli->last_slave_error[0]=0; + rli->last_slave_errno=0; +} int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, @@ -1531,18 +1552,9 @@ file '%s')", fname); goto err; } - mi->master_log_name[0] = 0; - mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number mi->fd = fd; - - if (master_host) - strmake(mi->host, master_host, sizeof(mi->host) - 1); - if (master_user) - strmake(mi->user, master_user, sizeof(mi->user) - 1); - if (master_password) - strmake(mi->password, master_password, HASH_PASSWORD_LENGTH); - mi->port = master_port; - mi->connect_retry = master_connect_retry; + init_master_info_with_options(mi); + } else // file exists { @@ -2613,6 +2625,12 @@ slave_begin: pthread_cond_broadcast(&rli->start_cond); // This should always be set to 0 when the slave thread is started rli->pending = 0; + /* + Reset errors for a clean start (otherwise, if the master is idle, the SQL + thread may execute no Query_log_event, so the error will remain even + though there's no problem anymore). + */ + clear_last_slave_error(rli); //tell the I/O thread to take relay_log_space_limit into account from now on pthread_mutex_lock(&rli->log_space_lock); diff --git a/sql/slave.h b/sql/slave.h index 42776061545..19411aba497 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -389,6 +389,8 @@ void skip_load_data_infile(NET* net); void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); void end_slave(); /* clean up */ +void init_master_info_with_options(MASTER_INFO* mi); +void clear_last_slave_error(RELAY_LOG_INFO* rli); int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 877eab74110..6df778c997b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -233,10 +233,10 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) "Found old style password for user '%s'. Ignoring user. (You may want to restart mysqld using --old-protocol)", user.user ? user.user : ""); /* purecov: tested */ } - else if (length % 8) // This holds true for passwords + else if (length % 8 || length > 16) { sql_print_error( - "Found invalid password for user: '%s@%s'; Ignoring user", + "Found invalid password for user: '%s'@'%s'; Ignoring user", user.user ? user.user : "", user.host.hostname ? user.host.hostname : ""); /* purecov: tested */ continue; /* purecov: tested */ diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index faa18b146bb..cdd0bca4a0e 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -769,12 +769,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi) &errmsg))) goto err; - //Clear master's log coordinates (only for good display of SHOW SLAVE STATUS) - mi->master_log_name[0]= 0; - mi->master_log_pos= BIN_LOG_HEADER_SIZE; - //Clear the errors displayed by SHOW SLAVE STATUS - mi->rli.last_slave_error[0]=0; - mi->rli.last_slave_errno=0; + /* + Clear master's log coordinates and reset host/user/etc to the values + specified in mysqld's options (only for good display of SHOW SLAVE STATUS; + next init_master_info() (in start_slave() for example) would have set them + the same way; but here this is for the case where the user does SHOW SLAVE + STATUS; before doing START SLAVE; + */ + init_master_info_with_options(mi); + clear_last_slave_error(&mi->rli); //close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0 end_master_info(mi); //and delete these two files @@ -965,6 +968,8 @@ int change_master(THD* thd, MASTER_INFO* mi) pthread_mutex_lock(&mi->rli.data_lock); mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */ + /* Clear the error, for a clean start. */ + clear_last_slave_error(&mi->rli); /* If we don't write new coordinates to disk now, then old will remain in relay-log.info until START SLAVE is issued; but if mysqld is shutdown diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cf430aec35d..c55015f7aa5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -602,13 +602,14 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, sql_field->flags|= NOT_NULL_FLAG; sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL; } + else + key_info->flags|= HA_NULL_PART_KEY; if (!(file->table_flags() & HA_NULL_KEY)) { my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX), MYF(0),column->field_name); DBUG_RETURN(-1); } - key_info->flags|= HA_NULL_PART_KEY; } if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) { diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 15127edeef4..0a33ae397e4 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -216,7 +216,6 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --infodir=%{_infodir} \ --includedir=%{_includedir} \ --mandir=%{_mandir} \ - --with-embedded-server \ --enable-thread-safe-client \ --with-comment=\"Official MySQL RPM\"; # Add this for more debugging support @@ -245,7 +244,7 @@ MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} # Clean up the BuildRoot first [ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR; -mkdir -p $RBR +mkdir -p $RBR%{_libdir}/mysql # # Use MYSQL_BUILD_PATH so that we can use a dedicated version of gcc @@ -267,6 +266,7 @@ BuildMySQL "--enable-shared \ --with-berkeley-db \ --with-innodb \ --with-raid \ + --with-embedded-server \ --with-server-suffix='-Max'" # Save everything for debug @@ -276,6 +276,9 @@ BuildMySQL "--enable-shared \ mv sql/mysqld sql/mysqld-max nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym +# Install embedded server library in the build root +install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql + # Save libraries (cd libmysql/.libs; tar cf $RBR/shared-libs.tar *.so*) (cd libmysql_r/.libs; tar rf $RBR/shared-libs.tar *.so*) @@ -295,13 +298,14 @@ BuildMySQL "--disable-shared \ --with-client-ldflags='-all-static' \ $USE_OTHER_LIBC_DIR \ --with-server-suffix='%{server_suffix}' \ + --without-embedded-server \ --without-berkeley-db \ --with-innodb \ --without-vio \ --without-openssl" nm --numeric-sort sql/mysqld > sql/mysqld.sym -%install -n mysql-%{mysql_version} +%install RBR=$RPM_BUILD_ROOT MBD=$RPM_BUILD_DIR/mysql-%{mysql_version} @@ -319,7 +323,7 @@ install -d $RBR%{_sbindir} make install-strip DESTDIR=$RBR benchdir_root=%{_datadir} # Install shared libraries (Disable for architectures that don't support it) -(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar) +(cd $RBR%{_libdir}; tar xf $RBR/shared-libs.tar; rm -f $RBR/shared-libs.tar) # install saved mysqld-max install -s -m755 $MBD/sql/mysqld-max $RBR%{_sbindir}/mysqld-max @@ -447,6 +451,7 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/isamlog.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1* @@ -462,6 +467,7 @@ fi %attr(755, root, root) %{_bindir}/myisampack %attr(755, root, root) %{_bindir}/mysql_convert_table_format %attr(755, root, root) %{_bindir}/mysql_explain_log +%attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables %attr(755, root, root) %{_bindir}/mysql_install_db %attr(755, root, root) %{_bindir}/mysql_secure_installation @@ -492,12 +498,14 @@ fi %attr(755, root, root) %{_bindir}/msql2mysql %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysql_find_rows +%attr(755, root, root) %{_bindir}/mysql_tableinfo %attr(755, root, root) %{_bindir}/mysql_waitpid %attr(755, root, root) %{_bindir}/mysqlaccess %attr(755, root, root) %{_bindir}/mysqladmin %attr(755, root, root) %{_bindir}/mysqlbinlog %attr(755, root, root) %{_bindir}/mysqlcheck %attr(755, root, root) %{_bindir}/mysqldump +%attr(755, root, root) %{_bindir}/mysqldumpslow %attr(755, root, root) %{_bindir}/mysqlimport %attr(755, root, root) %{_bindir}/mysqlshow @@ -554,6 +562,13 @@ fi %attr(644, root, root) %{_libdir}/mysql/libmysqld.a %changelog +* Tue Aug 05 2003 Lenz Grimmer <lenz@mysql.com> + +- Fixed BUG#959 (libmysqld not being compiled properly) +- Fixed BUG#998 (RPM build errors): added missing files to the + distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow, + mysql_fix_privilege_tables.1), removed "-n" from %install section. + * Wed Jul 09 2003 Lenz Grimmer <lenz@mysql.com> - removed the GIF Icon (file was not included in the sources anyway) |