From: Joerg Bruehe Date: August 17 2011 9:27am Subject: bzr push into mysql-5.5 branch (joerg.bruehe:3469 to 3481) List-Archive: http://lists.mysql.com/commits/140667 Message-Id: <201108170927.p7H9RoHi002458@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3481 Sven Sandberg 2011-07-27 [merge] Null merge 3480 Sven Sandberg 2011-07-27 Updated default.experimental; now rpl tests are up to date as of 2011-07-25. modified: mysql-test/collections/default.experimental 3479 Sergey Glukhov 2011-07-27 [merge] 5.1 -> 5.5 merge @ mysql-test/r/func_time.result 5.1 -> 5.5 merge @ mysql-test/t/func_time.test 5.1 -> 5.5 merge @ sql/item_timefunc.cc 5.1 -> 5.5 merge modified: mysql-test/r/func_time.result mysql-test/t/func_time.test sql/item_timefunc.cc 3478 Alfranio Correia 2011-07-24 Post-push fix for BUG#11809016. In 5.5, REFRESH SLAVE is used as an alias for RESET SLAVE and was removed in 5.6. Reseting a slave through REFRESH SLAVE was causing errors in the valgrind platform since reset_slave_info was undefined. To fix the problem, we have set reset_slave_info while calling REFRESH SLAVE. modified: sql/sql_yacc.yy 3477 Dmitry Lenev 2011-07-22 Fix for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1". The problem was that CHECK/REPAIR TABLE for a MERGE table which had several children missing or in wrong engine reported only issue with the first such table in its result-set. While in 5.0 this statement returned the whole list of problematic tables. Ability to report problems for all children was lost during significant refactorings of MERGE code which were done as part of work on 5.1 and 5.5 releases. This patch restores status quo ante refactorings by changing code in such a way that: 1) Failure to open child table due to its absence during CHECK/ REPAIR TABLE for a MERGE table is not reported immediately when its absence is discovered in open_tables(). Instead handling/error reporting in such a situation is postponed until the moment when children are attached. 2) Code performing attaching of children no longer stops when it encounters first problem with one of the children during CHECK/REPAIR TABLE. Instead it continues iteration through the child list until all problems caused by child absence/ wrong engine are reported. Note that even after this change problem with mismatch of child/parent definition won't be reported if there is also another child missing, but this is how it was in 5.0 as well. @ mysql-test/r/merge.result Added test case for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1". Adjusted results of existing tests to the fact that CHECK/REPAIR TABLE statements now try to report problems about missing table/ wrong engine for all underlying tables, and to the fact that mismatch of parent/child definitions is always reported as an error and not a warning. @ mysql-test/t/merge.test Added test case for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1". @ sql/sql_base.cc Changed code responsible for opening tables to ignore the fact that underlying tables of a MERGE table are missing, if this table is opened for CHECK/REPAIR TABLE. The absence of underlying tables in this case is now detected and appropriate error is reported at the point when child tables are attached. At this point we can produce full list of problematic child tables/errors to be returned as part of CHECK/REPAIR TABLE result-set. @ storage/myisammrg/ha_myisammrg.cc Changed myisammrg_attach_children_callback() to handle new situation, when during CHECK/REPAIR TABLE we do not report error about missing child immediately when this fact is discovered during open_tables() but postpone error-reporting till the time when children are attached. Also this callback is now responsible for pushing an error mentioning problematic child table to the list of errors to be reported by CHECK/REPAIR TABLE statements. Finally, since now myrg_attach_children() no longer relies on return value from callback to determine the end of the children list, callback no longer needs to set my_errno value and can be simplified. Changed myrg_print_wrong_table() to always report a problem with child table as an error and not as a warning. This makes reporting for different types of issues with child tables more consistent and compatible with 5.0 behavior. @ storage/myisammrg/myrg_open.c Changed code in myrg_attach_children() not to abort on the first problem with a child table when attaching children to parent MERGE table during CHECK/REPAIR TABLE statement execution. This allows CHECK/REPAIR TABLE to report problems about absence/wrong engine for all underlying tables as part of their result-set. modified: mysql-test/r/merge.result mysql-test/t/merge.test sql/sql_base.cc storage/myisammrg/ha_myisammrg.cc storage/myisammrg/myrg_open.c 3476 Sunanda Menon 2011-07-22 Bug #12561297: Added the MySQL embedded binary modified: support-files/mysql.spec.sh 3475 Alexander Nozdrin 2011-07-22 [merge] Manual merge from mysql-5.1. modified: client/mysql.cc client/mysql_upgrade.c client/mysqladmin.cc client/mysqlcheck.c client/mysqldump.c client/mysqlimport.c client/mysqlshow.c client/mysqltest.cc sql/gen_lex_hash.cc sql/mysqld.cc 3474 Jon Olav Hauglid 2011-07-21 Bug#12779790 COMPILATION FAILS OS X 10.7 - IMPLICIT DECLARATION OF FUNCTION 'PTHREAD_INIT' The problem was that compilation would fail with a warning: Implicit declaration of function 'pthread_init' if MySQL was compiled on OS X 10.7 (Lion). The reason was that pthread_init() is now part of an internal OS X pthread library so it was found by CMake. This patch fixes the problem by removing HAVE_PTHREAD_INIT and related code. pthread_init() was specific to MIT-pthreads which has not been supported since 4.1 and was therefore no longer relevant. No test case added. modified: config.h.cmake configure.cmake dbug/dbug_analyze.c dbug/my_main.c dbug/tests.c mysys/my_init.c 3473 Anitha Gopi 2011-07-20 Fixed the bug number since Bug#11755949 was closed as duplicate of Bug#11753919 modified: mysql-test/collections/default.experimental 3472 Alfranio Correia 2011-07-20 [merge] merge mysql-5.5 (local) --> mysql-5.5 modified: mysql-test/extra/rpl_tests/rpl_reset_slave.test mysql-test/suite/rpl/r/rpl_row_reset_slave.result mysql-test/suite/rpl/r/rpl_stm_reset_slave.result sql/rpl_mi.cc sql/rpl_mi.h sql/sql_lex.h sql/sql_repl.cc sql/sql_yacc.yy 3471 Tor Didriksen 2011-07-20 Bug#12756017 - PROFILING: SET_THD_PROC_INFO DOES NOT NEED TO CALL DIRNAME_LENGTH EACH TIME @ mysql-test/t/implicit_commit.test Test fails if server is compiled with -DENABLED_PROFILING=0 @ sql/sql_class.cc Let class PROFILING do its own handling of the input file name. @ sql/sql_profile.cc Store only basename of file argument. modified: mysql-test/t/implicit_commit.test sql/sql_class.cc sql/sql_profile.cc 3470 Inaam Rana 2011-07-19 [merge] Merge from 5.1 the fix for Bug 12356373 added: mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test modified: storage/innobase/buf/buf0buf.c storage/innobase/buf/buf0rea.c storage/innobase/handler/ha_innodb.cc storage/innobase/include/buf0buf.h storage/innobase/include/buf0buf.ic storage/innobase/include/buf0lru.h storage/innobase/include/buf0rea.h storage/innobase/include/srv0srv.h storage/innobase/srv/srv0srv.c 3469 Sunanda Menon 2011-07-19 #41836: Eventum Request to enable the mysql_embedded binary modified: libmysqld/examples/CMakeLists.txt === modified file 'client/mysql.cc' --- a/client/mysql.cc 2011-06-30 15:46:53 +0000 +++ b/client/mysql.cc 2011-07-22 07:50:44 +0000 @@ -1177,7 +1177,7 @@ int main(int argc,char *argv[]) mysql_thread_id(&mysql), server_version_string(&mysql)); put_info((char*) glob_buffer.ptr(),INFO_INFO); - put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"), INFO_INFO); + put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"), INFO_INFO); #ifdef HAVE_READLINE initialize_readline((char*) my_progname); @@ -1595,7 +1595,7 @@ static void usage(int version) if (version) return; - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); printf("Usage: %s [OPTIONS] [database]\n", my_progname); my_print_help(my_long_options); print_defaults("my", load_default_groups); === modified file 'client/mysql_upgrade.c' --- a/client/mysql_upgrade.c 2011-06-30 15:46:53 +0000 +++ b/client/mysql_upgrade.c 2011-07-22 07:50:44 +0000 @@ -243,6 +243,7 @@ get_one_option(int optid, const struct m switch (optid) { case '?': + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); printf("%s Ver %s Distrib %s, for %s (%s)\n", my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); === modified file 'client/mysqladmin.cc' --- a/client/mysqladmin.cc 2011-06-30 15:46:53 +0000 +++ b/client/mysqladmin.cc 2011-07-22 07:50:44 +0000 @@ -688,7 +688,7 @@ static int execute_commands(MYSQL *mysql case ADMIN_VER: new_line=1; print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); printf("Server version\t\t%s\n", mysql_get_server_info(mysql)); printf("Protocol version\t%d\n", mysql_get_proto_info(mysql)); printf("Connection\t\t%s\n",mysql_get_host_info(mysql)); @@ -1086,7 +1086,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); puts("Administration program for the mysqld daemon."); printf("Usage: %s [OPTIONS] command command....\n", my_progname); my_print_help(my_long_options); === modified file 'client/mysqlcheck.c' --- a/client/mysqlcheck.c 2011-06-30 15:46:53 +0000 +++ b/client/mysqlcheck.c 2011-07-22 07:50:44 +0000 @@ -224,7 +224,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),"); puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be"); puts("used at the same time. Not all options are supported by all storage engines."); === modified file 'client/mysqldump.c' --- a/client/mysqldump.c 2011-07-03 23:48:19 +0000 +++ b/client/mysqldump.c 2011-07-22 07:50:44 +0000 @@ -55,6 +55,8 @@ #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ +#include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ + /* Exit codes */ #define EX_USAGE 1 @@ -596,7 +598,7 @@ static void short_usage_sub(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); puts("Dumping structure and contents of MySQL databases and tables."); short_usage_sub(); print_defaults("my",load_default_groups); === modified file 'client/mysqlimport.c' --- a/client/mysqlimport.c 2011-06-30 15:46:53 +0000 +++ b/client/mysqlimport.c 2011-07-22 07:50:44 +0000 @@ -18,14 +18,8 @@ /* ** mysqlimport.c - Imports all given files ** into a table(s). -** -** ************************* -** * * -** * AUTHOR: Monty & Jani * -** * DATE: June 24, 1997 * -** * * -** ************************* */ + #define IMPORT_VERSION "3.7" #include "client_priv.h" @@ -44,6 +38,8 @@ pthread_mutex_t counter_mutex; pthread_cond_t count_threshhold; #endif +#include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ + static void db_error_with_table(MYSQL *mysql, char *table); static void db_error(MYSQL *mysql); static char *field_escape(char *to,const char *from,uint length); @@ -203,7 +199,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); printf("\ Loads tables from text files in various formats. The base name of the\n\ text file must be the name of the table that should be used.\n\ === modified file 'client/mysqlshow.c' --- a/client/mysqlshow.c 2011-06-30 15:46:53 +0000 +++ b/client/mysqlshow.c 2011-07-22 07:50:44 +0000 @@ -264,7 +264,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010)")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011)")); puts("Shows the structure of a MySQL database (databases, tables, and columns).\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); puts("\n\ === modified file 'client/mysqltest.cc' --- a/client/mysqltest.cc 2011-07-03 23:48:19 +0000 +++ b/client/mysqltest.cc 2011-07-22 07:50:44 +0000 @@ -22,13 +22,6 @@ http://dev.mysql.com/doc/mysqltest/en/index.html Please keep the test framework tools identical in all versions! - - Written by: - Sasha Pachev - Matt Wagner - Monty - Jani - Holyfoot */ #define MTEST_VERSION "3.3" @@ -6438,7 +6431,7 @@ void print_version(void) void usage() { print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); printf("Runs a test against the mysql server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); my_print_help(my_long_options); === modified file 'config.h.cmake' --- a/config.h.cmake 2011-04-30 05:24:38 +0000 +++ b/config.h.cmake 2011-07-21 15:45:38 +0000 @@ -219,7 +219,6 @@ #cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 #cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1 #cmakedefine HAVE_PTHREAD_CONDATTR_SETCLOCK 1 -#cmakedefine HAVE_PTHREAD_INIT 1 #cmakedefine HAVE_PTHREAD_KEY_DELETE 1 #cmakedefine HAVE_PTHREAD_KEY_DELETE 1 #cmakedefine HAVE_PTHREAD_KILL 1 === modified file 'configure.cmake' --- a/configure.cmake 2011-06-30 15:46:53 +0000 +++ b/configure.cmake 2011-07-21 15:45:38 +0000 @@ -391,7 +391,6 @@ CHECK_FUNCTION_EXISTS (pthread_attr_sets CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE) CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE) CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK) -CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT) CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE) CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK) CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK) === modified file 'dbug/dbug_analyze.c' --- a/dbug/dbug_analyze.c 2011-01-11 09:07:37 +0000 +++ b/dbug/dbug_analyze.c 2011-07-21 15:45:38 +0000 @@ -571,9 +571,6 @@ int main (int argc, char **argv) FILE *infile; FILE *outfile = {stdout}; -#if defined(HAVE_PTHREAD_INIT) - pthread_init(); /* Must be called before DBUG_ENTER */ -#endif my_thread_global_init(); { DBUG_ENTER ("main"); === modified file 'dbug/my_main.c' --- a/dbug/my_main.c 2011-01-11 09:07:37 +0000 +++ b/dbug/my_main.c 2011-07-21 15:45:38 +0000 @@ -16,9 +16,6 @@ char *argv[]; { register int result, ix; extern int factorial(int); -#if defined(HAVE_PTHREAD_INIT) - pthread_init(); /* Must be called before DBUG_ENTER */ -#endif my_thread_global_init(); { === modified file 'dbug/tests.c' --- a/dbug/tests.c 2011-01-11 09:07:37 +0000 +++ b/dbug/tests.c 2011-07-21 15:45:38 +0000 @@ -44,9 +44,6 @@ int main (int argc, char *argv[]) if (argc == 1) return 0; -#if defined(HAVE_PTHREAD_INIT) - pthread_init(); /* Must be called before DBUG_ENTER */ -#endif my_thread_global_init(); dup2(1, 2); === modified file 'mysql-test/collections/default.experimental' --- a/mysql-test/collections/default.experimental 2011-06-06 13:17:58 +0000 +++ b/mysql-test/collections/default.experimental 2011-07-27 10:37:27 +0000 @@ -8,16 +8,15 @@ funcs_1.charset_collation_1 main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2 main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically main.outfile_loaddata @solaris # Bug#11755168 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) -main.signal_demo3 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.sp @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +main.signal_demo3 @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +main.sp @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris -rpl.rpl_innodb_bug28430 # Bug#11754425 -rpl.rpl_bug37426 # WL#5867: skozlov: test case moved from unused bugs suite rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically -rpl.rpl_show_slave_hosts # BUG#12416700 2011-05-02 sven fails sporadically +rpl.rpl_innodb_bug28430 # Bug#11754425 +rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several test cases fail on Solaris with error Thread stack overrun -sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails # BUG #59055 : All ndb tests should be removed from the repository === modified file 'mysql-test/extra/rpl_tests/rpl_reset_slave.test' --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test 2010-12-19 17:15:12 +0000 +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test 2011-07-18 17:18:03 +0000 @@ -77,5 +77,31 @@ reset slave; source include/check_slave_no_error.inc; change master to master_user='root'; ---let $rpl_only_running_threads= 1 + +# +# BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING MYSQL BUG#28796 +# + +reset slave; +--source include/start_slave.inc + +--source include/stop_slave.inc +--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) +--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1) +--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1) + +reset slave all; +--error ER_BAD_SLAVE +start slave; + +--let $_show_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) +if ($_show_master_host != No such row) +{ + die; +} + +--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT +--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port +--source include/start_slave.inc + --source include/rpl_end.inc === modified file 'mysql-test/r/func_time.result' --- a/mysql-test/r/func_time.result 2011-05-18 06:59:04 +0000 +++ b/mysql-test/r/func_time.result 2011-07-27 08:51:55 +0000 @@ -1398,6 +1398,12 @@ NULL SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1); WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1) NULL +# +# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0, +# +DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5); +Warnings: +Warning 1292 Incorrect datetime value: '0' End of 5.1 tests # # Bug#57039: constant subtime expression returns incorrect result. === modified file 'mysql-test/r/merge.result' --- a/mysql-test/r/merge.result 2010-11-30 17:53:11 +0000 +++ b/mysql-test/r/merge.result 2011-07-22 12:31:10 +0000 @@ -904,7 +904,8 @@ SELECT * FROM tm1; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text -test.tm1 check Error Table 'test.t1' doesn't exist +test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt CREATE TABLE t1(a INT); @@ -912,7 +913,7 @@ SELECT * FROM tm1; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text -test.tm1 check Error Table 'test.t2' doesn't exist +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt CREATE TABLE t2(a BLOB); @@ -920,7 +921,7 @@ SELECT * FROM tm1; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text -test.tm1 check Warning Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt ALTER TABLE t2 MODIFY a INT; @@ -3634,7 +3635,7 @@ test.t1 analyze Error Unable to open und test.t1 analyze error Corrupt CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check Error Table 'test.t_not_exists' doesn't exist +test.t1 check Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist test.t1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.t1 check error Corrupt CHECKSUM TABLE t1; @@ -3650,7 +3651,7 @@ test.t1 optimize Error Unable to open un test.t1 optimize error Corrupt REPAIR TABLE t1; Table Op Msg_type Msg_text -test.t1 repair Error Table 'test.t_not_exists' doesn't exist +test.t1 repair Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist test.t1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.t1 repair error Corrupt REPAIR TABLE t1 USE_FRM; @@ -3676,4 +3677,37 @@ ALTER TABLE t1 engine=myisam; ERROR HY000: Table 't1' was locked with a READ lock and can't be updated UNLOCK TABLES; DROP TABLE m1, t1; -End of 6.0 tests +# +# Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL +# PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1" +# +drop tables if exists t1, t2, t3, t4, m1; +create table t1(id int) engine=myisam; +create view t3 as select 1 as id; +create table t4(id int) engine=memory; +create table m1(id int) engine=merge union=(t1,t2,t3,t4); +select * from m1; +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +# The below CHECK and REPAIR TABLE statements should +# report all problems with underlying tables: +# - absence of 't2', +# - missing base table for 't3', +# - wrong engine of 't4'. +check table m1; +Table Op Msg_type Msg_text +test.m1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.m1 check Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist +test.m1 check Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist +test.m1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.m1 check error Corrupt +repair table m1; +Table Op Msg_type Msg_text +test.m1 repair Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.m1 repair Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist +test.m1 repair Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist +test.m1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist +test.m1 repair error Corrupt +# Clean-up. +drop tables m1, t1, t4; +drop view t3; +End of 5.5 tests === modified file 'mysql-test/suite/rpl/r/rpl_row_reset_slave.result' --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result 2010-12-19 17:15:12 +0000 +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result 2011-07-18 17:18:03 +0000 @@ -41,4 +41,12 @@ include/stop_slave_sql.inc reset slave; include/check_slave_no_error.inc change master to master_user='root'; +reset slave; +include/start_slave.inc +include/stop_slave.inc +reset slave all; +start slave; +ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO +CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT; +include/start_slave.inc include/rpl_end.inc === modified file 'mysql-test/suite/rpl/r/rpl_stm_reset_slave.result' --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result 2010-12-19 17:15:12 +0000 +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result 2011-07-18 17:18:03 +0000 @@ -41,4 +41,12 @@ include/stop_slave_sql.inc reset slave; include/check_slave_no_error.inc change master to master_user='root'; +reset slave; +include/start_slave.inc +include/stop_slave.inc +reset slave all; +start slave; +ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO +CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT; +include/start_slave.inc include/rpl_end.inc === added file 'mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result' --- a/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result 2011-07-19 14:54:59 +0000 @@ -0,0 +1,92 @@ +SET @start_global_value = @@global.innodb_random_read_ahead; +SELECT @start_global_value; +@start_global_value +0 +Valid values are 'ON' and 'OFF' +select @@global.innodb_random_read_ahead in (0, 1); +@@global.innodb_random_read_ahead in (0, 1) +1 +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +0 +select @@session.innodb_random_read_ahead; +ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable +show global variables like 'innodb_random_read_ahead'; +Variable_name Value +innodb_random_read_ahead OFF +show session variables like 'innodb_random_read_ahead'; +Variable_name Value +innodb_random_read_ahead OFF +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +set global innodb_random_read_ahead='ON'; +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +1 +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +set @@global.innodb_random_read_ahead=0; +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +0 +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +set global innodb_random_read_ahead=1; +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +1 +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +set @@global.innodb_random_read_ahead='OFF'; +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +0 +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD OFF +set session innodb_random_read_ahead='OFF'; +ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_random_read_ahead='ON'; +ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_random_read_ahead=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead' +set global innodb_random_read_ahead=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead' +set global innodb_random_read_ahead=2; +ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of '2' +NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643) +set global innodb_random_read_ahead=-3; +select @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +1 +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_RANDOM_READ_AHEAD ON +set global innodb_random_read_ahead='AUTO'; +ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of 'AUTO' +SET @@global.innodb_random_read_ahead = @start_global_value; +SELECT @@global.innodb_random_read_ahead; +@@global.innodb_random_read_ahead +0 === added file 'mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test' --- a/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test 2011-07-19 14:54:59 +0000 @@ -0,0 +1,70 @@ + + +# 2010-01-25 - Added +# + +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_random_read_ahead; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are 'ON' and 'OFF' +select @@global.innodb_random_read_ahead in (0, 1); +select @@global.innodb_random_read_ahead; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_random_read_ahead; +show global variables like 'innodb_random_read_ahead'; +show session variables like 'innodb_random_read_ahead'; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; + +# +# show that it's writable +# +set global innodb_random_read_ahead='ON'; +select @@global.innodb_random_read_ahead; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +set @@global.innodb_random_read_ahead=0; +select @@global.innodb_random_read_ahead; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +set global innodb_random_read_ahead=1; +select @@global.innodb_random_read_ahead; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +set @@global.innodb_random_read_ahead='OFF'; +select @@global.innodb_random_read_ahead; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +--error ER_GLOBAL_VARIABLE +set session innodb_random_read_ahead='OFF'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_random_read_ahead='ON'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_random_read_ahead=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_random_read_ahead=1e1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_random_read_ahead=2; +--echo NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643) +set global innodb_random_read_ahead=-3; +select @@global.innodb_random_read_ahead; +select * from information_schema.global_variables where variable_name='innodb_random_read_ahead'; +select * from information_schema.session_variables where variable_name='innodb_random_read_ahead'; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_random_read_ahead='AUTO'; + +# +# Cleanup +# + +SET @@global.innodb_random_read_ahead = @start_global_value; +SELECT @@global.innodb_random_read_ahead; === modified file 'mysql-test/t/func_time.test' --- a/mysql-test/t/func_time.test 2011-05-18 06:59:04 +0000 +++ b/mysql-test/t/func_time.test 2011-07-27 08:51:55 +0000 @@ -909,6 +909,12 @@ SELECT DATE_FORMAT('0000-00-11', '%w'); SELECT MAKEDATE(11111111,1); SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1); +--echo # +--echo # Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0, +--echo # + +DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5); + --echo End of 5.1 tests --echo # === modified file 'mysql-test/t/implicit_commit.test' --- a/mysql-test/t/implicit_commit.test 2010-02-26 09:58:33 +0000 +++ b/mysql-test/t/implicit_commit.test 2011-07-20 06:50:47 +0000 @@ -1,5 +1,6 @@ source include/have_innodb.inc; source include/not_embedded.inc; +source include/have_profiling.inc; SET GLOBAL EVENT_SCHEDULER = OFF; SET BINLOG_FORMAT = STATEMENT; === modified file 'mysql-test/t/merge.test' --- a/mysql-test/t/merge.test 2010-10-06 07:56:29 +0000 +++ b/mysql-test/t/merge.test 2011-07-22 12:31:10 +0000 @@ -2798,7 +2798,32 @@ UNLOCK TABLES; DROP TABLE m1, t1; ---echo End of 6.0 tests +--echo # +--echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL +--echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1" +--echo # +--disable_warnings +drop tables if exists t1, t2, t3, t4, m1; +--enable_warnings +create table t1(id int) engine=myisam; +create view t3 as select 1 as id; +create table t4(id int) engine=memory; +create table m1(id int) engine=merge union=(t1,t2,t3,t4); +--error ER_WRONG_MRG_TABLE +select * from m1; +--echo # The below CHECK and REPAIR TABLE statements should +--echo # report all problems with underlying tables: +--echo # - absence of 't2', +--echo # - missing base table for 't3', +--echo # - wrong engine of 't4'. +check table m1; +repair table m1; +--echo # Clean-up. +drop tables m1, t1, t4; +drop view t3; + + +--echo End of 5.5 tests --disable_result_log --disable_query_log === modified file 'mysys/my_init.c' --- a/mysys/my_init.c 2011-06-30 15:46:53 +0000 +++ b/mysys/my_init.c 2011-07-21 15:45:38 +0000 @@ -99,10 +99,6 @@ my_bool my_init(void) fastmutex_global_init(); /* Must be called early */ #endif -#if defined(HAVE_PTHREAD_INIT) - pthread_init(); /* Must be called before DBUG_ENTER */ -#endif - /* $HOME is needed early to parse configuration files located in ~/ */ if ((home_dir= getenv("HOME")) != 0) home_dir= intern_filename(home_dir_buff, home_dir); === modified file 'sql/gen_lex_hash.cc' --- a/sql/gen_lex_hash.cc 2011-06-30 15:46:53 +0000 +++ b/sql/gen_lex_hash.cc 2011-07-22 07:50:44 +0000 @@ -1,4 +1,5 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,6 +85,8 @@ So, we can read full search-structure as #include #include +#include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ + struct hash_lex_struct { int first_char; @@ -374,24 +377,9 @@ int main(int argc,char **argv) /* Broken up to indicate that it's not advice to you, gentle reader. */ printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); - printf("\ -/* Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\ -\n\ - This program is free software; you can redistribute it and/or modify\n\ - it under the terms of the GNU General Public License as published by\n\ - the Free Software Foundation; version 2 of the License.\n\ -\n\ - This program is distributed in the hope that it will be useful,\n\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ - GNU General Public License for more details.\n\ -\n\ - You should have received a copy of the GNU General Public License\n\ - along with this program; see the file COPYING. If not, write to the\n\ - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston\n\ - MA 02110-1301 USA. */\n\ -\n\ -"); + puts("/*"); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); + puts("*/"); /* Broken up to indicate that it's not advice to you, gentle reader. */ printf("/* Do " "not " "edit " "this " "file! This is generated by " === modified file 'sql/item_timefunc.cc' --- a/sql/item_timefunc.cc 2011-07-05 23:13:50 +0000 +++ b/sql/item_timefunc.cc 2011-07-27 08:51:55 +0000 @@ -2747,7 +2747,7 @@ String *Item_time_typecast::val_str(Stri bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date) { - bool res= get_arg0_date(ltime, TIME_FUZZY_DATE); + bool res= get_arg0_date(ltime, fuzzy_date); ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; ltime->time_type= MYSQL_TIMESTAMP_DATE; return res; === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2011-07-07 11:22:43 +0000 +++ b/sql/mysqld.cc 2011-07-22 07:50:44 +0000 @@ -6708,7 +6708,7 @@ static void usage(void) if (!default_collation_name) default_collation_name= (char*) default_charset_info->name; print_version(); - puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); + puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011")); puts("Starts the MySQL database server.\n"); printf("Usage: %s [OPTIONS]\n", my_progname); if (!opt_verbose) === modified file 'sql/rpl_mi.cc' --- a/sql/rpl_mi.cc 2011-06-30 15:46:53 +0000 +++ b/sql/rpl_mi.cc 2011-07-18 17:18:03 +0000 @@ -31,6 +31,8 @@ int init_strvar_from_file(char *var, int int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); +static void init_master_log_pos(Master_info* mi); + Master_info::Master_info(bool is_slave_recovery) :Slave_reporting_capability("I/O"), ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), @@ -100,6 +102,16 @@ bool Master_info::shall_ignore_server_id != NULL; } +void Master_info::clear_in_memory_info(bool all) +{ + init_master_log_pos(this); + if (all) + { + port= MYSQL_PORT; + host[0] = 0; user[0] = 0; password[0] = 0; + } +} + void init_master_log_pos(Master_info* mi) { DBUG_ENTER("init_master_log_pos"); @@ -234,7 +246,7 @@ file '%s')", fname); } mi->fd = fd; - init_master_log_pos(mi); + mi->clear_in_memory_info(false); } else // file exists === modified file 'sql/rpl_mi.h' --- a/sql/rpl_mi.h 2011-06-30 15:46:53 +0000 +++ b/sql/rpl_mi.h 2011-07-18 17:18:03 +0000 @@ -62,6 +62,7 @@ class Master_info : public Slave_reporti Master_info(bool is_slave_recovery); ~Master_info(); bool shall_ignore_server_id(ulong s_id); + void clear_in_memory_info(bool all); /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN]; @@ -113,7 +114,6 @@ class Master_info : public Slave_reporti DYNAMIC_ARRAY ignore_server_ids; ulong master_id; }; -void init_master_log_pos(Master_info* mi); int init_master_info(Master_info* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file, === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2011-07-03 23:48:19 +0000 +++ b/sql/sql_base.cc 2011-07-22 12:31:10 +0000 @@ -89,6 +89,69 @@ bool No_such_table_error_handler::safely return ((m_handled_errors > 0) && (m_unhandled_errors == 0)); } + +/** + This internal handler is used to trap ER_NO_SUCH_TABLE and + ER_WRONG_MRG_TABLE errors during CHECK/REPAIR TABLE for MERGE + tables. +*/ + +class Repair_mrg_table_error_handler : public Internal_error_handler +{ +public: + Repair_mrg_table_error_handler() + : m_handled_errors(false), m_unhandled_errors(false) + {} + + bool handle_condition(THD *thd, + uint sql_errno, + const char* sqlstate, + MYSQL_ERROR::enum_warning_level level, + const char* msg, + MYSQL_ERROR ** cond_hdl); + + /** + Returns TRUE if there were ER_NO_SUCH_/WRONG_MRG_TABLE and there + were no unhandled errors. FALSE otherwise. + */ + bool safely_trapped_errors() + { + /* + Check for m_handled_errors is here for extra safety. + It can be useful in situation when call to open_table() + fails because some error which was suppressed by another + error handler (e.g. in case of MDL deadlock which we + decided to solve by back-off and retry). + */ + return (m_handled_errors && (! m_unhandled_errors)); + } + +private: + bool m_handled_errors; + bool m_unhandled_errors; +}; + + +bool +Repair_mrg_table_error_handler::handle_condition(THD *, + uint sql_errno, + const char*, + MYSQL_ERROR::enum_warning_level level, + const char*, + MYSQL_ERROR ** cond_hdl) +{ + *cond_hdl= NULL; + if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_WRONG_MRG_TABLE) + { + m_handled_errors= true; + return TRUE; + } + + m_unhandled_errors= true; + return FALSE; +} + + /** @defgroup Data_Dictionary Data Dictionary @{ @@ -4377,6 +4440,20 @@ open_and_process_table(THD *thd, LEX *le thd->pop_internal_handler(); safe_to_ignore_table= no_such_table_handler.safely_trapped_errors(); } + else if (tables->parent_l && (thd->open_options & HA_OPEN_FOR_REPAIR)) + { + /* + Also fail silently for underlying tables of a MERGE table if this + table is opened for CHECK/REPAIR TABLE statement. This is needed + to provide complete list of problematic underlying tables in + CHECK/REPAIR TABLE output. + */ + Repair_mrg_table_error_handler repair_mrg_table_handler; + thd->push_internal_handler(&repair_mrg_table_handler); + error= open_table(thd, tables, new_frm_mem, ot_ctx); + thd->pop_internal_handler(); + safe_to_ignore_table= repair_mrg_table_handler.safely_trapped_errors(); + } else error= open_table(thd, tables, new_frm_mem, ot_ctx); === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2011-07-07 09:42:14 +0000 +++ b/sql/sql_class.cc 2011-07-20 06:50:47 +0000 @@ -520,11 +520,11 @@ const char *set_thd_proc_info(void *thd_ thd= current_thd; const char *old_info= thd->proc_info; - const char *basename= calling_file ? base_name(calling_file) : NULL; - DBUG_PRINT("proc_info", ("%s:%d %s", basename, calling_line, info)); + DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, info)); #if defined(ENABLED_PROFILING) - thd->profiling.status_change(info, calling_function, basename, calling_line); + thd->profiling.status_change(info, + calling_function, calling_file, calling_line); #endif thd->proc_info= info; return old_info; === modified file 'sql/sql_lex.h' --- a/sql/sql_lex.h 2011-07-07 09:42:14 +0000 +++ b/sql/sql_lex.h 2011-07-18 17:18:03 +0000 @@ -294,6 +294,10 @@ typedef struct st_lex_master_info DYNAMIC_ARRAY repl_ignore_server_ids; } LEX_MASTER_INFO; +typedef struct st_lex_reset_slave +{ + bool all; +} LEX_RESET_SLAVE; enum sub_select_type { @@ -2232,6 +2236,7 @@ struct LEX: public Query_tables_list LEX_MASTER_INFO mi; // used by CHANGE MASTER LEX_SERVER_OPTIONS server_options; USER_RESOURCES mqh; + LEX_RESET_SLAVE reset_slave_info; ulong type; /* This variable is used in post-parse stage to declare that sum-functions, === modified file 'sql/sql_profile.cc' --- a/sql/sql_profile.cc 2011-06-30 15:46:53 +0000 +++ b/sql/sql_profile.cc 2011-07-20 06:50:47 +0000 @@ -294,7 +294,7 @@ void QUERY_PROFILE::new_status(const cha DBUG_ASSERT(status_arg != NULL); if ((function_arg != NULL) && (file_arg != NULL)) - prof= new PROF_MEASUREMENT(this, status_arg, function_arg, file_arg, line_arg); + prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg); else prof= new PROF_MEASUREMENT(this, status_arg); === modified file 'sql/sql_repl.cc' --- a/sql/sql_repl.cc 2011-06-30 15:46:53 +0000 +++ b/sql/sql_repl.cc 2011-07-18 17:18:03 +0000 @@ -1285,8 +1285,9 @@ int reset_slave(THD *thd, Master_info* m goto err; } - /* Clear master's log coordinates */ - init_master_log_pos(mi); + /* Clear master's log coordinates and associated information */ + mi->clear_in_memory_info(thd->lex->reset_slave_info.all); + /* Reset errors (the idea is that we forget about the old master). === modified file 'sql/sql_yacc.yy' --- a/sql/sql_yacc.yy 2011-07-03 23:48:19 +0000 +++ b/sql/sql_yacc.yy 2011-07-24 11:26:58 +0000 @@ -11306,7 +11306,10 @@ flush_option: | STATUS_SYM { Lex->type|= REFRESH_STATUS; } | SLAVE - { Lex->type|= REFRESH_SLAVE; } + { + Lex->type|= REFRESH_SLAVE; + Lex->reset_slave_info.all= false; + } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | DES_KEY_FILE @@ -11337,10 +11340,16 @@ reset_options: reset_option: SLAVE { Lex->type|= REFRESH_SLAVE; } + slave_reset_options { } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} ; +slave_reset_options: + /* empty */ { Lex->reset_slave_info.all= false; } + | ALL { Lex->reset_slave_info.all= true; } + ; + purge: PURGE { === modified file 'storage/innobase/buf/buf0buf.c' --- a/storage/innobase/buf/buf0buf.c 2011-06-23 12:57:25 +0000 +++ b/storage/innobase/buf/buf0buf.c 2011-07-19 14:54:59 +0000 @@ -400,6 +400,7 @@ buf_get_total_stat( tot_stat->n_pages_read += buf_stat->n_pages_read; tot_stat->n_pages_written += buf_stat->n_pages_written; tot_stat->n_pages_created += buf_stat->n_pages_created; + tot_stat->n_ra_pages_read_rnd += buf_stat->n_ra_pages_read_rnd; tot_stat->n_ra_pages_read += buf_stat->n_ra_pages_read; tot_stat->n_ra_pages_evicted += buf_stat->n_ra_pages_evicted; tot_stat->n_pages_made_young += buf_stat->n_pages_made_young; @@ -2358,6 +2359,9 @@ loop2: } if (buf_read_page(space, zip_size, offset)) { + buf_read_ahead_random(space, zip_size, offset, + ibuf_inside(mtr)); + retries = 0; } else if (retries < BUF_PAGE_READ_MAX_RETRIES) { ++retries; @@ -4381,6 +4385,7 @@ buf_stats_aggregate_pool_info( total_info->n_pages_created += pool_info->n_pages_created; total_info->n_pages_written += pool_info->n_pages_written; total_info->n_page_gets += pool_info->n_page_gets; + total_info->n_ra_pages_read_rnd += pool_info->n_ra_pages_read_rnd; total_info->n_ra_pages_read += pool_info->n_ra_pages_read; total_info->n_ra_pages_evicted += pool_info->n_ra_pages_evicted; total_info->page_made_young_rate += pool_info->page_made_young_rate; @@ -4393,6 +4398,7 @@ buf_stats_aggregate_pool_info( total_info->page_read_delta += pool_info->page_read_delta; total_info->young_making_delta += pool_info->young_making_delta; total_info->not_young_making_delta += pool_info->not_young_making_delta; + total_info->pages_readahead_rnd_rate += pool_info->pages_readahead_rnd_rate; total_info->pages_readahead_rate += pool_info->pages_readahead_rate; total_info->pages_evicted_rate += pool_info->pages_evicted_rate; total_info->unzip_lru_len += pool_info->unzip_lru_len; @@ -4470,6 +4476,7 @@ buf_stats_get_pool_info( pool_info->n_page_gets = buf_pool->stat.n_page_gets; + pool_info->n_ra_pages_read_rnd = buf_pool->stat.n_ra_pages_read_rnd; pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read; pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted; @@ -4509,6 +4516,10 @@ buf_stats_get_pool_info( buf_pool->stat.n_pages_not_made_young - buf_pool->old_stat.n_pages_not_made_young; } + pool_info->pages_readahead_rnd_rate = + (buf_pool->stat.n_ra_pages_read_rnd + - buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed; + pool_info->pages_readahead_rate = (buf_pool->stat.n_ra_pages_read @@ -4594,9 +4605,12 @@ buf_print_io_instance( /* Statistics about read ahead algorithm */ fprintf(file, "Pages read ahead %.2f/s," - " evicted without access %.2f/s\n", + " evicted without access %.2f/s," + " Random read ahead %.2f/s\n", + pool_info->pages_readahead_rate, - pool_info->pages_evicted_rate); + pool_info->pages_evicted_rate, + pool_info->pages_readahead_rnd_rate); /* Print some values to help us with visualizing what is happening with LRU eviction. */ === modified file 'storage/innobase/buf/buf0rea.c' --- a/storage/innobase/buf/buf0rea.c 2011-04-15 13:46:11 +0000 +++ b/storage/innobase/buf/buf0rea.c 2011-07-19 14:54:59 +0000 @@ -40,8 +40,10 @@ Created 11/5/1995 Heikki Tuuri #include "mysql/plugin.h" #include "mysql/service_thd_wait.h" -/** The linear read-ahead area size */ -#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA +/** There must be at least this many pages in buf_pool in the area to start +a random read-ahead */ +#define BUF_READ_AHEAD_RANDOM_THRESHOLD(b) \ + (5 + BUF_READ_AHEAD_AREA(b) / 8) /** If there are buf_pool->curr_size per the number below pending reads, then read-ahead is not done: this is to prevent flooding the buffer pool with @@ -162,6 +164,171 @@ buf_read_page_low( } /********************************************************************//** +Applies a random read-ahead in buf_pool if there are at least a threshold +value of accessed pages from the random read-ahead area. Does not read any +page, not even the one at the position (space, offset), if the read-ahead +mechanism is not activated. NOTE 1: the calling thread may own latches on +pages: to avoid deadlocks this function must be written such that it cannot +end up waiting for these latches! NOTE 2: the calling thread must want +access to the page given: this rule is set to prevent unintended read-aheads +performed by ibuf routines, a situation which could result in a deadlock if +the OS does not support asynchronous i/o. +@return number of page read requests issued; NOTE that if we read ibuf +pages, it may happen that the page at the given page number does not +get read even if we return a positive value! +@return number of page read requests issued */ +UNIV_INTERN +ulint +buf_read_ahead_random( +/*==================*/ + ulint space, /*!< in: space id */ + ulint zip_size, /*!< in: compressed page size in bytes, + or 0 */ + ulint offset, /*!< in: page number of a page which + the current thread wants to access */ + ibool inside_ibuf) /*!< in: TRUE if we are inside ibuf + routine */ +{ + buf_pool_t* buf_pool = buf_pool_get(space, offset); + ib_int64_t tablespace_version; + ulint recent_blocks = 0; + ulint ibuf_mode; + ulint count; + ulint low, high; + ulint err; + ulint i; + const ulint buf_read_ahead_random_area + = BUF_READ_AHEAD_AREA(buf_pool); + + if (!srv_random_read_ahead) { + /* Disabled by user */ + return(0); + } + + if (srv_startup_is_before_trx_rollback_phase) { + /* No read-ahead to avoid thread deadlocks */ + return(0); + } + + if (ibuf_bitmap_page(zip_size, offset) + || trx_sys_hdr_page(space, offset)) { + + /* If it is an ibuf bitmap page or trx sys hdr, we do + no read-ahead, as that could break the ibuf page access + order */ + + return(0); + } + + /* Remember the tablespace version before we ask te tablespace size + below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we + do not try to read outside the bounds of the tablespace! */ + + tablespace_version = fil_space_get_version(space); + + low = (offset / buf_read_ahead_random_area) + * buf_read_ahead_random_area; + high = (offset / buf_read_ahead_random_area + 1) + * buf_read_ahead_random_area; + if (high > fil_space_get_size(space)) { + + high = fil_space_get_size(space); + } + + buf_pool_mutex_enter(buf_pool); + + if (buf_pool->n_pend_reads + > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) { + buf_pool_mutex_exit(buf_pool); + + return(0); + } + + /* Count how many blocks in the area have been recently accessed, + that is, reside near the start of the LRU list. */ + + for (i = low; i < high; i++) { + const buf_page_t* bpage = + buf_page_hash_get(buf_pool, space, i); + + if (bpage + && buf_page_is_accessed(bpage) + && buf_page_peek_if_young(bpage)) { + + recent_blocks++; + + if (recent_blocks + >= BUF_READ_AHEAD_RANDOM_THRESHOLD(buf_pool)) { + + buf_pool_mutex_exit(buf_pool); + goto read_ahead; + } + } + } + + buf_pool_mutex_exit(buf_pool); + /* Do nothing */ + return(0); + +read_ahead: + /* Read all the suitable blocks within the area */ + + if (inside_ibuf) { + ibuf_mode = BUF_READ_IBUF_PAGES_ONLY; + } else { + ibuf_mode = BUF_READ_ANY_PAGE; + } + + count = 0; + + for (i = low; i < high; i++) { + /* It is only sensible to do read-ahead in the non-sync aio + mode: hence FALSE as the first parameter */ + + if (!ibuf_bitmap_page(zip_size, i)) { + count += buf_read_page_low( + &err, FALSE, + ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER, + space, zip_size, FALSE, + tablespace_version, i); + if (err == DB_TABLESPACE_DELETED) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: in random" + " readahead trying to access\n" + "InnoDB: tablespace %lu page %lu,\n" + "InnoDB: but the tablespace does not" + " exist or is just being dropped.\n", + (ulong) space, (ulong) i); + } + } + } + + /* In simulated aio we wake the aio handler threads only after + queuing all aio requests, in native aio the following call does + nothing: */ + + os_aio_simulated_wake_handler_threads(); + +#ifdef UNIV_DEBUG + if (buf_debug_prints && (count > 0)) { + fprintf(stderr, + "Random read-ahead space %lu offset %lu pages %lu\n", + (ulong) space, (ulong) offset, + (ulong) count); + } +#endif /* UNIV_DEBUG */ + + /* Read ahead is considered one I/O operation for the purpose of + LRU policy decision. */ + buf_LRU_stat_inc_io(); + + buf_pool->stat.n_ra_pages_read_rnd += count; + srv_buf_pool_reads += count; + return(count); +} + +/********************************************************************//** High-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock @@ -257,7 +424,7 @@ buf_read_ahead_linear( ulint err; ulint i; const ulint buf_read_ahead_linear_area - = BUF_READ_AHEAD_LINEAR_AREA(buf_pool); + = BUF_READ_AHEAD_AREA(buf_pool); ulint threshold; if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) { === modified file 'storage/innobase/handler/ha_innodb.cc' --- a/storage/innobase/handler/ha_innodb.cc 2011-06-28 12:28:21 +0000 +++ b/storage/innobase/handler/ha_innodb.cc 2011-07-19 14:54:59 +0000 @@ -614,6 +614,8 @@ static SHOW_VAR innodb_status_variables[ (char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG}, {"buffer_pool_pages_total", (char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG}, + {"buffer_pool_read_ahead_rnd", + (char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG}, {"buffer_pool_read_ahead", (char*) &export_vars.innodb_buffer_pool_read_ahead, SHOW_LONG}, {"buffer_pool_read_ahead_evicted", @@ -11317,6 +11319,11 @@ static MYSQL_SYSVAR_UINT(change_bufferin NULL, NULL, 0, 0, 1, 0); #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ +static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead, + PLUGIN_VAR_NOCMDARG, + "Whether to use read ahead for random access within an extent.", + NULL, NULL, FALSE); + static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, PLUGIN_VAR_RQCMDARG, "Number of pages that must be accessed sequentially for InnoDB to " @@ -11385,6 +11392,7 @@ static struct st_mysql_sys_var* innobase #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG MYSQL_SYSVAR(change_buffering_debug), #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(io_capacity), MYSQL_SYSVAR(purge_threads), === modified file 'storage/innobase/include/buf0buf.h' --- a/storage/innobase/include/buf0buf.h 2011-06-23 12:57:25 +0000 +++ b/storage/innobase/include/buf0buf.h 2011-07-19 14:54:59 +0000 @@ -147,6 +147,8 @@ struct buf_pool_info_struct{ ulint n_pages_created; /*!< buf_pool->n_pages_created */ ulint n_pages_written; /*!< buf_pool->n_pages_written */ ulint n_page_gets; /*!< buf_pool->n_page_gets */ + ulint n_ra_pages_read_rnd; /*!< buf_pool->n_ra_pages_read_rnd, + number of pages readahead */ ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number of pages readahead */ ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted, @@ -171,6 +173,8 @@ struct buf_pool_info_struct{ last printout */ /* Statistics about read ahead algorithm. */ + double pages_readahead_rnd_rate;/*!< random readahead rate in pages per + second */ double pages_readahead_rate; /*!< readahead rate in pages per second */ double pages_evicted_rate; /*!< rate of readahead page evicted @@ -542,6 +546,18 @@ buf_block_get_freed_page_clock( __attribute__((pure)); /********************************************************************//** +Tells if a block is still close enough to the MRU end of the LRU list +meaning that it is not in danger of getting evicted and also implying +that it has been accessed recently. +Note that this is for heuristics only and does not reserve buffer pool +mutex. +@return TRUE if block is close to MRU end of LRU */ +UNIV_INLINE +ibool +buf_page_peek_if_young( +/*===================*/ + const buf_page_t* bpage); /*!< in: block */ +/********************************************************************//** Recommends a move of a block to the start of the LRU list if there is danger of dropping from the buffer pool. NOTE: does not reserve the buffer pool mutex. @@ -1605,6 +1621,8 @@ struct buf_pool_stat_struct{ ulint n_pages_written;/*!< number write operations */ ulint n_pages_created;/*!< number of pages created in the pool with no read */ + ulint n_ra_pages_read_rnd;/*!< number of pages read in + as part of random read ahead */ ulint n_ra_pages_read;/*!< number of pages read in as part of read ahead */ ulint n_ra_pages_evicted;/*!< number of read ahead @@ -1744,7 +1762,7 @@ struct buf_pool_struct{ UT_LIST_BASE_NODE_T(buf_page_t) LRU; /*!< base node of the LRU list */ buf_page_t* LRU_old; /*!< pointer to the about - buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV + LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV oldest blocks in the LRU list; NULL if LRU length less than BUF_LRU_OLD_MIN_LEN; === modified file 'storage/innobase/include/buf0buf.ic' --- a/storage/innobase/include/buf0buf.ic 2011-06-23 12:57:25 +0000 +++ b/storage/innobase/include/buf0buf.ic 2011-07-19 14:54:59 +0000 @@ -125,6 +125,29 @@ buf_block_get_freed_page_clock( } /********************************************************************//** +Tells if a block is still close enough to the MRU end of the LRU list +meaning that it is not in danger of getting evicted and also implying +that it has been accessed recently. +Note that this is for heuristics only and does not reserve buffer pool +mutex. +@return TRUE if block is close to MRU end of LRU */ +UNIV_INLINE +ibool +buf_page_peek_if_young( +/*===================*/ + const buf_page_t* bpage) /*!< in: block */ +{ + buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); + + /* FIXME: bpage->freed_page_clock is 31 bits */ + return((buf_pool->freed_page_clock & ((1UL << 31) - 1)) + < ((ulint) bpage->freed_page_clock + + (buf_pool->curr_size + * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio) + / (BUF_LRU_OLD_RATIO_DIV * 4)))); +} + +/********************************************************************//** Recommends a move of a block to the start of the LRU list if there is danger of dropping from the buffer pool. NOTE: does not reserve the buffer pool mutex. @@ -154,12 +177,7 @@ buf_page_peek_if_too_old( buf_pool->stat.n_pages_not_made_young++; return(FALSE); } else { - /* FIXME: bpage->freed_page_clock is 31 bits */ - return((buf_pool->freed_page_clock & ((1UL << 31) - 1)) - > ((ulint) bpage->freed_page_clock - + (buf_pool->curr_size - * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio) - / (BUF_LRU_OLD_RATIO_DIV * 4)))); + return(!buf_page_peek_if_young(bpage)); } } === modified file 'storage/innobase/include/buf0lru.h' --- a/storage/innobase/include/buf0lru.h 2011-06-23 12:57:25 +0000 +++ b/storage/innobase/include/buf0lru.h 2011-07-19 14:54:59 +0000 @@ -184,7 +184,7 @@ buf_LRU_make_block_old( /*===================*/ buf_page_t* bpage); /*!< in: control block */ /**********************************************************************//** -Updates buf_LRU_old_ratio. +Updates buf_pool->LRU_old_ratio. @return updated old_pct */ UNIV_INTERN ulint @@ -193,7 +193,7 @@ buf_LRU_old_ratio_update( uint old_pct,/*!< in: Reserve this percentage of the buffer pool for "old" blocks. */ ibool adjust);/*!< in: TRUE=adjust the LRU list; - FALSE=just assign buf_LRU_old_ratio + FALSE=just assign buf_pool->LRU_old_ratio during the initialization of InnoDB */ /********************************************************************//** Update the historical stats that we are collecting for LRU eviction @@ -222,18 +222,15 @@ buf_LRU_print(void); #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ /** @name Heuristics for detecting index scan @{ */ -/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for -"old" blocks. Protected by buf_pool->mutex. */ -extern uint buf_LRU_old_ratio; -/** The denominator of buf_LRU_old_ratio. */ +/** The denominator of buf_pool->LRU_old_ratio. */ #define BUF_LRU_OLD_RATIO_DIV 1024 -/** Maximum value of buf_LRU_old_ratio. +/** Maximum value of buf_pool->LRU_old_ratio. @see buf_LRU_old_adjust_len -@see buf_LRU_old_ratio_update */ +@see buf_pool->LRU_old_ratio_update */ #define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV -/** Minimum value of buf_LRU_old_ratio. +/** Minimum value of buf_pool->LRU_old_ratio. @see buf_LRU_old_adjust_len -@see buf_LRU_old_ratio_update +@see buf_pool->LRU_old_ratio_update The minimum must exceed (BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */ #define BUF_LRU_OLD_RATIO_MIN 51 === modified file 'storage/innobase/include/buf0rea.h' --- a/storage/innobase/include/buf0rea.h 2011-04-15 13:58:30 +0000 +++ b/storage/innobase/include/buf0rea.h 2011-07-19 14:54:59 +0000 @@ -43,6 +43,31 @@ buf_read_page( ulint zip_size,/*!< in: compressed page size in bytes, or 0 */ ulint offset);/*!< in: page number */ /********************************************************************//** +Applies a random read-ahead in buf_pool if there are at least a threshold +value of accessed pages from the random read-ahead area. Does not read any +page, not even the one at the position (space, offset), if the read-ahead +mechanism is not activated. NOTE 1: the calling thread may own latches on +pages: to avoid deadlocks this function must be written such that it cannot +end up waiting for these latches! NOTE 2: the calling thread must want +access to the page given: this rule is set to prevent unintended read-aheads +performed by ibuf routines, a situation which could result in a deadlock if +the OS does not support asynchronous i/o. +@return number of page read requests issued; NOTE that if we read ibuf +pages, it may happen that the page at the given page number does not +get read even if we return a positive value! +@return number of page read requests issued */ +UNIV_INTERN +ulint +buf_read_ahead_random( +/*==================*/ + ulint space, /*!< in: space id */ + ulint zip_size, /*!< in: compressed page size in bytes, + or 0 */ + ulint offset, /*!< in: page number of a page which + the current thread wants to access */ + ibool inside_ibuf); /*!< in: TRUE if we are inside ibuf + routine */ +/********************************************************************//** Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. Does not read any page if the read-ahead mechanism is not activated. Note === modified file 'storage/innobase/include/srv0srv.h' --- a/storage/innobase/include/srv0srv.h 2011-04-26 17:55:52 +0000 +++ b/storage/innobase/include/srv0srv.h 2011-07-19 14:54:59 +0000 @@ -158,6 +158,7 @@ extern ulint srv_mem_pool_size; extern ulint srv_lock_table_size; extern ulint srv_n_file_io_threads; +extern my_bool srv_random_read_ahead; extern ulong srv_read_ahead_threshold; extern ulint srv_n_read_io_threads; extern ulint srv_n_write_io_threads; @@ -703,6 +704,7 @@ struct export_var_struct{ ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */ ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */ ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */ + ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */ ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */ ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/ ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */ === modified file 'storage/innobase/srv/srv0srv.c' --- a/storage/innobase/srv/srv0srv.c 2011-05-04 09:08:07 +0000 +++ b/storage/innobase/srv/srv0srv.c 2011-07-19 14:54:59 +0000 @@ -222,6 +222,8 @@ UNIV_INTERN ulint srv_n_file_io_threads UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX; UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX; +/* Switch to enable random read ahead. */ +UNIV_INTERN my_bool srv_random_read_ahead = FALSE; /* User settable value of the number of pages that must be present in the buffer cache and accessed sequentially for InnoDB to trigger a readahead request. */ @@ -2032,6 +2034,8 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free; export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed; export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads; + export_vars.innodb_buffer_pool_read_ahead_rnd + = stat.n_ra_pages_read_rnd; export_vars.innodb_buffer_pool_read_ahead = stat.n_ra_pages_read; export_vars.innodb_buffer_pool_read_ahead_evicted === modified file 'storage/myisammrg/ha_myisammrg.cc' --- a/storage/myisammrg/ha_myisammrg.cc 2011-07-03 23:48:19 +0000 +++ b/storage/myisammrg/ha_myisammrg.cc 2011-07-22 12:31:10 +0000 @@ -159,9 +159,14 @@ extern "C" void myrg_print_wrong_table(c buf[db.length]= '.'; memcpy(buf + db.length + 1, name.str, name.length); buf[db.length + name.length + 1]= 0; - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE), - buf); + /* + Push an error to be reported as part of CHECK/REPAIR result-set. + Note that calling my_error() from handler is a hack which is kept + here to avoid refactoring. Normally engines should report errors + through return value which will be interpreted by caller using + handler::print_error() call. + */ + my_error(ER_ADMIN_WRONG_MRG_TABLE, MYF(0), buf); } @@ -593,8 +598,7 @@ public: @return pointer to open MyISAM table structure @retval !=NULL OK, returning pointer - @retval NULL, my_errno == 0 Ok, no more child tables - @retval NULL, my_errno != 0 error + @retval NULL, Error. @detail This function retrieves the MyISAM table handle from the @@ -614,17 +618,33 @@ extern "C" MI_INFO *myisammrg_attach_chi MI_INFO *myisam= NULL; DBUG_ENTER("myisammrg_attach_children_callback"); - if (!child_l) - { - DBUG_PRINT("myrg", ("No more children to attach")); - my_errno= 0; /* Ok, no more child tables. */ - goto end; - } + /* + Number of children in the list and MYRG_INFO::tables_count, + which is used by caller of this function, should always match. + */ + DBUG_ASSERT(child_l); + child= child_l->table; /* Prepare for next child. */ param->next(); /* + When MERGE table is opened for CHECK or REPAIR TABLE statements, + failure to open any of underlying tables is ignored until this moment + (this is needed to provide complete list of the problematic underlying + tables in CHECK/REPAIR TABLE output). + Here we detect such a situation and report an appropriate error. + */ + if (! child) + { + DBUG_PRINT("error", ("failed to open underlying table '%s'.'%s'", + child_l->db, child_l->table_name)); + /* This should only happen inside of CHECK/REPAIR TABLE. */ + DBUG_ASSERT(current_thd->open_options & HA_OPEN_FOR_REPAIR); + goto end; + } + + /* Do a quick compatibility check. The table def version is set when the table share is created. The child def version is copied from the table def version after a successful compatibility check. @@ -653,7 +673,6 @@ extern "C" MI_INFO *myisammrg_attach_chi { DBUG_PRINT("error", ("temporary table mismatch parent: %d child: %d", parent->s->tmp_table, child->s->tmp_table)); - my_errno= HA_ERR_WRONG_MRG_TABLE_DEF; goto end; } @@ -664,12 +683,27 @@ extern "C" MI_INFO *myisammrg_attach_chi DBUG_PRINT("error", ("no MyISAM handle for child table: '%s'.'%s' 0x%lx", child->s->db.str, child->s->table_name.str, (long) child)); - my_errno= HA_ERR_WRONG_MRG_TABLE_DEF; } - DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx my_errno: %d", - my_errno ? 0L : (long) myisam, my_errno)); + + DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx", (long) myisam)); end: + + if (!myisam && + (current_thd->open_options & HA_OPEN_FOR_REPAIR)) + { + char buf[2*NAME_LEN + 1 + 1]; + strxnmov(buf, sizeof(buf) - 1, child_l->db, ".", child_l->table_name, NULL); + /* + Push an error to be reported as part of CHECK/REPAIR result-set. + Note that calling my_error() from handler is a hack which is kept + here to avoid refactoring. Normally engines should report errors + through return value which will be interpreted by caller using + handler::print_error() call. + */ + my_error(ER_ADMIN_WRONG_MRG_TABLE, MYF(0), buf); + } + DBUG_RETURN(myisam); } @@ -783,12 +817,6 @@ int ha_myisammrg::attach_children(void) /* Must call this with children list in place. */ DBUG_ASSERT(this->table->pos_in_table_list->next_global == this->children_l); - /* - 'my_errno' is set by myisammrg_attach_children_callback() in - case of an error. - */ - my_errno= 0; - if (myrg_attach_children(this->file, this->test_if_locked | current_thd->open_options, myisammrg_attach_children_callback, ¶m, === modified file 'storage/myisammrg/myrg_open.c' --- a/storage/myisammrg/myrg_open.c 2011-06-30 15:46:53 +0000 +++ b/storage/myisammrg/myrg_open.c 2011-07-22 12:31:10 +0000 @@ -385,6 +385,7 @@ int myrg_attach_children(MYRG_INFO *m_in uint UNINIT_VAR(key_parts); uint min_keys; my_bool bad_children= FALSE; + my_bool first_child= TRUE; DBUG_ENTER("myrg_attach_children"); DBUG_PRINT("myrg", ("handle_locking: %d", handle_locking)); @@ -399,16 +400,26 @@ int myrg_attach_children(MYRG_INFO *m_in errpos= 0; file_offset= 0; min_keys= 0; - child_nr= 0; - while ((myisam= (*callback)(callback_param))) + for (child_nr= 0; child_nr < m_info->tables; child_nr++) { + if (! (myisam= (*callback)(callback_param))) + { + if (handle_locking & HA_OPEN_FOR_REPAIR) + { + /* An appropriate error should've been already pushed by callback. */ + bad_children= TRUE; + continue; + } + goto bad_children; + } + DBUG_PRINT("myrg", ("child_nr: %u table: '%s'", child_nr, myisam->filename)); - DBUG_ASSERT(child_nr < m_info->tables); /* Special handling when the first child is attached. */ - if (!child_nr) + if (first_child) { + first_child= FALSE; m_info->reclength= myisam->s->base.reclength; min_keys= myisam->s->base.keys; key_parts= myisam->s->base.key_parts; @@ -456,14 +467,11 @@ int myrg_attach_children(MYRG_INFO *m_in for (idx= 0; idx < key_parts; idx++) m_info->rec_per_key_part[idx]+= (myisam->s->state.rec_per_key_part[idx] / m_info->tables); - child_nr++; } if (bad_children) goto bad_children; - /* Note: callback() resets my_errno, so it is safe to check it here */ - if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF) - goto err; + if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) { my_errno= HA_ERR_RECORD_FILE_FULL; === modified file 'support-files/mysql.spec.sh' --- a/support-files/mysql.spec.sh 2011-07-07 15:27:44 +0000 +++ b/support-files/mysql.spec.sh 2011-07-22 08:34:45 +0000 @@ -1121,6 +1121,7 @@ echo "=====" # ---------------------------------------------------------------------------- %files -n MySQL-embedded%{product_suffix} %defattr(-, root, root, 0755) +%attr(755, root, root) %{_bindir}/mysql_embedded %attr(644, root, root) %{_libdir}/mysql/libmysqld.a %attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a @@ -1130,6 +1131,10 @@ echo "=====" # merging BK trees) ############################################################################## %changelog +* Thu Jul 21 2011 Sunanda Menon + +- Fix bug#12561297: Added the MySQL embedded binary + * Thu Jul 07 2011 Joerg Bruehe - Fix bug#45415: "rpm upgrade recreates test database" No bundle (reason: useless for push emails).