From 18585d178d6cbf8364c11da5973531681ac26879 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Sep 2002 13:53:14 +0200 Subject: [PATCH 01/39] - merge 4.0 modifications to Build-tools/Do-compile Build-tools/Do-compile: - Merged 4.0 modifications (--innodb, more verbose failure reports) --- Build-tools/Do-compile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index e6773c1ca58..6bee9fb8a92 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -208,12 +208,15 @@ if ($opt_stage <= 1) $opt_config_options.= " --disable-shared" if (!$opt_enable_shared); # Default for binary versions $opt_config_options.= " --with-berkeley-db" if ($opt_bdb); $opt_config_options.= " --with-client-ldflags=-all-static" if ($opt_static_client); - $opt_config_options.= " --with-innodb" if ($opt_innodb); $opt_config_options.= " --with-libwrap" if ($opt_libwrap); $opt_config_options.= " --with-low-memory" if ($opt_with_low_memory); $opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server); $opt_config_options.= " --with-raid" if ($opt_raid); + # Only enable InnoDB when requested (required to be able to + # build the "Classic" packages that do not include InnoDB) + $opt_config_options.= " --without-innodb" if (!$opt_innodb); + if ($opt_with_other_libc) { $opt_with_other_libc= " --with-other-libc=$opt_with_other_libc"; @@ -516,9 +519,9 @@ sub abort open(TMP,">$mail_header_file"); print TMP "From: mysql\@$full_host_name\n"; print TMP "To: $email\n"; - print TMP "Subject: MySQL compilation failed again\n\n"; + print TMP "Subject: $ver$opt_version_suffix compilation failed\n\n"; close TMP; - system("tail -30 $log > $log.mail"); + system("tail -40 $log > $log.mail"); system("cat $mail_header_file $log.mail | $sendmail -t -f $email"); unlink($mail_header_file); unlink("$log.mail"); From 821c77c79d47ce1c15c179509b9c6418e01323c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Oct 2002 13:47:58 +0300 Subject: [PATCH 02/39] lock0lock.c: Fix bug: the AUTO-INC lock was held to the end of trx if it was granted after a lock wait innobase/lock/lock0lock.c: Fix bug: the AUTO-INC lock was held to the end of trx if it was granted after a lock wait --- innobase/lock/lock0lock.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index da4092b926e..5fe8dc62f5a 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -1863,6 +1863,19 @@ lock_grant( ut_ad(mutex_own(&kernel_mutex)); lock_reset_lock_and_trx_wait(lock); + + if (lock_get_mode(lock) == LOCK_AUTO_INC) { + + if (lock->trx->auto_inc_lock != NULL) { + fprintf(stderr, + "InnoDB: Error: trx already had an AUTO-INC lock!\n"); + } + + /* Store pointer to lock to trx so that we know to + release it at the end of the SQL statement */ + + lock->trx->auto_inc_lock = lock; + } if (lock_print_waits) { printf("Lock wait for trx %lu ends\n", From 8bc99030a1f163f02e0eaa743b343d18e075be22 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Oct 2002 13:06:04 +0200 Subject: [PATCH 03/39] - Small fix for support-files/mysql.spec.sh - Updated scripts/make_binary_distribution.sh to include the correct ChangeLog and the LICENSE file for non-GPL builds scripts/make_binary_distribution.sh: - Add BK ChangeLog (if existing) instead of sql/ChangeLog, which is not updated anymore since we switched to BK - Add LICENSE, if exists (required for non-GPL binary builds) support-files/mysql.spec.sh: - MySQL-Max now requires MySQL to be the same version (to avoid version mismatches e.g. mixing 3.23.xx and 4.0 packages) --- scripts/make_binary_distribution.sh | 9 ++++++--- support-files/mysql.spec.sh | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 99eb9e42967..c67de656600 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -54,10 +54,13 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ chmod o-rwx $BASE/data $BASE/data/* -for i in sql/ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - Docs/manual.html Docs/manual.txt Docs/manual_toc.html +for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ + LICENSE Docs/manual.html Docs/manual.txt Docs/manual_toc.html do - $CP $i $BASE + if [ -f $i ] + then + $CP $i $BASE + fi done for i in extra/comp_err extra/replace extra/perror extra/resolveip \ diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index d1ee921e8db..721e928930e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -115,6 +115,7 @@ Summary: MySQL - server with Berkeley DB and Innodb support Group: Applications/Databases Provides: mysql-Max Obsoletes: mysql-Max +Requires: MySQL = %{version} %description Max Optional MySQL server binary that supports features @@ -422,6 +423,11 @@ fi %changelog +* Tue Sep 24 2002 Lenz Grimmer + +- MySQL-Max now requires MySQL to be the same version (to + avoid version mismatches e.g. mixing 3.23.xx and 4.0 packages) + * Thu Jul 30 2002 Lenz Grimmer - Use some more macros (mandir and infodir) From 421514ae817446bdb851476c98d1af640fe7ce1c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Oct 2002 13:20:17 +0200 Subject: [PATCH 04/39] - applied fix from 4.0 configure.in required to build shared libraries with static glibc installed configure.in: - Better fix for building shared libraries with a patched glibc (from 4.0 tree) - removed obsolete comment --- configure.in | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 7051db63e5c..002932c9835 100644 --- a/configure.in +++ b/configure.in @@ -481,7 +481,7 @@ AC_ARG_WITH(other-libc, # we need special flags, but we will have to add those later STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv" STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS" - OTHER_LIBC_LIB="-L$other_libc_lib" + OTHER_LIBC_LIB="-static -L$other_libc_lib" static_nss=1 else # this is a dirty hack. We if we detect static nss glibc in the special @@ -529,7 +529,6 @@ fi AC_ARG_WITH(server-suffix, [ --with-server-suffix Append value to the version string.], - # I heard that 'cut' isn't portable. Isn't there a better way? [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ], [ MYSQL_SERVER_SUFFIX= ] ) @@ -2122,10 +2121,7 @@ then AC_DEFINE(THREAD_SAFE_CLIENT) fi -if test "$static_nss" = "1" -then - CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" -fi +CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" AC_SUBST(CLIENT_LIBS) AC_SUBST(sql_client_dirs) @@ -2275,11 +2271,8 @@ fi # I know to add the static NSS magic if we have static NSS libraries with # glibc - Sasha -if test "$static_nss" = "1" -then - LDFLAGS="$LDFLAGS -static $OTHER_LIBC_LIB" - LIBS="$LIBS $STATIC_NSS_FLAGS" -fi +LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB" +LIBS="$LIBS $STATIC_NSS_FLAGS" AC_SUBST(sql_server_dirs) AC_SUBST(thread_dirs) From 28ebf117dd95c831289b7027b44e64b441bb950c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Oct 2002 18:10:34 +0300 Subject: [PATCH 05/39] os0thread.h: Fix the probable reason why InnoDB versions after July 2, 2002 did not start properly in some Win 95/98/ME computers innobase/include/os0thread.h: Fix the probable reason why InnoDB versions after July 2, 2002 did not start properly in some Win 95/98/ME computers --- innobase/include/os0thread.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h index 9459750719f..8355afa46e9 100644 --- a/innobase/include/os0thread.h +++ b/innobase/include/os0thread.h @@ -15,7 +15,16 @@ Created 9/8/1995 Heikki Tuuri /* Maximum number of threads which can be created in the program; this is also the size of the wait slot array for MySQL threads which can wait inside InnoDB */ +#ifdef __WIN__ +/* Windows 95/98/ME seemed to have difficulties creating the all +the event semaphores for the wait array slots. If the computer had +<= 64 MB memory, InnoDB startup could take minutes or even crash. +That is why we set this to only 1000 in Windows. */ + +#define OS_THREAD_MAX_N 1000 +#else #define OS_THREAD_MAX_N 10000 +#endif /* Possible fixed priorities for threads */ #define OS_THREAD_PRIORITY_NONE 100 From 3a088a328d3b394b2ac678e2a1e73288708aba47 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Oct 2002 19:10:49 +0300 Subject: [PATCH 06/39] ha_innobase.cc, ha_innobase.h: Backport from 4.0.4 the bug fix of the crash when a temporary table was created inside LOCK TABLES and used sql/ha_innobase.h: Backport from 4.0.4 the bug fix of the crash when a temporary table was created inside LOCK TABLES and used sql/ha_innobase.cc: Backport from 4.0.4 the bug fix of the crash when a temporary table was created inside LOCK TABLES and used --- sql/ha_innobase.cc | 44 +++++++++++++++++++++++++++++++++++++++++++- sql/ha_innobase.h | 2 ++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index ef58b5b7dbb..ccf53eeb5d7 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1977,7 +1977,8 @@ convert_search_mode_to_innobase( case HA_READ_AFTER_KEY: return(PAGE_CUR_G); case HA_READ_BEFORE_KEY: return(PAGE_CUR_L); case HA_READ_PREFIX: return(PAGE_CUR_GE); - case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE); + case HA_READ_PREFIX_LAST: ut_a(0); return(PAGE_CUR_LE); + /* HA_READ_PREFIX_LAST does not yet work in InnoDB! */ /* the above PREFIX flags mean that the last field in the key value may just be a prefix of the complete fixed length field */ @@ -3413,6 +3414,47 @@ ha_innobase::reset(void) return(0); } + +/********************************************************************** +When we create a temporary table inside MySQL LOCK TABLES, MySQL will +not call external_lock for the temporary table when it uses it. Instead, +it will call this function. */ + +int +ha_innobase::start_stmt( +/*====================*/ + /* out: 0 or error code */ + THD* thd) /* in: handle to the user thread */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + trx_t* trx; + + update_thd(thd); + + trx = prebuilt->trx; + + innobase_release_stat_resources(trx); + trx_mark_sql_stat_end(trx); + + auto_inc_counter_for_this_stat = 0; + prebuilt->sql_stat_start = TRUE; + prebuilt->hint_no_need_to_fetch_extra_cols = TRUE; + prebuilt->read_just_key = 0; + + if (prebuilt->select_lock_type == LOCK_NONE) { + /* This handle is for a temporary table created inside + this same LOCK TABLES; since MySQL does NOT call external_lock + in this case, we must use x-row locks inside InnoDB to be + prepared for an update of a row */ + + prebuilt->select_lock_type = LOCK_X; + } + + thd->transaction.all.innodb_active_trans = 1; + + return(0); +} + /********************************************************************** As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement, we can use this function to store the diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 694d403a2d5..4fd42d08390 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -139,6 +139,8 @@ class ha_innobase: public handler int extra(enum ha_extra_function operation); int reset(void); int external_lock(THD *thd, int lock_type); + int start_stmt(THD *thd); + void position(byte *record); ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len, From 3c1e16c5749d73c55df89cd37c0c6a1bbd6bad0b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Oct 2002 18:30:49 +0200 Subject: [PATCH 07/39] - rearranged test order in Do-compile (BDB tends to fail more often than InnoDB, so test it after InnoDB) Build-tools/Do-compile: - Test BDB after InnoDB (BDB tends to fail more often than InnoDB) --- Build-tools/Do-compile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index 6bee9fb8a92..a3da1804af5 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -374,14 +374,14 @@ if ($opt_stage <= 9 && !$opt_no_test) log_system("rm -f output/*"); $tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : ""; check_system("perl ./run-all-tests --log --die-on-errors $connect_option $tmp","RUN-mysql"); - if ($opt_bdb) - { - check_system("perl ./run-all-tests --log --suffix=\"_bdb\" --die-on-errors $connect_option $tmp --create-option=\"type=bdb\"","RUN-mysql"); - } if ($opt_innodb) { check_system("perl ./run-all-tests --log --suffix=\"_innodb\" --die-on-errors $connect_option $tmp --create-option=\"type=innodb\"","RUN-mysql"); } + if ($opt_bdb) + { + check_system("perl ./run-all-tests --log --suffix=\"_bdb\" --die-on-errors $connect_option $tmp --create-option=\"type=bdb\"","RUN-mysql"); + } } rm_all($bench_tmpdir); From b05f22d9972e49dc911dd3b84042bcca9af7aaae Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Oct 2002 19:48:24 +0300 Subject: [PATCH 08/39] ha_innobase.cc: Remove unintentionally pushed assert sql/ha_innobase.cc: Remove unintentionally pushed assert --- sql/ha_innobase.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index ccf53eeb5d7..888b2aa784b 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1977,7 +1977,7 @@ convert_search_mode_to_innobase( case HA_READ_AFTER_KEY: return(PAGE_CUR_G); case HA_READ_BEFORE_KEY: return(PAGE_CUR_L); case HA_READ_PREFIX: return(PAGE_CUR_GE); - case HA_READ_PREFIX_LAST: ut_a(0); return(PAGE_CUR_LE); + case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE); /* HA_READ_PREFIX_LAST does not yet work in InnoDB! */ /* the above PREFIX flags mean that the last field in the key value may just be a prefix From ed175a5ebd45f6005eff4ee59426d99b733a4008 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Oct 2002 23:07:32 +0300 Subject: [PATCH 09/39] lock0lock.c: Fix bug: if SHOW INNODB STATUS or innodb_monitor printed several hundred transactions, the output was truncated and we forgot to release the kernel mutex innobase/lock/lock0lock.c: Fix bug: if SHOW INNODB STATUS or innodb_monitor printed several hundred transactions, the output was truncated and we forgot to release the kernel mutex --- innobase/lock/lock0lock.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 5fe8dc62f5a..c180ecb50ce 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -3599,6 +3599,8 @@ lock_print_info( mtr_t mtr; if (buf_end - buf < 600) { + sprintf(buf, "... output truncated!\n"); + return; } @@ -3623,6 +3625,9 @@ lock_print_info( if ((ulint)(buf_end - buf) < 100 + strlen(lock_latest_err_buf)) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } @@ -3630,6 +3635,9 @@ lock_print_info( } if (buf_end - buf < 600) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } @@ -3641,6 +3649,9 @@ lock_print_info( while (trx) { if (buf_end - buf < 900) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } @@ -3678,6 +3689,9 @@ loop: } if (buf_end - buf < 900) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } @@ -3688,6 +3702,9 @@ loop: buf += strlen(buf); if (buf_end - buf < 500) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } @@ -3742,6 +3759,9 @@ loop: } if (buf_end - buf < 500) { + lock_mutex_exit_kernel(); + sprintf(buf, "... output truncated!\n"); + return; } From 987474a6c386bff365469260bd8b258239dcf7b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Oct 2002 15:57:18 +0300 Subject: [PATCH 10/39] Small fix in mysqld_safe for some shells --- Docs/manual.texi | 2 ++ scripts/safe_mysqld.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 24b6ad6d4a8..29e4cb6758a 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,6 +46929,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item +Small fix in mysqld_safe for some shells +@item Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. @item Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 3494e3d707e..177a809ff36 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -269,8 +269,8 @@ do done fi - echo "`date +'%y%m%d %H:%M:%S mysqld restarted'`" | tee -a $err_log + echo "`date +'%y%m%d %H:%M:%S' mysqld restarted" | tee -a $err_log done -echo "`date +'%y%m%d %H:%M:%S mysqld ended'`" | tee -a $err_log +echo "`date +'%y%m%d %H:%M:%S'` mysqld ended" | tee -a $err_log echo "" | tee -a $err_log From 25b2d47517dbf04d5898c4b08bb88f2d3cb98839 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Oct 2002 22:23:51 +0300 Subject: [PATCH 11/39] btr0cur.c: Do not let range estimator to return over 1 / 2 of total rows in table; use longlong in range estimation btr0cur.h, ha_innobase.cc: Use longlong in range estimation, in case there are > 4 billion rows sql/ha_innobase.cc: Use longlong in range estimation, in case there are > 4 billion rows innobase/include/btr0cur.h: Use longlong in range estimation, in case there are > 4 billion rows innobase/btr/btr0cur.c: Do not let range estimator to return over 1 / 2 of total rows in table; use longlong in range estimation --- innobase/btr/btr0cur.c | 20 ++++++++++++++++++-- innobase/include/btr0cur.h | 2 +- sql/ha_innobase.cc | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 8abf918366a..6cf3d640aa0 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2531,7 +2531,7 @@ btr_cur_add_path_info( /*********************************************************************** Estimates the number of rows in a given index range. */ -ulint +ib_longlong btr_estimate_n_rows_in_range( /*=========================*/ /* out: estimated number of rows */ @@ -2548,7 +2548,7 @@ btr_estimate_n_rows_in_range( btr_path_t* slot2; ibool diverged; ulint divergence_level; - ulint n_rows; + ib_longlong n_rows; ulint i; mtr_t mtr; @@ -2608,6 +2608,22 @@ btr_estimate_n_rows_in_range( n_rows = n_rows * 2; } + + /* Do not estimate the number of rows in the range + to over 1 / 2 of the estimated rows in the whole + table */ + + if (n_rows > index->table->stat_n_rows / 2) { + n_rows = index->table->stat_n_rows / 2; + + /* If there are just 0 or 1 rows in the table, + then we estimate all rows are in the range */ + + if (n_rows == 0) { + n_rows = index->table->stat_n_rows; + } + } + return(n_rows); } diff --git a/innobase/include/btr0cur.h b/innobase/include/btr0cur.h index b01cbd9a875..7039ceba245 100644 --- a/innobase/include/btr0cur.h +++ b/innobase/include/btr0cur.h @@ -417,7 +417,7 @@ btr_cur_parse_del_mark_set_sec_rec( /*********************************************************************** Estimates the number of rows in a given index range. */ -ulint +ib_longlong btr_estimate_n_rows_in_range( /*=========================*/ /* out: estimated number of rows */ diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 888b2aa784b..c2a764c09bc 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -3031,7 +3031,7 @@ ha_innobase::records_in_range( MYF(MY_WME)); dtuple_t* range_start; dtuple_t* range_end; - ulint n_rows; + ib_longlong n_rows; ulint mode1; ulint mode2; void* heap1; From 03af773b7b58400d379c9d22402e712dc911110e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 6 Oct 2002 14:53:49 +0300 Subject: [PATCH 12/39] os0file.c: SHOW INNODB STATUS always showed average bytes read as 0 in Unix innobase/os/os0file.c: SHOW INNODB STATUS always showed average bytes read as 0 in Unix --- innobase/os/os0file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index b2881581fc7..098d5b25e89 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -1034,6 +1034,8 @@ try_again: ibool retry; ssize_t ret; + os_bytes_read_since_printout += n; + try_again: ret = os_file_pread(file, buf, n, offset, offset_high); From 03be0476abc966199c6b3c3d0b9b658531ae81be Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2002 15:07:45 +0300 Subject: [PATCH 13/39] fix for a small typo in the last push scripts/safe_mysqld.sh: fix for a small type --- scripts/safe_mysqld.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index 177a809ff36..2b625dbdfa3 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -269,7 +269,7 @@ do done fi - echo "`date +'%y%m%d %H:%M:%S' mysqld restarted" | tee -a $err_log + echo "`date +'%y%m%d %H:%M:%S'` mysqld restarted" | tee -a $err_log done echo "`date +'%y%m%d %H:%M:%S'` mysqld ended" | tee -a $err_log From 642b759333e1c4d210b2a9b6687c1021324c7627 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2002 15:42:10 -0600 Subject: [PATCH 14/39] fixed race that caused sig11s on simultaneous FLUSH LOGS (possibly also fixes binlog filename corruption problems--hasn't been reproduced since) sql/log.cc: Fixed race caused by calling MYSQL_LOG::is_open() outside of critical section. sql/sql_parse.cc: added missing args to calls to MYSQL_LOG::new_file(bool) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/log.cc | 10 +++++----- sql/sql_parse.cc | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 2e089f1b96a..e85dfeb876f 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -30,3 +30,4 @@ zak@balfor.local bar@bar.mysql.r18.ru paul@teton.kitebird.com serg@build.mysql2.com +nick@mysql.com diff --git a/sql/log.cc b/sql/log.cc index b90659fdf55..e3f85c8def5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -513,12 +513,12 @@ bool MYSQL_LOG::is_active(const char* log_file_name) void MYSQL_LOG::new_file(bool inside_mutex) { + if (!inside_mutex) + VOID(pthread_mutex_lock(&LOCK_log)); if (is_open()) { char new_name[FN_REFLEN], *old_name=name; - if (!inside_mutex) - VOID(pthread_mutex_lock(&LOCK_log)); - + if (!no_rotate) { /* @@ -550,9 +550,9 @@ void MYSQL_LOG::new_file(bool inside_mutex) my_free(old_name,MYF(0)); last_time=query_start=0; write_error=0; - if (!inside_mutex) - VOID(pthread_mutex_unlock(&LOCK_log)); } + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1dc97d53d02..1803568f880 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2839,10 +2839,10 @@ bool reload_acl_and_cache(THD *thd, uint options, TABLE_LIST *tables) } if (options & REFRESH_LOG) { - mysql_log.new_file(); - mysql_update_log.new_file(); - mysql_bin_log.new_file(); - mysql_slow_log.new_file(); + mysql_log.new_file(0); + mysql_update_log.new_file(0); + mysql_bin_log.new_file(0); + mysql_slow_log.new_file(0); if (ha_flush_logs()) result=1; } From a1517908c1efa396ab01e8ab2c212ed8d75cd8d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Oct 2002 16:39:52 -0600 Subject: [PATCH 15/39] touchup to last fix sql/log.cc: moved mutex back to after is_open() test, but still protecting name dereference (the real problem) --- sql/log.cc | 66 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index e3f85c8def5..33c7414644a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -513,44 +513,46 @@ bool MYSQL_LOG::is_active(const char* log_file_name) void MYSQL_LOG::new_file(bool inside_mutex) { + if (!is_open()) + return; + if (!inside_mutex) VOID(pthread_mutex_lock(&LOCK_log)); - if (is_open()) - { - char new_name[FN_REFLEN], *old_name=name; + + char new_name[FN_REFLEN], *old_name = name; - if (!no_rotate) + if (!no_rotate) + { + /* + only rotate open logs that are marked non-rotatable + (binlog with constant name are non-rotatable) + */ + if (generate_new_name(new_name, name)) + { + if (!inside_mutex) + VOID(pthread_mutex_unlock(&LOCK_log)); + return; // Something went wrong + } + if (log_type == LOG_BIN) { /* - only rotate open logs that are marked non-rotatable - (binlog with constant name are non-rotatable) + We log the whole file name for log file as the user may decide + to change base names at some point. */ - if (generate_new_name(new_name, name)) - { - if (!inside_mutex) - VOID(pthread_mutex_unlock(&LOCK_log)); - return; // Something went wrong - } - if (log_type == LOG_BIN) - { - /* - We log the whole file name for log file as the user may decide - to change base names at some point. - */ - Rotate_log_event r(new_name+dirname_length(new_name)); - r.write(&log_file); - VOID(pthread_cond_broadcast(&COND_binlog_update)); - } + Rotate_log_event r(new_name+dirname_length(new_name)); + r.write(&log_file); + VOID(pthread_cond_broadcast(&COND_binlog_update)); } - else - strmov(new_name, old_name); // Reopen old file name - name=0; - close(); - open(old_name, log_type, new_name); - my_free(old_name,MYF(0)); - last_time=query_start=0; - write_error=0; } + else + strmov(new_name, old_name); // Reopen old file name + name=0; + close(); + open(old_name, log_type, new_name); + my_free(old_name,MYF(0)); + last_time=query_start=0; + write_error=0; + if (!inside_mutex) VOID(pthread_mutex_unlock(&LOCK_log)); } @@ -564,8 +566,8 @@ bool MYSQL_LOG::write(THD *thd,enum enum_server_command command, int error=0; VOID(pthread_mutex_lock(&LOCK_log)); - /* Test if someone closed after the is_open test */ - if (log_type != LOG_CLOSED) + /* Test if someone closed between the is_open test and lock */ + if (is_open()) { time_t skr; ulong id; From 6db17cb1ab4dba5318b93a5146d30f966f268d1c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Oct 2002 12:54:18 +1000 Subject: [PATCH 16/39] 3.23 Changelog cleanup (sync with 4.0/4.1) --- Docs/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 29e4cb6758a..2d685d67016 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,7 +46929,7 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item -Small fix in mysqld_safe for some shells +Small fix in @code{mysqld_safe} for some shells. @item Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. @item From 07ecf7d2dfc230d53ac9313dad8b5e2765df5cf6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Oct 2002 15:11:51 +1000 Subject: [PATCH 17/39] Fixup. --- Docs/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 2d685d67016..001df660773 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,7 +46929,7 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item -Small fix in @code{mysqld_safe} for some shells. +Small fix in @code{safe_mysqld} for some shells. @item Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. @item From 122b6927bf6482aa4ffa8bfec9ab3a59542fe633 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Oct 2002 15:17:41 +0300 Subject: [PATCH 18/39] ha_innobase.cc: test sql/ha_innobase.cc: test --- sql/ha_innobase.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index c2a764c09bc..620573aa581 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -16,7 +16,7 @@ /* This file defines the InnoDB handler: the interface between MySQL and InnoDB */ - + /* TODO list for the InnoDB handler: - Ask Monty if strings of different languages can exist in the same database. Answer: in 4.1 yes. From 9d33a7a2e4ce6e18589db27285ac984d757a00c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Oct 2002 16:40:50 +0300 Subject: [PATCH 19/39] Remove wrong clear of mysql_port when using --skip-show-databases Docs/manual.texi: ChangeLog --- Docs/manual.texi | 2 ++ sql/mysqld.cc | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 001df660773..907ab1de62c 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,6 +46929,8 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item +Fixed that @code{--skip-show-databases} doesn't reset the @code{--port} option. +@item Small fix in @code{safe_mysqld} for some shells. @item Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b5c789548e7..2edde0ed684 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3807,7 +3807,6 @@ static void get_options(int argc,char **argv) case (int) OPT_SKIP_SHOW_DB: opt_skip_show_db=1; opt_specialflag|=SPECIAL_SKIP_SHOW_DB; - mysql_port=0; break; case (int) OPT_MEMLOCK: locked_in_memory=1; From 3dd6cce9891f5d8fc3fc0860bc6ac1576696a208 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Oct 2002 17:58:43 +0300 Subject: [PATCH 20/39] Fixed missing table_list->name -> table_list->alias convert myisam/mi_open.c: Fixed problem with wrongly calculated max_data_file_length mysql-test/Makefile.am: Added missing .require test files scripts/mysqlhotcopy.sh: Remove end / from directory names (portability fix) tests/grant.res: Update of test results --- myisam/mi_open.c | 2 +- mysql-test/Makefile.am | 1 + scripts/mysqlhotcopy.sh | 6 +++++- tests/grant.res | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 617b1cd8d90..d53c39daec4 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -204,7 +204,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) max_data_file_length= (share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ? (((ulonglong) 1 << (share->base.rec_reflength*8))-1) : - (mi_safe_mul(share->base.reclength, + (mi_safe_mul(share->base.pack_reclength, (ulonglong) 1 << (share->base.rec_reflength*8))-1); max_key_file_length= mi_safe_mul(MI_KEY_BLOCK_LENGTH, diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index d98c10a29a9..a91baa1538e 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -42,6 +42,7 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r + $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 1aad5c95c25..d808ffdcaef 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -37,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.16"; +my $VERSION = "1.17"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -388,6 +388,8 @@ foreach my $rdb ( @db_desc ) { foreach my $td ( '', @{$rdb->{raid_dirs}} ) { my $tgt_dirpath = "$rdb->{target}/$td"; + # Remove trailing slashes (needed for Mac OS X) + substr($tgt_dirpath, 1) =~ s|/+$||; if ( $opt{dryrun} ) { print "mkdir $tgt_dirpath, 0750\n"; } @@ -1001,3 +1003,5 @@ resulted in nothing being copied when a regexp was specified but no database name(s). Martin Waite - Fix to handle database name that contains space. + +Paul DuBois - Remove end '/' from directory names diff --git a/tests/grant.res b/tests/grant.res index 37266facc61..91c37a2c9f8 100644 --- a/tests/grant.res +++ b/tests/grant.res @@ -310,7 +310,7 @@ select Host, Db, User, Table_name, Grantor, Table_priv, Column_priv from mysql.t revoke GRANT OPTION on grant_test.test from grant_user@localhost Error in execute: There is no such grant defined for user 'grant_user' on host 'localhost' on table 'test' grant select(a) on grant_test.test to grant_user@localhost -show columns from test +show full columns from test a int(11) YES NULL select b int(11) YES NULL From 38b547257d2cf6a6fbfe50612aeaa609a6634a70 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2002 12:05:22 +0300 Subject: [PATCH 21/39] Fixed bug in LOCK TABLES on windows. Docs/manual.texi: Changelog --- Docs/manual.texi | 12 +++++++++++- sql/sql_db.cc | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 907ab1de62c..e8b9d89e1a2 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46868,6 +46868,7 @@ users use this code as the rest of the code and because of this we are not yet 100% confident in this code. @menu +* News-3.23.54:: Changes in release 3.23.54 * News-3.23.53:: Changes in release 3.23.53 * News-3.23.52:: Changes in release 3.23.52 * News-3.23.51:: Changes in release 3.23.51 @@ -46925,10 +46926,19 @@ not yet 100% confident in this code. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.53, News-3.23.52, News-3.23.x, News-3.23.x +@node News-3.23.54, News-3.23.53, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.54 + +@node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item +Fixed possible memory corruption bug in binary log file handling when +slave rotated the logs (only affected 3.23, not 4.0). +@item +Fixed problem in @code{LOCK TABLES} on windows when on connects to a +database that contains upper case letters. +@item Fixed that @code{--skip-show-databases} doesn't reset the @code{--port} option. @item Small fix in @code{safe_mysqld} for some shells. diff --git a/sql/sql_db.cc b/sql/sql_db.cc index b3d63f72b8d..7fcda7948a2 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -368,6 +368,8 @@ bool mysql_change_db(THD *thd,const char *name) } send_ok(&thd->net); x_free(thd->db); + if (lower_case_table_names) + casedn_str(dbname); thd->db=dbname; thd->db_access=db_access; DBUG_RETURN(0); From 7cd5626c7059defa60ab1529d18d5e3b8c7cfe1b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2002 13:04:03 +0300 Subject: [PATCH 22/39] Fix for build problem on AIX --- include/global.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/global.h b/include/global.h index 1525a7c6e06..4ab7cbbeee6 100644 --- a/include/global.h +++ b/include/global.h @@ -105,6 +105,7 @@ #define _SYS_STREAM_H #define _AIX32_CURSES #define ulonglong2double(A) my_ulonglong2double(A) +#define my_off_t2double(A) my_ulonglong2double(A) #ifdef __cplusplus extern "C" { #endif From 9909173b4a48af8c86f100982cfc6bcb9ef1ad26 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2002 13:50:48 +0200 Subject: [PATCH 23/39] - Fixed typo in 3.23.53 changelog entry in manual.texi Docs/manual.texi: - fixed typo in changelog entry (thanks to Jocelyn Fournier for spotting this) --- Docs/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index e8b9d89e1a2..5446e71c83d 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46943,7 +46943,7 @@ Fixed that @code{--skip-show-databases} doesn't reset the @code{--port} option. @item Small fix in @code{safe_mysqld} for some shells. @item -Fixed that @code{SHOW STATUS} doesn't reset @code{Delayed_insert_threads}. +Fixed that @code{FLUSH STATUS} doesn't reset @code{Delayed_insert_threads}. @item Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. @item From c05fc9fa31e97a5028beb2c2b43e7d88caf6d49d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2002 19:52:34 +0300 Subject: [PATCH 24/39] ha_innobase.cc: Fix bug: if skip-innodb was defined SHOW INNODB STATUS crashed sql/ha_innobase.cc: Fix bug: if skip-innodb was defined SHOW INNODB STATUS crashed --- sql/ha_innobase.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 620573aa581..13912ad5919 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -3552,6 +3552,14 @@ innodb_show_status( DBUG_ENTER("innodb_show_status"); + if (innodb_skip) { + + fprintf(stderr, + "Cannot call SHOW INNODB STATUS because skip-innodb is defined\n"); + + DBUG_RETURN(-1); + } + /* We let the InnoDB Monitor to output at most 100 kB of text, add a safety margin of 10 kB for buffer overruns */ From 3d21a8cf0b0708fe38dda9898a1bb4c7a44a61a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Oct 2002 22:16:40 +0200 Subject: [PATCH 25/39] - added missing changelog entry to manual.texi Docs/manual.texi: - added missing changelog entry - fixed typo --- Docs/manual.texi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 5446e71c83d..247e284f2d0 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46933,10 +46933,13 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.53 @itemize @bullet @item +Fixed crash when @code{SHOW INNODB STATUS} was used and @code{skip-innodb} +was defined. +@item Fixed possible memory corruption bug in binary log file handling when slave rotated the logs (only affected 3.23, not 4.0). @item -Fixed problem in @code{LOCK TABLES} on windows when on connects to a +Fixed problem in @code{LOCK TABLES} on windows when one connects to a database that contains upper case letters. @item Fixed that @code{--skip-show-databases} doesn't reset the @code{--port} option. From ac471d1daf3c81b8365af990c3ca2552dab02214 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Oct 2002 15:14:47 +0000 Subject: [PATCH 26/39] libraries should be always prepended to $LIBS, never appended --- configure.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index 002932c9835..ca445813328 100644 --- a/configure.in +++ b/configure.in @@ -735,7 +735,7 @@ AC_ARG_WITH(libwrap, _libs=${LIBS} AC_CHECK_HEADER(tcpd.h, - LIBS="$LIBS -lwrap" + LIBS="-lwrap $LIBS" AC_MSG_CHECKING(for TCP wrappers library -lwrap) AC_TRY_LINK([#include int allow_severity = 0; @@ -1231,7 +1231,7 @@ fi AC_MSG_CHECKING("named thread libs:") if test "$with_named_thread" != "no" then - LIBS="$with_named_thread $LIBS $with_named_thread" + LIBS="$with_named_thread $LIBS" with_posix_threads="yes" with_mit_threads="no" AC_MSG_RESULT("$with_named_thread") @@ -1250,7 +1250,7 @@ else then AC_MSG_CHECKING("for pthread_create in -lpthread"); ac_save_LIBS="$LIBS" - LIBS="$LIBS -lpthread" + LIBS="-lpthread $LIBS" AC_TRY_LINK( [#include ], [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], @@ -1258,7 +1258,7 @@ else AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then - LIBS=" $ac_save_LIBS -lpthreads" + LIBS=" -lpthreads $ac_save_LIBS" AC_MSG_CHECKING("for pthread_create in -lpthreads"); AC_TRY_LINK( [#include ], From 23cce6c26612178392f156209fb9bcfa4dc2c14d Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Oct 2002 15:44:45 +0300 Subject: [PATCH 27/39] os0thread.c: Fix compilation error on HP-UX-11: pthread_t is a scalar there, not a struct like in HP-UX-10.20 innobase/os/os0thread.c: Fix compilation error on HP-UX-11: pthread_t is a scalar there, not a struct like in HP-UX-10.20 --- innobase/os/os0thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index ad6b66a1dc2..1f40508df26 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -52,8 +52,8 @@ os_thread_pf( /*=========*/ os_thread_id_t a) { -#ifdef UNIV_HPUX - /* In HP-UX a pthread_t is a struct of 3 fields: field1, field2, +#ifdef UNIV_HPUX10 + /* In HP-UX-10.20 a pthread_t is a struct of 3 fields: field1, field2, field3. We do not know if field1 determines the thread uniquely. */ return((ulint)(a.field1)); From 8926c0bc3817150d00a1906e07a6e6b469c4c696 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 12 Oct 2002 12:38:48 +0300 Subject: [PATCH 28/39] Fixed bug where we could reference a freed tmp_table->table_name variable for some GROUP BY ... ORDER BY queries. Docs/manual.texi: ChangeLog --- Docs/manual.texi | 6 ++++++ sql/sql_select.cc | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index e8b9d89e1a2..21bab5ea6e4 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46928,6 +46928,12 @@ not yet 100% confident in this code. @node News-3.23.54, News-3.23.53, News-3.23.x, News-3.23.x @appendixsubsec Changes in release 3.23.54 +@itemize +Fixed reference to freed memory when doing complicated @code{GROUP BY +... ORDER BY} queries. Symptom was that @code{mysqld} died in function +@code{send_fields}. +queries. +@end itemize @node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x @appendixsubsec Changes in release 3.23.53 diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 04368c016d1..e2cf2fd72df 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3395,7 +3395,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, bzero((char*) from_field,sizeof(Field*)*field_count); table->field=reg_field; table->real_name=table->path=tmpname; - table->table_name=base_name(tmpname); + /* + This must be "" as field may refer to it after tempory table is dropped + */ + table->table_name= (char*) ""; table->reginfo.lock_type=TL_WRITE; /* Will be updated */ table->db_stat=HA_OPEN_KEYFILE+HA_OPEN_RNDFILE; table->blob_ptr_size=mi_portable_sizeof_char_ptr; @@ -3731,6 +3734,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, if (create_myisam_tmp_table(table,param,select_options)) goto err; } + /* Set table_name for easier debugging */ + table->table_name= base_name(tmpname); if (!open_tmp_table(table)) DBUG_RETURN(table); From e484a91efe357872c91c0e2a3231b8539a83c16e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 13 Oct 2002 16:26:28 +0200 Subject: [PATCH 29/39] - Tagged ChangeSet 1.1224 as "mysql-3.23.53" - bumped up version number to 3.23.54 in configure.in - replaced Docs/LICENSE with Docs/MySQLEULA.txt and modified scripts/make_binary_distribution.sh and Build-tools/mysql-copyright* accordingly. BitKeeper/deleted/.del-LICENSE~4cfaff8de837acb8: Delete: Docs/LICENSE Build-tools/mysql-copyright-2: - replaced LICENSE with MySQLEULA.txt Build-tools/mysql-copyright: - use "tar" instead of "gtar" - replaced LICENSE with MySQLEULA.txt configure.in: - Bumped up version number to 3.23.54 now that 3.23.53 has been tagged scripts/make_binary_distribution.sh: - replaced LICENSE with MySQLEULA.txt --- Build-tools/mysql-copyright | 10 +- Build-tools/mysql-copyright-2 | 4 +- Docs/LICENSE | 98 ----------- Docs/MySQLEULA.txt | 252 ++++++++++++++++++++++++++++ configure.in | 2 +- scripts/make_binary_distribution.sh | 2 +- 6 files changed, 261 insertions(+), 107 deletions(-) delete mode 100644 Docs/LICENSE create mode 100644 Docs/MySQLEULA.txt diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index 0d49acac400..70b65d3f2cf 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -89,15 +89,15 @@ sub main } # everything should be ok, continue with extracting.. - `gtar xfz ../$distfile`; + `tar xfz ../$distfile`; $pec= $? >> 8; abort($dir, "Extracting from tar failed!\n") if ($pec); - # remove the 'PUBLIC' file from distribution and copy LICENSE + # remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt # on the toplevel of the directory instead. file 'PUBLIC' shouldn't # exist in the new mysql distributions, but let's be sure.. `rm -f $destdir/PUBLIC $destdir/README`; - `cp -p $WD/Docs/LICENSE $destdir/`; + `cp -p $WD/Docs/MySQLEULA.txt $destdir/`; # fix file copyrights &fix_usage_copyright(); @@ -107,7 +107,7 @@ sub main `mv -f $destdir $newdistname`; # tar the new distribution - `gtar cz -f $opt_target/$newdistname.tar.gz *`; + `tar cz -f $opt_target/$newdistname.tar.gz *`; $pec= $? >> 8; abort($dir, "Making new tar archive failed!\n") if ($pec); @@ -129,7 +129,7 @@ sub fix_usage_copyright foreach my $Cfile (@Cfiles) { chop $Cfile; - `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file LICENSE for details" -- $Cfile`; + `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file MySQLEULA.txt for details" -- $Cfile`; } } diff --git a/Build-tools/mysql-copyright-2 b/Build-tools/mysql-copyright-2 index a0d30f308e5..447a2d7c164 100755 --- a/Build-tools/mysql-copyright-2 +++ b/Build-tools/mysql-copyright-2 @@ -15,10 +15,10 @@ Getopts("v") || die "Aborted"; "This software is distributed with NO WARRANTY OF ANY KIND. No author or", "distributor accepts any responsibility for the consequences of using it, or", "for whether it serves any particular purpose or works at all, unless he or", - "she says so in writing. Refer to the LICENSE file for details.", + "she says so in writing. Refer to the MySQLEULA.txt file for details.", "", "Every copy of this file must include a copy of the License, normally in a", - "plain ASCII text file named LICENSE. The License grants you the right to", + "plain ASCII text file named MySQLEULA.txt. The License grants you the right to", "copy, modify and redistribute this file, but only under certain conditions", "described in the License. Among other things, the License requires that", "the copyright notice and this notice be preserved on all copies" diff --git a/Docs/LICENSE b/Docs/LICENSE deleted file mode 100644 index bd123fe42a5..00000000000 --- a/Docs/LICENSE +++ /dev/null @@ -1,98 +0,0 @@ - End-User License Agreement for MySQL Commercial Server - - (Version 6, July 13, 2000) - - Copyright (C) 2000, MySQL AB & MySQL Finland AB - - Stockholm SWEDEN, Helsingfors FINLAND and Uppsala SWEDEN - - All rights reserved. - -Definitions. This End-User License Agreement ("License") is a legal -agreement between you, either an individual or a single entity, -("Licensee") and MySQL AB, MySQL Finland AB and Detron HB ("Licensor") -for the software product identified above, which includes computer -software and may include associated media, printed materials, and -online or electronic documentation ("Software"). The Software also -includes any updates and supplements to the original Software product -provided to you by Licensor. Any software provided along with the -Software that is associated with a separate end-user license agreement -is licensed to you under the terms of that license agreement. - -Agreement to the License. The Software is protected by copyright laws -and international copyright treaties, as well as other intellectual -property laws and treaties. The Software is licensed, not sold. If you -do not agree to the terms of this License, do not install or use the -Software. By installing, copying, modifying, downloading, -distributing, accessing or otherwise using the Software, you agree to -be bound by the following terms of this License: - -1. Grant for Authorized Use of the Software - -Licensor hereby grants to Licensee a non-exclusive, non-transferable -right to use the Software in: - Installing. You may install copies of -the Software for authorized use on your computers, including -workstations, terminals and other digital electronic devices -("Computer"). - Single Computer use. You may only use the Software on -one Computer at a time regardless the number of Computers with -installed copies. This right covers any number of concurrent users, -CPUs and MySQL-servers with any number of copies running on one -Computer. - -2. Description of Other Rights - -Licensor grants no other rights to the Software except as expressly -set forth herein: - -- Copying. You may not copy the Software unless copies or adaptations - are meant for authorized use, archival purposes or when copying or - adaptation is a necessary step in the authorized use of the Software. - -- Distribution. You may not distribute the Software. - -- Modifying. You may modify the Software but you must reproduce all - copyright notices in the Software on all modified copies and - adaptations. - -- License transfer. You may resell or rent this License. If any - modifications have been made to the Software, you must include a - proper notification that the Software is modified. - -- Support services. Licensor may provide you with support services - related to the Software. Use and terms of support services are not - governed in this License. - -3. Term - -This license is effective until terminated. Licensor has the -right to terminate your License immediately if you fail to comply with -any term of this License. - -4. No Warranty - -The Software is provided "as is". Licensor makes no warranties, -express or implied, arising from course of dealing or usage of trade, -or statutory, as to any matter whatsoever. In particular, any and all -warranties or merchantability, fitness for a particular purpose or -non-infringement of third party rights are expressly excluded. The -entire risk as to the quality and performance of the Software is with -you. If the Software proves defective, you assume all the cost of -necessary service, repair or correction. - -5. Limited Liability - -In no event will Licensor be liable to you for any consequential or -incidental damages, including any lost profits or lost savings, or for -any claim by any party, even if a Licensor representative has been -advised of the possibility of such damages. Some states do not allow -the exclusion or limitation of liability. Therefore, in any case, the -entire liability of Licensor under any provision of this License is -limited to the amount actually paid by you for the Software. - -6. Governing Law and Jurisdiction - -This License will be governed by the laws in force in -Sweden. Jurisdiction is with Tingsrätten of Stockholm, Sweden. - -Should you have any questions concerning the validity of this License, -please contact: mysql-licensing@mysql.com. diff --git a/Docs/MySQLEULA.txt b/Docs/MySQLEULA.txt new file mode 100644 index 00000000000..a71f19b3845 --- /dev/null +++ b/Docs/MySQLEULA.txt @@ -0,0 +1,252 @@ + License Agreement for Commercial Use of MySQL[tm] Software + +This Agreement ("License") is between MySQL AB, a Swedish company +("Licensor"), and the customer ("Licensee") identified on the electronic order +form submitted on behalf of Licensee (the "Order Form"). In consideration of +the mutual promises, covenants and conditions contained herein, the +sufficiency of which is hereby acknowledged, the parties agree as follows. + +1. License Grant. +"Licensed Software" means a complete and unchanged copy of the object code +version of the MySQL relational database management software identified in the +Order Form and posted on a special download page of the MySQL AB web site (the +"Download Page") made available to Licensee immediately after payment as +provided in Section 4. Subject to payment and the other terms and conditions +hereof, Licensor grants to Licensee a limited, non-exclusive and +non-transferable right to: (a) make one copy of the Licensed Software for each +license purchased (each, a "Licensed Copy"); (b) compile and/or link each +Licensed Copy to one copy of the Licensee software identified in the Order +Form (the "Licensee Application") without modifying the Licensed Software +(each, an "Integrated Product"); and (c) load and use the Licensed Copy +portion of an Integrated Product on one machine or instrument in the operating +system environment(s), and on the hardware platform(s) specified in the Order +Form, and solely for running and extracting data from, the Licensee +Application. "Use" means operation by one person for internal business +purposes in accordance with the terms and conditions hereof. Licensed Copies +shall be deemed accepted by Licensee immediately upon download. Licensee may +make one additional copy of each Licensed Copy for backup and archival +purposes only. + +2. Transfer. +Only after Licensee has linked or compiled a Licensed Copy as permitted in +Section 1, Licensee may transfer to a third party (the "Transferee") the right +to use such copy as described in Section 1. As a condition to any such +transfer: (a) Licensee must deliver the Licensed Copy and any backup copy to +the Transferee along with a copy of this License (including the Sales Order); +and (b) the Transferee must accept the terms and conditions of this License. +Any and all of Licensee's rights to a Licensed Copy shall terminate upon +transfer of the right to use such copy. A Transferee's rights are limited to +the use rights described in Section 1(c), and do not include the linking, +compilation or copying rights (except for backup and archival copies) +described in Section 1. If you did not purchase this License directly from +MySQL AB, then you are a Transferee. Licensee and any Transferee must comply +with all applicable export laws and regulations. + +3. Restrictions. +Licensee may use the Licensed Software only as expressly provided in Section +1. Without limiting the foregoing, Licensee shall not: (a) lease, license, +use, make available, distribute or modify all or any part of the Licensed +Software to any third party, except as otherwise expressly permitted herein; +(b) use the Licensed Software to operate in or as a time-sharing, outsourcing, +service bureau, application service provider or managed service provider +environment; (c) lease, license, use, make available or distribute the +Licensed Software as a general SQL server, as a stand alone application or +with applications other than the Licensee Application under this License; (d) +copy the Licensed Software onto any public or distributed network; (e) +distribute Integrated Products pursuant to a public or open source license; +(f) port the Licensed Software to any operating system other than as described +in the Order Form; or (g) change any proprietary rights notices which appear +in the Licensed Software. Except as otherwise provided in Section 2, the +rights granted to Licensee herein are rights that may be exercised solely by +Licensee. + +4. Price and payment. +No later than thirty (30) days after submission of the Order Form, Licensee +shall remit one non-refundable license fee per Licensed Copy as posted on +http://order.mysql.com on the date Licensee submitted the Order Form (the +"License Fee"). All payments shall be made in Euros or U.S. dollars. Licensee +shall be responsible for paying all local, state, federal and international +sales, value added, excise and other taxes and duties payable in connection +with this License, other than taxes based upon Licensor's net income. Licensee +shall not be permitted to access the Download Page until Licensor has received +payment in full. + +5. Termination. +Licensor may terminate this License immediately if the Licensee shall breach +any of the provisions of this License and such breach remains uncured 30 days +after receipt of notice. In the event that Licensee becomes liquidated, +dissolved, bankrupt or insolvent, whether voluntarily or involuntarily, or +shall take any action to be so declared, Licensor shall have the right to +terminate this License immediately. Upon expiration, cancellation or other +termination of this License, Licensee shall immediately: (a) discontinue +distribution of Integrated Products that include Licensed Software; and (b) +destroy all copies of the Licensed Software, including (without limitation) as +linked or compiled in any Integrated Product. Sections 4 through 10 shall +survive the termination of this License for any reason. + +6. Proprietary Rights. +Licensee agrees that the copyright, patent, trade secrets and all other +intellectual proprietary rights of whatever nature in the Licensed Software +and related documentation, including derivative works, are and shall remain +the exclusive property of Licensor and any third party suppliers. Nothing in +this License should be construed as transferring any aspects of such rights to +Licensee or any third party. Licensor reserves any and all rights not +expressly granted herein. MySQL is a trademark of MySQL AB, and shall not be +used by Licensee without Licensor's express written authorization. Licensee +shall include in the Integrated Products a conspicuous notice that the +Integrated Products include software whose copyright is owned by MySQL AB. + +7. Disclaimer of Warranties. +THE LICENSED SOFTWARE IS LICENSED "AS IS," WITHOUT ANY WARRANTIES WHATSOEVER. +LICENSOR EXPRESSLY DISCLAIMS, AND LICENSEE EXPRESSLY WAIVES, ALL WARRANTIES, +WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTIBILITY, FITNESS +FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, SYSTEM INTEGRATION, +NON-INTERFERENCE AND ACCURACY OF INFORMATIONAL CONTENT. LICENSOR DOES NOT +WARRANT THAT THE LICENSED SOFTWARE WILL MEET LICENSEE'S REQUIREMENTS OR THAT +THE OPERATION OF THE LICENSED SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR +THAT ERRORS WILL BE CORRECTED. THE ENTIRE RISK OF THE LICENSED SOFTWARE'S +QUALITY AND PERFORMANCE IS WITH LICENSEE. Without limiting the generality of +the foregoing disclaimer, Licensee acknowledges that the Licensed Software is +not specifically designed, manufactured or intended for use in the planning, +construction, maintenance, control or direct operation of nuclear facilities, +aircraft navigation, control or communication systems, weapons systems or +direct life support systems. + +8. Indemnification. +Licensee hereby indemnifies and agrees to defend Licensor against any and all +damages, judgments and costs (including reasonable attorneys' fees) related to +any claim based upon: (a) an allegation that the Licensee Application +infringes the intellectual property of a third party; (b) use of the Licensed +Software in a manner prohibited under this License or in a manner for which +the Licensed Software was not designed; (c) integration or use of the Licensed +Software with the Licensee Application (where use of the Licensed Software +alone would not infringe); (d) changes made by Licensee to the Licensed +Software (where use of unmodified Licensed Software would not infringe); (e) +changes made, or actions taken, by Licensor upon Licensee's direct +instructions; or (f) bodily injury, property damage or any other damage or +injury due to the use or inability to use an Integrated Product. + +9. Limitation of Liability. +LICENSOR SHALL HAVE NO LIABILITY WITH RESPECT TO ITS OBLIGATIONS UNDER THIS +AGREEMENT OR OTHERWISE FOR CONSEQUENTIAL, EXEMPLARY, SPECIAL, INDIRECT, +INCIDENTAL OR PUNITIVE DAMAGES, INCLUDING (WITHOUT LIMITATION) ANY LOST +PROFITS OR LOST SAVINGS (WHETHER RESULTING FROM IMPAIRED OR LOST DATA, +SOFTWARE OR COMPUTER FAILURE OR ANY OTHER CAUSE), EVEN IF IT HAS BEEN ADVISED +OF THE POSSIBILITY OF SUCH DAMAGES. NOTWITHSTANDING ANY OTHER PROVISION IN +THIS AGREEMENT, THE LIABILITY OF LICENSOR FOR ANY REASON AND UPON ANY CAUSE OF +ACTION SHALL BE LIMITED TO THE AMOUNT PAID TO LICENSOR BY LICENSEE UNDER THIS +AGREEMENT. THIS LIMITATION APPLIES TO ALL CAUSES OF ACTION IN THE AGGREGATE, +INCLUDING (WITHOUT LIMITATION) BREACH OF CONTRACT, BREACH OF WARRANTY, +NEGLIGENCE, MISREPRESENTATIONS AND OTHER TORTS. THE PARTIES AGREE THAT THE +REMEDIES AND LIMITATIONS HEREIN ALLOCATE THE RISKS BETWEEN THE PARTIES AS +AUTHORIZED BY APPLICABLE LAWS. THE LICENSE FEES ARE SET IN RELIANCE UPON THIS +ALLOCATION OF RISK AND THE EXCLUSION OF CERTAIN DAMAGES AS SET FORTH IN THIS +AGREEMENT. + +10. Miscellaneous. + +10.1 Interpretation. +Failure by Licensor to exercise any right or remedy does not signify +acceptance of the event giving rise to such right or remedy. No action arising +out of this License may be brought by Licensee more than one year after the +cause of action has accrued. If any part of this License is held by a court of +competent jurisdiction to be illegal or unenforceable, the validity or +enforceability of the remainder of this License shall not be affected and such +provision shall be deemed modified to the minimum extent necessary to make +such provision consistent with applicable law and, in its modified form, such +provision shall be enforceable and enforced. Licensor reserves the right not +to accept any Order Form. Any invoice issued by Licensor in connection with +this License shall be deemed a part of this Agreement. To the extent of any +inconsistency between an Order Form and an invoice issued by Licensor, the +terms and conditions of the invoice shall prevail; Licensee shall be deemed to +have accepted an invoice upon payment of such invoice. In the event that +Licensee placed an order by telephone or through an authorized sales +representative, the invoice issued by Licensor shall constitute the Order +Form. The terms and conditions of this Agreement shall replace and serve as a +novation of the terms and conditions of any commercial (i.e., non-GPL) license +purchased online by Licensee prior to August 2002. + +10.2 Binding. +This Agreement will be binding upon and inure to the benefit of the parties, +their respective successors and permitted assigns. Except as otherwise +provided in Section 2, without the prior written consent of Licensor, Licensee +may not assign this License or its rights or obligations under this License to +any person or party, whether by operation of law or otherwise; any attempt by +Licensee to assign this License without Licensor's prior written consent shall +be null and void. There are no intended third party beneficiaries of this +License. The parties are, and shall remain, independent contractors; nothing +in this License is designed to create, nor shall create between them, a +partnership, joint venture, agency, or employment relationship. + +10.3 Governing Law; Dispute Forum. +If Licensee's residence, principal place of business or place of organization +is in the United States of America ("USA"), then this License shall be deemed +to have been executed in the USA and shall be governed by the laws of the +State of Delaware, without regard to the conflict of laws provisions thereof. +If Licensee's residence, principal place of business or place of organization +is in any country other than the USA, then this License shall be deemed to +have been executed in Sweden and shall be governed by the laws of Sweden, +without regard to the conflict of laws provisions thereof. In no event shall +the United Nations Convention on Contracts for the International Sale of Goods +apply to, or govern, this License. The parties consent to the exclusive +jurisdiction of the courts of Sweden and the USA, as provided in this Section. +In the event that Licensor initiates an action in connection with this License +or any other dispute between the parties, the exclusive jurisdiction of such +action shall be in: (a) Newark, Delaware, if Licensee's residence, principal +place of business or place of organization is in the USA; or (b) Uppsala, +Sweden, if Licensee's residence, principal place of business or place of +organization is in any country other than the USA. In the event that Licensee +initiates an action in connection with this License or any other dispute +between the parties, the exclusive jurisdiction of such action shall be in +Stockholm, Sweden. Notwithstanding the foregoing, either party may bring a +counterclaim in an action in the same jurisdiction in which the originating +claim was filed, and either party may enforce any judgment rendered by such +court in any court of competent jurisdiction. Licensee shall comply at its own +expense with all relevant and applicable laws related to use and distribution +of the Licensed Software as permitted in this License. Notwithstanding the +foregoing, Licensor may seek injunctive or other equitable relief in any +jurisdiction in order to protect its intellectual property rights. The parties +have agreed to execute this License in the English language, and the English +language version of the Agreement will control for all purposes. Any action +brought under this License shall be conducted in the English language. +Licensee shall be responsible for Licensor's attorneys fees and other expenses +associated with the enforcement of this License or the collection of any +amounts due under this License. + +10.4 Notice. +Unless otherwise agreed, any notice under this License shall be delivered and +addressed to Licensee at the address set forth on the Order Form, and to +Licensor at Bangardsgatan 8, 753 20, Uppsala, Sweden. Notice shall be deemed +received by any party: (a) on the day given, if personally delivered or if +sent by confirmed facsimile transmission, receipt verified; (b) on the third +day after deposit, if mailed by certified, first class, postage prepaid, +return receipt requested mail, or by reputable, expedited overnight courier; +or (c) on the fifth day after deposit, if sent by reputable, expedited +international courier. Either party may change its address for notice +purposes upon notice in accordance with this Section. Licensor may identify +Licensee as a commercial licensee, including on the MySQL web site. + +10.5 GPL. +The GPL License shall continue to apply to any and all uses and distributions +of the Licensed Software undertaken by Licensee either prior to the Effective +Date, after termination, or otherwise outside the scope of this License. This +Agreement shall not be deemed to replace or otherwise amend any Licensee +rights or obligations pursuant to the GPL License with respect to any uses of +the Licensed Software described in the preceding sentence. + +10.6 Entire Agreement. +This Agreement (including the Order Form and the invoice) comprises the entire +agreement, and supercedes and merges all prior proposals, understandings and +agreements, oral and written, between the parties relating to the subject +matter of this License. This Agreement may be amended or modified only in a +writing executed by both parties. To the extent of any conflict or +inconsistency between this License and any invoice or other document submitted +by Licensee to Licensor, this License will control. Licensor's acceptance of +any document shall not be construed as an acceptance of provisions which are +in any way in conflict or inconsistent with, or in addition to, this License, +unless such terms are separately and specifically accepted in writing by an +authorized officer of Licensor. + +10.7 Print this License. +For record keeping purposes, we encourage Licensee to print this License and +the Order Form on the date that the Order Form is submitted. diff --git a/configure.in b/configure.in index ca445813328..c22a208e6d0 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.53) +AM_INIT_AUTOMAKE(mysql, 3.23.54) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index c67de656600..bde77713d63 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -55,7 +55,7 @@ mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ chmod o-rwx $BASE/data $BASE/data/* for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ - LICENSE Docs/manual.html Docs/manual.txt Docs/manual_toc.html + MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html do if [ -f $i ] then From 4442b7faeb8ffe36c7cad5b1ce976e9e422eb6e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 13 Oct 2002 16:53:19 +0200 Subject: [PATCH 30/39] - fixed formatting in MySQLEULA.txt Docs/MySQLEULA.txt: - replaced tabs with spaces --- Docs/MySQLEULA.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Docs/MySQLEULA.txt b/Docs/MySQLEULA.txt index a71f19b3845..71e630ec81f 100644 --- a/Docs/MySQLEULA.txt +++ b/Docs/MySQLEULA.txt @@ -1,4 +1,4 @@ - License Agreement for Commercial Use of MySQL[tm] Software + License Agreement for Commercial Use of MySQL[tm] Software This Agreement ("License") is between MySQL AB, a Swedish company ("Licensor"), and the customer ("Licensee") identified on the electronic order @@ -6,7 +6,7 @@ form submitted on behalf of Licensee (the "Order Form"). In consideration of the mutual promises, covenants and conditions contained herein, the sufficiency of which is hereby acknowledged, the parties agree as follows. -1. License Grant. +1. License Grant. "Licensed Software" means a complete and unchanged copy of the object code version of the MySQL relational database management software identified in the Order Form and posted on a special download page of the MySQL AB web site (the @@ -27,7 +27,7 @@ shall be deemed accepted by Licensee immediately upon download. Licensee may make one additional copy of each Licensed Copy for backup and archival purposes only. -2. Transfer. +2. Transfer. Only after Licensee has linked or compiled a Licensed Copy as permitted in Section 1, Licensee may transfer to a third party (the "Transferee") the right to use such copy as described in Section 1. As a condition to any such @@ -42,7 +42,7 @@ described in Section 1. If you did not purchase this License directly from MySQL AB, then you are a Transferee. Licensee and any Transferee must comply with all applicable export laws and regulations. -3. Restrictions. +3. Restrictions. Licensee may use the Licensed Software only as expressly provided in Section 1. Without limiting the foregoing, Licensee shall not: (a) lease, license, use, make available, distribute or modify all or any part of the Licensed @@ -60,7 +60,7 @@ in the Licensed Software. Except as otherwise provided in Section 2, the rights granted to Licensee herein are rights that may be exercised solely by Licensee. -4. Price and payment. +4. Price and payment. No later than thirty (30) days after submission of the Order Form, Licensee shall remit one non-refundable license fee per Licensed Copy as posted on http://order.mysql.com on the date Licensee submitted the Order Form (the @@ -71,7 +71,7 @@ with this License, other than taxes based upon Licensor's net income. Licensee shall not be permitted to access the Download Page until Licensor has received payment in full. -5. Termination. +5. Termination. Licensor may terminate this License immediately if the Licensee shall breach any of the provisions of this License and such breach remains uncured 30 days after receipt of notice. In the event that Licensee becomes liquidated, @@ -84,7 +84,7 @@ destroy all copies of the Licensed Software, including (without limitation) as linked or compiled in any Integrated Product. Sections 4 through 10 shall survive the termination of this License for any reason. -6. Proprietary Rights. +6. Proprietary Rights. Licensee agrees that the copyright, patent, trade secrets and all other intellectual proprietary rights of whatever nature in the Licensed Software and related documentation, including derivative works, are and shall remain @@ -96,7 +96,7 @@ used by Licensee without Licensor's express written authorization. Licensee shall include in the Integrated Products a conspicuous notice that the Integrated Products include software whose copyright is owned by MySQL AB. -7. Disclaimer of Warranties. +7. Disclaimer of Warranties. THE LICENSED SOFTWARE IS LICENSED "AS IS," WITHOUT ANY WARRANTIES WHATSOEVER. LICENSOR EXPRESSLY DISCLAIMS, AND LICENSEE EXPRESSLY WAIVES, ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTIBILITY, FITNESS @@ -112,7 +112,7 @@ construction, maintenance, control or direct operation of nuclear facilities, aircraft navigation, control or communication systems, weapons systems or direct life support systems. -8. Indemnification. +8. Indemnification. Licensee hereby indemnifies and agrees to defend Licensor against any and all damages, judgments and costs (including reasonable attorneys' fees) related to any claim based upon: (a) an allegation that the Licensee Application @@ -126,7 +126,7 @@ changes made, or actions taken, by Licensor upon Licensee's direct instructions; or (f) bodily injury, property damage or any other damage or injury due to the use or inability to use an Integrated Product. -9. Limitation of Liability. +9. Limitation of Liability. LICENSOR SHALL HAVE NO LIABILITY WITH RESPECT TO ITS OBLIGATIONS UNDER THIS AGREEMENT OR OTHERWISE FOR CONSEQUENTIAL, EXEMPLARY, SPECIAL, INDIRECT, INCIDENTAL OR PUNITIVE DAMAGES, INCLUDING (WITHOUT LIMITATION) ANY LOST @@ -143,9 +143,9 @@ AUTHORIZED BY APPLICABLE LAWS. THE LICENSE FEES ARE SET IN RELIANCE UPON THIS ALLOCATION OF RISK AND THE EXCLUSION OF CERTAIN DAMAGES AS SET FORTH IN THIS AGREEMENT. -10. Miscellaneous. +10. Miscellaneous. -10.1 Interpretation. +10.1 Interpretation. Failure by Licensor to exercise any right or remedy does not signify acceptance of the event giving rise to such right or remedy. No action arising out of this License may be brought by Licensee more than one year after the @@ -178,7 +178,7 @@ License. The parties are, and shall remain, independent contractors; nothing in this License is designed to create, nor shall create between them, a partnership, joint venture, agency, or employment relationship. -10.3 Governing Law; Dispute Forum. +10.3 Governing Law; Dispute Forum. If Licensee's residence, principal place of business or place of organization is in the United States of America ("USA"), then this License shall be deemed to have been executed in the USA and shall be governed by the laws of the @@ -213,7 +213,7 @@ Licensee shall be responsible for Licensor's attorneys fees and other expenses associated with the enforcement of this License or the collection of any amounts due under this License. -10.4 Notice. +10.4 Notice. Unless otherwise agreed, any notice under this License shall be delivered and addressed to Licensee at the address set forth on the Order Form, and to Licensor at Bangardsgatan 8, 753 20, Uppsala, Sweden. Notice shall be deemed @@ -226,7 +226,7 @@ international courier. Either party may change its address for notice purposes upon notice in accordance with this Section. Licensor may identify Licensee as a commercial licensee, including on the MySQL web site. -10.5 GPL. +10.5 GPL. The GPL License shall continue to apply to any and all uses and distributions of the Licensed Software undertaken by Licensee either prior to the Effective Date, after termination, or otherwise outside the scope of this License. This @@ -234,7 +234,7 @@ Agreement shall not be deemed to replace or otherwise amend any Licensee rights or obligations pursuant to the GPL License with respect to any uses of the Licensed Software described in the preceding sentence. -10.6 Entire Agreement. +10.6 Entire Agreement. This Agreement (including the Order Form and the invoice) comprises the entire agreement, and supercedes and merges all prior proposals, understandings and agreements, oral and written, between the parties relating to the subject @@ -247,6 +247,6 @@ in any way in conflict or inconsistent with, or in addition to, this License, unless such terms are separately and specifically accepted in writing by an authorized officer of Licensor. -10.7 Print this License. +10.7 Print this License. For record keeping purposes, we encourage Licensee to print this License and the Order Form on the date that the Order Form is submitted. From 61632073ac9473e00d5e0c88078880d3af575828 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 13 Oct 2002 23:42:37 +0300 Subject: [PATCH 31/39] Allocate HEAP blocks in smaller blocks to get better memory utilization and more speed when used with safemalloc. Don't initalize memory areas when run with --skip-safemalloc. Docs/manual.texi: ChangeLog heap/heapdef.h: Allocate HEAP blocks in smaller blocks to get better memory utilization and more speed when used with safemalloc. heap/hp_open.c: Allocate HEAP blocks in smaller blocks to get better memory utilization and more speed when used with safemalloc. mysys/safemalloc.c: Don't initalize memory areas when run with --skip-safemalloc. This can in some cases increase speed with 20 times when debugging --- Docs/manual.texi | 4 +++- heap/heapdef.h | 11 +++++++++++ heap/hp_open.c | 10 ++++++++-- mysys/safemalloc.c | 7 +++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 21bab5ea6e4..86b19c0ff33 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46929,10 +46929,12 @@ not yet 100% confident in this code. @node News-3.23.54, News-3.23.53, News-3.23.x, News-3.23.x @appendixsubsec Changes in release 3.23.54 @itemize +@item Fixed reference to freed memory when doing complicated @code{GROUP BY ... ORDER BY} queries. Symptom was that @code{mysqld} died in function @code{send_fields}. -queries. +@item +Allocate heap rows in smaller blocks to get better memory usage. @end itemize @node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x diff --git a/heap/heapdef.h b/heap/heapdef.h index 938cb55c0eb..6b85e234c5e 100644 --- a/heap/heapdef.h +++ b/heap/heapdef.h @@ -22,6 +22,17 @@ #endif #include "heap.h" /* Structs & some defines */ +/* + When allocating keys /rows in the internal block structure, do it + within the following boundaries. + + The challenge is to find the balance between allocate as few blocks + as possible and keep memory consumption down. +*/ + +#define HP_MIN_RECORDS_IN_BLOCK 16 +#define HP_MAX_RECORDS_IN_BLOCK 8192 + /* Some extern variables */ extern LIST *heap_open_list,*heap_share_list; diff --git a/heap/hp_open.c b/heap/hp_open.c index 692142de14a..e0615879193 100644 --- a/heap/hp_open.c +++ b/heap/hp_open.c @@ -157,8 +157,14 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records, max_records=1000; /* As good as quess as anything */ recbuffer=(uint) (reclength+sizeof(byte**)-1) & ~(sizeof(byte**)-1); records_in_block=max_records/10; - if (records_in_block < 10 && max_records) - records_in_block=10; + if (records_in_block < HP_MIN_RECORDS_IN_BLOCK && max_records) + records_in_block= HP_MIN_RECORDS_IN_BLOCK; + /* + Don't allocate too many rows at one time too keep memory consumption + done when we don't need it. + */ + if (records_in_block > HP_MAX_RECORDS_IN_BLOCK) + records_in_block= HP_MAX_RECORDS_IN_BLOCK; if (!records_in_block || records_in_block*recbuffer > (my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS)) records_in_block=(my_default_record_cache_size-sizeof(HP_PTRS)* diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 34fcfff756c..0bf9341e3c1 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -194,9 +194,7 @@ gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags) pthread_mutex_unlock(&THR_LOCK_malloc); /* Set the memory to the aribtrary wierd value */ -#ifdef HAVE_purify - if (MyFlags & MY_ZEROFILL) -#endif + if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick) bfill(&pTmp -> aData[sf_malloc_prehunc],uSize, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL)); /* Return a pointer to the real data */ @@ -315,7 +313,8 @@ void _myfree (gptr pPtr, const char *sFile, uint uLine, myf myflags) #ifndef HAVE_purify /* Mark this data as free'ed */ - bfill(&pRec->aData[sf_malloc_prehunc],pRec->uDataSize,(pchar) FREE_VAL); + if (!sf_malloc_quick) + bfill(&pRec->aData[sf_malloc_prehunc],pRec->uDataSize,(pchar) FREE_VAL); #endif *((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) = ~MAGICKEY; From a86c172f582570dbc19554e85691c34869def66f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Oct 2002 17:04:12 +0300 Subject: [PATCH 32/39] Fixed a bug in key optimizing handling where the expression WHERE column_name = key_column_name was calculated as true for NULL values. Docs/manual.texi: Changelog mysql-test/r/distinct.result: Updated results caused by bug fix. mysql-test/r/null_key.result: New tests mysql-test/t/null_key.test: New tests sql/sql_select.cc: Additional change for previous changeset for using BLOB in GROUP BY --- Docs/manual.texi | 7 ++++++ mysql-test/r/distinct.result | 2 +- mysql-test/r/null_key.result | 6 +++++ mysql-test/t/null_key.test | 44 ++++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 18 +++++++++++---- sql/table.cc | 7 ++++++ 6 files changed, 79 insertions(+), 5 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 86b19c0ff33..67320f7352f 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46935,6 +46935,13 @@ Fixed reference to freed memory when doing complicated @code{GROUP BY @code{send_fields}. @item Allocate heap rows in smaller blocks to get better memory usage. +@item +Fixed memory allocation bug when storing BLOB values in internal +temporary tables used for some (unlikely) @code{GROUP BY} queries. +@item +Fixed a bug in key optimizing handling where the expression +@code{WHERE column_name = key_column_name} was calculated as true +for @code{NULL} values. @end itemize @node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 1d18fb4c75b..0d2f6c6c59c 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -128,7 +128,7 @@ a 1 table type possible_keys key key_len ref rows Extra t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary -t3 ref a a 5 t1.a 10 Using index; Distinct +t3 ref a a 5 t1.a 10 where used; Using index; Distinct a 1 2 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index ead1dc29326..a0f88b804aa 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -120,3 +120,9 @@ id uniq_id 4 2 7 3 8 4 +order_id product_id product_type +order_id product_id product_type +3d7ce39b5d4b3e3d22aaafe9b633de51 1206029 3 +3d7ce39b5d4b3e3d22aaafe9b633de51 5880836 3 +id id +id id diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index e5d8fc59e4f..3ab8b993f43 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -91,3 +91,47 @@ DELETE FROM t2 WHERE uniq_id IS NULL; SELECT * FROM t1 ORDER BY uniq_id, id; SELECT * FROM t2 ORDER BY uniq_id, id; DROP table t1,t2; + +# +# This crashed MySQL 3.23.47 +# + +CREATE TABLE `t1` ( + `order_id` char(32) NOT NULL default '', + `product_id` char(32) NOT NULL default '', + `product_type` int(11) NOT NULL default '0', + PRIMARY KEY (`order_id`,`product_id`,`product_type`) +) TYPE=MyISAM; +CREATE TABLE `t2` ( + `order_id` char(32) NOT NULL default '', + `product_id` char(32) NOT NULL default '', + `product_type` int(11) NOT NULL default '0', + PRIMARY KEY (`order_id`,`product_id`,`product_type`) +) TYPE=MyISAM; +INSERT INTO t1 (order_id, product_id, product_type) VALUES +('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3), +('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3), +('9d9aad7764b5b2c53004348ef8d34500',2315652, 3); +INSERT INTO t2 (order_id, product_id, product_type) VALUES +('9d9aad7764b5b2c53004348ef8d34500',2315652, 3); + +select t1.* from t1 +left join t2 using(order_id, product_id, product_type) +where t2.order_id=NULL; +select t1.* from t1 +left join t2 using(order_id, product_id, product_type) +where t2.order_id is NULL; +drop table t1,t2; + +# +# The last select returned wrong results in 3.23.52 +# + +create table t1 (id int); +insert into t1 values (null), (0); +create table t2 (id int); +insert into t2 values (null); +select * from t1, t2 where t1.id = t2.id; +alter table t1 add key id (id); +select * from t1, t2 where t1.id = t2.id; +drop table t1,t2; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e2cf2fd72df..8cf51e13759 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3319,7 +3319,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, char *tmpname,path[FN_REFLEN]; byte *pos,*group_buff; uchar *null_flags; - Field **reg_field,**from_field; + Field **reg_field, **from_field, **blob_field; Copy_field *copy=0; KEY *keyinfo; KEY_PART_INFO *key_part_info; @@ -3364,8 +3364,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, hidden_field_count=param->hidden_field_count; if (!my_multi_malloc(MYF(MY_WME), &table,sizeof(*table), - ®_field,sizeof(Field*)*(field_count+1), - &from_field,sizeof(Field*)*field_count, + ®_field, sizeof(Field*)*(field_count+1), + &blob_field, sizeof(Field*)*(field_count+1), + &from_field, sizeof(Field*)*field_count, ©_func,sizeof(*copy_func)*(param->func_count+1), ¶m->keyinfo,sizeof(*param->keyinfo), &key_part_info, @@ -3394,6 +3395,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, bzero((char*) reg_field,sizeof(Field*)*(field_count+1)); bzero((char*) from_field,sizeof(Field*)*field_count); table->field=reg_field; + table->blob_field= (Field_blob**) blob_field; table->real_name=table->path=tmpname; /* This must be "" as field may refer to it after tempory table is dropped @@ -3406,7 +3408,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, table->tmp_table= TMP_TABLE; table->db_low_byte_first=1; // True for HEAP and MyISAM table->temp_pool_slot = temp_pool_slot; - + table->copy_blobs= 1; /* Calculate which type of fields we will store in the temporary table */ @@ -3450,7 +3452,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, if (!(new_field->flags & NOT_NULL_FLAG)) null_count++; if (new_field->flags & BLOB_FLAG) + { + *blob_field++= new_field; blob_count++; + } ((Item_sum*) item)->args[i]= new Item_field(new_field); } } @@ -3472,7 +3477,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, if (!(new_field->flags & NOT_NULL_FLAG)) null_count++; if (new_field->flags & BLOB_FLAG) + { + *blob_field++= new_field; blob_count++; + } if (item->marker == 4 && item->maybe_null) { group_null_items++; @@ -3484,6 +3492,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, hidden_null_count=null_count; } field_count= (uint) (reg_field - table->field); + *blob_field= 0; // End marker /* If result table is small; use a heap */ if (blob_count || using_unique_constraint || group_null_items || @@ -3882,6 +3891,7 @@ free_tmp_table(THD *thd, TABLE *entry) save_proc_info=thd->proc_info; thd->proc_info="removing tmp table"; + free_blobs(entry); if (entry->db_stat && entry->file) { (void) entry->file->close(); diff --git a/sql/table.cc b/sql/table.cc index 4f71dacfa1d..e0f5edbf262 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -455,6 +455,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, field->field_length=key_part->length; } } + /* + If the field can be NULL, don't optimize away the test + key_part_column = expression from the WHERE clause + as we need to test for NULL = NULL. + */ + if (field->real_maybe_null()) + key_part->key_part_flag|= HA_PART_KEY; } else { // Error: shorten key From fab06ac587b5a0714fe962e687ae28f68c205bfd Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Oct 2002 01:52:41 +0300 Subject: [PATCH 33/39] Fix error handling in last patch (BLOB's in temporary tables) if create_tmp_table fails. --- sql/sql_select.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8cf51e13759..49502a7a116 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3749,6 +3749,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, DBUG_RETURN(table); err: + /* + Hack to ensure that free_blobs() doesn't fail if blob_field is not yet + complete + */ + *table->blob_field= 0; free_tmp_table(thd,table); /* purecov: inspected */ bitmap_clear_bit(&temp_pool, temp_pool_slot); DBUG_RETURN(NULL); /* purecov: inspected */ From cba8acc1af1e4874fafe0955e57815c0f8c2b5ad Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Oct 2002 02:04:43 -0200 Subject: [PATCH 34/39] Added optional services BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e85dfeb876f..5b4ad2564be 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -31,3 +31,4 @@ bar@bar.mysql.r18.ru paul@teton.kitebird.com serg@build.mysql2.com nick@mysql.com +miguel@hegel.br From 61062239c9937a29814256256b56a95bf912e68c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Oct 2002 21:28:38 +0200 Subject: [PATCH 35/39] - fixed Do-compile to actually add InnoDB support when requested to do so Build-tools/Do-compile: - fixed brainfart that ruined the 3.23.53-Max binaries: of course "--with-innodb" has to be added, when requested (will be part of 3.23.53a packages now) --- Build-tools/Do-compile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index a3da1804af5..0a4776b3eb9 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -215,7 +215,14 @@ if ($opt_stage <= 1) # Only enable InnoDB when requested (required to be able to # build the "Classic" packages that do not include InnoDB) - $opt_config_options.= " --without-innodb" if (!$opt_innodb); + if ($opt_innodb) + { + $opt_config_options.= " --with-innodb"; + } + else + { + $opt_config_options.= " --without-innodb"; + } if ($opt_with_other_libc) { From caad1f04f32d0b56ff5c1babab467d78022826df Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Oct 2002 21:03:41 +0000 Subject: [PATCH 36/39] -lpthread should be appended to LIBS --- configure.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index c22a208e6d0..0fc85479db5 100644 --- a/configure.in +++ b/configure.in @@ -1231,7 +1231,7 @@ fi AC_MSG_CHECKING("named thread libs:") if test "$with_named_thread" != "no" then - LIBS="$with_named_thread $LIBS" + LIBS="$with_named_thread $LIBS $with_named_thread" with_posix_threads="yes" with_mit_threads="no" AC_MSG_RESULT("$with_named_thread") @@ -1250,7 +1250,7 @@ else then AC_MSG_CHECKING("for pthread_create in -lpthread"); ac_save_LIBS="$LIBS" - LIBS="-lpthread $LIBS" + LIBS="$LIBS -lpthread" AC_TRY_LINK( [#include ], [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], @@ -1258,7 +1258,7 @@ else AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then - LIBS=" -lpthreads $ac_save_LIBS" + LIBS=" $ac_save_LIBS -lpthreads" AC_MSG_CHECKING("for pthread_create in -lpthreads"); AC_TRY_LINK( [#include ], From 09ab0dded2360bd8821453ccd3be7a8111674400 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Oct 2002 00:05:14 +0300 Subject: [PATCH 37/39] btr0cur.c: Fix bug: range estimator exaggerated small range size greatly if the paths in the B-tree happened to branch on a high level innobase/btr/btr0cur.c: Fix bug: range estimator exaggerated small range size greatly if the paths in the B-tree happened to branch on a high level --- innobase/btr/btr0cur.c | 44 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 6cf3d640aa0..c4960b7af80 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2547,6 +2547,7 @@ btr_estimate_n_rows_in_range( btr_path_t* slot1; btr_path_t* slot2; ibool diverged; + ibool diverged_lot; ulint divergence_level; ib_longlong n_rows; ulint i; @@ -2589,10 +2590,13 @@ btr_estimate_n_rows_in_range( /* We have the path information for the range in path1 and path2 */ n_rows = 1; - diverged = FALSE; - divergence_level = 1000000; - - for (i = 0; ; i++) { + diverged = FALSE; /* This becomes true when the path is not + the same any more */ + diverged_lot = FALSE; /* This becomes true when the paths are + not the same or adjacent any more */ + divergence_level = 1000000; /* This is the level where paths diverged + a lot */ + for (i = 0; ; i++) { ut_ad(i < BTR_PATH_ARRAY_N_SLOTS); slot1 = path1 + i; @@ -2620,7 +2624,7 @@ btr_estimate_n_rows_in_range( then we estimate all rows are in the range */ if (n_rows == 0) { - n_rows = index->table->stat_n_rows; + n_rows = index->table->stat_n_rows / 2; } } @@ -2629,8 +2633,15 @@ btr_estimate_n_rows_in_range( if (!diverged && slot1->nth_rec != slot2->nth_rec) { + diverged = TRUE; + if (slot1->nth_rec < slot2->nth_rec) { n_rows = slot2->nth_rec - slot1->nth_rec; + + if (n_rows > 1) { + diverged_lot = TRUE; + divergence_level = i; + } } else { /* Maybe the tree has changed between searches */ @@ -2638,10 +2649,27 @@ btr_estimate_n_rows_in_range( return(10); } - divergence_level = i; + } else if (diverged && !diverged_lot) { + + if (slot1->nth_rec < slot1->n_recs + || slot2->nth_rec > 1) { + + diverged_lot = TRUE; + divergence_level = i; + + n_rows = 0; + + if (slot1->nth_rec < slot1->n_recs) { + n_rows += slot1->n_recs + - slot1->nth_rec; + } + + if (slot2->nth_rec > 1) { + n_rows += slot2->nth_rec - 1; + } + } + } else if (diverged_lot) { - diverged = TRUE; - } else if (diverged) { n_rows = (n_rows * (slot1->n_recs + slot2->n_recs)) / 2; } From b95b51e53ad89f2ff1e6155c86cc3736c6402283 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Oct 2002 00:05:15 +0300 Subject: [PATCH 38/39] btr0cur.c: Fix typo in earlier commit innobase/btr/btr0cur.c: Fix typo in earlier commit --- innobase/btr/btr0cur.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index c4960b7af80..e1fe5ba8771 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2624,7 +2624,7 @@ btr_estimate_n_rows_in_range( then we estimate all rows are in the range */ if (n_rows == 0) { - n_rows = index->table->stat_n_rows / 2; + n_rows = index->table->stat_n_rows; } } From b3e3a09e726501dc1147563725dc80f718467e70 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Oct 2002 10:32:45 +0300 Subject: [PATCH 39/39] Fixed bug in LEFT JOIN ... WHERE not_null_key_column=NULL; Docs/manual.texi: ChangeLog sql/field.h: New virtual function to set a field to null or signal an error sql/field_conv.cc: New function to set a field to null or signal an error sql/item.cc: When setting a field to null internally (for WHERE testing) don't autoconvert NULL -> now() or last_insert_id() sql/item.h: New virtual function to set a field to null or signal an error --- Docs/manual.texi | 2 ++ sql/field.h | 1 + sql/field_conv.cc | 61 ++++++++++++++++++++++++++++++----------------- sql/item.cc | 42 ++++++++++++++++++++++++++++---- sql/item.h | 3 +++ 5 files changed, 83 insertions(+), 26 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 443340a2a4d..158db75a407 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46942,6 +46942,8 @@ temporary tables used for some (unlikely) @code{GROUP BY} queries. Fixed a bug in key optimizing handling where the expression @code{WHERE column_name = key_column_name} was calculated as true for @code{NULL} values. +@item +Fixed core dump bug when doing @code{LEFT JOIN ... WHERE key_column=NULL}. @end itemize @node News-3.23.53, News-3.23.52, News-3.23.54, News-3.23.x diff --git a/sql/field.h b/sql/field.h index b138eb772d8..e822f6a71d6 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1043,6 +1043,7 @@ Field *make_field(char *ptr, uint32 field_length, uint pack_length_to_packflag(uint type); uint32 calc_pack_length(enum_field_types type,uint32 length); bool set_field_to_null(Field *field); +bool set_field_to_null_with_conversions(Field *field); uint find_enum(TYPELIB *typelib,const char *x, uint length); ulonglong find_set(TYPELIB *typelib,const char *x, uint length); bool test_if_int(const char *str,int length); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 606edd84c74..dab96a9b827 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -112,35 +112,52 @@ static void do_outer_field_to_null_str(Copy_field *copy) bool set_field_to_null(Field *field) { - if (field->maybe_null()) + if (field->real_maybe_null()) { field->set_null(); field->reset(); + return 0; } - else - { - if (field->type() == FIELD_TYPE_TIMESTAMP) - { - ((Field_timestamp*) field)->set_time(); - return 0; // Ok to set time to NULL - } - field->reset(); - if (field == field->table->next_number_field) - return 0; // field is set in handler.cc - if (current_thd->count_cuted_fields) - { - current_thd->cuted_fields++; // Increment error counter - return 0; - } - if (!current_thd->no_errors) - my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), - field->field_name); - return 1; - } - return 0; + return 1; } +bool +set_field_to_null_with_conversions(Field *field) +{ + if (field->real_maybe_null()) + { + field->set_null(); + field->reset(); + return 0; + } + + /* + Check if this is a special type, which will get a special walue + when set to NULL + */ + if (field->type() == FIELD_TYPE_TIMESTAMP) + { + ((Field_timestamp*) field)->set_time(); + return 0; // Ok to set time to NULL + } + field->reset(); + if (field == field->table->next_number_field) + return 0; // field is set in handler.cc + if (current_thd->count_cuted_fields) + { + current_thd->cuted_fields++; // Increment error counter + return 0; + } + if (!current_thd->no_errors) + my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0), + field->field_name); + return 1; +} + + + + static void do_skip(Copy_field *copy __attribute__((unused))) { } diff --git a/sql/item.cc b/sql/item.cc index 0ce37cdd593..9b4274ab71d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -383,7 +383,7 @@ void Item_field::save_org_in_field(Field *to) if (field->is_null()) { null_value=1; - set_field_to_null(to); + set_field_to_null_with_conversions(to); } else { @@ -398,7 +398,7 @@ bool Item_field::save_in_field(Field *to) if (result_field->is_null()) { null_value=1; - return set_field_to_null(to); + return set_field_to_null_with_conversions(to); } else { @@ -409,8 +409,41 @@ bool Item_field::save_in_field(Field *to) return 0; } +/* + Store null in field + + SYNOPSIS + save_in_field() + field Field where we want to store NULL + + DESCRIPTION + This is used on INSERT. + Allow NULL to be inserted in timestamp and auto_increment values + + RETURN VALUES + 0 ok + 1 Field doesn't support NULL values and can't handle 'field = NULL' +*/ bool Item_null::save_in_field(Field *field) +{ + return set_field_to_null_with_conversions(field); +} + + +/* + Store null in field + + SYNOPSIS + save_safe_in_field() + field Field where we want to store NULL + + RETURN VALUES + 0 ok + 1 Field doesn't support NULL values +*/ + +bool Item_null::save_safe_in_field(Field *field) { return set_field_to_null(field); } @@ -427,7 +460,7 @@ bool Item::save_in_field(Field *field) str_value.set_quick(buff,sizeof(buff)); result=val_str(&str_value); if (null_value) - return set_field_to_null(field); + return set_field_to_null_with_conversions(field); field->set_notnull(); field->store(result->ptr(),result->length()); str_value.set_quick(0, 0); @@ -444,13 +477,14 @@ bool Item::save_in_field(Field *field) { longlong nr=val_int(); if (null_value) - return set_field_to_null(field); + return set_field_to_null_with_conversions(field); field->set_notnull(); field->store(nr); } return 0; } + bool Item_string::save_in_field(Field *field) { String *result; diff --git a/sql/item.h b/sql/item.h index b8903756027..408010d211a 100644 --- a/sql/item.h +++ b/sql/item.h @@ -55,6 +55,8 @@ public: virtual bool save_in_field(Field *field); virtual void save_org_in_field(Field *field) { (void) save_in_field(field); } + virtual bool save_safe_in_field(Field *field) + { return save_in_field(field); } virtual bool send(String *str); virtual bool eq(const Item *, bool binary_cmp) const; virtual Item_result result_type () const { return REAL_RESULT; } @@ -144,6 +146,7 @@ public: String *val_str(String *str); void make_field(Send_field *field); bool save_in_field(Field *field); + bool save_safe_in_field(Field *field); enum Item_result result_type () const { return STRING_RESULT; } bool send(String *str);