List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:July 22 2011 9:40am
Subject:bzr push into mysql-5.5-mtr branch (bjorn.munch:3229 to 3232)
View as plain text  
 3232 Bjorn Munch	2011-07-22 [merge]
      null upmerge

 3231 Bjorn Munch	2011-07-22 [merge]
      merge from 5.5 main

    added:
      mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result
      mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test
    modified:
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqltest.cc
      config.h.cmake
      configure.cmake
      dbug/dbug_analyze.c
      dbug/my_main.c
      dbug/tests.c
      libmysqld/examples/CMakeLists.txt
      mysql-test/collections/default.experimental
      mysql-test/extra/rpl_tests/rpl_reset_slave.test
      mysql-test/r/func_math.result
      mysql-test/suite/rpl/r/rpl_row_reset_slave.result
      mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
      mysql-test/t/func_math.test
      mysql-test/t/implicit_commit.test
      mysys/my_init.c
      sql/gen_lex_hash.cc
      sql/item_func.cc
      sql/mysqld.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/sql_class.cc
      sql/sql_lex.h
      sql/sql_profile.cc
      sql/sql_repl.cc
      sql/sql_yacc.yy
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0rea.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/buf0lru.h
      storage/innobase/include/buf0rea.h
      storage/innobase/include/srv0srv.h
      storage/innobase/srv/srv0srv.c
      strings/decimal.c
      support-files/mysql.spec.sh
 3230 Bjorn Munch	2011-07-22
      Bug #11766328 59417: TEST BUGS.BUG57108 IS BROKEN:.....
        The test has been removed, no other tests are using this file
        (If any did, they would fail)
        Removing the file.

    removed:
      mysql-test/std_data/bug57108.cnf
 3229 Bjorn Munch	2011-07-15 [merge]
      null upmerge

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2011-06-30 15:46:53 +0000
+++ b/client/mysql.cc	2011-07-22 07:50:44 +0000
@@ -1177,7 +1177,7 @@ int main(int argc,char *argv[])
 	  mysql_thread_id(&mysql), server_version_string(&mysql));
   put_info((char*) glob_buffer.ptr(),INFO_INFO);
 
-  put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"), INFO_INFO);
+  put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"), INFO_INFO);
 
 #ifdef HAVE_READLINE
   initialize_readline((char*) my_progname);
@@ -1595,7 +1595,7 @@ static void usage(int version)
 
   if (version)
     return;
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   printf("Usage: %s [OPTIONS] [database]\n", my_progname);
   my_print_help(my_long_options);
   print_defaults("my", load_default_groups);

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2011-06-30 15:46:53 +0000
+++ b/client/mysql_upgrade.c	2011-07-22 07:50:44 +0000
@@ -243,6 +243,7 @@ get_one_option(int optid, const struct m
   switch (optid) {
 
   case '?':
+    puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
     printf("%s  Ver %s Distrib %s, for %s (%s)\n",
            my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
     puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2011-06-30 15:46:53 +0000
+++ b/client/mysqladmin.cc	2011-07-22 07:50:44 +0000
@@ -688,7 +688,7 @@ static int execute_commands(MYSQL *mysql
     case ADMIN_VER:
       new_line=1;
       print_version();
-      puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+      puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
       printf("Server version\t\t%s\n", mysql_get_server_info(mysql));
       printf("Protocol version\t%d\n", mysql_get_proto_info(mysql));
       printf("Connection\t\t%s\n",mysql_get_host_info(mysql));
@@ -1086,7 +1086,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   puts("Administration program for the mysqld daemon.");
   printf("Usage: %s [OPTIONS] command command....\n", my_progname);
   my_print_help(my_long_options);

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2011-06-30 15:46:53 +0000
+++ b/client/mysqlcheck.c	2011-07-22 07:50:44 +0000
@@ -224,7 +224,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
   puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
   puts("used at the same time. Not all options are supported by all storage engines.");

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2011-07-03 23:48:19 +0000
+++ b/client/mysqldump.c	2011-07-22 07:50:44 +0000
@@ -55,6 +55,8 @@
 
 #include <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);

=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c	2011-06-30 15:46:53 +0000
+++ b/client/mysqlimport.c	2011-07-22 07:50:44 +0000
@@ -18,14 +18,8 @@
 /*
 **	   mysqlimport.c  - Imports all given files
 **			    into a table(s).
-**
-**			   *************************
-**			   *			   *
-**			   * AUTHOR: Monty & Jani  *
-**			   * DATE:   June 24, 1997 *
-**			   *			   *
-**			   *************************
 */
+
 #define IMPORT_VERSION "3.7"
 
 #include "client_priv.h"
@@ -44,6 +38,8 @@ pthread_mutex_t counter_mutex;
 pthread_cond_t count_threshhold;
 #endif
 
+#include <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\

=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c	2011-06-30 15:46:53 +0000
+++ b/client/mysqlshow.c	2011-07-22 07:50:44 +0000
@@ -264,7 +264,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010)"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011)"));
   puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
   printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
   puts("\n\

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-07-03 23:48:19 +0000
+++ b/client/mysqltest.cc	2011-07-22 07:50:44 +0000
@@ -22,13 +22,6 @@
   http://dev.mysql.com/doc/mysqltest/en/index.html
 
   Please keep the test framework tools identical in all versions!
-
-  Written by:
-  Sasha Pachev <sasha@stripped>
-  Matt Wagner  <matt@stripped>
-  Monty
-  Jani
-  Holyfoot
 */
 
 #define MTEST_VERSION "3.3"
@@ -6438,7 +6431,7 @@ void print_version(void)
 void usage()
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   printf("Runs a test against the mysql server and compares output with a results file.\n\n");
   printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
   my_print_help(my_long_options);

=== modified file 'config.h.cmake'
--- a/config.h.cmake	2011-04-30 05:24:38 +0000
+++ b/config.h.cmake	2011-07-21 15:45:38 +0000
@@ -219,7 +219,6 @@
 #cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
 #cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
 #cmakedefine HAVE_PTHREAD_CONDATTR_SETCLOCK 1
-#cmakedefine HAVE_PTHREAD_INIT 1
 #cmakedefine HAVE_PTHREAD_KEY_DELETE 1
 #cmakedefine HAVE_PTHREAD_KEY_DELETE 1
 #cmakedefine HAVE_PTHREAD_KILL 1

=== modified file 'configure.cmake'
--- a/configure.cmake	2011-06-30 15:46:53 +0000
+++ b/configure.cmake	2011-07-21 15:45:38 +0000
@@ -391,7 +391,6 @@ CHECK_FUNCTION_EXISTS (pthread_attr_sets
 CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
 CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
 CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
-CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT)
 CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
 CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
 CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)

=== modified file 'dbug/dbug_analyze.c'
--- a/dbug/dbug_analyze.c	2011-01-11 09:07:37 +0000
+++ b/dbug/dbug_analyze.c	2011-07-21 15:45:38 +0000
@@ -571,9 +571,6 @@ int main (int argc, char **argv)
     FILE *infile;
     FILE *outfile = {stdout};
 
-#if defined(HAVE_PTHREAD_INIT)
-  pthread_init();                       /* Must be called before DBUG_ENTER */
-#endif
   my_thread_global_init(); 
   {
     DBUG_ENTER ("main");

=== modified file 'dbug/my_main.c'
--- a/dbug/my_main.c	2011-01-11 09:07:37 +0000
+++ b/dbug/my_main.c	2011-07-21 15:45:38 +0000
@@ -16,9 +16,6 @@ char *argv[];
 {
   register int result, ix;
   extern int factorial(int);
-#if defined(HAVE_PTHREAD_INIT)
-  pthread_init();			/* Must be called before DBUG_ENTER */
-#endif
   my_thread_global_init();
 
   {

=== modified file 'dbug/tests.c'
--- a/dbug/tests.c	2011-01-11 09:07:37 +0000
+++ b/dbug/tests.c	2011-07-21 15:45:38 +0000
@@ -44,9 +44,6 @@ int main (int argc, char *argv[])
   if (argc == 1)
     return 0;
 
-#if defined(HAVE_PTHREAD_INIT)
-  pthread_init();                       /* Must be called before DBUG_ENTER */
-#endif
   my_thread_global_init();
 
   dup2(1, 2);

=== modified file 'libmysqld/examples/CMakeLists.txt'
--- a/libmysqld/examples/CMakeLists.txt	2011-06-30 15:46:53 +0000
+++ b/libmysqld/examples/CMakeLists.txt	2011-07-19 07:35:14 +0000
@@ -23,9 +23,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/
 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)

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-06-06 13:17:58 +0000
+++ b/mysql-test/collections/default.experimental	2011-07-20 17:12:47 +0000
@@ -8,8 +8,8 @@ funcs_1.charset_collation_1
 main.func_math @freebsd                  # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
 main.lock_multi_bug38499                 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
 main.outfile_loaddata @solaris           # Bug#11755168 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
-main.signal_demo3 @solaris               # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.sp @solaris                         # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+main.signal_demo3 @solaris               # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+main.sp @solaris                         # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 main.wait_timeout @solaris               # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris
 
 rpl.rpl_innodb_bug28430                  # Bug#11754425
@@ -17,7 +17,7 @@ rpl.rpl_bug37426
 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
 
-sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 sys_vars.wait_timeout_func                    # Bug#11750645 2010-04-26 alik wait_timeout_func fails
 
 # BUG #59055 : All ndb tests should be removed from the repository

=== modified file 'mysql-test/extra/rpl_tests/rpl_reset_slave.test'
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test	2010-12-19 17:15:12 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test	2011-07-18 17:18:03 +0000
@@ -77,5 +77,31 @@ reset slave;
 source include/check_slave_no_error.inc;
 change master to master_user='root';
 
---let $rpl_only_running_threads= 1
+
+#
+# BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING MYSQL BUG#28796
+#
+
+reset slave;
+--source include/start_slave.inc
+
+--source include/stop_slave.inc
+--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
+--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
+--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
+
+reset slave all;
+--error ER_BAD_SLAVE
+start slave;
+
+--let $_show_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
+if ($_show_master_host != No such row)
+{
+  die;
+}
+
+--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT
+--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port
+--source include/start_slave.inc
+
 --source include/rpl_end.inc

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2011-05-26 10:09:25 +0000
+++ b/mysql-test/r/func_math.result	2011-07-18 09:21:14 +0000
@@ -699,3 +699,32 @@ select (1.175494351E-37 div 1.7976931348
 0
 Warnings:
 Warning	1292	Truncated incorrect DECIMAL value: ''
+#
+# Bug#12537160 ASSERTION FAILED:
+# STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
+#
+select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.1 as foo;
+foo
+0.0
+select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.0 as foo;
+foo
+NULL
+#
+# Bug#12711164 - 61676:
+# RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE 
+#
+select 5 div 2;
+5 div 2
+2
+select 5.0 div 2.0;
+5.0 div 2.0
+2
+select 5.0 div 2;
+5.0 div 2
+2
+select 5 div 2.0;
+5 div 2.0
+2
+select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
+5.9 div 2	1.23456789e3 DIV 2	1.23456789e9 DIV 2	1.23456789e19 DIV 2
+2	617	617283945	6172839450000000000

=== removed file 'mysql-test/std_data/bug57108.cnf'
--- a/mysql-test/std_data/bug57108.cnf	2010-11-04 10:00:59 +0000
+++ b/mysql-test/std_data/bug57108.cnf	1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-[mysqld]
-open-files-limit=1024
-character-set-server=latin1
-connect-timeout=4711
-log-bin-trust-function-creators=1
-key_buffer_size=1M
-sort_buffer=256K
-max_heap_table_size=1M
-loose-innodb_data_file_path=ibdata1:10M:autoextend
-loose-innodb_buffer_pool_size=8M
-loose-innodb_write_io_threads=2
-loose-innodb_read_io_threads=2
-loose-innodb_log_buffer_size=1M
-loose-innodb_log_file_size=5M
-loose-innodb_additional_mem_pool_size=1M
-loose-innodb_log_files_in_group=2
-slave-net-timeout=120
-log-bin=mysqld-bin
-loose-enable-performance-schema
-loose-performance-schema-max-mutex-instances=10000
-loose-performance-schema-max-rwlock-instances=10000
-loose-performance-schema-max-table-instances=500
-loose-performance-schema-max-table-handles=1000
-binlog-direct-non-transactional-updates
-
-[mysql]
-default-character-set=latin1
-
-[mysqlshow]
-default-character-set=latin1
-
-[mysqlimport]
-default-character-set=latin1
-
-[mysqlcheck]
-default-character-set=latin1
-
-[mysql_upgrade]
-default-character-set=latin1
-tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp
-
-[mysqld.1]
-#!run-master-sh
-log-bin=master-bin
-loose-enable-performance-schema
-basedir=/home/bzr/bugs/b57108-5.5-bugteam
-tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1
-character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
-lc-messages-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/
-datadir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/data
-pid-file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/run/mysqld.1.pid
-#host=localhost
-port=13000
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-#log-error=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/log/mysqld.1.err
-general_log=1
-general_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld.log
-slow_query_log=1
-slow_query_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld-slow.log
-#user=root
-#password=
-server-id=1
-secure-file-priv=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var
-ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
-ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-cert.pem
-ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-key.pem
-
-[mysqlbinlog]
-disable-force-if-open
-character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
-
-[ENV]
-MASTER_MYPORT=13000
-MASTER_MYSOCK=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-
-[client]
-password=
-user=root
-port=13000
-host=localhost
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-
-[mysqltest]
-ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
-ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-cert.pem
-ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-key.pem
-skip-ssl=1
-
-[client.1]
-password=
-user=root
-port=13000
-host=localhost
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-

=== modified file 'mysql-test/suite/rpl/r/rpl_row_reset_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result	2011-07-18 17:18:03 +0000
@@ -41,4 +41,12 @@ include/stop_slave_sql.inc
 reset slave;
 include/check_slave_no_error.inc
 change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_reset_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result	2011-07-18 17:18:03 +0000
@@ -41,4 +41,12 @@ include/stop_slave_sql.inc
 reset slave;
 include/check_slave_no_error.inc
 change master to master_user='root';
+reset slave;
+include/start_slave.inc
+include/stop_slave.inc
+reset slave all;
+start slave;
+ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
+include/start_slave.inc
 include/rpl_end.inc

=== added file 'mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_random_read_ahead_basic.result	2011-07-19 14:54:59 +0000
@@ -0,0 +1,92 @@
+SET @start_global_value = @@global.innodb_random_read_ahead;
+SELECT @start_global_value;
+@start_global_value
+0
+Valid values are 'ON' and 'OFF' 
+select @@global.innodb_random_read_ahead in (0, 1);
+@@global.innodb_random_read_ahead in (0, 1)
+1
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+0
+select @@session.innodb_random_read_ahead;
+ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable
+show global variables like 'innodb_random_read_ahead';
+Variable_name	Value
+innodb_random_read_ahead	OFF
+show session variables like 'innodb_random_read_ahead';
+Variable_name	Value
+innodb_random_read_ahead	OFF
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+set global innodb_random_read_ahead='ON';
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+1
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+set @@global.innodb_random_read_ahead=0;
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+0
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+set global innodb_random_read_ahead=1;
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+1
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+set @@global.innodb_random_read_ahead='OFF';
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+0
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	OFF
+set session innodb_random_read_ahead='OFF';
+ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_random_read_ahead='ON';
+ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_random_read_ahead=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead'
+set global innodb_random_read_ahead=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead'
+set global innodb_random_read_ahead=2;
+ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of '2'
+NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
+set global innodb_random_read_ahead=-3;
+select @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+1
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_RANDOM_READ_AHEAD	ON
+set global innodb_random_read_ahead='AUTO';
+ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of 'AUTO'
+SET @@global.innodb_random_read_ahead = @start_global_value;
+SELECT @@global.innodb_random_read_ahead;
+@@global.innodb_random_read_ahead
+0

=== added file 'mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_random_read_ahead_basic.test	2011-07-19 14:54:59 +0000
@@ -0,0 +1,70 @@
+
+
+# 2010-01-25 - Added
+#
+
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_random_read_ahead;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+--echo Valid values are 'ON' and 'OFF' 
+select @@global.innodb_random_read_ahead in (0, 1);
+select @@global.innodb_random_read_ahead;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_random_read_ahead;
+show global variables like 'innodb_random_read_ahead';
+show session variables like 'innodb_random_read_ahead';
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+
+#
+# show that it's writable
+#
+set global innodb_random_read_ahead='ON';
+select @@global.innodb_random_read_ahead;
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+set @@global.innodb_random_read_ahead=0;
+select @@global.innodb_random_read_ahead;
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+set global innodb_random_read_ahead=1;
+select @@global.innodb_random_read_ahead;
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+set @@global.innodb_random_read_ahead='OFF';
+select @@global.innodb_random_read_ahead;
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--error ER_GLOBAL_VARIABLE
+set session innodb_random_read_ahead='OFF';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_random_read_ahead='ON';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_random_read_ahead=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_random_read_ahead=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_random_read_ahead=2;
+--echo NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
+set global innodb_random_read_ahead=-3;
+select @@global.innodb_random_read_ahead;
+select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
+select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_random_read_ahead='AUTO';
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_random_read_ahead = @start_global_value;
+SELECT @@global.innodb_random_read_ahead;

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2011-05-26 10:09:25 +0000
+++ b/mysql-test/t/func_math.test	2011-07-18 09:21:14 +0000
@@ -536,3 +536,25 @@ SELECT 1 div null;
 --echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
 --echo #
 select (1.175494351E-37 div 1.7976931348623157E+308);
+
+--echo #
+--echo # Bug#12537160 ASSERTION FAILED:
+--echo # STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
+--echo #
+
+let $nine_81=
+999999999999999999999999999999999999999999999999999999999999999999999999999999999;
+
+eval select $nine_81 % 0.1 as foo;
+eval select $nine_81 % 0.0 as foo;
+
+--echo #
+--echo # Bug#12711164 - 61676:
+--echo # RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE 
+--echo #
+
+select 5 div 2;
+select 5.0 div 2.0;
+select 5.0 div 2;
+select 5 div 2.0;
+select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;

=== modified file 'mysql-test/t/implicit_commit.test'
--- a/mysql-test/t/implicit_commit.test	2010-02-26 09:58:33 +0000
+++ b/mysql-test/t/implicit_commit.test	2011-07-20 06:50:47 +0000
@@ -1,5 +1,6 @@
 source include/have_innodb.inc;
 source include/not_embedded.inc;
+source include/have_profiling.inc;
 
 SET GLOBAL EVENT_SCHEDULER = OFF;
 SET BINLOG_FORMAT = STATEMENT;

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2011-06-30 15:46:53 +0000
+++ b/mysys/my_init.c	2011-07-21 15:45:38 +0000
@@ -99,10 +99,6 @@ my_bool my_init(void)
   fastmutex_global_init();              /* Must be called early */
 #endif
 
-#if defined(HAVE_PTHREAD_INIT)
-  pthread_init();			/* Must be called before DBUG_ENTER */
-#endif
-
   /* $HOME is needed early to parse configuration files located in ~/ */
   if ((home_dir= getenv("HOME")) != 0)
     home_dir= intern_filename(home_dir_buff, home_dir);

=== modified file 'sql/gen_lex_hash.cc'
--- a/sql/gen_lex_hash.cc	2011-06-30 15:46:53 +0000
+++ b/sql/gen_lex_hash.cc	2011-07-22 07:50:44 +0000
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/*
+   Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -84,6 +85,8 @@ So, we can read full search-structure as
 #include <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 "

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-07-07 11:22:43 +0000
+++ b/sql/item_func.cc	2011-07-18 09:21:14 +0000
@@ -1605,8 +1605,13 @@ longlong Item_func_int_div::val_int()
       return 0;
     }
 
+    my_decimal truncated;
+    const bool do_truncate= true;
+    if (my_decimal_round(E_DEC_FATAL_ERROR, &tmp, 0, do_truncate, &truncated))
+      DBUG_ASSERT(false);
+
     longlong res;
-    if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) &
+    if (my_decimal2int(E_DEC_FATAL_ERROR, &truncated, unsigned_flag, &res) &
         E_DEC_OVERFLOW)
       raise_integer_overflow();
     return res;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-07-07 11:22:43 +0000
+++ b/sql/mysqld.cc	2011-07-22 07:50:44 +0000
@@ -6708,7 +6708,7 @@ static void usage(void)
   if (!default_collation_name)
     default_collation_name= (char*) default_charset_info->name;
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   puts("Starts the MySQL database server.\n");
   printf("Usage: %s [OPTIONS]\n", my_progname);
   if (!opt_verbose)

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2011-06-30 15:46:53 +0000
+++ b/sql/rpl_mi.cc	2011-07-18 17:18:03 +0000
@@ -31,6 +31,8 @@ int init_strvar_from_file(char *var, int
 int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val);
 int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f);
 
+static void init_master_log_pos(Master_info* mi);
+
 Master_info::Master_info(bool is_slave_recovery)
   :Slave_reporting_capability("I/O"),
    ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), 
@@ -100,6 +102,16 @@ bool Master_info::shall_ignore_server_id
       != NULL;
 }
 
+void Master_info::clear_in_memory_info(bool all)
+{
+  init_master_log_pos(this);
+  if (all)
+  {
+    port= MYSQL_PORT;
+    host[0] = 0; user[0] = 0; password[0] = 0;
+  }
+}
+
 void init_master_log_pos(Master_info* mi)
 {
   DBUG_ENTER("init_master_log_pos");
@@ -234,7 +246,7 @@ file '%s')", fname);
     }
 
     mi->fd = fd;
-    init_master_log_pos(mi);
+    mi->clear_in_memory_info(false);
 
   }
   else // file exists

=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h	2011-06-30 15:46:53 +0000
+++ b/sql/rpl_mi.h	2011-07-18 17:18:03 +0000
@@ -62,6 +62,7 @@ class Master_info : public Slave_reporti
   Master_info(bool is_slave_recovery);
   ~Master_info();
   bool shall_ignore_server_id(ulong s_id);
+  void clear_in_memory_info(bool all);
 
   /* the variables below are needed because we can change masters on the fly */
   char master_log_name[FN_REFLEN];
@@ -113,7 +114,6 @@ class Master_info : public Slave_reporti
   DYNAMIC_ARRAY ignore_server_ids;
   ulong master_id;
 };
-void init_master_log_pos(Master_info* mi);
 int init_master_info(Master_info* mi, const char* master_info_fname,
 		     const char* slave_info_fname,
 		     bool abort_if_no_master_info_file,

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2011-07-07 09:42:14 +0000
+++ b/sql/sql_class.cc	2011-07-20 06:50:47 +0000
@@ -520,11 +520,11 @@ const char *set_thd_proc_info(void *thd_
     thd= current_thd;
 
   const char *old_info= thd->proc_info;
-  const char *basename= calling_file ? base_name(calling_file) : NULL;
-  DBUG_PRINT("proc_info", ("%s:%d  %s", basename, calling_line, info));
+  DBUG_PRINT("proc_info", ("%s:%d  %s", calling_file, calling_line, info));
 
 #if defined(ENABLED_PROFILING)
-  thd->profiling.status_change(info, calling_function, basename, calling_line);
+  thd->profiling.status_change(info,
+                               calling_function, calling_file, calling_line);
 #endif
   thd->proc_info= info;
   return old_info;

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2011-07-07 09:42:14 +0000
+++ b/sql/sql_lex.h	2011-07-18 17:18:03 +0000
@@ -294,6 +294,10 @@ typedef struct st_lex_master_info
   DYNAMIC_ARRAY repl_ignore_server_ids;
 } LEX_MASTER_INFO;
 
+typedef struct st_lex_reset_slave
+{
+  bool all;
+} LEX_RESET_SLAVE;
 
 enum sub_select_type
 {
@@ -2232,6 +2236,7 @@ struct LEX: public Query_tables_list
   LEX_MASTER_INFO mi;				// used by CHANGE MASTER
   LEX_SERVER_OPTIONS server_options;
   USER_RESOURCES mqh;
+  LEX_RESET_SLAVE reset_slave_info;
   ulong type;
   /*
     This variable is used in post-parse stage to declare that sum-functions,

=== modified file 'sql/sql_profile.cc'
--- a/sql/sql_profile.cc	2011-06-30 15:46:53 +0000
+++ b/sql/sql_profile.cc	2011-07-20 06:50:47 +0000
@@ -294,7 +294,7 @@ void QUERY_PROFILE::new_status(const cha
   DBUG_ASSERT(status_arg != NULL);
 
   if ((function_arg != NULL) && (file_arg != NULL))
-    prof= new PROF_MEASUREMENT(this, status_arg, function_arg, file_arg, line_arg);
+    prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg);
   else
     prof= new PROF_MEASUREMENT(this, status_arg);
 

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2011-06-30 15:46:53 +0000
+++ b/sql/sql_repl.cc	2011-07-18 17:18:03 +0000
@@ -1285,8 +1285,9 @@ int reset_slave(THD *thd, Master_info* m
     goto err;
   }
 
-  /* Clear master's log coordinates */
-  init_master_log_pos(mi);
+  /* Clear master's log coordinates and associated information */
+  mi->clear_in_memory_info(thd->lex->reset_slave_info.all);
+
   /*
      Reset errors (the idea is that we forget about the
      old master).

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-07-03 23:48:19 +0000
+++ b/sql/sql_yacc.yy	2011-07-18 17:18:03 +0000
@@ -11337,10 +11337,16 @@ reset_options:
 
 reset_option:
           SLAVE               { Lex->type|= REFRESH_SLAVE; }
+          slave_reset_options { }
         | MASTER_SYM          { Lex->type|= REFRESH_MASTER; }
         | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
         ;
 
+slave_reset_options:
+          /* empty */ { Lex->reset_slave_info.all= false; }
+        | ALL         { Lex->reset_slave_info.all= true; }
+        ;
+
 purge:
           PURGE
           {

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	2011-06-23 12:57:25 +0000
+++ b/storage/innobase/buf/buf0buf.c	2011-07-19 14:54:59 +0000
@@ -400,6 +400,7 @@ buf_get_total_stat(
 		tot_stat->n_pages_read += buf_stat->n_pages_read;
 		tot_stat->n_pages_written += buf_stat->n_pages_written;
 		tot_stat->n_pages_created += buf_stat->n_pages_created;
+		tot_stat->n_ra_pages_read_rnd += buf_stat->n_ra_pages_read_rnd;
 		tot_stat->n_ra_pages_read += buf_stat->n_ra_pages_read;
 		tot_stat->n_ra_pages_evicted += buf_stat->n_ra_pages_evicted;
 		tot_stat->n_pages_made_young += buf_stat->n_pages_made_young;
@@ -2358,6 +2359,9 @@ loop2:
 		}
 
 		if (buf_read_page(space, zip_size, offset)) {
+			buf_read_ahead_random(space, zip_size, offset,
+					      ibuf_inside(mtr));
+
 			retries = 0;
 		} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
 			++retries;
@@ -4381,6 +4385,7 @@ buf_stats_aggregate_pool_info(
 	total_info->n_pages_created += pool_info->n_pages_created;
 	total_info->n_pages_written += pool_info->n_pages_written;
 	total_info->n_page_gets += pool_info->n_page_gets;
+	total_info->n_ra_pages_read_rnd += pool_info->n_ra_pages_read_rnd;
 	total_info->n_ra_pages_read += pool_info->n_ra_pages_read;
 	total_info->n_ra_pages_evicted += pool_info->n_ra_pages_evicted;
 	total_info->page_made_young_rate += pool_info->page_made_young_rate;
@@ -4393,6 +4398,7 @@ buf_stats_aggregate_pool_info(
 	total_info->page_read_delta += pool_info->page_read_delta;
 	total_info->young_making_delta += pool_info->young_making_delta;
 	total_info->not_young_making_delta += pool_info->not_young_making_delta;
+	total_info->pages_readahead_rnd_rate += pool_info->pages_readahead_rnd_rate;
 	total_info->pages_readahead_rate += pool_info->pages_readahead_rate;
 	total_info->pages_evicted_rate += pool_info->pages_evicted_rate;
 	total_info->unzip_lru_len += pool_info->unzip_lru_len;
@@ -4470,6 +4476,7 @@ buf_stats_get_pool_info(
 
 	pool_info->n_page_gets = buf_pool->stat.n_page_gets;
 
+	pool_info->n_ra_pages_read_rnd = buf_pool->stat.n_ra_pages_read_rnd;
 	pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read;
 
 	pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
@@ -4509,6 +4516,10 @@ buf_stats_get_pool_info(
 			buf_pool->stat.n_pages_not_made_young
 			- buf_pool->old_stat.n_pages_not_made_young;
 	}
+	pool_info->pages_readahead_rnd_rate =
+		 (buf_pool->stat.n_ra_pages_read_rnd
+		  - buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed;
+
 
 	pool_info->pages_readahead_rate =
 		 (buf_pool->stat.n_ra_pages_read
@@ -4594,9 +4605,12 @@ buf_print_io_instance(
 
 	/* Statistics about read ahead algorithm */
 	fprintf(file, "Pages read ahead %.2f/s,"
-		" evicted without access %.2f/s\n",
+		" evicted without access %.2f/s,"
+		" Random read ahead %.2f/s\n",
+
 		pool_info->pages_readahead_rate,
-		pool_info->pages_evicted_rate);
+		pool_info->pages_evicted_rate,
+		pool_info->pages_readahead_rnd_rate);
 
 	/* Print some values to help us with visualizing what is
 	happening with LRU eviction. */

=== modified file 'storage/innobase/buf/buf0rea.c'
--- a/storage/innobase/buf/buf0rea.c	2011-04-15 13:46:11 +0000
+++ b/storage/innobase/buf/buf0rea.c	2011-07-19 14:54:59 +0000
@@ -40,8 +40,10 @@ Created 11/5/1995 Heikki Tuuri
 #include "mysql/plugin.h"
 #include "mysql/service_thd_wait.h"
 
-/** The linear read-ahead area size */
-#define	BUF_READ_AHEAD_LINEAR_AREA	BUF_READ_AHEAD_AREA
+/** There must be at least this many pages in buf_pool in the area to start
+a random read-ahead */
+#define BUF_READ_AHEAD_RANDOM_THRESHOLD(b)	\
+				(5 + BUF_READ_AHEAD_AREA(b) / 8)
 
 /** If there are buf_pool->curr_size per the number below pending reads, then
 read-ahead is not done: this is to prevent flooding the buffer pool with
@@ -162,6 +164,171 @@ buf_read_page_low(
 }
 
 /********************************************************************//**
+Applies a random read-ahead in buf_pool if there are at least a threshold
+value of accessed pages from the random read-ahead area. Does not read any
+page, not even the one at the position (space, offset), if the read-ahead
+mechanism is not activated. NOTE 1: the calling thread may own latches on
+pages: to avoid deadlocks this function must be written such that it cannot
+end up waiting for these latches! NOTE 2: the calling thread must want
+access to the page given: this rule is set to prevent unintended read-aheads
+performed by ibuf routines, a situation which could result in a deadlock if
+the OS does not support asynchronous i/o.
+@return number of page read requests issued; NOTE that if we read ibuf
+pages, it may happen that the page at the given page number does not
+get read even if we return a positive value!
+@return	number of page read requests issued */
+UNIV_INTERN
+ulint
+buf_read_ahead_random(
+/*==================*/
+	ulint	space,		/*!< in: space id */
+	ulint	zip_size,	/*!< in: compressed page size in bytes,
+				or 0 */
+	ulint	offset,		/*!< in: page number of a page which
+				the current thread wants to access */
+	ibool	inside_ibuf)	/*!< in: TRUE if we are inside ibuf
+				routine */
+{
+	buf_pool_t*	buf_pool = buf_pool_get(space, offset);
+	ib_int64_t	tablespace_version;
+	ulint		recent_blocks	= 0;
+	ulint		ibuf_mode;
+	ulint		count;
+	ulint		low, high;
+	ulint		err;
+	ulint		i;
+	const ulint	buf_read_ahead_random_area
+				= BUF_READ_AHEAD_AREA(buf_pool);
+
+	if (!srv_random_read_ahead) {
+		/* Disabled by user */
+		return(0);
+	}
+
+	if (srv_startup_is_before_trx_rollback_phase) {
+		/* No read-ahead to avoid thread deadlocks */
+		return(0);
+	}
+
+	if (ibuf_bitmap_page(zip_size, offset)
+	    || trx_sys_hdr_page(space, offset)) {
+
+		/* If it is an ibuf bitmap page or trx sys hdr, we do
+		no read-ahead, as that could break the ibuf page access
+		order */
+
+		return(0);
+	}
+
+	/* Remember the tablespace version before we ask te tablespace size
+	below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
+	do not try to read outside the bounds of the tablespace! */
+
+	tablespace_version = fil_space_get_version(space);
+
+	low  = (offset / buf_read_ahead_random_area)
+		* buf_read_ahead_random_area;
+	high = (offset / buf_read_ahead_random_area + 1)
+		* buf_read_ahead_random_area;
+	if (high > fil_space_get_size(space)) {
+
+		high = fil_space_get_size(space);
+	}
+
+	buf_pool_mutex_enter(buf_pool);
+
+	if (buf_pool->n_pend_reads
+	    > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
+		buf_pool_mutex_exit(buf_pool);
+
+		return(0);
+	}
+
+	/* Count how many blocks in the area have been recently accessed,
+	that is, reside near the start of the LRU list. */
+
+	for (i = low; i < high; i++) {
+		const buf_page_t* bpage =
+			buf_page_hash_get(buf_pool, space, i);
+
+		if (bpage
+		    && buf_page_is_accessed(bpage)
+		    && buf_page_peek_if_young(bpage)) {
+
+			recent_blocks++;
+
+			if (recent_blocks
+			    >= BUF_READ_AHEAD_RANDOM_THRESHOLD(buf_pool)) {
+
+				buf_pool_mutex_exit(buf_pool);
+				goto read_ahead;
+			}
+		}
+	}
+
+	buf_pool_mutex_exit(buf_pool);
+	/* Do nothing */
+	return(0);
+
+read_ahead:
+	/* Read all the suitable blocks within the area */
+
+	if (inside_ibuf) {
+		ibuf_mode = BUF_READ_IBUF_PAGES_ONLY;
+	} else {
+		ibuf_mode = BUF_READ_ANY_PAGE;
+	}
+
+	count = 0;
+
+	for (i = low; i < high; i++) {
+		/* It is only sensible to do read-ahead in the non-sync aio
+		mode: hence FALSE as the first parameter */
+
+		if (!ibuf_bitmap_page(zip_size, i)) {
+			count += buf_read_page_low(
+				&err, FALSE,
+				ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+				space, zip_size, FALSE,
+				tablespace_version, i);
+			if (err == DB_TABLESPACE_DELETED) {
+				ut_print_timestamp(stderr);
+				fprintf(stderr,
+					"  InnoDB: Warning: in random"
+					" readahead trying to access\n"
+					"InnoDB: tablespace %lu page %lu,\n"
+					"InnoDB: but the tablespace does not"
+					" exist or is just being dropped.\n",
+					(ulong) space, (ulong) i);
+			}
+		}
+	}
+
+	/* In simulated aio we wake the aio handler threads only after
+	queuing all aio requests, in native aio the following call does
+	nothing: */
+
+	os_aio_simulated_wake_handler_threads();
+
+#ifdef UNIV_DEBUG
+	if (buf_debug_prints && (count > 0)) {
+		fprintf(stderr,
+			"Random read-ahead space %lu offset %lu pages %lu\n",
+			(ulong) space, (ulong) offset,
+			(ulong) count);
+	}
+#endif /* UNIV_DEBUG */
+
+	/* Read ahead is considered one I/O operation for the purpose of
+	LRU policy decision. */
+	buf_LRU_stat_inc_io();
+
+	buf_pool->stat.n_ra_pages_read_rnd += count;
+	srv_buf_pool_reads += count;
+	return(count);
+}
+
+/********************************************************************//**
 High-level function which reads a page asynchronously from a file to the
 buffer buf_pool if it is not already there. Sets the io_fix flag and sets
 an exclusive lock on the buffer frame. The flag is cleared and the x-lock
@@ -257,7 +424,7 @@ buf_read_ahead_linear(
 	ulint		err;
 	ulint		i;
 	const ulint	buf_read_ahead_linear_area
-		= BUF_READ_AHEAD_LINEAR_AREA(buf_pool);
+		= BUF_READ_AHEAD_AREA(buf_pool);
 	ulint		threshold;
 
 	if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-06-28 12:28:21 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-07-19 14:54:59 +0000
@@ -614,6 +614,8 @@ static SHOW_VAR innodb_status_variables[
   (char*) &export_vars.innodb_buffer_pool_pages_misc,	  SHOW_LONG},
   {"buffer_pool_pages_total",
   (char*) &export_vars.innodb_buffer_pool_pages_total,	  SHOW_LONG},
+  {"buffer_pool_read_ahead_rnd",
+  (char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG},
   {"buffer_pool_read_ahead",
   (char*) &export_vars.innodb_buffer_pool_read_ahead,	  SHOW_LONG},
   {"buffer_pool_read_ahead_evicted",
@@ -11317,6 +11319,11 @@ static MYSQL_SYSVAR_UINT(change_bufferin
   NULL, NULL, 0, 0, 1, 0);
 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
 
+static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,
+  PLUGIN_VAR_NOCMDARG,
+  "Whether to use read ahead for random access within an extent.",
+  NULL, NULL, FALSE);
+
 static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
   PLUGIN_VAR_RQCMDARG,
   "Number of pages that must be accessed sequentially for InnoDB to "
@@ -11385,6 +11392,7 @@ static struct st_mysql_sys_var* innobase
 #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
   MYSQL_SYSVAR(change_buffering_debug),
 #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+  MYSQL_SYSVAR(random_read_ahead),
   MYSQL_SYSVAR(read_ahead_threshold),
   MYSQL_SYSVAR(io_capacity),
   MYSQL_SYSVAR(purge_threads),

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	2011-06-23 12:57:25 +0000
+++ b/storage/innobase/include/buf0buf.h	2011-07-19 14:54:59 +0000
@@ -147,6 +147,8 @@ struct buf_pool_info_struct{
 	ulint	n_pages_created;	/*!< buf_pool->n_pages_created */
 	ulint	n_pages_written;	/*!< buf_pool->n_pages_written */
 	ulint	n_page_gets;		/*!< buf_pool->n_page_gets */
+	ulint	n_ra_pages_read_rnd;	/*!< buf_pool->n_ra_pages_read_rnd,
+					number of pages readahead */
 	ulint	n_ra_pages_read;	/*!< buf_pool->n_ra_pages_read, number
 					of pages readahead */
 	ulint	n_ra_pages_evicted;	/*!< buf_pool->n_ra_pages_evicted,
@@ -171,6 +173,8 @@ struct buf_pool_info_struct{
 					last printout */
 
 	/* Statistics about read ahead algorithm.  */
+	double	pages_readahead_rnd_rate;/*!< random readahead rate in pages per
+					second */
 	double	pages_readahead_rate;	/*!< readahead rate in pages per
 					second */
 	double	pages_evicted_rate;	/*!< rate of readahead page evicted
@@ -542,6 +546,18 @@ buf_block_get_freed_page_clock(
 	__attribute__((pure));
 
 /********************************************************************//**
+Tells if a block is still close enough to the MRU end of the LRU list
+meaning that it is not in danger of getting evicted and also implying
+that it has been accessed recently.
+Note that this is for heuristics only and does not reserve buffer pool
+mutex.
+@return	TRUE if block is close to MRU end of LRU */
+UNIV_INLINE
+ibool
+buf_page_peek_if_young(
+/*===================*/
+	const buf_page_t*	bpage);	/*!< in: block */
+/********************************************************************//**
 Recommends a move of a block to the start of the LRU list if there is danger
 of dropping from the buffer pool. NOTE: does not reserve the buffer pool
 mutex.
@@ -1605,6 +1621,8 @@ struct buf_pool_stat_struct{
 	ulint	n_pages_written;/*!< number write operations */
 	ulint	n_pages_created;/*!< number of pages created
 				in the pool with no read */
+	ulint	n_ra_pages_read_rnd;/*!< number of pages read in
+				as part of random read ahead */
 	ulint	n_ra_pages_read;/*!< number of pages read in
 				as part of read ahead */
 	ulint	n_ra_pages_evicted;/*!< number of read ahead
@@ -1744,7 +1762,7 @@ struct buf_pool_struct{
 	UT_LIST_BASE_NODE_T(buf_page_t) LRU;
 					/*!< base node of the LRU list */
 	buf_page_t*	LRU_old;	/*!< pointer to the about
-					buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
+					LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
 					oldest blocks in the LRU list;
 					NULL if LRU length less than
 					BUF_LRU_OLD_MIN_LEN;

=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic	2011-06-23 12:57:25 +0000
+++ b/storage/innobase/include/buf0buf.ic	2011-07-19 14:54:59 +0000
@@ -125,6 +125,29 @@ buf_block_get_freed_page_clock(
 }
 
 /********************************************************************//**
+Tells if a block is still close enough to the MRU end of the LRU list
+meaning that it is not in danger of getting evicted and also implying
+that it has been accessed recently.
+Note that this is for heuristics only and does not reserve buffer pool
+mutex.
+@return	TRUE if block is close to MRU end of LRU */
+UNIV_INLINE
+ibool
+buf_page_peek_if_young(
+/*===================*/
+	const buf_page_t*	bpage)	/*!< in: block */
+{
+	buf_pool_t*	buf_pool = buf_pool_from_bpage(bpage);
+
+	/* FIXME: bpage->freed_page_clock is 31 bits */
+	return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
+	       < ((ulint) bpage->freed_page_clock
+		  + (buf_pool->curr_size
+		     * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
+		     / (BUF_LRU_OLD_RATIO_DIV * 4))));
+}
+
+/********************************************************************//**
 Recommends a move of a block to the start of the LRU list if there is danger
 of dropping from the buffer pool. NOTE: does not reserve the buffer pool
 mutex.
@@ -154,12 +177,7 @@ buf_page_peek_if_too_old(
 		buf_pool->stat.n_pages_not_made_young++;
 		return(FALSE);
 	} else {
-		/* FIXME: bpage->freed_page_clock is 31 bits */
-		return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
-		       > ((ulint) bpage->freed_page_clock
-			  + (buf_pool->curr_size
-			     * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
-			     / (BUF_LRU_OLD_RATIO_DIV * 4))));
+		return(!buf_page_peek_if_young(bpage));
 	}
 }
 

=== modified file 'storage/innobase/include/buf0lru.h'
--- a/storage/innobase/include/buf0lru.h	2011-06-23 12:57:25 +0000
+++ b/storage/innobase/include/buf0lru.h	2011-07-19 14:54:59 +0000
@@ -184,7 +184,7 @@ buf_LRU_make_block_old(
 /*===================*/
 	buf_page_t*	bpage);	/*!< in: control block */
 /**********************************************************************//**
-Updates buf_LRU_old_ratio.
+Updates buf_pool->LRU_old_ratio.
 @return	updated old_pct */
 UNIV_INTERN
 ulint
@@ -193,7 +193,7 @@ buf_LRU_old_ratio_update(
 	uint	old_pct,/*!< in: Reserve this percentage of
 			the buffer pool for "old" blocks. */
 	ibool	adjust);/*!< in: TRUE=adjust the LRU list;
-			FALSE=just assign buf_LRU_old_ratio
+			FALSE=just assign buf_pool->LRU_old_ratio
 			during the initialization of InnoDB */
 /********************************************************************//**
 Update the historical stats that we are collecting for LRU eviction
@@ -222,18 +222,15 @@ buf_LRU_print(void);
 #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
 
 /** @name Heuristics for detecting index scan @{ */
-/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
-"old" blocks.  Protected by buf_pool->mutex. */
-extern uint	buf_LRU_old_ratio;
-/** The denominator of buf_LRU_old_ratio. */
+/** The denominator of buf_pool->LRU_old_ratio. */
 #define BUF_LRU_OLD_RATIO_DIV	1024
-/** Maximum value of buf_LRU_old_ratio.
+/** Maximum value of buf_pool->LRU_old_ratio.
 @see buf_LRU_old_adjust_len
-@see buf_LRU_old_ratio_update */
+@see buf_pool->LRU_old_ratio_update */
 #define BUF_LRU_OLD_RATIO_MAX	BUF_LRU_OLD_RATIO_DIV
-/** Minimum value of buf_LRU_old_ratio.
+/** Minimum value of buf_pool->LRU_old_ratio.
 @see buf_LRU_old_adjust_len
-@see buf_LRU_old_ratio_update
+@see buf_pool->LRU_old_ratio_update
 The minimum must exceed
 (BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */
 #define BUF_LRU_OLD_RATIO_MIN	51

=== modified file 'storage/innobase/include/buf0rea.h'
--- a/storage/innobase/include/buf0rea.h	2011-04-15 13:58:30 +0000
+++ b/storage/innobase/include/buf0rea.h	2011-07-19 14:54:59 +0000
@@ -43,6 +43,31 @@ buf_read_page(
 	ulint	zip_size,/*!< in: compressed page size in bytes, or 0 */
 	ulint	offset);/*!< in: page number */
 /********************************************************************//**
+Applies a random read-ahead in buf_pool if there are at least a threshold
+value of accessed pages from the random read-ahead area. Does not read any
+page, not even the one at the position (space, offset), if the read-ahead
+mechanism is not activated. NOTE 1: the calling thread may own latches on
+pages: to avoid deadlocks this function must be written such that it cannot
+end up waiting for these latches! NOTE 2: the calling thread must want
+access to the page given: this rule is set to prevent unintended read-aheads
+performed by ibuf routines, a situation which could result in a deadlock if
+the OS does not support asynchronous i/o.
+@return number of page read requests issued; NOTE that if we read ibuf
+pages, it may happen that the page at the given page number does not
+get read even if we return a positive value!
+@return	number of page read requests issued */
+UNIV_INTERN
+ulint
+buf_read_ahead_random(
+/*==================*/
+	ulint	space,		/*!< in: space id */
+	ulint	zip_size,	/*!< in: compressed page size in bytes,
+				or 0 */
+	ulint	offset,		/*!< in: page number of a page which
+				the current thread wants to access */
+	ibool	inside_ibuf);	/*!< in: TRUE if we are inside ibuf
+				routine */
+/********************************************************************//**
 Applies linear read-ahead if in the buf_pool the page is a border page of
 a linear read-ahead area and all the pages in the area have been accessed.
 Does not read any page if the read-ahead mechanism is not activated. Note

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	2011-04-26 17:55:52 +0000
+++ b/storage/innobase/include/srv0srv.h	2011-07-19 14:54:59 +0000
@@ -158,6 +158,7 @@ extern ulint	srv_mem_pool_size;
 extern ulint	srv_lock_table_size;
 
 extern ulint	srv_n_file_io_threads;
+extern my_bool	srv_random_read_ahead;
 extern ulong	srv_read_ahead_threshold;
 extern ulint	srv_n_read_io_threads;
 extern ulint	srv_n_write_io_threads;
@@ -703,6 +704,7 @@ struct export_var_struct{
 	ulint innodb_buffer_pool_wait_free;	/*!< srv_buf_pool_wait_free */
 	ulint innodb_buffer_pool_pages_flushed;	/*!< srv_buf_pool_flushed */
 	ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
+	ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
 	ulint innodb_buffer_pool_read_ahead;	/*!< srv_read_ahead */
 	ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
 	ulint innodb_dblwr_pages_written;	/*!< srv_dblwr_pages_written */

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2011-05-04 09:08:07 +0000
+++ b/storage/innobase/srv/srv0srv.c	2011-07-19 14:54:59 +0000
@@ -222,6 +222,8 @@ UNIV_INTERN ulint	srv_n_file_io_threads
 UNIV_INTERN ulint	srv_n_read_io_threads	= ULINT_MAX;
 UNIV_INTERN ulint	srv_n_write_io_threads	= ULINT_MAX;
 
+/* Switch to enable random read ahead. */
+UNIV_INTERN my_bool	srv_random_read_ahead	= FALSE;
 /* User settable value of the number of pages that must be present
 in the buffer cache and accessed sequentially for InnoDB to trigger a
 readahead request. */
@@ -2032,6 +2034,8 @@ srv_export_innodb_status(void)
 	export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
 	export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
 	export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
+	export_vars.innodb_buffer_pool_read_ahead_rnd
+		= stat.n_ra_pages_read_rnd;
 	export_vars.innodb_buffer_pool_read_ahead
 		= stat.n_ra_pages_read;
 	export_vars.innodb_buffer_pool_read_ahead_evicted

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	2011-07-03 23:48:19 +0000
+++ b/strings/decimal.c	2011-07-18 07:47:39 +0000
@@ -2182,7 +2182,6 @@ static int do_div_mod(const decimal_t *f
   }
   buf0=to->buf;
   stop0=buf0+intg0+frac0;
-  DBUG_ASSERT(stop0 <= &to->buf[to->len]);
   if (likely(div_mod))
     while (dintg++ < 0 && buf0 < &to->buf[to->len])
     {
@@ -2277,7 +2276,10 @@ static int do_div_mod(const decimal_t *f
       }
     }
     if (likely(div_mod))
+    {
+      DBUG_ASSERT(buf0 < to->buf + to->len);
       *buf0=(dec1)guess;
+    }
     dcarry= *start1;
     start1++;
   }

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2011-07-07 15:27:44 +0000
+++ b/support-files/mysql.spec.sh	2011-07-22 08:34:45 +0000
@@ -1121,6 +1121,7 @@ echo "====="
 # ----------------------------------------------------------------------------
 %files -n MySQL-embedded%{product_suffix}
 %defattr(-, root, root, 0755)
+%attr(755, root, root) %{_bindir}/mysql_embedded
 %attr(644, root, root) %{_libdir}/mysql/libmysqld.a
 %attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a
 
@@ -1130,6 +1131,10 @@ echo "====="
 # merging BK trees)
 ##############################################################################
 %changelog
+* Thu Jul 21 2011 Sunanda Menon <sunanda.menon@stripped>
+
+- Fix bug#12561297: Added the MySQL embedded binary
+
 * Thu Jul 07 2011 Joerg Bruehe <joerg.bruehe@stripped>
 
 - Fix bug#45415: "rpm upgrade recreates test database"

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-mtr branch (bjorn.munch:3229 to 3232) Bjorn Munch22 Jul