Commit 3641a481 authored by monty@donna.mysql.fi's avatar monty@donna.mysql.fi

Merge work:/home/bk/mysql-4.0 into donna.mysql.fi:/home/my/bk/mysql-4.0

parents cc4e7310 b684e9aa
heikki@donna.mysql.fi heikki@donna.mysql.fi
jani@hynda.mysql.fi jani@hynda.mysql.fi
jani@janikt.pp.saunalahti.fi
jcole@abel.spaceapes.com jcole@abel.spaceapes.com
jcole@main.burghcom.com jcole@main.burghcom.com
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
......
...@@ -539,7 +539,7 @@ InnoDB Tables ...@@ -539,7 +539,7 @@ InnoDB Tables
* InnoDB overview:: InnoDB tables overview * InnoDB overview:: InnoDB tables overview
* InnoDB start:: InnoDB startup options * InnoDB start:: InnoDB startup options
* Creating an InnoDB database:: Creating an InnoDB database. * InnoDB init:: Creating InnoDB table space.
* Using InnoDB tables:: Creating InnoDB tables * Using InnoDB tables:: Creating InnoDB tables
* Adding and removing:: Adding and removing InnoDB data and log files * Adding and removing:: Adding and removing InnoDB data and log files
* Backing up:: Backing up and recovering an InnoDB database * Backing up:: Backing up and recovering an InnoDB database
...@@ -552,7 +552,7 @@ InnoDB Tables ...@@ -552,7 +552,7 @@ InnoDB Tables
* InnoDB restrictions:: Some restrictions on InnoDB tables * InnoDB restrictions:: Some restrictions on InnoDB tables
* InnoDB contact information:: InnoDB contact information. * InnoDB contact information:: InnoDB contact information.
Creating an InnoDB database Creating InnoDB table space
* Error creating InnoDB:: * Error creating InnoDB::
...@@ -942,6 +942,12 @@ MySQL Internals ...@@ -942,6 +942,12 @@ MySQL Internals
* MySQL threads:: MySQL threads * MySQL threads:: MySQL threads
* MySQL test suite:: MySQL test suite * MySQL test suite:: MySQL test suite
MySQL Test Suite
* running mysqltest::
* extending mysqltest::
* Reporting mysqltest bugs::
Credits Credits
* Developers:: * Developers::
...@@ -9203,9 +9209,10 @@ You should now have an ODBC connection to @strong{MySQL}, encrypted using SSH. ...@@ -9203,9 +9209,10 @@ You should now have an ODBC connection to @strong{MySQL}, encrypted using SSH.
@node Windows symbolic links, Windows compiling, Windows and SSH, Windows @node Windows symbolic links, Windows compiling, Windows and SSH, Windows
@subsection Splitting Data Across Different Disks on Windows @subsection Splitting Data Across Different Disks on Windows
Beginning with @strong{MySQL} Version 3.23.16, the @strong{MySQL} Beginning with @strong{MySQL} Version 3.23.16, the @code{mysqld-max}
distribution is compiled with the @code{-DUSE_SYMDIR} option. This allows and @code{mysql-max-nt} servers in the @strong{MySQL} distribution are
you to put a database on different disk by adding a symbolic link to it compiled with the @code{-DUSE_SYMDIR} option. This allows you to put a
database on different disk by adding a symbolic link to it
(in a manner similar to the way that symbolic links work on Unix). (in a manner similar to the way that symbolic links work on Unix).
On Windows, you make a symbolic link to a database by creating a file On Windows, you make a symbolic link to a database by creating a file
...@@ -10372,7 +10379,7 @@ feature). ...@@ -10372,7 +10379,7 @@ feature).
Ignore the @code{delay_key_write} option for all tables. Ignore the @code{delay_key_write} option for all tables.
@xref{Server parameters}. @xref{Server parameters}.
@item -Sg, --skip-grant-tables @item --skip-grant-tables
This option causes the server not to use the privilege system at all. This This option causes the server not to use the privilege system at all. This
gives everyone @emph{full access} to all databases! (You can tell a running gives everyone @emph{full access} to all databases! (You can tell a running
server to start using the grant tables again by executing @code{mysqladmin server to start using the grant tables again by executing @code{mysqladmin
...@@ -24716,7 +24723,7 @@ NuSphere is working on removing these limitations. ...@@ -24716,7 +24723,7 @@ NuSphere is working on removing these limitations.
@menu @menu
* InnoDB overview:: InnoDB tables overview * InnoDB overview:: InnoDB tables overview
* InnoDB start:: InnoDB startup options * InnoDB start:: InnoDB startup options
* Creating an InnoDB database:: Creating an InnoDB database. * InnoDB init:: Creating InnoDB table space.
* Using InnoDB tables:: Creating InnoDB tables * Using InnoDB tables:: Creating InnoDB tables
* Adding and removing:: Adding and removing InnoDB data and log files * Adding and removing:: Adding and removing InnoDB data and log files
* Backing up:: Backing up and recovering an InnoDB database * Backing up:: Backing up and recovering an InnoDB database
...@@ -24771,7 +24778,7 @@ may consist of several files. This is different from, for example, ...@@ -24771,7 +24778,7 @@ may consist of several files. This is different from, for example,
InnoDB is distributed under the GNU GPL License Version 2 (of June 1991). InnoDB is distributed under the GNU GPL License Version 2 (of June 1991).
In the source distribution of @strong{MySQL}, InnoDB appears as a subdirectory. In the source distribution of @strong{MySQL}, InnoDB appears as a subdirectory.
@node InnoDB start, Creating an InnoDB database, InnoDB overview, InnoDB @node InnoDB start, InnoDB init, InnoDB overview, InnoDB
@subsection InnoDB startup options @subsection InnoDB startup options
Beginning from @strong{MySQL}-3.23.37 the prefix of the options is changed Beginning from @strong{MySQL}-3.23.37 the prefix of the options is changed
...@@ -24913,8 +24920,8 @@ InnoDB cannot notice. In cases like this the timeout is useful to ...@@ -24913,8 +24920,8 @@ InnoDB cannot notice. In cases like this the timeout is useful to
resolve the situation. resolve the situation.
@end multitable @end multitable
@node Creating an InnoDB database, Using InnoDB tables, InnoDB start, InnoDB @node InnoDB init, Using InnoDB tables, InnoDB start, InnoDB
@subsection Creating an InnoDB database @subsection Creating InnoDB table space
Suppose you have installed @strong{MySQL} and have edited @file{my.cnf} so that Suppose you have installed @strong{MySQL} and have edited @file{my.cnf} so that
it contains the necessary InnoDB configuration parameters. it contains the necessary InnoDB configuration parameters.
...@@ -24975,7 +24982,7 @@ mysqld: ready for connections ...@@ -24975,7 +24982,7 @@ mysqld: ready for connections
* Error creating InnoDB:: * Error creating InnoDB::
@end menu @end menu
@node Error creating InnoDB, , Creating an InnoDB database, Creating an InnoDB database @node Error creating InnoDB, , InnoDB init, InnoDB init
@subsubsection If something goes wrong in database creation @subsubsection If something goes wrong in database creation
If something goes wrong in an InnoDB database creation, you should If something goes wrong in an InnoDB database creation, you should
...@@ -24985,7 +24992,7 @@ create some InnoDB tables, delete also the corresponding @file{.frm} ...@@ -24985,7 +24992,7 @@ create some InnoDB tables, delete also the corresponding @file{.frm}
files for these tables from the @strong{MySQL} database files for these tables from the @strong{MySQL} database
directories. Then you can try the InnoDB database creation again. directories. Then you can try the InnoDB database creation again.
@node Using InnoDB tables, Adding and removing, Creating an InnoDB database, InnoDB @node Using InnoDB tables, Adding and removing, InnoDB init, InnoDB
@subsection Creating InnoDB tables @subsection Creating InnoDB tables
Suppose you have started the @strong{MySQL} client with the command Suppose you have started the @strong{MySQL} client with the command
...@@ -26221,6 +26228,12 @@ The menagerie database will be simple (deliberately), but it is not difficult ...@@ -26221,6 +26228,12 @@ The menagerie database will be simple (deliberately), but it is not difficult
to think of real-world situations in which a similar type of database might to think of real-world situations in which a similar type of database might
be used. For example, a database like this could be used by a farmer to keep be used. For example, a database like this could be used by a farmer to keep
track of livestock, or by a veterinarian to keep track of patient records. track of livestock, or by a veterinarian to keep track of patient records.
A menagerie distribution containing some of the queries and sample data used
in the following sections can be obtained from the @strong{MySQL} Web site.
It's available in either
@uref{http://www.mysql.com/Downloads/Contrib/Examples/menagerie.tar.gz,compressed @code{tar} format}
or
@uref{http://www.mysql.com/Downloads/Contrib/Examples/menagerie.zip,Zip format}.
Use the @code{SHOW} statement to find out what databases currently exist Use the @code{SHOW} statement to find out what databases currently exist
on the server: on the server:
...@@ -35429,12 +35442,20 @@ To add a new native @strong{MySQL} function, follow these steps: ...@@ -35429,12 +35442,20 @@ To add a new native @strong{MySQL} function, follow these steps:
Add one line to @file{lex.h} that defines the function name in the Add one line to @file{lex.h} that defines the function name in the
@code{sql_functions[]} array. @code{sql_functions[]} array.
@item @item
Add two lines to @file{sql_yacc.yy}. One indicates the preprocessor If the function prototype is simple (just takes zero, one, two or three
symbol that @code{yacc} should define (this should be added at the arguments), you should in lex.h specify SYM(FUNC_ARG#) (where # is the
beginning of the file). Then define the function parameters and add an number of arguments) as the second argument in the
``item'' with these parameters to the @code{simple_expr} parsing rule. @code{sql_functions[]} array and add a function that creates a function
For an example, check all occurrences of @code{SOUNDEX} in object in @file{item_create.cc}. Take a look at @code{"ABS"} and
@file{sql_yacc.yy} to see how this is done. @code{create_funcs_abs()} for an example of this.
If the function prototype is complicated (for example takes a variable number
of arguments), you should add two lines to @file{sql_yacc.yy}. One
indicates the preprocessor symbol that @code{yacc} should define (this
should be added at the beginning of the file). Then define the function
parameters and add an ``item'' with these parameters to the
@code{simple_expr} parsing rule. For an example, check all occurrences
of @code{ATAN} in @file{sql_yacc.yy} to see how this is done.
@item @item
In @file{item_func.h}, declare a class inheriting from @code{Item_num_func} or In @file{item_func.h}, declare a class inheriting from @code{Item_num_func} or
@code{Item_str_func}, depending on whether your function returns a number or a @code{Item_str_func}, depending on whether your function returns a number or a
...@@ -35447,28 +35468,45 @@ double Item_func_newname::val() ...@@ -35447,28 +35468,45 @@ double Item_func_newname::val()
longlong Item_func_newname::val_int() longlong Item_func_newname::val_int()
String *Item_func_newname::Str(String *str) String *Item_func_newname::Str(String *str)
@end example @end example
If you inherit your object from any of the standard items (like
@code{Item_num_func} you probably only have to define one of the above
functions and let the parent object take care of the other functions.
For example, the @code{Item_str_func} class defines a @code{val()} function
that executes @code{atof()} on the value returned by @code{::str()}.
@item @item
You should probably also define the following function: You should probably also define the following object function:
@example @example
void Item_func_newname::fix_length_and_dec() void Item_func_newname::fix_length_and_dec()
@end example @end example
This function should at least calculate @code{max_length} based on the This function should at least calculate @code{max_length} based on the
given arguments. @code{max_length} is the maximum number of characters given arguments. @code{max_length} is the maximum number of characters
the function may return. This function should also set @code{maybe_null = 0} the function may return. This function should also set @code{maybe_null
if the main function can't return a @code{NULL} value. The function can check = 0} if the main function can't return a @code{NULL} value. The
if any of the function arguments can return @code{NULL} by checking the function can check if any of the function arguments can return
arguments @code{maybe_null} variable. @code{NULL} by checking the arguments @code{maybe_null} variable. You
can take a look at @code{Item_func_mod::fix_length_and_dec} for a
typical example of how to do this.
@end enumerate @end enumerate
All functions must be thread safe. All functions must be thread safe (In other words, don't use any global or
static variables in the functions without protecting them with mutexes).
If you want to return @code{NULL}, from @code{::val()}, @code{::val_int()}
or @code{::str()} you should set @code{null_value} to 1 and return 0.
For @code{::str()} object functions, there are some additional
considerations to be aware of:
For string functions, there are some additional considerations to be aware of:
@itemize @bullet @itemize @bullet
@item @item
The @code{String *str} argument provides a string The @code{String *str} argument provides a string buffer that may be
buffer that may be used to hold the result. used to hold the result. (For more information about the @code{String} type,
take a look at the @file{sql_string.h} file.)
@item @item
The function should return the string that holds the result. The @code{::str()} function should return the string that holds the result or
@code{(char*) 0} if the result is @code{NULL}.
@item @item
All current string functions try to avoid allocating any memory unless All current string functions try to avoid allocating any memory unless
absolutely necessary! absolutely necessary!
...@@ -42486,16 +42524,35 @@ as well developers, to do regression tests on the @strong{MySQL} code. To ...@@ -42486,16 +42524,35 @@ as well developers, to do regression tests on the @strong{MySQL} code. To
address this problem, we have created a new test system that is included in address this problem, we have created a new test system that is included in
the source and binary distributions starting in Version 3.23.29. the source and binary distributions starting in Version 3.23.29.
The test system consist of a test language interpreter (@code{mysqltest}), The current set of test cases doesn't test everything in MySQL but, it
a shell script to run all tests(@code{mysql-test-run}), the actual test cases should catch most obvious bugs in the SQL processing code, OS/library
written in a special test language, and their expected results. To run the issues, and is quite thorough in testing replication. Our eventual goal
test suite on your system after a build, type @code{mysql-test/mysql-test-run} is to have the tests cover 100% of the code. We welcome contributions
from the source root. If you have installed a binary distribution, @code{cd} to our test suite. You may especially want to contribute tests that
to the install root (eg. @code{/usr/local/mysql}), and do examine the functionality critical to your system, as this will ensure
@code{scripts/mysql-test-run}. All tests should succeed. If they do not, that all future @strong{MySQL} releases will work well with your
use @code{mysqlbug} to send a bug report to @email{bugs@@lists.mysql.com}. applications.
Make sure to include the output of @code{mysql-test-run}, as well as
contents of all @code{.reject} files in @code{mysql-test/r} directory. @menu
* running mysqltest::
* extending mysqltest::
* Reporting mysqltest bugs::
@end menu
@node running mysqltest, extending mysqltest, MySQL test suite, MySQL test suite
@subsection Running the MySQL Test Suite
The test system consist of a test language interpreter
(@code{mysqltest}), a shell script to run all
tests(@code{mysql-test-run}), the actual test cases written in a special
test language, and their expected results. To run the test suite on
your system after a build, type @code{make test} or
@code{mysql-test/mysql-test-run} from the source root. If you have
installed a binary distribution, @code{cd} to the install root
(eg. @code{/usr/local/mysql}), and do @code{scripts/mysql-test-run}.
All tests should succeed. If not, you should try to find out why and
report the problem if this is a bug in @strong{MySQL}.
@xref{Reporting mysqltest bugs}.
If you have a copy of @code{mysqld} running on the machine where you want to If you have a copy of @code{mysqld} running on the machine where you want to
run the test suite you do not have to stop it, as long as it is not using run the test suite you do not have to stop it, as long as it is not using
...@@ -42503,14 +42560,14 @@ ports @code{9306} and @code{9307}. If one of those ports is taken, you should ...@@ -42503,14 +42560,14 @@ ports @code{9306} and @code{9307}. If one of those ports is taken, you should
edit @code{mysql-test-run} and change the values of the master and/or slave edit @code{mysql-test-run} and change the values of the master and/or slave
port to one that is available. port to one that is available.
The current set of test cases is far from comprehensive, as we have not yet You can run one individual test case with
converted all of our private tests to the new format. However, it should @code{mysql-test/mysql-test-run test_name}.
already catch most obvious bugs in the SQL processing code, OS/library issues,
and is quite thorough in testing replication. Our eventual goal is to have If one test fails, you should test running @code{mysql-test-run} with
the tests cover 100% of the code. We welcome contributions to our test suite. the @code{--force} option to check if any other tests fails.
You may especially want to contribute tests that examine the functionality
critical to your system, as this will ensure that all future @strong{MySQL} @node extending mysqltest, Reporting mysqltest bugs, running mysqltest, MySQL test suite
releases will work well with your applications. @subsection Extending the MySQL Test Suite
You can use the @code{mysqltest} language to write your own test cases. You can use the @code{mysqltest} language to write your own test cases.
Unfortunately, we have not yet written full documentation for it - we plan to Unfortunately, we have not yet written full documentation for it - we plan to
...@@ -42518,15 +42575,9 @@ do this shortly. You can, however, look at our current test cases and use ...@@ -42518,15 +42575,9 @@ do this shortly. You can, however, look at our current test cases and use
them as an example. The following points should help you get started: them as an example. The following points should help you get started:
@itemize @itemize
@item @item
The tests are located in @code{mysql-test/t/*.test} The tests are located in @code{mysql-test/t/*.test}
@item
You can run one individual test case with
@code{mysql-test/mysql-test-run test_name}
removing @code{.test} extension from the file name
@item @item
A test case consists of @code{;} terminated statements and is similar to the A test case consists of @code{;} terminated statements and is similar to the
input of @code{mysql} command line client. A statement by default is a query input of @code{mysql} command line client. A statement by default is a query
...@@ -42555,15 +42606,9 @@ test produces more than one result, you should use @code{test_name.a.result}, ...@@ -42555,15 +42606,9 @@ test produces more than one result, you should use @code{test_name.a.result},
@code{test_name.b.result}, etc. @code{test_name.b.result}, etc.
@item @item
Failed test results are put in a file with the same base name as the If a statement returns an error, you should on the line before the statement
result file with the @code{.reject} extension. If your test case is specify with the @code{--error error-number}. The error number can be
failing, you should do a diff on the two files. If you cannot see how a list of possible error numbers separated with @code{','}.
they are different, examine both with @code{od -c} and also check their
lengths.
@item
You can prefix a query with @code{!} if the test can continue after that query
returns an error.
@item @item
If you are writing a replication test case, you should on the first line of If you are writing a replication test case, you should on the first line of
...@@ -42602,6 +42647,9 @@ attachments, you should ftp all the relevant files to: ...@@ -42602,6 +42647,9 @@ attachments, you should ftp all the relevant files to:
@end itemize @end itemize
@node Reporting mysqltest bugs, , extending mysqltest, MySQL test suite
@subsection Extending the MySQL Test Suite
If your @strong{MySQL} version doesn't pass the test suite you should If your @strong{MySQL} version doesn't pass the test suite you should
do the following: do the following:
...@@ -42611,6 +42659,26 @@ Don't send a bug report before you have found out as much as possible of ...@@ -42611,6 +42659,26 @@ Don't send a bug report before you have found out as much as possible of
what when wrong! When you do it, please use the @code{mysqlbug} script what when wrong! When you do it, please use the @code{mysqlbug} script
so that we can get information about your system and @code{MySQL} so that we can get information about your system and @code{MySQL}
version. @xref{Bug reports}. version. @xref{Bug reports}.
@item
Make sure to include the output of @code{mysql-test-run}, as well as
contents of all @code{.reject} files in @code{mysql-test/r} directory.
@item
If a test in the test suite fails, check if the test fails also when run
by its own:
@example
cd mysql-test
mysql-test-run --local test-name
@end example
If this fails, then you should configure @strong{MySQL} with
@code{--with-debug} and run @code{mysql-test-run} with the
@code{--debug} option. If this also fails send the trace file
@file{var/tmp/master.trace} to ftp://support.mysql.com/pub/mysql/secret
so that we can examine it. Please remember to also include a full
description of your system, the version of the mysqld binary and how you
compiled it.
@item @item
If you have compiled @strong{MySQL} yourself, check our manual for how If you have compiled @strong{MySQL} yourself, check our manual for how
to compile @strong{MySQL} on your platform or, preferable, use one of to compile @strong{MySQL} on your platform or, preferable, use one of
...@@ -42622,10 +42690,14 @@ pass the test suite ! ...@@ -42622,10 +42690,14 @@ pass the test suite !
If you get an error, like @code{Result length mismatch} or @code{Result If you get an error, like @code{Result length mismatch} or @code{Result
content mismatch} it means that the output of the test didn't match content mismatch} it means that the output of the test didn't match
exactly the expected output. This could be a bug in @strong{MySQL} or exactly the expected output. This could be a bug in @strong{MySQL} or
that your @code{mysqld} version produces slightly different results under some that your mysqld version produces slight different results under some
circumstances. In this case, you should compare the @file{.test} circumstances.
and @file{.reject} file in the @file{mysql-test/r} sub directory to
see if this is something to worry about. Failed test results are put in a file with the same base name as the
result file with the @code{.reject} extension. If your test case is
failing, you should do a diff on the two files. If you cannot see how
they are different, examine both with @code{od -c} and also check their
lengths.
@item @item
If a test fails totally, you should check the logs file in the If a test fails totally, you should check the logs file in the
...@@ -42633,7 +42705,8 @@ If a test fails totally, you should check the logs file in the ...@@ -42633,7 +42705,8 @@ If a test fails totally, you should check the logs file in the
@item @item
If you have compiled @strong{MySQL} with debugging you can try to debug this If you have compiled @strong{MySQL} with debugging you can try to debug this
with the @code{--gdb} and @code{--debug} options to @code{mysql-test-run}. by running @code{mysql-test-run} with the @code{--gdb} and/or @code{--debug}
options.
@xref{Making trace files}. @xref{Making trace files}.
If you have not compiled @strong{MySQL} for debugging you should probably If you have not compiled @strong{MySQL} for debugging you should probably
...@@ -43459,6 +43532,11 @@ these tables directly without ODBC-driver. ...@@ -43459,6 +43532,11 @@ these tables directly without ODBC-driver.
Windows GUI (binary only) to administrate a database, by David B. Mansel, Windows GUI (binary only) to administrate a database, by David B. Mansel,
@email{david@@zhadum.org}. @email{david@@zhadum.org}.
@item @uref{http://members.xoom.com/_opex_/mysqlmanager/index.html, MySQL Manager}
a graphical MySQL server manager for MySQL server written in Java, for Windows
@item @uref{http://www.mysql.com/Downloads/Win32/netadmin.zip, netadmin.zip} @item @uref{http://www.mysql.com/Downloads/Win32/netadmin.zip, netadmin.zip}
An administrator tool for @strong{MySQL} on Windows 95/98 and Windows NT An administrator tool for @strong{MySQL} on Windows 95/98 and Windows NT
4.0. Only tested with @strong{MySQL} Versions 3.23.5 - 3.23.7. Written 4.0. Only tested with @strong{MySQL} Versions 3.23.5 - 3.23.7. Written
...@@ -44553,6 +44631,9 @@ not yet 100% confident in this code. ...@@ -44553,6 +44631,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.39 @appendixsubsec Changes in release 3.23.39
@itemize @bullet @itemize @bullet
@item @item
Fixed that date-part extract functions works with dates where day
and/or month is 0.
@item
Extended argument length in option files from 256 to 512 chars. Extended argument length in option files from 256 to 512 chars.
@item @item
Fixed problem with shutdown when @code{INSERT DELAYED} was waiting for Fixed problem with shutdown when @code{INSERT DELAYED} was waiting for
...@@ -48,6 +48,9 @@ extern dulint srv_archive_recovery_limit_lsn; ...@@ -48,6 +48,9 @@ extern dulint srv_archive_recovery_limit_lsn;
extern ulint srv_lock_wait_timeout; extern ulint srv_lock_wait_timeout;
extern char* srv_unix_file_flush_method_str;
extern ulint srv_unix_file_flush_method;
extern ibool srv_set_thread_priorities; extern ibool srv_set_thread_priorities;
extern int srv_query_thread_priority; extern int srv_query_thread_priority;
...@@ -100,6 +103,13 @@ typedef struct srv_sys_struct srv_sys_t; ...@@ -100,6 +103,13 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */ /* The server system */
extern srv_sys_t* srv_sys; extern srv_sys_t* srv_sys;
/* Alternatives for fiel flush option in Unix; see the InnoDB manual about
what these mean */
#define SRV_UNIX_FDATASYNC 1
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4
/************************************************************************* /*************************************************************************
Boots Innobase server. */ Boots Innobase server. */
......
...@@ -838,14 +838,18 @@ log_io_complete( ...@@ -838,14 +838,18 @@ log_io_complete(
/* It was a checkpoint write */ /* It was a checkpoint write */
group = (log_group_t*)((ulint)group - 1); group = (log_group_t*)((ulint)group - 1);
fil_flush(group->space_id); if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id);
}
log_io_complete_checkpoint(group); log_io_complete_checkpoint(group);
return; return;
} }
fil_flush(group->space_id); if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id);
}
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
...@@ -1474,7 +1478,9 @@ log_checkpoint( ...@@ -1474,7 +1478,9 @@ log_checkpoint(
recv_apply_hashed_log_recs(TRUE); recv_apply_hashed_log_recs(TRUE);
} }
fil_flush_file_spaces(FIL_TABLESPACE); if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush_file_spaces(FIL_TABLESPACE);
}
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
......
...@@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri ...@@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h" #include "os0file.h"
#include "os0sync.h" #include "os0sync.h"
#include "ut0mem.h" #include "ut0mem.h"
#include "srv0srv.h"
#ifdef POSIX_ASYNC_IO #ifdef POSIX_ASYNC_IO
...@@ -345,12 +346,11 @@ try_again: ...@@ -345,12 +346,11 @@ try_again:
UT_NOT_USED(purpose); UT_NOT_USED(purpose);
/* On Linux opening a file in the O_SYNC mode seems to be much #ifdef O_DSYNC
more efficient for small writes than calling an explicit fsync or if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is create_flag = create_flag | O_DSYNC;
extremely slow in large block writes to a big file. Therefore we }
do not use these options, but use explicit fdatasync. */ #endif
if (create_mode == OS_FILE_CREATE) { if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
| S_IWGRP | S_IROTH | S_IWOTH); | S_IWGRP | S_IROTH | S_IWOTH);
...@@ -546,6 +546,12 @@ os_file_flush( ...@@ -546,6 +546,12 @@ os_file_flush(
return(FALSE); return(FALSE);
#else #else
int ret; int ret;
#ifdef O_DSYNC
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
return(TRUE);
}
#endif
#ifdef HAVE_FDATASYNC #ifdef HAVE_FDATASYNC
ret = fdatasync(file); ret = fdatasync(file);
...@@ -621,10 +627,15 @@ os_file_pwrite( ...@@ -621,10 +627,15 @@ os_file_pwrite(
#ifdef HAVE_PWRITE #ifdef HAVE_PWRITE
ret = pwrite(file, buf, n, offs); ret = pwrite(file, buf, n, offs);
/* Always do fsync to reduce the probability that when the OS crashes, if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
a database page is only partially physically written to disk. */ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
ut_a(TRUE == os_file_flush(file)); /* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file));
}
return(ret); return(ret);
#else #else
...@@ -645,10 +656,15 @@ os_file_pwrite( ...@@ -645,10 +656,15 @@ os_file_pwrite(
ret = write(file, buf, n); ret = write(file, buf, n);
/* Always do fsync to reduce the probability that when the OS crashes, if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
a database page is only partially physically written to disk. */ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
ut_a(TRUE == os_file_flush(file)); /* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file));
}
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
......
...@@ -88,6 +88,9 @@ dulint srv_archive_recovery_limit_lsn; ...@@ -88,6 +88,9 @@ dulint srv_archive_recovery_limit_lsn;
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024; ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
char* srv_unix_file_flush_method_str = NULL;
ulint srv_unix_file_flush_method = 0;
ibool srv_set_thread_priorities = TRUE; ibool srv_set_thread_priorities = TRUE;
int srv_query_thread_priority = 0; int srv_query_thread_priority = 0;
/*-------------------------------------------*/ /*-------------------------------------------*/
......
...@@ -532,6 +532,22 @@ innobase_start_or_create_for_mysql(void) ...@@ -532,6 +532,22 @@ innobase_start_or_create_for_mysql(void)
srv_is_being_started = TRUE; srv_is_being_started = TRUE;
if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) {
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "O_DSYNC")) {
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str,
"littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) {
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
} else {
fprintf(stderr,
"InnoDB: Unrecognized value for innodb_unix_file_flush_method\n");
return(DB_ERROR);
}
os_aio_use_native_aio = srv_use_native_aio; os_aio_use_native_aio = srv_use_native_aio;
err = srv_boot(); err = srv_boot();
......
encrypt('foo', 'ff') length(encrypt('foo', 'ff')) <> 0
ffTU0fyIP09Z. 1
...@@ -20,6 +20,8 @@ dayofmonth("1997-01-02") dayofmonth(19970323) ...@@ -20,6 +20,8 @@ dayofmonth("1997-01-02") dayofmonth(19970323)
2 23 2 23
month("1997-01-02") year("98-02-03") dayofyear("1997-12-31") month("1997-01-02") year("98-02-03") dayofyear("1997-12-31")
1 1998 365 1 1998 365
month("2001-02-00") year("2001-00-00")
2 2001
DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303) DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303)
62 9 1 62 9 1
HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322) HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322)
...@@ -184,6 +186,8 @@ extract(MINUTE_SECOND FROM "10:11:12") ...@@ -184,6 +186,8 @@ extract(MINUTE_SECOND FROM "10:11:12")
1112 1112
extract(SECOND FROM "1999-01-02 10:11:12") extract(SECOND FROM "1999-01-02 10:11:12")
12 12
extract(MONTH FROM "2001-02-00")
2
ctime hour(ctime) ctime hour(ctime)
2001-01-12 12:23:40 12 2001-01-12 12:23:40 12
monthname(date) monthname(date)
......
...@@ -252,7 +252,7 @@ id ggid email passwd ...@@ -252,7 +252,7 @@ id ggid email passwd
2 test2 yyy 2 test2 yyy
id ggid email passwd id ggid email passwd
1 this will work 1 this will work
3 test2 this will work 4 test2 this will work
id ggid email passwd id ggid email passwd
1 this will work 1 this will work
id ggid email passwd id ggid email passwd
...@@ -474,4 +474,4 @@ t1 CREATE TABLE `t1` ( ...@@ -474,4 +474,4 @@ t1 CREATE TABLE `t1` (
a a
1 1
2 2
3 4
select encrypt('foo', 'ff');
select length(encrypt('foo', 'ff')) <> 0;
...@@ -14,6 +14,7 @@ select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); ...@@ -14,6 +14,7 @@ select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")); select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
select dayofmonth("1997-01-02"),dayofmonth(19970323); select dayofmonth("1997-01-02"),dayofmonth(19970323);
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31"); select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
select month("2001-02-00"),year("2001-00-00");
select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303); select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322); select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
select week(19980101),week(19970101),week(19980101,1),week(19970101,1); select week(19980101),week(19970101),week(19980101,1),week(19970101,1);
...@@ -100,6 +101,7 @@ select extract(HOUR_SECOND FROM "10:11:12"); ...@@ -100,6 +101,7 @@ select extract(HOUR_SECOND FROM "10:11:12");
select extract(MINUTE FROM "10:11:12"); select extract(MINUTE FROM "10:11:12");
select extract(MINUTE_SECOND FROM "10:11:12"); select extract(MINUTE_SECOND FROM "10:11:12");
select extract(SECOND FROM "1999-01-02 10:11:12"); select extract(SECOND FROM "1999-01-02 10:11:12");
select extract(MONTH FROM "2001-02-00");
create table t1 (ctime varchar(20)); create table t1 (ctime varchar(20));
insert into t1 values ('2001-01-12 12:23:40'); insert into t1 values ('2001-01-12 12:23:40');
......
...@@ -449,7 +449,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) ...@@ -449,7 +449,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"read lock with old write lock",0); check_locks(lock,"read lock with old write lock",0);
if (lock->get_status) if (lock->get_status)
(*lock->get_status)(data->status_param); (*lock->get_status)(data->status_param);
++locks_immediate; statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end; goto end;
} }
if (lock->write.data->type == TL_WRITE_ONLY) if (lock->write.data->type == TL_WRITE_ONLY)
...@@ -473,7 +473,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) ...@@ -473,7 +473,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if ((int) lock_type == (int) TL_READ_NO_INSERT) if ((int) lock_type == (int) TL_READ_NO_INSERT)
lock->read_no_write_count++; lock->read_no_write_count++;
check_locks(lock,"read lock with no write locks",0); check_locks(lock,"read lock with no write locks",0);
++locks_immediate; statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end; goto end;
} }
/* Can't get lock yet; Wait for it */ /* Can't get lock yet; Wait for it */
...@@ -505,7 +505,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) ...@@ -505,7 +505,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
data->cond=get_cond(); data->cond=get_cond();
if (lock->get_status) if (lock->get_status)
(*lock->get_status)(data->status_param); (*lock->get_status)(data->status_param);
++locks_immediate; statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end; goto end;
} }
} }
...@@ -540,7 +540,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) ...@@ -540,7 +540,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"second write lock",0); check_locks(lock,"second write lock",0);
if (data->lock->get_status) if (data->lock->get_status)
(*data->lock->get_status)(data->status_param); (*data->lock->get_status)(data->status_param);
++locks_immediate; statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end; goto end;
} }
DBUG_PRINT("lock",("write locked by thread: %ld", DBUG_PRINT("lock",("write locked by thread: %ld",
...@@ -566,7 +566,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) ...@@ -566,7 +566,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if (data->lock->get_status) if (data->lock->get_status)
(*data->lock->get_status)(data->status_param); (*data->lock->get_status)(data->status_param);
check_locks(lock,"only write lock",0); check_locks(lock,"only write lock",0);
++locks_immediate; statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end; goto end;
} }
} }
......
...@@ -83,6 +83,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group, ...@@ -83,6 +83,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group,
char *innobase_data_home_dir, *innobase_data_file_path; char *innobase_data_home_dir, *innobase_data_file_path;
char *innobase_log_group_home_dir, *innobase_log_arch_dir; char *innobase_log_group_home_dir, *innobase_log_arch_dir;
char *innobase_unix_file_flush_method;
bool innobase_flush_log_at_trx_commit, innobase_log_archive, bool innobase_flush_log_at_trx_commit, innobase_log_archive,
innobase_use_native_aio; innobase_use_native_aio;
...@@ -474,6 +475,10 @@ innobase_init(void) ...@@ -474,6 +475,10 @@ innobase_init(void)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
srv_unix_file_flush_method_str = (innobase_unix_file_flush_method ?
innobase_unix_file_flush_method :
(char*)"fdatasync");
srv_n_log_groups = (ulint) innobase_mirrored_log_groups; srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
srv_n_log_files = (ulint) innobase_log_files_in_group; srv_n_log_files = (ulint) innobase_log_files_in_group;
srv_log_file_size = (ulint) innobase_log_file_size; srv_log_file_size = (ulint) innobase_log_file_size;
......
...@@ -161,6 +161,7 @@ extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; ...@@ -161,6 +161,7 @@ extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size;
extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern long innobase_file_io_threads, innobase_lock_wait_timeout;
extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method;
extern bool innobase_flush_log_at_trx_commit, innobase_log_archive, extern bool innobase_flush_log_at_trx_commit, innobase_log_archive,
innobase_use_native_aio; innobase_use_native_aio;
......
...@@ -75,7 +75,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate) ...@@ -75,7 +75,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
char buff[40]; char buff[40];
String tmp(buff,sizeof(buff)),*res; String tmp(buff,sizeof(buff)),*res;
if (!(res=val_str(&tmp)) || if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,0) == TIMESTAMP_NONE) str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
{ {
bzero((char*) ltime,sizeof(*ltime)); bzero((char*) ltime,sizeof(*ltime));
return 1; return 1;
......
...@@ -2473,6 +2473,7 @@ enum options { ...@@ -2473,6 +2473,7 @@ enum options {
OPT_INNODB_LOG_ARCH_DIR, OPT_INNODB_LOG_ARCH_DIR,
OPT_INNODB_LOG_ARCHIVE, OPT_INNODB_LOG_ARCHIVE,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD,
OPT_SAFE_SHOW_DB, OPT_SAFE_SHOW_DB,
OPT_GEMINI_SKIP, OPT_INNODB_SKIP, OPT_GEMINI_SKIP, OPT_INNODB_SKIP,
OPT_TEMP_POOL, OPT_DO_PSTACK, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_DO_PSTACK, OPT_TX_ISOLATION,
...@@ -2535,6 +2536,8 @@ static struct option long_options[] = { ...@@ -2535,6 +2536,8 @@ static struct option long_options[] = {
OPT_INNODB_LOG_ARCHIVE}, OPT_INNODB_LOG_ARCHIVE},
{"innodb_flush_log_at_trx_commit", optional_argument, 0, {"innodb_flush_log_at_trx_commit", optional_argument, 0,
OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT}, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT},
{"innodb_unix_file_flush_method", required_argument, 0,
OPT_INNODB_UNIX_FILE_FLUSH_METHOD},
#endif #endif
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"init-file", required_argument, 0, (int) OPT_INIT_FILE}, {"init-file", required_argument, 0, (int) OPT_INIT_FILE},
...@@ -2821,6 +2824,7 @@ struct show_var_st init_vars[]= { ...@@ -2821,6 +2824,7 @@ struct show_var_st init_vars[]= {
{"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
{"innodb_unix_file_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
#endif #endif
{"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG}, {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG},
{"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG},
...@@ -3666,6 +3670,9 @@ static void get_options(int argc,char **argv) ...@@ -3666,6 +3670,9 @@ static void get_options(int argc,char **argv)
case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT: case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT:
innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1; innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1;
break; break;
case OPT_INNODB_UNIX_FILE_FLUSH_METHOD:
innobase_unix_file_flush_method=optarg;
break;
#endif /* HAVE_INNOBASE_DB */ #endif /* HAVE_INNOBASE_DB */
case OPT_DO_PSTACK: case OPT_DO_PSTACK:
opt_do_pstack = 1; opt_do_pstack = 1;
......
...@@ -1864,15 +1864,6 @@ mysql_execute_command(void) ...@@ -1864,15 +1864,6 @@ mysql_execute_command(void)
} }
if (check_db_used(thd,tables) || end_active_trans(thd)) if (check_db_used(thd,tables) || end_active_trans(thd))
goto error; goto error;
for (TABLE_LIST *tmp = tables; tmp; tmp = tmp->next)
{
if (!(tmp->lock_type == TL_READ_NO_INSERT ?
!check_table_access(thd, SELECT_ACL, tmp) :
(!check_table_access(thd, INSERT_ACL, tmp) ||
!check_table_access(thd, UPDATE_ACL, tmp) ||
!check_table_access(thd, DELETE_ACL, tmp))))
goto error;
}
thd->in_lock_tables=1; thd->in_lock_tables=1;
if (!(res=open_and_lock_tables(thd,tables))) if (!(res=open_and_lock_tables(thd,tables)))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment