From 3479f42807eb1bbd78804e4b6b06791635c60639 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 15 Sep 2001 22:09:12 -0600 Subject: [PATCH 1/3] fixed bug in mysqltest updated mysql-test-run with features from 4.0 added a test case for broken load data from master for MyISAM tables with checksum client/mysqltest.c: fixed parser bug mysql-test/mysql-test-run.sh: backported changes from 4.0 ( needed to be able to run client in gdb) mysql-test/t/rpl000006.test: updated test case for a bug --- client/mysqltest.c | 4 + mysql-test/mysql-test-run.sh | 184 +++++++++++++++++++++++++++++------ mysql-test/t/rpl000006.test | 18 ++++ 3 files changed, 178 insertions(+), 28 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 7d149fe6f66..4288b5d7871 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1359,6 +1359,10 @@ int read_line(char* buf, int size) *p = 0; return 0; } + else if (c == '\'') + state = R_Q1; + else if (c == '"') + state = R_Q2; else state = R_NORMAL; break; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 4d987e591e0..5504e224ca9 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -99,8 +99,9 @@ export MYSQL_TEST_DIR STD_DATA=$MYSQL_TEST_DIR/std_data hostname=`hostname` # Installed in the mysql privilege table -TESTDIR="$MYSQL_TEST_DIR/t/" +TESTDIR="$MYSQL_TEST_DIR/t" TESTSUFFIX=test +TOT_SKIP=0 TOT_PASS=0 TOT_FAIL=0 TOT_TEST=0 @@ -108,6 +109,7 @@ USERT=0 SYST=0 REALT=0 MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp +SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging RES_SPACE=" " MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \ myisammrg heap sql" @@ -124,6 +126,7 @@ USE_RUNNING_SERVER=1 DO_GCOV="" DO_GDB="" DO_DDD="" +DO_CLIENT_GDB="" SLEEP_TIME=2 DBUSER="" @@ -135,10 +138,33 @@ while test $# -gt 0; do --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;; --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;; + --with-openssl) + EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ + --ssl-ca=$BASEDIR/SSL/cacert.pem \ + --ssl-cert=$BASEDIR/SSL/server-cert.pem \ + --ssl-key=$BASEDIR/SSL/server-key.pem" + EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ + --ssl-ca=$BASEDIR/SSL/cacert.pem \ + --ssl-cert=$BASEDIR/SSL/server-cert.pem \ + --ssl-key=$BASEDIR/SSL/server-key.pem" ;; + --skip-innobase) + EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-innobase" + EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-innobase" ;; + --skip-bdb) + EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-bdb" + EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-bdb" ;; --skip-rpl) NO_SLAVE=1 ;; + --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;; + --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;; --record) RECORD=1; EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; + --bench) + DO_BENCH=1 + NO_SLAVE=1 + ;; + --big*) # Actually --big-test + EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; --sleep=*) EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" SLEEP_TIME=`$ECHO "$1" | $SED -e "s;--sleep=;;"` @@ -160,18 +186,22 @@ while test $# -gt 0; do ;; --gdb ) if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option" + $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option" fi DO_GDB=1 USE_RUNNING_SERVER="" - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-stack" + ;; + --client-gdb ) + if [ x$BINARY_DIST = x1 ] ; then + $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option" + fi + DO_CLIENT_GDB=1 ;; --ddd ) if [ x$BINARY_DIST = x1 ] ; then - $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option" + $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option" fi DO_DDD=1 - EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-stack" USE_RUNNING_SERVER="" ;; --skip-*) @@ -180,9 +210,9 @@ while test $# -gt 0; do ;; --debug) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ - --debug=d:t:O,$MYSQL_TMP_DIR/master.trace" + --debug=d:t:O,$MYSQL_TEST_DIR/var/log/master.trace" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --debug=d:t:O,$MYSQL_TMP_DIR/slave.trace" + --debug=d:t:O,$MYSQL_TEST_DIR/var/log/slave.trace" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug" ;; -- ) shift; break ;; @@ -231,16 +261,23 @@ fi [ -z "$COLUMNS" ] && COLUMNS=80 E=`$EXPR $COLUMNS - 8` -#DASH72=`expr substr '------------------------------------------------------------------------' 1 $E` +#DASH72=`$EXPR substr '------------------------------------------------------------------------' 1 $E` DASH72=`$ECHO '------------------------------------------------------------------------'|$CUT -c 1-$E` # on source dist, we pick up freshly build executables # on binary, use what is installed if [ x$SOURCE_DIST = x1 ] ; then MYSQLD="$BASEDIR/sql/mysqld" - MYSQL_TEST="$BASEDIR/client/mysqltest" + if [ -e "$BASEDIR/client/.libs/mysqltest" ] ; then + [ -e "$BASEDIR/client/.libs/lt-mysqltest" ] || $BASEDIR/client/mysqltest -V + MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest" + else + MYSQL_TEST="$BASEDIR/client/mysqltest" + fi MYSQLADMIN="$BASEDIR/client/mysqladmin" MYSQL="$BASEDIR/client/mysql" + LANGUAGE="$BASEDIR/sql/share/english/" + CHARSETSDIR="$BASEDIR/sql/share/charsets" INSTALL_DB="./install_test_db" else MYSQLD="$BASEDIR/bin/mysqld" @@ -248,6 +285,14 @@ else MYSQLADMIN="$BASEDIR/bin/mysqladmin" MYSQL="$BASEDIR/bin/mysql" INSTALL_DB="./install_test_db -bin" + if test -d "$BASEDIR/share/mysql/english" + then + LANGUAGE="$BASEDIR/share/mysql/english/" + CHARSETSDIR="$BASEDIR/share/mysql/charsets" + else + LANGUAGE="$BASEDIR/share/english/" + CHARSETSDIR="$BASEDIR/share/charsets" + fi fi # If we should run all tests cases, we will use a local server for that @@ -272,7 +317,10 @@ then fi -MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR" +MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB --user=$DBUSER --password=$DBPASSWD --silent -v --tmpdir=$MYSQL_TMP_DIR" +MYSQL_TEST_BIN=$MYSQL_TEST +MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS" +GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out @@ -303,11 +351,18 @@ show_failed_diff () { reject_file=r/$1.reject result_file=r/$1.result + eval_file=r/$1.eval + + if [ -f $eval_file ] + then + result_file=$eval_file + fi + if [ -x "$DIFF" ] && [ -f $reject_file ] then echo "Below are the diffs between actual and expected results:" echo "-------------------------------------------------------" - $DIFF -c $result_file $reject_file + $DIFF -c -a $result_file $reject_file echo "-------------------------------------------------------" echo "Please follow the instructions outlined at" echo "http://www.mysql.com/doc/R/e/Reporting_mysqltest_bugs.html" @@ -315,6 +370,15 @@ show_failed_diff () fi } +do_gdb_test () +{ + mysql_test_args="$MYSQL_TEST_ARGS $1" + $ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT + echo "Set breakpoints ( if needed) and type 'run' in gdb window" + #this xterm should not be backgrounded + xterm -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN +} + error () { $ECHO "Error: $1" exit 1 @@ -435,19 +499,38 @@ start_master() # Remove old berkeley db log files that can confuse the server $RM -f $MASTER_MYDDIR/log.* #start master - master_args="--no-defaults --log-bin=master-bin \ + if [ -z "$DO_BENCH" ] + then + master_args="--no-defaults --log-bin=master-bin \ --server-id=1 \ + --basedir=$MY_BASEDIR \ + --port=$MASTER_MYPORT \ + --exit-info=256 \ + --datadir=$MASTER_MYDDIR \ + --pid-file=$MASTER_MYPID \ + --socket=$MASTER_MYSOCK \ + --log=$MASTER_MYLOG \ + --character-sets-dir=$CHARSETSDIR \ + --tmpdir=$MYSQL_TMP_DIR \ + --language=$LANGUAGE \ + --innodb_data_file_path=ibdata1:50M \ + $SMALL_SERVER \ + $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" + else + master_args="--no-defaults --log-bin=master-bin --server-id=1 \ --basedir=$MY_BASEDIR \ --port=$MASTER_MYPORT \ --datadir=$MASTER_MYDDIR \ --pid-file=$MASTER_MYPID \ --socket=$MASTER_MYSOCK \ - --log=$MASTER_MYLOG --default-character-set=latin1 \ + --default-character-set=$CHARACTER_SET \ + --core \ --tmpdir=$MYSQL_TMP_DIR \ - --language=english \ + --language=$LANGUAGE \ --innodb_data_file_path=ibdata1:50M \ $SMALL_SERVER \ $EXTRA_MASTER_OPT $EXTRA_MASTER_MYSQLD_OPT" + fi if [ x$DO_DDD = x1 ] then $ECHO "set args $master_args" > $GDB_MASTER_INIT @@ -496,10 +579,11 @@ start_slave() --pid-file=$SLAVE_MYPID \ --port=$SLAVE_MYPORT \ --socket=$SLAVE_MYSOCK \ - --log=$SLAVE_MYLOG --default-character-set=latin1 \ + --log=$SLAVE_MYLOG \ + --character-sets-dir=$CHARSETSDIR \ --core \ --tmpdir=$MYSQL_TMP_DIR \ - --language=english \ + --language=$LANGUAGE \ --skip-innodb --skip-slave-start \ $SMALL_SERVER \ $EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT" @@ -507,7 +591,7 @@ start_slave() then $ECHO "set args $master_args" > $GDB_SLAVE_INIT ddd --debugger "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD & - prompt_user "Hit enter to continue after you've started the master" + prompt_user "Hit enter to continue after you've started the slave" elif [ x$DO_GDB = x1 ] then $ECHO "set args $slave_args" > $GDB_SLAVE_INIT @@ -609,6 +693,22 @@ run_testcase () slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` + if [ -n "$SKIP_TEST" ] ; then + SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0` + if [ x$SKIP_THIS_TEST = x1 ] ; + then + return; + fi + fi + + if [ -n "$DO_TEST" ] ; then + DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0` + if [ x$DO_THIS_TEST = x0 ] ; + then + return; + fi + fi + if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then @@ -616,9 +716,9 @@ run_testcase () SYST=" ...." REALT=" ...." timestr="$USERT $SYST $REALT" - pname=`$ECHO "$tname "|$CUT -c 1-16` - RES="$pname $timestr" - pass_inc + pname=`$ECHO "$tname "|$CUT -c 1-24` + RES="$pname $timestr" + skip_inc $ECHO "$RES$RES_SPACE [ skipped ]" return fi @@ -672,8 +772,13 @@ run_testcase () if [ -f $tf ] ; then $RM -f r/$tname.*reject - mytime=`$TIME -p $MYSQL_TEST -R r/$tname.result $EXTRA_MYSQL_TEST_OPT \ - < $tf 2> $TIMEFILE` + mysql_test_args="-R r/$tname.result $EXTRA_MYSQL_TEST_OPT" + if [ -z "$DO_CLIENT_GDB" ] ; then + mytime=`$TIME -p $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE` + else + do_gdb_test "$mysql_test_args" "$tf" + fi + res=$? if [ $res = 0 ]; then @@ -692,15 +797,19 @@ run_testcase () fi timestr="$USERT $SYST $REALT" - pname=`$ECHO "$tname "|$CUT -c 1-16` - RES="$pname $timestr" + pname=`$ECHO "$tname "|$CUT -c 1-24` + RES="$pname $timestr" if [ $res = 0 ]; then total_inc pass_inc $ECHO "$RES$RES_SPACE [ pass ]" else - if [ $res = 1 ]; then + # why the following ``if'' ? That is why res==1 is special ? + if [ $res = 2 ]; then + skip_inc + $ECHO "$RES$RES_SPACE [ skipped ]" + else total_inc fail_inc $ECHO "$RES$RES_SPACE [ fail ]" @@ -724,9 +833,6 @@ run_testcase () fi $ECHO "Resuming Tests" $ECHO "" - else - pass_inc - $ECHO "$RES$RES_SPACE [ skipped ]" fi fi fi @@ -763,6 +869,28 @@ fi $ECHO "Starting Tests" +if [ "$DO_BENCH" = 1 ] +then + BENCHDIR=$BASEDIR/sql-bench/ + savedir=`pwd` + cd $BENCHDIR + if [ -z "$1" ] + then + ./run-all-tests --socket=$MASTER_MYSOCK --user=root + else + if [ -x "./$1" ] + then + ./$1 --socket=$MASTER_MYSOCK --user=root + else + echo "benchmark $1 not found" + fi + fi + cd $savedir + mysql_stop + exit +fi + + $ECHO $ECHO " TEST USER SYSTEM ELAPSED RESULT" $ECHO $DASH72 diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test index 8668aac0b72..b8ee690837e 100644 --- a/mysql-test/t/rpl000006.test +++ b/mysql-test/t/rpl000006.test @@ -15,3 +15,21 @@ drop table foo; save_master_pos; connection slave; sync_with_master; +connection master; +set SQL_LOG_BIN=1; +CREATE TABLE t1 ( + a int not null +) TYPE=MyISAM MAX_ROWS=4000 CHECKSUM=1; + +INSERT INTO t1 VALUES (1); +save_master_pos; +connection slave; +sync_with_master; +drop table t1; +load table t1 from master; +check table t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; From 79ce69d7ea240cd8ef885d8dea9ee0f116f33348 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Sep 2001 18:17:38 +0300 Subject: [PATCH 2/3] log0log.c Eliminate a Purify warning buf0buf.c Fix uninitilaized flush field noticed with Purify innobase/buf/buf0buf.c: Fix uninitilaized flush field noticed with Purify innobase/log/log0log.c: Eliminate a Purify warning --- innobase/buf/buf0buf.c | 1 + innobase/log/log0log.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index f485088a5b7..acf56ac4ddf 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -359,6 +359,7 @@ buf_pool_create( for (i = BUF_FLUSH_LRU; i <= BUF_FLUSH_LIST; i++) { buf_pool->n_flush[i] = 0; + buf_pool->init_flush[i] = FALSE; buf_pool->no_flush[i] = os_event_create(NULL); } diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 351ea7f2fd5..beac63535ab 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -569,7 +569,7 @@ log_init(void) ut_a(LOG_BUFFER_SIZE >= 4 * UNIV_PAGE_SIZE); buf = ut_malloc(LOG_BUFFER_SIZE + OS_FILE_LOG_BLOCK_SIZE); - log_sys->buf = ut_align(buf, OS_FILE_LOG_BLOCK_SIZE); + log_sys->buf = ut_align(buf, OS_FILE_LOG_BLOCK_SIZE); log_sys->buf_size = LOG_BUFFER_SIZE; log_sys->max_buf_free = log_sys->buf_size / LOG_BUF_FLUSH_RATIO @@ -613,6 +613,7 @@ log_init(void) log_sys->archiving_state = LOG_ARCH_ON; log_sys->archived_lsn = log_sys->lsn; + log_sys->next_archived_lsn = ut_dulint_zero; log_sys->n_pending_archive_ios = 0; From ffe994614f09f79104a20fe75b1e2986d062523a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Sep 2001 23:43:53 +0300 Subject: [PATCH 3/3] Added unique error for DEADLOCK Include missing man pages into binary distribution BitKeeper/deleted/.del-make_mysql_pkg.sh~c616a18bed4b9c2: Delete: support-files/make_mysql_pkg.sh Docs/manual.texi: Changelog extra/perror.c: Added missing error codes include/my_base.h: Added unique error for DEADLOCK include/mysql.h: Portability fix for the LCC windows compiler include/mysqld_error.h: Added unique error for DEADLOCK scripts/make_binary_distribution.sh: Include missing man pages into binary distribution sql/ha_berkeley.cc: Added unique error for DEADLOCK sql/ha_berkeley.h: Added unique error for DEADLOCK sql/handler.h: Added unique error for DEADLOCK sql/mysqld.cc: Portability fix sql/share/czech/errmsg.txt: Added unique error for DEADLOCK sql/share/danish/errmsg.txt: Added unique error for DEADLOCK sql/share/dutch/errmsg.txt: Added unique error for DEADLOCK sql/share/english/errmsg.txt: Added unique error for DEADLOCK sql/share/estonian/errmsg.txt: Added unique error for DEADLOCK sql/share/french/errmsg.txt: Added unique error for DEADLOCK sql/share/german/errmsg.txt: Added unique error for DEADLOCK sql/share/greek/errmsg.txt: Added unique error for DEADLOCK sql/share/hungarian/errmsg.txt: Added unique error for DEADLOCK sql/share/italian/errmsg.txt: Added unique error for DEADLOCK sql/share/japanese/errmsg.txt: Added unique error for DEADLOCK sql/share/korean/errmsg.txt: Added unique error for DEADLOCK sql/share/norwegian-ny/errmsg.txt: Added unique error for DEADLOCK sql/share/norwegian/errmsg.txt: Added unique error for DEADLOCK sql/share/polish/errmsg.txt: Added unique error for DEADLOCK sql/share/portuguese/errmsg.txt: Added unique error for DEADLOCK sql/share/romanian/errmsg.txt: Added unique error for DEADLOCK sql/share/russian/errmsg.txt: Added unique error for DEADLOCK sql/share/slovak/errmsg.txt: Added unique error for DEADLOCK sql/share/spanish/errmsg.txt: Added unique error for DEADLOCK sql/share/swedish/errmsg.txt: Added unique error for DEADLOCK sql/share/ukrainian/errmsg.txt: Added unique error for DEADLOCK --- Docs/manual.texi | 3 + extra/perror.c | 4 + include/my_base.h | 1 + include/mysql.h | 3 + include/mysqld_error.h | 3 +- scripts/make_binary_distribution.sh | 3 +- sql/ha_berkeley.cc | 6 + sql/ha_berkeley.h | 1 + sql/handler.h | 2 +- sql/mysqld.cc | 2 +- sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 3 +- sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 3 +- sql/share/ukrainian/errmsg.txt | 1 + support-files/make_mysql_pkg.pl | 414 ++++++++++++++++++++++++++++ support-files/make_mysql_pkg.sh | 159 ----------- 34 files changed, 462 insertions(+), 165 deletions(-) create mode 100644 support-files/make_mysql_pkg.pl delete mode 100644 support-files/make_mysql_pkg.sh diff --git a/Docs/manual.texi b/Docs/manual.texi index 27c42e74540..c43f3dbc1b5 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46853,6 +46853,9 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.43 @itemize @bullet @item +Added unique error message when one gets a DEADLOCK during a transaction with +BDB tables. +@item Fixed problem with @code{BDB} tables and @code{UNIQUE} columns defined as @code{NULL}. @item diff --git a/extra/perror.c b/extra/perror.c index 5fc1f75785b..038665438d9 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -67,6 +67,10 @@ static HA_ERRORS ha_errlist[]= { 143,"Conflicting table definition between MERGE and mapped table"}, { 144,"Table is crashed and last repair failed"}, { 145,"Table was marked as crashed and should be repaired"}, + { 146,"Lock timed out; Retry transaction"}, + { 147,"Lock table is full; Restart program with a larger locktable"}, + { 148,"Updates are not allowed under a read only transactions"}, + { 149,"Lock deadlock; Retry transaction"}, { 0,NullS }, }; diff --git a/include/my_base.h b/include/my_base.h index bb2e4128195..2e097f26dc1 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -214,6 +214,7 @@ enum ha_base_keytype { #define HA_ERR_LOCK_WAIT_TIMEOUT 146 #define HA_ERR_LOCK_TABLE_FULL 147 #define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ +#define HA_ERR_LOCK_DEADLOCK 149 /* Other constants */ diff --git a/include/mysql.h b/include/mysql.h index b5d918a98af..bd54be0bc22 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -36,6 +36,9 @@ extern "C" { #ifndef _global_h /* If not standard header */ #include +#ifdef __LCC__ +#include /* For windows */ +#endif typedef char my_bool; #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) #define __WIN__ diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 08e621f4a2a..cbdf0efb122 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -213,4 +213,5 @@ #define ER_WRONG_ARGUMENTS 1210 #define ER_NO_PERMISSON_TO_CREATE_USER 1211 #define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 -#define ER_ERROR_MESSAGES 213 +#define ER_LOCK_DEADLOCK 1213 +#define ER_ERROR_MESSAGES 214 diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 40c48188346..0974ac4b368 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -50,7 +50,7 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \ $BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \ $BASE/mysql-test/t $BASE/mysql-test/r \ - $BASE/mysql-test/include $BASE/mysql-test/std_data + $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/man chmod o-rwx $BASE/data $BASE/data/* @@ -101,6 +101,7 @@ rm $BASE/include/Makefile*; rm $BASE/include/*.in $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests $CP support-files/* $BASE/support-files +$CP man/*.? $BASE/man $CP -r sql/share/* $BASE/share/mysql rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 10866a1872b..e9cd3f57122 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -1996,6 +1996,12 @@ longlong ha_berkeley::get_auto_increment() return nr; } +void ha_berkeley::print_error(int error, myf errflag) +{ + if (error == DB_LOCK_DEADLOCK) + error=HA_ERR_LOCK_DEADLOCK; + handler::print_error(error,errflag); +} /**************************************************************************** Analyzing, checking, and optimizing tables diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index fda7d2f2069..cc193aba485 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -162,6 +162,7 @@ class ha_berkeley: public handler pthread_mutex_unlock(&share->mutex); } longlong get_auto_increment(); + void print_error(int error, myf errflag); }; extern bool berkeley_skip, berkeley_shared_data; diff --git a/sql/handler.h b/sql/handler.h index 4ce743a5edd..a4b2ddc00e7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -215,7 +215,7 @@ public: int ha_open(const char *name, int mode, int test_if_locked); void update_timestamp(byte *record); void update_auto_increment(); - void print_error(int error, myf errflag); + virtual void print_error(int error, myf errflag); uint get_dup_key(int error); void change_table_ptr(TABLE *table_arg) { table=table_arg; } virtual double scan_time() diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ee72bdb1c3b..a124eea7807 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2325,7 +2325,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused))) if (!(test_flags & TEST_BLOCKING)) fcntl(sock, F_SETFL, flags); #endif - if (new_sock < 0) + if (new_sock == INVALID_SOCKET) { if ((error_count++ & 255) == 0) // This can happen often sql_perror("Error in accept"); diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 1ca2aa9b02b..9d514d26fce 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -223,3 +223,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index e6c828625eb..4247feb7ed4 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -217,3 +217,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index abaa475402e..ff8c729f445 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -218,3 +218,4 @@ "Foutieve parameters voor %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 7fc0928d67d..faded099c2d 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -206,7 +206,7 @@ "Could not create slave thread, check system resources", "User %-.64s has already more than 'max_user_connections' active connections", "You may only use constant expressions with SET", -"Lock wait timeout exceeded", +"Lock wait timeout exceeded; Try restarting transaction", "The total number of locks exceeds the lock table size", "Update locks cannot be acquired during a READ UNCOMMITTED transaction", "DROP DATABASE not allowed while thread is holding global read lock", @@ -214,3 +214,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index d9c98fa919d..ee229cec589 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -218,3 +218,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 6dc6f150d57..a5719da6d30 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -214,3 +214,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 262390d42ea..6181ece9e33 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -217,3 +217,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 146f196852b..a81608ab1d8 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -214,3 +214,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 1d76fd1d898..e6ffe66ca8e 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -216,3 +216,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 79e8c8aed8b..9c31c70a733 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -214,3 +214,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 2971882d431..fbf92c0837a 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -216,3 +216,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 7fbc60b8953..c83aaad8235 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -214,3 +214,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 9fb3f5f5666..a4f45dcb12a 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -216,3 +216,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index cc04859d99d..a4ef04c0b1a 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -216,3 +216,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 989c1f7f45d..81a574fdf49 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -218,3 +218,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 82670f503b0..46b72025f1e 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -214,3 +214,4 @@ "Argumentos errados para %s", "Não é permitido a %-.32s@%-.64s criar novos usuários", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index ba214e540e6..0b2b172811e 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -218,3 +218,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 94889100847..3ab9c76aa6f 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -217,3 +217,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 652f50c77c8..d700398c2dc 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -222,3 +222,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 271b362f63f..c786ccb9ece 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -215,3 +215,4 @@ "Wrong arguments to %s", "%-.32s@%-.64s is not allowed to create new users", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 1eb3e9db1e7..9286aba66e4 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -206,7 +206,7 @@ "Kunde inte starta en tråd för replikering", "Användare '%-.64s' har redan 'max_user_connections' aktiva inloggningar", "Man kan endast använda konstant-uttryck med SET", -"Fick inte ett lås i tid", +"Fick inte ett lås i tid ; Försök att starta om transaktionen", "Antal lås överskrider antalet reserverade lås", "Updaterings-lås kan inte göras när man använder READ UNCOMMITTED", "DROP DATABASE är inte tillåtet när man har ett globalt läs-lås", @@ -214,3 +214,4 @@ "Felaktiga argument till %s", "%-.32s@%-.64s har inte rättigheter att skapa nya användare", "Felaktig tabell definition: Alla tabeller i en MERGE tabell måste vara i samma databas", +"Fick 'DEADLOCK' vid låsförsök av block/rad; Försök att starta om transaktionen", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index db17f88f2c2..000f3114cda 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -219,3 +219,4 @@ "èÉÂÎÉÊ ÁÒÇÕÍÅÎÔ ÄÌÑ %s", "ëÏÒÉÓÔÕ×ÁÞÕ %-.32s@%-.64s ÎÅ ÄÏÚ×ÏÌÅÎÏ ÓÔ×ÏÒÀ×ÁÔÉ ÎÏ×ÉÈ ËÏÒÉÓÔÕ×ÁÞ¦×", "Incorrect table definition; All MERGE tables must be in the same database", +"Deadlock found when trying to get lock; Try restarting transaction", diff --git a/support-files/make_mysql_pkg.pl b/support-files/make_mysql_pkg.pl new file mode 100644 index 00000000000..75345c7275b --- /dev/null +++ b/support-files/make_mysql_pkg.pl @@ -0,0 +1,414 @@ +#!/usr/bin/perl -w +# +# +# make_mysql_pkg.pl +# +# This script creates a Mac OS X installation package +# of MySQL for Apple's Installer application. +# +# To use it: +# +# 1.) Unpack the mysql source tarball and cd into the directory +# 2.) execute this script +# +# +# Written by Marc Liyanage (http://www.entropy.ch) +# +# History: +# +# When Who What +# ------------------------------------------------------------- +# 2001-09-16 Marc Liyanage First version + +use strict; +use DirHandle; + +my $data = {}; + +$data->{PREFIX_DIR} = "/usr/local"; +$data->{CONFIG} = "--prefix=$data->{PREFIX_DIR} --with-innodb"; + + + + + +prepare($data); +configure_source($data); +make($data); +make_binary_distribution($data); +create_pax_root($data); +create_package($data); +cleanup($data); + +print "Package $data->{PACKAGE_TARBALL_FILENAME} created\n"; + + + + + + +# Subroutines follow here... + + + + +# Prepares data in the global $data hash, like version numbers, +# directory names etc. Also makes sure that no old stuff +# is in our way. +# +sub prepare { + + my ($data) = @_; + + # Keep the current wd for reference + # + $data->{OLDWD} = `pwd`; + chomp($data->{OLDWD}); + + # Look for configure script + # + unless (-f "configure") { + abort($data, "Unable to find 'configure', make sure you're in the MySQL source toplevel directory!"); + } + + # Try to find version number there + # + my $mysql_version_h = `cat configure`; + ($data->{VERSION}) = $mysql_version_h =~ /^VERSION=(.+?)$/m; + + unless ($data->{VERSION} =~ /\d+/) { + abort($data, "Unable to find MySQL version number!"); + } + + debug($data, "found MySQL version number $data->{VERSION}"); + + + # PAXROOT_DIR is where we will build our own little + # fake /usr/local directory. Make sure it doesn't exist, + # then try to create it. + # + $data->{PAXROOT_DIR} = "/tmp/mysql-$data->{VERSION}-paxroot"; + + if (-e $data->{PAXROOT_DIR}) { + abort($data, "$data->{PAXROOT_DIR} exists, please remove first"); + } + + if (system("mkdir $data->{PAXROOT_DIR}")) { + abort($data, "Unable to mkdir $data->{PAXROOT_DIR}, please make sure you have the right permissions!"); + } + + + # PACKAGE_DIR is where we will build the package directory + # hierarchy, according to the standard .pkg layout. + # + $data->{PACKAGE_NAME} = "mysql-$data->{VERSION}.pkg"; + $data->{PACKAGE_DIR} = "/tmp/$data->{PACKAGE_NAME}"; + + if (-e $data->{PACKAGE_DIR}) { + abort($data, "$data->{PACKAGE_DIR} exists, please remove first"); + } + + if (system("mkdir $data->{PACKAGE_DIR}")) { + abort($data, "Unable to mkdir $data->{PACKAGE_DIR}, please make sure you have the right permissions!"); + } + + +} + + + +# Configure the MySQL source with our options +# +sub configure_source { + + my ($data) = @_; + + if (system("./configure $data->{CONFIG}")) { + abort($data, "Unable to configure!"); + } + +} + + + + +# Build the software +# +sub make { + + my ($data) = @_; + + if (system("make")) { + abort($data, "Unable to make!"); + } + +} + + + +# We don't ever install the software, but instead we use an +# included script to create a binary distribution +# tarball. +# +sub make_binary_distribution { + + my ($data) = @_; + + if (system("./scripts/make_binary_distribution > make_binary_distribution.out")) { + abort($data, "Unable to make_binary_distribution!"); + } + + my @output = `cat make_binary_distribution.out`; + my $last_line = $output[-1]; + unlink("make_binary_distribution.out"); + + my ($tarball_filename, $tarball_directory) = $last_line =~ /^((.+)\.tar\.gz) created/i; + + unless ($tarball_filename and -f $tarball_filename) { + abort($data, "Unable determine the output filename of scripts/make_binary_distribution!"); + } + + $data->{BINARY_TARBALL_FILENAME} = $tarball_filename; + $data->{BINARY_TARBALL_DIRECTORY} = $tarball_directory; + +} + + + + +# Now we build a fake /usr/local directory hierarchy. +# This will be fed to the pax tool to create +# the archive. +# +sub create_pax_root { + + my ($data) = @_; + + # Go there and try to extract the binary distribution + # tarball which we created in the previous step. + # + chdir($data->{PAXROOT_DIR}); + my $tarfile = "$data->{OLDWD}/$data->{BINARY_TARBALL_FILENAME}"; + + if(system("tar -xzf $tarfile")) { + abort($data, "Unable to extract $tarfile inside $data->{PAXROOT_DIR}"); + } + + # Rename it to what we want it to be in the + # installed /usr/local directory later on, i.e. + # mysql-. Then create a symlink from + # mysql to mysql- + # + rename($data->{BINARY_TARBALL_DIRECTORY}, "mysql-$data->{VERSION}"); + symlink("mysql-$data->{VERSION}", "mysql"); + + + # We create a bunch of symlinks in /usr/local/bin and + # /usr/local/share/man so that the end-user will not + # have to adjust PATH and MANPATH to include the + # /usr/local/mysql/bin and man directories. + # + system("mkdir -p $_") foreach qw(bin share/man); + + + # First create the symlinks in the bin directory + # + chdir("bin"); + symlink("../mysql/bin/$_", "$_") foreach (grep {$_ !~ /^\.+$/} DirHandle->new("../mysql/bin")->read()); + + + # Now include the man pages. Two problems here: + # 1.) the make_binary_distribution script does not seem + # to include the man pages, so we have to copy them over + # now. + # 2.) The man pages could be in different sections, so + # we have to recursively copy *and* symlink them. + # + + # First find out what's there in the source distribution. + # Store the names of the manpages in anonymous + # arrays which in turn will be stored in a hash, using + # the section numbers as hash keys. + # + chdir($data->{OLDWD}); + my %man_sections; + foreach my $manpage (grep {$_ =~ /^.+\.(\d+)$/} DirHandle->new("man")->read()) { + + my ($section) = $manpage =~ /\.(\d+)$/; + + $man_sections{$section} ||= []; + push @{$man_sections{$section}}, "$manpage"; + + } + + + # Now iterate through the sections and man pages, + # and copy/symlink the man pages + # + chdir("$data->{PAXROOT_DIR}/share/man/"); + + foreach my $section (keys(%man_sections)) { + + system("mkdir -p $data->{PAXROOT_DIR}/mysql/man/man$section/"); + system("mkdir -p man$section"); + chdir("man$section"); + + foreach my $manpage (@{$man_sections{$section}}) { + + system("cp $data->{OLDWD}/man/$manpage $data->{PAXROOT_DIR}/mysql/man/man$section/"); + symlink("../../../mysql/man/man$section/$manpage", $manpage) + + } + + chdir(".."); + + } + + +} + + + +# Take the pax root directory, create a few auxiliary +# files and then pack everything up into a tarball +# +sub create_package { + + my ($data) = @_; + + # Create the resources directory in which all + # interesting files for this package will be stored + # + $data->{PKG_RESOURCES_DIR} = "$data->{PACKAGE_DIR}/Contents/Resources"; + + if (system("mkdir -p $data->{PKG_RESOURCES_DIR}")) { + abort("Unable to create package resources dir $data->{PKG_RESOURCES_DIR}"); + } + + + # Create the big archive with all the files using + # the pax tool + # + chdir($data->{PAXROOT_DIR}); + if(system("pax -w . | gzip -c > $data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.pax.gz")) { + abort("Unable to create package pax file"); + } + + + # Create the "Bill Of Materials" (bom) file. + # + if(system("mkbom . $data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.bom")) { + abort("Unable to create package bom file"); + } + + + # Create the ".sizes" file with some information about the package + # + my $size_uncompressed = `du -sk $data->{PAXROOT_DIR} | cut -f 1`; + chomp($size_uncompressed); + + my $size_compressed = `du -sk $data->{PACKAGE_DIR} | cut -f 1`; + chomp($size_compressed); + + my $numfiles = `find /tmp/mysql-3.23.42-paxroot/ | wc -l`; + $numfiles--; + + open(SIZESFILE, ">$data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.sizes") or abort("Unable to write open sizes file $data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.sizes"); + print SIZESFILE "NumFiles $numfiles\n"; + print SIZESFILE "InstalledSize $size_uncompressed\n"; + print SIZESFILE "CompressedSize $size_compressed\n"; + close(SIZESFILE); + + + # Create the ".info" file with more information abou the package. + # + open(INFOFILE, ">$data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.info") or abort("Unable to write open sizes file $data->{PKG_RESOURCES_DIR}/mysql-$data->{VERSION}.info"); + my $infodata = join("", ); + $infodata =~ s/<%(.+?)%>/$data->{$1}/eg; + abort("Unable to get info file data from __DATA__!") unless ($infodata =~ /\w+/); + print INFOFILE $infodata; + close(INFOFILE); + + + + # Finally, create the .tar.gz file for the package, + # this is our end result + # + chdir($data->{PACKAGE_DIR}); + chdir(".."); + + $data->{PACKAGE_TARBALL_FILENAME} = "$data->{PACKAGE_NAME}.tar.gz"; + + if(system("tar -czf $data->{OLDWD}/$data->{PACKAGE_TARBALL_FILENAME} $data->{PACKAGE_NAME}")) { + abort("Unable to create package tar file $data->{OLDWD}/$data->{PACKAGE_TARBALL_FILENAME}"); + } + + + +} + + +# Abort with an error message +# +sub abort { + + my ($data, $errormessage) = @_; + + my ($caller) = (caller(1))[3]; + $caller =~ s/^main:://; + + print "*** Error: $caller(): $errormessage\n"; + + exit 1; + +} + + +# Output informative messages +# +sub debug { + + my ($data, $message) = @_; + + my ($caller) = (caller(1))[3]; + $caller =~ s/^main:://; + + print "*** Info: $caller(): $message\n"; + +} + + + +# Remove temporary items +# +sub cleanup { + + my ($data) = @_; + + chdir($data->{OLDWD}); + + system("rm -rf $data->{PACKAGE_DIR}"); + system("rm -rf $data->{PAXROOT_DIR}"); + system("rm $data->{BINARY_TARBALL_FILENAME}"); + +} + + + + +__DATA__ +Title MySQL +Version <%VERSION%> +Description The MySQL database server in a convenient Mac OS X package. Some additional configuration is necessary, please see http://www.entropy.ch/software/macosx/mysql/ +DefaultLocation /usr/local +Diskname (null) +DeleteWarning +NeedsAuthorization YES +DisableStop NO +UseUserMask NO +Application NO +Relocatable NO +Required NO +InstallOnly NO +RequiresReboot NO +InstallFat NO \ No newline at end of file diff --git a/support-files/make_mysql_pkg.sh b/support-files/make_mysql_pkg.sh deleted file mode 100644 index b0eb817fff4..00000000000 --- a/support-files/make_mysql_pkg.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh -# -# make_mysql_pkg.sh -# -# This script creates a Mac OS X installation package -# for Apple's Installer application. -# -# To use it: -# -# 1.) unpack the MySQL source tarball -# 2.) cd to into the resulting directory and stay there for the next steps -# 3.) "configure" the source (preferably with --mandir=/usr/local/share/man) -# 4.) "make" the package -# 5.) invoke this script with superuser privileges (sudo or in a root shell) -# -# Written by Marc Liyanage (http://www.entropy.ch) -# -# History: -# -# When Who What -# ------------------------------------------------------------- -# 2001-09-13 Marc Liyanage First version - - -# Find the version number of this particular MySQL build -# -OLDWD=`pwd` -VERSION_H_FILE=$OLDWD/include/mysql_version.h - -if [ ! -e $VERSION_H_FILE ] -then -echo $VERSION_H_FILE not found, make sure you are in the mysql source dir -exit 1 -fi - -MYSQLVERSION=`egrep 'MYSQL_SERVER_VERSION' $VERSION_H_FILE | perl -e '$_ = <>; $_ =~ /"(.+?)"/; print $1'` - - - -# We will temporarily rename /usr/local to this name -# and then mkdir a new, empty /usr/local -# -LOCAL_TMPDIR=/usr/local.tmp - -# At the end, we'll keep our temporary /usr/local -# to this name -# -LOCAL_BACKUPDIR=/usr/local.mysql-package - -# Where do we create the package directory -# -PKG_DIR=/tmp/mysql-$MYSQLVERSION.pkg - -# Where is the resources directory within the -# package directory -# -PKG_RESOURCES_DIR=$PKG_DIR/Contents/Resources - -# Check if old stuff is in our way -# -if [ -e $LOCAL_BACKUPDIR ] -then -echo $LOCAL_BACKUPDIR exists, please remove first... -exit 1 -fi - -if [ -e $LOCAL_TMPDIR ] -then -echo $LOCAL_TMPDIR exists, please remove first... -exit 1 -fi - -if [ -e $PKG_DIR ] -then -echo $PKG_DIR exists, please remove first... -exit 1 -fi - -# Now create the package dir -# -mkdir -p $PKG_RESOURCES_DIR - -# Move the existing /usr/local out of our way -# -mv /usr/local $LOCAL_TMPDIR - -# Now create our new empty temporary /usr/local -# -mkdir /usr/local - -# And install MySQL there -# -make install - - -# cd there so the next few commands will use it -# as base directory -# -cd /usr/local - -# First, create the gzipped pax archive file -# which contains the actual files -# -pax -w . | gzip -c > $PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.pax.gz - -# Create the bom ("Bill Of Materials") file -# -mkbom . $PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.bom - -# Create the sizes file with the package space -# requirement numbers and file count -# -SIZE_UNCOMPRESSED=`du -sk /usr/local | cut -f 1` -SIZE_COMPRESSED=`du -sk $PKG_DIR | cut -f 1` -NUMFILES=`find /usr/local | wc -l | perl -e '$_ = <>; $_ =~ /\s+(\d+)/; print $1 - 1'` - -echo NumFiles $NUMFILES >> $PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.sizes -echo InstalledSize $SIZE_UNCOMPRESSED >> $PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.sizes -echo CompressedSize $SIZE_COMPRESSED >> $PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.sizes - - -# Finally create the info file which drives the "Installer" application -# -cat >$PKG_RESOURCES_DIR/mysql-$MYSQLVERSION.info <<- EOF - Title MySQL - Version $MYSQLVERSION - Description The MySQL database server in a convenient Mac OS X package. Some additional configuration is necessary, please see http://www.entropy.ch/software/macosx/mysql/ - DefaultLocation /usr/local - Diskname (null) - DeleteWarning - NeedsAuthorization YES - DisableStop NO - UseUserMask NO - Application NO - Relocatable NO - Required NO - InstallOnly NO - RequiresReboot NO - InstallFat NO -EOF - -# Create a .tar.gz file for the package directory -# -cd $PKG_DIR -cd .. -DIRNAME=`dirname $PKG_DIR` -BASENAME=`basename $PKG_DIR` -FILENAME=$BASENAME.tar.gz -tar -cvzf $FILENAME $BASENAME - -# Move our temporary /usr/local out of the way -# and the original one back -# -mv /usr/local $LOCAL_BACKUPDIR -mv $LOCAL_TMPDIR /usr/local - -echo output package is in $DIRNAME/$FILENAME - -