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/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 7fb48eff205..a0e2c737434 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,5 +1,5 @@ monty@donna.mysql.com mwagner@evoq.home.mwagner.org +paul@central.snake.net sasha@mysql.sashanet.com serg@serg.mysql.com -paul@central.snake.net 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/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 654cb986392..f82b6858385 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,8 @@ 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 * News-3.23.24:: Changes in release 3.23.24 @@ -838,7 +840,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 +954,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 +5886,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 +6222,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 +6666,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 @@ -7598,7 +7590,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 @@ -7732,7 +7724,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 @@ -9490,7 +9482,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 @@ -18137,7 +18130,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 @@ -18164,6 +18157,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 @@ -19525,13 +19523,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} @@ -19865,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 @@ -20010,8 +20015,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 @@ -20069,6 +20075,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} @@ -21358,7 +21369,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 @@ -21496,6 +21507,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 @@ -24655,7 +24682,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 @@ -24663,6 +24690,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. @@ -24676,14 +24707,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}. @@ -25416,7 +25448,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. @@ -26422,7 +26456,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 @@ -28646,12 +28680,28 @@ 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 +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 @@ -31001,8 +31051,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: @@ -31134,7 +31185,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 @@ -32224,7 +32275,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 @@ -33602,7 +33653,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: @@ -38103,6 +38156,8 @@ 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 * News-3.23.24:: Changes in release 3.23.24 @@ -38132,7 +38187,33 @@ 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.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 +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} +Added the latin5 (turkish) character set +@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 @@ -38202,7 +38283,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 @@ -42513,7 +42595,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 @@ -42546,9 +42628,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 @@ -42902,7 +42983,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/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/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/configure.in b/configure.in index efb746fffdc..bd78c787189 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 @@ -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"]) @@ -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 - # MIT pthreads does not support connecting with unix sockets - AC_DEFINE(HAVE_THREADS_WITHOUT_SOCKETS) -fi +#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 # Some usefull subst AC_SUBST(CC) diff --git a/include/m_string.h b/include/m_string.h index c17e928ea37..ce5197f17af 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 @@ -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/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/myisam/mi_check.c b/myisam/mi_check.c index e55065b795e..253abbbcffb 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); @@ -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 + 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)); } } @@ -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..b18f42bfb81 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); } @@ -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/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/mysql.proj b/mysql.proj index f8a4ea2d46f..ed591da265e 100644 Binary files a/mysql.proj and b/mysql.proj differ 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/field.cc b/sql/field.cc index 459c53ffcb1..639c2def068 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3439,6 +3439,23 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length) } +int Field_string::pack_cmp(const char *b, uint length) +{ + uint b_length= (uint) (uchar) *b++; + char *end= ptr + field_length; + while (end > 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 274d9164a9b..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 | @@ -203,7 +206,7 @@ const char **ha_berkeley::bas_ext() const static int -berkeley_cmp_hidden_key(const DBT *new_key, const DBT *saved_key) +berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key) { ulonglong a=uint5korr((char*) new_key->data); ulonglong b=uint5korr((char*) saved_key->data); @@ -211,9 +214,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*) (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; @@ -224,8 +227,13 @@ berkeley_cmp_packed_key(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))) @@ -242,9 +250,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*) (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; @@ -263,6 +271,36 @@ berkeley_cmp_fix_length_key(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]; @@ -321,6 +359,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->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)))) @@ -359,6 +399,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)->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, @@ -561,7 +602,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 +639,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 +1094,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 +1130,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,15 +1150,14 @@ 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 - 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; } } @@ -1215,7 +1254,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/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/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/handler.h b/sql/handler.h index 269f60eec16..b7872ead98a 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, @@ -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/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/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/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/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/mysqld.cc b/sql/mysqld.cc index 5f15ca9794a..6cb24de17c5 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 */ @@ -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 @@ -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 @@ -2694,7 +2697,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/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 diff --git a/sql/slave.cc b/sql/slave.cc index a267421a3bd..676c80bb04a 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) @@ -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 } @@ -986,5 +988,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 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..d97a59cb898 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; @@ -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 */ @@ -4196,7 +4200,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 +4235,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 +4259,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 +4291,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 +4369,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 +4401,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 +4419,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 +4445,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 +4458,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 +4476,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; } 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/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/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 {} 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) 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; {