From 982260d2cb5ec6b3864a34a4cb355160986f807f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Oct 2000 17:39:23 +0300 Subject: [PATCH 01/10] Bug fixes + defines for INNOBASE Docs/manual.texi: Cleanups client/sql_string.cc: Fixes for AIX mit-pthreads/Changes-mysql: Changelog mit-pthreads/config/configure.in: Fixes for NETBSD mit-pthreads/config/configure: Fixes for NETBSD mit-pthreads/gen/ctime.c: Fixes for NETBSD mysys/my_pthread.c: Changed assert to dbug_assert scripts/make_binary_distribution.sh: Removed mysql-test scripts/safe_mysqld.sh: Forced --defaults-extra-file to be first argument to mysqld sql/handler.h: Added INNOBASE database type sql/item_func.h: Fixed core dump when using MATCH sql/lex.h: Added INNOBASE database type sql/mysqld.cc: Fix for future sql/sql_yacc.yy: Added INNOBASE database type --- Docs/manual.texi | 34 +++++++++++++++++++---------- client/sql_string.cc | 31 ++++++++++++++++---------- mit-pthreads/Changes-mysql | 4 ++++ mit-pthreads/config/configure | 8 +++---- mit-pthreads/config/configure.in | 8 +++---- mit-pthreads/gen/ctime.c | 4 ++-- mysys/my_pthread.c | 6 ++--- scripts/make_binary_distribution.sh | 4 ++-- scripts/safe_mysqld.sh | 10 ++++----- sql/handler.h | 2 +- sql/item_func.h | 2 +- sql/lex.h | 1 + sql/mysqld.cc | 2 +- sql/sql_yacc.yy | 4 ++++ 14 files changed, 73 insertions(+), 47 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 11588bc6f3e..d3c963b7c5a 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -9408,7 +9408,8 @@ the sort order! @item The default return type of @code{IF} will now depend on both arguments and not only the first argument. @item @code{AUTO_INCREMENT} will not work with negative numbers. -@item @code{INNER} and @code{DELAYED} are now reserved words. +@item @code{INNER}, @code{DELAYED}, @code{RIGHT} and @code{WHEN} +are now reserved words. @item @code{FLOAT(X)} is now a true floating point type and not a value with a fixed number of decimals. @item When declaring @code{DECIMAL(length,dec)} the length argument no @@ -18050,7 +18051,7 @@ the table will not be analyzed again. @section @code{REPAIR TABLE} syntax @example -REPAIR TABLE tbl_name[,tbl_name...] [QUICK] +REPAIR TABLE tbl_name[,tbl_name...] [QUICK] [EXTENDED] @end example @code{REPAIR TABLE} only works on @code{MyISAM} tables and is the same things @@ -18077,6 +18078,11 @@ future, we will make it more flexible. If @code{QUICK} is given then @strong{MySQL} will try to do a @code{REPAIR} of only the index tree. +If you use @code{EXTENDED} then @strong{MySQL} will create the index row +by row instead of creating one index at a time with sorting; This may be +better than sorting on fixed length keys if you have long @code{char()} +keys that compress very good. + @findex DELETE @node DELETE, SELECT, REPAIR TABLE, Reference @section @code{DELETE} syntax @@ -19923,8 +19929,9 @@ Maximum number of temporary tables a client can keep open at the same time. After this many write locks, allow some read locks to run in between. @item @code{myisam_sort_buffer_size} -The buffer that is allocated when sorting the index when doing a @code{REPAIR} -table. +The buffer that is allocated when sorting the index when doing a +@code{REPAIR} or when creating indexes with @code{CREATE INDEX} or +@code{ALTER TABLE}. @item @code{net_buffer_length} The communication buffer is reset to this size between queries. This @@ -30912,8 +30919,9 @@ in these cases, and can provide useful information about the current number of connections and their status. @item -Run the command @code{mysqladmin -i 5 status} -in a separate window to produce statistics while you run your other queries. +Run the command @code{mysqladmin -i 5 status} or @code{mysqladmin -i 5 +-r status} or in a separate window to produce statistics while you run +your other queries. @item Try the following: @@ -33513,7 +33521,9 @@ For the connection specified by @code{mysql}, @code{mysql_errno()} returns the error code for the most recently invoked API function that can succeed or fail. A return value of zero means that no error occurred. Client error message numbers are listed in the @strong{MySQL} @file{errmsg.h} header file. -Server error message numbers are listed in @file{mysqld_error.h} +Server error message numbers are listed in @file{mysqld_error.h}. In the +@strong{MySQL} source distribution you can find a complete list of +error messages and error numbers in the file @file{Docs/mysqld_error.txt}. @subsubheading Return values: @@ -38101,7 +38111,8 @@ was part of the key that was used to find rows. @item Fixed bug in @code{FULLTEXT} index when inserting a @code{NULL} column. @item -Changed to use @code{mkstemp()} instead of @code{tempnam()}. +Changed to use @code{mkstemp()} instead of @code{tempnam()}. Based +on a patch from John Jones. @end itemize @node News-3.23.25, News-3.23.24, News-3.23.26, News-3.23.x @@ -42412,7 +42423,7 @@ tell us what you want to have done more quickly. @xref{Licensing and Support}. @item Fail safe replication. @item -Optimize, test and document transactions safe tables +Optimize, test and document transactions safe tables (BDB tables) @item Allow users to change startup options. @item @@ -42445,9 +42456,8 @@ Check if locked threads take any CPU. Fix configure so that one can compile all libraries (like @code{MyISAM}) without threads. @item -Change to use mkstemp() instead of tempnam() for system that supports the call. -We need to add a my_mkstemp() function in mysys and also change the cache -code to not create the filename until we do the actual open. +Add an option to periodically flush key pages for tables with delayed keys +if they haven't been used in a while. @item Allow join on key parts (optimization issue). @item diff --git a/client/sql_string.cc b/client/sql_string.cc index 67ce0f6ff54..7ca2d3c419e 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -81,7 +81,8 @@ bool String::realloc(uint32 alloc_length) } else if ((new_ptr= (char*) my_malloc(len,MYF(MY_WME)))) { - memcpy(new_ptr,Ptr,str_length); + if (str_length) // Avoid bugs in memcpy on AIX + memcpy(new_ptr,Ptr,str_length); new_ptr[str_length]=0; Ptr=new_ptr; Alloced_length=len; @@ -221,8 +222,8 @@ bool String::copy(const char *str,uint32 arg_length) { if (alloc(arg_length)) return TRUE; - str_length=arg_length; - memcpy(Ptr,str,arg_length); + if ((str_length=arg_length)) + memcpy(Ptr,str,arg_length); Ptr[arg_length]=0; return FALSE; } @@ -251,17 +252,21 @@ void String::strip_sp() bool String::append(const String &s) { - if (realloc(str_length+s.length())) - return TRUE; - memcpy(Ptr+str_length,s.ptr(),s.length()); - str_length+=s.length(); + if (s.length()) + { + if (realloc(str_length+s.length())) + return TRUE; + memcpy(Ptr+str_length,s.ptr(),s.length()); + str_length+=s.length(); + } return FALSE; } bool String::append(const char *s,uint32 arg_length) { if (!arg_length) // Default argument - arg_length= (uint32) strlen(s); + if (!(arg_length= (uint32) strlen(s))) + return FALSE; if (realloc(str_length+arg_length)) return TRUE; memcpy(Ptr+str_length,s,arg_length); @@ -398,7 +403,8 @@ bool String::replace(uint32 offset,uint32 arg_length,const String &to) { if (diff < 0) { - memcpy(Ptr+offset,to.ptr(),to.length()); + if (to.length()) + memcpy(Ptr+offset,to.ptr(),to.length()); bmove(Ptr+offset+to.length(),Ptr+offset+arg_length, str_length-offset-arg_length); } @@ -411,7 +417,8 @@ bool String::replace(uint32 offset,uint32 arg_length,const String &to) bmove_upp(Ptr+str_length+diff,Ptr+str_length, str_length-offset-arg_length); } - memcpy(Ptr+offset,to.ptr(),to.length()); + if (to.length()) + memcpy(Ptr+offset,to.ptr(),to.length()); } str_length+=(uint32) diff; } @@ -502,8 +509,8 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) } if (to->realloc(from_length)) return from; // Actually an error - to->str_length=min(from->str_length,from_length); - memcpy(to->Ptr,from->Ptr,to->str_length); + if ((to->str_length=min(from->str_length,from_length))) + memcpy(to->Ptr,from->Ptr,to->str_length); return to; } diff --git a/mit-pthreads/Changes-mysql b/mit-pthreads/Changes-mysql index 8895144206d..d7d6af7cb23 100644 --- a/mit-pthreads/Changes-mysql +++ b/mit-pthreads/Changes-mysql @@ -192,3 +192,7 @@ Changes done to this distrubtion (pthreads-1_60_beta6) by Monty (monty@tcx.se) 00.03.30 by Monty (monty@mysql.com) - Added chroot() and gethostname(). + +00.10.18 by Monty (monty@mysql.com) +- Added patch by Dave Huang to fix problem with date/time + on NETBSD/Alpha. diff --git a/mit-pthreads/config/configure b/mit-pthreads/config/configure index ab781193cae..589caec367d 100755 --- a/mit-pthreads/config/configure +++ b/mit-pthreads/config/configure @@ -1252,7 +1252,7 @@ except="" name=$host_cpu-$host_os case $host in - alpha-*-netbsd1.3[H-Z]|alpha-*-netbsd1.4*) + alpha-*-netbsd1.3[H-Z]|alpha-*-netbsd1.[45]*) name=alpha-netbsd-1.3 sysincludes=netbsd-1.1 except="fork lseek pipe fstat" @@ -1276,7 +1276,7 @@ case $host in CFLAGS="$CFLAGS -std" fi ;; - arm32-*-netbsd1.3[H-Z]|arm32-*-netbsd1.4*) + arm32-*-netbsd1.3[H-Z]|arm32-*-netbsd1.[45]*) name=arm32-netbsd-1.3 sysincludes=netbsd-1.1 except="fork pipe lseek ftruncate fstat" @@ -1336,7 +1336,7 @@ EOF EOF ;; - sparc-*-netbsd1.3[H-Z]|sparc-*-netbsd1.4*) + sparc-*-netbsd1.3[H-Z]|sparc-*-netbsd1.[45]*) name=sparc-netbsd-1.3 sysincludes=netbsd-1.1 except="pipe fork lseek ftruncate fstat" @@ -1375,7 +1375,7 @@ EOF syscall=i386-bsdi-2.0 except="fork lseek ftruncate sigsuspend" ;; - i386-*-netbsd1.3[H-Z]|i386-*-netbsd1.4*) + i386-*-netbsd1.3[H-Z]|i386-*-netbsd1.[45]*) name=i386-netbsd-1.3 sysincludes=netbsd-1.1 except="fork lseek ftruncate pipe fstat" diff --git a/mit-pthreads/config/configure.in b/mit-pthreads/config/configure.in index c623ddc4343..d7226a5bb84 100755 --- a/mit-pthreads/config/configure.in +++ b/mit-pthreads/config/configure.in @@ -126,7 +126,7 @@ name=$host_cpu-$host_os case $host in changequote(,)dnl - alpha-*-netbsd1.3[H-Z]|alpha-*-netbsd1.4*) + alpha-*-netbsd1.3[H-Z]|alpha-*-netbsd1.[45]*) name=alpha-netbsd-1.3 sysincludes=netbsd-1.1 except="fork lseek pipe fstat" @@ -152,7 +152,7 @@ changequote([,])dnl fi ;; changequote(,)dnl - arm32-*-netbsd1.3[H-Z]|arm32-*-netbsd1.4*) + arm32-*-netbsd1.3[H-Z]|arm32-*-netbsd1.[45]*) name=arm32-netbsd-1.3 sysincludes=netbsd-1.1 except="fork pipe lseek ftruncate fstat" @@ -199,7 +199,7 @@ changequote([,])dnl AC_DEFINE(BROKEN_SIGNALS) ;; changequote(,)dnl - sparc-*-netbsd1.3[H-Z]|sparc-*-netbsd1.4*) + sparc-*-netbsd1.3[H-Z]|sparc-*-netbsd1.[45]*) name=sparc-netbsd-1.3 sysincludes=netbsd-1.1 except="pipe fork lseek ftruncate fstat" @@ -240,7 +240,7 @@ changequote([,])dnl except="fork lseek ftruncate sigsuspend" ;; changequote(,)dnl - i386-*-netbsd1.3[H-Z]|i386-*-netbsd1.4*) + i386-*-netbsd1.3[H-Z]|i386-*-netbsd1.[45]*) name=i386-netbsd-1.3 sysincludes=netbsd-1.1 except="fork lseek ftruncate pipe fstat" diff --git a/mit-pthreads/gen/ctime.c b/mit-pthreads/gen/ctime.c index e7980296e50..0c1e711cf13 100644 --- a/mit-pthreads/gen/ctime.c +++ b/mit-pthreads/gen/ctime.c @@ -129,7 +129,7 @@ struct rule { ** Prototypes for static functions. */ -static long detzcode __P_((const char *)); +static int detzcode __P_((const char *)); static const char * getnum __P_((const char *, int *, int, int)); static const char * getsecs __P_((const char *, long *)); static const char * getoffset __P_((const char *, long *)); @@ -175,7 +175,7 @@ int daylight = 0; time_t altzone = 0; #endif /* defined ALTZONE */ -static long detzcode(const char * codep) +static int detzcode(const char * codep) { long result; int i; diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 3d8b2e4d0ed..f54e11eae8b 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -424,7 +424,7 @@ struct hostent *my_gethostbyname_r(const char *name, int buflen, int *h_errnop) { struct hostent *hp; - assert((size_t) buflen >= sizeof(*result)); + dbug_assert((size_t) buflen >= sizeof(*result)); if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop)) return 0; return hp; @@ -436,7 +436,7 @@ struct hostent *my_gethostbyname_r(const char *name, struct hostent *result, char *buffer, int buflen, int *h_errnop) { - assert(buflen >= sizeof(struct hostent_data)); + dbug_assert(buflen >= sizeof(struct hostent_data)); if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1) { *h_errnop= errno; @@ -452,7 +452,7 @@ struct hostent *my_gethostbyname_r(const char *name, int buflen, int *h_errnop) { struct hostent *hp; - assert(buflen >= sizeof(struct hostent_data)); + dbug_assert(buflen >= sizeof(struct hostent_data)); hp= gethostbyname_r(name,result,(struct hostent_data *) buffer); *h_errnop= errno; return hp; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 3dd4a4a6acd..7fc492439d0 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -37,8 +37,8 @@ done for i in extra/comp_err extra/replace extra/perror extra/resolveip \ extra/my_print_defaults isam/isamchk isam/pack_isam myisam/myisamchk myisam/myisampack sql/mysqld sql/mysqlbinlog \ - client/mysql sql/mysqld client/mysqlshow client/mysqladmin client/mysqldump client/mysqlimport client/mysql-test \ - client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysql-test + client/mysql sql/mysqld client/mysqlshow client/mysqladmin client/mysqldump client/mysqlimport \ + client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin client/.libs/mysqldump client/.libs/mysqlimport do cp -p $i $BASE/bin done diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh index ee9f40ed5dd..43023e0fb8b 100644 --- a/scripts/safe_mysqld.sh +++ b/scripts/safe_mysqld.sh @@ -14,7 +14,7 @@ trap '' 1 2 3 15 # we shouldn't let anyone kill us defaults= case "$1" in - --no-defaults|--defaults-file=*) + --no-defaults|--defaults-file=*|--defaults-extra-file=*) defaults="$1"; shift ;; esac @@ -138,8 +138,8 @@ fi # checked and repaired at start # # echo "Checking tables in $DATADIR" -# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check $DATADIR/*/*.MYI -# $MY_BASEDIR_VERSION/bin/isamchk --silent --force $DATADIR/*/*.ISM +# $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI +# $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM echo "Starting mysqld daemon with databases from $DATADIR" @@ -155,9 +155,9 @@ do rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety if test "$#" -eq 0 then - (trap "" 1 ; exec $NOHUP_NICENESS $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1 ) + (trap "" 1 ; exec $NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1 ) else - (trap "" ; exec $NOHUP_NICENESS $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ "$@" >> $err_log 2>&1 ) + (trap "" ; exec $NOHUP_NICENESS $ledir/mysqld $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ "$@" >> $err_log 2>&1 ) fi if test ! -f $pid_file # This is removed if normal shutdown then diff --git a/sql/handler.h b/sql/handler.h index 269f60eec16..64d08204948 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -102,7 +102,7 @@ enum db_type { DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1, DB_TYPE_HASH,DB_TYPE_MISAM,DB_TYPE_PISAM, DB_TYPE_RMS_ISAM, DB_TYPE_HEAP, DB_TYPE_ISAM, DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM, - DB_TYPE_BERKELEY_DB, + DB_TYPE_BERKELEY_DB, DB_TYPE_INNOBASE, DB_TYPE_DEFAULT }; enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC, diff --git a/sql/item_func.h b/sql/item_func.h index 68ec61db2c1..7b6d9acdcdc 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -843,7 +843,7 @@ public: FT_DOCLIST *ft_handler; Item_func_match(List &a, Item *b): Item_real_func(b), - fields(a), table(0), master(0), ft_handler(0) {} + fields(a), table(0), join_key(0), master(0), ft_handler(0) {} ~Item_func_match() { if (!master) diff --git a/sql/lex.h b/sql/lex.h index 7916eb467ef..a5c1b6eb123 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -160,6 +160,7 @@ static SYMBOL symbols[] = { { "INDEX", SYM(INDEX),0,0}, { "INFILE", SYM(INFILE),0,0}, { "INNER", SYM(INNER_SYM),0,0}, + { "INNOBASE", SYM(INNOBASE_SYM),0,0}, { "INSERT", SYM(INSERT),0,0}, { "INSERT_ID", SYM(INSERT_ID),0,0}, { "INT", SYM(INT_SYM),0,0}, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5f15ca9794a..c58a80fdd35 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2169,7 +2169,7 @@ pthread_handler_decl(handle_flush,arg __attribute__((unused))) flush_thread_in_use=1; pthread_mutex_lock(&LOCK_flush); - for (;;) + while (flush_time) { struct timespec abstime; #ifdef HAVE_TIMESPEC_TS_SEC diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2ab78a0e7a0..4b404081676 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -178,6 +178,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token INDEX %token INFILE %token INNER_SYM +%token INNOBASE_SYM %token INTO %token IN_SYM %token ISAM_SYM @@ -744,6 +745,7 @@ table_types: | MERGE_SYM { $$= DB_TYPE_MRG_MYISAM; } | HEAP_SYM { $$= DB_TYPE_HEAP; } | BERKELEY_DB_SYM { $$= DB_TYPE_BERKELEY_DB; } + | INNOBASE_SYM { $$= DB_TYPE_INNOBASE; } row_types: DEFAULT { $$= ROW_TYPE_DEFAULT; } @@ -2432,6 +2434,7 @@ keyword: | AVG_SYM {} | BACKUP_SYM {} | BEGIN_SYM {} + | BERKELEY_DB_SYM {} | BIT_SYM {} | BOOL_SYM {} | CHANGED {} @@ -2463,6 +2466,7 @@ keyword: | HOUR_SYM {} | IDENTIFIED_SYM {} | ISAM_SYM {} + | INNOBASE_SYM {} | LOCAL_SYM {} | LOGS_SYM {} | MAX_ROWS {} From bc7aaafc7eb1af4ce5e7b5811dfa892082493483 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Oct 2000 12:17:08 -0600 Subject: [PATCH 02/10] sql/slave.cc buffer size fix + template instatiation BitKeeper/etc/ignore: Added BitKeeper/etc/csets-in support-files/mysql-3.23.26-beta.spec to the ignore list sql/slave.cc: buffer size fix + template instatiation --- .bzrignore | 2 ++ sql/slave.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index d09880b1df3..1c9e79fc71b 100644 --- a/.bzrignore +++ b/.bzrignore @@ -157,3 +157,5 @@ PENDING/2000-10-11.04 PENDING/2000-10-11.05 PENDING/2000-10-11.06 BitKeeper/etc/csets-out +BitKeeper/etc/csets-in +support-files/mysql-3.23.26-beta.spec diff --git a/sql/slave.cc b/sql/slave.cc index a267421a3bd..bfbe12df22e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -284,7 +284,7 @@ int init_master_info(MASTER_INFO* mi) { FILE* file; MY_STAT stat_area; - char fname[FN_REFLEN]; + char fname[FN_REFLEN+128]; fn_format(fname, master_info_file, mysql_data_home, "", 4+16+32); if(!mi->inited) @@ -986,5 +986,6 @@ static void safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) #ifdef __GNUC__ template class I_List_iterator; +template class I_List_iterator; #endif From 57a7162f71f640abcf4318bc4a36fa7b56760182 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Oct 2000 12:33:36 -0600 Subject: [PATCH 03/10] sql/slave.cc cosmetic change sql/slave.cc@1.49 cosmetic change sql/slave.cc: cosmetic change --- sql/slave.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index bfbe12df22e..676c80bb04a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -683,7 +683,8 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) enum enum_duplicates handle_dup = DUP_IGNORE; if(lev->sql_ex.opt_flags && REPLACE_FLAG) handle_dup = DUP_REPLACE; - sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && DUMPFILE_FLAG ); + sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && + DUMPFILE_FLAG ); String field_term(&lev->sql_ex.field_term, 1), enclosed(&lev->sql_ex.enclosed, 1), line_term(&lev->sql_ex.line_term,1), escaped(&lev->sql_ex.escaped, 1), line_start(&lev->sql_ex.line_start, 1); @@ -927,7 +928,8 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused))) { sql_print_error("Error running query, slave aborted. Fix the problem, and re-start\ the slave thread with mysqladmin start-slave"); - goto err; // there was an error running the query + goto err; + // there was an error running the query // abort the slave thread, when the problem is fixed, the user // should restart the slave with mysqladmin start-slave } From da12c768d31b33cc9ab69f5efc1e7f754c1dfade Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 22 Oct 2000 01:19:05 +0300 Subject: [PATCH 04/10] Give an error if you use a BLOB(X) where X > 255 Fixes for MIT pthreads Docs/manual.texi: Update for MIT pthreads and sockets configure.in: Fixed MIT pthreads to use sockets myisam/mi_check.c: Portability fix myisam/sort.c: Portability fix sql/handler.h: Give an error if you use a BLOB(X) where X > 255 sql/mysqld.cc: Fixed MIT pthreads to use sockets sql/sql_table.cc: Give an error if you use a BLOB(X) where X > 255 sql/table.cc: Fixed problem with BDB tables without keys --- Docs/manual.texi | 101 +++++++++++++++++++++++----------------------- configure.in | 4 +- myisam/mi_check.c | 4 +- myisam/sort.c | 4 +- sql/handler.h | 1 + sql/mysqld.cc | 4 +- sql/sql_table.cc | 3 +- sql/table.cc | 2 + 8 files changed, 64 insertions(+), 59 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 46d51a3f5a4..41baa1b6f64 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -267,7 +267,7 @@ System-specific Issues * HP-UX 10.20:: HP-UX 10.20 notes * HP-UX 11.x:: HP-UX 11.x notes * Mac OS X:: Mac OS X notes -* BEOS:: +* BEOS:: Linux Notes (All Linux Versions) @@ -278,7 +278,7 @@ Linux Notes (All Linux Versions) * Linux-Alpha:: Linux-Alpha notes * MKLinux:: MkLinux notes * Qube2:: Qube2 Linux notes -* Linux-Ia64:: +* Linux-Ia64:: BSD/OS Notes @@ -295,7 +295,7 @@ Windows Notes * Windows and SSH:: Connecting to a remote @strong{MySQL} from Windows with SSH * Windows symbolic links:: Splitting data across different disks under Win32 * Windows compiling:: Compiling MySQL clients on Windows. -* Windows and BDB tables.:: +* Windows and BDB tables.:: * Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL} Post-installation Setup and Testing @@ -454,18 +454,18 @@ Functions for Use in @code{SELECT} and @code{WHERE} Clauses @code{SHOW} syntax (Get information about tables, columns,...) -* SHOW DATABASE INFO:: -* SHOW TABLE STATUS:: -* SHOW STATUS:: -* SHOW VARIABLES:: -* SHOW PROCESSLIST:: -* SHOW GRANTS:: -* SHOW CREATE TABLE:: +* SHOW DATABASE INFO:: +* SHOW TABLE STATUS:: +* SHOW STATUS:: +* SHOW VARIABLES:: +* SHOW PROCESSLIST:: +* SHOW GRANTS:: +* SHOW CREATE TABLE:: MySQL table types * MyISAM:: MyISAM tables -* MERGE:: +* MERGE:: MERGE tables * ISAM:: ISAM tables * HEAP:: HEAP tables * BDB:: BDB or Berkeley_db tables @@ -581,7 +581,7 @@ Speed of queries that access or update data * Estimating performance:: Estimating query performance * SELECT speed:: Speed of @code{SELECT} queries * Where optimizations:: How MySQL optimizes @code{WHERE} clauses -* DISTINCT optimization:: +* DISTINCT optimization:: * LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN} * LIMIT optimization:: How MySQL optimizes @code{LIMIT} * Insert speed:: Speed of @code{INSERT} queries @@ -613,10 +613,10 @@ Using @code{myisamchk} for table maintenance and crash recovery @code{myisamchk} invocation syntax -* myisamchk general options:: -* myisamchk check options:: -* myisamchk repair options:: -* myisamchk other options:: +* myisamchk general options:: +* myisamchk check options:: +* myisamchk repair options:: +* myisamchk other options:: Using @code{myisamchk} for crash recovery @@ -689,7 +689,7 @@ Some common errors when using MySQL * Packet too large:: @code{Packet too large} error * Communication errors:: Communication errors / Aborted connection * Full table:: @code{The table is full} error -* Cannot create:: +* Cannot create:: * Commands out of sync:: @code{Commands out of sync} error in client * Ignoring user:: @code{Ignoring user} error * Cannot find table:: @code{Table 'xxx' doesn't exist} error @@ -699,7 +699,7 @@ Solving some common problems with MySQL * Log Replication:: Database replication with update log * Backup:: Database backups * Update log:: The update log -* Binary log:: +* Binary log:: * Slow query log:: Log of slow queries * Multiple servers:: Running multiple @strong{MySQL} servers on the same machine @@ -813,6 +813,7 @@ MySQL change history Changes in release 3.23.x (Recommended; beta) +* News-3.23.27:: * News-3.23.26:: Changes in release 3.23.26 * News-3.23.25:: Changes in release 3.23.25 * News-3.23.24:: Changes in release 3.23.24 @@ -838,7 +839,7 @@ Changes in release 3.23.x (Recommended; beta) * News-3.23.4:: Changes in release 3.23.4 * News-3.23.3:: Changes in release 3.23.3 * News-3.23.2:: Changes in release 3.23.2 -* News-3.23.1:: +* News-3.23.1:: Changes in release 3.23.1 * News-3.23.0:: Changes in release 3.23.0 Changes in release 3.22.x @@ -952,7 +953,7 @@ Comments on porting to other systems * Debugging server:: Debugging a @strong{MySQL} server * Debugging client:: Debugging a @strong{MySQL} client * The DBUG package:: The DBUG package -* Locking methods:: +* Locking methods:: * RTS-threads:: Comments about RTS threads * Thread packages:: Differences between different thread packages @@ -5884,16 +5885,6 @@ shell> ./configure --with-mit-threads Building in a non-source directory is not supported when using MIT-pthreads, because we want to minimize our changes to this code. -@item -MIT-pthreads doesn't support the @code{AF_UNIX} protocol used to implement -UNIX sockets. This means that if you compile using MIT-pthreads, all -connections must be made using TCP/IP (which is a little slower). If you -find after building @strong{MySQL} that you cannot connect to the local -server, it may be that your client is attempting to connect to -@code{localhost} using a UNIX socket as the default. Try making a TCP/IP -connection with @code{mysql} by using a host option (@code{-h} or -@code{--host}) to specify the local host name explicitly. - @item The checks that determine whether or not to use MIT-pthreads occur only during the part of the configuration process that deals with the server @@ -6230,7 +6221,7 @@ distribution. * HP-UX 10.20:: HP-UX 10.20 notes * HP-UX 11.x:: HP-UX 11.x notes * Mac OS X:: Mac OS X notes -* BEOS:: +* BEOS:: @end menu @@ -6674,7 +6665,7 @@ CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE -DCONST=const - * Linux-Alpha:: Linux-Alpha notes * MKLinux:: MkLinux notes * Qube2:: Qube2 Linux notes -* Linux-Ia64:: +* Linux-Ia64:: @end menu @node Linux-x86, Linux-RedHat50, Linux, Linux @@ -7732,7 +7723,7 @@ is also described in the @file{README} file that comes with the * Windows and SSH:: Connecting to a remote @strong{MySQL} from Windows with SSH * Windows symbolic links:: Splitting data across different disks under Win32 * Windows compiling:: Compiling MySQL clients on Windows. -* Windows and BDB tables.:: +* Windows and BDB tables.:: * Windows vs Unix:: @strong{MySQL}-Windows compared to Unix @strong{MySQL} @end menu @@ -19531,13 +19522,13 @@ and @samp{_} wildcard characters. @findex SHOW INDEX @findex SHOW KEYS @menu -* SHOW DATABASE INFO:: -* SHOW TABLE STATUS:: -* SHOW STATUS:: -* SHOW VARIABLES:: -* SHOW PROCESSLIST:: -* SHOW GRANTS:: -* SHOW CREATE TABLE:: +* SHOW DATABASE INFO:: +* SHOW TABLE STATUS:: +* SHOW STATUS:: +* SHOW VARIABLES:: +* SHOW PROCESSLIST:: +* SHOW GRANTS:: +* SHOW CREATE TABLE:: @end menu @cindex displaying, information, @code{SHOW} @@ -21365,7 +21356,7 @@ of both worlds. @menu * MyISAM:: MyISAM tables -* MERGE:: MERGE tables +* MERGE:: MERGE tables * ISAM:: ISAM tables * HEAP:: HEAP tables * BDB:: BDB or Berkeley_db tables @@ -26429,7 +26420,7 @@ great tool to find out if this is a problem with your query. * Estimating performance:: Estimating query performance * SELECT speed:: Speed of @code{SELECT} queries * Where optimizations:: How MySQL optimizes @code{WHERE} clauses -* DISTINCT optimization:: +* DISTINCT optimization:: * LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN} * LIMIT optimization:: How MySQL optimizes @code{LIMIT} * Insert speed:: Speed of @code{INSERT} queries @@ -28653,10 +28644,10 @@ shell> myisamchk /path/to/datadir/*/*.MYI @code{myisamchk} supports the following options: @menu -* myisamchk general options:: -* myisamchk check options:: -* myisamchk repair options:: -* myisamchk other options:: +* myisamchk general options:: +* myisamchk check options:: +* myisamchk repair options:: +* myisamchk other options:: @end menu @cindex options, @code{myisamchk} @@ -31142,7 +31133,7 @@ sure that no other programs is using the dynamic libraries! * Packet too large:: @code{Packet too large} error * Communication errors:: Communication errors / Aborted connection * Full table:: @code{The table is full} error -* Cannot create:: +* Cannot create:: * Commands out of sync:: @code{Commands out of sync} error in client * Ignoring user:: @code{Ignoring user} error * Cannot find table:: @code{Table 'xxx' doesn't exist} error @@ -32232,7 +32223,7 @@ Drop or rename @code{old_table} * Log Replication:: Database replication with update log * Backup:: Database backups * Update log:: The update log -* Binary log:: +* Binary log:: * Slow query log:: Log of slow queries * Multiple servers:: Running multiple @strong{MySQL} servers on the same machine @end menu @@ -38113,6 +38104,7 @@ version. The replication and BerkeleyDB code is still under development, though, so 3.23 is not released as a stable version yet. @menu +* News-3.23.27:: Changes in release 3.23.27 * News-3.23.26:: Changes in release 3.23.26 * News-3.23.25:: Changes in release 3.23.25 * News-3.23.24:: Changes in release 3.23.24 @@ -38142,7 +38134,16 @@ though, so 3.23 is not released as a stable version yet. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.26, News-3.23.25, News-3.23.x, News-3.23.x +@node News-3.23.27, News-3.23.26, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.27 +@itemize @bullet +@item +You can now have sockets even with @code{mit-pthreads} +@item +Small portability fixes +@end itemize + +@node News-3.23.26, News-3.23.25, News-3.23.27, News-3.23.x @appendixsubsec Changes in release 3.23.26 @itemize @bullet @item @@ -42912,7 +42913,7 @@ will ensure that your thread installation has even a remote chance to work! * Debugging server:: Debugging a @strong{MySQL} server * Debugging client:: Debugging a @strong{MySQL} client * The DBUG package:: The DBUG package -* Locking methods:: +* Locking methods:: * RTS-threads:: Comments about RTS threads * Thread packages:: Differences between different thread packages @end menu diff --git a/configure.in b/configure.in index efb746fffdc..48d04852cdf 100644 --- a/configure.in +++ b/configure.in @@ -1862,8 +1862,8 @@ AC_SUBST(server_scripts) if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes" then - # MIT pthreads does not support connecting with unix sockets - AC_DEFINE(HAVE_THREADS_WITHOUT_SOCKETS) + # MIT pthreads does now support connecting with unix sockets + # AC_DEFINE(HAVE_THREADS_WITHOUT_SOCKETS) fi # Some usefull subst diff --git a/myisam/mi_check.c b/myisam/mi_check.c index e55065b795e..351c2d469da 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -192,7 +192,7 @@ int chk_del(MI_CHECK *param, register MI_INFO *info, uint test_flag) } DBUG_RETURN(0); wrong: - param->retry_without_quick=1; // Don't use quick repair + param->retry_without_quick=1; /* Don't use quick repair */ if (test_flag & T_VERBOSE) puts(""); mi_check_print_error(param,"record delete-link-chain corrupted"); DBUG_RETURN(1); @@ -292,7 +292,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info) error=1; mi_check_print_error(param,"Size of datafile is: %-8s Should be: %s", llstr(size,buff), llstr(skr,buff2)); - param->retry_without_quick=1; // Don't use quick repair + param->retry_without_quick=1; /* Don't use quick repair */ } else { diff --git a/myisam/sort.c b/myisam/sort.c index a2a28ec9109..e6c7d61e39a 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -291,9 +291,9 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, temp=from_file; from_file=to_file; to_file=temp; *maxbuffer= (int) (lastbuff-buffpek)-1; } - close_cached_file(to_file); // This holds old result + close_cached_file(to_file); /* This holds old result */ if (to_file == t_file) - *t_file=t_file2; // Copy result file + *t_file=t_file2; /* Copy result file */ DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ } /* merge_many_buff */ diff --git a/sql/handler.h b/sql/handler.h index 64d08204948..b7872ead98a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -273,6 +273,7 @@ public: virtual uint max_keys() const =0; virtual uint max_key_parts() const =0; virtual uint max_key_length()const =0; + virtual uint max_key_part_length() { return 255; } virtual uint min_record_length(uint options) const { return 1; } virtual bool low_byte_first() const { return 1; } virtual bool is_crashed() const { return 0; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c58a80fdd35..7e156077723 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -809,7 +809,7 @@ static void server_init(void) } #endif -#if defined(HAVE_SYS_UN_H) && !defined(HAVE_mit_thread) +#if defined(HAVE_SYS_UN_H) /* ** Create the UNIX socket */ @@ -2694,7 +2694,7 @@ The default values (after parsing the command line arguments) are:\n\n"); if (opt_slow_logname) printf("update log: %s\n",opt_slow_logname); printf("TCP port: %d\n",mysql_port); -#if defined(HAVE_SYS_UN_H) && !defined(HAVE_mit_thread) +#if defined(HAVE_SYS_UN_H) printf("Unix socket: %s\n",mysql_unix_port); #endif if (my_disable_locking) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e4257f84459..f5336e7beaf 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -416,7 +416,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, { if (f_is_blob(sql_field->pack_flag)) { - if ((length=column->length) > file->max_key_length()) + if ((length=column->length) > file->max_key_length() || + length > file->max_key_part_length()) { my_error(ER_WRONG_SUB_KEY,MYF(0)); DBUG_RETURN(-1); diff --git a/sql/table.cc b/sql/table.cc index b784c8ca35f..bdc2c0f124e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -491,6 +491,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, else outparam->primary_key = MAX_KEY; // we do not have a primary key } + else + outparam->primary_key= MAX_KEY; x_free((gptr) disk_buff); disk_buff=0; if (new_field_pack_flag <= 1) From 8f7e2af1e84cdf261e0782bda6676af004153b04 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 22 Oct 2000 17:53:16 -0400 Subject: [PATCH 05/10] Index Added latin5 (turkish) character set manual.texi Added latin5 (turkish) character set configure.in Added latin5 (turkish) character set latin5.conf BitKeeper file /usr/local/src/my/work/sql/share/charsets/latin5.conf configure.in: Added latin5 (turkish) character set Docs/manual.texi: Added latin5 (turkish) character set sql/share/charsets/Index: Added latin5 (turkish) character set BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + Docs/manual.texi | 2 + configure.in | 4 +- sql/share/charsets/Index | 1 + sql/share/charsets/latin5.conf | 78 ++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 sql/share/charsets/latin5.conf diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index d90aef8018e..7de3b456185 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -2,3 +2,4 @@ monty@donna.mysql.com mwagner@evoq.home.mwagner.org sasha@mysql.sashanet.com serg@serg.mysql.com +tim@threads.polyesthetic.msg diff --git a/Docs/manual.texi b/Docs/manual.texi index 41baa1b6f64..3302130f131 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -38138,6 +38138,8 @@ though, so 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.27 @itemize @bullet @item +Added the latin5 (turkish) character set +@item You can now have sockets even with @code{mit-pthreads} @item Small portability fixes diff --git a/configure.in b/configure.in index 48d04852cdf..b57ba6a5aa9 100644 --- a/configure.in +++ b/configure.in @@ -1549,7 +1549,7 @@ dnl sql/share/charsets/Index. If the character set uses strcoll dnl or other special handling, you must also create dnl strings/ctype-$charset_name.c -CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620" +CHARSETS_AVAILABLE="big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr latin1 latin2 latin5 swe7 usa7 win1250 win1251 win1251ukr ujis sjis tis620" DEFAULT_CHARSET=latin1 dnl win1251 is deprecated - it's available, but not listed here in the help @@ -1557,7 +1557,7 @@ AC_ARG_WITH(charset, [ --with-charset=CHARSET Use CHARSET by default (one of: big5 cp1251 cp1257 croat czech danish dec8 dos estonia euc_kr gb2312 gbk german1 greek hebrew hp8 hungarian koi8_ru koi8_ukr - latin1 latin2 swe7 usa7 win1250 win1251ukr + latin1 latin2 latin5 swe7 usa7 win1250 win1251ukr ujis sjis tis620; Default is latin1)], [default_charset="$withval"], [default_charset="$DEFAULT_CHARSET"]) diff --git a/sql/share/charsets/Index b/sql/share/charsets/Index index f28ee87b396..b91e27e7c02 100644 --- a/sql/share/charsets/Index +++ b/sql/share/charsets/Index @@ -33,3 +33,4 @@ win1250 26 croat 27 gbk 28 cp1257 29 +latin5 30 diff --git a/sql/share/charsets/latin5.conf b/sql/share/charsets/latin5.conf new file mode 100644 index 00000000000..92fbd2299bb --- /dev/null +++ b/sql/share/charsets/latin5.conf @@ -0,0 +1,78 @@ +# Configuration file for the latin5 (turkish) character set + +# Note: all accented characters are compared separately (this +# is different from the default latin1 character set, where +# e.g. a = ä = á, etc.). + +# ctype array (must have 257 elements) + 00 + 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10 + 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10 + 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 + 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02 + 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 + 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02 + +# to_lower array (must have 256 elements) + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC 69 FE DF + E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF + F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + +# to_upper array (must have 256 elements) + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F + 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F + 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F + A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF + B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF + C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF + D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC 49 DE FF + +# sort_order array (must have 256 elements) + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 45 46 47 48 4A 4B 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65 + 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52 + 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B + 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B + 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB + AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB + BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5 + CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA + 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF From 76edea0d7354133743b3608213653c5a7f3c94ce Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Oct 2000 15:35:42 +0300 Subject: [PATCH 06/10] Fix of automatic repair Docs/manual.texi: Update for 3.23.27 configure.in: Fixed syntax error include/m_string.h: bmove() was wrongly defined (old code was probably never executed) myisam/mi_check.c: Fix for automatic repair myisam/myisamchk.c: Fix for automatic repair sql/ha_myisam.cc: Fix for automatic repair sql/handler.cc: Fix for automatic repair sql/mysqlbinlog.cc: Indentation sql/sql_insert.cc: Move incrementation of thread_count to make things safer sql/sql_parse.cc: Added a new state for bug tracking sql/sql_select.cc: Increment created_tmp_disk_tables for each internal temporary MyISAM table. Added path to some printf statements. --- Docs/manual.texi | 23 +++++++++++++++++-- configure.in | 8 +++---- include/m_string.h | 2 +- myisam/mi_check.c | 13 ++++++++--- myisam/myisamchk.c | 2 +- sql/ha_myisam.cc | 55 +++++++++++++++++++++++++++++----------------- sql/handler.cc | 1 + sql/mysqlbinlog.cc | 4 ++-- sql/sql_insert.cc | 6 ++--- sql/sql_parse.cc | 1 + sql/sql_select.cc | 22 +++++++++---------- 11 files changed, 90 insertions(+), 47 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 41baa1b6f64..3bacaf1a834 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -813,7 +813,7 @@ MySQL change history Changes in release 3.23.x (Recommended; beta) -* News-3.23.27:: +* News-3.23.27:: Changes in release 3.23.27 * News-3.23.26:: Changes in release 3.23.26 * News-3.23.25:: Changes in release 3.23.25 * News-3.23.24:: Changes in release 3.23.24 @@ -21494,6 +21494,22 @@ If the repair fails, retry once more with the old repair option method type of error with little disk requirements.. @end itemize +If the recover wouldn't be able to recover all rows from a previous +completed statement and you didn't specify @code{FORCE} as an option to +@code{myisam-recover}, then the automatic repair will abort with an error +message in the error file: + +@example +Error: Couldn't repair table: test.g00pages +@end example + +If you in this case had used the @code{FORCE} option you would instead have got +a warning in the error file: + +@example +Warning: Found 344 of 354 rows when repairing ./test/g00pages +@end example + Note that if you run automatic recover with the @code{BACKUP} option, you should have a cron script that automaticly moves file with names like @file{tablename-datetime.BAK} from the database directories to a @@ -38138,7 +38154,10 @@ though, so 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.27 @itemize @bullet @item -You can now have sockets even with @code{mit-pthreads} +Fixed bug where the automatic repair of MyISAM tables failed sometimes +when the data file was corrupt. +@item +You can now use Unix sockets with @code{mit-pthreads} @item Small portability fixes @end itemize diff --git a/configure.in b/configure.in index 48d04852cdf..32041850efc 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! -AM_INIT_AUTOMAKE(mysql, 3.23.26-beta) +AM_INIT_AUTOMAKE(mysql, 3.23.27-beta) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -1860,11 +1860,11 @@ AC_SUBST(sql_server_dirs) AC_SUBST(thread_dirs) AC_SUBST(server_scripts) -if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes" -then +#if test "$with_posix_threads" = "no" -o "$with_mit_threads" = "yes" +#then # MIT pthreads does now support connecting with unix sockets # AC_DEFINE(HAVE_THREADS_WITHOUT_SOCKETS) -fi +#fi # Some usefull subst AC_SUBST(CC) diff --git a/include/m_string.h b/include/m_string.h index c17e928ea37..6b7719d44f5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -62,7 +62,7 @@ #if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) # define memcpy(d, s, n) bcopy ((s), (d), (n)) # define memset(A,C,B) bfill((A),(B),(C)) -# define memmove(d, s, n) bmove ((s), (d), (n)) +# define memmove(d, s, n) bmove ((d), (s), (n)) #elif defined(HAVE_MEMMOVE) # define bmove(d, s, n) memmove((d), (s), (n)) #else diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 351c2d469da..2e3df08083d 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1048,6 +1048,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) mi_check_print_error(param,"got error: %d when reading datafile",my_errno); err2: my_afree((gptr) record); + param->retry_without_quick=1; DBUG_RETURN(1); } /* chk_data_link */ @@ -2052,6 +2053,7 @@ static int sort_get_next_record(SORT_INFO *sort_info) { if (param->read_cache.error) param->out_flag |= O_DATA_LOST; + param->retry_repair=param->retry_without_quick=1; DBUG_RETURN(-1); } sort_info->start_recpos=sort_info->pos; @@ -2076,7 +2078,10 @@ static int sort_get_next_record(SORT_INFO *sort_info) found_record=block_info.second_read= 0; left_length=1; if (searching) + { pos=MY_ALIGN(pos,MI_DYN_ALIGN_SIZE); + param->retry_without_quick=1; + } do { if (pos > sort_info->max_pos) @@ -2084,11 +2089,10 @@ static int sort_get_next_record(SORT_INFO *sort_info) if (pos & (MI_DYN_ALIGN_SIZE-1)) { if ((param->testflag & T_VERBOSE) || searching == 0) - { mi_check_print_info(param,"Wrong aligned block at %s", llstr(pos,llbuff)); + if (searching) goto try_next; - } } if (found_record && pos == param->search_after_block) mi_check_print_info(param,"Block: %s used by record at %s", @@ -2110,6 +2114,7 @@ static int sort_get_next_record(SORT_INFO *sort_info) if (searching && ! sort_info->fix_datafile) { param->error_printed=1; + param->retry_repair=param->retry_without_quick=1; DBUG_RETURN(1); /* Something wrong with data */ } if (((b_type=_mi_get_block_info(&block_info,-1,pos)) & @@ -2230,7 +2235,7 @@ static int sort_get_next_record(SORT_INFO *sort_info) { mi_check_print_error(param,"Not enough memory for blob at %s", llstr(sort_info->start_recpos,llbuff)); - DBUG_RETURN(-1); + DBUG_RETURN(1); } } else @@ -2305,6 +2310,7 @@ static int sort_get_next_record(SORT_INFO *sort_info) if (searching && ! sort_info->fix_datafile) { param->error_printed=1; + param->retry_repair=param->retry_without_quick=1; DBUG_RETURN(1); /* Something wrong with data */ } sort_info->start_recpos=sort_info->pos; @@ -2958,6 +2964,7 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update) } if (mi_state_info_write(share->kfile,&share->state,1+2)) goto err; + share->changed=0; } { /* Force update of status */ int error; diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 7d9ba9b7c28..29259d15c1a 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -196,7 +196,7 @@ static struct option long_options[] = static void print_version(void) { - printf("%s Ver 1.35 for %s at %s\n",my_progname,SYSTEM_TYPE, + printf("%s Ver 1.36 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 639c2dc04a6..7b1d274922d 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -368,14 +368,14 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) err: { - MI_CHECK param; - myisamchk_init(¶m); - param.thd = thd; - param.op_name = (char*)"restore"; - param.table_name = table->table_name; - param.testflag = 0; - mi_check_print_error(¶m,errmsg, errno ); - return error; + MI_CHECK param; + myisamchk_init(¶m); + param.thd = thd; + param.op_name = (char*)"restore"; + param.table_name = table->table_name; + param.testflag = 0; + mi_check_print_error(¶m,errmsg, errno ); + return error; } } @@ -409,10 +409,11 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) { int error; - if (!file) return HA_ADMIN_INTERNAL_ERROR; MI_CHECK param; ha_rows start_records; + if (!file) return HA_ADMIN_INTERNAL_ERROR; + myisamchk_init(¶m); param.thd = thd; param.op_name = (char*) "repair"; @@ -428,14 +429,15 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) if (param.retry_without_quick && param.opt_rep_quick) { param.opt_rep_quick=0; - sql_print_error("Warning: Retrying recover of: %s without quick", + sql_print_error("Warning: Retrying repair of: '%s' without quick", table->path); continue; } + param.opt_rep_quick=0; // Safety if ((param.testflag & T_REP_BY_SORT)) { param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP; - sql_print_error("Warning: Retrying recover of: %s with keycache", + sql_print_error("Warning: Retrying repair of: '%s' with keycache", table->path); continue; } @@ -444,7 +446,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) if (!error && start_records != file->state->records) { char llbuff[22],llbuff2[22]; - sql_print_error("Warning: Found %s of %s rows from %s", + sql_print_error("Warning: Found %s of %s rows when repairing '%s'", llstr(file->state->records, llbuff), llstr(start_records, llbuff2), table->path); @@ -472,6 +474,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) { int error=0; + uint extra_testflag=0; bool optimize_done= !optimize, statistics_done=0; char fixed_name[FN_REFLEN]; const char *old_proc_info=thd->proc_info; @@ -487,6 +490,12 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT, 4+ (param.opt_follow_links ? 16 : 0))); + if (mi_lock_database(file,F_WRLCK)) + { + mi_check_print_error(¶m,ER(ER_CANT_LOCK),my_errno); + DBUG_RETURN(HA_ADMIN_FAILED); + } + if (!optimize || ((file->state->del || share->state.split != file->state->records) && (!param.opt_rep_quick || @@ -496,10 +505,13 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) if (mi_test_if_sort_rep(file,file->state->records,0) && (param.testflag & T_REP_BY_SORT)) { + uint testflag=param.testflag; + extra_testflag= T_STATISTICS; param.testflag|= T_STATISTICS; // We get this for free thd->proc_info="Repair by sorting"; statistics_done=1; error = mi_repair_by_sort(¶m, file, fixed_name, param.opt_rep_quick); + param.testflag=testflag; } else { @@ -539,17 +551,19 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) update_auto_increment_key(¶m, file, 1); error = update_state_info(¶m, file, UPDATE_TIME | UPDATE_OPEN_COUNT | - (param.testflag & T_STATISTICS ? - UPDATE_STAT : 0)); + ((param.testflag | extra_testflag) & + T_STATISTICS ? UPDATE_STAT : 0)); info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE | HA_STATUS_CONST); } - else if (!mi_is_crashed(file)) + else { - mi_mark_crashed(file); + mi_mark_crashed_on_repair(file); file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; + update_state_info(¶m, file, 0); } thd->proc_info=old_proc_info; + mi_lock_database(file,F_UNLCK); DBUG_RETURN(error ? HA_ADMIN_FAILED : !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK); } @@ -593,6 +607,7 @@ bool ha_myisam::activate_all_index(THD *thd) bool ha_myisam::check_and_repair(THD *thd) { int error=0; + int marked_crashed; HA_CHECK_OPT check_opt; DBUG_ENTER("ha_myisam::auto_check_and_repair"); @@ -601,11 +616,11 @@ bool ha_myisam::check_and_repair(THD *thd) // Don't use quick if deleted rows if (!file->state->del && (myisam_recover_options & HA_RECOVER_QUICK)) check_opt.quick=1; - sql_print_error("Warning: Checking table: %s",table->path); - if (mi_is_crashed(file) || check(thd, &check_opt)) + sql_print_error("Warning: Checking table: '%s'",table->path); + if ((marked_crashed=mi_is_crashed(file)) || check(thd, &check_opt)) { - sql_print_error("Warning: Recovering table: %s",table->path); - check_opt.quick= !check_opt.retry_without_quick; + sql_print_error("Warning: Recovering table: '%s'",table->path); + check_opt.quick= !check_opt.retry_without_quick && !marked_crashed; check_opt.flags=(((myisam_recover_options & HA_RECOVER_BACKUP) ? T_BACKUP_DATA : 0) | (!(myisam_recover_options & HA_RECOVER_FORCE) ? diff --git a/sql/handler.cc b/sql/handler.cc index c7353a864ff..df44df4a8c1 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -542,6 +542,7 @@ void handler::print_error(int error, myf errflag) textno=ER_CHECKREAD; break; case HA_ERR_CRASHED: + case HA_ERR_CRASHED_ON_REPAIR: textno=ER_NOT_KEYFILE; break; case HA_ERR_OUT_OF_MEM: diff --git a/sql/mysqlbinlog.cc b/sql/mysqlbinlog.cc index 5c94d5d5a57..179bc717093 100644 --- a/sql/mysqlbinlog.cc +++ b/sql/mysqlbinlog.cc @@ -327,8 +327,8 @@ static void dump_local_log_entries(const char* logname) if(!position) { char magic[4]; - if(my_fread(file, (byte*) magic, sizeof(magic), MYF(MY_NABP|MY_WME))) - die("I/O error reading binlog magic number"); + if (my_fread(file, (byte*) magic, sizeof(magic), MYF(MY_NABP|MY_WME))) + die("I/O error reading binlog magic number"); if(memcmp(magic, BINLOG_MAGIC, 4)) die("Bad magic number"); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index b32e5393404..9fc47cd4dfc 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -567,6 +567,9 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list) pthread_mutex_unlock(&LOCK_delayed_create); DBUG_RETURN(0); } + pthread_mutex_lock(&LOCK_thread_count); + thread_count++; + pthread_mutex_unlock(&LOCK_thread_count); if (!(tmp->thd.db=my_strdup(table_list->db,MYF(MY_WME))) || !(tmp->thd.query=my_strdup(table_list->real_name,MYF(MY_FAE)))) { @@ -578,9 +581,6 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list) } tmp->table_list=table_list; // Needed to open table tmp->lock(); - pthread_mutex_lock(&LOCK_thread_count); - thread_count++; - pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_lock(&tmp->mutex); if ((error=pthread_create(&tmp->thd.real_id,&connection_attrib, handle_delayed_insert,(void*) tmp))) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 83355d08925..359ed495a83 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -817,6 +817,7 @@ bool do_command(THD *thd) mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query); } } + thd->proc_info="cleaning up2"; VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list thd->proc_info=0; thd->command=COM_SLEEP; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 35949c41b3c..4cdfc992e19 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3721,6 +3721,7 @@ static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param, table->db_stat=0; goto err; } + statistic_increment(created_tmp_disk_tables, &LOCK_status); table->db_record_offset=1; DBUG_RETURN(0); err: @@ -3781,7 +3782,6 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error, save_proc_info=thd->proc_info; thd->proc_info="converting HEAP to MyISAM"; - statistic_increment(created_tmp_disk_tables, &LOCK_status); if (create_myisam_tmp_table(&new_table,param, thd->lex.options | thd->options)) goto err2; @@ -4196,7 +4196,7 @@ join_read_const(JOIN_TAB *tab) if (error != HA_ERR_KEY_NOT_FOUND) { sql_print_error("read_const: Got error %d when reading table %s", - error, table->real_name); + error, table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4231,7 +4231,7 @@ join_read_key(JOIN_TAB *tab) if (error && error != HA_ERR_KEY_NOT_FOUND) { sql_print_error("read_key: Got error %d when reading table '%s'",error, - table->real_name); + table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4255,7 +4255,7 @@ join_read_always_key(JOIN_TAB *tab) if (error != HA_ERR_KEY_NOT_FOUND) { sql_print_error("read_const: Got error %d when reading table %s",error, - table->real_name); + table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4287,7 +4287,7 @@ join_read_next(READ_RECORD *info) if (error != HA_ERR_END_OF_FILE) { sql_print_error("read_next: Got error %d when reading table %s",error, - table->real_name); + table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4365,7 +4365,7 @@ join_init_read_next_with_key(READ_RECORD *info) if (error != HA_ERR_END_OF_FILE) { sql_print_error("read_next_with_key: Got error %d when reading table %s", - error, info->table->real_name); + error, info->table->path); info->file->print_error(error,MYF(0)); return 1; } @@ -4397,7 +4397,7 @@ join_init_read_last_with_key(JOIN_TAB *tab) if (error != HA_ERR_END_OF_FILE) { sql_print_error("read_first_with_key: Got error %d when reading table", - error, table->real_name); + error, table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4415,7 +4415,7 @@ join_init_read_prev_with_key(READ_RECORD *info) if (error != HA_ERR_END_OF_FILE) { sql_print_error("read_prev_with_key: Got error %d when reading table: %s", - error,info->table->real_name); + error,info->table->path); info->file->print_error(error,MYF(0)); return 1; } @@ -4441,7 +4441,7 @@ join_ft_read_first(JOIN_TAB *tab) if (error != HA_ERR_KEY_NOT_FOUND) { sql_print_error("ft_read_first/init: Got error %d when reading table %s",error, - table->real_name); + table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4454,7 +4454,7 @@ join_ft_read_first(JOIN_TAB *tab) if (error != HA_ERR_END_OF_FILE) { sql_print_error("ft_read_first/read: Got error %d when reading table %s", - error, table->real_name); + error, table->path); table->file->print_error(error,MYF(0)); return 1; } @@ -4472,7 +4472,7 @@ join_ft_read_next(READ_RECORD *info) if (error != HA_ERR_END_OF_FILE) { sql_print_error("ft_read_next: Got error %d when reading table %s", - error, info->table->real_name); + error, info->table->path); info->file->print_error(error,MYF(0)); return 1; } From 101a583f0ec7c71786817bf13705737eeedfa366 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Oct 2000 02:39:54 +0300 Subject: [PATCH 07/10] Update of interface for BDB tables. Fixed bug in SHOW CREATE TABLE Build-tools/mysql-copyright: Shorter error message Docs/manual.texi: Update of myisamchk stuff acinclude.m4: Force use of Berkeley DB 3.2.3 or newer include/m_string.h: Changed type of arguments to bmove() myisam/mi_check.c: Nicer error message mysql.proj: Updated sql/ha_berkeley.cc: Use new key compare interface sql/sql_select.cc: Call join_free() early to free all cursors sql/sql_show.cc: Fixed CREATE TABLE when used with auto_increment columns strings/bmove.c: Changed type of arguments to bmove() --- Build-tools/mysql-copyright | 32 ++++++++++++++++++++++++++------ Docs/manual.texi | 20 +++++++++++++++++++- acinclude.m4 | 8 ++++---- include/m_string.h | 2 +- myisam/mi_check.c | 4 ++-- mysql.proj | Bin 163840 -> 167936 bytes sql/ha_berkeley.cc | 25 +++++++++++++------------ sql/sql_select.cc | 12 ++++++++---- sql/sql_show.cc | 17 ++++++++--------- strings/bmove.c | 2 +- 10 files changed, 82 insertions(+), 40 deletions(-) diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index a4eac33ded8..f481325bebb 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -3,16 +3,17 @@ # Untar a MySQL distribution, change the copyright texts, # pack it up again to a given directory -$VER="1.1"; +$VER="1.2"; use Getopt::Long; -$opt_help= 0; -$opt_target= "mysql-copyright-target-"; -$opt_target.= `date +%d%m%y-%H%M%S`; +$opt_help = 0; +$opt_version = 0; +$opt_target = "mysql-copyright-target-"; +$opt_target .= `date +%d%m%y-%H%M%S`; chop $opt_target; -GetOptions("help","target=s") || usage(); +GetOptions("help","version","target=s") || error(); # fix the directory prefix for target dir @@ -32,7 +33,13 @@ sub main my $REG_VERSION = '[0-9\.\-]+[a-z]?[0-9\.\-]+?(.alpha|.beta|.gamma|pre\d|[0-9\.\-a-z])?'; my $target; - usage() if (!$ARGV[0] || $opt_help); + if ($opt_version) + { + print "$0 version $VER by Jani Tolonen\n"; + exit(0); + } + usage() if ($opt_help); + print error() if ($#ARGV == -1); `mkdir -p $opt_target`; $pec= $? >> 8; @@ -210,3 +217,16 @@ Options: EOF exit(0); } + +#### +#### error +#### + +sub error +{ + if ($#ARGV == -1) + { + print "Too few arguments to $0!\n"; + } + exit(1); +} diff --git a/Docs/manual.texi b/Docs/manual.texi index 3afb6161a75..dbb6923d3ed 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -7589,7 +7589,7 @@ the DCE libraries while you compile @code{gcc} 2.95! For HPUX Version 11.x we recommend @strong{MySQL} 3.23.15 or later. -If you are using @code{gcc} 2.95.1 on a unpatched HPUX Versiib 11.x system, +If you are using @code{gcc} 2.95.1 on a unpatched HPUX 11.x system, you will get the error: @example @@ -28666,6 +28666,22 @@ shell> myisamchk /path/to/datadir/*/*.MYI * myisamchk other options:: @end menu +Note that if you get an error like: + +@example +myisamchk: warning: 1 clients is using or hasn't closed the table properly +@end example + +This means that you are trying to check a table that has been updated by +the another program (like the mysqld server) that hasn't yet closed +the file or that has died without closing the file properly. + +If you @code{mysqld} is running, you must force a sync/close of all +tables with @code{FLUSH TABLES} and ensure that no one is using the +tables while you are running @code{myisamchk}. In MySQL 3.23 the easiest +way to avoid this problem is to use @code{CHECK TABLE} instead of +@code{myisamchk} to check tables. + @cindex options, @code{myisamchk} @cindex @code{myisamchk}, options @node myisamchk general options, myisamchk check options, myisamchk syntax, myisamchk syntax @@ -38157,6 +38173,8 @@ though, so 3.23 is not released as a stable version yet. Fixed bug where the automatic repair of MyISAM tables failed sometimes when the data file was corrupt. @item +Changed BDB tables to use new compare function in Berkeley DB 3.2.3 +@item You can now use Unix sockets with @code{mit-pthreads} Added the latin5 (turkish) character set @item diff --git a/acinclude.m4 b/acinclude.m4 index 7361acd6bee..c8dab319c99 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -602,7 +602,7 @@ AC_MSG_RESULT($ac_cv_conv_longlong_to_float) dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_CHECK_BDB dnl Sets HAVE_BERKELEY_DB if inst library is found -dnl Makes sure db version is >= 3.1.11 +dnl Makes sure db version is >= 3.2.3 dnl Looks in $srcdir for Berkeley distribution not told otherwise dnl --------------------------------------------------------------------------- @@ -806,15 +806,15 @@ AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [ if test $db_major -gt 3 then bdb_version_ok=yes - elif test $db_major -eq 3 && test $db_minor -gt 1 + elif test $db_major -eq 3 && test $db_minor -gt 2 then bdb_version_ok=yes - elif test $db_major -eq 3 && test $db_minor -eq 1 && test $db_patch -ge 11 + elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -ge 3 then bdb_version_ok=yes else bdb_version_ok="invalid version $db_major.$db_minor.$db_patch" - bdb_version_ok="$bdb_version_ok (must be at least version 3.1.11)" + bdb_version_ok="$bdb_version_ok (must be at least version 3.2.3)" fi ]) diff --git a/include/m_string.h b/include/m_string.h index 6b7719d44f5..ce5197f17af 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -140,7 +140,7 @@ extern void bmove512(gptr dst,const gptr src,uint len); #endif #if !defined(HAVE_BMOVE) && !defined(bmove) -extern void bmove(gptr dst,const char *src,uint len); +extern void bmove(char *dst, const char *src,uint len); #endif extern void bmove_upp(char *dst,const char *src,uint len); diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 2e3df08083d..253abbbcffb 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -290,14 +290,14 @@ int chk_size(MI_CHECK *param, register MI_INFO *info) if (skr > size && skr != size + MEMMAP_EXTRA_MARGIN) { error=1; - mi_check_print_error(param,"Size of datafile is: %-8s Should be: %s", + mi_check_print_error(param,"Size of datafile is: %-9s Should be: %s", llstr(size,buff), llstr(skr,buff2)); param->retry_without_quick=1; /* Don't use quick repair */ } else { mi_check_print_warning(param, - "Size of datafile is: %-8s Should be: %s", + "Size of datafile is: %-9s Should be: %s", llstr(size,buff), llstr(skr,buff2)); } } diff --git a/mysql.proj b/mysql.proj index f8a4ea2d46f4380381d01148299e9c9b1d009760..0cf0074c0483ce0d064c082bf7e3f38a7dcc9533 100644 GIT binary patch delta 742 zcmX|9Ur1A76#ve>S9jg!IoFX(`sbB`MxdMFkU(%f`=I$E^q@|+O1wC0n>fi>FA^nW zT;aZih`}NX*}B9npSF^Mp4ywmq`gQF2`yK?^kCm~^Wg^{=lss^cfQ~EC6o5#s(tBV zGcd*+9K>PcP&pbhJ)2(X>p^SDZ1VjgUG+7t1r!vRBr~>82b_yczdd-yyfm;y&N7Lt zPDVa>TrH4nr0%Y0F-iG<*?3uIe_{bbo6?t1%Q2y3M&S z3#1o|^@e{8lqwBtv?q7rtp0qj)f_FZl8z;Jl|VH@ZXR09p3)}ii@WZVN6RbKW;8w( ziMIPY{CcUZ>e+wwh6*6P8G;vNpaL~5P>#Z|E+|mo9TnUuA1KW-+oPYfOfOZ6E}mgh}zZFeMR5sIB)enh7XFTOfHg0q<#F0-*FrBn8P%#;|e~- zNB98eF^+v4nS39*Lg5?1xE5ofv61lXxE2qEt=KvwAe9ESQ((&ukv()QJ2ctz?z+4P z!NbUy=8cYZ)-kcN?BTU42mbFe`EiG}JPDeVD#Ge1JNrXr`awJNji>XO-qQxXr4=#B`XkTNBY(sQNT64Lrv_RI46a|e= za4sVH18)p-e#8esv3|VJiX2`P zW6a}#9B2*<2YPPbn@)GROhwrk{6&@#Ywd^WQW>DBKn|YHOZ|1!&dErsEUawofFXY=*{wH+1tn8#)UXnNJ z!6UVNnZPTx*#nxoZ1O3PE1ycW&U0j()mNqVwtgOyk%bWw6{4X^n5G@(utOTf8EULh zSf%!K1nmb10egZ&-P1OhqN*van+625sTKk6X=6nys!S?$E_~LsbFI*#wixhXT?wL+ zTw#LGk^MFVt)oE@eji(+5`Cv{^pR%i6+Ndh8dd&ocue;EVc6alWRa7hh#3o|h7u-Y zXQIhe|G-cv8t-G3&)jiVo;+MZm5xIikh5X0i>187-nFXb^x|G_?OyUZLC3f?v8+jR z`69QD{H?KCOS+uTzKD4$oQ|c|5}Jd3v2?^#data); ulonglong b=uint5korr((char*) saved_key->data); @@ -211,9 +211,9 @@ berkeley_cmp_hidden_key(const DBT *new_key, const DBT *saved_key) } static int -berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key) +berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key) { - KEY *key= (KEY*) new_key->app_private; + KEY *key= (KEY*) BT_APP_PRIVATE(file); char *new_key_ptr= (char*) new_key->data; char *saved_key_ptr=(char*) saved_key->data; KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts; @@ -242,9 +242,9 @@ berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key) /* The following is not yet used; Should be used for fixed length keys */ static int -berkeley_cmp_fix_length_key(const DBT *new_key, const DBT *saved_key) +berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key) { - KEY *key=(KEY*) (new_key->app_private); + KEY *key=(KEY*) BT_APP_PRIVATE(file); char *new_key_ptr= (char*) new_key->data; char *saved_key_ptr=(char*) saved_key->data; KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts; @@ -321,6 +321,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) file->set_bt_compare(file, (hidden_primary_key ? berkeley_cmp_hidden_key : berkeley_cmp_packed_key)); + if (!hidden_primary_key) + file->set_bt_app_private(file,table->key_info+table->primary_key); if ((error=(file->open(file, fn_format(name_buff,name,"", ha_berkeley_ext, 2 | 4), "main", DB_BTREE, open_mode,0)))) @@ -359,6 +361,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) sprintf(part,"key%02d",++used_keys); key_type[i]=table->key_info[i].flags & HA_NOSAME ? DB_NOOVERWRITE : 0; (*ptr)->set_bt_compare(*ptr, berkeley_cmp_packed_key); + (*ptr)->set_bt_app_private(*ptr,table->key_info+i); if (!(table->key_info[i].flags & HA_NOSAME)) (*ptr)->set_flags(*ptr, DB_DUP); if ((error=((*ptr)->open(*ptr, name_buff, part, DB_BTREE, @@ -561,7 +564,6 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff, DBUG_ENTER("pack_key"); key->data=buff; - key->app_private= key_info; for ( ; key_part != end ; key_part++) { @@ -599,7 +601,6 @@ DBT *ha_berkeley::pack_key(DBT *key, uint keynr, char *buff, bzero((char*) key,sizeof(*key)); key->data=buff; - key->app_private= key_info; for (; key_part != end && (int) key_length > 0 ; key_part++) { @@ -1055,7 +1056,6 @@ int ha_berkeley::read_row(int error, char *buf, uint keynr, DBT *row, bzero((char*) &key,sizeof(key)); key.data=key_buff2; key.size=row->size; - key.app_private=table->key_info+primary_key; memcpy(key_buff2,row->data,row->size); /* Read the data into current_row */ current_row.flags=DB_DBT_REALLOC; @@ -1092,10 +1092,12 @@ int ha_berkeley::index_read(byte * buf, const byte * key, { DBT row; int error; + KEY *key_info= &table->key_info[active_index]; DBUG_ENTER("index_read"); + statistic_increment(ha_read_key_count,&LOCK_status); bzero((char*) &row,sizeof(row)); - if (key_len == table->key_info[active_index].key_length) + if (key_len == key_info->key_length) { error=read_row(cursor->c_get(cursor, pack_key(&last_key, active_index, @@ -1110,10 +1112,10 @@ int ha_berkeley::index_read(byte * buf, const byte * key, pack_key(&last_key, active_index, key_buff, key, key_len); /* Store for compare */ memcpy(key_buff2, key_buff, last_key.size); - ((KEY*) last_key.app_private)->handler.bdb_return_if_eq= -1; + key_info->handler.bdb_return_if_eq= -1; error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE), buf, active_index, &row, (DBT*) 0, 0); - ((KEY*) last_key.app_private)->handler.bdb_return_if_eq=0; + key_info->handler.bdb_return_if_eq= 0; if (!error && find_flag == HA_READ_KEY_EXACT) { /* Check that we didn't find a key that wasn't equal to the current @@ -1215,7 +1217,6 @@ DBT *ha_berkeley::get_pos(DBT *to, byte *pos) bzero((char*) to,sizeof(*to)); to->data=pos; - to->app_private=table->key_info+primary_key; if (fixed_length_primary_key) to->size=ref_length; else diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4cdfc992e19..d97a59cb898 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3905,12 +3905,16 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) if (error == -3) error=0; /* select_limit used */ } - if (!table) + if (!table) /* If sending data to client */ { if (error < 0) - join->result->send_error(0,NullS); /* purecov: inspected */ - else if (join->result->send_eof()) - error= -1; + join->result->send_error(0,NullS); /* purecov: inspected */ + else + { + join_free(join); // Unlock all cursors + if (join->result->send_eof()) + error= -1; + } } else if (error < 0) join->result->send_error(0,NullS); /* purecov: inspected */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8c3c5dc6bf5..eb7e1455297 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -718,17 +718,16 @@ store_create_info(THD *thd, TABLE *table, String *packet) field->sql_type(type); packet->append(type.ptr(),type.length()); - bool null_default_value = (field->type() == FIELD_TYPE_TIMESTAMP || - field->unireg_check == Field::NEXT_NUMBER); - bool has_default = (field->type() != FIELD_TYPE_BLOB); + bool has_default = (field->type() != FIELD_TYPE_BLOB && + field->type() != FIELD_TYPE_TIMESTAMP && + field->unireg_check != Field::NEXT_NUMBER); + if (flags & NOT_NULL_FLAG) + packet->append(" NOT NULL", 9); - if((flags & NOT_NULL_FLAG) && !null_default_value) - packet->append(" NOT NULL", 9); - - if(has_default) + if (has_default) { packet->append(" default ", 9); - if (!null_default_value && !field->is_null()) + if (!field->is_null()) { // Not null by default type.set(tmp,sizeof(tmp)); field->val_str(&type,&type); @@ -736,7 +735,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(type.ptr(),type.length()); packet->append('\''); } - else if (field->maybe_null() || null_default_value) + else if (field->maybe_null()) packet->append("NULL", 4); // Null as default else packet->append(tmp,0); diff --git a/strings/bmove.c b/strings/bmove.c index 096a6282609..f63ff0bd4f8 100644 --- a/strings/bmove.c +++ b/strings/bmove.c @@ -52,7 +52,7 @@ asm(".L5: "); #else void bmove(dst, src, len) -register byte *dst; +register char *dst; register const char *src; register uint len; { From 08dc21df3ad57f782bce0b7277900e880415a0a5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Oct 2000 03:55:04 +0300 Subject: [PATCH 08/10] Fix for new berkeley DB interface Docs/manual.texi: Update for 3.23.27 --- Docs/manual.texi | 2 ++ sql/ha_berkeley.cc | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index dbb6923d3ed..510c2b45317 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -38173,6 +38173,8 @@ though, so 3.23 is not released as a stable version yet. Fixed bug where the automatic repair of MyISAM tables failed sometimes when the data file was corrupt. @item +Fixed a bug in @code{SHOW CREATE} when using auto_increment columns. +@item Changed BDB tables to use new compare function in Berkeley DB 3.2.3 @item You can now use Unix sockets with @code{mit-pthreads} diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index bf993c39a20..06d0927854f 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -213,7 +213,7 @@ berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key) static int berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key) { - KEY *key= (KEY*) BT_APP_PRIVATE(file); + KEY *key= (KEY*) (file->app_private); char *new_key_ptr= (char*) new_key->data; char *saved_key_ptr=(char*) saved_key->data; KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts; @@ -244,7 +244,7 @@ berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key) static int berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key) { - KEY *key=(KEY*) BT_APP_PRIVATE(file); + KEY *key=(KEY*) (file->app_private); char *new_key_ptr= (char*) new_key->data; char *saved_key_ptr=(char*) saved_key->data; KEY_PART_INFO *key_part= key->key_part, *end=key_part+key->key_parts; @@ -322,7 +322,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) (hidden_primary_key ? berkeley_cmp_hidden_key : berkeley_cmp_packed_key)); if (!hidden_primary_key) - file->set_bt_app_private(file,table->key_info+table->primary_key); + file->app_private= (void*) (table->key_info+table->primary_key); if ((error=(file->open(file, fn_format(name_buff,name,"", ha_berkeley_ext, 2 | 4), "main", DB_BTREE, open_mode,0)))) @@ -361,7 +361,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) sprintf(part,"key%02d",++used_keys); key_type[i]=table->key_info[i].flags & HA_NOSAME ? DB_NOOVERWRITE : 0; (*ptr)->set_bt_compare(*ptr, berkeley_cmp_packed_key); - (*ptr)->set_bt_app_private(*ptr,table->key_info+i); + (*ptr)->app_private= (void*) (table->key_info+i); if (!(table->key_info[i].flags & HA_NOSAME)) (*ptr)->set_flags(*ptr, DB_DUP); if ((error=((*ptr)->open(*ptr, name_buff, part, DB_BTREE, From 68d4984b877ca071fee279178bf472ee522a55ee Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Oct 2000 18:02:47 -0400 Subject: [PATCH 09/10] manual.texi Add warning about too-high table_cache value Docs/manual.texi: Add warning about too-high table_cache value --- Docs/manual.texi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Docs/manual.texi b/Docs/manual.texi index 510c2b45317..422d397ba47 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -20067,6 +20067,11 @@ variable. @xref{SHOW}. If this variable is big and you don't do @code{FLUSH TABLES} a lot (which just forces all tables to be closed and reopenend), then you should increase the value of this variable. +Make sure that your operating system can handle the number of open file +descriptors implied by the @code{table_cache} setting. If @code{table_cache} +is set too high, @strong{MySQL} may run out of file descriptors and refuse +connections, fail to perform queries, and be very unreliable. + For information about how the table cache works, see @ref{Table cache}. @item @code{thread_cache_size} From 5aacf92e2215cc40a8d8934fe7376180fe30ee10 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Oct 2000 01:50:46 +0300 Subject: [PATCH 10/10] Added bdb_lock_max and fixed bug in BDB tables when using key parts Docs/Makefile.am: Don't try to get the manual from SCCS Docs/manual.texi: Added bdb_lock_max + some information about Linux and big files myisam/myisamchk.c: Code cleanup mysql.proj: updated sql/field.cc: Added compare of packed BDB key sql/field.h: Added compare of packed BDB key sql/ha_berkeley.cc: Added compare of packed BDB keys and bdb_lock_max variable sql/ha_berkeley.h: Added bdb_lock_max variable sql/key.cc: cleanup sql/mysqld.cc: Added bdb_lock_max --- Docs/Makefile.am | 3 +++ Docs/manual.texi | 35 ++++++++++++++++++++---- myisam/myisamchk.c | 1 - mysql.proj | Bin 167936 -> 176128 bytes sql/field.cc | 65 +++++++++++++++++++++++++++++++++++++++++++++ sql/field.h | 5 ++++ sql/ha_berkeley.cc | 47 ++++++++++++++++++++++++++++---- sql/ha_berkeley.h | 2 +- sql/key.cc | 2 +- sql/mysqld.cc | 3 +++ 10 files changed, 150 insertions(+), 13 deletions(-) diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 0fe0ab3a56d..2840bdae38d 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -139,3 +139,6 @@ INSTALL-BINARY: mysql.info $(GT) ../MIRRORS: manual.texi $(srcdir)/Support/generate-mirror-listing.pl perl -w $(srcdir)/Support/generate-mirror-listing.pl manual.texi > $@ + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/Docs/manual.texi b/Docs/manual.texi index 510c2b45317..821a3516816 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -813,6 +813,7 @@ MySQL change history Changes in release 3.23.x (Recommended; beta) +* News-3.23.28:: * News-3.23.27:: Changes in release 3.23.27 * News-3.23.26:: Changes in release 3.23.26 * News-3.23.25:: Changes in release 3.23.25 @@ -19862,6 +19863,13 @@ The buffer that is allocated to cache index and rows for @code{BDB} tables. If you don't use @code{BDB} tables, you should set this to 0 or start @code{mysqld} with @code{--skip-bdb} o not waste memory for this cache. +@item @code{bdb_lock_max} +The maximum number of locks (1000 by default) you can have active on a BDB +table. You should increase this if you get errors of type +@code{bdb: Lock table is out of available locks} when you have do long +transactions or when mysqld has to examine a lot of rows to calculate +the query. + @item @code{concurrent_inserts} If @code{ON} (the default), @strong{MySQL} will allow you to use @code{INSERT} on @code{MyISAM} tables at the same time as you run @code{SELECT} queries @@ -24669,7 +24677,7 @@ limits. Here are some examples: @multitable @columnfractions .5 .5 @item @strong{Operating System} @tab @strong{File Size Limit} -@item Linux-Intel @tab 2G (or 4G with reiserfs) +@item Linux-Intel 32 bit@tab 2G, 4G or bigger depending on Linux version @item Linux-Alpha @tab 8T (?) @item Solaris 2.5.1 @tab 2G (possible 4G with patch) @item Solaris 2.6 @tab 4G @@ -24677,6 +24685,10 @@ limits. Here are some examples: @item Solaris 2.7 ULTRA-SPARC @tab 8T (?) @end multitable +On Linux 2.2 you can get bigger tables than 2G by using the LFS patch for +the ext2 file system. On Linux 2.4 there exists also patches for ReiserFS +to get support for big files. + This means that the table size for @strong{MySQL} is normally limited by the operating system. @@ -24690,14 +24702,15 @@ this), you should set the @code{AVG_ROW_LENGTH} and @code{MAX_ROWS} parameter when you create your table. @xref{CREATE TABLE}. You can also set these later with @code{ALTER TABLE}. @xref{ALTER TABLE}. -If you need to have bigger tables than 2G / 4G - If your big table is going to be read-only, you could use @code{myisampack} to merge and compress many tables to one. @code{myisampack} usually compresses a table by at least 50%, so you can have, in effect, much bigger tables. @xref{myisampack, , @code{myisampack}}. +You can go around the operating system file limit for @code{MyISAM} data +files by using the @code{RAID} option. @xref{CREATE TABLE}. + Another solution can be the included MERGE library, which allows you to handle a collection of identical tables as one. @xref{MERGE, MERGE tables}. @@ -25430,7 +25443,9 @@ multiple CPU machines one should use Solaris (because the threads works really nice) or Linux (because the 2.2 kernel has really good SMP support). Also on 32bit machines Linux has a 2G file size limit by default. Hopefully this will be fixed soon when new filesystems is -released (XFS/Reiserfs). +released (XFS/Reiserfs). If you have a desperate need for files bigger +tan 2G on Linux-intel 32 bit, you should get the LFS patch for the ext2 +file system. Because we have not run @strong{MySQL} in production on that many platforms we advice you to test your intended platform before choosing it, if possible. @@ -38136,6 +38151,7 @@ version. The replication and BerkeleyDB code is still under development, though, so 3.23 is not released as a stable version yet. @menu +* News-3.23.28:: Changes in release 3.23.28 * News-3.23.27:: Changes in release 3.23.27 * News-3.23.26:: Changes in release 3.23.26 * News-3.23.25:: Changes in release 3.23.25 @@ -38166,7 +38182,16 @@ though, so 3.23 is not released as a stable version yet. * News-3.23.0:: Changes in release 3.23.0 @end menu -@node News-3.23.27, News-3.23.26, News-3.23.x, News-3.23.x +@node News-3.23.28, News-3.23.27, News-3.23.x, News-3.23.x +@appendixsubsec Changes in release 3.23.28 +@itemize @bullet +@item +Fixed bug in a BDB key compare function when comparing part keys. +@item +Added variable @code{bdb_lock_max} to @code{mysqld}. +@end itemize + +@node News-3.23.27, News-3.23.26, News-3.23.28, News-3.23.x @appendixsubsec Changes in release 3.23.27 @itemize @bullet @item diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 29259d15c1a..b18f42bfb81 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -1378,7 +1378,6 @@ void mi_check_print_info(MI_CHECK *param __attribute__((unused)), VOID(vfprintf(stdout, fmt, args)); VOID(fputc('\n',stdout)); va_end(args); - return; } /* VARARGS */ diff --git a/mysql.proj b/mysql.proj index 0cf0074c0483ce0d064c082bf7e3f38a7dcc9533..ed591da265ee8875cf3d835040d3998ddee73b58 100644 GIT binary patch delta 8336 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 ptr && end[-1] == ' ') + end--; + uint a_length = (uint) (end - ptr); + + if (binary_flag) + { + int cmp= memcmp(ptr,b,min(a_length,b_length)); + return cmp ? cmp : (int) (a_length - b_length); + } + return my_sortncmp(ptr,a_length, b, b_length); +} + + uint Field_string::packed_col_length(const char *ptr) { if (field_length > 255) @@ -3637,6 +3654,27 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length) return my_sortncmp(a,a_length, b,b_length); } +int Field_varstring::pack_cmp(const char *b, uint key_length) +{ + char *a=ptr+2; + uint a_length=uint2korr(ptr); + uint b_length; + if (key_length > 255) + { + b_length=uint2korr(b); b+=2; + } + else + { + b_length= (uint) (uchar) *b++; + } + if (binary_flag) + { + int cmp= memcmp(a,b,min(a_length,b_length)); + return cmp ? cmp : (int) (a_length - b_length); + } + return my_sortncmp(a,a_length, b,b_length); +} + uint Field_varstring::packed_col_length(const char *ptr) { if (field_length > 255) @@ -4019,6 +4057,33 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length) return my_sortncmp(a,a_length, b,b_length); } + +int Field_blob::pack_cmp(const char *b, uint key_length) +{ + char *a; + memcpy_fixed(&a,ptr+packlength,sizeof(char*)); + if (!a) + return key_length > 0 ? -1 : 0; + uint a_length=get_length(ptr); + uint b_length; + + if (key_length > 255) + { + b_length=uint2korr(b); b+=2; + } + else + { + b_length= (uint) (uchar) *b++; + } + if (binary_flag) + { + int cmp= memcmp(a,b,min(a_length,b_length)); + return cmp ? cmp : (int) (a_length - b_length); + } + return my_sortncmp(a,a_length, b,b_length); +} + + char *Field_blob::pack_key(char *to, const char *from, uint max_length) { uint length=uint2korr(to); diff --git a/sql/field.h b/sql/field.h index f8ba329375b..4af7c17486a 100644 --- a/sql/field.h +++ b/sql/field.h @@ -177,6 +177,8 @@ public: virtual int pack_cmp(const char *a,const char *b, uint key_length_arg) { return cmp(a,b); } + virtual int pack_cmp(const char *b, uint key_length_arg) + { return cmp(ptr,b); } uint offset(); // Should be inline ... void copy_from_tmp(int offset); uint fill_cache_field(struct st_cache_field *copy); @@ -726,6 +728,7 @@ public: char *pack(char *to, const char *from, uint max_length=~(uint) 0); const char *unpack(char* to, const char *from); int pack_cmp(const char *a,const char *b,uint key_length); + int pack_cmp(const char *b,uint key_length); uint packed_col_length(const char *to); uint max_packed_col_length(uint max_length); uint size_of() const { return sizeof(*this); } @@ -777,6 +780,7 @@ public: char *pack(char *to, const char *from, uint max_length=~(uint) 0); const char *unpack(char* to, const char *from); int pack_cmp(const char *a, const char *b, uint key_length); + int pack_cmp(const char *b, uint key_length); uint packed_col_length(const char *to); uint max_packed_col_length(uint max_length); uint size_of() const { return sizeof(*this); } @@ -891,6 +895,7 @@ public: } char *pack_key(char *to, const char *from, uint max_length=~(uint) 0); int pack_cmp(const char *a, const char *b, uint key_length); + int pack_cmp(const char *b, uint key_length); uint packed_col_length(const char *col_ptr) { return get_length(col_ptr)+packlength;} virtual uint max_packed_col_length(uint max_length) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 06d0927854f..1239c7db7d3 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -68,6 +68,7 @@ ulong berkeley_cache_size; char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; long berkeley_lock_scan_time=0; ulong berkeley_trans_retry=5; +ulong berkeley_lock_max; pthread_mutex_t bdb_mutex; static DB_ENV *db_env; @@ -116,6 +117,8 @@ bool berkeley_init(void) db_env->set_cachesize(db_env, 0, berkeley_cache_size, 0); db_env->set_lk_detect(db_env, berkeley_lock_type); + if (berkeley_lock_max) + db_env->set_lk_max(db_env, berkeley_lock_max); if (db_env->open(db_env, berkeley_home, berkeley_init_flags | DB_INIT_LOCK | @@ -224,8 +227,13 @@ berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key) int cmp; if (key_part->null_bit) { - if (*new_key_ptr++ != *saved_key_ptr++) - return ((int) new_key_ptr[-1] - (int) saved_key_ptr[-1]); + if (*new_key_ptr != *saved_key_ptr++) + return ((int) *new_key_ptr - (int) saved_key_ptr[-1]); + if (!*new_key_ptr++) + { + key_length--; + continue; + } } if ((cmp=key_part->field->pack_cmp(new_key_ptr,saved_key_ptr, key_part->length))) @@ -263,6 +271,36 @@ berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key) } +/* Compare key against row */ + +static bool +berkeley_key_cmp(TABLE *table, KEY *key_info, const char *key, uint key_length) +{ + KEY_PART_INFO *key_part= key_info->key_part, + *end=key_part+key_info->key_parts; + + for ( ; key_part != end && (int) key_length > 0; key_part++) + { + int cmp; + if (key_part->null_bit) + { + key_length--; + if (*key != (table->record[0][key_part->null_offset] & + key_part->null_bit) ? 0 : 1) + return 1; + if (!*key++) // Null value + continue; + } + if ((cmp=key_part->field->pack_cmp(key,key_part->length))) + return cmp; + uint length=key_part->field->packed_col_length(key); + key+=length; + key_length-=length; + } + return 0; +} + + int ha_berkeley::open(const char *name, int mode, uint test_if_locked) { char name_buff[FN_REFLEN]; @@ -1118,9 +1156,8 @@ int ha_berkeley::index_read(byte * buf, const byte * key, key_info->handler.bdb_return_if_eq= 0; if (!error && find_flag == HA_READ_KEY_EXACT) { - /* Check that we didn't find a key that wasn't equal to the current - one */ - if (!error && ::key_cmp(table, key_buff2, active_index, key_len)) + /* Ensure that we found a key that is equal to the current one */ + if (!error && berkeley_key_cmp(table, key_info, key_buff2, key_len)) error=HA_ERR_KEY_NOT_FOUND; } } diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index b44b112b0ed..84061ae09be 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -147,7 +147,7 @@ class ha_berkeley: public handler extern bool berkeley_skip; extern u_int32_t berkeley_init_flags,berkeley_lock_type,berkeley_lock_types[]; -extern ulong berkeley_cache_size; +extern ulong berkeley_cache_size, berkeley_lock_max; extern char *berkeley_home, *berkeley_tmpdir, *berkeley_logdir; extern long berkeley_lock_scan_time; extern TYPELIB berkeley_lock_typelib; diff --git a/sql/key.cc b/sql/key.cc index 8678202922e..87595fda06d 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -171,7 +171,7 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length) { key_length--; if (*key != test(table->record[0][key_part->null_offset] & - key_part->null_bit)) + key_part->null_bit)) return 1; if (*key) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7e156077723..6cb24de17c5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2333,6 +2333,8 @@ CHANGEABLE_VAR changeable_vars[] = { #ifdef HAVE_BERKELEY_DB { "bdb_cache_size", (long*) &berkeley_cache_size, KEY_CACHE_SIZE, 20*1024, (long) ~0, 0, IO_SIZE }, + { "bdb_lock_max", (long*) &berkeley_lock_max, + 1000, 0, (long) ~0, 0, 1 }, #endif { "connect_timeout", (long*) &connect_timeout, CONNECT_TIMEOUT, 2, 65535, 0, 1 }, @@ -2413,6 +2415,7 @@ struct show_var_st init_vars[]= { #ifdef HAVE_BERKELEY_DB {"bdb_cache_size", (char*) &berkeley_cache_size, SHOW_LONG}, {"bdb_home", (char*) &berkeley_home, SHOW_CHAR_PTR}, + {"bdb_lock_max", (char*) &berkeley_lock_max, SHOW_LONG}, {"bdb_logdir", (char*) &berkeley_logdir, SHOW_CHAR_PTR}, {"bdb_tmpdir", (char*) &berkeley_tmpdir, SHOW_CHAR_PTR}, #endif