summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc4
-rw-r--r--client/mysql_upgrade.c1
-rw-r--r--client/mysqladmin.cc4
-rw-r--r--client/mysqlcheck.c2
-rw-r--r--client/mysqldump.c4
-rw-r--r--client/mysqlimport.c12
-rw-r--r--client/mysqlshow.c2
-rw-r--r--client/mysqltest.cc9
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rw-r--r--dbug/dbug_analyze.c3
-rw-r--r--dbug/my_main.c3
-rw-r--r--dbug/tests.c3
-rw-r--r--libmysqld/examples/CMakeLists.txt4
-rw-r--r--mysql-test/collections/default.experimental11
-rw-r--r--mysql-test/extra/rpl_tests/rpl_reset_slave.test28
-rw-r--r--mysql-test/r/func_time.result6
-rw-r--r--mysql-test/r/merge.result46
-rw-r--r--mysql-test/r/sp.result19
-rw-r--r--mysql-test/suite/innodb/r/innodb-zip.result114
-rw-r--r--mysql-test/suite/innodb/t/innodb-zip.test20
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result8
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result6
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_file_format_check_basic.result127
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result65
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result92
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result64
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result83
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test112
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test60
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test70
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test58
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test72
-rw-r--r--mysql-test/t/func_time.test6
-rw-r--r--mysql-test/t/implicit_commit.test1
-rw-r--r--mysql-test/t/merge.test27
-rw-r--r--mysql-test/t/sp.test27
-rw-r--r--mysys/my_init.c4
-rw-r--r--sql/gen_lex_hash.cc26
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/rpl_mi.cc14
-rw-r--r--sql/rpl_mi.h2
-rw-r--r--sql/sql_base.cc85
-rw-r--r--sql/sql_class.cc7
-rw-r--r--sql/sql_class.h7
-rw-r--r--sql/sql_insert.cc9
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_lex.h15
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_profile.cc2
-rw-r--r--sql/sql_repl.cc5
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/sql_yacc.yy11
-rw-r--r--storage/innobase/buf/buf0buf.c18
-rw-r--r--storage/innobase/buf/buf0rea.c173
-rw-r--r--storage/innobase/handler/ha_innodb.cc27
-rw-r--r--storage/innobase/include/buf0buf.h20
-rw-r--r--storage/innobase/include/buf0buf.ic30
-rw-r--r--storage/innobase/include/buf0lru.h17
-rw-r--r--storage/innobase/include/buf0rea.h25
-rw-r--r--storage/innobase/include/srv0srv.h2
-rw-r--r--storage/innobase/row/row0sel.c88
-rw-r--r--storage/innobase/srv/srv0srv.c4
-rw-r--r--storage/myisammrg/ha_myisammrg.cc70
-rw-r--r--storage/myisammrg/myrg_open.c24
-rw-r--r--support-files/mysql.spec.sh13
-rw-r--r--tests/mysql_client_test.c29
69 files changed, 1570 insertions, 357 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 9ed4d6cee00..db86a9b1a57 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -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);
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 35c2641fbf6..fb4be716df2 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -243,6 +243,7 @@ get_one_option(int optid, const struct my_option *opt,
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"));
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 8826b6713be..3f33c25e664 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -688,7 +688,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
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);
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 345b5f25e89..04d942e3318 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -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.");
diff --git a/client/mysqldump.c b/client/mysqldump.c
index a1b21590291..8ccf1f90c97 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -55,6 +55,8 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
+#include <welcome_copyright_notice.h> /* 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);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index d02c63fbc1f..44807edc970 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -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 <welcome_copyright_notice.h> /* 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\
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index c723595e20b..dfa5b011184 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -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\
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 77289b3380f..cc5dd1f377c 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -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 <sasha@mysql.com>
- Matt Wagner <matt@mysql.com>
- 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);
diff --git a/config.h.cmake b/config.h.cmake
index 3247093c613..8c146011c7b 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -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
diff --git a/configure.cmake b/configure.cmake
index 64de376f669..c3cc787ebc8 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -391,7 +391,6 @@ CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
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)
diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c
index 3d5713758ae..cd395cd3b02 100644
--- a/dbug/dbug_analyze.c
+++ b/dbug/dbug_analyze.c
@@ -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");
diff --git a/dbug/my_main.c b/dbug/my_main.c
index 48d092ca10a..490e1808dd2 100644
--- a/dbug/my_main.c
+++ b/dbug/my_main.c
@@ -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();
{
diff --git a/dbug/tests.c b/dbug/tests.c
index 837a477aef3..5fb84d48ffc 100644
--- a/dbug/tests.c
+++ b/dbug/tests.c
@@ -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);
diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt
index f4a888c10ef..9c7c5bdb85c 100644
--- a/libmysqld/examples/CMakeLists.txt
+++ b/libmysqld/examples/CMakeLists.txt
@@ -23,9 +23,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT)
-# We never use "mysql_embedded", is more of a linktest, so we don't
-# use MYSQL_ADD_EXECUTABLE as that would install it and package it
-ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
+MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc)
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
IF(UNIX)
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 6ef1a377b6c..b3623402065 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -8,16 +8,15 @@ funcs_1.charset_collation_1 # depends on compile-time decisions
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
diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index 14b457f601e..0d94f04ca44 100644
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -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
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index e6ef9bdfe61..bad467b3255 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -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.
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index f668761cb16..6e4e6c5a443 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -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 underlying table which is differently defin
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 underlying table which is differently defi
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
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 8512407aaf3..a8428476e34 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7161,6 +7161,25 @@ init_connect
SET @@GLOBAL.init_connect= @old_init_connect;
DROP PROCEDURE p2;
DROP PROCEDURE p5;
+#
+# Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
+#
+CREATE TABLE t1 (a INT, b INT, KEY(b));
+CREATE TABLE t2 (c INT, d INT, KEY(c));
+INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
+INSERT INTO t2 VALUES (1,1),(1,2);
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+DECLARE a int;
+-- SQL statement inside
+SELECT 1 INTO a;
+RETURN a;
+END $
+SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
+COUNT(DISTINCT d)
+2
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result
index a63ddff15ce..94f3bc71af1 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-zip.result
@@ -63,42 +63,42 @@ row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t0 Compact
-test t00 Compact
-test t1 Compact
-test t10 Dynamic
-test t11 Compressed
-test t12 Compressed
-test t13 Compressed
-test t14 Compact
-test t2 Redundant
-test t3 Compact
-test t4 Compact
-test t5 Redundant
-test t6 Redundant
-test t7 Redundant
-test t8 Compact
-test t9 Compact
+table_schema table_name row_format data_length index_length
+test t0 Compact 16384 0
+test t00 Compact 16384 0
+test t1 Compact 16384 0
+test t10 Dynamic 16384 0
+test t11 Compressed 1024 0
+test t12 Compressed 1024 0
+test t13 Compressed 8192 0
+test t14 Compact 16384 0
+test t2 Redundant 16384 0
+test t3 Compact 16384 0
+test t4 Compact 16384 0
+test t5 Redundant 16384 0
+test t6 Redundant 16384 0
+test t7 Redundant 16384 0
+test t8 Compact 16384 0
+test t9 Compact 16384 0
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Dynamic
+table_schema table_name row_format data_length index_length
+test t1 Dynamic 16384 0
alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compact
+table_schema table_name row_format data_length index_length
+test t1 Compact 16384 0
alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Redundant
+table_schema table_name row_format data_length index_length
+test t1 Redundant 16384 0
drop table t1;
create table t1(a int not null, b text, index(b(10))) engine=innodb
key_block_size=1;
@@ -115,11 +115,11 @@ rollback;
select a,left(b,40) from t1 natural join t2;
a left(b,40)
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-test t2 Compact
+table_schema table_name row_format data_length index_length
+test t1 Compressed 2048 1024
+test t2 Compact 16384 0
drop table t1,t2;
SET SESSION innodb_strict_mode = off;
CREATE TABLE t1(
@@ -207,19 +207,19 @@ create table t8 (id int primary key) engine = innodb row_format = compressed;
create table t9 (id int primary key) engine = innodb row_format = dynamic;
create table t10(id int primary key) engine = innodb row_format = compact;
create table t11(id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compact
-test t10 Compact
-test t11 Redundant
-test t3 Compressed
-test t4 Compressed
-test t5 Compressed
-test t6 Compressed
-test t7 Compressed
-test t8 Compressed
-test t9 Dynamic
+table_schema table_name row_format data_length index_length
+test t1 Compact 16384 0
+test t10 Compact 16384 0
+test t11 Redundant 16384 0
+test t3 Compressed 1024 0
+test t4 Compressed 2048 0
+test t5 Compressed 4096 0
+test t6 Compressed 8192 0
+test t7 Compressed 16384 0
+test t8 Compressed 8192 0
+test t9 Dynamic 16384 0
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
create table t1 (id int primary key) engine = innodb
key_block_size = 8 row_format = compressed;
@@ -246,11 +246,11 @@ Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-test t5 Compressed
+table_schema table_name row_format data_length index_length
+test t1 Compressed 8192 0
+test t5 Compressed 8192 0
drop table t1, t5;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
@@ -276,9 +276,9 @@ Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
+table_schema table_name row_format data_length index_length
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
@@ -324,11 +324,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
+table_schema table_name row_format data_length index_length
+test t8 Compact 16384 0
+test t9 Redundant 16384 0
drop table t8, t9;
set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
@@ -376,11 +376,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
+table_schema table_name row_format data_length index_length
+test t8 Compact 16384 0
+test t9 Redundant 16384 0
drop table t8, t9;
set global innodb_file_per_table=0;
set global innodb_file_format=Antelope;
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test
index 2b4631f83db..6e99d9fe54a 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-zip.test
@@ -39,19 +39,19 @@ create table t13(a int primary key) engine=innodb
row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1;
@@ -84,7 +84,7 @@ connection default;
disconnect a;
disconnect b;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2;
@@ -195,7 +195,7 @@ create table t9 (id int primary key) engine = innodb row_format = dynamic;
create table t10(id int primary key) engine = innodb row_format = compact;
create table t11(id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
@@ -221,7 +221,7 @@ show warnings;
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1, t5;
@@ -241,7 +241,7 @@ create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
show warnings;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
#test valid values with innodb_file_per_table unset
@@ -271,7 +271,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t8, t9;
@@ -303,7 +303,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
+SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t8, t9;
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index 7dc94bab481..41fe0b1a9f3 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -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
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
index aa8bc63a432..b1473c937a1 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -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
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 3cee368853f..715ad9e2c15 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -11,13 +11,7 @@ There should be *no* long test name listed below:
select variable_name as `There should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
There should be *no* variables listed below:
-INNODB_ROLLBACK_SEGMENTS
-INNODB_STATS_METHOD
-INNODB_FILE_FORMAT_MAX
INNODB_LARGE_PREFIX
-INNODB_ROLLBACK_SEGMENTS
-INNODB_STATS_METHOD
-INNODB_FILE_FORMAT_MAX
INNODB_LARGE_PREFIX
drop table t1;
drop table t2;
diff --git a/mysql-test/suite/sys_vars/r/innodb_file_format_check_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_format_check_basic.result
index c59e1b802f4..9167585f1d6 100644
--- a/mysql-test/suite/sys_vars/r/innodb_file_format_check_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_file_format_check_basic.result
@@ -1,59 +1,80 @@
-SET @start_global_value = @@global.innodb_file_format_max;
+SET @start_global_value = @@global.innodb_file_format_check;
SELECT @start_global_value;
@start_global_value
-Antelope
-Valid values are 'Antelope' and 'Barracuda'
-select @@global.innodb_file_format_max in ('Antelope', 'Barracuda');
-@@global.innodb_file_format_max in ('Antelope', 'Barracuda')
-1
-select @@global.innodb_file_format_max;
-@@global.innodb_file_format_max
-Antelope
-select @@session.innodb_file_format_max;
-ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable
-show global variables like 'innodb_file_format_max';
+1
+Valid values are 'ON' and 'OFF'
+SELECT @@global.innodb_file_format_check in (0, 1);
+@@global.innodb_file_format_check in (0, 1)
+1
+SELECT @@global.innodb_file_format_check;
+@@global.innodb_file_format_check
+1
+SELECT @@session.innodb_file_format_check;
+ERROR HY000: Variable 'innodb_file_format_check' is a GLOBAL variable
+SHOW global variables LIKE 'innodb_file_format_check';
Variable_name Value
-innodb_file_format_max Antelope
-show session variables like 'innodb_file_format_max';
+innodb_file_format_check ON
+SHOW session variables LIKE 'innodb_file_format_check';
Variable_name Value
-innodb_file_format_max Antelope
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Antelope
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Antelope
-set global innodb_file_format_max='Antelope';
-select @@global.innodb_file_format_max;
-@@global.innodb_file_format_max
-Antelope
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Antelope
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
-VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Antelope
-set @@global.innodb_file_format_max='Barracuda';
-select @@global.innodb_file_format_max;
-@@global.innodb_file_format_max
-Barracuda
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
+innodb_file_format_check ON
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_check';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Barracuda
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
+INNODB_FILE_FORMAT_CHECK ON
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_check';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_FILE_FORMAT_MAX Barracuda
-set session innodb_file_format_max='Salmon';
-ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable and should be set with SET GLOBAL
-set @@session.innodb_file_format_max='Salmon';
-ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable and should be set with SET GLOBAL
-set global innodb_file_format_max=1.1;
-ERROR 42000: Incorrect argument type to variable 'innodb_file_format_max'
-set global innodb_file_format_max=1e1;
-ERROR 42000: Incorrect argument type to variable 'innodb_file_format_max'
-set global innodb_file_format_max='Salmon';
-ERROR 42000: Variable 'innodb_file_format_max' can't be set to the value of 'Salmon'
-SET @@global.innodb_file_format_max = @start_global_value;
-SELECT @@global.innodb_file_format_max;
-@@global.innodb_file_format_max
-Antelope
+INNODB_FILE_FORMAT_CHECK ON
+SET @@global.innodb_file_format_check='Off';
+ERROR HY000: Variable 'innodb_file_format_check' is a read only variable
+Expected error 'Read only variable'
+SET @@global.innodb_file_format_check=1;
+ERROR HY000: Variable 'innodb_file_format_check' is a read only variable
+Expected error 'Read only variable'
+SET @@global.innodb_file_format_check=0;
+ERROR HY000: Variable 'innodb_file_format_check' is a read only variable
+Expected error 'Read only variable'
+SET @@global.innodb_file_format_check='On';
+ERROR HY000: Variable 'innodb_file_format_check' is a read only variable
+Expected error 'Read only variable'
+SET session innodb_large_prefix='OFF';
+ERROR HY000: Variable 'innodb_large_prefix' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@session.innodb_stats_on_metadata='ON';
+ERROR HY000: Variable 'innodb_stats_on_metadata' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT IF(@@GLOBAL.innodb_file_format_check, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_format_check';
+IF(@@GLOBAL.innodb_file_format_check, "ON", "OFF") = VARIABLE_VALUE
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.innodb_file_format_check);
+COUNT(@@GLOBAL.innodb_file_format_check)
+1
+1 Expected
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_format_check';
+COUNT(VARIABLE_VALUE)
+1
+1 Expected
+SELECT @@innodb_file_format_check = @@GLOBAL.innodb_file_format_check;
+@@innodb_file_format_check = @@GLOBAL.innodb_file_format_check
+1
+1 Expected
+SELECT COUNT(@@innodb_file_format_check);
+COUNT(@@innodb_file_format_check)
+1
+1 Expected
+SELECT COUNT(@@local.innodb_file_format_check);
+ERROR HY000: Variable 'innodb_file_format_check' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT COUNT(@@SESSION.innodb_file_format_check);
+ERROR HY000: Variable 'innodb_file_format_check' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT COUNT(@@GLOBAL.innodb_file_format_check);
+COUNT(@@GLOBAL.innodb_file_format_check)
+1
+1 Expected
+SELECT innodb_file_format_check = @@SESSION.innodb_file_format_check;
+ERROR 42S22: Unknown column 'innodb_file_format_check' in 'field list'
+Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result
new file mode 100644
index 00000000000..32b2262c091
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_file_format_max_basic.result
@@ -0,0 +1,65 @@
+SET @start_global_value = @@global.innodb_file_format_max;
+SELECT @start_global_value;
+@start_global_value
+Antelope
+Valid values are 'Antelope' and 'Barracuda'
+SELECT @@global.innodb_file_format_max in ('Antelope', 'Barracuda');
+@@global.innodb_file_format_max in ('Antelope', 'Barracuda')
+1
+SELECT @@global.innodb_file_format_max;
+@@global.innodb_file_format_max
+Antelope
+SELECT @@session.innodb_file_format_max;
+ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable
+SHOW global variables LIKE 'innodb_file_format_max';
+Variable_name Value
+innodb_file_format_max Antelope
+SHOW session variables LIKE 'innodb_file_format_max';
+Variable_name Value
+innodb_file_format_max Antelope
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Antelope
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Antelope
+SET global innodb_file_format_max='Antelope';
+SELECT @@global.innodb_file_format_max;
+@@global.innodb_file_format_max
+Antelope
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Antelope
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Antelope
+SET @@global.innodb_file_format_max='Barracuda';
+SELECT @@global.innodb_file_format_max;
+@@global.innodb_file_format_max
+Barracuda
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Barracuda
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_FILE_FORMAT_MAX Barracuda
+SET session innodb_file_format_max='Salmon';
+ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@session.innodb_file_format_max='Salmon';
+ERROR HY000: Variable 'innodb_file_format_max' is a GLOBAL variable and should be set with SET GLOBAL
+SET global innodb_file_format_max=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_file_format_max'
+SET global innodb_file_format_max=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_file_format_max'
+SET global innodb_file_format_max='Salmon';
+ERROR 42000: Variable 'innodb_file_format_max' can't be set to the value of 'Salmon'
+SET @@global.innodb_file_format_max = @start_global_value;
+SELECT @@global.innodb_file_format_max;
+@@global.innodb_file_format_max
+Antelope
diff --git a/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result b/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result
new file mode 100644
index 00000000000..d627aa92ba7
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result
@@ -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
diff --git a/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result b/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
new file mode 100644
index 00000000000..a8d392eee38
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_rollback_segments_basic.result
@@ -0,0 +1,64 @@
+SET @start_global_value = @@global.innodb_rollback_segments;
+SELECT @start_global_value;
+@start_global_value
+128
+Valid values are zero or above
+SELECT @@global.innodb_rollback_segments >=0;
+@@global.innodb_rollback_segments >=0
+1
+SELECT @@global.innodb_rollback_segments <=128;
+@@global.innodb_rollback_segments <=128
+1
+SELECT @@global.innodb_rollback_segments;
+@@global.innodb_rollback_segments
+128
+SELECT @@session.innodb_rollback_segments;
+ERROR HY000: Variable 'innodb_rollback_segments' is a GLOBAL variable
+SHOW global variables LIKE 'innodb_rollback_segments';
+Variable_name Value
+innodb_rollback_segments 128
+SHOW session variables LIKE 'innodb_rollback_segments';
+Variable_name Value
+innodb_rollback_segments 128
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ROLLBACK_SEGMENTS 128
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_rollback_segments';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ROLLBACK_SEGMENTS 128
+SET global innodb_rollback_segments=100;
+SELECT @@global.innodb_rollback_segments;
+@@global.innodb_rollback_segments
+100
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ROLLBACK_SEGMENTS 100
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_rollback_segments';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ROLLBACK_SEGMENTS 100
+SET session innodb_rollback_segments=1;
+ERROR HY000: Variable 'innodb_rollback_segments' is a GLOBAL variable and should be set with SET GLOBAL
+SET global innodb_rollback_segments=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
+SET global innodb_rollback_segments=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
+SET global innodb_rollback_segments="foo";
+ERROR 42000: Incorrect argument type to variable 'innodb_rollback_segments'
+SET global innodb_rollback_segments=-7;
+Warnings:
+Warning 1292 Truncated incorrect innodb_rollback_segments value: '-7'
+SELECT @@global.innodb_rollback_segments;
+@@global.innodb_rollback_segments
+1
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_ROLLBACK_SEGMENTS 1
+SET @@global.innodb_rollback_segments = @start_global_value;
+SELECT @@global.innodb_rollback_segments;
+@@global.innodb_rollback_segments
+128
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result
new file mode 100644
index 00000000000..6599ca9edb6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_method_basic.result
@@ -0,0 +1,83 @@
+SET @start_global_value = @@global.innodb_stats_method;
+SELECT @start_global_value;
+@start_global_value
+nulls_equal
+Valid values are 'nulls_equal', 'nulls_unequal', 'nulls_ignored'
+SELECT @@global.innodb_stats_method in ('nulls_equal', 'nulls_unequal',
+'nulls_ignored');
+@@global.innodb_stats_method in ('nulls_equal', 'nulls_unequal',
+'nulls_ignored')
+1
+SELECT @@global.innodb_stats_method;
+@@global.innodb_stats_method
+nulls_equal
+SELECT @@session.innodb_stats_method;
+ERROR HY000: Variable 'innodb_stats_method' is a GLOBAL variable
+SHOW global variables LIKE 'innodb_stats_method';
+Variable_name Value
+innodb_stats_method nulls_equal
+SHOW session variables LIKE 'innodb_stats_method';
+Variable_name Value
+innodb_stats_method nulls_equal
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_equal
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_equal
+SET global innodb_stats_method='nulls_equal';
+SELECT @@global.innodb_stats_method;
+@@global.innodb_stats_method
+nulls_equal
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_equal
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_equal
+SET @@global.innodb_stats_method='nulls_unequal';
+SELECT @@global.innodb_stats_method;
+@@global.innodb_stats_method
+nulls_unequal
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_unequal
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_unequal
+SET global innodb_stats_method=2;
+SELECT @@global.innodb_stats_method;
+@@global.innodb_stats_method
+nulls_ignored
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_ignored
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_STATS_METHOD nulls_ignored
+SET session innodb_stats_method='nulls_equal';
+ERROR HY000: Variable 'innodb_stats_method' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@session.innodb_stats_method='nulls_ignored';
+ERROR HY000: Variable 'innodb_stats_method' is a GLOBAL variable and should be set with SET GLOBAL
+SET global innodb_stats_method=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_stats_method'
+SET global innodb_stats_method=4;
+ERROR 42000: Variable 'innodb_stats_method' can't be set to the value of '4'
+SET global innodb_stats_method=-2;
+ERROR 42000: Variable 'innodb_stats_method' can't be set to the value of '-2'
+SET global innodb_stats_method=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_stats_method'
+SET global innodb_stats_method='some';
+ERROR 42000: Variable 'innodb_stats_method' can't be set to the value of 'some'
+SET @@global.innodb_stats_method = @start_global_value;
+SELECT @@global.innodb_stats_method;
+@@global.innodb_stats_method
+nulls_equal
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
index cbf25af2442..f9f61b9380c 100644
--- a/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_file_format_check_basic.test
@@ -1,55 +1,95 @@
-
-
-# 2010-01-25 - Added
#
+# 2011-08-02 - Added
+#
+
--source include/not_embedded.inc
--source include/have_innodb.inc
-SET @start_global_value = @@global.innodb_file_format_max;
+SET @start_global_value = @@global.innodb_file_format_check;
SELECT @start_global_value;
#
# exists as global only
#
---echo Valid values are 'Antelope' and 'Barracuda'
-select @@global.innodb_file_format_max in ('Antelope', 'Barracuda');
-select @@global.innodb_file_format_max;
+--echo Valid values are 'ON' and 'OFF'
+SELECT @@global.innodb_file_format_check in (0, 1);
+SELECT @@global.innodb_file_format_check;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_file_format_check;
+SHOW global variables LIKE 'innodb_file_format_check';
+SHOW session variables LIKE 'innodb_file_format_check';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_check';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_check';
+
+#
+# show that it's read only
+#
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_file_format_check='Off';
+--echo Expected error 'Read only variable'
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_file_format_check=1;
+--echo Expected error 'Read only variable'
+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.innodb_file_format_max;
-show global variables like 'innodb_file_format_max';
-show session variables like 'innodb_file_format_max';
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
-
-#
-# show that it's writable
-#
-set global innodb_file_format_max='Antelope';
-select @@global.innodb_file_format_max;
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
-set @@global.innodb_file_format_max='Barracuda';
-select @@global.innodb_file_format_max;
-select * from information_schema.global_variables where variable_name='innodb_file_format_max';
-select * from information_schema.session_variables where variable_name='innodb_file_format_max';
+SET @@global.innodb_file_format_check=0;
+--echo Expected error 'Read only variable'
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.innodb_file_format_check='On';
+--echo Expected error 'Read only variable'
+
--error ER_GLOBAL_VARIABLE
-set session innodb_file_format_max='Salmon';
+SET session innodb_large_prefix='OFF';
--error ER_GLOBAL_VARIABLE
-set @@session.innodb_file_format_max='Salmon';
+SET @@session.innodb_stats_on_metadata='ON';
#
-# incorrect types
+# Check if the value in GLOBAL Table matches value in variable
#
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_file_format_max=1.1;
---error ER_WRONG_TYPE_FOR_VAR
-set global innodb_file_format_max=1e1;
---error ER_WRONG_VALUE_FOR_VAR
-set global innodb_file_format_max='Salmon';
+
+SELECT IF(@@GLOBAL.innodb_file_format_check, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_format_check';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_file_format_check);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_file_format_check';
+--echo 1 Expected
#
-# Cleanup
+# Check if accessing variable with and without GLOBAL point to same variable
#
+SELECT @@innodb_file_format_check = @@GLOBAL.innodb_file_format_check;
+--echo 1 Expected
+
+#
+# Check if innodb_doublewrite can be accessed with and without @@ sign
+#
+
+SELECT COUNT(@@innodb_file_format_check);
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_file_format_check);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_file_format_check);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_file_format_check);
+--echo 1 Expected
-SET @@global.innodb_file_format_max = @start_global_value;
-SELECT @@global.innodb_file_format_max;
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_file_format_check = @@SESSION.innodb_file_format_check;
+--echo Expected error 'Readonly variable'
diff --git a/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test
new file mode 100644
index 00000000000..c2cb4cb47bb
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_file_format_max_basic.test
@@ -0,0 +1,60 @@
+#
+# 2011-08-02 - Added
+#
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_file_format_max;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'Antelope' and 'Barracuda'
+SELECT @@global.innodb_file_format_max in ('Antelope', 'Barracuda');
+SELECT @@global.innodb_file_format_max;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_file_format_max;
+SHOW global variables LIKE 'innodb_file_format_max';
+SHOW session variables LIKE 'innodb_file_format_max';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+
+#
+# show that it's writable
+#
+SET global innodb_file_format_max='Antelope';
+SELECT @@global.innodb_file_format_max;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+SET @@global.innodb_file_format_max='Barracuda';
+SELECT @@global.innodb_file_format_max;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_file_format_max';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_file_format_max';
+--error ER_GLOBAL_VARIABLE
+SET session innodb_file_format_max='Salmon';
+--error ER_GLOBAL_VARIABLE
+SET @@session.innodb_file_format_max='Salmon';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_file_format_max=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_file_format_max=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_file_format_max='Salmon';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_file_format_max = @start_global_value;
+SELECT @@global.innodb_file_format_max;
diff --git a/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test
new file mode 100644
index 00000000000..f78223bad02
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test
@@ -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;
diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
new file mode 100644
index 00000000000..9f0b70a528f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_rollback_segments_basic.test
@@ -0,0 +1,58 @@
+#
+# 2011-08-01 Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_rollback_segments;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are zero or above
+SELECT @@global.innodb_rollback_segments >=0;
+SELECT @@global.innodb_rollback_segments <=128;
+SELECT @@global.innodb_rollback_segments;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_rollback_segments;
+SHOW global variables LIKE 'innodb_rollback_segments';
+SHOW session variables LIKE 'innodb_rollback_segments';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_rollback_segments';
+
+#
+# show that it's writable
+#
+SET global innodb_rollback_segments=100;
+SELECT @@global.innodb_rollback_segments;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_rollback_segments';
+--error ER_GLOBAL_VARIABLE
+SET session innodb_rollback_segments=1;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_rollback_segments=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_rollback_segments=1e1;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_rollback_segments="foo";
+SET global innodb_rollback_segments=-7;
+SELECT @@global.innodb_rollback_segments;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_rollback_segments';
+
+#
+# cleanup
+#
+
+SET @@global.innodb_rollback_segments = @start_global_value;
+SELECT @@global.innodb_rollback_segments;
diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
new file mode 100644
index 00000000000..f01574c3683
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_stats_method_basic.test
@@ -0,0 +1,72 @@
+#
+# 2011-08-05 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_stats_method;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'nulls_equal', 'nulls_unequal', 'nulls_ignored'
+SELECT @@global.innodb_stats_method in ('nulls_equal', 'nulls_unequal',
+'nulls_ignored');
+SELECT @@global.innodb_stats_method;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.innodb_stats_method;
+SHOW global variables LIKE 'innodb_stats_method';
+SHOW session variables LIKE 'innodb_stats_method';
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+
+#
+# show that it's writable
+#
+SET global innodb_stats_method='nulls_equal';
+SELECT @@global.innodb_stats_method;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+SET @@global.innodb_stats_method='nulls_unequal';
+SELECT @@global.innodb_stats_method;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+SET global innodb_stats_method=2;
+SELECT @@global.innodb_stats_method;
+SELECT * FROM information_schema.global_variables
+WHERE variable_name='innodb_stats_method';
+SELECT * FROM information_schema.session_variables
+WHERE variable_name='innodb_stats_method';
+
+--error ER_GLOBAL_VARIABLE
+SET session innodb_stats_method='nulls_equal';
+--error ER_GLOBAL_VARIABLE
+SET @@session.innodb_stats_method='nulls_ignored';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_method=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method=4;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+SET global innodb_stats_method=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+SET global innodb_stats_method='some';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_stats_method = @start_global_value;
+SELECT @@global.innodb_stats_method;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 86f465b3a6e..57a5a656591 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -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 #
diff --git a/mysql-test/t/implicit_commit.test b/mysql-test/t/implicit_commit.test
index b10788bd891..59f8dc3a44c 100644
--- a/mysql-test/t/implicit_commit.test
+++ b/mysql-test/t/implicit_commit.test
@@ -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;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 07839257a15..74110962299 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -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
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index a9220aa04e6..5586231ea62 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8376,6 +8376,33 @@ SET @@GLOBAL.init_connect= @old_init_connect;
DROP PROCEDURE p2;
DROP PROCEDURE p5;
+--echo #
+--echo # Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, KEY(b));
+CREATE TABLE t2 (c INT, d INT, KEY(c));
+INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
+INSERT INTO t2 VALUES (1,1),(1,2);
+
+DELIMITER $;
+
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
+BEGIN
+ DECLARE a int;
+ -- SQL statement inside
+ SELECT 1 INTO a;
+ RETURN a;
+END $
+
+DELIMITER ;$
+
+SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
+
+DROP FUNCTION f1;
+DROP TABLE t1, t2;
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
diff --git a/mysys/my_init.c b/mysys/my_init.c
index b5da20b262c..e81752fb271 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -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);
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 30303c43bb4..e2ced8c8326 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -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 32-bit word
#include <stdio.h>
#include <string.h>
+#include <welcome_copyright_notice.h> /* 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 "
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 97ba38aa5be..6519146d040 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2747,7 +2747,7 @@ String *Item_time_typecast::val_str(String *str)
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;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e2a1f694aee..0f5087c6ccf 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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)
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index d1fd6bac41c..0060bcb6b1e 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -31,6 +31,8 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
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(ulong s_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
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 2e06d3e8b94..1434ba45519 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -62,6 +62,7 @@ class Master_info : public Slave_reporting_capability
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_reporting_capability
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,
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 43ad400ce64..644796ea337 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -89,6 +89,69 @@ bool No_such_table_error_handler::safely_trapped_errors()
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 *lex, TABLE_LIST *tables,
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);
@@ -7811,7 +7888,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
sum_func_list)
item->split_sum_func(thd, ref_pointer_array, *sum_func_list);
- thd->used_tables|= item->used_tables();
+ thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
@@ -8158,7 +8235,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
views and natural joins this update is performed inside the loop below.
*/
if (table)
- thd->used_tables|= table->map;
+ thd->lex->used_tables|= table->map;
/*
Initialize a generic field iterator for the current table reference.
@@ -8243,7 +8320,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
field_table= nj_col->table_ref->table;
if (field_table)
{
- thd->used_tables|= field_table->map;
+ thd->lex->used_tables|= field_table->map;
field_table->covering_keys.intersect(field->part_of_key);
field_table->merge_keys.merge(field->part_of_key);
field_table->used_fields++;
@@ -8251,7 +8328,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
}
}
else
- thd->used_tables|= item->used_tables();
+ thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
/*
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index dd8133835d3..97a227c8bb5 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -520,11 +520,11 @@ const char *set_thd_proc_info(void *thd_arg, const char *info,
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;
@@ -795,7 +795,6 @@ THD::THD()
is_slave_error= thread_specific_used= FALSE;
my_hash_clear(&handler_tables_hash);
tmp_table=0;
- used_tables=0;
cuted_fields= 0L;
sent_row_count= 0L;
limit_found_rows= 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fafbab07979..9f13908d31c 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1960,13 +1960,6 @@ public:
*/
ha_rows examined_row_count;
- /*
- The set of those tables whose fields are referenced in all subqueries
- of the query.
- TODO: possibly this it is incorrect to have used tables in THD because
- with more than one subquery, it is not clear what does the field mean.
- */
- table_map used_tables;
USER_CONN *user_connect;
CHARSET_INFO *db_charset;
Warning_info *warning_info;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d2118a16566..eaf7f4c895b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -717,7 +717,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
lock_type= table_list->lock_type;
thd_proc_info(thd, "init");
- thd->used_tables=0;
+ thd->lex->used_tables=0;
values= its++;
value_count= values->elements;
@@ -872,7 +872,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
else
{
- if (thd->used_tables) // Column used in values()
+ if (thd->lex->used_tables) // Column used in values()
restore_record(table,s->default_values); // Get empty record
else
{
@@ -1610,9 +1610,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto before_trg_err;
table->file->restore_auto_increment(prev_insert_id);
- if (table->next_number_field)
- table->file->adjust_next_insert_id_after_explicit_value(
- table->next_number_field->val_int());
info->touched++;
if (!records_are_comparable(table) || compare_records(table))
{
@@ -1649,8 +1646,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (table->next_number_field)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
- info->touched++;
-
goto ok_or_after_trg_err;
}
else /* DUP_REPLACE */
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 44c7879694b..1cc967c5055 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -434,6 +434,7 @@ void lex_start(THD *thd)
lex->server_options.port= -1;
lex->is_lex_started= TRUE;
+ lex->used_tables= 0;
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index accbd78246e..8794006fef7 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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,
@@ -2391,6 +2396,16 @@ struct LEX: public Query_tables_list
bool escape_used;
bool is_lex_started; /* If lex_start() did run. For debugging. */
+ /*
+ The set of those tables whose fields are referenced in all subqueries
+ of the query.
+ TODO: possibly this it is incorrect to have used tables in LEX because
+ with subquery, it is not clear what does the field mean. To fix this
+ we should aggregate used tables information for selected expressions
+ into the select_lex.
+ */
+ table_map used_tables;
+
LEX();
virtual ~LEX()
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 7f2ab1aeb8e..48b6886f6f2 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1474,7 +1474,7 @@ static int mysql_test_select(Prepared_statement *stmt,
if (open_normal_and_derived_tables(thd, tables, MYSQL_OPEN_FORCE_SHARED_MDL))
goto error;
- thd->used_tables= 0; // Updated by setup_fields
+ thd->lex->used_tables= 0; // Updated by setup_fields
/*
JOIN::prepare calls
@@ -1646,7 +1646,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
if (specific_prepare && (*specific_prepare)(thd))
DBUG_RETURN(TRUE);
- thd->used_tables= 0; // Updated by setup_fields
+ thd->lex->used_tables= 0; // Updated by setup_fields
/* Calls JOIN::prepare */
DBUG_RETURN(lex->unit.prepare(thd, 0, setup_tables_done_option));
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index 6c398ca0cb5..5910833612a 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -294,7 +294,7 @@ void QUERY_PROFILE::new_status(const char *status_arg,
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);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 001c4cec678..8653607263f 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1285,8 +1285,9 @@ int reset_slave(THD *thd, Master_info* mi)
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).
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index cb811a57cf7..35495197c2b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -435,7 +435,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
if (!ref->fixed && ref->fix_fields(thd, 0))
return TRUE;
- thd->used_tables|= item->used_tables();
+ thd->lex->used_tables|= item->used_tables();
}
return false;
}
@@ -1675,7 +1675,7 @@ JOIN::optimize()
if (exec_tmp_table1->distinct)
{
- table_map used_tables= thd->used_tables;
+ table_map used_tables= thd->lex->used_tables;
JOIN_TAB *last_join_tab= join_tab+tables-1;
do
{
@@ -2552,7 +2552,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(TRUE);
thd_proc_info(thd, "init");
- thd->used_tables=0; // Updated by setup_fields
+ thd->lex->used_tables=0; // Updated by setup_fields
err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit);
@@ -17032,7 +17032,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
need_order=0;
extra.append(STRING_WITH_LEN("; Using filesort"));
}
- if (distinct & test_all_bits(used_tables,thd->used_tables))
+ if (distinct & test_all_bits(used_tables, thd->lex->used_tables))
extra.append(STRING_WITH_LEN("; Distinct"));
for (uint part= 0; part < tab->ref.key_parts; part++)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 564250a9bf2..ba1b9e43713 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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
{
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index fe311ebfd8d..648e53ac4a6 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -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. */
diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
index eeaa21ae9ef..da804a66b29 100644
--- a/storage/innobase/buf/buf0rea.c
+++ b/storage/innobase/buf/buf0rea.c
@@ -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)) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index c4d2226227e..f8e96d5fa60 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -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",
@@ -7896,6 +7898,8 @@ ha_innobase::info_low(
if (flag & HA_STATUS_VARIABLE) {
+ ulint page_size;
+
dict_table_stats_lock(ib_table, RW_S_LATCH);
n_rows = ib_table->stat_n_rows;
@@ -7938,14 +7942,19 @@ ha_innobase::info_low(
prebuilt->autoinc_last_value = 0;
}
+ page_size = dict_table_zip_size(ib_table);
+ if (page_size == 0) {
+ page_size = UNIV_PAGE_SIZE;
+ }
+
stats.records = (ha_rows)n_rows;
stats.deleted = 0;
- stats.data_file_length = ((ulonglong)
- ib_table->stat_clustered_index_size)
- * UNIV_PAGE_SIZE;
- stats.index_file_length = ((ulonglong)
- ib_table->stat_sum_of_other_index_sizes)
- * UNIV_PAGE_SIZE;
+ stats.data_file_length
+ = ((ulonglong) ib_table->stat_clustered_index_size)
+ * page_size;
+ stats.index_file_length =
+ ((ulonglong) ib_table->stat_sum_of_other_index_sizes)
+ * page_size;
dict_table_stats_unlock(ib_table, RW_S_LATCH);
@@ -11317,6 +11326,11 @@ static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
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 +11399,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
#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),
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index b7621c679f0..98931067850 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -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;
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 4fdaf6ff43e..0e80ce55e57 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -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));
}
}
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index f42894a138c..74ef2d2dab7 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -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
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index cdf6cdba3d1..cd5eff66ee8 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -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
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index fc9401a12f5..7a93548cb03 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -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 */
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 53d0c2ec232..36da621e077 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -2541,6 +2541,8 @@ row_sel_field_store_in_mysql_format(
ut_ad(len != UNIV_SQL_NULL);
UNIV_MEM_ASSERT_RW(data, len);
+ UNIV_MEM_ASSERT_W(dest, templ->mysql_col_len);
+ UNIV_MEM_INVALID(dest, templ->mysql_col_len);
switch (templ->type) {
const byte* field_end;
@@ -2579,14 +2581,16 @@ row_sel_field_store_in_mysql_format(
dest = row_mysql_store_true_var_len(
dest, len, templ->mysql_length_bytes);
+ /* Copy the actual data. Leave the rest of the
+ buffer uninitialized. */
+ memcpy(dest, data, len);
+ break;
}
/* Copy the actual data */
ut_memcpy(dest, data, len);
- /* Pad with trailing spaces. We pad with spaces also the
- unused end of a >= 5.0.3 true VARCHAR column, just in case
- MySQL expects its contents to be deterministic. */
+ /* Pad with trailing spaces. */
pad = dest + len;
@@ -3113,6 +3117,39 @@ sel_restore_position_for_mysql(
}
/********************************************************************//**
+Copies a cached field for MySQL from the fetch cache. */
+static
+void
+row_sel_copy_cached_field_for_mysql(
+/*================================*/
+ byte* buf, /*!< in/out: row buffer */
+ const byte* cache, /*!< in: cached row */
+ const mysql_row_templ_t*templ) /*!< in: column template */
+{
+ ulint len;
+
+ buf += templ->mysql_col_offset;
+ cache += templ->mysql_col_offset;
+
+ UNIV_MEM_ASSERT_W(buf, templ->mysql_col_len);
+
+ if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR
+ && templ->type != DATA_INT) {
+ /* Check for != DATA_INT to make sure we do
+ not treat MySQL ENUM or SET as a true VARCHAR!
+ Find the actual length of the true VARCHAR field. */
+ row_mysql_read_true_varchar(
+ &len, cache, templ->mysql_length_bytes);
+ len += templ->mysql_length_bytes;
+ UNIV_MEM_INVALID(buf, templ->mysql_col_len);
+ } else {
+ len = templ->mysql_col_len;
+ }
+
+ ut_memcpy(buf, cache, len);
+}
+
+/********************************************************************//**
Pops a cached row for MySQL from the fetch cache. */
UNIV_INLINE
void
@@ -3124,26 +3161,22 @@ row_sel_pop_cached_row_for_mysql(
{
ulint i;
const mysql_row_templ_t*templ;
- byte* cached_rec;
+ const byte* cached_rec;
ut_ad(prebuilt->n_fetch_cached > 0);
ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
+ UNIV_MEM_ASSERT_W(buf, prebuilt->mysql_row_len);
+
+ cached_rec = prebuilt->fetch_cache[prebuilt->fetch_cache_first];
+
if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) {
/* Copy cache record field by field, don't touch fields that
are not covered by current key */
- cached_rec = prebuilt->fetch_cache[
- prebuilt->fetch_cache_first];
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
-#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
- UNIV_MEM_ASSERT_RW(cached_rec
- + templ->mysql_col_offset,
- templ->mysql_col_len);
-#endif
- ut_memcpy(buf + templ->mysql_col_offset,
- cached_rec + templ->mysql_col_offset,
- templ->mysql_col_len);
+ row_sel_copy_cached_field_for_mysql(
+ buf, cached_rec, templ);
/* Copy NULL bit of the current field from cached_rec
to buf */
if (templ->mysql_null_bit_mask) {
@@ -3153,17 +3186,24 @@ row_sel_pop_cached_row_for_mysql(
& (byte)templ->mysql_null_bit_mask;
}
}
+ } else if (prebuilt->mysql_prefix_len > 63) {
+ /* The record is long. Copy it field by field, in case
+ there are some long VARCHAR column of which only a
+ small length is being used. */
+ UNIV_MEM_INVALID(buf, prebuilt->mysql_prefix_len);
+
+ /* First copy the NULL bits. */
+ ut_memcpy(buf, cached_rec, prebuilt->null_bitmap_len);
+ /* Then copy the requested fields. */
+
+ for (i = 0; i < prebuilt->n_template; i++) {
+ row_sel_copy_cached_field_for_mysql(
+ buf, cached_rec, prebuilt->mysql_template + i);
+ }
+ } else {
+ ut_memcpy(buf, cached_rec, prebuilt->mysql_prefix_len);
}
- else {
-#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
- UNIV_MEM_ASSERT_RW(prebuilt->fetch_cache
- [prebuilt->fetch_cache_first],
- prebuilt->mysql_prefix_len);
-#endif
- ut_memcpy(buf,
- prebuilt->fetch_cache[prebuilt->fetch_cache_first],
- prebuilt->mysql_prefix_len);
- }
+
prebuilt->n_fetch_cached--;
prebuilt->fetch_cache_first++;
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 04503d25cd4..c7427abdddd 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -222,6 +222,8 @@ UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX;
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
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 233f63ba680..c76e9ee0bfe 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -159,9 +159,14 @@ extern "C" void myrg_print_wrong_table(const char *table_name)
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_children_callback(void *callback_param)
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_children_callback(void *callback_param)
{
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_children_callback(void *callback_param)
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, &param,
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 533e5d13cdd..d51036fc69d 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -385,6 +385,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
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_info, int handle_locking,
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_info, int handle_locking,
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;
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 719800e309a..92f055e269a 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -127,13 +127,13 @@
%define distro_description Oracle Enterprise Linux 4
%define distro_releasetag oel4
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
- %define distro_requires chkconfig coreutils grep procps shadow-utils
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%if "%oelver" == "5"
%define distro_description Oracle Enterprise Linux 5
%define distro_releasetag oel5
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
- %define distro_requires chkconfig coreutils grep procps shadow-utils
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%{error:Oracle Enterprise Linux %{oelver} is unsupported}
%endif
@@ -145,13 +145,13 @@
%define distro_description Red Hat Enterprise Linux 4
%define distro_releasetag rhel4
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
- %define distro_requires chkconfig coreutils grep procps shadow-utils
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%if "%rhelver" == "5"
%define distro_description Red Hat Enterprise Linux 5
%define distro_releasetag rhel5
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
- %define distro_requires chkconfig coreutils grep procps shadow-utils
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%{error:Red Hat Enterprise Linux %{rhelver} is unsupported}
%endif
@@ -1123,6 +1123,7 @@ echo "=====" >> $STATUS_HISTORY
# ----------------------------------------------------------------------------
%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
@@ -1136,6 +1137,10 @@ echo "=====" >> $STATUS_HISTORY
- Added the mysql_plugin client - enables or disables plugins.
+* Thu Jul 21 2011 Sunanda Menon <sunanda.menon@oracle.com>
+
+- Fix bug#12561297: Added the MySQL embedded binary
+
* Thu Jul 07 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
- Fix bug#45415: "rpm upgrade recreates test database"
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index b3da65485dd..14a60f0e857 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -19660,6 +19660,34 @@ static void test_bug12337762()
DBUG_VOID_RETURN;
}
+
+/*
+ BUG 11754979 - 46675: ON DUPLICATE KEY UPDATE AND UPDATECOUNT() POSSIBLY WRONG
+*/
+
+static void test_bug11754979()
+{
+ MYSQL* conn;
+ DBUG_ENTER("test_bug11754979");
+
+ myheader("test_bug11754979");
+ DIE_UNLESS((conn= mysql_client_init(NULL)));
+ DIE_UNLESS(mysql_real_connect(conn, opt_host, opt_user,
+ opt_password, opt_db ? opt_db:"test", opt_port,
+ opt_unix_socket, CLIENT_FOUND_ROWS));
+ myquery(mysql_query(conn, "DROP TABLE IF EXISTS t1"));
+ myquery(mysql_query(conn, "CREATE TABLE t1(id INT, label CHAR(1), PRIMARY KEY(id))"));
+ myquery(mysql_query(conn, "INSERT INTO t1(id, label) VALUES (1, 'a')"));
+ myquery(mysql_query(conn, "INSERT INTO t1(id, label) VALUES (1, 'a') "
+ "ON DUPLICATE KEY UPDATE id = 4"));
+ DIE_UNLESS(mysql_affected_rows(conn) == 2);
+ myquery(mysql_query(conn, "DROP TABLE t1"));
+ mysql_close(conn);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -20005,6 +20033,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug56976", test_bug56976 },
{ "test_bug11766854", test_bug11766854 },
{ "test_bug12337762", test_bug12337762 },
+ { "test_bug11754979", test_bug11754979 },
{ 0, 0 }
};