Update to new root alloc, OPTIMIZE TABLE and some other changes

Docs/manual.texi:
  Added chapter for binary log, updated the changelog, linux section, OPTIMIZE TABLE...
client/mysqladmin.c:
  Fixed bug with pid-file handling.
client/mysqldump.c:
  Version change
configure.in:
  Version change
include/Makefile.am:
  Fix for SCO to get sched.h removed.
include/global.h:
  Increased MY_NFILE;  Added thread_safe_increment
include/my_sys.h:
  Better root_alloc
include/mysql.h:
  Better root_alloc
include/mysys_err.h:
  Fix for PREAD/PWRITE on windows
libmysql/libmysql.c:
  Better root_alloc
myisam/mi_locking.c:
  Fix for PREAD/PWRITE on windows
myisam/mi_static.c:
  Fix for PREAD/PWRITE on windows
mysys/default.c:
  Better root_alloc
mysys/errors.c:
  Fix for PREAD/PWRITE on windows
mysys/my_alloc.c:
  Better root_alloc
mysys/my_create.c:
  Fix for PREAD/PWRITE on windows
mysys/my_fopen.c:
  Fix for PREAD/PWRITE on windows
mysys/my_open.c:
  Fix for PREAD/PWRITE on windows
mysys/my_pread.c:
  Fix for PREAD/PWRITE on windows
mysys/tree.c:
  Better root_alloc
readline/bind.c:
  Removed compiler warning
readline/isearch.c:
  Removed compiler warning
scripts/safe_mysqld.sh:
  Allow use of MYSQL_UNIX_PORT and MYSQL_TCP_PORT
sql-bench/crash-me.sh:
  Version change
sql-bench/limits/mysql-3.23.cfg:
  Update to latest MySQL version
sql/filesort.cc:
  Added more statistics
sql/ha_berkeley.h:
  Fixed bug with ORDER BY
sql/ha_myisam.cc:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/ha_myisam.h:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/handler.cc:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/handler.h:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/item_func.cc:
  Fixed comment
sql/item_timefunc.cc:
  Fixed possible month bug
sql/mini_client.cc:
  Use of new root_alloc
sql/mysql_priv.h:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/mysqld.cc:
  Added more statistics
sql/opt_range.cc:
  Use of new root_alloc
sql/slave.cc:
  Use of new root_alloc
sql/sql_acl.cc:
  Use of new root_alloc
sql/sql_class.cc:
  Use of new root_alloc
sql/sql_parse.cc:
  Use of new root_alloc
sql/sql_select.cc:
  Added more statistics
sql/sql_table.cc:
  Added OPTIMIZE TABLE and cleaned up the repair code
sql/sql_udf.cc:
  Use of new root_alloc
sql/sql_yacc.yy:
  Fixed that OPTIMIZE TABLE can take many tables as arguments
sql/table.cc:
  Use of new root_alloc
sql/thr_malloc.cc:
  Use of new root_alloc
support-files/mysql.server.sh:
  Removed usage of AWK
This commit is contained in:
unknown 2000-09-12 03:02:33 +03:00
parent 1dc6a46936
commit fe4cccd6a4
49 changed files with 39374 additions and 487 deletions

38699
Docs/manual.ja.texi Normal file

File diff suppressed because it is too large Load diff

View file

@ -338,7 +338,7 @@ MySQL language reference
* LOAD DATA:: @code{LOAD DATA INFILE} syntax
* UPDATE:: @code{UPDATE} syntax
* USE:: @code{USE} syntax
* FLUSH:: @code{FLUSH} syntax (clearing caches)
* FLUSH:: @code{Flush} syntax (clearing caches)
* KILL:: @code{KILL} syntax
* SHOW:: @code{SHOW} syntax (Get information about tables, columns, ...)
* EXPLAIN:: @code{EXPLAIN} syntax (Get information about a @code{SELECT})
@ -418,7 +418,7 @@ Functions for use in @code{SELECT} and @code{WHERE} clauses
* SHOW VARIABLES::
* SHOW PROCESSLIST::
* SHOW GRANTS::
* SHOW CREATE TABLE::
* SHOW CREATE TABLE::
MySQL table types
@ -644,6 +644,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::
* 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
@ -653,6 +654,7 @@ Solving some common problems with MySQL
* Log Replication:: Database replication with update log
* Backup:: Database backups
* Update log:: The update log
* Binary log::
* Slow query log:: Log of slow queries
* Multiple servers:: Running multiple @strong{MySQL} servers on the same machine
@ -764,8 +766,9 @@ MySQL change history
* News-3.20.x:: Changes in release 3.20.x
* News-3.19.x:: Changes in release 3.19.x
Changes in release 3.23.x (Released as beta)
Changes in release 3.23.x (Recommended; beta)
* News-3.23.25:: Changes in release 3.23.25
* News-3.23.24:: Changes in release 3.23.24
* News-3.23.23:: Changes in release 3.23.23
* News-3.23.22:: Changes in release 3.23.22
@ -6014,6 +6017,16 @@ patch could do - use at your own risk. We have also been told by the
Linux kernel developers that this problem is fixed in 2.4, although we
have not yet done any testing.
The current implementation of mutex in Linuxthreads is also very bad for
programs with many threads that only holds the mutex for a short time.
We have made a patch availlable for glibc 2.1,
@uref{http://www.mysql.com/Downloads/Linux/linuxthreads-2.1-patch,linuxthreads-2.1-patch}
and for glibc 2.2,
@uref{http://www.mysql.com/Downloads/Linux/linuxthreads-2.2-patch,linuxthreads-2.2-patch}.
If you apply the patches, you are doing this at your own risk; We can
only say that they appear to work excellent for us!.
If you can't start @code{mysqld} or if @code{mysql_install_db} doesn't work,
please continue reading! This only happens on Linux system with problems in
the LinuxThreads or @code{libc}/@code{glibc} libraries. There are a lot of
@ -7520,11 +7533,10 @@ a new thread! WinNT and Win98 don't suffer from this bug.
@item Concurrent reads
@strong{MySQL} depends on the @code{pread()} and @code{pwrite()} calls to be
able to mix @code{INSERT} and @code{SELECT}. As windows doesn't support these
calls, @strong{MySQL} can't currently handle concurrent reads on windows.
We plan to fix this by adding an extra mutex to each open file and simulate
@code{pread()}/@code{pwrite()}.
able to mix @code{INSERT} and @code{SELECT}. Currently we use mutexes
to emulate @code{pread()}/@code{pwrite()}. We will in the long run
replace the file level interface with a virtual interface so that we can
use the @code{readfile()}/@code{writefile()} interface on NT to get more speed.
@item Blocking read
@strong{MySQL} uses a blocking read for each connection.
This means that:
@ -8808,11 +8820,16 @@ table to a @code{MyISAM} table with @code{ALTER TABLE} or the Perl script
The following lists tell what you have to watch out for when upgrading to 3.23:
@itemize @bullet
@item @strong{MySQL} client 'mysql' now starts with option --no-named-commands
(-g) by default. This option can be disabled with --enable-named-commands
(-G). This may cause incompatibility problems in some cases, for example
in SQL scripts that use named commands without a semicolon, etc. !
Long format commands still work from the first line.
@item
@code{OPTIMIZE TABLE} now only works for @strong{MyISAM} tables.
For other table types, you can use @code{ALTER TABLE} to optimize the table.
During @code{OPTIMIZE TABLE} the table is now locked from other threads.
@item
The @strong{MySQL} client @code{mysql} is now by default started with the
option @code{--no-named-commands (-g)}. This option can be disabled with
@code{--enable-named-commands (-G)}. This may cause incompatibility problems in
some cases, for example in SQL scripts that use named commands without a
semicolon! Long format commands still work from the first line.
@item
If you are using the @code{german} character sort order, you must repair
all your tables with @code{isamchk -r}, as we have made some changes in
@ -9208,8 +9225,8 @@ Use of @code{LOAD DATA INFILE}. In many cases, this syntax is compatible with
Oracle's @code{LOAD DATA INFILE}. @xref{LOAD DATA, , @code{LOAD DATA}}.
@item
The @code{OPTIMIZE TABLE} statement.
@xref{OPTIMIZE TABLE, , @code{OPTIMIZE TABLE}}.
The @code{ANALYZE TABLE}, @code{CHECK TABLE}, @code{OPTIMIZE TABLE} and
@code{REPAIR TABLE} statements.
@item
The @code{SHOW} statement.
@ -11214,6 +11231,11 @@ Another way to set the password is by using the @code{mysqladmin} command:
shell> mysqladmin -u root password new_password
@end example
Only user with write/update access to the mysql database can change the
password for others user. All normal users (not anonymous ones) can only
change his own password with either of the above commands or with
@code{SET PASSWORD PASSWORD('new password')}
Note that if you update the password in the @code{user} table directly using
the first method, you must tell the server to reread the grant tables (with
@code{FLUSH PRIVILEGES}), because the change will go unnoticed otherwise.
@ -12411,6 +12433,9 @@ recent operation if you don't give it a value yourself. You can also set it
to the current date and time by assigning it a @code{NULL} value. @xref{Date
and time types}.
A @code{TIMESTAMP} is always stored in 4 bytes; The @code{M} argument only
affects how the @code{TIMESTAMP} column is displayed.
Note that @code{TIMESTAMP(X)} columns where X is 8 or 14 are reported to
be numbers while other @code{TIMESTAMP(X)} columns are reported to be
strings. This is just to ensure that one can reliable dump and restore
@ -17030,7 +17055,7 @@ prevent an error from occurring for tables that don't exist.
@section @code{OPTIMIZE TABLE} syntax
@example
OPTIMIZE TABLE tbl_name
OPTIMIZE TABLE tbl_name[,tbl_name]...
@end example
@code{OPTIMIZE TABLE} should be used if you have deleted a large part of a
@ -17040,17 +17065,28 @@ Deleted records are maintained in a linked list and subsequent @code{INSERT}
operations reuse old record positions. You can use @code{OPTIMIZE TABLE} to
reclaim the unused space.
@code{OPTIMIZE TABLE} works by making a temporary copy of the original
table; The old table is copied to the new table (without the unused
rows), then the original table is deleted and the new one is
renamed. While @code{OPTIMIZE TABLE} is executing, the original table is
readable by other clients. Updates and writes to the table are stalled
until the new table is ready. This is done in such a way that all updates
are automatically redirected to the new table without any failed updates.
For the moment @code{OPTIMIZE TABLE} only works on @strong{MyISAM}
tables. You can get optimize table to work on other table types by
starting @code{mysqld} with @code{--skip-new} or @code{--safe-mode}, but in
this case @code{OPTIMIZE TABLE} is just mapped to @code{ALTER TABLE}.
Currently @code{OPTIMIZE TABLE} is done by doing an @code{ALTER TABLE},
but we will soon change this to use the @code{REPAIR} code, which will make
the repair much faster for @code{MyISAM} tables.
@code{OPTIMIZE TABLE} works the following way:
@itemize @bullet
@item
If the table has deleted or split rows, repair the table.
@item
If the index pages are not sorted, sort them.
@item
If the statistics is not up to date (and the repair couldn't be done
by sorting the index), update it.
@end itemize
@code{OPTIMIZE TABLE} is equvialent of running
@code{myisamchk --quick --check-changed-tables --sort-index --analyze}
on the table.
Note that the table is locked during the time @code{OPTIMIZE TABLE} is
running!
@findex CHECK TABLE
@node CHECK TABLE, ANALYZE TABLE, OPTIMIZE TABLE, Reference
@ -18402,11 +18438,11 @@ Flushing the host tables allows the host to attempt to connect
again. @xref{Blocked host}.) You can start @code{mysqld} with
@code{-O max_connection_errors=999999999} to avoid this error message.
@item @code{LOGS} @tab Closes and reopens the standard and update log
files. If you have specified the update log file without an extension,
the extension number of the new update log file will be incremented by
one relative to the previous file. If you have used an extension in the
file name, @strong{MySQL} will close and reopen the update log file.
@item @code{LOGS} @tab Closes and reopens all log files.
If you have specified the update log file or a binary log file without
an extension, the extension number of the log file will be incremented
by one relative to the previous file. If you have used an extension in
the file name, @strong{MySQL} will close and reopen the update log file.
@xref{Update log}.
@item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in
@ -18673,9 +18709,17 @@ have..
@item @code{Open_files} @tab Number of files that are open.
@item @code{Open_streams} @tab Number of streams that are open (used mainly for logging)
@item @code{Opened_tables} @tab Number of tables that have been opened.
@item @code{Select_full_join} @tab Number of joins without keys (Should be 0).
@item @code{Select_full_range_join} @tab Number of joins where we used a range search on reference table.
@item @code{Select_range} @tab Number of joins where we used ranges on the first table (It's normally not critical even if this is big)
@item @code{Select_scan} @tab Number of joins where we scanned the first table.
@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (Should be 0).
@item @code{Questions} @tab Number of queries sent to the server.
@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to connect.
@item @code{Slow_queries} @tab Number of queries that has taken more than @code{long_query_time}. @xref{Slow query log}.
@item @code{Sort_range} @tab Number of sorts that where done with ranges.
@item @code{Sort_rows} @tab Number of sorted rows.
@item @code{Sort_scan} @tab Number of sorts that where done by scanning the table.
@item @code{Threads_cached} @tab Number of threads in the thread cache.
@item @code{Threads_connected} @tab Number of currently open connections.
@item @code{Threads_running} @tab Number of threads that are not sleeping.
@ -23321,6 +23365,7 @@ doesn't support indexes. We will add indexes to this in the near future.
@node Replication Intro, Replication Implementation, Replication, Replication
@section Introduction
One way replication can be used both to increase robustness and
speed. For robustness you have two systems and switch to the backup if
you have problems with the master. The extra speed is achieved by
@ -23337,32 +23382,41 @@ slave upon connecting informs the master where it left off sinse the
last successfully propogated update, catches up on the updates, and then
blocks and waits for the master to notify it of the new updates.
Note that if you are replicating a database, all updates to this
database should be done through the master!
On older servers one can use the update log to do simple replication.
@xref{Log Replication}.
@node Replication Implementation, Replication HOWTO, Replication Intro, Replication
@section Replication Implementation Overview
@strong{MySQL} internal replication uses the master-slave approach. One
server is designated as the master, while the other ( or others) as
slave(s). The master keeps a binary log of updates. The slave connects
to the master, catches up on the missed updates, and then starts
receiving updates immediately as they come to the master. If the
connection is lost, the slave will reconnect. If the master goes down,
the slave will keep trying to connect every @code{master-connect-retry}
seconds until the master comes back up and the connection can be
established. The slave keeps track of where it left off in the
replication process, so it can use the info in the case it goes down and
gets restarted later.
slave(s). The master keeps a binary log of updates. @xref{Binary log}.
The slave connects to the master, catches up on the missed updates, and
then starts receiving updates immediately as they come to the master. If
the connection is lost, the slave will reconnect. If the master goes
down, the slave will keep trying to connect every
@code{master-connect-retry} seconds until the master comes back up and
the connection can be established. The slave keeps track of where it
left off in the replication process, so it can use the info in the case
it goes down and gets restarted later.
@node Replication HOWTO, Replication Features, Replication Implementation, Replication
@section HOWTO
Below is a quick HOWTO on how to set up replication on your current system:
Below is a quick HOWTO on how to set up replication on your current
system:
@itemize @bullet
@item
Upgrade both slave and master to 3.23.15 or higher. We recommend that
you always use the latest 3.23 version on both the slave and the master. While
3.23 is in beta, the versions may be not backwards compatible. In
addition, the newer version will fix some bugs and add new features. Please, do not report bugs until you have verified that the problem is present in
the latest release.
you always use the latest 3.23 version on both the slave and the
master. While 3.23 is in beta, the versions may be not backwards
compatible. In addition, the newer version will fix some bugs and add
new features. Please, do not report bugs until you have verified that
the problem is present in the latest release.
@item
Set up special replication user(s) on the master with the @code{FILE}
privilege and permission to connect from all the slaves. If the user is
@ -24061,7 +24115,7 @@ among all threads.
You can check if your table cache is too small by checking the mysqld
variable @code{opened_tables}. If this is quite big, even if you
haven't done alot of @code{flush tables}, you should increase your table
haven't done alot of @code{FLUSH TABLES}, you should increase your table
cache. @xref{SHOW STATUS}.
@node Creating many tables, Open tables, Table cache, System
@ -27589,10 +27643,11 @@ shell> myisamchk -r tbl_name
@end example
You can optimize a table in the same way using the SQL @code{OPTIMIZE TABLE}
statement. @code{OPTIMIZE TABLE} is easier, but @code{myisamchk} is faster.
statement. @code{OPTIMIZE TABLE} does a repair of the table, a key
analyzes and also sorts the index tree to give faster key lookups.
There is also no possibility of unwanted interaction between a utility
and the server, because the server does all the work when you use
@code{OPTIMIZE TABLE}.
@code{OPTIMIZE TABLE}. @xref{OPTIMIZE TABLE}.
@code{myisamchk} also has a number of other options you can use to improve
the performance of a table:
@ -29555,8 +29610,8 @@ really big tables.
For some @code{SELECT} queries, @strong{MySQL} also creates temporary SQL
tables. These are not hidden and have names of the form @file{SQL_*}.
@code{ALTER TABLE} and @code{OPTIMIZE TABLE} create a temporary table in the
same directory as the original table.
@code{ALTER TABLE} creates a temporary table in the same directory as
the original table.
@node Problems with mysql.sock, Error Access denied, Temporary files, Problems
@section How to protect @file{/tmp/mysql.sock} from being deleted
@ -30120,6 +30175,7 @@ Drop or rename @code{old_table}
* Log Replication:: Database replication with update log
* Backup:: Database backups
* Update log:: The update log
* Binary log::
* Slow query log:: Log of slow queries
* Multiple servers:: Running multiple @strong{MySQL} servers on the same machine
@end menu
@ -30129,15 +30185,16 @@ Drop or rename @code{old_table}
@node Log Replication, Backup, Common problems, Common problems
@section Database replication with update log
Now that master-slave internal replication is available starting in
3.23.15, this is the recommended way. @xref{Replication}.
Now that master-slave internal replication is available starting in 3.23.15,
this is the recommended way. However, it is still possible to replicate a database by
using the update
log. @xref{Update log}. This requires one database that acts as a master
(to which data changes are made) and one or more other databases that act
as slaves. To update a slave, just run @code{mysql < update_log}.
Supply host, user and password options that are appropriate for the slave
database, and use the update log from the master database as input.
However, it is still possible to replicate a database by using the
update log. @xref{Update log}. This requires one database that acts as a
master (to which data changes are made) and one or more other databases
that act as slaves. To update a slave, just run @code{mysql <
update_log}. Supply host, user and password options that are
appropriate for the slave database, and use the update log from the
master database as input.
If you never delete anything from a table, you can use a @code{TIMESTAMP}
column to find out which rows have been inserted or changed in the table
@ -30226,7 +30283,7 @@ to be replaced with new ones when a new record duplicates an old record on
a unique key value.
@cindex Update log
@node Update log, Slow query log, Backup, Common problems
@node Update log, Binary log, Backup, Common problems
@section The update log
When started with the @code{--log-update[=file_name]} option,
@ -30280,8 +30337,58 @@ This can be useful if you have to revert to backup files after a crash
and you want to redo the updates that occurred between the time of the backup
and the crash.
@cindex Binary log
@node Binary log, Slow query log, Update log, Common problems
@section The binary log
In the future we expect the binary log to replace the update log!
The binary log contains all information that is available in the update
log in a more efficient format. It also contains information of how long
time every query that updated the database took.
The binary log is also used when you are replication a slave from a master.
@xref{Replication}.
When started with the @code{--log-bin[=file_name]} option, @code{mysqld}
writes a log file containing all SQL commands that update data. If no
file name is given, it defaults to the name of the host machine followed
by @code{-bin}., If file name is given, but it doesn't contain a path the
file is written in the data directory.
To the binary log file name mysqld will append an extensions that is a
number that is incremented each time you execute @code{mysqladmin
refresh} or @code{mysqladmin flush-logs}, the @code{FLUSH LOGS}
statement or restart the server.
To be able to know which different binary log files that has been used
@code{mysqld} will also create a binary log index file which will
contain name of all used binary log files. By default this is has the
same name as the binary log file, with the extension @code{'.index'}.
You can change the name of the binary log index file with the
@code{--log-bin-index=[filename]} option.
If you are using replication, you should not delete old binary log
files until you are sure that no slave will ever need to use them.
One way to do this is to do @code{mysqladmin flush-logs} once a day and then
remove any logs that are more than 3 days old.
You can examine the binary log file with the @code{mysqlbinlib} command.
For example, you can update a @strong{MySQL} server from the binary log
as follows:
@example
mysqlbinlog log-file | mysql -h server_name
@end example
You can also use @file{mysqlbinlog} program to read the binary log
direct from a remote mysql server!
@code{mysqlbinlog --help} will give you more information of how to use
this program!
@cindex Slow query log
@node Slow query log, Multiple servers, Update log, Common problems
@node Slow query log, Multiple servers, Binary log, Common problems
@section The slow query log
When started with the @code{--log-slow-queries[=file_name]} option,
@ -35099,7 +35206,7 @@ only on Linux.
You can always find the latest version
@uref{http://www.trash.net/~ffischer/admin/index.html, here}.
@item @uref{http://www.mysql.com/Downloads/Win32/MySQL-Maker091.zip,MySQL-Maker 091}.
@item @uref{http://www.mysql.com/Downloads/Win32/MySQL-Maker092.zip,MySQL-Maker 092}.
Shareware @strong{MySQL} client for windows. It's WYSIWYG tool which allows
you to create, change and delete databases and tables.
You can change field - structure and add, change and delete data in
@ -35278,16 +35385,15 @@ User-customizable multi-threaded tool set to benchmark @strong{MySQL}. By Sasha
@appendixsec Authentication tools
@itemize @bullet
@item @uref{http://www.mysql.com/Downloads/Contrib/ascend-radius-mysql-0.7.1.patch.gz,
ascend-radius-mysql-0.7.1.patch.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/ascend-radius-mysql-0.7.2.patch.gz,ascend-radius-mysql-0.7.2.patch.gz}
This is authentication and logging patch using @strong{MySQL} for
Ascend-Radius. By @email{takeshi@@SoftAgency.co.jp}.
@item @uref{http://www.mysql.com/Downloads/Contrib/icradius-0.10.tar.gz, icradius 0.10}
@uref{http://www.mysql.com/Downloads/Contrib/icradius.README, icradius readme file}
@item @uref{http://www.mysql.com/Downloads/Contrib/checkpassword-0.81-mysql-0.6.5.patch.gz,
checkpassword-0.81-mysql-0.6.5.patch.gz}
@item @uref{http://www.mysql.com/Downloads/Contrib/checkpassword-0.81-mysql-0.6.6.patch.gz,
checkpassword-0.81-mysql-0.6.6.patch.gz}
@strong{MySQL} authentication patch for QMAIL and checkpassword. These are
useful for management user(mail,pop account) by @strong{MySQL}.
By @email{takeshi@@SoftAgency.co.jp}
@ -35846,6 +35952,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.25:: Changes in release 3.23.25
* News-3.23.24:: Changes in release 3.23.24
* News-3.23.23:: Changes in release 3.23.23
* News-3.23.22:: Changes in release 3.23.22
@ -35873,7 +35980,36 @@ 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.24, News-3.23.23, News-3.23.x, News-3.23.x
@node News-3.23.25, News-3.23.24, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.25
@itemize @bullet
@item
Fixed bug in mysqldump from 3.23 which caused that some @code{CHAR} columns
wheren't quoted.
@item
Merged @code{analyze}, @code{check}, @code{optimize} and repair code.
@item
@code{OPTIMIZE TABLE} is now mapped to @code{REPAIR} with statistics and
sorting of the index tree. This means that for the moment it only
works on @code{MyISAM} tables.
@item
Added a pre-alloced block to root_malloc to get fewer mallocs.
@item
Added a lot of new statistics variables.
@item
Fixed @code{ORDER BY} bug with BDB tables.
@item
Removed warning that mysqld couldn't remove the .pid file under Windows.
@item
Changed @code{--log-isam} to log @strong{MyISAM} tables instead of isam
tables.
@item
Fixed that @code{CHECK TABLE} works on windows.
@item
Added file mutexes to make @code{pwrite()} safe on Windows.
@end itemize
@node News-3.23.24, News-3.23.23, News-3.23.25, News-3.23.x
@appendixsubsec Changes in release 3.23.24
@itemize @bullet
@item
@ -35883,9 +36019,9 @@ To make it possibly to reliable dump and restore tables with
@code{TIMESTAMP(X)} columns, @code{MySQL} now reports columns with X
other than 14 or 8 to be strings.
@item
Changed sort order for latin1 as it was before 3.23.22. Any table with
Changed sort order for latin1 as it was before 3.23.23. Any table with
@code{CHAR} columns that may have characters > ASCII 128 created or
modified with 3.23.22 must be repaired!
modified with 3.23.23 must be repaired!
@item
Fixed small memory leak introduced from 3.23.22 when creating a
temporary table.

View file

@ -28,7 +28,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
#define ADMIN_VERSION "8.8"
#define ADMIN_VERSION "8.9"
#define MAX_MYSQL_VAR 64
#define MAX_TIME_TO_WAIT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -1077,9 +1077,11 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
result = mysql_store_result(mysql);
if (result)
{
strmov(pidfile, mysql_fetch_row(result)[1]);
MYSQL_ROW row=mysql_fetch_row(result);
if (row)
strmov(pidfile, row[1]);
mysql_free_result(result);
return 0;
return row == 0; /* Error if row = 0 */
}
return 1; /* Error */
}

View file

@ -37,7 +37,7 @@
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
**/
#define DUMP_VERSION "8.9"
#define DUMP_VERSION "8.10"
#include <global.h>
#include <my_sys.h>

View file

@ -4,13 +4,13 @@ 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.24-beta)
AM_INIT_AUTOMAKE(mysql, 3.23.25-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_VERSION=9:0:0
SHARED_LIB_VERSION=10:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4

View file

@ -35,7 +35,7 @@ noinst_HEADERS = global.h config-win.h \
SUPERCLEANFILES = mysql_version.h
# Some include files that may be moved and patched by configure
DISTCLEANFILES = $(distdir)/sched.h
DISTCLEANFILES = sched.h
all-local: my_config.h my_global.h

View file

@ -383,7 +383,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#ifndef FN_LIBCHAR
#define FN_LIBCHAR '/'
#define FN_ROOTDIR "/"
#define MY_NFILE 127 /* This is only used to save filenames */
#define MY_NFILE 1024 /* This is only used to save filenames */
#endif
/* #define EXT_IN_LIBNAME */
@ -855,5 +855,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#endif
#endif
#ifndef THREAD
#define thread_safe_increment(V,L) (V)++
#define thread_safe_add(V,C,L) (V)+=(C)
#define thread_safe_sub(V,C,L) (V)-=(C)
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
#endif
#endif /* _global_h */

View file

@ -104,6 +104,9 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
#define KEYCACHE_BLOCK_SIZE 1024
/* root_alloc flags */
#define MY_KEEP_PREALLOC 1
/* defines when allocating data */
#ifdef SAFEMALLOC
@ -240,6 +243,9 @@ extern struct my_file_info
{
my_string name;
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_t mutex;
#endif
} my_file_info[MY_NFILE];
@ -329,15 +335,17 @@ typedef struct st_changeable_var {
#define ST_USED_MEM_DEFINED
typedef struct st_used_mem { /* struct for once_alloc */
struct st_used_mem *next; /* Next block in use */
unsigned int left; /* memory left in block */
unsigned int size; /* size of block */
unsigned int left; /* memory left in block */
unsigned int size; /* Size of block */
} USED_MEM;
typedef struct st_mem_root {
USED_MEM *free;
USED_MEM *used;
USED_MEM *pre_alloc;
unsigned int min_malloc;
unsigned int block_size;
void (*error_handler)(void);
} MEM_ROOT;
#endif
@ -532,9 +540,9 @@ extern void my_free_lock(byte *ptr,myf flags);
#define my_free_lock(A,B) my_free((A),(B))
#endif
#define alloc_root_inited(A) ((A)->min_malloc != 0)
void init_alloc_root(MEM_ROOT *mem_root,uint block_size);
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size);
gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
void free_root(MEM_ROOT *root);
void free_root(MEM_ROOT *root, myf MyFLAGS);
char *strdup_root(MEM_ROOT *root,const char *str);
char *memdup_root(MEM_ROOT *root,const char *str,uint len);
void load_defaults(const char *conf_file, const char **groups,

View file

@ -49,8 +49,10 @@ typedef struct st_used_mem { /* struct for once_alloc */
typedef struct st_mem_root {
USED_MEM *free;
USED_MEM *used;
USED_MEM *pre_alloc;
unsigned int min_malloc;
unsigned int block_size;
void (*error_handler)(void);
} MEM_ROOT;
#endif
@ -74,7 +76,7 @@ extern char *mysql_unix_port;
#define IS_BLOB(n) ((n) & BLOB_FLAG)
#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && (f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8) || (f)->type == FIELD_TYPE_YEAR)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
typedef struct st_mysql_field {
char *name; /* Name of column */

View file

@ -50,6 +50,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_DISK_FULL 20
#define EE_CANT_MKDIR 21
#define EE_UNKNOWN_CHARSET 22
#define EE_OUT_OF_FILERESOURCES 23
#ifdef __cplusplus
}

View file

@ -405,7 +405,7 @@ static void free_rows(MYSQL_DATA *cur)
{
if (cur)
{
free_root(&cur->alloc);
free_root(&cur->alloc,MYF(0));
my_free((gptr) cur,MYF(0));
}
}
@ -472,8 +472,8 @@ static void free_old_query(MYSQL *mysql)
{
DBUG_ENTER("free_old_query");
if (mysql->fields)
free_root(&mysql->field_alloc);
init_alloc_root(&mysql->field_alloc,8192); /* Assume rowlength < 8192 */
free_root(&mysql->field_alloc,MYF(0));
init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
mysql->fields=0;
mysql->field_count=0; /* For API */
DBUG_VOID_RETURN;
@ -662,7 +662,7 @@ mysql_free_result(MYSQL_RES *result)
}
free_rows(result->data);
if (result->fields)
free_root(&result->field_alloc);
free_root(&result->field_alloc,MYF(0));
if (result->row)
my_free((gptr) result->row,MYF(0));
my_free((gptr) result,MYF(0));
@ -888,7 +888,7 @@ static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
strmov(net->last_error,ER(net->last_errno));
DBUG_RETURN(0);
}
init_alloc_root(&result->alloc,8192); /* Assume rowlength < 8192 */
init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
prev_ptr= &result->data;
result->rows=0;

View file

@ -24,9 +24,6 @@
#include "myisamdef.h"
#ifdef __WIN__
#include <errno.h>
#endif
#if !defined(HAVE_PREAD) && defined(THREAD)
pthread_mutex_t THR_LOCK_keycache;
#endif
/* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
@ -73,14 +70,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
share->state.process= share->last_process=share->this_process;
share->state.unique= info->last_unique= info->this_unique;
#ifndef HAVE_PREAD
pthread_mutex_lock(&THR_LOCK_keycache); /* QQ; Has to be removed! */
#endif
if (mi_state_info_write(share->kfile, &share->state, 1))
error=my_errno;
#ifndef HAVE_PREAD
pthread_mutex_unlock(&THR_LOCK_keycache);/* QQ; Has to be removed! */
#endif
share->changed=0;
if (myisam_flush)
{

View file

@ -33,7 +33,7 @@ File myisam_log_file= -1;
uint myisam_quick_table_bits=9;
uint myisam_block_size=MI_KEY_BLOCK_LENGTH; /* Best by test */
my_bool myisam_flush=0,myisam_delay_key_write=0;
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS) && defined(HAVE_PREAD)
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
my_bool myisam_concurrent_insert=1;
#else
my_bool myisam_concurrent_insert=0;

View file

@ -78,7 +78,7 @@ void load_defaults(const char *conf_file, const char **groups,
char *ptr,**res;
DBUG_ENTER("load_defaults");
init_alloc_root(&alloc,128);
init_alloc_root(&alloc,128,0);
if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
{
/* remove the --no-defaults argument and return only the other arguments */
@ -188,7 +188,7 @@ void free_defaults(char **argv)
{
MEM_ROOT ptr;
memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
free_root(&ptr);
free_root(&ptr,MYF(0));
}

View file

@ -45,6 +45,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Disk is full writing '%s'. Waiting for someone to free space...",
"Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file"
"Out of resources when opening file '%s' (Errcode: %d)",
};
void init_glob_errs(void)
@ -80,5 +81,6 @@ void init_glob_errs()
EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file";
EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)",
}
#endif

View file

@ -21,12 +21,25 @@
#include <my_sys.h>
#include <m_string.h>
void init_alloc_root(MEM_ROOT *mem_root,uint block_size)
void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
{
mem_root->free=mem_root->used=0;
mem_root->min_malloc=16;
mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
mem_root->error_handler=0;
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
if ((mem_root->free = mem_root->pre_alloc=
(USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)),
MYF(0))))
{
mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
mem_root->free->left=pre_alloc_size;
mem_root->free->next=0;
}
}
#endif
}
gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
@ -89,27 +102,39 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
/* deallocate everything used by alloc_root */
void free_root(MEM_ROOT *root)
void free_root(MEM_ROOT *root, myf MyFlags)
{
reg1 USED_MEM *next,*old;
DBUG_ENTER("free_root");
if (!root)
DBUG_VOID_RETURN; /* purecov: inspected */
for (next= root->used ; next ; )
if (!(MyFlags & MY_KEEP_PREALLOC))
root->pre_alloc=0;
for ( next=root->used; next ;)
{
old=next; next= next->next ;
my_free((gptr) old,MYF(0));
if (old != root->pre_alloc)
my_free((gptr) old,MYF(0));
}
for (next= root->free ; next ; )
{
old=next; next= next->next ;
my_free((gptr) old,MYF(0));
if (old != root->pre_alloc)
my_free((gptr) old,MYF(0));
}
root->used=root->free=0;
if (root->pre_alloc)
{
root->free=root->pre_alloc;
root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM));
root->free->next=0;
}
DBUG_VOID_RETURN;
}
char *strdup_root(MEM_ROOT *root,const char *str)
{
uint len= (uint) strlen(str)+1;

View file

@ -63,13 +63,26 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
{
if ((int) fd >= MY_NFILE)
{
#if defined(THREAD) && !defined(HAVE_PREAD)
(void) my_close(fd,MyFlags);
my_errno=EMFILE;
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
FileName, my_errno);
DBUG_RETURN(-1);
#else
thread_safe_increment(my_file_opened,&THR_LOCK_open);
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd); /* safeguard */
#endif
}
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
{
my_file_opened++;
my_file_info[fd].type = FILE_BY_CREATE;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_init(&my_file_info[fd].mutex,NULL);
#endif
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd);
}

View file

@ -44,7 +44,10 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
so we can ignore if this doesn't work.
*/
if ((uint) fileno(fd) >= MY_NFILE)
{
thread_safe_increment(my_stream_opened,&THR_LOCK_open);
DBUG_RETURN(fd); /* safeguard */
}
pthread_mutex_lock(&THR_LOCK_open);
if ((my_file_info[fileno(fd)].name = (char*)
my_strdup(FileName,MyFlags)))
@ -87,11 +90,12 @@ int my_fclose(FILE *fd, myf MyFlags)
my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),
my_filename(file),errno);
}
else
my_stream_opened--;
if ((uint) file < MY_NFILE && my_file_info[file].type != UNOPEN)
{
my_file_info[file].type = UNOPEN;
my_free(my_file_info[file].name, MYF(0));
my_stream_opened--;
}
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(err);

View file

@ -48,12 +48,27 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
if ((int) fd >= 0)
{
if ((int) fd >= MY_NFILE)
{
#if defined(THREAD) && !defined(HAVE_PREAD)
(void) my_close(fd,MyFlags);
my_errno=EMFILE;
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
FileName, my_errno);
DBUG_RETURN(-1);
#else
thread_safe_increment(my_file_opened,&THR_LOCK_open);
#endif
DBUG_RETURN(fd); /* safeguard */
}
pthread_mutex_lock(&THR_LOCK_open);
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
{
my_file_opened++;
my_file_info[fd].type = FILE_BY_OPEN;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_init(&my_file_info[fd].mutex,NULL);
#endif
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_PRINT("exit",("fd: %d",fd));
DBUG_RETURN(fd);
@ -80,7 +95,7 @@ int my_close(File fd, myf MyFlags)
DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
pthread_mutex_lock(&THR_LOCK_open);
if ((err = close(fd)) != 0)
if ((err = close(fd)))
{
my_errno=errno;
if (MyFlags & (MY_FAE | MY_WME))
@ -88,9 +103,12 @@ int my_close(File fd, myf MyFlags)
}
if ((uint) fd < MY_NFILE && my_file_info[fd].type != UNOPEN)
{
my_file_opened--;
my_free(my_file_info[fd].name, MYF(0));
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_destroy(&my_file_info[fd].mutex);
#endif
my_file_info[fd].type = UNOPEN;
my_file_opened--;
}
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(err);

View file

@ -28,6 +28,7 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
myf MyFlags)
{
uint readbytes;
int error;
DBUG_ENTER("my_pread");
DBUG_PRINT("my",("Fd: %d Seek: %lu Buffer: %lx Count: %u MyFlags: %d",
Filedes, (ulong) offset, Buffer, Count, MyFlags));
@ -38,32 +39,35 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
errno=0; /* Linux doesn't reset this */
#endif
#ifndef HAVE_PREAD
pthread_mutex_lock(&my_file_info[Filedes].mutex);
readbytes= (uint) -1;
if (lseek(Filedes, offset, MY_SEEK_SET) == -1L ||
(readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
error= (lseek(Filedes, offset, MY_SEEK_SET) == -1L ||
(readbytes = (uint) read(Filedes, Buffer, Count)) != Count);
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
#else
if ((readbytes = (uint) pread(Filedes, Buffer, Count, offset)) != Count)
error=((readbytes = (uint) pread(Filedes, Buffer, Count, offset)) != Count);
#endif
{
my_errno=errno;
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes,Count,Filedes,my_errno));
if (error)
{
my_errno=errno;
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
readbytes,Count,Filedes,my_errno));
#ifdef THREAD
if (readbytes == 0 && errno == EINTR)
continue; /* Interrupted */
if (readbytes == 0 && errno == EINTR)
continue; /* Interrupted */
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
if ((int) readbytes == -1)
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
else if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
}
if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
if ((int) readbytes == -1)
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
else if (MyFlags & (MY_NABP | MY_FNABP))
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
}
if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
}
if (MyFlags & (MY_NABP | MY_FNABP))
DBUG_RETURN(0); /* Ok vid l{sning */
DBUG_RETURN(readbytes); /* purecov: inspected */
@ -76,6 +80,7 @@ uint my_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
myf MyFlags)
{
int error;
uint writenbytes,errors;
ulong written;
DBUG_ENTER("my_pwrite");
@ -87,12 +92,16 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
{
#ifndef HAVE_PREAD
writenbytes= (uint) -1;
if (lseek(Filedes, offset, MY_SEEK_SET) != -1L &&
(writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)
pthread_mutex_lock(&my_file_info[Filedes].mutex);
error=(lseek(Filedes, offset, MY_SEEK_SET) != -1L &&
(writenbytes = (uint) write(Filedes, Buffer, Count)) == Count);
pthread_mutex_unlock(&my_file_info[Filedes].mutex);
if (error)
break;
#else
if ((writenbytes = (uint) pwrite(Filedes, Buffer, Count,offset)) == Count)
#endif
break;
#endif
if ((int) writenbytes != -1)
{ /* Safegueard */
written+=writenbytes;

View file

@ -96,7 +96,7 @@ void init_tree(TREE *tree, uint default_alloc_size, int size,
}
if (!(tree->with_delete=with_delete))
{
init_alloc_root(&tree->mem_root, default_alloc_size);
init_alloc_root(&tree->mem_root, default_alloc_size,0);
tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
}
DBUG_VOID_RETURN;
@ -115,7 +115,7 @@ void delete_tree(TREE *tree)
{
if (tree->free)
delete_tree_element(tree,tree->root);
free_root(&tree->mem_root);
free_root(&tree->mem_root,MYF(0));
}
}
tree->root= &tree->null_element;

View file

@ -1371,7 +1371,7 @@ rl_variable_bind (name, value)
v[end] = '\0';
/* The value starts at v + beg. Translate it into a character string. */
_rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
rl_translate_keyseq (v + beg, (char*) _rl_isearch_terminators, &end);
_rl_isearch_terminators[end] = '\0';
free (v);
}

View file

@ -264,7 +264,7 @@ rl_search_history (direction, invoking_key)
variable isearch-terminators) are used to terminate the search but
not subsequently execute the character as a command. The default
value is "\033\012" (ESC and C-J). */
if (strchr (isearch_terminators, c))
if (strchr((char*) isearch_terminators, c))
#endif
{
/* ESC still terminates the search, but if there is pending

View file

@ -58,8 +58,8 @@ else
fi
pid_file=$DATADIR/`@HOSTNAME@`.pid
MYSQL_UNIX_PORT=@MYSQL_UNIX_ADDR@
MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
MYSQL_UNIX_PORT=${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}
MYSQL_TCP_PORT=${MYSQL_TCP_PORT:-@MYSQL_TCP_PORT@}
log=$DATADIR/`@HOSTNAME@`.log
err_log=$DATADIR/`@HOSTNAME@`.err
user=@MYSQLD_USER@

View file

@ -39,7 +39,7 @@
# "3-byte int" or "same as xxx".
$version="1.48";
$version="1.49";
use DBI;
use Getopt::Long;

View file

@ -1,4 +1,4 @@
#This file is automaticly generated by crash-me 1.47
#This file is automaticly generated by crash-me 1.48
NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic
@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe
crash_me_version=1.47 # crash me version
crash_me_version=1.48 # crash me version
create_default=yes # default value for column
create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists
@ -283,14 +283,17 @@ group_func_extra_count_distinct_list=yes # Group function COUNT(DISTINCT expr,ex
group_func_extra_std=yes # Group function STD
group_func_extra_stddev=yes # Group function STDDEV
group_func_extra_variance=no # Group function VARIANCE
group_func_sql_any=no # Group function ANY
group_func_sql_avg=yes # Group function AVG
group_func_sql_count_*=yes # Group function COUNT (*)
group_func_sql_count_column=yes # Group function COUNT column name
group_func_sql_count_distinct=yes # Group function COUNT(DISTINCT expr)
group_func_sql_every=no # Group function EVERY
group_func_sql_max=yes # Group function MAX on numbers
group_func_sql_max_str=yes # Group function MAX on strings
group_func_sql_min=yes # Group function MIN on numbers
group_func_sql_min_str=yes # Group function MIN on strings
group_func_sql_some=no # Group function SOME
group_func_sql_sum=yes # Group function SUM
group_functions=yes # Group functions
has_true_false=no # TRUE and FALSE
@ -384,7 +387,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.19 beta debug # server version
server_version=MySQL 3.23.22 beta debug # server version
simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values
subqueries=no # subqueries

View file

@ -115,7 +115,15 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
param.ref_length= table[0]->file->ref_length;
param.sort_length=sortlength(sortorder,s_length)+ param.ref_length;
param.max_rows= max_rows;
if (select && select->quick)
{
statistic_increment(filesort_range_count, &LOCK_status);
}
else
{
statistic_increment(filesort_scan_count, &LOCK_status);
}
if (select && my_b_inited(&select->file))
{
records=special=select->records; /* purecov: deadcode */
@ -261,6 +269,8 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
}
if (error)
my_error(ER_FILSORT_ABORT,MYF(ME_ERROR+ME_WAITTANG));
else
statistic_add(filesort_rows, records, &LOCK_status);
#ifdef SKIPP_DBUG_IN_FILESORT
DBUG_POP(); /* Ok to DBUG */

View file

@ -66,12 +66,13 @@ class ha_berkeley: public handler
public:
ha_berkeley(TABLE *table): handler(table), alloc_ptr(0),rec_buff(0), file(0),
int_option_flag(HA_READ_NEXT+HA_READ_PREV+
HA_KEYPOS_TO_RNDPOS+ HA_READ_ORDER+ HA_LASTKEY_ORDER+
HA_LONGLONG_KEYS+ HA_NULL_KEY +
HA_BLOB_KEY +
HA_REQUIRE_PRIMARY_KEY + HA_NOT_EXACT_COUNT +
HA_PRIMARY_KEY_IN_READ_INDEX + HA_DROP_BEFORE_CREATE),
int_option_flag(HA_READ_NEXT | HA_READ_PREV |
HA_REC_NOT_IN_SEQ |
HA_KEYPOS_TO_RNDPOS | HA_READ_ORDER | HA_LASTKEY_ORDER |
HA_LONGLONG_KEYS | HA_NULL_KEY |
HA_BLOB_KEY |
HA_REQUIRE_PRIMARY_KEY | HA_NOT_EXACT_COUNT |
HA_PRIMARY_KEY_IN_READ_INDEX | HA_DROP_BEFORE_CREATE),
last_dup_key((uint) -1)
{
}

View file

@ -30,10 +30,6 @@
#include "../myisam/myisamdef.h"
#endif
#if !defined(HAVE_PREAD)
pthread_mutex_t THR_LOCK_keycache;
#endif
ulong myisam_sort_buffer_size;
/*****************************************************************************
@ -228,7 +224,7 @@ int ha_myisam::write_row(byte * buf)
int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
if (!file) return HA_CHECK_INTERNAL_ERROR;
if (!file) return HA_ADMIN_INTERNAL_ERROR;
int error ;
MI_CHECK param;
MYISAM_SHARE* share = file->s;
@ -249,7 +245,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
STATE_CRASHED_ON_REPAIR)) &&
share->state.open_count == 0) ||
((param.testflag & T_FAST) && share->state.open_count == 0)))
return HA_CHECK_ALREADY_CHECKED;
return HA_ADMIN_ALREADY_DONE;
error = chk_size(&param, file);
if (!error)
@ -277,17 +273,11 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
{
file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
pthread_mutex_lock(&share->intern_lock);
#ifndef HAVE_PREAD
pthread_mutex_lock(&THR_LOCK_keycache); // QQ; Has to be removed!
#endif
share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
STATE_CRASHED_ON_REPAIR);
if (!(table->db_stat & HA_READ_ONLY))
error=update_state_info(&param,file,UPDATE_TIME | UPDATE_OPEN_COUNT |
UPDATE_STAT);
#ifndef HAVE_PREAD
pthread_mutex_unlock(&THR_LOCK_keycache);// QQ; Has to be removed!
#endif
pthread_mutex_unlock(&share->intern_lock);
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST);
@ -299,7 +289,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
}
return error ? HA_CHECK_CORRUPT : HA_CHECK_OK;
return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
}
@ -309,7 +299,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt)
two threads may do an analyze at the same time!
*/
int ha_myisam::analyze(THD *thd)
int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
{
int error=0;
MI_CHECK param;
@ -323,62 +313,104 @@ int ha_myisam::analyze(THD *thd)
T_DONT_CHECK_CHECKSUM);
param.using_global_keycache = 1;
if (share->state.changed & STATE_NOT_ANALYZED)
if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE;
error = chk_key(&param, file);
if (!error)
{
error = chk_key(&param, file);
if (!error)
{
pthread_mutex_lock(&share->intern_lock);
#ifndef HAVE_PREAD
pthread_mutex_lock(&THR_LOCK_keycache); // QQ; Has to be removed!
#endif
error=update_state_info(&param,file,UPDATE_STAT);
#ifndef HAVE_PREAD
pthread_mutex_unlock(&THR_LOCK_keycache);// QQ; Has to be removed!
#endif
pthread_mutex_unlock(&share->intern_lock);
}
else if (!mi_is_crashed(file))
mi_mark_crashed(file);
pthread_mutex_lock(&share->intern_lock);
error=update_state_info(&param,file,UPDATE_STAT);
pthread_mutex_unlock(&share->intern_lock);
}
return error ? HA_CHECK_CORRUPT : HA_CHECK_OK;
else if (!mi_is_crashed(file))
mi_mark_crashed(file);
return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
}
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{
if (!file) return HA_CHECK_INTERNAL_ERROR;
if (!file) return HA_ADMIN_INTERNAL_ERROR;
MI_CHECK param;
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*) "repair";
param.testflag = (check_opt->flags | T_SILENT|T_FORCE_CREATE|T_REP_BY_SORT|
T_STATISTICS);
param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT);
if (check_opt->quick)
param.opt_rep_quick++;
param.sort_buffer_length= check_opt->sort_buffer_size;
return repair(thd,param);
return repair(thd,param,0);
}
int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt)
{
if (!file) return HA_ADMIN_INTERNAL_ERROR;
MI_CHECK param;
myisamchk_init(&param);
param.thd = thd;
param.op_name = (char*) "optimize";
param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE |
T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
param.opt_rep_quick++;
param.sort_buffer_length= check_opt->sort_buffer_size;
return repair(thd,param,1);
}
int ha_myisam::repair(THD *thd, MI_CHECK &param)
int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
{
int error;
int error=0;
bool optimize_done= !optimize;
char fixed_name[FN_REFLEN];
const char *old_proc_info=thd->proc_info;
MYISAM_SHARE* share = file->s;
param.table_name = table->table_name;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1;
param.thd=thd;
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0)));
if (mi_test_if_sort_rep(file,file->state->records))
error = mi_repair_by_sort(&param, file, fixed_name, param.opt_rep_quick);
else
error= mi_repair(&param, file, fixed_name, param.opt_rep_quick);
if (!optimize || file->state->del ||
share->state.split != file->state->records)
{
optimize_done=1;
if (mi_test_if_sort_rep(file,file->state->records))
{
param.testflag|= T_STATISTICS; // We get this for free
thd->proc_info="Repairing by sorting";
error = mi_repair_by_sort(&param, file, fixed_name, param.opt_rep_quick);
}
else
{
thd->proc_info="Repairing";
error= mi_repair(&param, file, fixed_name, param.opt_rep_quick);
}
}
if (!error)
{
if ((param.testflag & T_SORT_INDEX) &&
(share->state.changed & STATE_NOT_SORTED_PAGES))
{
optimize_done=1;
thd->proc_info="Sorting index";
error=mi_sort_index(&param,file,fixed_name);
}
if ((param.testflag & T_STATISTICS) &&
(share->state.changed & STATE_NOT_ANALYZED))
{
optimize_done=1;
thd->proc_info="Analyzing";
error = chk_key(&param, file);
}
}
thd->proc_info="saving state";
if (!error)
{
if (share->state.changed & STATE_CHANGED)
@ -390,7 +422,10 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param)
file->save_state=file->s->state.state;
if (file->s->base.auto_key)
update_auto_increment_key(&param, file, 1);
error = update_state_info(&param, file, UPDATE_TIME|UPDATE_STAT);
error = update_state_info(&param, file,
UPDATE_TIME |
(param.testflag & T_STATISTICS ?
UPDATE_STAT : 0));
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST);
}
@ -407,6 +442,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param)
We have to close all instances of this file to ensure that we can
do the rename safely and that all threads are using the new version.
*/
thd->proc_info="renaming file";
VOID(pthread_mutex_lock(&LOCK_open));
if (close_cached_table(thd,table))
error=1;
@ -421,7 +457,9 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param)
VOID(pthread_mutex_unlock(&LOCK_open));
}
}
return error ? HA_REPAIR_FAILED : HA_REPAIR_OK;
thd->proc_info=old_proc_info;
return (error ? HA_ADMIN_FAILED :
!optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
}
@ -451,7 +489,7 @@ bool ha_myisam::activate_all_index(THD *thd)
param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= myisam_sort_buffer_size;
param.opt_rep_quick++;
error=repair(thd,param) != HA_CHECK_OK;
error=repair(thd,param,0) != HA_ADMIN_OK;
thd->proc_info=save_proc_info;
}
DBUG_RETURN(error);

View file

@ -30,7 +30,7 @@ class ha_myisam: public handler
{
MI_INFO *file;
uint int_option_flag;
int repair(THD *thd, MI_CHECK &param);
int repair(THD *thd, MI_CHECK &param, bool optimize);
public:
ha_myisam(TABLE *table): handler(table), file(0),
@ -93,8 +93,9 @@ class ha_myisam: public handler
int rename_table(const char * from, const char * to);
int delete_table(const char *name);
int check(THD* thd, HA_CHECK_OPT* check_opt);
int analyze(THD* thd);
int analyze(THD* thd,HA_CHECK_OPT* check_opt);
int repair(THD* thd, HA_CHECK_OPT* check_opt);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int dump(THD* thd, int fd);
int net_read_dump(NET* net);
};

View file

@ -318,7 +318,7 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
if (!error)
{
if (!alloc_root_inited(&table->mem_root)) // If temporary table
ref=sql_alloc(ALIGN_SIZE(ref_length)*2);
ref=(byte*) sql_alloc(ALIGN_SIZE(ref_length)*2);
else
ref=(byte*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2);
if (!ref)
@ -334,22 +334,22 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
int handler::check(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_CHECK_NOT_IMPLEMENTED;
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_REPAIR_NOT_IMPLEMENTED;
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::optimize(THD* thd)
int handler::optimize(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_OPTIMIZE_NOT_IMPLEMENTED;
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::analyze(THD* thd)
int handler::analyze(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ANALYZE_NOT_IMPLEMENTED;
return HA_ADMIN_NOT_IMPLEMENTED;
}
/* Read first row from a table */

View file

@ -27,26 +27,12 @@
// the following is for checking tables
#define HA_CHECK_ALREADY_CHECKED 1
#define HA_CHECK_OK 0
#define HA_CHECK_NOT_IMPLEMENTED -1
#define HA_CHECK_CORRUPT -2
#define HA_CHECK_INTERNAL_ERROR -3
#define HA_REPAIR_OK 0
#define HA_REPAIR_NOT_IMPLEMENTED -1
#define HA_REPAIR_FAILED -2
#define HA_REPAIR_INTERNAL_ERROR -3
#define HA_OPTIMIZE_OK 0
#define HA_OPTIMIZE_NOT_IMPLEMENTED -1
#define HA_OPTIMIZE_FAILED -2
#define HA_OPTIMIZE_INTERNAL_ERROR -3
#define HA_ANALYZE_OK 0
#define HA_ANALYZE_NOT_IMPLEMENTED -1
#define HA_ANALYZE_FAILED -2
#define HA_ANALYZE_INTERNAL_ERROR -3
#define HA_ADMIN_ALREADY_DONE 1
#define HA_ADMIN_OK 0
#define HA_ADMIN_NOT_IMPLEMENTED -1
#define HA_ADMIN_FAILED -2
#define HA_ADMIN_CORRUPT -3
#define HA_ADMIN_INTERNAL_ERROR -4
/* Bits in bas_flag to show what database can do */
@ -156,9 +142,10 @@ typedef struct st_ha_check_opt
uint flags;
bool quick;
bool changed_files;
bool optimize;
inline void init()
{
flags= 0; quick= 0;
flags= 0; quick= optimize=0;
sort_buffer_size = myisam_sort_buffer_size;
}
} HA_CHECK_OPT;
@ -257,10 +244,10 @@ public:
virtual int delete_all_rows();
virtual longlong get_auto_increment();
virtual void update_create_info(HA_CREATE_INFO *create_info) {}
virtual int check(THD* thd, HA_CHECK_OPT* check_opt );
virtual int repair(THD* thd, HA_CHECK_OPT* check_opt);
virtual int optimize(THD* thd);
virtual int analyze(THD* thd);
virtual int check(THD* thd, HA_CHECK_OPT* check_opt );
virtual int repair(THD* thd, HA_CHECK_OPT* check_opt);
virtual int optimize(THD* thd,HA_CHECK_OPT* check_opt);
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt);
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
virtual void deactivate_non_unique_index(ha_rows rows) {}
virtual bool activate_all_index(THD *thd) {return 0;}

View file

@ -1012,7 +1012,7 @@ longlong Item_func_bit_count::val_int()
/****************************************************************************
** Functions to handle dynamic loadable functions
** Original source by: Alexis Mikhailov <root@medinf.chuvashia.su>
** Rewritten by: Monty.
** Rewritten by monty.
****************************************************************************/
#ifdef HAVE_DLOPEN

View file

@ -134,7 +134,7 @@ longlong Item_func_month::val_int()
String* Item_func_monthname::val_str(String* str)
{
uint month=(uint) Item_func_month::val_int();
if (null_value)
if (!month) // This is also true for NULL
return (String*) 0;
return &month_names[month-1];
}

View file

@ -208,8 +208,9 @@ static void mc_free_old_query(MYSQL *mysql)
{
DBUG_ENTER("mc_free_old_query");
if (mysql->fields)
free_root(&mysql->field_alloc);
init_alloc_root(&mysql->field_alloc,8192); /* Assume rowlength < 8192 */
free_root(&mysql->field_alloc,MYF(0));
else
init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
mysql->fields=0;
mysql->field_count=0; /* For API */
DBUG_VOID_RETURN;

View file

@ -34,7 +34,7 @@ typedef ulong key_part_map; /* Used for finding key parts */
#include "mysql_com.h"
#include "unireg.h"
void init_sql_alloc(MEM_ROOT *root,uint block_size);
void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size);
gptr sql_alloc(unsigned size);
gptr sql_calloc(unsigned size);
char *sql_strdup(const char *str);
@ -243,9 +243,10 @@ int mysql_check_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_repair_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_analyze_table(THD* thd, TABLE_LIST* table_list);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list);
int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
/* net_pkg.c */
void send_error(NET *net,uint sql_errno=0, const char *err=0);
@ -434,6 +435,9 @@ extern ulong refresh_version,flush_version, thread_id,query_id,opened_tables,
delayed_insert_limit, delayed_queue_size,
delayed_insert_threads, delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors;
extern ulong filesort_rows, filesort_range_count, filesort_scan_count;
extern ulong select_range_check_count, select_range_count, select_scan_count;
extern ulong select_full_range_join_count,select_full_join_count;
extern uint test_flags,select_errors,mysql_port,ha_open_options;
extern ulong thd_startup_options, slow_launch_threads, slow_launch_time;
extern time_t start_time;

View file

@ -145,7 +145,7 @@ static pthread_t select_thread;
static pthread_t flush_thread; // Used when debugging
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_ansi_mode;
opt_ansi_mode,opt_myisam_log=0;
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
// if sql_bin_update is true, SQL_LOG_UPDATE and SQL_LOG_BIN are kept in sync, and are
@ -205,6 +205,9 @@ ulong query_id=1L,long_query_count,long_query_time,aborted_threads,
aborted_connects,delayed_insert_timeout,delayed_insert_limit,
delayed_queue_size,delayed_insert_threads,delayed_insert_writes,
delayed_rows_in_use,delayed_insert_errors,flush_time;
ulong filesort_rows, filesort_range_count, filesort_scan_count;
ulong select_range_check_count, select_range_count, select_scan_count;
ulong select_full_range_join_count,select_full_join_count;
ulong specialflag=0,opened_tables=0,created_tmp_tables=0,
created_tmp_disk_tables=0;
ulong max_connections,max_insert_delayed_threads,max_used_connections,
@ -579,7 +582,7 @@ void clean_up(void)
udf_free();
#endif
end_key_cache(); /* This is usually freed automaticly */
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables */
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
#ifdef USE_RAID
end_raid();
#endif
@ -1481,6 +1484,8 @@ int main(int argc, char **argv)
sql_print_error("Can't init databases");
exit(1);
}
if (opt_myisam_log)
(void) mi_log( 1 );
ft_init_stopwords(ft_precompiled_stopwords); /* SerG */
#ifdef __WIN__
@ -1509,7 +1514,9 @@ int main(int argc, char **argv)
{
select_thread_in_use=0;
(void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL);
#ifndef __WIN__
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not neaded anymore
#endif
exit(1);
}
if (!opt_noacl)
@ -1643,7 +1650,9 @@ int main(int argc, char **argv)
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
}
(void) pthread_mutex_unlock(&LOCK_thread_count);
#ifndef __WIN__
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not neaded anymore
#endif
my_thread_end();
exit(0);
return(0); /* purecov: deadcode */
@ -2203,7 +2212,7 @@ static struct option long_options[] = {
{"log", optional_argument, 0, 'l'},
{"language", required_argument, 0, 'L'},
{"log-bin", optional_argument, 0, (int) OPT_BIN_LOG},
{"log-bin-index", optional_argument, 0, (int) OPT_BIN_LOG_INDEX},
{"log-bin-index", required_argument, 0, (int) OPT_BIN_LOG_INDEX},
{"log-isam", optional_argument, 0, (int) OPT_ISAM_LOG},
{"log-update", optional_argument, 0, (int) OPT_UPDATE_LOG},
{"log-slow-queries", optional_argument, 0, (int) OPT_SLOW_QUERY_LOG},
@ -2440,9 +2449,17 @@ struct show_var_st status_vars[]= {
{"Open_streams", (char*) &my_stream_opened, SHOW_INT_CONST},
{"Opened_tables", (char*) &opened_tables, SHOW_LONG},
{"Questions", (char*) 0, SHOW_QUESTION},
{"Select_full_join", (char*) &select_full_join_count, SHOW_LONG},
{"Select_full_range_join", (char*) &select_full_range_join_count, SHOW_LONG},
{"Select_range", (char*) &select_range_count, SHOW_LONG},
{"Select_range_check", (char*) &select_range_check_count, SHOW_LONG},
{"Select_scan", (char*) &select_scan_count, SHOW_LONG},
{"Slave_running", (char*) &slave_running, SHOW_BOOL},
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
{"Slow_queries", (char*) &long_query_count, SHOW_LONG},
{"Slave_running", (char*) &slave_running, SHOW_BOOL},
{"Sort_range", (char*) &filesort_range_count, SHOW_LONG},
{"Sort_rows", (char*) &filesort_rows, SHOW_LONG},
{"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG},
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST},
{"Threads_connected", (char*) &thread_count, SHOW_INT_CONST},
{"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
@ -2508,7 +2525,7 @@ static void usage(void)
--log-bin-index=file File that holds the names for last binary log files\n\
--log-update[=file] Log updates to file.# where # is a unique number\n\
if not given.\n\
--log-isam[=file] Log all isam changes to file\n\
--log-isam[=file] Log all MyISAM changes to file\n\
--log-long-format Log some extra information to update log\n\
--low-priority-updates INSERT/DELETE/UPDATE has lower priority than selects\n\
--log-slow-queries=[file]\n\
@ -2583,7 +2600,9 @@ The default values (after parsing the command line arguments) are:\n\n");
printf("datadir: %s\n",mysql_real_data_home);
printf("tmpdir: %s\n",mysql_tmpdir);
printf("language: %s\n",language);
#ifndef __WIN__
printf("pid file: %s\n",pidfile_name);
#endif
if (opt_logname)
printf("logfile: %s\n",opt_logname);
if (opt_update_logname)
@ -2739,9 +2758,9 @@ static void get_options(int argc,char **argv)
thd_startup_options|=OPTION_BIG_TABLES;
break;
case (int) OPT_ISAM_LOG:
opt_myisam_log=1;
if (optarg)
nisam_log_filename=optarg;
(void) nisam_log(1);
myisam_log_filename=optarg;
break;
case (int) OPT_UPDATE_LOG:
opt_update_log=1;
@ -3168,8 +3187,8 @@ static int get_service_parameters()
else if ( lstrcmp(szKeyValueName, TEXT("ISAMLogFile")) == 0 )
{
CHECK_KEY_TYPE( REG_SZ, szKeyValueName );
COPY_KEY_VALUE( nisam_log_filename );
(void) nisam_log( 1 );
COPY_KEY_VALUE( myisam_log_filename );
opt_myisam_log=1;
}
else if ( lstrcmp(szKeyValueName, TEXT("LongLogFormat")) == 0 )
{

View file

@ -387,7 +387,7 @@ QUICK_SELECT::QUICK_SELECT(TABLE *table,uint key_nr,bool no_alloc)
{
if (!no_alloc)
{
init_sql_alloc(&alloc,1024); // Allocates everything here
init_sql_alloc(&alloc,1024,0); // Allocates everything here
my_pthread_setspecific_ptr(THR_MALLOC,&alloc);
}
else
@ -400,7 +400,7 @@ QUICK_SELECT::QUICK_SELECT(TABLE *table,uint key_nr,bool no_alloc)
QUICK_SELECT::~QUICK_SELECT()
{
file->index_end();
free_root(&alloc);
free_root(&alloc,MYF(0));
}
@ -622,13 +622,13 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
param.keys=0;
current_thd->no_errors=1; // Don't warn about NULL
init_sql_alloc(&alloc,2048);
init_sql_alloc(&alloc,2048,0);
if (!(param.key_parts = (KEY_PART*) alloc_root(&alloc,
sizeof(KEY_PART)*
head->key_parts)))
{
current_thd->no_errors=0;
free_root(&alloc); // Return memory & allocator
free_root(&alloc,MYF(0)); // Return memory & allocator
DBUG_RETURN(0); // Can't use range
}
key_parts= param.key_parts;
@ -720,7 +720,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
}
}
}
free_root(&alloc); // Return memory & allocator
free_root(&alloc,MYF(0)); // Return memory & allocator
my_pthread_setspecific_ptr(THR_MALLOC,old_root);
current_thd->no_errors=0;
}

View file

@ -559,7 +559,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
Query_log_event* qev = (Query_log_event*)ev;
int q_len = qev->q_len;
init_sql_alloc(&thd->mem_root, 8192);
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = (char*)qev->db;
if(db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
@ -604,7 +604,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->db = 0;// prevent db from being freed
thd->query = 0; // just to be sure
close_thread_tables(thd);
free_root(&thd->mem_root);
free_root(&thd->mem_root,0);
if (thd->query_error)
{
sql_print_error("Slave: error running query '%s' ",
@ -628,7 +628,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
case LOAD_EVENT:
{
Load_log_event* lev = (Load_log_event*)ev;
init_sql_alloc(&thd->mem_root, 8192);
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = (char*)lev->db;
thd->query = 0;
thd->query_error = 0;

View file

@ -156,7 +156,7 @@ int acl_init(bool dont_read_acl_tables)
DBUG_RETURN(1); /* purecov: inspected */
}
init_sql_alloc(&mem,1024);
init_sql_alloc(&mem,1024,0);
init_read_record(&read_record_info,thd,table= tables[0].table,NULL,1,0);
VOID(init_dynamic_array(&acl_hosts,sizeof(ACL_HOST),20,50));
while (!(read_record_info.read_record(&read_record_info)))
@ -272,7 +272,7 @@ int acl_init(bool dont_read_acl_tables)
void acl_free(bool end)
{
free_root(&mem);
free_root(&mem,MYF(0));
delete_dynamic(&acl_hosts);
delete_dynamic(&acl_users);
delete_dynamic(&acl_dbs);
@ -323,7 +323,7 @@ void acl_reload(void)
}
else
{
free_root(&old_mem);
free_root(&old_mem,MYF(0));
delete_dynamic(&old_acl_hosts);
delete_dynamic(&old_acl_users);
delete_dynamic(&old_acl_dbs);
@ -1845,7 +1845,7 @@ void grant_free(void)
DBUG_ENTER("grant_free");
grant_option = FALSE;
hash_free(&hash_tables);
free_root(&memex);
free_root(&memex,MYF(0));
DBUG_VOID_RETURN;
}
@ -1863,7 +1863,7 @@ int grant_init (void)
grant_option = FALSE;
(void) hash_init(&hash_tables,0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
init_sql_alloc(&memex,1024);
init_sql_alloc(&memex,1024,0);
if (!initialized)
DBUG_RETURN(0); /* purecov: tested */
@ -1965,7 +1965,7 @@ void grant_reload(void)
else
{
hash_free(&old_hash_tables);
free_root(&old_mem);
free_root(&old_mem,MYF(0));
}
pthread_mutex_unlock(&LOCK_grant);
DBUG_VOID_RETURN;

View file

@ -155,7 +155,7 @@ THD::~THD()
safeFree(user);
safeFree(db);
safeFree(ip);
free_root(&mem_root);
free_root(&mem_root,MYF(0));
mysys_var=0; // Safety (shouldn't be needed)
DBUG_VOID_RETURN;
}

View file

@ -394,11 +394,13 @@ pthread_handler_decl(handle_one_connection,arg)
thd->proc_info=0; // Remove 'login'
thd->version=refresh_version;
thd->set_time();
init_sql_alloc(&thd->mem_root,8192,8192);
while (!net->error && net->vio != 0 && !thd->killed)
{
if (do_command(thd))
break;
}
free_root(&thd->mem_root,MYF(0));
if (net->error && net->vio != 0)
{
sql_print_error(ER(ER_NEW_ABORTING_CONNECTION),
@ -453,13 +455,13 @@ int handle_bootstrap(THD *thd,FILE *file)
thd->version=refresh_version;
char *buff= (char*) thd->net.buff;
init_sql_alloc(&thd->mem_root,8192,8192);
while (fgets(buff, thd->net.max_packet, file))
{
uint length=(uint) strlen(buff);
while (length && (isspace(buff[length-1]) || buff[length-1] == ';'))
length--;
buff[length]=0;
init_sql_alloc(&thd->mem_root,8192);
thd->current_tablenr=0;
thd->query= thd->memdup(buff,length+1);
thd->query_id=query_id++;
@ -469,8 +471,9 @@ int handle_bootstrap(THD *thd,FILE *file)
{
DBUG_RETURN(-1);
}
free_root(&thd->mem_root);
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
}
free_root(&thd->mem_root,MYF(0));
DBUG_RETURN(0);
}
@ -537,7 +540,6 @@ bool do_command(THD *thd)
enum enum_server_command command;
DBUG_ENTER("do_command");
init_sql_alloc(&thd->mem_root,8192);
net= &thd->net;
thd->current_tablenr=0;
@ -741,7 +743,7 @@ bool do_command(THD *thd)
send_eof(net); // This is for 'quit request'
close_connection(net);
close_thread_tables(thd); // Free before kill
free_root(&thd->mem_root);
free_root(&thd->mem_root,MYF(0));
kill_mysql();
error=TRUE;
break;
@ -822,7 +824,7 @@ bool do_command(THD *thd)
thread_running--;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->packet.shrink(net_buffer_length); // Reclaim some memory
free_root(&thd->mem_root);
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_RETURN(error);
}
@ -1191,33 +1193,34 @@ mysql_execute_command(void)
if (check_db_used(thd,tables) ||
check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */
res = mysql_analyze_table(thd, tables);
res = mysql_analyze_table(thd, tables, &lex->check_opt);
break;
}
case SQLCOM_OPTIMIZE:
{
HA_CREATE_INFO create_info;
/* This is now done with ALTER TABLE, but should be done with isamchk */
if (!tables->db)
tables->db=thd->db;
if (check_access(thd,SELECT_ACL | INSERT_ACL,tables->db,
&tables->grant.privilege))
if (check_db_used(thd,tables) ||
check_table_access(thd,SELECT_ACL | INSERT_ACL, tables))
goto error; /* purecov: inspected */
if (grant_option && check_grant(thd,SELECT_ACL | INSERT_ACL,tables))
goto error;
lex->create_list.empty();
lex->key_list.empty();
lex->col_list.empty();
lex->drop_list.empty();
lex->alter_list.empty();
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
create_info.row_type=ROW_TYPE_DEFAULT;
res= mysql_alter_table(thd, NullS, NullS, &create_info,
tables, lex->create_list,
lex->key_list, lex->drop_list, lex->alter_list,
0,DUP_ERROR);
if (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC))
{
/* Use ALTER TABLE */
lex->create_list.empty();
lex->key_list.empty();
lex->col_list.empty();
lex->drop_list.empty();
lex->alter_list.empty();
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
create_info.row_type=ROW_TYPE_DEFAULT;
res= mysql_alter_table(thd, NullS, NullS, &create_info,
tables, lex->create_list,
lex->key_list, lex->drop_list, lex->alter_list,
0,DUP_ERROR);
}
else
res = mysql_optimize_table(thd, tables, &lex->check_opt);
break;
}
case SQLCOM_UPDATE:

View file

@ -2333,10 +2333,35 @@ make_join_readinfo(JOIN *join,uint options)
}
/* These init changes read_record */
if (tab->use_quick == 2)
{
tab->read_first_record= join_init_quick_read_record;
statistic_increment(select_range_check_count, &LOCK_status);
}
else
{
tab->read_first_record= join_init_read_record;
if (i == join->const_tables)
{
if (tab->select && tab->select->quick)
{
statistic_increment(select_range_count, &LOCK_status);
}
else
{
statistic_increment(select_scan_count, &LOCK_status);
}
}
else
{
if (tab->select && tab->select->quick)
{
statistic_increment(select_full_range_join_count, &LOCK_status);
}
else
{
statistic_increment(select_full_join_count, &LOCK_status);
}
}
if (tab->select && tab->select->quick &&
table->used_keys & ((key_map) 1 << tab->select->quick->index))
{

View file

@ -718,14 +718,19 @@ bool close_cached_table(THD *thd,TABLE *table)
}
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt,
thr_lock_type lock_type,
bool open_for_modify,
const char *operator_name,
int (handler::*operator_func)
(THD *, HA_CHECK_OPT *))
{
TABLE_LIST *table;
List<Item> field_list;
Item* item;
String* packet = &thd->packet;
DBUG_ENTER("mysql_repair_table");
DBUG_ENTER("mysql_admin_table");
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
item->maybe_null = 1;
@ -738,21 +743,20 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
for (table = tables; table; table = table->next)
{
char table_name[NAME_LEN*2+2];
char* db = (table->db) ? table->db : thd->db;
strxmov(table_name,db ? db : "",".",table->name,NullS);
table->table = open_ltable(thd, table, TL_WRITE);
table->table = open_ltable(thd, table, lock_type);
packet->length(0);
if (!table->table)
{
const char *err_msg;
net_store_data(packet, table_name);
net_store_data(packet, "repair");
net_store_data(packet, operator_name);
net_store_data(packet, "error");
if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
@ -763,217 +767,53 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
goto err;
continue;
}
int repair_code = table->table->file->repair(thd, check_opt);
packet->length(0);
net_store_data(packet, table_name);
net_store_data(packet, "repair");
switch(repair_code) {
case HA_REPAIR_NOT_IMPLEMENTED:
net_store_data(packet, "error");
net_store_data(packet, ER(ER_CHECK_NOT_IMPLEMENTED));
break;
case HA_REPAIR_OK:
net_store_data(packet, "status");
net_store_data(packet, "OK");
break;
case HA_REPAIR_FAILED:
net_store_data(packet, "status");
net_store_data(packet, "Not repaired");
break;
default:
net_store_data(packet, "Unknown - internal error during repair");
break;
}
close_thread_tables(thd);
if (my_net_write(&thd->net, (char*) packet->ptr(),
packet->length()))
goto err;
}
close_thread_tables(thd);
send_eof(&thd->net);
DBUG_RETURN(0);
err:
close_thread_tables(thd);
DBUG_RETURN(-1);
}
int mysql_optimize_table(THD* thd, TABLE_LIST* tables)
{
net_printf(&thd->net, ER_PARSE_ERROR, "Sorry; This doesn't work yet", "",
0);
return 1;
}
int mysql_analyze_table(THD* thd, TABLE_LIST* tables)
{
TABLE_LIST *table;
List<Item> field_list;
Item* item;
String* packet = &thd->packet;
DBUG_ENTER("mysql_analyze_table");
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Op", 10));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Msg_type", 10));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Msg_text", 255));
item->maybe_null = 1;
if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
for (table = tables; table; table = table->next)
{
char table_name[NAME_LEN*2+2];
char* db = (table->db) ? table->db : thd->db;
strxmov(table_name,db ? db : "",".",table->name,NullS);
table->table = open_ltable(thd, table, TL_READ_NO_INSERT);
packet->length(0);
if (!table->table)
{
const char *err_msg;
net_store_data(packet, table_name);
net_store_data(packet, "analyze");
net_store_data(packet, "error");
if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
net_store_data(packet, err_msg);
thd->net.last_error[0]=0;
if (my_net_write(&thd->net, (char*) thd->packet.ptr(),
packet->length()))
goto err;
continue;
}
if (table->table->db_stat & HA_READ_ONLY)
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{
net_store_data(packet, table_name);
net_store_data(packet, "analyze");
net_store_data(packet, operator_name);
net_store_data(packet, "error");
net_store_data(packet, ER(ER_OPEN_AS_READONLY));
close_thread_tables(thd);
if (my_net_write(&thd->net, (char*) thd->packet.ptr(),
packet->length()))
goto err;
continue;
}
int analyze_code = table->table->file->analyze(thd);
int result_code = (table->table->file->*operator_func)(thd, check_opt);
packet->length(0);
net_store_data(packet, table_name);
net_store_data(packet, "analyze");
net_store_data(packet, operator_name);
switch(analyze_code) {
case HA_ANALYZE_NOT_IMPLEMENTED:
switch (result_code) {
case HA_ADMIN_NOT_IMPLEMENTED:
net_store_data(packet, "error");
net_store_data(packet, ER(ER_CHECK_NOT_IMPLEMENTED));
break;
case HA_ANALYZE_OK:
case HA_ADMIN_OK:
net_store_data(packet, "status");
net_store_data(packet, "OK");
break;
default:
net_store_data(packet, "Unknown - internal error during analyze");
case HA_ADMIN_FAILED:
net_store_data(packet, "status");
net_store_data(packet, "Operation failed");
break;
}
close_thread_tables(thd);
if (my_net_write(&thd->net, (char*) packet->ptr(),
packet->length()))
goto err;
}
close_thread_tables(thd);
send_eof(&thd->net);
DBUG_RETURN(0);
err:
close_thread_tables(thd);
DBUG_RETURN(-1);
}
case HA_ADMIN_ALREADY_DONE:
net_store_data(packet, "status");
net_store_data(packet, "Table is already up to date");
break;
int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
{
TABLE_LIST *table;
List<Item> field_list;
Item* item;
String* packet = &thd->packet;
DBUG_ENTER("mysql_check_table");
field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Op", 10));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Msg_type", 10));
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Msg_text", 255));
item->maybe_null = 1;
if (send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
for (table = tables; table; table = table->next)
{
char table_name[NAME_LEN*2+2];
char* db = (table->db) ? table->db : thd->db;
strxmov(table_name,db ? db : "",".",table->name,NullS);
table->table = open_ltable(thd, table, TL_READ_NO_INSERT);
packet->length(0);
if (!table->table)
{
const char *err_msg;
net_store_data(packet, table_name);
net_store_data(packet, "check");
case HA_ADMIN_CORRUPT:
net_store_data(packet, "error");
if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
net_store_data(packet, err_msg);
thd->net.last_error[0]=0;
if (my_net_write(&thd->net, (char*) thd->packet.ptr(),
packet->length()))
goto err;
continue;
}
int check_code = table->table->file->check(thd, check_opt);
packet->length(0);
net_store_data(packet, table_name);
net_store_data(packet, "check");
switch(check_code) {
case HA_CHECK_NOT_IMPLEMENTED:
net_store_data(packet, "error");
net_store_data(packet, ER(ER_CHECK_NOT_IMPLEMENTED));
break;
case HA_CHECK_OK:
net_store_data(packet, "status");
net_store_data(packet, "OK");
break;
case HA_CHECK_ALREADY_CHECKED:
net_store_data(packet, "status");
net_store_data(packet, "Not checked");
break;
case HA_CHECK_CORRUPT:
net_store_data(packet, "status");
net_store_data(packet, "Corrupt");
break;
default:
net_store_data(packet, "Unknown - internal error during check");
default: // Probably HA_ADMIN_INTERNAL_ERROR
net_store_data(packet, "error");
net_store_data(packet, "Unknown - internal error during operation");
break;
}
close_thread_tables(thd);
@ -982,15 +822,52 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
goto err;
}
close_thread_tables(thd);
send_eof(&thd->net);
DBUG_RETURN(0);
err:
close_thread_tables(thd);
close_thread_tables(thd); // Shouldn't be needed
DBUG_RETURN(-1);
}
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_repair_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1,
"repair",
&handler::repair));
}
int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_optimize_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_WRITE, 1,
"optimize",
&handler::optimize));
}
int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_analyze_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 1,
"analyze",
&handler::analyze));
}
int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_check_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
TL_READ_NO_INSERT, 0,
"check",
&handler::check));
}
int mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_CREATE_INFO *create_info,

View file

@ -107,14 +107,14 @@ void udf_init()
pthread_mutex_init(&THR_LOCK_udf,NULL);
init_sql_alloc(&mem, 1024);
init_sql_alloc(&mem, 1024,0);
THD *new_thd = new THD;
if (!new_thd ||
hash_init(&udf_hash,32,0,0,get_hash_key, NULL, HASH_CASE_INSENSITIVE))
{
sql_print_error("Can't allocate memory for udf structures");
hash_free(&udf_hash);
free_root(&mem);
free_root(&mem,MYF(0));
DBUG_VOID_RETURN;
}
initialized = 1;
@ -208,7 +208,7 @@ void udf_free()
dlclose(udf->dlhandle);
}
hash_free(&udf_hash);
free_root(&mem);
free_root(&mem,MYF(0));
DBUG_VOID_RETURN;
}

View file

@ -1104,11 +1104,12 @@ mi_check_types:
| CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; }
analyze:
ANALYZE_SYM table_or_tables table_list
ANALYZE_SYM table_or_tables
{
Lex->sql_command = SQLCOM_ANALYZE;
Lex->check_opt.init();
}
table_list opt_mi_check_type
check:
CHECK_SYM table_or_tables
@ -1119,12 +1120,12 @@ check:
table_list opt_mi_check_type
optimize:
OPTIMIZE table_or_tables table_ident
OPTIMIZE table_or_tables
{
Lex->sql_command = SQLCOM_OPTIMIZE;
if (!add_table_to_list($3, NULL))
YYABORT;
Lex->check_opt.init();
}
table_list opt_mi_check_type
rename:
RENAME table_or_tables

View file

@ -69,7 +69,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam->db_stat = db_stat;
error=1;
init_sql_alloc(&outparam->mem_root,1024);
init_sql_alloc(&outparam->mem_root,1024,0);
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root);
@ -550,7 +550,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
my_pthread_setspecific_ptr(THR_MALLOC,old_root);
frm_error(error,outparam,name,ME_ERROR+ME_WAITTANG);
outparam->file=0; // For easyer errorchecking
free_root(&outparam->mem_root);
free_root(&outparam->mem_root,MYF(0));
my_free(outparam->table_name,MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN (error);
} /* openfrm */
@ -578,7 +578,7 @@ int closefrm(register TABLE *table)
delete table->file;
table->file=0; /* For easyer errorchecking */
hash_free(&table->name_hash);
free_root(&table->mem_root);
free_root(&table->mem_root,MYF(0));
DBUG_RETURN(error);
}

View file

@ -27,9 +27,9 @@ extern "C" {
}
}
void init_sql_alloc(MEM_ROOT *mem_root,uint block_size)
void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc)
{
init_alloc_root(mem_root,block_size);
init_alloc_root(mem_root, block_size, pre_alloc);
mem_root->error_handler=sql_alloc_error_handler;
}

View file

@ -46,7 +46,7 @@ do
# but for now it looks like only the mysqld ones are needed for
# server startup scripts
eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\
awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'`
# awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'`
# it would be easier if the my.cnf and variable values were
# all matched, but since they aren't we need to map them here.