1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with 4.0.9

BitKeeper/etc/ignore:
  auto-union
client/mysqltest.c:
  Auto merged
configure.in:
  Auto merged
BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137:
  Auto merged
BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1:
  Auto merged
innobase/btr/btr0cur.c:
  Auto merged
innobase/btr/btr0pcur.c:
  Auto merged
innobase/log/log0log.c:
  Auto merged
innobase/srv/srv0srv.c:
  Auto merged
innobase/trx/trx0trx.c:
  Auto merged
myisam/mi_create.c:
  Auto merged
myisam/mi_unique.c:
  Auto merged
myisam/myisamchk.c:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/merge.result:
  Auto merged
mysql-test/r/null.result:
  Auto merged
mysql-test/t/group_by.test:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
mysql-test/t/null.test:
  Auto merged
scripts/mysql_fix_privilege_tables.sh:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/opt_sum.cc:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
strings/Makefile.am:
  Auto merged
libmysql/Makefile.shared:
  merge
libmysql/libmysql.def:
  merge
sql/ha_innodb.cc:
  merge
sql/item_cmpfunc.cc:
  merge
sql/log_event.cc:
  merge
sql/sql_handler.cc:
  merge
This commit is contained in:
unknown
2003-01-18 03:13:37 +02:00
59 changed files with 550 additions and 154 deletions

View File

@ -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
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
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
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

View File

@ -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

View File

@ -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

View File

@ -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)
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)),
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;
} }

View File

@ -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
/* ) 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"

View File

@ -1,9 +1,26 @@
#include <sys/types.h> /* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Wait until a program dies */
#include <my_global.h>
#include <m_string.h>
#include <my_getopt.h>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include <my_global.h>
#include <my_getopt.h>
static const char *VER= "1.1"; static const char *VER= "1.1";
static char *progname; static char *progname;

View File

@ -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 ??? */

View File

@ -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

View File

@ -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(
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(
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));

View File

@ -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
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 */

View File

@ -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

View File

@ -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 */

View File

@ -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(
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;

View File

@ -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! */

View File

@ -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(
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:
/* 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--;

View File

@ -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(
#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(
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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
.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.

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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.

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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

View File

@ -1,4 +1,4 @@
.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.
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

View File

@ -1,4 +1,4 @@
.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)

View File

@ -1,4 +1,4 @@
.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.

View File

@ -1,4 +1,4 @@
.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.

View File

@ -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++)

View File

@ -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,7 +80,16 @@ 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)

View File

@ -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)
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,...)
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;

View File

@ -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=*)

View File

@ -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;

View File

@ -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);
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

View File

@ -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;

View File

@ -0,0 +1,13 @@
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;

View File

@ -0,0 +1,2 @@
\N 10
\N 15

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,16 @@
# 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;

View File

@ -0,0 +1 @@
--skip-external-locking

View File

@ -1,19 +1,27 @@
#!/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 ""
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 ""
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 ""
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
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 ""
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
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 ""
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 ""
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
# 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
# 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
# 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;

View File

@ -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

View File

@ -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=*)

View File

@ -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;
} }

View File

@ -2272,19 +2272,7 @@ convert_search_mode_to_innobase(
case HA_READ_AFTER_KEY: return(PAGE_CUR_G); case HA_READ_AFTER_KEY: return(PAGE_CUR_G);
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L); case HA_READ_BEFORE_KEY: return(PAGE_CUR_L);
case HA_READ_PREFIX: return(PAGE_CUR_GE); case HA_READ_PREFIX: return(PAGE_CUR_GE);
case HA_READ_PREFIX_LAST: case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE_OR_EXTENDS);
/* ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: Using HA_READ_PREFIX_LAST\n"); */
return(PAGE_CUR_LE);
/* InnoDB does not yet support ..PREFIX_LAST!
We have to add a new search flag
PAGE_CUR_LE_OR_PREFIX to 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 */
default: assert(0); default: assert(0);
} }
@ -2489,6 +2477,9 @@ ha_innobase::change_active_index(
(trx_t*) current_thd->transaction.all.innobase_tid); (trx_t*) current_thd->transaction.all.innobase_tid);
ut_a(user_thd == current_thd); ut_a(user_thd == current_thd);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
active_index = keynr; active_index = keynr;
if (keynr != MAX_KEY && table->keys > 0) { if (keynr != MAX_KEY && table->keys > 0) {
@ -2520,6 +2511,11 @@ ha_innobase::change_active_index(
the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary
copying. Starting from MySQL-4.1 we use a more efficient flag here. */ copying. Starting from MySQL-4.1 we use a more efficient flag here. */
/*
TODO: In 4.0 the below user_thd was changed to NULL.
Heikki, please delete this comment after you have read this and may
acted upon it.
*/
build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS); build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS);
DBUG_RETURN(0); DBUG_RETURN(0);
@ -3025,6 +3021,7 @@ ha_innobase::create(
{ {
int error; int error;
dict_table_t* innobase_table; dict_table_t* innobase_table;
trx_t* parent_trx;
trx_t* trx; trx_t* trx;
int primary_key_no; int primary_key_no;
uint i; uint i;
@ -3036,6 +3033,16 @@ ha_innobase::create(
DBUG_ASSERT(thd != NULL); DBUG_ASSERT(thd != NULL);
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx);
trx = trx_allocate_for_mysql(); trx = trx_allocate_for_mysql();
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) { if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
@ -3196,11 +3203,22 @@ ha_innobase::delete_table(
{ {
ulint name_len; ulint name_len;
int error; int error;
trx_t* parent_trx;
trx_t* trx; trx_t* trx;
char norm_name[1000]; char norm_name[1000];
DBUG_ENTER("ha_innobase::delete_table"); DBUG_ENTER("ha_innobase::delete_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx);
if (lower_case_table_names) { if (lower_case_table_names) {
srv_lower_case_table_names = TRUE; srv_lower_case_table_names = TRUE;
} else { } else {
@ -3255,11 +3273,22 @@ innobase_drop_database(
the database name is 'test' */ the database name is 'test' */
{ {
ulint len = 0; ulint len = 0;
trx_t* parent_trx;
trx_t* trx; trx_t* trx;
char* ptr; char* ptr;
int error; int error;
char namebuf[10000]; char namebuf[10000];
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx);
ptr = strend(path) - 2; ptr = strend(path) - 2;
while (ptr >= path && *ptr != '\\' && *ptr != '/') { while (ptr >= path && *ptr != '\\' && *ptr != '/') {
@ -3311,12 +3340,23 @@ ha_innobase::rename_table(
ulint name_len1; ulint name_len1;
ulint name_len2; ulint name_len2;
int error; int error;
trx_t* parent_trx;
trx_t* trx; trx_t* trx;
char norm_from[1000]; char norm_from[1000];
char norm_to[1000]; char norm_to[1000];
DBUG_ENTER("ha_innobase::rename_table"); DBUG_ENTER("ha_innobase::rename_table");
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(parent_trx);
if (lower_case_table_names) { if (lower_case_table_names) {
srv_lower_case_table_names = TRUE; srv_lower_case_table_names = TRUE;
} else { } else {
@ -3363,8 +3403,8 @@ Estimates the number of index records in a range. */
ha_rows ha_rows
ha_innobase::records_in_range( ha_innobase::records_in_range(
/*==========================*/ /*==========================*/
/* out: estimated number of rows, /* out: estimated number of
currently 32-bit int or uint */ rows */
int keynr, /* in: index number */ int keynr, /* in: index number */
const mysql_byte* start_key, /* in: start key value of the const mysql_byte* start_key, /* in: start key value of the
range, may also be empty */ range, may also be empty */
@ -3395,9 +3435,18 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range"); DBUG_ENTER("records_in_range");
/* Warning: since it is not sure that MySQL calls external_lock /* We do not know if MySQL can call this function before calling
before calling this function, the trx field in prebuilt can be external_lock(). To be safe, update the thd of the current table
obsolete! */ handle. */
update_thd(current_thd);
prebuilt->trx->op_info = (char*)"estimating records in index range";
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(prebuilt->trx);
active_index = keynr; active_index = keynr;
@ -3431,6 +3480,8 @@ ha_innobase::records_in_range(
my_free((char*) key_val_buff2, MYF(0)); my_free((char*) key_val_buff2, MYF(0));
prebuilt->trx->op_info = (char*)"";
DBUG_RETURN((ha_rows) n_rows); DBUG_RETURN((ha_rows) n_rows);
} }
@ -3451,11 +3502,21 @@ ha_innobase::estimate_number_of_rows(void)
ulonglong estimate; ulonglong estimate;
ulonglong local_data_file_length; ulonglong local_data_file_length;
/* Warning: since it is not sure that MySQL calls external_lock DBUG_ENTER("estimate_number_of_rows");
before calling this function, the trx field in prebuilt can be
obsolete! */
DBUG_ENTER("info"); /* We do not know if MySQL can call this function before calling
external_lock(). To be safe, update the thd of the current table
handle. */
update_thd(current_thd);
prebuilt->trx->op_info = (char*)
"calculating upper bound for table rows";
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(prebuilt->trx);
index = dict_table_get_first_index_noninline(prebuilt->table); index = dict_table_get_first_index_noninline(prebuilt->table);
@ -3470,6 +3531,8 @@ ha_innobase::estimate_number_of_rows(void)
estimate = 2 * local_data_file_length / dict_index_calc_min_rec_len(index); estimate = 2 * local_data_file_length / dict_index_calc_min_rec_len(index);
prebuilt->trx->op_info = (char*)"";
DBUG_RETURN((ha_rows) estimate); DBUG_RETURN((ha_rows) estimate);
} }
@ -3520,9 +3583,18 @@ ha_innobase::info(
return; return;
} }
/* Warning: since it is not sure that MySQL calls external_lock /* We do not know if MySQL can call this function before calling
before calling this function, the trx field in prebuilt can be external_lock(). To be safe, update the thd of the current table
obsolete! */ handle. */
update_thd(current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
prebuilt->trx->op_info = (char*)"returning various info to MySQL";
trx_search_latch_release_if_reserved(prebuilt->trx);
ib_table = prebuilt->table; ib_table = prebuilt->table;
@ -3530,7 +3602,12 @@ ha_innobase::info(
/* In sql_show we call with this flag: update then statistics /* In sql_show we call with this flag: update then statistics
so that they are up-to-date */ so that they are up-to-date */
prebuilt->trx->op_info = (char*)"updating table statistics";
dict_update_statistics(ib_table); dict_update_statistics(ib_table);
prebuilt->trx->op_info = (char*)
"returning various info to MySQL";
} }
if (flag & HA_STATUS_VARIABLE) { if (flag & HA_STATUS_VARIABLE) {
@ -3590,12 +3667,6 @@ ha_innobase::info(
} }
} }
/* The trx struct in InnoDB contains a pthread mutex embedded:
in the debug version of MySQL that it replaced by a 'safe mutex'
which is of a different size. We have to use a function to access
trx fields. Otherwise trx->error_info will be a random
pointer and cause a seg fault. */
if (flag & HA_STATUS_ERRKEY) { if (flag & HA_STATUS_ERRKEY) {
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
@ -3604,6 +3675,8 @@ ha_innobase::info(
trx_get_error_info(prebuilt->trx)); trx_get_error_info(prebuilt->trx));
} }
prebuilt->trx->op_info = (char*)"";
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -3661,11 +3734,22 @@ ha_innobase::update_table_comment(
char* str = my_malloc(length + 16500, MYF(0)); char* str = my_malloc(length + 16500, MYF(0));
char* pos; char* pos;
/* Warning: since it is not sure that MySQL calls external_lock /* We do not know if MySQL can call this function before calling
before calling this function, the trx field in prebuilt can be external_lock(). To be safe, update the thd of the current table
obsolete! */ handle. */
update_thd(current_thd);
prebuilt->trx->op_info = (char*)"returning table comment";
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(prebuilt->trx);
if (!str) { if (!str) {
prebuilt->trx->op_info = (char*)"";
return((char*)comment); return((char*)comment);
} }
@ -3689,6 +3773,8 @@ ha_innobase::update_table_comment(
prebuilt->table); prebuilt->table);
} }
prebuilt->trx->op_info = (char*)"";
return(str); return(str);
} }
@ -3705,12 +3791,20 @@ ha_innobase::get_foreign_key_create_info(void)
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt; row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
char* str; char* str;
if (prebuilt == NULL) { ut_a(prebuilt != NULL);
fprintf(stderr,
"InnoDB: Error: cannot get create info for foreign keys\n");
return(NULL); /* We do not know if MySQL can call this function before calling
} external_lock(). To be safe, update the thd of the current table
handle. */
update_thd(current_thd);
prebuilt->trx->op_info = (char*)"getting info on foreign keys";
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
trx_search_latch_release_if_reserved(prebuilt->trx);
str = (char*)ut_malloc(10000); str = (char*)ut_malloc(10000);
@ -3718,6 +3812,8 @@ ha_innobase::get_foreign_key_create_info(void)
dict_print_info_on_foreign_keys(TRUE, str, 9000, prebuilt->table); dict_print_info_on_foreign_keys(TRUE, str, 9000, prebuilt->table);
prebuilt->trx->op_info = (char*)"";
return(str); return(str);
} }
@ -3793,9 +3889,10 @@ ha_innobase::reset(void)
} }
/********************************************************************** /**********************************************************************
When we create a temporary table inside MySQL LOCK TABLES, MySQL will Inside LOCK TABLES MySQL will not call external_lock() between SQL
not call external_lock for the temporary table when it uses it. Instead, statements. It will call this function at the start of each SQL statement.
it will call this function. */ Note also a spacial case: if a temporary table is created inside LOCK
TABLES, MySQL has not called external_lock() at all on that table. */
int int
ha_innobase::start_stmt( ha_innobase::start_stmt(
@ -3933,8 +4030,8 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0; trx->mysql_n_tables_locked = 0;
/* Here we release the search latch, auto_inc_lock, /* Here we release the search latch and InnoDB
and InnoDB thread FIFO ticket if they were reserved. */ thread FIFO ticket if they were reserved. */
innobase_release_stat_resources(trx); innobase_release_stat_resources(trx);
@ -3978,12 +4075,12 @@ innodb_show_status(
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/* We let the InnoDB Monitor to output at most 100 kB of text, add /* We let the InnoDB Monitor to output at most 200 kB of text, add
a safety margin of 10 kB for buffer overruns */ a safety margin of 10 kB for buffer overruns */
buf = (char*)ut_malloc(110 * 1024); buf = (char*)ut_malloc(210 * 1024);
srv_sprintf_innodb_monitor(buf, 100 * 1024); srv_sprintf_innodb_monitor(buf, 200 * 1024);
List<Item> field_list; List<Item> field_list;
@ -3991,6 +4088,7 @@ innodb_show_status(
if (protocol->send_fields(&field_list, 1)) if (protocol->send_fields(&field_list, 1))
{ {
ut_free(buf);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }

View File

@ -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);

View File

@ -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)
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)
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)
{ {
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()
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
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
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
{ {
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
shift = max(shift, u + 1); shift = max(shift, u + 1);
u = 0; u = 0;
} }
j += shift; j+= shift;
} }
return 0; return 0;
} }

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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,
{ {
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,
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,
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,
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,
} }
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,
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));
} }

View File

@ -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;

View File

@ -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 \