Commit 76f146a1 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Merge with 4.0.9

parents 1b03f007 c1d61419
...@@ -253,6 +253,7 @@ depcomp ...@@ -253,6 +253,7 @@ depcomp
extra/comp_err extra/comp_err
extra/my_print_defaults extra/my_print_defaults
extra/mysql_install extra/mysql_install
extra/mysql_waitpid
extra/perror extra/perror
extra/replace extra/replace
extra/resolve_stack_dump extra/resolve_stack_dump
...@@ -350,6 +351,7 @@ libmysqld/opt_range.cc ...@@ -350,6 +351,7 @@ libmysqld/opt_range.cc
libmysqld/opt_sum.cc libmysqld/opt_sum.cc
libmysqld/password.c libmysqld/password.c
libmysqld/procedure.cc libmysqld/procedure.cc
libmysqld/protocol.cc
libmysqld/records.cc libmysqld/records.cc
libmysqld/repl_failsafe.cc libmysqld/repl_failsafe.cc
libmysqld/set_var.cc libmysqld/set_var.cc
...@@ -569,6 +571,7 @@ support-files/mysql-log-rotate ...@@ -569,6 +571,7 @@ support-files/mysql-log-rotate
support-files/mysql.server support-files/mysql.server
support-files/mysql.spec support-files/mysql.spec
tags tags
test_xml
tests/client_test tests/client_test
tmp/* tmp/*
tools/my_vsnprintf.c tools/my_vsnprintf.c
...@@ -579,6 +582,3 @@ vio/test-ssl ...@@ -579,6 +582,3 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
libmysqld/protocol.cc
test_xml
extra/mysql_waitpid
...@@ -4,7 +4,7 @@ make -k clean ...@@ -4,7 +4,7 @@ make -k clean
/bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache mysql-*.tar.gz /bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache mysql-*.tar.gz
aclocal; autoheader; aclocal; automake; autoconf aclocal; autoheader; aclocal; automake; autoconf
CC=ccc CFLAGS="-fast" CXX=cxx CXXFLAGS="-fast -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared --without-extra-tools CC=ccc CFLAGS="-fast" CXX=cxx CXXFLAGS="-fast -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared --without-extra-tools --disable-dependency-tracking
make -j2 make -j2
find . -name ".deps" | xargs rm -r find . -name ".deps" | xargs rm -r
......
...@@ -21,10 +21,10 @@ AUTOMAKE_OPTIONS = foreign ...@@ -21,10 +21,10 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory # These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE README \ EXTRA_DIST = INSTALL-SOURCE README \
COPYING COPYING.LIB COPYING COPYING.LIB
SUBDIRS = include @docs_dirs@ @readline_dir@ \ SUBDIRS = . include @docs_dirs@ @readline_dir@ \
@thread_dirs@ pstack @sql_client_dirs@ \ @thread_dirs@ pstack @sql_client_dirs@ \
@sql_server_dirs@ @libmysqld_dirs@ scripts man \ @sql_server_dirs@ scripts man tests \
tests BUILD os2 \ BUILD os2 libmysql_r @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@ @bench_dirs@ support-files @fs_dirs@ @tools_dirs@
# Relink after clean # Relink after clean
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.26" #define MTEST_VERSION "1.27"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -684,7 +684,7 @@ int open_file(const char* name) ...@@ -684,7 +684,7 @@ int open_file(const char* name)
if (*cur_file && cur_file == file_stack_end) if (*cur_file && cur_file == file_stack_end)
die("Source directives are nesting too deep"); die("Source directives are nesting too deep");
if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY, MYF(MY_WME)))) if (!(*(cur_file+1) = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME))))
die(NullS); die(NullS);
cur_file++; cur_file++;
*++lineno=1; *++lineno=1;
...@@ -1924,7 +1924,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -1924,7 +1924,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
argument= buff; argument= buff;
} }
fn_format(buff, argument, "", "", 4); fn_format(buff, argument, "", "", 4);
if (!(*++cur_file = my_fopen(buff, O_RDONLY, MYF(MY_WME)))) if (!(*++cur_file = my_fopen(buff, O_RDONLY | O_BINARY, MYF(MY_WME))))
die("Could not open %s: errno = %d", argument, errno); die("Could not open %s: errno = %d", argument, errno);
break; break;
} }
......
...@@ -2311,6 +2311,7 @@ EOF ...@@ -2311,6 +2311,7 @@ EOF
if test X"$have_innodb" = Xyes if test X"$have_innodb" = Xyes
then then
innodb_conf_flags=""
sql_server_dirs="$sql_server_dirs innobase" sql_server_dirs="$sql_server_dirs innobase"
echo "CONFIGURING FOR INNODB" echo "CONFIGURING FOR INNODB"
if test ! -d "innobase"; then if test ! -d "innobase"; then
...@@ -2323,7 +2324,11 @@ EOF ...@@ -2323,7 +2324,11 @@ EOF
/* ) rel_srcdir="$srcdir" ;; /* ) rel_srcdir="$srcdir" ;;
* ) rel_srcdir="../$srcdir" ;; * ) rel_srcdir="../$srcdir" ;;
esac esac
(cd innobase && sh $rel_srcdir/innobase/configure) \ if test "x$enable_dependency_tracking" == xno
then
innodb_conf_flags=--disable-dependency-tracking
fi
(cd innobase && sh $rel_srcdir/innobase/configure $innodb_conf_flags) \
|| AC_MSG_ERROR([could not configure INNODB]) || AC_MSG_ERROR([could not configure INNODB])
echo "END OF INNODB CONFIGURATION" echo "END OF INNODB CONFIGURATION"
......
#include <sys/types.h> /* Copyright (C) 2003 MySQL AB
#include <signal.h>
#include <errno.h> This program is free software; you can redistribute it and/or modify
#include <string.h> it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Wait until a program dies */
#include <my_global.h> #include <my_global.h>
#include <m_string.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <signal.h>
#include <errno.h>
static const char *VER= "1.1"; static const char *VER= "1.1";
static char *progname; static char *progname;
......
...@@ -153,6 +153,13 @@ C_MODE_END ...@@ -153,6 +153,13 @@ C_MODE_END
#undef HAVE_INITGROUPS #undef HAVE_INITGROUPS
#endif #endif
/* gcc/egcs issues */
#if defined(__GNUC) && defined(__EXCEPTIONS)
#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile"
#endif
/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ /* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) #if SIZEOF_LONG == 4 && defined(__LONG_MAX__)
#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ #undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */
......
...@@ -581,9 +581,13 @@ extern int pthread_dummy(int); ...@@ -581,9 +581,13 @@ extern int pthread_dummy(int);
#define THREAD_NAME_SIZE 10 #define THREAD_NAME_SIZE 10
#if defined(__ia64__) #if defined(__ia64__)
#define DEFAULT_THREAD_STACK (128*1024) /*
MySQL can survive with 32K, but some glibc libraries require > 128K stack
To resolve hostnames
*/
#define DEFAULT_THREAD_STACK (192*1024L)
#else #else
#define DEFAULT_THREAD_STACK (64*1024) #define DEFAULT_THREAD_STACK (192*1024L)
#endif #endif
struct st_my_thread_var struct st_my_thread_var
......
...@@ -135,7 +135,7 @@ btr_page_insert_fits( ...@@ -135,7 +135,7 @@ btr_page_insert_fits(
/****************************************************************** /******************************************************************
Gets the root node of a tree and x-latches it. */ Gets the root node of a tree and x-latches it. */
static
page_t* page_t*
btr_root_get( btr_root_get(
/*=========*/ /*=========*/
...@@ -147,9 +147,6 @@ btr_root_get( ...@@ -147,9 +147,6 @@ btr_root_get(
ulint root_page_no; ulint root_page_no;
page_t* root; page_t* root;
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree), MTR_MEMO_X_LOCK)
|| mtr_memo_contains(mtr, dict_tree_get_lock(tree), MTR_MEMO_S_LOCK));
space = dict_tree_get_space(tree); space = dict_tree_get_space(tree);
root_page_no = dict_tree_get_page(tree); root_page_no = dict_tree_get_page(tree);
...@@ -334,8 +331,6 @@ btr_page_alloc( ...@@ -334,8 +331,6 @@ btr_page_alloc(
page_t* new_page; page_t* new_page;
ulint new_page_no; ulint new_page_no;
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK));
if (tree->type & DICT_IBUF) { if (tree->type & DICT_IBUF) {
return(btr_page_alloc_for_ibuf(tree, mtr)); return(btr_page_alloc_for_ibuf(tree, mtr));
......
...@@ -3183,7 +3183,7 @@ btr_store_big_rec_extern_fields( ...@@ -3183,7 +3183,7 @@ btr_store_big_rec_extern_fields(
ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree), ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree),
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(data), ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
ut_a(index->type & DICT_CLUSTERED); ut_a(index->type & DICT_CLUSTERED);
...@@ -3318,7 +3318,13 @@ void ...@@ -3318,7 +3318,13 @@ void
btr_free_externally_stored_field( btr_free_externally_stored_field(
/*=============================*/ /*=============================*/
dict_index_t* index, /* in: index of the data, the index dict_index_t* index, /* in: index of the data, the index
tree MUST be X-latched */ tree MUST be X-latched; if the tree
height is 1, then also the root page
must be X-latched! (this is relevant
in the case this function is called
from purge where 'data' is located on
an undo log page, not an index
page) */
byte* data, /* in: internally stored data byte* data, /* in: internally stored data
+ reference to the externally + reference to the externally
stored part */ stored part */
......
...@@ -55,6 +55,15 @@ UNIQUE definition on secondary indexes when we decide if we can use the ...@@ -55,6 +55,15 @@ UNIQUE definition on secondary indexes when we decide if we can use the
insert buffer to speed up inserts */ insert buffer to speed up inserts */
#define BTR_IGNORE_SEC_UNIQUE 2048 #define BTR_IGNORE_SEC_UNIQUE 2048
/******************************************************************
Gets the root node of a tree and x-latches it. */
page_t*
btr_root_get(
/*=========*/
/* out: root page, x-latched */
dict_tree_t* tree, /* in: index tree */
mtr_t* mtr); /* in: mtr */
/****************************************************************** /******************************************************************
Gets a buffer page and declares its latching order level. */ Gets a buffer page and declares its latching order level. */
UNIV_INLINE UNIV_INLINE
......
...@@ -507,7 +507,13 @@ void ...@@ -507,7 +507,13 @@ void
btr_free_externally_stored_field( btr_free_externally_stored_field(
/*=============================*/ /*=============================*/
dict_index_t* index, /* in: index of the data, the index dict_index_t* index, /* in: index of the data, the index
tree MUST be X-latched */ tree MUST be X-latched; if the tree
height is 1, then also the root page
must be X-latched! (this is relevant
in the case this function is called
from purge where 'data' is located on
an undo log page, not an index
page) */
byte* data, /* in: internally stored data byte* data, /* in: internally stored data
+ reference to the externally + reference to the externally
stored part */ stored part */
......
...@@ -253,7 +253,8 @@ page_cur_search_with_match( ...@@ -253,7 +253,8 @@ page_cur_search_with_match(
up_matched_bytes = cur_matched_bytes; up_matched_bytes = cur_matched_bytes;
} }
} else if ((mode == PAGE_CUR_G) || (mode == PAGE_CUR_LE)) { } else if (mode == PAGE_CUR_G || mode == PAGE_CUR_LE
|| mode == PAGE_CUR_LE_OR_EXTENDS) {
low = mid; low = mid;
low_matched_fields = cur_matched_fields; low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes; low_matched_bytes = cur_matched_bytes;
...@@ -308,7 +309,8 @@ page_cur_search_with_match( ...@@ -308,7 +309,8 @@ page_cur_search_with_match(
up_matched_fields = cur_matched_fields; up_matched_fields = cur_matched_fields;
up_matched_bytes = cur_matched_bytes; up_matched_bytes = cur_matched_bytes;
} }
} else if ((mode == PAGE_CUR_G) || (mode == PAGE_CUR_LE)) { } else if (mode == PAGE_CUR_G || mode == PAGE_CUR_LE
|| mode == PAGE_CUR_LE_OR_EXTENDS) {
low_rec = mid_rec; low_rec = mid_rec;
low_matched_fields = cur_matched_fields; low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes; low_matched_bytes = cur_matched_bytes;
......
...@@ -430,6 +430,17 @@ skip_secondaries: ...@@ -430,6 +430,17 @@ skip_secondaries:
mtr_x_lock(dict_tree_get_lock(index->tree), &mtr); mtr_x_lock(dict_tree_get_lock(index->tree), &mtr);
/* NOTE: we must also acquire an X-latch to the
root page of the tree. We will need it when we
free pages from the tree. If the tree is of height 1,
the tree X-latch does NOT protect the root page,
because it is also a leaf page. Since we will have a
latch on an undo log page, we would break the
latching order if we would only later latch the
root page of such a tree! */
btr_root_get(index->tree, &mtr);
/* We assume in purge of externally stored fields /* We assume in purge of externally stored fields
that the space id of the undo log record is 0! */ that the space id of the undo log record is 0! */
......
...@@ -1727,6 +1727,7 @@ srv_conc_enter_innodb( ...@@ -1727,6 +1727,7 @@ srv_conc_enter_innodb(
ibool has_slept = FALSE; ibool has_slept = FALSE;
srv_conc_slot_t* slot; srv_conc_slot_t* slot;
ulint i; ulint i;
char err_buf[1000];
if (srv_thread_concurrency >= 500) { if (srv_thread_concurrency >= 500) {
/* Disable the concurrency check */ /* Disable the concurrency check */
...@@ -1745,6 +1746,16 @@ srv_conc_enter_innodb( ...@@ -1745,6 +1746,16 @@ srv_conc_enter_innodb(
retry: retry:
os_fast_mutex_lock(&srv_conc_mutex); os_fast_mutex_lock(&srv_conc_mutex);
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
trx_print(err_buf, trx);
fprintf(stderr,
" InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
"InnoDB: it already is declared.\n%s\n", err_buf);
}
if (srv_conc_n_threads < (lint)srv_thread_concurrency) { if (srv_conc_n_threads < (lint)srv_thread_concurrency) {
srv_conc_n_threads++; srv_conc_n_threads++;
...@@ -1815,8 +1826,12 @@ retry: ...@@ -1815,8 +1826,12 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will /* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */ release this thread */
trx->op_info = "waiting in InnoDB queue";
os_event_wait(slot->event); os_event_wait(slot->event);
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex); os_fast_mutex_lock(&srv_conc_mutex);
srv_conc_n_waiting_threads--; srv_conc_n_waiting_threads--;
......
...@@ -233,8 +233,19 @@ trx_free( ...@@ -233,8 +233,19 @@ trx_free(
/*=====*/ /*=====*/
trx_t* trx) /* in, own: trx object */ trx_t* trx) /* in, own: trx object */
{ {
char err_buf[1000];
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
trx_print(err_buf, trx);
fprintf(stderr,
" InnoDB: Error: Freeing a trx which is declared to be processing\n"
"InnoDB: inside InnoDB.\n%s\n", err_buf);
}
ut_a(trx->magic_n == TRX_MAGIC_N); ut_a(trx->magic_n == TRX_MAGIC_N);
trx->magic_n = 11112222; trx->magic_n = 11112222;
...@@ -1506,10 +1517,10 @@ trx_print( ...@@ -1506,10 +1517,10 @@ trx_print(
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
buf += sprintf(buf, ", process no %lu", trx->mysql_process_no); buf += sprintf(buf, ", process no %lu", trx->mysql_process_no);
#else #endif
buf += sprintf(buf, ", OS thread id %lu", buf += sprintf(buf, ", OS thread id %lu",
os_thread_pf(trx->mysql_thread_id)); os_thread_pf(trx->mysql_thread_id));
#endif
if (ut_strlen(trx->op_info) > 0) { if (ut_strlen(trx->op_info) > 0) {
buf += sprintf(buf, " %s", trx->op_info); buf += sprintf(buf, " %s", trx->op_info);
} }
...@@ -1518,6 +1529,11 @@ trx_print( ...@@ -1518,6 +1529,11 @@ trx_print(
buf += sprintf(buf, " purge trx"); buf += sprintf(buf, " purge trx");
} }
if (trx->declared_to_be_inside_innodb) {
buf += sprintf(buf, ", thread declared inside InnoDB %lu",
trx->n_tickets_to_enter_innodb);
}
buf += sprintf(buf, "\n"); buf += sprintf(buf, "\n");
start_of_line = buf; start_of_line = buf;
......
...@@ -84,6 +84,8 @@ clean-local: ...@@ -84,6 +84,8 @@ clean-local:
rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \ rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \
`echo $(dbugobjects) | sed "s;\.lo;.c;g"` \ `echo $(dbugobjects) | sed "s;\.lo;.c;g"` \
`echo $(mysysobjects) | sed "s;\.lo;.c;g"` \ `echo $(mysysobjects) | sed "s;\.lo;.c;g"` \
`echo $(vio_objects) | sed "s;\.lo;.c;g"` \
$(CHARSET_SRCS) $(CHARSET_OBJS) \
$(mystringsextra) $(mysysheaders) \ $(mystringsextra) $(mysysheaders) \
../linked_client_sources net.c ../linked_client_sources net.c
......
...@@ -100,6 +100,12 @@ EXPORTS ...@@ -100,6 +100,12 @@ EXPORTS
mysql_rpl_probe mysql_rpl_probe
mysql_set_master mysql_set_master
mysql_add_slave mysql_add_slave
my_getopt_print_errors
handle_options
my_print_help
my_print_variables
getopt_ull_limit_value
getopt_compare_strings
mysql_warning_count mysql_warning_count
mysql_warnings mysql_warnings
mysql_prepare mysql_prepare
......
...@@ -3009,6 +3009,16 @@ hardcode_action=$hardcode_action ...@@ -3009,6 +3009,16 @@ hardcode_action=$hardcode_action
# This must work even if \$libdir does not exist. # This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
# Check if debuild is being run by the current shell. If it is then,
# the DEB_BUILD_ARCH variable should be of non-zero length, indicating
# that we are in the middle of a Debian package build (assuming the
# user isn't doing anything strange with environment variables).
if test -n "`dpkg-architecture -qDEB_BUILD_ARCH`" && ps | grep debuild | grep -v grep > /dev/null; then
# Debian policy mandates that rpaths should not be encoded into a binary
# so it is overridden.
hardcode_libdir_flag_spec=" -D_DEBIAN_PATCHED_LIBTOOL_ "
fi
# Whether we need a single -rpath flag with a separated argument. # Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator=$hardcode_libdir_separator hardcode_libdir_separator=$hardcode_libdir_separator
......
.TH ISAMCHK 1 "19 December 2000" .TH isamchk 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR isamchk .BR isamchk
\- Description, check and repair of ISAM tables. \- Description, check and repair of ISAM tables.
......
.TH ISAMLOG 1 "20 December 2000" .TH isamlog 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
isamlog - Write info about whats in a nisam log file. isamlog - Write info about whats in a nisam log file.
.SH USAGE .SH USAGE
......
.TH MYSQL 1 "13 June 1997" .TH mysql 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
mysql \- text-based client for mysqld, a SQL-based relational database daemon mysql \- text-based client for mysqld, a SQL-based relational database daemon
.SH SYNOPSIS .SH SYNOPSIS
......
.TH ZAP 1 "20 December 2000" .TH zap 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
zap - a perl script used to kill processes zap - a perl script used to kill processes
.SH USAGE .SH USAGE
......
.TH MYSQLACCESS 1 "19 December 2000" .TH mysqlaccess 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR mysqlaccess .BR mysqlaccess
\- Create new users to mysql. \- Create new users to mysql.
......
.TH MYSQLADMIN 1 "18 December 2000" .TH mysqladmin 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
mysqladmin [OPTIONS] command command.... \- A utility for performing administrative operations mysqladmin [OPTIONS] command command.... \- A utility for performing administrative operations
.SH OPTION SYNOPSIS .SH OPTION SYNOPSIS
......
.TH MYSQLD 1 "19 December 2000" .TH mysqld 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR mysqld .BR mysqld
\- Starts the MySQL server demon \- Starts the MySQL server demon
......
.TH MYSQLD_MULTI 1 "20 December 2000" .TH mysqld_multi 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
mysqld_multi - is meant for managing several mysqld processes running in different UNIX sockets and TCP/IP ports. mysqld_multi - is meant for managing several mysqld processes running in different UNIX sockets and TCP/IP ports.
.SH USAGE .SH USAGE
......
.TH SAFE_MYSQLD 1 "19 December 2000" "safe_mysqld (mysql)" mysql.com .TH safe_mysqld 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
mysqld_safe \- start the mysqld daemon on Unix. mysqld_safe \- start the mysqld daemon on Unix.
.SH SYNOPSIS .SH SYNOPSIS
......
.TH MYSQLDUMP 1 "19 December 2000" .TH mysqldump 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
mysqldump \- text-based client for dumping or backing up mysql databases , tables and or data. mysqldump \- text-based client for dumping or backing up mysql databases , tables and or data.
...@@ -123,7 +123,7 @@ Connect to host. ...@@ -123,7 +123,7 @@ Connect to host.
Lock all tables for read. Lock all tables for read.
.TP .TP
.BR \-n | \-\-no\-create\-db .BR \-n | \-\-no\-create\-db
'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;' \&'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;'
will not be put in the output. The above line will will not be put in the output. The above line will
be added otherwise, if be added otherwise, if
.BR \-\-databases .BR \-\-databases
......
.TH MYSQLSHOW 1 "19 December 2000" .TH mysqlshow 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR mysqlshow .BR mysqlshow
\- Shows the structure of a mysql database (databases,tables and columns) \- Shows the structure of a mysql database (databases,tables and columns)
......
.TH PERROR 1 "19 December 2000" .TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR perror .BR perror
can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. The error messages are mostly system dependent. can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. The error messages are mostly system dependent.
......
.TH REPLACE 1 "20 December 2000" .TH replace 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.TP .TP
replace - A utility program that is used by msql2mysql, but that has more general applicability as well. replace changes strings in place in files or on the standard input. Uses a finite state machine to match longer strings first. Can be used to swap strings. replace - A utility program that is used by msql2mysql, but that has more general applicability as well. replace changes strings in place in files or on the standard input. Uses a finite state machine to match longer strings first. Can be used to swap strings.
......
...@@ -230,7 +230,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -230,7 +230,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (uniques) if (uniques)
{ {
max_key_block_length= myisam_block_size; max_key_block_length= myisam_block_size;
max_key_length= MI_UNIQUE_HASH_LENGTH; max_key_length= MI_UNIQUE_HASH_LENGTH + pointer;
} }
for (i=0, keydef=keydefs ; i < keys ; i++ , keydef++) for (i=0, keydef=keydefs ; i < keys ; i++ , keydef++)
......
...@@ -24,7 +24,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record, ...@@ -24,7 +24,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
{ {
my_off_t lastpos=info->lastpos; my_off_t lastpos=info->lastpos;
MI_KEYDEF *key= &info->s->keyinfo[def->key]; MI_KEYDEF *key= &info->s->keyinfo[def->key];
uchar *key_buff=info->lastkey+info->s->base.max_key_length; uchar *key_buff=info->lastkey2;
DBUG_ENTER("mi_check_unique"); DBUG_ENTER("mi_check_unique");
mi_unique_store(record+key->seg->start, unique_hash); mi_unique_store(record+key->seg->start, unique_hash);
...@@ -80,8 +80,17 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record) ...@@ -80,8 +80,17 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
if (keyseg->null_bit) if (keyseg->null_bit)
{ {
if (record[keyseg->null_pos] & keyseg->null_bit) if (record[keyseg->null_pos] & keyseg->null_bit)
{
/*
Change crc in a way different from an empty string or 0.
(This is an optimisation; The code will work even if this isn't
done)
*/
crc=((crc << 8) + 511+
(crc >> (8*sizeof(ha_checksum)-8)));
continue; continue;
} }
}
pos= record+keyseg->start; pos= record+keyseg->start;
if (keyseg->flag & HA_VAR_LENGTH) if (keyseg->flag & HA_VAR_LENGTH)
{ {
......
...@@ -130,7 +130,7 @@ int main(int argc, char **argv) ...@@ -130,7 +130,7 @@ int main(int argc, char **argv)
char buff[22],buff2[22]; char buff[22],buff2[22];
if (!(check_param.testflag & T_SILENT) || check_param.testflag & T_INFO) if (!(check_param.testflag & T_SILENT) || check_param.testflag & T_INFO)
puts("\n---------\n"); puts("\n---------\n");
printf("\nTotal of all %d ISAM-files:\nData records: %9s Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff), printf("\nTotal of all %d MyISAM-files:\nData records: %9s Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff),
llstr(check_param.total_deleted,buff2)); llstr(check_param.total_deleted,buff2));
} }
free_defaults(default_argv); free_defaults(default_argv);
...@@ -330,7 +330,7 @@ static void usage(void) ...@@ -330,7 +330,7 @@ static void usage(void)
print_version(); print_version();
puts("By Monty, for your professional use"); puts("By Monty, for your professional use");
puts("This software comes with NO WARRANTY: see the PUBLIC for details.\n"); puts("This software comes with NO WARRANTY: see the PUBLIC for details.\n");
puts("Description, check and repair of ISAM tables."); puts("Description, check and repair of MyISAM tables.");
puts("Used without options all tables on the command will be checked for errors"); puts("Used without options all tables on the command will be checked for errors");
printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname); printf("Usage: %s [OPTIONS] tables[.MYI]\n", my_progname);
puts("\nGlobal options:\n\ puts("\nGlobal options:\n\
...@@ -1693,7 +1693,7 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...) ...@@ -1693,7 +1693,7 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
if (!param->warning_printed && !param->error_printed) if (!param->warning_printed && !param->error_printed)
{ {
if (param->testflag & T_SILENT) if (param->testflag & T_SILENT)
fprintf(stderr,"%s: ISAM file %s\n",my_progname,param->isam_file_name); fprintf(stderr,"%s: MyISAM file %s\n",my_progname,param->isam_file_name);
param->out_flag|= O_DATA_LOST; param->out_flag|= O_DATA_LOST;
} }
param->error_printed|=1; param->error_printed|=1;
......
...@@ -332,7 +332,7 @@ while test $# -gt 0; do ...@@ -332,7 +332,7 @@ while test $# -gt 0; do
VALGRIND="valgrind --alignment=8 --leak-check=yes" VALGRIND="valgrind --alignment=8 --leak-check=yes"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc" EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
#SLEEP_TIME_AFTER_RESTART=120 SLEEP_TIME_AFTER_RESTART=10
SLEEP_TIME_FOR_DELETE=60 SLEEP_TIME_FOR_DELETE=60
;; ;;
--valgrind-options=*) --valgrind-options=*)
......
...@@ -468,3 +468,17 @@ NOT NULL); ...@@ -468,3 +468,17 @@ NOT NULL);
max(value) max(value)
4 4
drop table t1,t2,t3; drop table t1,t2,t3;
create table t1 (a blob null);
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
select a,count(*) from t1 group by a;
a count(*)
NULL 9
3
b 1
set option sql_big_tables=1;
select a,count(*) from t1 group by a;
a count(*)
NULL 9
3
b 1
drop table t1;
...@@ -260,7 +260,7 @@ t3 CREATE TABLE `t3` ( ...@@ -260,7 +260,7 @@ t3 CREATE TABLE `t3` (
`othr` int(11) NOT NULL default '0' `othr` int(11) NOT NULL default '0'
) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2) ) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
drop table t3,t2,t1; drop table t3,t2,t1;
create table t1 (a int not null) type=merge; create table t1 (a int not null, key(a)) type=merge;
select * from t1; select * from t1;
a a
drop table t1; drop table t1;
...@@ -536,7 +536,7 @@ INSERT INTO t2 VALUES (1,2), (2,2); ...@@ -536,7 +536,7 @@ INSERT INTO t2 VALUES (1,2), (2,2);
CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2);
select max(b) from t3 where a = 2; select max(b) from t3 where a = 2;
max(b) max(b)
NULL 2
select max(b) from t1 where a = 2; select max(b) from t1 where a = 2;
max(b) max(b)
1 1
......
...@@ -73,3 +73,39 @@ b ifnull(t2.b,"this is null") ...@@ -73,3 +73,39 @@ b ifnull(t2.b,"this is null")
NULL this is null NULL this is null
NULL this is null NULL this is null
drop table t1; drop table t1;
CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
UPDATE t1 SET d=1/NULL;
UPDATE t1 SET d=NULL;
INSERT INTO t1 (a) values (null);
Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null);
INSERT INTO t1 (b) values (null);
Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null);
Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null);
INSERT INTO t1 (c) values (null);
Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null);
Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null);
INSERT INTO t1 (d) values (null);
Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null);
Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null);
select * from t1;
a b c d
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
drop table t1;
slave stop;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
select * from t1;
a b
1 10
2 15
drop table t1;
...@@ -363,3 +363,14 @@ m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = ...@@ -363,3 +363,14 @@ m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
NOT NULL); NOT NULL);
drop table t1,t2,t3; drop table t1,t2,t3;
#
# Test bug in GROUP BY on BLOB that is NULL or empty
#
create table t1 (a blob null);
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
select a,count(*) from t1 group by a;
set option sql_big_tables=1;
select a,count(*) from t1 group by a;
drop table t1;
...@@ -109,7 +109,7 @@ drop table t3,t2,t1; ...@@ -109,7 +109,7 @@ drop table t3,t2,t1;
# #
# Test table without unions # Test table without unions
# #
create table t1 (a int not null) type=merge; create table t1 (a int not null, key(a)) type=merge;
select * from t1; select * from t1;
drop table t1; drop table t1;
......
...@@ -52,3 +52,34 @@ insert into t1 values(10,null); ...@@ -52,3 +52,34 @@ insert into t1 values(10,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
t2.b=t3.a order by 1; t2.b=t3.a order by 1;
drop table t1; drop table t1;
#
# Test inserting and updating with NULL
#
CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT NULL, d smallint(6) NOT NULL);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
UPDATE t1 SET d=1/NULL;
UPDATE t1 SET d=NULL;
--error 1048
INSERT INTO t1 (a) values (null);
--error 1048
INSERT INTO t1 (a) values (1/null);
INSERT INTO t1 (a) values (null),(null);
--error 1048
INSERT INTO t1 (b) values (null);
--error 1048
INSERT INTO t1 (b) values (1/null);
INSERT INTO t1 (b) values (null),(null);
--error 1048
INSERT INTO t1 (c) values (null);
--error 1048
INSERT INTO t1 (c) values (1/null);
INSERT INTO t1 (c) values (null),(null);
--error 1048
INSERT INTO t1 (d) values (null);
--error 1048
INSERT INTO t1 (d) values (1/null);
INSERT INTO t1 (d) values (null),(null);
select * from t1;
drop table t1;
# See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
source include/master-slave.inc;
create table t1(a int not null auto_increment, b int, primary key(a) );
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
--skip-external-locking
#!/bin/sh #!/bin/sh
echo "This scripts updates the mysql.user, mysql.db, mysql.host and the" echo "This scripts updates the mysql.user, mysql.db, mysql.host and the"
echo "mysql.func table to MySQL 3.22.14 and above." echo "mysql.func tables to MySQL 3.22.14 and above."
echo "" echo ""
echo "This is needed if you want to use the new GRANT functions," echo "This is needed if you want to use the new GRANT functions,"
echo "CREATE AGGREAGATE FUNCTION or want to use the more secure passwords in 3.23" echo "CREATE AGGREGATE FUNCTION or want to use the more secure passwords in 3.23"
echo "" echo ""
echo "If you get Access denied errors, you should run this script again" echo "If you get 'Access denied' errors, you should run this script again"
echo "and give the MySQL root user password as a argument!" echo "and give the MySQL root user password as an argument!"
root_password="$1" root_password="$1"
host="localhost" host="localhost"
user="root"
if test -z $1 ; then
cmd="@bindir@/mysql -f --user=$user --host=$host mysql"
else
root_password="$1"
cmd="@bindir@/mysql -f --user=$user --password=$root_password --host=$host mysql"
fi
echo "Converting all privilege tables to MyISAM format" echo "Converting all privilege tables to MyISAM format"
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
ALTER TABLE user type=MyISAM; ALTER TABLE user type=MyISAM;
ALTER TABLE db type=MyISAM; ALTER TABLE db type=MyISAM;
ALTER TABLE host type=MyISAM; ALTER TABLE host type=MyISAM;
...@@ -28,7 +36,7 @@ echo "" ...@@ -28,7 +36,7 @@ echo ""
echo "If your tables are already up to date or partially up to date you will" echo "If your tables are already up to date or partially up to date you will"
echo "get some warnings about 'Duplicated column name'. You can safely ignore these!" echo "get some warnings about 'Duplicated column name'. You can safely ignore these!"
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
alter table user change password password char(16) NOT NULL; alter table user change password password char(16) NOT NULL;
alter table user add File_priv enum('N','Y') NOT NULL; alter table user add File_priv enum('N','Y') NOT NULL;
CREATE TABLE if not exists func ( CREATE TABLE if not exists func (
...@@ -45,7 +53,7 @@ echo "" ...@@ -45,7 +53,7 @@ echo ""
echo "Creating Grant Alter and Index privileges if they don't exists" echo "Creating Grant Alter and Index privileges if they don't exists"
echo "You can ignore any Duplicate column errors" echo "You can ignore any Duplicate column errors"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
alter table user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; alter table user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
alter table host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; alter table host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
alter table db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; alter table db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
...@@ -59,7 +67,7 @@ echo "" ...@@ -59,7 +67,7 @@ echo ""
if test $res = 0 if test $res = 0
then then
echo "Setting default privileges for the new grant, index and alter privileges" echo "Setting default privileges for the new grant, index and alter privileges"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv; UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv; UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv; UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv;
...@@ -72,7 +80,7 @@ fi ...@@ -72,7 +80,7 @@ fi
echo "Adding columns needed by GRANT .. REQUIRE (openssl)" echo "Adding columns needed by GRANT .. REQUIRE (openssl)"
echo "You can ignore any Duplicate column errors" echo "You can ignore any Duplicate column errors"
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
ALTER TABLE user ALTER TABLE user
ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL,
ADD ssl_cipher BLOB NOT NULL, ADD ssl_cipher BLOB NOT NULL,
...@@ -88,7 +96,7 @@ echo "" ...@@ -88,7 +96,7 @@ echo ""
echo "Creating the new table and column privilege tables" echo "Creating the new table and column privilege tables"
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
CREATE TABLE IF NOT EXISTS tables_priv ( CREATE TABLE IF NOT EXISTS tables_priv (
Host char(60) DEFAULT '' NOT NULL, Host char(60) DEFAULT '' NOT NULL,
Db char(60) DEFAULT '' NOT NULL, Db char(60) DEFAULT '' NOT NULL,
...@@ -119,7 +127,7 @@ END_OF_DATA ...@@ -119,7 +127,7 @@ END_OF_DATA
echo "Changing name of columns_priv.Type -> columns_priv.Column_priv" echo "Changing name of columns_priv.Type -> columns_priv.Column_priv"
echo "You can ignore any Unknown column errors from this" echo "You can ignore any Unknown column errors from this"
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL; ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;
END_OF_DATA END_OF_DATA
echo "" echo ""
...@@ -131,7 +139,7 @@ echo "" ...@@ -131,7 +139,7 @@ echo ""
echo "Fixing the func table" echo "Fixing the func table"
echo "You can ignore any Duplicate column errors" echo "You can ignore any Duplicate column errors"
@bindir@/mysql --user=root --password=$root_password mysql <<EOF $cmd <<EOF
alter table func add type enum ('function','aggregate') NOT NULL; alter table func add type enum ('function','aggregate') NOT NULL;
EOF EOF
echo "" echo ""
...@@ -143,7 +151,7 @@ echo "" ...@@ -143,7 +151,7 @@ echo ""
echo "Adding new fields used by MySQL 4.0.2 to the privilege tables" echo "Adding new fields used by MySQL 4.0.2 to the privilege tables"
echo "You can ignore any Duplicate column errors" echo "You can ignore any Duplicate column errors"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
alter table user alter table user
add Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv, add Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER alter_priv,
add Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv, add Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv,
...@@ -159,7 +167,7 @@ then ...@@ -159,7 +167,7 @@ then
# Convert privileges so that users have similar privileges as before # Convert privileges so that users have similar privileges as before
echo "" echo ""
echo "Updating new privileges in MySQL 4.0.2 from old ones" echo "Updating new privileges in MySQL 4.0.2 from old ones"
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>""; update user set show_db_priv= select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>"";
END_OF_DATA END_OF_DATA
echo "" echo ""
...@@ -168,7 +176,7 @@ fi ...@@ -168,7 +176,7 @@ fi
# Add fields that can be used to limit number of questions and connections # Add fields that can be used to limit number of questions and connections
# for some users. # for some users.
@bindir@/mysql -f --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
alter table user alter table user
add max_questions int(11) NOT NULL AFTER x509_subject, add max_questions int(11) NOT NULL AFTER x509_subject,
add max_updates int(11) unsigned NOT NULL AFTER max_questions, add max_updates int(11) unsigned NOT NULL AFTER max_questions,
...@@ -188,7 +196,7 @@ END_OF_DATA ...@@ -188,7 +196,7 @@ END_OF_DATA
# Add Create_tmp_table_priv and Lock_tables_priv to db and host # Add Create_tmp_table_priv and Lock_tables_priv to db and host
# #
@bindir@/mysql --user=root --password="$root_password" --host="$host" mysql <<END_OF_DATA $cmd <<END_OF_DATA
alter table db alter table db
add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, add Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; add Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
......
...@@ -13,7 +13,7 @@ BEGIN { ...@@ -13,7 +13,7 @@ BEGIN {
$script = $1; $script = $1;
$script = 'MySQLAccess' unless $script; $script = 'MySQLAccess' unless $script;
$script_conf = "$script.conf"; $script_conf = "$script.conf";
$script_log = "~/$script.log"; $script_log = $ENV{'HOME'}."/$script.log";
# **************************** # ****************************
# information on MySQL # information on MySQL
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
trap '' 1 2 3 15 # we shouldn't let anyone kill us trap '' 1 2 3 15 # we shouldn't let anyone kill us
umask 007
defaults= defaults=
case "$1" in case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*) --no-defaults|--defaults-file=*|--defaults-extra-file=*)
......
...@@ -118,6 +118,15 @@ set_field_to_null(Field *field) ...@@ -118,6 +118,15 @@ set_field_to_null(Field *field)
field->reset(); field->reset();
return 0; return 0;
} }
field->reset();
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 1;
} }
......
This diff is collapsed.
...@@ -241,7 +241,7 @@ void ha_myisammrg::info(uint flag) ...@@ -241,7 +241,7 @@ void ha_myisammrg::info(uint flag)
#endif #endif
if (flag & HA_STATUS_CONST) if (flag & HA_STATUS_CONST)
{ {
if (table->key_parts) if (table->key_parts && info.rec_per_key)
memcpy((char*) table->key_info[0].rec_per_key, memcpy((char*) table->key_info[0].rec_per_key,
(char*) info.rec_per_key, (char*) info.rec_per_key,
sizeof(table->key_info[0].rec_per_key)*table->key_parts); sizeof(table->key_info[0].rec_per_key)*table->key_parts);
......
...@@ -1898,7 +1898,7 @@ Item_func_regex::~Item_func_regex() ...@@ -1898,7 +1898,7 @@ Item_func_regex::~Item_func_regex()
Precomputation dependent only on pattern_len. Precomputation dependent only on pattern_len.
**********************************************************************/ **********************************************************************/
void Item_func_like::turboBM_compute_suffixes(int* suff) void Item_func_like::turboBM_compute_suffixes(int *suff)
{ {
const int plm1 = pattern_len - 1; const int plm1 = pattern_len - 1;
int f = 0; int f = 0;
...@@ -1940,8 +1940,8 @@ void Item_func_like::turboBM_compute_suffixes(int* suff) ...@@ -1940,8 +1940,8 @@ void Item_func_like::turboBM_compute_suffixes(int* suff)
if (i < g) if (i < g)
g = i; // g = min(i, g) g = i; // g = min(i, g)
f = i; f = i;
while (g >= 0 && likeconv(cs, pattern[g]) == while (g >= 0 &&
likeconv(cs, pattern[g + plm1 - f])) likeconv(cs, pattern[g]) == likeconv(cs, pattern[g + plm1 - f]))
g--; g--;
suff[i] = f - g; suff[i] = f - g;
} }
...@@ -1955,12 +1955,12 @@ void Item_func_like::turboBM_compute_suffixes(int* suff) ...@@ -1955,12 +1955,12 @@ void Item_func_like::turboBM_compute_suffixes(int* suff)
Precomputation dependent only on pattern_len. Precomputation dependent only on pattern_len.
**********************************************************************/ **********************************************************************/
void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) void Item_func_like::turboBM_compute_good_suffix_shifts(int *suff)
{ {
turboBM_compute_suffixes(suff); turboBM_compute_suffixes(suff);
int* end = bmGs + pattern_len; int *end = bmGs + pattern_len;
int* k; int *k;
for (k = bmGs; k < end; k++) for (k = bmGs; k < end; k++)
*k = pattern_len; *k = pattern_len;
...@@ -1974,14 +1974,14 @@ void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) ...@@ -1974,14 +1974,14 @@ void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff)
{ {
for (tmp = plm1 - i; j < tmp; j++) for (tmp = plm1 - i; j < tmp; j++)
{ {
int* tmp2 = bmGs + j; int *tmp2 = bmGs + j;
if (*tmp2 == pattern_len) if (*tmp2 == pattern_len)
*tmp2 = tmp; *tmp2 = tmp;
} }
} }
} }
int* tmp2; int *tmp2;
for (tmp = plm1 - i; j < tmp; j++) for (tmp = plm1 - i; j < tmp; j++)
{ {
tmp2 = bmGs + j; tmp2 = bmGs + j;
...@@ -2014,12 +2014,12 @@ void Item_func_like::turboBM_compute_bad_character_shifts() ...@@ -2014,12 +2014,12 @@ void Item_func_like::turboBM_compute_bad_character_shifts()
if (binary()) if (binary())
{ {
for (j = 0; j < plm1; j++) for (j = 0; j < plm1; j++)
bmBc[pattern[j]] = plm1 - j; bmBc[(uint) (uchar) pattern[j]] = plm1 - j;
} }
else else
{ {
for (j = 0; j < plm1; j++) for (j = 0; j < plm1; j++)
bmBc[likeconv(cs,pattern[j])] = plm1 - j; bmBc[(uint) likeconv(cs,pattern[j])] = plm1 - j;
} }
} }
...@@ -2038,27 +2038,27 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const ...@@ -2038,27 +2038,27 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
int u = 0; int u = 0;
CHARSET_INFO *cs=system_charset_info; // QQ Needs to be fixed CHARSET_INFO *cs=system_charset_info; // QQ Needs to be fixed
const int plm1 = pattern_len - 1; const int plm1= pattern_len - 1;
const int tlmpl = text_len - pattern_len; const int tlmpl= text_len - pattern_len;
/* Searching */ /* Searching */
if (binary()) if (binary())
{ {
while (j <= tlmpl) while (j <= tlmpl)
{ {
register int i = plm1; register int i= plm1;
while (i >= 0 && pattern[i] == text[i + j]) while (i >= 0 && pattern[i] == text[i + j])
{ {
i--; i--;
if (i == plm1 - shift) if (i == plm1 - shift)
i -= u; i-= u;
} }
if (i < 0) if (i < 0)
return 1; return 1;
register const int v = plm1 - i; register const int v = plm1 - i;
turboShift = u - v; turboShift = u - v;
bcShift = bmBc[text[i + j]] - plm1 + i; bcShift = bmBc[(uint) (uchar) text[i + j]] - plm1 + i;
shift = max(turboShift, bcShift); shift = max(turboShift, bcShift);
shift = max(shift, bmGs[i]); shift = max(shift, bmGs[i]);
if (shift == bmGs[i]) if (shift == bmGs[i])
...@@ -2069,7 +2069,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const ...@@ -2069,7 +2069,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
shift = max(shift, u + 1); shift = max(shift, u + 1);
u = 0; u = 0;
} }
j += shift; j+= shift;
} }
return 0; return 0;
} }
...@@ -2082,14 +2082,14 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const ...@@ -2082,14 +2082,14 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
{ {
i--; i--;
if (i == plm1 - shift) if (i == plm1 - shift)
i -= u; i-= u;
} }
if (i < 0) if (i < 0)
return 1; return 1;
register const int v = plm1 - i; register const int v = plm1 - i;
turboShift = u - v; turboShift = u - v;
bcShift = bmBc[likeconv(cs, text[i + j])] - plm1 + i; bcShift = bmBc[(uint) likeconv(cs, text[i + j])] - plm1 + i;
shift = max(turboShift, bcShift); shift = max(turboShift, bcShift);
shift = max(shift, bmGs[i]); shift = max(shift, bmGs[i]);
if (shift == bmGs[i]) if (shift == bmGs[i])
...@@ -2100,7 +2100,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const ...@@ -2100,7 +2100,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
shift = max(shift, u + 1); shift = max(shift, u + 1);
u = 0; u = 0;
} }
j += shift; j+= shift;
} }
return 0; return 0;
} }
......
...@@ -1331,8 +1331,8 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, ...@@ -1331,8 +1331,8 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
bool old_format) bool old_format)
{ {
uint data_len; uint data_len;
uint header_len= old_format ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
char* buf_end = (char*)buf + event_len; char* buf_end = (char*)buf + event_len;
uint header_len= old_format ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
const char* data_head = buf + header_len; const char* data_head = buf + header_len;
thread_id = uint4korr(data_head + L_THREAD_ID_OFFSET); thread_id = uint4korr(data_head + L_THREAD_ID_OFFSET);
exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET); exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET);
......
...@@ -770,7 +770,7 @@ static void *kill_server(void *sig_ptr) ...@@ -770,7 +770,7 @@ static void *kill_server(void *sig_ptr)
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0) #define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
#else #else
static void __cdecl kill_server(int sig_ptr) static void __cdecl kill_server(int sig_ptr)
#define RETURN_FROM_KILL_SERVER DBUG_RETURN #define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
#endif #endif
{ {
int sig=(int) (long) sig_ptr; // This is passed a int int sig=(int) (long) sig_ptr; // This is passed a int
......
...@@ -165,10 +165,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) ...@@ -165,10 +165,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
error=table->file->index_last(table->record[0]) !=0; error=table->file->index_last(table->record[0]) !=0;
else else
{ {
(void)table->file->index_read(table->record[0], key_buff, error = table->file->index_read(table->record[0], key_buff,
ref.key_length, ref.key_length,
HA_READ_AFTER_KEY); HA_READ_PREFIX_LAST) ||
error=table->file->index_prev(table->record[0]) ||
key_cmp(table,key_buff,ref.key,ref.key_length); key_cmp(table,key_buff,ref.key,ref.key_length);
} }
if (table->key_read) if (table->key_read)
......
...@@ -283,6 +283,20 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ...@@ -283,6 +283,20 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{ {
if (lf_info.wrote_create_file) if (lf_info.wrote_create_file)
{ {
/*
Make sure last block (the one which caused the error) gets logged.
This is needed because otherwise after write of
(to the binlog, not to read_info (which is a cache))
Delete_file_log_event the bad block will remain in read_info.
At the end of mysql_load(), the destructor of read_info will call
end_io_cache() which will flush read_info, so we will finally have
this in the binlog:
Append_block # The last successfull block
Delete_file
Append_block # The failing block
which is nonsense.
*/
read_info.end_io_cache();
Delete_file_log_event d(thd, log_delayed); Delete_file_log_event d(thd, log_delayed);
mysql_bin_log.write(&d); mysql_bin_log.write(&d);
} }
...@@ -343,8 +357,10 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, ...@@ -343,8 +357,10 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
{ {
List_iterator_fast<Item> it(fields); List_iterator_fast<Item> it(fields);
Item_field *sql_field; Item_field *sql_field;
ulonglong id;
DBUG_ENTER("read_fixed_length"); DBUG_ENTER("read_fixed_length");
id=0;
/* No fields can be null in this format. mark all fields as not null */ /* No fields can be null in this format. mark all fields as not null */
while ((sql_field= (Item_field*) it++)) while ((sql_field= (Item_field*) it++))
sql_field->field->set_notnull(); sql_field->field->set_notnull();
...@@ -387,6 +403,14 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, ...@@ -387,6 +403,14 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
thd->cuted_fields++; /* To long row */ thd->cuted_fields++; /* To long row */
if (write_record(table,&info)) if (write_record(table,&info))
DBUG_RETURN(1); DBUG_RETURN(1);
/*
If auto_increment values are used, save the first one
for LAST_INSERT_ID() and for the binary/update log.
We can't use insert_id() as we don't want to touch the
last_insert_id_used flag.
*/
if (!id && thd->insert_id_used)
id= thd->last_insert_id;
if (table->next_number_field) if (table->next_number_field)
table->next_number_field->reset(); // Clear for next record table->next_number_field->reset(); // Clear for next record
if (read_info.next_line()) // Skip to next line if (read_info.next_line()) // Skip to next line
...@@ -394,6 +418,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields, ...@@ -394,6 +418,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
if (read_info.line_cuted) if (read_info.line_cuted)
thd->cuted_fields++; /* To long row */ thd->cuted_fields++; /* To long row */
} }
if (id && !read_info.error)
thd->insert_id(id); // For binary/update log
DBUG_RETURN(test(read_info.error)); DBUG_RETURN(test(read_info.error));
} }
...@@ -407,9 +433,11 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, ...@@ -407,9 +433,11 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
List_iterator_fast<Item> it(fields); List_iterator_fast<Item> it(fields);
Item_field *sql_field; Item_field *sql_field;
uint enclosed_length; uint enclosed_length;
ulonglong id;
DBUG_ENTER("read_sep_field"); DBUG_ENTER("read_sep_field");
enclosed_length=enclosed.length(); enclosed_length=enclosed.length();
id=0;
for (;;it.rewind()) for (;;it.rewind())
{ {
...@@ -463,6 +491,14 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, ...@@ -463,6 +491,14 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
} }
if (write_record(table,&info)) if (write_record(table,&info))
DBUG_RETURN(1); DBUG_RETURN(1);
/*
If auto_increment values are used, save the first one
for LAST_INSERT_ID() and for the binary/update log.
We can't use insert_id() as we don't want to touch the
last_insert_id_used flag.
*/
if (!id && thd->insert_id_used)
id= thd->last_insert_id;
if (table->next_number_field) if (table->next_number_field)
table->next_number_field->reset(); // Clear for next record table->next_number_field->reset(); // Clear for next record
if (read_info.next_line()) // Skip to next line if (read_info.next_line()) // Skip to next line
...@@ -470,6 +506,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table, ...@@ -470,6 +506,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
if (read_info.line_cuted) if (read_info.line_cuted)
thd->cuted_fields++; /* To long row */ thd->cuted_fields++; /* To long row */
} }
if (id && !read_info.error)
thd->insert_id(id); // For binary/update log
DBUG_RETURN(test(read_info.error)); DBUG_RETURN(test(read_info.error));
} }
......
...@@ -2031,11 +2031,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -2031,11 +2031,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (error) if (error)
{ {
/* /*
* The following function call will also free a The following function call will free the new_table pointer,
* new_table pointer. in close_temporary_table(), so we can safely directly jump to err
* Therefore, here new_table pointer is not free'd as it is
* free'd in close_temporary() which is called by by the
* close_temporary_table() function.
*/ */
close_temporary_table(thd,new_db,tmp_name); close_temporary_table(thd,new_db,tmp_name);
goto err; goto err;
......
...@@ -40,6 +40,7 @@ endif ...@@ -40,6 +40,7 @@ endif
libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src noinst_PROGRAMS = conf_to_src
DISTCLEANFILES = ctype_autoconf.c
# Default charset definitions # Default charset definitions
EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \
ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment