Commit 7ff42f82 authored by monty@tik.mysql.fi's avatar monty@tik.mysql.fi

Merge

parents bbfd15f4 bf9876a1
...@@ -19854,6 +19854,28 @@ still get strange errors from a table when @strong{MySQL} tries to ...@@ -19854,6 +19854,28 @@ still get strange errors from a table when @strong{MySQL} tries to
update a row or find a row by key (this is VERY unlikely to happen if a update a row or find a row by key (this is VERY unlikely to happen if a
normal check has succeeded!). normal check has succeeded!).
Some things reported by check table, can't be corrected automaticly:
@itemize @bullet
@item
@code{Found row where the auto_increment column has the value 0}.
This means that you have in the table a row where the
@code{auto_increment} index column contains the value 0.
(It's possible to create a row where the auto_increment column is 0 by
explicitely setting the column to 0 with an @code{UPDATE} statement)
This isn't an error in itself, but could cause trouble if you decide to
dump the table and restore it or do an @code{ALTER TABLE} on the
table. In this case the auto_increment column will change value,
according to the rules of auto_increment columns, which could cause
problems like a duplicate key error.
To get rid of the warning, just execute an @code{UPDATE} statement
to set the column to some other value than 0.
@end itemize
@findex BACKUP TABLE @findex BACKUP TABLE
@node BACKUP TABLE, RESTORE TABLE, CHECK TABLE, Reference @node BACKUP TABLE, RESTORE TABLE, CHECK TABLE, Reference
@section @code{BACKUP TABLE} Syntax @section @code{BACKUP TABLE} Syntax
...@@ -21453,7 +21475,8 @@ If you have specified the update log file or a binary log file without ...@@ -21453,7 +21475,8 @@ If you have specified the update log file or a binary log file without
an extension, the extension number of the log file will be incremented an extension, the extension number of the log file will be incremented
by one relative to the previous file. If you have used an extension in by one relative to the previous file. If you have used an extension in
the file name, @strong{MySQL} will close and reopen the update log file. the file name, @strong{MySQL} will close and reopen the update log file.
@xref{Update log}. @xref{Update log}. This is the same thing as sending the @code{SIGHUP}
signal to the @code{mysqld} server.
@item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in @item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in
the @code{mysql} database. the @code{mysql} database.
...@@ -21464,13 +21487,16 @@ the @code{mysql} database. ...@@ -21464,13 +21487,16 @@ the @code{mysql} database.
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convenient way to get backups if you have a file system, like Veritas,that can take snapshots in time. @item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. This is very convenient way to get backups if you have a file system, like Veritas,that can take snapshots in time.
@item @code{STATUS} @tab Resets most status variables to zero. @item @code{STATUS} @tab Resets most status variables to zero. This is something one should only use when debugging a query.
@end multitable @end multitable
You can also access each of the commands shown above with the @code{mysqladmin} You can also access each of the commands shown above with the @code{mysqladmin}
utility, using the @code{flush-hosts}, @code{flush-logs}, @code{reload}, utility, using the @code{flush-hosts}, @code{flush-logs}, @code{reload},
or @code{flush-tables} commands. or @code{flush-tables} commands.
Take also a look at the @code{RESET} command used with
replication. @xref{Replication SQL}.
@cindex @code{mysqladmin} @cindex @code{mysqladmin}
@findex KILL @findex KILL
@node KILL, SHOW, FLUSH, Reference @node KILL, SHOW, FLUSH, Reference
...@@ -29252,14 +29278,14 @@ The following table has the options you can use for the @strong{MASTER}: ...@@ -29252,14 +29278,14 @@ The following table has the options you can use for the @strong{MASTER}:
@item @strong{Option} @tab @strong{Description} @item @strong{Option} @tab @strong{Description}
@item @code{log-bin=filename} @tab @item @code{log-bin=filename} @tab
Write to a binary update log to the specified location. Note that if you Write to a binary update log to the specified location. Note that if you
give it a parameter with an extension give it a parameter with an extension (for example,
(for example, @code{log-bin=/mysql/logs/replication.log} ) versions up to 3.23.24 @code{log-bin=/mysql/logs/replication.log} ) versions up to 3.23.24 will
will not work right during replication if you do @code{FLUSH LOGS} . The not work right during replication if you do @code{FLUSH LOGS} . The
problem is fixed in Version 3.23.25. If you are using this kind of log name, problem is fixed in Version 3.23.25. If you are using this kind of log
@code{FLUSH LOGS} will be ignored on binlog. To clear the log, run name, @code{FLUSH LOGS} will be ignored on binlog. To clear the log, run
@code{FLUSH MASTER}, and do not forget to run @code{FLUSH SLAVE} on all @code{FLUSH MASTER}, and do not forget to run @code{FLUSH SLAVE} on all
slaves. In Version 3.23.26 and in later versions you should use @code{RESET MASTER} slaves. In Version 3.23.26 and in later versions you should use
and @code{RESET SLAVE} @code{RESET MASTER} and @code{RESET SLAVE}
@item @code{log-bin-index=filename} @tab @item @code{log-bin-index=filename} @tab
Because the user could issue the @code{FLUSH LOGS} command, we need to Because the user could issue the @code{FLUSH LOGS} command, we need to
...@@ -45688,6 +45714,14 @@ not yet 100% confident in this code. ...@@ -45688,6 +45714,14 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.40 @appendixsubsec Changes in release 3.23.40
@itemize @bullet @itemize @bullet
@item @item
Fixed that @code{DELETE FROM table_name ... LIMIT 0} and
@code{UPDATE FROM table_name ... LIMIT 0} doesn't delete/update anything.
@item
@code{CHECK TABLE} now checks if an auto_increment column contains the value 0.
@item
Sending a @code{SIGHUP} to @code{mysqld} will now only flush the logs,
not reset the replication.
@item
Fixed parser to allow floats of type @code{1.0e1} (no sign after @code{e}). Fixed parser to allow floats of type @code{1.0e1} (no sign after @code{e}).
@item @item
Option @code{--force} to @code{myisamchk} now also updates states. Option @code{--force} to @code{myisamchk} now also updates states.
...@@ -51131,6 +51165,9 @@ efficiently, we need to add an API to allow binding of variables. ...@@ -51131,6 +51165,9 @@ efficiently, we need to add an API to allow binding of variables.
Make it possible to specify @code{long_query_time} with a granularity Make it possible to specify @code{long_query_time} with a granularity
in microseconds. in microseconds.
@item @item
Add a configurable prompt to the @code{mysql} command line client, with
options like database in use, time and date...
@item
Add range checking to @code{MERGE} tables. Add range checking to @code{MERGE} tables.
@item @item
Link the @code{myisampack} code into the server. Link the @code{myisampack} code into the server.
...@@ -629,7 +629,10 @@ struct request_info *req; ...@@ -629,7 +629,10 @@ struct request_info *req;
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(LIBWRAP) AC_DEFINE(LIBWRAP)
AC_DEFINE(HAVE_LIBWRAP) AC_DEFINE(HAVE_LIBWRAP)
WRAPLIBS="-L$with_libwrap/lib -lwrap", if test "$with_libwrap" != "yes"; then
WRAPLIBS="-L${with_libwrap}/lib"
fi
WRAPLIBS="${WRAPLIBS} -lwrap",
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}), CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}) CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
...@@ -798,6 +801,11 @@ case $SYSTEM_TYPE in ...@@ -798,6 +801,11 @@ case $SYSTEM_TYPE in
echo "Adding fix for interrupted reads" echo "Adding fix for interrupted reads"
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000" CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
;; ;;
*netbsd*)
echo "Adding flag -Dunix"
CFLAGS="$CFLAGS -Dunix"
CXXFLAGS="$CXXFLAGS -Dunix"
;;
*bsdi*) *bsdi*)
echo "Adding fix for BSDI" echo "Adding fix for BSDI"
CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH" CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
...@@ -2043,15 +2051,15 @@ EOF ...@@ -2043,15 +2051,15 @@ EOF
AC_DEFINE(HAVE_mit_thread) AC_DEFINE(HAVE_mit_thread)
MT_INCLUDES="-I\$(top_srcdir)/mit-pthreads/include" MT_INCLUDES="-I\$(top_srcdir)/mit-pthreads/include"
AC_SUBST(MT_INCLUDES) AC_SUBST(MT_INCLUDES)
MT_LD_ADD="-L \$(top_srcdir)/mit-pthreads/obj/ -lpthread" MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
AC_SUBST(MT_LD_ADD) AC_SUBST(MT_LD_ADD)
LIBS="$MT_LD_ADD $LIBS"
echo "" echo ""
echo "Configuring MIT Pthreads" echo "Configuring MIT Pthreads"
# We will never install so installation paths are not needed. # We will never install so installation paths are not needed.
(cd mit-pthreads; sh ./configure) (cd mit-pthreads; sh ./configure)
echo "End of MIT Pthreads configuration" echo "End of MIT Pthreads configuration"
echo "" echo ""
LIBS="$MT_LD_ADD $LIBS"
fi fi
fi fi
AC_SUBST(sql_server_dirs) AC_SUBST(sql_server_dirs)
......
...@@ -177,7 +177,7 @@ time_t altzone = 0; ...@@ -177,7 +177,7 @@ time_t altzone = 0;
static int detzcode(const char * codep) static int detzcode(const char * codep)
{ {
long result; int result;
int i; int i;
result = 0; result = 0;
......
#include <sys/signal.h> #include <sys/signal.h>
__BEGIN_DECLS
#if NSIG <= 32 #if NSIG <= 32
#define __SIGEMPTYSET 0 #define __SIGEMPTYSET 0
#define __SIGFILLSET 0xffffffff #define __SIGFILLSET 0xffffffff
...@@ -8,6 +10,9 @@ ...@@ -8,6 +10,9 @@
#define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0) #define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0)
#else /* XXX Netbsd >= 1.3H */ #else /* XXX Netbsd >= 1.3H */
int sigaction __P_((int, const struct sigaction *, struct sigaction *)) __RENAME(__sigaction14);
#define __SIGEMPTYSET { 0, 0, 0, 0} #define __SIGEMPTYSET { 0, 0, 0, 0}
#define __SIGFILLSET { 0xffffffff, 0xffffffff, \ #define __SIGFILLSET { 0xffffffff, 0xffffffff, \
0xffffffff, 0xffffffff } 0xffffffff, 0xffffffff }
...@@ -18,3 +23,5 @@ ...@@ -18,3 +23,5 @@
#define __SIGISMEMBER(s, n) (((s)->__bits[__SIGWORD(n)] & __SIGMASK(n)) != 0) #define __SIGISMEMBER(s, n) (((s)->__bits[__SIGWORD(n)] & __SIGMASK(n)) != 0)
#endif #endif
__END_DECLS
...@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)strerror.c 5.6 (Berkeley) 5/4/91"; ...@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <string.h> #include <string.h>
#if defined(__NetBSD__)
#include <errno.h>
#endif
char * char *
strerror(num) strerror(num)
int num; int num;
{ {
#if !defined(__NetBSD__)
extern int sys_nerr; extern int sys_nerr;
extern char *sys_errlist[]; extern char *sys_errlist[];
#endif
#define UPREFIX "Unknown error: " #define UPREFIX "Unknown error: "
static char ebuf[40] = UPREFIX; /* 64-bit number + slop */ static char ebuf[40] = UPREFIX; /* 64-bit number + slop */
register unsigned int errnum; register unsigned int errnum;
...@@ -51,7 +56,7 @@ strerror(num) ...@@ -51,7 +56,7 @@ strerror(num)
errnum = num; /* convert to unsigned */ errnum = num; /* convert to unsigned */
if (errnum < sys_nerr) if (errnum < sys_nerr)
return(sys_errlist[errnum]); return((char *)sys_errlist[errnum]);
/* Do this by hand, so we don't include stdio(3). */ /* Do this by hand, so we don't include stdio(3). */
t = tmp; t = tmp;
......
...@@ -432,9 +432,9 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) ...@@ -432,9 +432,9 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
} }
else else
full_text_keys++; full_text_keys++;
/* Check that auto_increment key is bigger than max key value */
if ((uint) share->base.auto_key -1 == key) if ((uint) share->base.auto_key -1 == key)
{ {
/* Check that auto_increment key is bigger than max key value */
ulonglong save_auto_value=info->s->state.auto_increment; ulonglong save_auto_value=info->s->state.auto_increment;
info->s->state.auto_increment=0; info->s->state.auto_increment=0;
info->lastinx=key; info->lastinx=key;
...@@ -454,6 +454,20 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) ...@@ -454,6 +454,20 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
} }
else else
info->s->state.auto_increment=save_auto_value; info->s->state.auto_increment=save_auto_value;
/* Check that there isn't a row with auto_increment = 0 in the table */
mi_extra(info,HA_EXTRA_KEYREAD);
bzero(info->lastkey,keyinfo->seg->length);
if (!mi_rkey(info, info->rec_buff, key, info->lastkey,
keyinfo->seg->length, HA_READ_KEY_EXACT))
{
/* Don't count this as a real warning, as myisamchk can't correct it */
uint save=param->warning_printed;
mi_check_print_warning(param,
"Found row where the auto_increment column has the value 0");
param->warning_printed=save;
}
mi_extra(info,HA_EXTRA_NO_KEYREAD);
} }
length=(my_off_t) isam_key_length(info,keyinfo)*keys + param->key_blocks*2; length=(my_off_t) isam_key_length(info,keyinfo)*keys + param->key_blocks*2;
......
...@@ -201,7 +201,7 @@ static struct option long_options[] = ...@@ -201,7 +201,7 @@ static struct option long_options[] =
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver 1.47 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.48 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
} }
......
...@@ -55,3 +55,8 @@ ordid ord ...@@ -55,3 +55,8 @@ ordid ord
2 sdj 2 sdj
3 sdj 3 sdj
1 zzz 1 zzz
a
0
Table Op Msg_type Msg_text
test.t1 check warning Found row where the auto_increment column has the value 0
test.t1 check status OK
...@@ -20,3 +20,6 @@ a b ...@@ -20,3 +20,6 @@ a b
a b a b
2 2 2 2
3 4 3 4
i
2
1
...@@ -64,3 +64,14 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null ...@@ -64,3 +64,14 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null
insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc'); insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test of auto_increment columns when they are set to 0
#
create table t1 (a int not null primary key auto_increment);
insert into t1 values (0);
update t1 set a=0;
select * from t1;
check table t1;
drop table t1;
...@@ -17,3 +17,14 @@ select * from t1; ...@@ -17,3 +17,14 @@ select * from t1;
delete from t1 limit 1; delete from t1 limit 1;
select * from t1; select * from t1;
drop table t1; drop table t1;
create table t1 (i int);
insert into t1 (i) values(1);
insert into t1 (i) values(1);
insert into t1 (i) values(1);
delete from t1 limit 1;
update t1 set i=2 limit 1;
delete from t1 limit 0;
update t1 set i=3 limit 0;
select * from t1;
drop table t1;
...@@ -85,7 +85,7 @@ gen_lex_hash_SOURCES = gen_lex_hash.cc ...@@ -85,7 +85,7 @@ gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS) gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqlbinlog_SOURCES = mysqlbinlog.cc mini_client.cc net_serv.cc \ mysqlbinlog_SOURCES = mysqlbinlog.cc mini_client.cc net_serv.cc \
mini_client_errors.c violite.c password.c mini_client_errors.c violite.c password.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) $(mysqld_LDADD) mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) # $(mysqld_LDADD)
DEFS = -DMYSQL_SERVER \ DEFS = -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
......
/* Copyright (C) 2000 NuSphere Corporation /* Copyright (C) 2000 MySQL AB & NuSphere Corporation
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file is based on ha_berkeley.cc */
#ifdef __GNUC__ #ifdef __GNUC__
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
......
/* Copyright (C) 2000 NuSphere Corporation /* Copyright (C) 2000 MySQL AB & NuSphere Corporation
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
......
...@@ -170,12 +170,13 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, ...@@ -170,12 +170,13 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
select=make_select(table,0,0,conds,&error); select=make_select(table,0,0,conds,&error);
if (error) if (error)
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), if ((select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES),
limit)) limit)) ||
!limit)
{ {
delete select; delete select;
send_ok(&thd->net,0L); send_ok(&thd->net,0L);
DBUG_RETURN(0); DBUG_RETURN(0); // Nothing to delete
} }
/* If running in safe sql mode, don't allow updates without keys */ /* If running in safe sql mode, don't allow updates without keys */
......
...@@ -110,7 +110,8 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields, ...@@ -110,7 +110,8 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
select=make_select(table,0,0,conds,&error); select=make_select(table,0,0,conds,&error);
if (error || if (error ||
(select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES), (select && select->check_quick(test(thd->options & SQL_SAFE_UPDATES),
limit))) limit)) ||
!limit)
{ {
delete select; delete select;
table->time_stamp=save_time_stamp; // Restore timestamp pointer table->time_stamp=save_time_stamp; // Restore timestamp pointer
......
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