List:Commits« Previous MessageNext Message »
From:Anitha Gopi Date:May 27 2011 4:54am
Subject:bzr commit into mysql-trunk branch (anitha.gopi:3118)
View as plain text  
#At file:///home/anitha/mysql/repo/mysql-trunk-mod/ based on revid:anitha.gopi@stripped

 3118 Anitha Gopi	2011-05-27 [merge]
      Automerge : Update local tree

    added:
      mysql-test/suite/binlog/r/binlog_reset_master.result
      mysql-test/suite/binlog/t/binlog_reset_master.test
      mysql-test/suite/rpl/t/rpl_typeconv-master.opt
    modified:
      BUILD/SETUP.sh
      cmake/configure.pl
      cmake/os/WindowsCache.cmake
      include/violite.h
      libmysql/errmsg.c
      mysql-test/include/subquery.inc
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/func_math.result
      mysql-test/r/openssl_1.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_none.result
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/suite/innodb/t/innodb_mysql.test
      mysql-test/t/func_math.test
      sql-common/client.c
      sql/binlog.cc
      sql/item_func.cc
      sql/item_subselect.cc
      sql/mysqld.cc
      sql/sql_acl.cc
      sql/sql_array.h
      sql/sql_base.cc
      sql/sql_parse.cc
      sql/sql_select.cc
      sql/sql_select.h
      storage/innobase/handler/i_s.cc
      storage/innobase/lock/lock0lock.c
      storage/innobase/que/que0que.c
      storage/innobase/srv/srv0start.c
      vio/test-ssl.c
      vio/test-sslclient.c
      vio/test-sslserver.c
      vio/viossl.c
      vio/viosslfactories.c
      vio/viotest-ssl.c
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	2011-05-06 13:21:38 +0000
+++ b/BUILD/SETUP.sh	2011-05-25 10:45:37 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2000, 2007 MySQL AB
+# 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 Library General Public
@@ -250,7 +250,7 @@ gcov_compile_flags="$gcov_compile_flags 
 
 gcov_link_flags="-fprofile-arcs -ftest-coverage"
 
-gcov_configs="--disable-shared"
+gcov_configs="--with-gcov"
 
 # gprof
 

=== modified file 'cmake/configure.pl'
--- a/cmake/configure.pl	2010-11-12 01:40:51 +0000
+++ b/cmake/configure.pl	2011-05-25 10:45:37 +0000
@@ -195,6 +195,11 @@ foreach my $option (@ARGV)
     $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; 
     next;
   }
+  if ($option =~ /with-gcov/)
+  {
+      $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; 
+      next;
+  }
 
   $option = uc($option);
   $option =~ s/-/_/g;

=== modified file 'cmake/os/WindowsCache.cmake'
--- a/cmake/os/WindowsCache.cmake	2011-04-30 05:36:44 +0000
+++ b/cmake/os/WindowsCache.cmake	2011-05-26 08:14:09 +0000
@@ -347,6 +347,7 @@ SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE I
 SET(C_HAS_inline CACHE INTERNAL "")
 SET(C_HAS___inline 1 CACHE INTERNAL "")
 SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
+SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
 SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
 SET(HAVE_CXXABI_H CACHE INTERNAL "")
 SET(HAVE_NDIR_H CACHE INTERNAL "")

=== modified file 'include/violite.h'
--- a/include/violite.h	2011-04-08 10:23:36 +0000
+++ b/include/violite.h	2011-05-19 09:47:43 +0000
@@ -134,13 +134,13 @@ struct st_VioSSLFd
   SSL_CTX *ssl_context;
 };
 
-int sslaccept(struct st_VioSSLFd*, Vio *, long timeout);
-int sslconnect(struct st_VioSSLFd*, Vio *, long timeout);
+int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
+int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
 
 struct st_VioSSLFd
 *new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
 		       const char *ca_file,  const char *ca_path,
-		       const char *cipher);
+		       const char *cipher, enum enum_ssl_init_error* error);
 struct st_VioSSLFd
 *new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
 		      const char *ca_file,const char *ca_path,

=== modified file 'libmysql/errmsg.c'
--- a/libmysql/errmsg.c	2011-03-08 19:14:42 +0000
+++ b/libmysql/errmsg.c	2011-05-26 12:36:57 +0000
@@ -51,7 +51,7 @@ const char *client_errors[]=
   "Error on SHOW SLAVE HOSTS:",
   "Error connecting to slave:",
   "Error connecting to master:",
-  "SSL connection error",
+  "SSL connection error: %-.100s",
   "Malformed packet",
   "This client library is licensed only for use with MySQL servers having '%s' license",
   "Invalid use of null pointer",

=== modified file 'mysql-test/include/subquery.inc'
--- a/mysql-test/include/subquery.inc	2011-05-05 07:41:53 +0000
+++ b/mysql-test/include/subquery.inc	2011-05-26 11:09:57 +0000
@@ -5354,3 +5354,32 @@ CREATE TABLE t(a VARCHAR(245) DEFAULT
 INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
 SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
 DROP TABLE t;
+
+--echo #
+--echo # Bug 11765699 - 58690: !TABLE || (!TABLE->READ_SET || 
+--echo #                BITMAP_IS_SET(TABLE->READ_SET, FIELD_INDEX
+--echo #
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0), (1); 
+
+CREATE TABLE t2(
+  b TEXT, 
+  c INT, 
+  PRIMARY KEY (b(1))
+);
+INSERT INTO t2 VALUES ('a', 2), ('b', 3);
+
+SELECT 1 FROM t1 WHERE a = 
+ (SELECT 1 FROM t2 WHERE b = 
+  (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+   ORDER BY b
+ );
+
+SELECT 1 FROM t1 WHERE a = 
+ (SELECT 1 FROM t2 WHERE b = 
+  (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+   GROUP BY b
+ );
+
+DROP TABLE t1, t2;

=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl	2011-04-07 08:39:10 +0000
+++ b/mysql-test/lib/mtr_misc.pl	2011-05-25 10:45:37 +0000
@@ -31,6 +31,7 @@ sub mtr_script_exists(@);
 sub mtr_file_exists(@);
 sub mtr_exe_exists(@);
 sub mtr_exe_maybe_exists(@);
+sub mtr_compress_file($);
 sub mtr_milli_sleep($);
 sub start_timer($);
 sub has_expired($);
@@ -199,6 +200,40 @@ sub mtr_exe_exists (@) {
   }
 }
 
+#
+# Try to compress file using tools that might be available.
+# If zip/gzip is not available, just silently ignore.
+#
+
+sub mtr_compress_file ($) {
+  my ($filename)= @_;
+
+  mtr_error ("File to compress not found: $filename") unless -f $filename;
+
+  my $did_compress= 0;
+
+  if (IS_WINDOWS)
+  {
+    # Capture stderr
+    my $ziperr= `zip $filename.zip $filename 2>&1`;
+    if ($?) {
+      print "$ziperr\n" if $ziperr !~ /recognized as an internal or external/;
+    } else {
+      unlink($filename);
+      $did_compress=1;
+    }
+  }
+  else
+  {
+    my $gzres= system("gzip $filename");
+    $did_compress= ! $gzres;
+    if ($gzres && $gzres != -1) {
+      mtr_error ("Error: have gzip but it fails to compress core file");
+    }
+  }
+  mtr_print("Compressed file $filename") if $did_compress;
+}
+
 
 sub mtr_milli_sleep ($) {
   die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-05-12 13:49:50 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-05-25 14:48:51 +0000
@@ -264,7 +264,6 @@ my $opt_shutdown_timeout= $ENV{MTR_SHUTD
 my $opt_start_timeout   = $ENV{MTR_START_TIMEOUT}    || 180; # seconds
 
 sub suite_timeout { return $opt_suite_timeout * 60; };
-sub check_timeout { return $opt_testcase_timeout * 6; };
 
 my $opt_wait_all;
 my $opt_user_args;
@@ -300,6 +299,8 @@ sub testcase_timeout ($) {
   return $opt_testcase_timeout * 60;
 }
 
+sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
+
 our $opt_warnings= 1;
 
 our $opt_include_ndbcluster= 0;
@@ -658,6 +659,8 @@ sub run_test_server ($$$) {
 			     mtr_report(" - deleting it, already saved",
 					"$opt_max_save_core");
 			     unlink("$core_file");
+			   } else {
+			     mtr_compress_file($core_file) unless @opt_cases;
 			   }
 			   ++$num_saved_cores;
 			 }
@@ -3415,7 +3418,7 @@ sub check_testcase($$)
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result;
@@ -3487,7 +3490,7 @@ test case was executed:\n";
     }
     elsif ( $proc->{timeout} ) {
       $tinfo->{comment}.= "Timeout for 'check-testcase' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
       $result= 4;
     }
     else {
@@ -3577,7 +3580,7 @@ sub run_on_all($$)
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result;
@@ -3608,7 +3611,7 @@ sub run_on_all($$)
     }
     elsif ($proc->{timeout}) {
       $tinfo->{comment}.= "Timeout for '$run' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
     }
     else {
       # Unknown process returned, most likley a crash, abort everything
@@ -4333,7 +4336,7 @@ sub check_warnings ($) {
   # Return immediately if no check proceess was started
   return 0 unless ( keys %started );
 
-  my $timeout= start_timer(check_timeout());
+  my $timeout= start_timer(check_timeout($tinfo));
 
   while (1){
     my $result= 0;
@@ -4385,7 +4388,7 @@ sub check_warnings ($) {
     }
     elsif ( $proc->{timeout} ) {
       $tinfo->{comment}.= "Timeout for 'check warnings' expired after "
-	.check_timeout()." seconds";
+	.check_timeout($tinfo)." seconds";
       $result= 4;
     }
     else {

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2011-04-20 07:56:57 +0000
+++ b/mysql-test/r/func_math.result	2011-05-26 10:13:07 +0000
@@ -543,6 +543,12 @@ ROUND(LEAST(15, -4939092, 0.2704), STDDE
 -4939092.0000
 Warnings:
 Warning	1292	Truncated incorrect DOUBLE value: 'a'
+#
+# Bug#12392636  ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
+#
+SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
+SUM(DISTINCT (TRUNCATE((.1), NULL)))
+NULL
 End of 5.1 tests
 #
 # Bug #8433: Overflow must be an error

=== modified file 'mysql-test/r/openssl_1.result'
--- a/mysql-test/r/openssl_1.result	2010-01-29 14:54:27 +0000
+++ b/mysql-test/r/openssl_1.result	2011-05-19 09:47:43 +0000
@@ -44,13 +44,13 @@ ERROR 42000: DELETE command denied to us
 drop user ssl_user1@localhost, ssl_user2@localhost,
 ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
 drop table t1;
-mysqltest: Could not open connection 'default': 2026 SSL connection error
-mysqltest: Could not open connection 'default': 2026 SSL connection error
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL connection error: ASN: bad other signature confirmation
 SSL error: Unable to get private key from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get private key
 SSL error: Unable to get certificate from ''
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get certificate
 SHOW STATUS LIKE 'Ssl_cipher';
 Variable_name	Value
 Ssl_cipher	DHE-RSA-AES256-SHA
@@ -83,7 +83,7 @@ Ssl_cipher	AES128-SHA
 SHOW STATUS LIKE 'Ssl_cipher';
 Variable_name	Value
 Ssl_cipher	AES128-SHA
-mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error: SSL_CTX_new failed
 CREATE TABLE t1(a int);
 INSERT INTO t1 VALUES (1), (2);
 
@@ -189,7 +189,7 @@ UNLOCK TABLES;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 SSL error: Unable to get private key from 'MYSQL_TEST_DIR/std_data/client-cert.pem'
-mysqldump: Got error: 2026: SSL connection error when trying to connect
+mysqldump: Got error: 2026: SSL connection error: Unable to get private key when trying to connect
 DROP TABLE t1;
 Variable_name	Value
 Ssl_cipher	DHE-RSA-AES256-SHA

=== modified file 'mysql-test/r/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result	2011-05-05 07:41:53 +0000
+++ b/mysql-test/r/subquery_nomat_nosj.result	2011-05-26 11:09:57 +0000
@@ -6507,4 +6507,29 @@ SELECT * FROM (SELECT default(a) FROM t 
 default(a)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 DROP TABLE t;
+#
+# Bug 11765699 - 58690: !TABLE || (!TABLE->READ_SET || 
+#                BITMAP_IS_SET(TABLE->READ_SET, FIELD_INDEX
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0), (1);
+CREATE TABLE t2(
+b TEXT, 
+c INT, 
+PRIMARY KEY (b(1))
+);
+INSERT INTO t2 VALUES ('a', 2), ('b', 3);
+SELECT 1 FROM t1 WHERE a = 
+(SELECT 1 FROM t2 WHERE b = 
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+ORDER BY b
+);
+1
+SELECT 1 FROM t1 WHERE a = 
+(SELECT 1 FROM t2 WHERE b = 
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+GROUP BY b
+);
+1
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_none.result'
--- a/mysql-test/r/subquery_none.result	2011-05-05 07:41:53 +0000
+++ b/mysql-test/r/subquery_none.result	2011-05-26 11:09:57 +0000
@@ -6506,4 +6506,29 @@ SELECT * FROM (SELECT default(a) FROM t 
 default(a)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 DROP TABLE t;
+#
+# Bug 11765699 - 58690: !TABLE || (!TABLE->READ_SET || 
+#                BITMAP_IS_SET(TABLE->READ_SET, FIELD_INDEX
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0), (1);
+CREATE TABLE t2(
+b TEXT, 
+c INT, 
+PRIMARY KEY (b(1))
+);
+INSERT INTO t2 VALUES ('a', 2), ('b', 3);
+SELECT 1 FROM t1 WHERE a = 
+(SELECT 1 FROM t2 WHERE b = 
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+ORDER BY b
+);
+1
+SELECT 1 FROM t1 WHERE a = 
+(SELECT 1 FROM t2 WHERE b = 
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+GROUP BY b
+);
+1
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== added file 'mysql-test/suite/binlog/r/binlog_reset_master.result'
--- a/mysql-test/suite/binlog/r/binlog_reset_master.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_reset_master.result	2011-05-26 10:50:43 +0000
@@ -0,0 +1 @@
+RESET MASTER;

=== added file 'mysql-test/suite/binlog/t/binlog_reset_master.test'
--- a/mysql-test/suite/binlog/t/binlog_reset_master.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_reset_master.test	2011-05-26 10:50:43 +0000
@@ -0,0 +1,26 @@
+# ==== Purpose ====
+#
+# Test bugs in RESET MASTER.
+
+--source include/have_debug.inc
+--source include/have_log_bin.inc
+
+#######################################################################
+# BUG#12574820: binlog.binlog_tmp_table timing out in daily and weekly trunk run
+# Problem: MYSQL_BIN_LOG::reset_logs acquired LOCK_thread_count and
+# LOCK_log in the wrong order. This could cause a deadlock when
+# RESET MASTER was run concurrently with a disconnecting thread.
+#######################################################################
+
+# We use sleep, not debug_sync, because the sync point needs to be in
+# the thread shut down code after the debug sync facility has been
+# shut down.
+--let $write_var= SET DEBUG="+d,sleep_after_lock_thread_count_before_delete_thd"; CREATE TEMPORARY TABLE test.t1 (a INT);
+--let $write_to_file= GENERATE
+--disable_query_log
+--source include/write_var_to_file.inc
+--enable_query_log
+
+--exec $MYSQL < $write_to_file
+RESET MASTER;
+--remove_file $write_to_file

=== modified file 'mysql-test/suite/innodb/r/innodb_mysql.result'
--- a/mysql-test/suite/innodb/r/innodb_mysql.result	2011-05-19 12:43:26 +0000
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result	2011-05-26 16:23:52 +0000
@@ -2690,7 +2690,6 @@ COUNT(*)
 1537
 SET SESSION sort_buffer_size = DEFAULT;
 DROP TABLE t1;
-End of 5.1 tests
 #
 # Test for bug #39932 "create table fails if column for FK is in different
 #                      case than in corr index".
@@ -2712,6 +2711,23 @@ t2	CREATE TABLE `t2` (
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
 drop table t2, t1;
 #
+# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
+#                           UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
+#
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t1 READ;
+# Even though temporary table was locked for READ we
+# still allow writes to it to be compatible with MyISAM.
+# This is possible since due to fact that temporary tables
+# are specific to connection and therefore locking for them
+# is irrelevant.
+UPDATE t1 SET c = 5;
+UNLOCK TABLES;
+DROP TEMPORARY TABLE t1;
+End of 5.1 tests
+#
 # Bug#49604 "6.0 processing compound WHERE clause incorrectly 
 #            with Innodb - extra rows"
 #

=== modified file 'mysql-test/suite/innodb/t/innodb_mysql.test'
--- a/mysql-test/suite/innodb/t/innodb_mysql.test	2011-05-19 12:43:26 +0000
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test	2011-05-26 16:23:52 +0000
@@ -830,8 +830,6 @@ SET SESSION sort_buffer_size = DEFAULT;
 
 DROP TABLE t1;
 
---echo End of 5.1 tests
-
 
 --echo #
 --echo # Test for bug #39932 "create table fails if column for FK is in different
@@ -852,6 +850,28 @@ drop table t2, t1;
 
 
 --echo #
+--echo # Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
+--echo #                           UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t1 READ;
+--echo # Even though temporary table was locked for READ we
+--echo # still allow writes to it to be compatible with MyISAM.
+--echo # This is possible since due to fact that temporary tables
+--echo # are specific to connection and therefore locking for them
+--echo # is irrelevant.
+UPDATE t1 SET c = 5;
+UNLOCK TABLES;
+DROP TEMPORARY TABLE t1;
+
+--echo End of 5.1 tests
+
+
+--echo #
 --echo # Bug#49604 "6.0 processing compound WHERE clause incorrectly 
 --echo #            with Innodb - extra rows"
 --echo #

=== added file 'mysql-test/suite/rpl/t/rpl_typeconv-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_typeconv-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_typeconv-master.opt	2011-05-25 14:39:39 +0000
@@ -0,0 +1 @@
+--testcase-timeout=40

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2011-04-20 07:56:57 +0000
+++ b/mysql-test/t/func_math.test	2011-05-26 10:13:07 +0000
@@ -370,6 +370,12 @@ DROP TABLE t1;
 
 SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
 
+--echo #
+--echo # Bug#12392636  ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
+--echo #
+
+SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2011-04-29 21:53:46 +0000
+++ b/sql-common/client.c	2011-05-26 12:36:57 +0000
@@ -1844,6 +1844,8 @@ mysql_get_ssl_cipher(MYSQL *mysql __attr
   ssl_verify_server_cert()
     vio              pointer to a SSL connected vio
     server_hostname  name of the server that we connected to
+    errptr           if we fail, we'll return (a pointer to a string
+                     describing) the reason here
 
   RETURN VALUES
    0 Success
@@ -1853,7 +1855,7 @@ mysql_get_ssl_cipher(MYSQL *mysql __attr
 
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
 
-static int ssl_verify_server_cert(Vio *vio, const char* server_hostname)
+static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const char **errptr)
 {
   SSL *ssl;
   X509 *server_cert;
@@ -1864,19 +1866,19 @@ static int ssl_verify_server_cert(Vio *v
 
   if (!(ssl= (SSL*)vio->ssl_arg))
   {
-    DBUG_PRINT("error", ("No SSL pointer found"));
+    *errptr= "No SSL pointer found";
     DBUG_RETURN(1);
   }
 
   if (!server_hostname)
   {
-    DBUG_PRINT("error", ("No server hostname supplied"));
+    *errptr= "No server hostname supplied";
     DBUG_RETURN(1);
   }
 
   if (!(server_cert= SSL_get_peer_certificate(ssl)))
   {
-    DBUG_PRINT("error", ("Could not get server certificate"));
+    *errptr= "Could not get server certificate";
     DBUG_RETURN(1);
   }
 
@@ -1905,7 +1907,7 @@ static int ssl_verify_server_cert(Vio *v
       DBUG_RETURN(0);
     }
   }
-  DBUG_PRINT("error", ("SSL certificate validation failure"));
+  *errptr= "SSL certificate validation failure";
   DBUG_RETURN(1);
 }
 
@@ -2511,6 +2513,9 @@ static int send_client_reply_packet(MCPV
     /* Do the SSL layering. */
     struct st_mysql_options *options= &mysql->options;
     struct st_VioSSLFd *ssl_fd;
+    enum enum_ssl_init_error ssl_init_error;
+    const char *cert_error;
+    unsigned long ssl_error;
 
     /*
       Send mysql->client_flag, max_packet_size - unencrypted otherwise
@@ -2530,9 +2535,11 @@ static int send_client_reply_packet(MCPV
                                         options->ssl_cert,
                                         options->ssl_ca,
                                         options->ssl_capath,
-                                        options->ssl_cipher)))
+                                        options->ssl_cipher,
+                                        &ssl_init_error)))
     {
-      set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+                               ER(CR_SSL_CONNECTION_ERROR), sslGetErrString(ssl_init_error));
       goto error;
     }
     mysql->connector_fd= (unsigned char *) ssl_fd;
@@ -2540,18 +2547,24 @@ static int send_client_reply_packet(MCPV
     /* Connect to the server */
     DBUG_PRINT("info", ("IO layer change in progress..."));
     if (sslconnect(ssl_fd, net->vio,
-                   (long) (mysql->options.connect_timeout)))
+                   (long) (mysql->options.connect_timeout), &ssl_error))
     {    
-      set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
+      char buf[512];
+      ERR_error_string_n(ssl_error, buf, 512);
+      buf[511]= 0;
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+                               ER(CR_SSL_CONNECTION_ERROR),
+                               buf);
       goto error;
     }    
     DBUG_PRINT("info", ("IO layer change done!"));
 
     /* Verify server cert */
     if ((mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) &&
-        ssl_verify_server_cert(net->vio, mysql->host))
+        ssl_verify_server_cert(net->vio, mysql->host, &cert_error))
     {
-      set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+                               ER(CR_SSL_CONNECTION_ERROR), cert_error);
       goto error;
     }
   }

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2011-05-12 17:29:19 +0000
+++ b/sql/binlog.cc	2011-05-26 11:18:45 +0000
@@ -2315,12 +2315,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
   DBUG_ENTER("reset_logs");
 
   ha_reset_logs(thd);
-  /*
-    We need to get both locks to be sure that no one is trying to
-    write to the index log file.
-  */
-  mysql_mutex_lock(&LOCK_log);
-  mysql_mutex_lock(&LOCK_index);
 
   /*
     The following mutex is needed to ensure that no threads call
@@ -2330,6 +2324,13 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
   */
   mysql_mutex_lock(&LOCK_thread_count);
 
+  /*
+    We need to get both locks to be sure that no one is trying to
+    write to the index log file.
+  */
+  mysql_mutex_lock(&LOCK_log);
+  mysql_mutex_lock(&LOCK_index);
+
   /* Save variables so that we can reopen the log */
   save_name=name;
   name=0;					// Protect against free

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-05-21 09:31:19 +0000
+++ b/sql/item_func.cc	2011-05-26 10:13:07 +0000
@@ -2273,6 +2273,9 @@ void Item_func_round::fix_length_and_dec
   }
 
   val1= args[1]->val_int();
+  if ((null_value= args[1]->is_null()))
+    return;
+
   val1_unsigned= args[1]->unsigned_flag;
   if (val1 < 0)
     decimals_to_set= val1_unsigned ? INT_MAX : 0;

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-04-06 11:13:33 +0000
+++ b/sql/item_subselect.cc	2011-05-24 09:36:11 +0000
@@ -3181,23 +3181,24 @@ bool subselect_hash_sj_engine::setup(Lis
     - here we initialize only those members that are used by
       subselect_uniquesubquery_engine, so these objects are incomplete.
   */ 
-  if (!(tab= new (thd->mem_root) JOIN_TAB))
+  JOIN_TAB * const tmp_tab= new (thd->mem_root) JOIN_TAB;
+  if (tmp_tab == NULL)
     DBUG_RETURN(TRUE);
-  tab->table= tmp_table;
-  tab->ref.key= 0; /* The only temp table index. */
-  tab->ref.key_length= tmp_key->key_length;
-  if (!(tab->ref.key_buff=
+  tmp_tab->table= tmp_table;
+  tmp_tab->ref.key= 0; /* The only temp table index. */
+  tmp_tab->ref.key_length= tmp_key->key_length;
+  if (!(tmp_tab->ref.key_buff=
         (uchar*) thd->calloc(ALIGN_SIZE(tmp_key->key_length) * 2)) ||
-      !(tab->ref.key_copy=
+      !(tmp_tab->ref.key_copy=
         (store_key**) thd->alloc((sizeof(store_key*) *
                                   (tmp_key_parts + 1)))) ||
-      !(tab->ref.items=
+      !(tmp_tab->ref.items=
         (Item**) thd->alloc(sizeof(Item*) * tmp_key_parts)))
     DBUG_RETURN(TRUE);
 
   KEY_PART_INFO *cur_key_part= tmp_key->key_part;
-  store_key **ref_key= tab->ref.key_copy;
-  uchar *cur_ref_buff= tab->ref.key_buff;
+  store_key **ref_key= tmp_tab->ref.key_copy;
+  uchar *cur_ref_buff= tmp_tab->ref.key_buff;
 
   /*
     Create an artificial condition to post-filter those rows matched by index
@@ -3235,10 +3236,10 @@ bool subselect_hash_sj_engine::setup(Lis
     /* Item for the corresponding field from the materialized temp table. */
     Item_field *right_col_item;
     int null_count= test(cur_key_part->field->real_maybe_null());
-    tab->ref.items[i]= item_in->left_expr->element_index(i);
+    tmp_tab->ref.items[i]= item_in->left_expr->element_index(i);
 
     if (!(right_col_item= new Item_field(thd, context, cur_key_part->field)) ||
-        !(eq_cond= new Item_func_eq(tab->ref.items[i], right_col_item)) ||
+        !(eq_cond= new Item_func_eq(tmp_tab->ref.items[i], right_col_item)) ||
         ((Item_cond_and*)cond)->add(eq_cond))
     {
       delete cond;
@@ -3255,16 +3256,19 @@ bool subselect_hash_sj_engine::setup(Lis
                                  */
                                  cur_ref_buff + null_count,
                                  null_count ? cur_ref_buff : 0,
-                                 cur_key_part->length, tab->ref.items[i]);
+                                 cur_key_part->length, tmp_tab->ref.items[i]);
     cur_ref_buff+= cur_key_part->store_length;
   }
   *ref_key= NULL; /* End marker. */
-  tab->ref.key_err= 1;
-  tab->ref.key_parts= tmp_key_parts;
+  tmp_tab->ref.key_err= 1;
+  tmp_tab->ref.key_parts= tmp_key_parts;
 
   if (cond->fix_fields(thd, &cond))
     DBUG_RETURN(TRUE);
 
+  // Set 'tab' only when function cannot fail, because of assert in destructor
+  tab= tmp_tab;
+
   /*
     Create and optimize the JOIN that will be used to materialize
     the subquery if not yet created.

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-05-25 10:18:08 +0000
+++ b/sql/mysqld.cc	2011-05-26 11:18:45 +0000
@@ -2081,6 +2081,12 @@ void unlink_thd(THD *thd)
   thd_cleanup(thd);
   dec_connection_count();
   mysql_mutex_lock(&LOCK_thread_count);
+  /*
+    Used by binlog_reset_master.  It would be cleaner to use
+    DEBUG_SYNC here, but that's not possible because the THD's debug
+    sync feature has been shut down at this point.
+  */
+  DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5););
   delete_thd(thd);
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-05-21 08:25:33 +0000
+++ b/sql/sql_acl.cc	2011-05-26 12:36:57 +0000
@@ -8608,14 +8608,14 @@ static ulong parse_client_handshake_pack
   DBUG_PRINT("info", ("client capabilities: %lu", mpvio->client_capabilities));
   if (mpvio->client_capabilities & CLIENT_SSL)
   {
-    char error_string[1024] __attribute__((unused));
+    unsigned long errptr;
 
     /* Do the SSL layering. */
     if (!ssl_acceptor_fd)
       return packet_error;
 
     DBUG_PRINT("info", ("IO layer change in progress..."));
-    if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout))
+    if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout, &errptr))
     {
       DBUG_PRINT("error", ("Failed to accept new SSL connection"));
       return packet_error;

=== modified file 'sql/sql_array.h'
--- a/sql/sql_array.h	2010-11-05 22:14:29 +0000
+++ b/sql/sql_array.h	2011-05-18 13:12:02 +0000
@@ -79,75 +79,4 @@ public:
   }
 };
 
-
-/* 
-  Array of pointers to Elem that uses memory from MEM_ROOT
-
-  MEM_ROOT has no realloc() so this is supposed to be used for cases when
-  reallocations are rare.
-*/
-
-template <class Elem> class Array
-{
-  enum {alloc_increment = 16};
-  Elem **buffer;
-  uint n_elements, max_element;
-public:
-  Array(MEM_ROOT *mem_root, uint prealloc=16)
-  {
-    buffer= (Elem**)alloc_root(mem_root, prealloc * sizeof(Elem**));
-    max_element = buffer? prealloc : 0;
-    n_elements= 0;
-  }
-
-  Elem& at(int idx)
-  {
-    return *(((Elem*)buffer) + idx);
-  }
-
-  Elem **front()
-  {
-    return buffer;
-  }
-
-  Elem **back()
-  {
-    return buffer + n_elements;
-  }
-
-  bool append(MEM_ROOT *mem_root, Elem *el)
-  {
-    if (n_elements == max_element)
-    {
-      Elem **newbuf;
-      if (!(newbuf= (Elem**)alloc_root(mem_root, (n_elements + alloc_increment)*
-                                                  sizeof(Elem**))))
-      {
-        return FALSE;
-      }
-      memcpy(newbuf, buffer, n_elements*sizeof(Elem*));
-      buffer= newbuf;
-    }
-    buffer[n_elements++]= el;
-    return FALSE;
-  }
-
-  int elements()
-  {
-    return n_elements;
-  }
-
-  void clear()
-  {
-    n_elements= 0;
-  }
-
-  typedef int (*CMP_FUNC)(Elem * const *el1, Elem *const *el2);
-
-  void sort(CMP_FUNC cmp_func)
-  {
-    my_qsort(buffer, n_elements, sizeof(Elem*), (qsort_cmp)cmp_func);
-  }
-};
-
 #endif /* SQL_ARRAY_INCLUDED */

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-05-21 08:25:33 +0000
+++ b/sql/sql_base.cc	2011-05-26 08:39:40 +0000
@@ -6876,9 +6876,29 @@ find_field_in_tables(THD *thd, Item_iden
   if (last_table)
     last_table= last_table->next_name_resolution_table;
 
+#ifndef DBUG_OFF
+  uint loop_count= 0;
+  TABLE_LIST *one_node;
+#endif
   for (; cur_table != last_table ;
        cur_table= cur_table->next_name_resolution_table)
   {
+#ifndef DBUG_OFF
+    ++loop_count;
+    if (loop_count == 1000) // not normal, record one node we meet
+      one_node= cur_table;
+    if ((loop_count > 1000) && (one_node == cur_table))
+    {
+      /*
+        Meeting same node again: cycle, infinite loop. Raise an error which
+        doesn't stop RQG, so that Roel can continue working while we fix the
+        bug. We cannot continue the statement though.
+      */
+      my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0),
+               "HITTING BUG#12567331 INFINITE LOOP DETECTED - ASK GUILHEM AND ROEL");
+      return NULL;
+    }
+#endif
     Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
                                               item->name, db, table_name, ref,
                                               (thd->lex->sql_command ==

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-05-21 08:25:33 +0000
+++ b/sql/sql_parse.cc	2011-05-26 16:23:52 +0000
@@ -1891,6 +1891,67 @@ bool sp_process_definer(THD *thd)
 
 
 /**
+  Auxiliary call that opens and locks tables for LOCK TABLES statement
+  and initializes the list of locked tables.
+
+  @param thd     Thread context.
+  @param tables  List of tables to be locked.
+
+  @return FALSE in case of success, TRUE in case of error.
+*/
+
+static bool lock_tables_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
+{
+  Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
+  uint counter;
+  TABLE_LIST *table;
+
+  thd->in_lock_tables= 1;
+
+  if (open_tables(thd, &tables, &counter, 0, &lock_tables_prelocking_strategy))
+    goto err;
+
+  /*
+    We allow to change temporary tables even if they were locked for read
+    by LOCK TABLES. To avoid a discrepancy between lock acquired at LOCK
+    TABLES time and by the statement which is later executed under LOCK TABLES
+    we ensure that for temporary tables we always request a write lock (such
+    discrepancy can cause problems for the storage engine).
+    We don't set TABLE_LIST::lock_type in this case as this might result in
+    extra warnings from THD::decide_logging_format() even though binary logging
+    is totally irrelevant for LOCK TABLES.
+  */
+  for (table= tables; table; table= table->next_global)
+    if (!table->placeholder() && table->table->s->tmp_table)
+      table->table->reginfo.lock_type= TL_WRITE;
+
+  if (lock_tables(thd, tables, counter, 0) ||
+      thd->locked_tables_list.init_locked_tables(thd))
+    goto err;
+
+  thd->in_lock_tables= 0;
+
+  return FALSE;
+
+err:
+  thd->in_lock_tables= 0;
+
+  trans_rollback_stmt(thd);
+  /*
+    Need to end the current transaction, so the storage engine (InnoDB)
+    can free its locks if LOCK TABLES locked some tables before finding
+    that it can't lock a table in its list
+  */
+  trans_commit_implicit(thd);
+  /* Close tables and release metadata locks. */
+  close_thread_tables(thd);
+  DBUG_ASSERT(!thd->locked_tables_mode);
+  thd->mdl_context.release_transactional_locks();
+  return TRUE;
+}
+
+
+/**
   Execute command saved in thd and lex->sql_command.
 
   @param thd                       Thread handle
@@ -3265,31 +3326,11 @@ end_with_restore_list:
       goto error;
 
     thd->variables.option_bits|= OPTION_TABLE_LOCK;
-    thd->in_lock_tables=1;
 
-    {
-      Lock_tables_prelocking_strategy lock_tables_prelocking_strategy;
-
-      res= (open_and_lock_tables(thd, all_tables, FALSE, 0,
-                                 &lock_tables_prelocking_strategy) ||
-            thd->locked_tables_list.init_locked_tables(thd));
-    }
-
-    thd->in_lock_tables= 0;
+    res= lock_tables_open_and_lock_tables(thd, all_tables);
 
     if (res)
     {
-      trans_rollback_stmt(thd);
-      /*
-        Need to end the current transaction, so the storage engine (InnoDB)
-        can free its locks if LOCK TABLES locked some tables before finding
-        that it can't lock a table in its list
-      */
-      trans_commit_implicit(thd);
-      /* Close tables and release metadata locks. */
-      close_thread_tables(thd);
-      DBUG_ASSERT(!thd->locked_tables_mode);
-      thd->mdl_context.release_transactional_locks();
       thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
     }
     else

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-05-18 10:43:46 +0000
+++ b/sql/sql_select.cc	2011-05-26 11:09:57 +0000
@@ -978,7 +978,7 @@ bool resolve_subquery(THD *thd, JOIN *jo
 
     /* Register the subquery for further processing in flatten_subqueries() */
     select_lex->outer_select()->join->
-      sj_subselects.append(thd->mem_root, in_exists_predicate);
+      sj_subselects.push_back(in_exists_predicate);
   }
   else
   {
@@ -1904,6 +1904,11 @@ JOIN::optimize()
       thd->restore_active_arena(arena, &backup);
   }
 
+  /*
+    Note: optimize_cond() makes changes to conds. Since
+    select_lex->where and conds points to the same condition, this
+    function call effectively changes select_lex->where as well.
+  */
   conds= optimize_cond(this, conds, join_list, TRUE, &select_lex->cond_value);
   if (thd->is_error())
   {
@@ -1913,6 +1918,7 @@ JOIN::optimize()
   }
 
   {
+    // Note above about optimize_cond() also applies to selec_lex->having
     having= optimize_cond(this, having, join_list, FALSE,
                           &select_lex->having_value);
     if (thd->is_error())
@@ -4170,11 +4176,11 @@ bool JOIN::flatten_subqueries()
   Item_exists_subselect **subq_end;
   DBUG_ENTER("JOIN::flatten_subqueries");
 
-  if (sj_subselects.elements() == 0)
+  if (sj_subselects.empty())
     DBUG_RETURN(FALSE);
 
   /* First, convert child join's subqueries. We proceed bottom-up here */
-  for (subq= sj_subselects.front(), subq_end= sj_subselects.back(); 
+  for (subq= sj_subselects.begin(), subq_end= sj_subselects.end(); 
        subq != subq_end;
        subq++)
   {
@@ -4207,7 +4213,7 @@ bool JOIN::flatten_subqueries()
   {
     if (tbl->on_expr || tbl->in_outer_join_nest())
     {
-      subq= sj_subselects.front();
+      subq= sj_subselects.begin();
       arena= thd->activate_stmt_arena_if_needed(&backup);
       goto skip_conversion;
     }
@@ -4220,11 +4226,14 @@ bool JOIN::flatten_subqueries()
       - prefer correlated subqueries over uncorrelated;
       - prefer subqueries that have greater number of outer tables;
   */
-  sj_subselects.sort(subq_sj_candidate_cmp);
+  my_qsort(sj_subselects.begin(),
+           sj_subselects.size(), sj_subselects.element_size(),
+           reinterpret_cast<qsort_cmp>(subq_sj_candidate_cmp));
+
   // #tables-in-parent-query + #tables-in-subquery < MAX_TABLES
   /* Replace all subqueries to be flattened with Item_int(1) */
   arena= thd->activate_stmt_arena_if_needed(&backup);
-  for (subq= sj_subselects.front(); 
+  for (subq= sj_subselects.begin(); 
        subq != subq_end && 
        tables + (*subq)->unit->first_select()->join->tables < MAX_TABLES;
        subq++)
@@ -4235,7 +4244,7 @@ bool JOIN::flatten_subqueries()
       DBUG_RETURN(TRUE); /* purecov: inspected */
   }
  
-  for (subq= sj_subselects.front(); 
+  for (subq= sj_subselects.begin(); 
        subq != subq_end && 
        tables + (*subq)->unit->first_select()->join->tables < MAX_TABLES;
        subq++)
@@ -14708,7 +14717,8 @@ optimize_cond(JOIN *join, Item *conds, L
   SYNPOSIS
     remove_eq_conds()
     thd 			THD environment
-    cond                        the condition to handle
+    cond                        the condition to handle. Note that cond
+                                is changed by this function
     cond_value                  the resulting value of the condition
 
   RETURN
@@ -14770,9 +14780,34 @@ internal_remove_eq_conds(THD *thd, Item 
 	*cond_value != Item::COND_OK)
       return (Item*) 0;
     if (((Item_cond*) cond)->argument_list()->elements == 1)
-    {						// Remove list
+    {
+      /*
+        BUG#11765699:
+        We're dealing with an AND or OR item that has only one
+        argument. However, it is not an option to empty the list
+        because:
+
+         - this function is called for either JOIN::conds or
+           JOIN::having, but these point to the same condition as
+           SELECT_LEX::where and SELECT_LEX::having do.
+
+         - The return value of remove_eq_conds() is assigned to
+           JOIN::conds and JOIN::having, so emptying the list and
+           returning the only remaining item "replaces" the AND or OR
+           with item for the variables in JOIN. However, the return
+           value is not assigned to the SELECT_LEX counterparts. Thus,
+           if argument_list is emptied, SELECT_LEX forgets the item in
+           argument_list()->head().
+
+        item is therefore returned, but argument_list is not emptied.
+      */
       item= ((Item_cond*) cond)->argument_list()->head();
-      ((Item_cond*) cond)->argument_list()->empty();
+      /*
+        Consider reenabling the line below when the optimizer has been
+        split into properly separated phases.
+ 
+        ((Item_cond*) cond)->argument_list()->empty();
+      */
       return item;
     }
   }

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2011-05-18 10:43:46 +0000
+++ b/sql/sql_select.h	2011-05-26 06:03:02 +0000
@@ -1888,7 +1888,8 @@ public:
   bool union_part; ///< this subselect is part of union 
   bool optimized; ///< flag to avoid double optimization in EXPLAIN
   
-  Array<Item_exists_subselect> sj_subselects;
+  // true: No need to run DTORs on pointers.
+  Mem_root_array<Item_exists_subselect*, true> sj_subselects;
 
   /* Temporary tables used to weed-out semi-join duplicates */
   List<TABLE> sj_tmp_tables;
@@ -1913,7 +1914,7 @@ public:
        select_result *result_arg)
     : keyuse(thd_arg->mem_root),
       fields_list(fields_arg),
-      sj_subselects(thd_arg->mem_root, 4)
+      sj_subselects(thd_arg->mem_root)
   {
     init(thd_arg, fields_arg, select_options_arg, result_arg);
   }

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	2011-05-21 08:25:33 +0000
+++ b/storage/innobase/handler/i_s.cc	2011-05-25 13:43:30 +0000
@@ -3347,7 +3347,7 @@ i_s_innodb_buffer_page_get_info(
 
 		page_info->space_id = buf_page_get_space(bpage);
 
-		page_info->page_num = buf_page_get_page_no(bpage);;
+		page_info->page_num = buf_page_get_page_no(bpage);
 
 		page_info->flush_type = bpage->flush_type;
 
@@ -4793,7 +4793,7 @@ i_s_sys_indexes_fill_table(
 
 	/* Process each record in the table */
 	while (rec) {
-		const char*	err_msg;;
+		const char*	err_msg;
 		table_id_t	table_id;
 		dict_index_t	index_rec;
 

=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	2011-05-24 20:22:08 +0000
+++ b/storage/innobase/lock/lock0lock.c	2011-05-27 03:36:33 +0000
@@ -4393,7 +4393,11 @@ lock_trx_table_locks_remove(
 
 	ut_ad(lock_mutex_own());
 
-	trx_mutex_enter(trx);
+	if (!trx->lock.was_chosen_as_deadlock_victim) {
+		trx_mutex_enter(trx);
+	} else {
+		ut_ad(trx_mutex_own(trx));
+	}
 
 	for (i = ib_vector_size(trx->lock.table_locks) - 1; i >= 0; --i) {
 		const lock_t*	lock;
@@ -4410,12 +4414,18 @@ lock_trx_table_locks_remove(
 
 		if (lock == lock_to_remove) {
 			ib_vector_set(trx->lock.table_locks, i, NULL);
-			trx_mutex_exit(trx);
+
+			if (!trx->lock.was_chosen_as_deadlock_victim) {
+				trx_mutex_exit(trx);
+			}
+
 			return;
 		}
 	}
 
-	trx_mutex_exit(trx);
+	if (!trx->lock.was_chosen_as_deadlock_victim) {
+		trx_mutex_exit(trx);
+	}
 
 	/* Lock must exist in the vector. */
 	ut_error;

=== modified file 'storage/innobase/que/que0que.c'
--- a/storage/innobase/que/que0que.c	2011-04-12 07:53:47 +0000
+++ b/storage/innobase/que/que0que.c	2011-05-25 13:43:30 +0000
@@ -703,7 +703,7 @@ que_thr_stop(
 	que_thr_t*	thr)	/*!< in: query thread */
 {
 	que_t*		graph;
-	trx_t*		trx = thr_get_trx(thr);;
+	trx_t*		trx = thr_get_trx(thr);
 
 	graph = thr->graph;
 

=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c	2011-05-17 11:42:10 +0000
+++ b/storage/innobase/srv/srv0start.c	2011-05-26 06:29:48 +0000
@@ -840,7 +840,8 @@ open_or_create_data_files(
 			ut_a(size != (os_offset_t) -1);
 			/* Round size downward to megabytes */
 
-			rounded_size_pages = size >> UNIV_PAGE_SIZE_SHIFT;
+			rounded_size_pages = (ulint)
+				(size >> UNIV_PAGE_SIZE_SHIFT);
 
 			if (i == srv_n_data_files - 1
 			    && srv_auto_extend_last_data_file) {

=== modified file 'vio/test-ssl.c'
--- a/vio/test-ssl.c	2010-07-15 11:13:30 +0000
+++ b/vio/test-ssl.c	2011-05-19 09:47:43 +0000
@@ -59,6 +59,9 @@ main(int argc, char**	argv)
   struct st_VioSSLFd* ssl_acceptor= 0;
   struct st_VioSSLFd* ssl_connector= 0;
   Vio* client_vio=0, *server_vio=0;
+  enum enum_ssl_init_error ssl_init_error;
+  unsigned long ssl_error;
+
   MY_INIT(argv[0]);
   DBUG_PROCESS(argv[0]);
   DBUG_PUSH(default_dbug_option);
@@ -91,16 +94,16 @@ main(int argc, char**	argv)
   ssl_acceptor = new_VioSSLAcceptorFd(server_key, server_cert, ca_file,
 				      ca_path, cipher);
   ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file,
-					ca_path, cipher);
+					ca_path, cipher, &ssl_init_error);
 
   client_vio = (struct st_vio*)my_malloc(sizeof(struct st_vio),MYF(0));
   client_vio->sd = sv[0];
   client_vio->vioblocking(client_vio, 0, &unused);
-  sslconnect(ssl_connector,client_vio,60L);
+  sslconnect(ssl_connector,client_vio,60L,&ssl_error);
   server_vio = (struct st_vio*)my_malloc(sizeof(struct st_vio),MYF(0));
   server_vio->sd = sv[1];
   server_vio->vioblocking(client_vio, 0, &unused);
-  sslaccept(ssl_acceptor,server_vio,60L);
+  sslaccept(ssl_acceptor,server_vio,60L, &ssl_error);
 
   printf("Socketpair: %d , %d\n", client_vio->sd, server_vio->sd);
 

=== modified file 'vio/test-sslclient.c'
--- a/vio/test-sslclient.c	2010-07-08 21:20:08 +0000
+++ b/vio/test-sslclient.c	2011-05-19 09:47:43 +0000
@@ -50,6 +50,9 @@ main(	int	argc __attribute__((unused)),
 	Vio* client_vio=0;
 	int err;
 	char	xbuf[100]="Ohohhhhoh1234";
+        enum enum_ssl_init_error ssl_init_error;
+        unsigned long ssl_error;
+
 	MY_INIT(argv[0]);
         DBUG_PROCESS(argv[0]);
         DBUG_PUSH(default_dbug_option);
@@ -60,7 +63,8 @@ main(	int	argc __attribute__((unused)),
 	if (ca_path!=0)
 		printf("CApath          : %s\n", ca_path);
 
-	ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, ca_path, cipher);
+	ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, ca_path, cipher,
+                                              &ssl_init_error);
 	if(!ssl_connector) {
                  fatal_error("client:new_VioSSLConnectorFd failed");
 	}
@@ -81,7 +85,7 @@ main(	int	argc __attribute__((unused)),
 	/* ----------------------------------------------- */
 	/* Now we have TCP conncetion. Start SSL negotiation. */
 	read(client_vio->sd,xbuf, sizeof(xbuf));
-        sslconnect(ssl_connector,client_vio,60L);
+        sslconnect(ssl_connector,client_vio,60L,&ssl_error);
 	err = vio_read(client_vio,xbuf, sizeof(xbuf));
 	if (err<=0) {
 		my_free(ssl_connector);

=== modified file 'vio/test-sslserver.c'
--- a/vio/test-sslserver.c	2010-07-08 21:20:08 +0000
+++ b/vio/test-sslserver.c	2011-05-19 09:47:43 +0000
@@ -52,6 +52,7 @@ do_ssl_stuff(	TH_ARGS*	args)
 	const char*	s = "Huhuhuhuuu";
 	Vio*		server_vio;
 	int		err;
+        unsigned long   ssl_error;
 	DBUG_ENTER("do_ssl_stuff");
 
 	server_vio = vio_new(args->sd, VIO_TYPE_TCPIP, TRUE);
@@ -60,7 +61,7 @@ do_ssl_stuff(	TH_ARGS*	args)
 	/* TCP connection is ready. Do server side SSL. */
 
 	err = write(server_vio->sd,(uchar*)s, strlen(s));
-	sslaccept(args->ssl_acceptor,server_vio,60L);
+	sslaccept(args->ssl_acceptor,server_vio,60L,&ssl_error);
 	err = server_vio->write(server_vio,(uchar*)s, strlen(s));
 	DBUG_VOID_RETURN;
 }

=== modified file 'vio/viossl.c'
--- a/vio/viossl.c	2010-08-16 12:50:27 +0000
+++ b/vio/viossl.c	2011-05-19 09:47:43 +0000
@@ -144,8 +144,9 @@ void vio_ssl_delete(Vio *vio)
 
 
 static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
-                  int (*connect_accept_func)(SSL*))
+                  int (*connect_accept_func)(SSL*), unsigned long *errptr)
 {
+  int r;
   SSL *ssl;
   my_bool unused;
   my_bool was_blocking;
@@ -160,7 +161,7 @@ static int ssl_do(struct st_VioSSLFd *pt
   if (!(ssl= SSL_new(ptr->ssl_context)))
   {
     DBUG_PRINT("error", ("SSL_new failure"));
-    report_errors(ssl);
+    *errptr= ERR_get_error();
     vio_blocking(vio, was_blocking, &unused);
     DBUG_RETURN(1);
   }
@@ -169,10 +170,10 @@ static int ssl_do(struct st_VioSSLFd *pt
   SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
   SSL_set_fd(ssl, vio->sd);
 
-  if (connect_accept_func(ssl) < 1)
+  if ((r= connect_accept_func(ssl)) < 1)
   {
     DBUG_PRINT("error", ("SSL_connect/accept failure"));
-    report_errors(ssl);
+    *errptr= SSL_get_error(ssl, r);
     SSL_free(ssl);
     vio_blocking(vio, was_blocking, &unused);
     DBUG_RETURN(1);
@@ -220,17 +221,17 @@ static int ssl_do(struct st_VioSSLFd *pt
 }
 
 
-int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
+int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *errptr)
 {
   DBUG_ENTER("sslaccept");
-  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept));
+  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept, errptr));
 }
 
 
-int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
+int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *errptr)
 {
   DBUG_ENTER("sslconnect");
-  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect));
+  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, errptr));
 }
 
 

=== modified file 'vio/viosslfactories.c'
--- a/vio/viosslfactories.c	2010-07-15 11:13:30 +0000
+++ b/vio/viosslfactories.c	2011-05-19 09:47:43 +0000
@@ -165,7 +165,7 @@ static struct st_VioSSLFd *
 new_VioSSLFd(const char *key_file, const char *cert_file,
              const char *ca_file, const char *ca_path,
              const char *cipher, SSL_METHOD *method, 
-             enum enum_ssl_init_error* error)
+             enum enum_ssl_init_error *error)
 {
   DH *dh;
   struct st_VioSSLFd *ssl_fd;
@@ -249,11 +249,10 @@ new_VioSSLFd(const char *key_file, const
 struct st_VioSSLFd *
 new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
                       const char *ca_file, const char *ca_path,
-                      const char *cipher)
+                      const char *cipher, enum enum_ssl_init_error* error)
 {
   struct st_VioSSLFd *ssl_fd;
   int verify= SSL_VERIFY_PEER;
-  enum enum_ssl_init_error dummy;
 
   /*
     Turn off verification of servers certificate if both
@@ -263,7 +262,7 @@ new_VioSSLConnectorFd(const char *key_fi
     verify= SSL_VERIFY_NONE;
 
   if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file,
-                             ca_path, cipher, TLSv1_client_method(), &dummy)))
+                             ca_path, cipher, TLSv1_client_method(), error)))
   {
     return 0;
   }

=== modified file 'vio/viotest-ssl.c'
--- a/vio/viotest-ssl.c	2010-07-08 21:20:08 +0000
+++ b/vio/viotest-ssl.c	2011-05-19 09:47:43 +0000
@@ -60,6 +60,9 @@ int main(int argc, char **argv)
   struct st_VioSSLConnectorFd* ssl_connector=0; 
   Vio* client_vio=0;
   Vio* server_vio=0;
+  enum enum_ssl_init_error ssl_init_error;
+  unsigned long ssl_error;
+
   MY_INIT(argv[0]);
   DBUG_PROCESS(argv[0]);
   DBUG_PUSH(default_dbug_option);
@@ -92,14 +95,14 @@ int main(int argc, char **argv)
   ssl_acceptor = new_VioSSLAcceptorFd(server_key, server_cert, ca_file,
 				      ca_path);
   ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file,
-					ca_path);
+					ca_path, &ssl_init_error);
 
   client_vio = (Vio*)my_malloc(sizeof(struct st_vio),MYF(0));
   client_vio->sd = sv[0];
-  sslconnect(ssl_connector,client_vio);
+  sslconnect(ssl_connector,client_vio,&ssl_error);
   server_vio = (Vio*)my_malloc(sizeof(struct st_vio),MYF(0));
   server_vio->sd = sv[1];
-  sslaccept(ssl_acceptor,server_vio);
+  sslaccept(ssl_acceptor,server_vio,&ssl_error);
 
   printf("Socketpair: %d , %d\n", client_vio->sd, server_vio->sd);
 


Attachment: [text/bzr-bundle] bzr/anitha.gopi@oracle.com-20110527045335-moc6fhbj6tfici2w.bundle
Thread
bzr commit into mysql-trunk branch (anitha.gopi:3118) Anitha Gopi27 May