← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (knielsen:2795)

 

#At lp:maria

 2795 knielsen@xxxxxxxxxxxxxxx	2010-02-20 [merge]
      automerge latest trunk for buildbot test
      added:
        mysql-test/suite/parts/t/partition_repair_myisam-master.opt
      modified:
        .bzrignore
        BUILD/util.sh
        client/mysqlslap.c
        client/mysqltest.cc
        config/ac-macros/libevent.m4
        configure.in
        extra/libevent/devpoll.c
        extra/yassl/src/yassl_error.cpp
        extra/yassl/taocrypt/include/asn.hpp
        extra/yassl/taocrypt/src/asn.cpp
        include/ft_global.h
        include/maria.h
        include/my_base.h
        include/violite.h
        libmysqld/CMakeLists.txt
        mysql-test/mysql-test-run.pl
        mysql-test/r/grant.result
        mysql-test/r/openssl_1.result
        mysql-test/r/show_check.result
        mysql-test/r/sp-destruct.result
        mysql-test/r/table_elim.result
        mysql-test/r/udf.result
        mysql-test/r/variables.result
        mysql-test/r/view.result
        mysql-test/std_data/cacert.pem
        mysql-test/std_data/client-cert.pem
        mysql-test/std_data/client-key.pem
        mysql-test/std_data/server-cert.pem
        mysql-test/std_data/server-key.pem
        mysql-test/suite/maria/r/maria3.result
        mysql-test/suite/maria/t/maria-recovery2-master.opt
        mysql-test/suite/maria/t/maria3.test
        mysql-test/suite/rpl/t/rpl_rotate_logs.test
        mysql-test/t/grant.test
        mysql-test/t/openssl_1.test
        mysql-test/t/partition_innodb_semi_consistent.test
        mysql-test/t/query_cache_debug.test
        mysql-test/t/show_check-master.opt
        mysql-test/t/sp-destruct.test
        mysql-test/t/table_elim.test
        mysql-test/t/udf.test
        mysql-test/t/view.test
        mysys/my_file.c
        mysys/my_thr_init.c
        sql-bench/bench-init.pl.sh
        sql-bench/server-cfg.sh
        sql-bench/test-ATIS.sh
        sql-bench/test-alter-table.sh
        sql-bench/test-big-tables.sh
        sql-bench/test-connect.sh
        sql-bench/test-create.sh
        sql-bench/test-select.sh
        sql-bench/test-transactions.sh
        sql-bench/test-wisconsin.sh
        sql-common/client.c
        sql/CMakeLists.txt
        sql/item.cc
        sql/lock.cc
        sql/mysql_priv.h
        sql/mysqld.cc
        sql/net_serv.cc
        sql/opt_table_elimination.cc
        sql/rpl_record.cc
        sql/slave.cc
        sql/sql_base.cc
        sql/sql_cache.cc
        sql/sql_connect.cc
        sql/sql_delete.cc
        sql/sql_parse.cc
        sql/sql_profile.cc
        sql/sql_profile.h
        sql/sql_table.cc
        sql/table.cc
        sql/table.h
        sql/udf_example.def
        storage/maria/ft_maria.c
        storage/maria/ha_maria.cc
        storage/maria/ma_blockrec.c
        storage/maria/ma_close.c
        storage/maria/ma_extra.c
        storage/maria/ma_locking.c
        storage/maria/ma_recovery.c
        storage/maria/maria_def.h
        storage/myisam/ft_boolean_search.c
        storage/myisam/ft_myisam.c
        storage/myisam/ft_nlq_search.c
        storage/myisam/ft_parser.c
        storage/myisam/ft_stopwords.c
        storage/myisam/ftdefs.h
        storage/myisam/mi_close.c
        storage/myisam/mi_extra.c
        storage/myisam/mi_open.c
        storage/myisam/myisamdef.h
        storage/xtradb/buf/buf0buf.c
        storage/xtradb/handler/i_s.cc
        support-files/compiler_warnings.supp
        unittest/mysys/waiting_threads-t.c
        vio/viossl.c

=== modified file '.bzrignore'
--- a/.bzrignore	2009-12-22 13:50:20 +0000
+++ b/.bzrignore	2010-01-29 18:42:22 +0000
@@ -40,15 +40,15 @@
 *.dsp
 *.Po
 *.Plo
-*/*.dir/*
+*.dir/
 */*_pure_*warnings
 */.deps
 */.libs/*
 */.pure
-*/debug/*
-*/minsizerel/*
-*/release/*
-*/relwithdebinfo/*
+debug/
+MinSizeRel/
+Release/
+RelWithDebInfo/
 *~
 .*.swp
 ./CMakeCache.txt
@@ -96,7 +96,7 @@ BitKeeper/tmp/gone
 BitKeeper/tmp
 BitKeeper/log
 BitKeeper/etc/SCCS
-CMakeFiles/*
+CMakeFiles/
 COPYING
 COPYING.LIB
 Docs/#manual.texi#

=== modified file 'BUILD/util.sh'
--- a/BUILD/util.sh	2010-01-07 12:02:18 +0000
+++ b/BUILD/util.sh	2010-01-28 22:34:22 +0000
@@ -16,6 +16,8 @@
 
 # Setting cpu options.
 get_cpuopt () {
+    case "$(uname -o)" in
+      *Linux*)
 	case "$(gcc -dumpmachine)" in
           x86_64-*)
                 # gcc barfs on -march=... on x64
@@ -26,7 +28,13 @@ get_cpuopt () {
                 CPUOPT="-m32 -march=i586 -mtune=generic"
                 ;;
 	esac
-	return 0
+	;;
+      *Solaris*)
+	# ToDo: handle 32-bit build? For now default to 64-bit.
+	CPUOPT="-D__sun -m64 -mtune=athlon64"
+	;;
+    esac
+    return 0
 }
 
 # Default to a parallel build, but only if AM_MAKEFLAGS is not set.

=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c	2009-12-03 11:34:11 +0000
+++ b/client/mysqlslap.c	2010-01-29 18:42:22 +0000
@@ -292,6 +292,25 @@ static int gettimeofday(struct timeval *
 }
 #endif
 
+void set_mysql_connect_options(MYSQL *mysql)
+{
+  if (opt_compress)
+    mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS);
+#ifdef HAVE_OPENSSL
+  if (opt_use_ssl)
+    mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
+                  opt_ssl_capath, opt_ssl_cipher);
+#endif
+  if (opt_protocol)
+    mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
+#ifdef HAVE_SMEM
+  if (shared_memory_base_name)
+    mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
+#endif
+  mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
+}
+
+
 int main(int argc, char **argv)
 {
   MYSQL mysql;
@@ -323,20 +342,7 @@ int main(int argc, char **argv)
     exit(1);
   }
   mysql_init(&mysql);
-  if (opt_compress)
-    mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
-#ifdef HAVE_OPENSSL
-  if (opt_use_ssl)
-    mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
-                  opt_ssl_capath, opt_ssl_cipher);
-#endif
-  if (opt_protocol)
-    mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
-#ifdef HAVE_SMEM
-  if (shared_memory_base_name)
-    mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
-#endif
-  mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
+  set_mysql_connect_options(&mysql);
 
   if (!opt_only_print) 
   {
@@ -1815,6 +1821,7 @@ pthread_handler_t run_task(void *p)
             my_progname, mysql_error(mysql));
     exit(0);
   }
+  set_mysql_connect_options(mysql);
 
   if (mysql_thread_init())
   {
@@ -1855,7 +1862,6 @@ limit_not_met:
                   my_progname, mysql_error(mysql));
           exit(0);
         }
-
         if (slap_connect(mysql))
           goto end;
       }
@@ -2223,6 +2229,7 @@ slap_connect(MYSQL *mysql)
   int x, connect_error= 1;
   for (x= 0; x < 10; x++)
   {
+    set_mysql_connect_options(mysql);
     if (mysql_real_connect(mysql, host, user, opt_password,
                            create_schema_string,
                            opt_mysql_port,

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-01-15 15:27:55 +0000
+++ b/client/mysqltest.cc	2010-01-28 14:49:14 +0000
@@ -657,7 +657,9 @@ public:
     }
 
     while ((bytes= fread(buf, 1, sizeof(buf), m_file)) > 0)
-      fwrite(buf, 1, bytes, stderr);
+      if (fwrite(buf, 1, bytes, stderr))
+        die("Failed to write to '%s', errno: %d",
+            m_file_name, errno);
 
     if (!lines)
     {

=== modified file 'config/ac-macros/libevent.m4'
--- a/config/ac-macros/libevent.m4	2009-09-29 23:36:15 +0000
+++ b/config/ac-macros/libevent.m4	2010-01-30 12:39:39 +0000
@@ -14,13 +14,6 @@ AC_DEFUN([MYSQL_USE_BUNDLED_LIBEVENT], [
 
   libevent_libs="\$(top_builddir)/extra/libevent/libevent.a"
   libevent_includes="-I\$(top_srcdir)/extra/libevent"
-  libevent_test_option="--mysqld=--thread-handling=pool-of-threads"
-  AC_SUBST(libevent_libs)
-  AC_SUBST(libevent_includes)
-  AC_SUBST(libevent_test_option)
-
-  AC_DEFINE([HAVE_LIBEVENT], [1], [If we want to use libevent and have connection pooling])
-  AC_MSG_RESULT([using bundled libevent])
 
   dnl Get the upstream file with the original libevent configure macros.
   dnl Use builtin include for this, to work around path problems in old versions of aclocal.
@@ -39,17 +32,64 @@ AC_DEFUN([MYSQL_CHECK_LIBEVENT], [
 
   AC_CONFIG_FILES(extra/libevent/Makefile)
 
-  AC_MSG_CHECKING(for libevent)
+  AC_MSG_NOTICE([checking what libevent library to use])
+
   AC_ARG_WITH([libevent],
-      [  --with-libevent         use libevent and have connection pooling],
-      [with_libevent=$withval],
-      [with_libevent=no]
-  )
-
-  if test "$with_libevent" != "no"; then
-    MYSQL_USE_BUNDLED_LIBEVENT
-  else
-    AC_MSG_RESULT([disabled])
+              AC_HELP_STRING([--with-libevent=yes|no|bundled|DIR],
+                             [Use libevent and have connection pooling.
+                              A location of libevent library can be specified.
+                              Given DIR, libevent library is 
+                              assumed to be in $DIR/lib and header files
+                              in $DIR/include.]),
+              [with_libevent=${withval}],
+              [with_libevent=no])
+
+  case "$with_libevent" in
+    "no")
+      with_libevent=disabled
+      ;;
+    "bundled")
+      MYSQL_USE_BUNDLED_LIBEVENT
+      ;;
+    "" | "yes")
+      libevent_includes=""
+      libevent_libs="-levent"
+      AC_CHECK_LIB(event, evutil_socketpair,[with_libevent=system],
+                   [with_libevent=bundled])
+      AC_CHECK_HEADER(evutil.h,,[with_libevent=bundled])
+      if test "$with_libevent" = "bundled"; then
+        MYSQL_USE_BUNDLED_LIBEVENT
+      fi
+      ;;
+    *)
+      # Test for libevent using all known library file endings
+      if test \( -f "$with_libevent/lib/libevent.a"  -o \
+                 -f "$with_libevent/lib/libevent.so" -o \
+                 -f "$with_libevent/lib/libevent.sl" -o \
+                 -f "$with_libevent/lib/libevent.dylib" \) \
+              -a -f "$with_libevent/include/evutil.h"; then
+        libevent_includes="-I$with_libevent/include"
+        libevent_libs="-L$with_libevent/lib -levent"
+        AC_CHECK_LIB(event, evutil_socketpair,[with_libevent=$with_libevent],
+                     [with_libevent=no], [$libevent_libs])
+      else
+        with_libevent=no
+      fi
+      if test "$with_libevent" = "no"; then 
+        AC_MSG_ERROR([libevent headers or binaries were not found])
+      fi
+      ;;
+  esac
+  AC_MSG_CHECKING(for libevent)
+  AC_MSG_RESULT([$with_libevent])
+
+  if test "$with_libevent" != "disabled"; then
+    libevent_test_option="--mysqld=--thread-handling=pool-of-threads"
+    AC_SUBST(libevent_libs)
+    AC_SUBST(libevent_includes)
+    AC_SUBST(libevent_test_option)
+    AC_DEFINE([HAVE_LIBEVENT], [1], [If we want to use libevent and have connection pooling])
   fi
-  AM_CONDITIONAL([HAVE_LIBEVENT], [ test "$with_libevent" != "no" ])
+  AM_CONDITIONAL([HAVE_LIBEVENT], [ test "$with_libevent" != "disabled" ])
 ])
+

=== modified file 'configure.in'
--- a/configure.in	2010-01-17 17:22:46 +0000
+++ b/configure.in	2010-01-29 20:37:22 +0000
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
 #
 # When changing major version number please also check switch statement
 # in mysqlbinlog::check_master_version().
-AM_INIT_AUTOMAKE(mysql, 5.1.42-MariaDB-rc)
+AM_INIT_AUTOMAKE(mysql, 5.1.42-MariaDB)
 AM_CONFIG_HEADER([include/config.h:config.h.in])
 
 # Request support for automake silent-rules if available.
@@ -604,7 +604,7 @@ AC_CHECK_TOOL([NM], [nm]) 
 
 if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
 then
-  tmp=`$NM ${other_libc_lib:-/usr/lib*}/libc.a | grep _nss_files_getaliasent_r1`
+  tmp=`$NM ${other_libc_lib:-/usr/lib*}/libc.a 2>&1 | grep _nss_files_getaliasent_r1`
   if test -n "$tmp"
   then
      STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"

=== modified file 'extra/libevent/devpoll.c'
--- a/extra/libevent/devpoll.c	2010-01-07 13:00:06 +0000
+++ b/extra/libevent/devpoll.c	2010-01-28 11:35:10 +0000
@@ -140,7 +140,7 @@ devpoll_init(struct event_base *base)
 		return (NULL);
 
 	if (getrlimit(RLIMIT_NOFILE, &rl) == 0 &&
-	    rl.rlim_cur != RLIM_INFINITY)
+	    (unsigned long long) rl.rlim_cur != (unsigned long long) RLIM_INFINITY)
 		nfiles = rl.rlim_cur - 1;
 
 	/* Initialize the kernel queue */

=== modified file 'extra/yassl/src/yassl_error.cpp'
--- a/extra/yassl/src/yassl_error.cpp	2008-11-18 16:45:44 +0000
+++ b/extra/yassl/src/yassl_error.cpp	2010-01-29 10:42:31 +0000
@@ -60,7 +60,7 @@ void SetErrorString(YasslError error, ch
     using namespace TaoCrypt;
     const int max = MAX_ERROR_SZ;  // shorthand
 
-    switch (error) {
+    switch ((int) error) {
 
         // yaSSL proper errors
     case range_error :

=== modified file 'extra/yassl/taocrypt/include/asn.hpp'
--- a/extra/yassl/taocrypt/include/asn.hpp	2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/include/asn.hpp	2010-01-27 10:38:29 +0000
@@ -305,6 +305,7 @@ private:
     bool   ValidateSignature(SignerList*);
     bool   ConfirmSignature(Source&);
     void   GetKey();
+    char*  AddTag(char*, const char*, const char*, word32, word32);
     void   GetName(NameType);
     void   GetValidity();
     void   GetDate(DateType);

=== modified file 'extra/yassl/taocrypt/src/asn.cpp'
--- a/extra/yassl/taocrypt/src/asn.cpp	2009-09-15 11:22:39 +0000
+++ b/extra/yassl/taocrypt/src/asn.cpp	2010-01-27 10:38:29 +0000
@@ -652,6 +652,25 @@ word32 CertDecoder::GetDigest()
 }
 
 
+// memory length checked add tag to buffer
+char* CertDecoder::AddTag(char* ptr, const char* buf_end, const char* tag_name,
+                          word32 tag_name_length, word32 tag_value_length)
+{
+    if (ptr + tag_name_length + tag_value_length > buf_end) {
+        source_.SetError(CONTENT_E);
+        return 0;
+    }
+
+    memcpy(ptr, tag_name, tag_name_length);
+    ptr += tag_name_length;
+
+    memcpy(ptr, source_.get_current(), tag_value_length);
+    ptr += tag_value_length;
+
+    return ptr;
+}
+
+
 // process NAME, either issuer or subject
 void CertDecoder::GetName(NameType nt)
 {
@@ -659,11 +678,22 @@ void CertDecoder::GetName(NameType nt)
 
     SHA    sha;
     word32 length = GetSequence();  // length of all distinguished names
-    assert (length < ASN_NAME_MAX);
+
+    if (length >= ASN_NAME_MAX)
+        return;
     length += source_.get_index();
 
-    char*  ptr = (nt == ISSUER) ? issuer_ : subject_;
-    word32 idx = 0;
+    char* ptr;
+    char* buf_end;
+
+    if (nt == ISSUER) {
+        ptr = issuer_;
+        buf_end = ptr + sizeof(issuer_) - 1;   // 1 byte for trailing 0
+    }
+    else {
+        ptr = subject_;
+        buf_end = ptr + sizeof(subject_) - 1;  // 1 byte for trailing 0
+    }
 
     while (source_.get_index() < length) {
         GetSet();
@@ -685,47 +715,36 @@ void CertDecoder::GetName(NameType nt)
             byte   id      = source_.next();  
             b              = source_.next();    // strType
             word32 strLen  = GetLength(source_);
-            bool   copy    = false;
-
-            if (id == COMMON_NAME) {
-                memcpy(&ptr[idx], "/CN=", 4);
-                idx += 4;
-                copy = true;
-            }
-            else if (id == SUR_NAME) {
-                memcpy(&ptr[idx], "/SN=", 4);
-                idx += 4;
-                copy = true;
-            }
-            else if (id == COUNTRY_NAME) {
-                memcpy(&ptr[idx], "/C=", 3);
-                idx += 3;
-                copy = true;
-            }
-            else if (id == LOCALITY_NAME) {
-                memcpy(&ptr[idx], "/L=", 3);
-                idx += 3;
-                copy = true;
-            }
-            else if (id == STATE_NAME) {
-                memcpy(&ptr[idx], "/ST=", 4);
-                idx += 4;
-                copy = true;
-            }
-            else if (id == ORG_NAME) {
-                memcpy(&ptr[idx], "/O=", 3);
-                idx += 3;
-                copy = true;
-            }
-            else if (id == ORGUNIT_NAME) {
-                memcpy(&ptr[idx], "/OU=", 4);
-                idx += 4;
-                copy = true;
-            }
 
-            if (copy) {
-                memcpy(&ptr[idx], source_.get_current(), strLen);
-                idx += strLen;
+            switch (id) {
+            case COMMON_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/CN=", 4, strLen)))
+                    return;
+                break;
+            case SUR_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/SN=", 4, strLen)))
+                    return;
+                break;
+            case COUNTRY_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/C=", 3, strLen)))
+                    return;
+                break;
+            case LOCALITY_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/L=", 3, strLen)))
+                    return;
+                break;
+            case STATE_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/ST=", 4, strLen)))
+                    return;
+                break;
+            case ORG_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/O=", 3, strLen)))
+                    return;
+                break;
+            case ORGUNIT_NAME:
+                if (!(ptr = AddTag(ptr, buf_end, "/OU=", 4, strLen)))
+                    return;
+                break;
             }
 
             sha.Update(source_.get_current(), strLen);
@@ -740,17 +759,15 @@ void CertDecoder::GetName(NameType nt)
             word32 length = GetLength(source_);
 
             if (email) {
-                memcpy(&ptr[idx], "/emailAddress=", 14);
-                idx += 14;
-
-                memcpy(&ptr[idx], source_.get_current(), length);
-                idx += length;
+                if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length)))
+                    return; 
             }
 
             source_.advance(length);
         }
     }
-    ptr[idx++] = 0;
+
+    *ptr = 0;
 
     if (nt == ISSUER)
         sha.Final(issuerHash_);

=== modified file 'include/ft_global.h'
--- a/include/ft_global.h	2009-11-30 13:36:06 +0000
+++ b/include/ft_global.h	2010-01-27 21:53:08 +0000
@@ -62,7 +62,8 @@ void ft_free_stopwords(void);
 #define FT_SORTED 2
 #define FT_EXPAND 4   /* query expansion */
 
-FT_INFO *ft_init_search(uint,void *, uint, uchar *, uint,CHARSET_INFO *, uchar *);
+FT_INFO *ft_init_search(uint,void *, uint, uchar *, size_t,
+                        CHARSET_INFO *, uchar *);
 my_bool ft_boolean_check_syntax_string(const uchar *);
 
 /* Internal symbols for fulltext between maria and MyISAM */

=== modified file 'include/maria.h'
--- a/include/maria.h	2009-02-19 09:01:25 +0000
+++ b/include/maria.h	2010-01-27 21:53:08 +0000
@@ -462,7 +462,7 @@ void maria_versioning(MARIA_HA *info, my
 void maria_ignore_trids(MARIA_HA *info);
 
 /* fulltext functions */
-FT_INFO *maria_ft_init_search(uint,void *, uint, uchar *, uint,
+FT_INFO *maria_ft_init_search(uint,void *, uint, uchar *, size_t,
                               CHARSET_INFO *, uchar *);
 
 /* 'Almost-internal' Maria functions */

=== modified file 'include/my_base.h'
--- a/include/my_base.h	2009-09-07 20:50:10 +0000
+++ b/include/my_base.h	2010-02-10 19:06:24 +0000
@@ -111,7 +111,7 @@ enum ha_storage_media {
 enum ha_extra_function {
   HA_EXTRA_NORMAL=0,			/* Optimize for space (def) */
   HA_EXTRA_QUICK=1,			/* Optimize for speed */
-  HA_EXTRA_NOT_USED=2,
+  HA_EXTRA_NOT_USED=2,			/* Should be ignored by handler */
   HA_EXTRA_CACHE=3,			/* Cache record in HA_rrnd() */
   HA_EXTRA_NO_CACHE=4,			/* End caching of records (def) */
   HA_EXTRA_NO_READCHECK=5,		/* No readcheck on update */

=== modified file 'include/violite.h'
--- a/include/violite.h	2010-01-15 15:27:55 +0000
+++ b/include/violite.h	2010-01-29 10:42:31 +0000
@@ -123,8 +123,8 @@ 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, char *error_string);
+int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, char *error_string);
 
 struct st_VioSSLFd
 *new_VioSSLConnectorFd(const char *key_file, const char *cert_file,

=== modified file 'libmysqld/CMakeLists.txt'
--- a/libmysqld/CMakeLists.txt	2009-12-03 11:19:05 +0000
+++ b/libmysqld/CMakeLists.txt	2010-01-31 09:13:21 +0000
@@ -153,7 +153,7 @@ FILE(WRITE cmake_dummy.c " ")
 # custom targets to "sql/CMakeLists.txt" and reference them here.
 ADD_LIBRARY(mysqlserver STATIC ${LIBMYSQLD_SOURCES})
 ADD_DEPENDENCIES(mysqlserver GenServerSource GenError)
-TARGET_LINK_LIBRARIES(mysqlserver)
+TARGET_LINK_LIBRARIES(mysqlserver psapi.lib)
 
 # Add any additional libraries requested by engine(s)
 FOREACH (ENGINE_LIB ${MYSQLD_STATIC_ENGINE_LIBS})

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-01-27 17:41:05 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-02-10 19:06:24 +0000
@@ -413,7 +413,6 @@ sub main {
     # Not all tests completed, failure
     mtr_report();
     mtr_report("Only ", int(@$completed), " of $num_tests completed.");
-    mtr_error("Not all tests completed");
   }
 
   mtr_print_line();
@@ -425,6 +424,10 @@ sub main {
 
   mtr_report_stats($fail, $completed, $extra_warnings);
 
+  if ( @$completed != $num_tests)
+  {
+    mtr_error("Not all tests completed");
+  }
   exit(0);
 }
 
@@ -5539,6 +5542,8 @@ sub usage ($) {
   if ( $message )
   {
     print STDERR "$message\n";
+    print STDERR "For full list of options, use $0 --help\n";
+    exit;      
   }
 
   print <<HERE;

=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2009-10-27 10:09:36 +0000
+++ b/mysql-test/r/grant.result	2010-01-29 10:42:31 +0000
@@ -29,15 +29,15 @@ show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
 GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
-grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "Monty Program Ab";
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
-GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'Monty Program Ab' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
 GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
 revoke all privileges on mysqltest.* from mysqltest_1@localhost;
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
-GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'Monty Program Ab' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
 delete from mysql.user where user='mysqltest_1';
 flush privileges;
 delete from mysql.user where user='mysqltest_1';

=== modified file 'mysql-test/r/openssl_1.result'
--- a/mysql-test/r/openssl_1.result	2009-05-25 13:00:18 +0000
+++ b/mysql-test/r/openssl_1.result	2010-01-29 10:42:31 +0000
@@ -3,8 +3,10 @@ create table t1(f1 int);
 insert into t1 values (5);
 grant select on test.* to ssl_user1@localhost require SSL;
 grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@xxxxxxxxx";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@xxxxxxxxx" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user3@localhost require cipher
+"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx";
+grant select on test.* to ssl_user4@localhost require cipher
+"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx" ISSUER "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx";
 grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
 flush privileges;
 connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
@@ -44,9 +46,9 @@ 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 error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL error: ASN: bad other signature confirmation
+mysqltest: Could not open connection 'default': 2026 SSL error: ASN: bad other signature confirmation
 SSL error: Unable to get private key from ''
 mysqltest: Could not open connection 'default': 2026 SSL connection error
 SSL error: Unable to get certificate from ''

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2009-12-15 09:03:24 +0000
+++ b/mysql-test/r/show_check.result	2010-01-27 21:53:08 +0000
@@ -252,13 +252,11 @@ drop table t1;
 flush tables;
 show open tables;
 Database	Table	In_use	Name_locked
-mysql	general_log	0	0
 create table t1(n int);
 insert into t1 values (1);
 show open tables;
 Database	Table	In_use	Name_locked
 test	t1	0	0
-mysql	general_log	0	0
 drop table t1;
 create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
 show create table t1;

=== modified file 'mysql-test/r/sp-destruct.result'
--- a/mysql-test/r/sp-destruct.result	2009-11-21 11:18:21 +0000
+++ b/mysql-test/r/sp-destruct.result	2010-02-10 19:06:24 +0000
@@ -1,4 +1,5 @@
 call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+flush table mysql.proc;
 use test;
 drop procedure if exists bug14233;
 drop function if exists bug14233;

=== modified file 'mysql-test/r/table_elim.result'
--- a/mysql-test/r/table_elim.result	2009-09-16 19:05:03 +0000
+++ b/mysql-test/r/table_elim.result	2010-02-18 12:03:52 +0000
@@ -418,3 +418,49 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	
 1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using where
 drop table t1, t2;
+#
+# LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB
+#
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`col_int_nokey` int(11) DEFAULT NULL,
+`col_int_key` int(11) DEFAULT NULL,
+`col_date_key` date DEFAULT NULL,
+`col_date_nokey` date DEFAULT NULL,
+`col_time_key` time DEFAULT NULL,
+`col_time_nokey` time DEFAULT NULL,
+`col_datetime_key` datetime DEFAULT NULL,
+`col_datetime_nokey` datetime DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+`col_varchar_nokey` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `col_int_key` (`col_int_key`),
+KEY `col_date_key` (`col_date_key`),
+KEY `col_time_key` (`col_time_key`),
+KEY `col_datetime_key` (`col_datetime_key`),
+KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES 
+(10,7,8,NULL,NULL,'01:27:35','01:27:35','2002-02-26 06:14:37','2002-02-26 06:14:37','v','v'),
+(11,1,9,'2006-06-14','2006-06-14','19:48:31','19:48:31','1900-01-01 00:00:00','1900-01-01 00:00:00','r','r');
+INSERT INTO t2 SELECT * FROM t1;
+SELECT table2.col_int_key AS field1 
+FROM ( 
+t2 AS table1 
+RIGHT OUTER JOIN 
+( 
+( t1 AS table2 STRAIGHT_JOIN 
+t1 AS table3 ON (
+(table3.col_varchar_nokey = table2.col_varchar_key ) AND 
+(table3.pk = table2.col_int_key)) 
+)
+) ON 
+(
+(table3.col_varchar_key = table2.col_varchar_key) OR 
+(table3.col_int_key = table2.pk)
+)
+)
+HAVING field1 < 216;
+field1
+DROP TABLE t1, t2;

=== modified file 'mysql-test/r/udf.result'
--- a/mysql-test/r/udf.result	2010-01-11 13:15:28 +0000
+++ b/mysql-test/r/udf.result	2010-01-22 21:19:21 +0000
@@ -38,8 +38,6 @@ ERROR HY000: Can't initialize function '
 select reverse_lookup("127.0.0.1");
 select reverse_lookup(127,0,0,1);
 select reverse_lookup("localhost");
-reverse_lookup("localhost")
-NULL
 select avgcost();
 ERROR HY000: Can't initialize function 'avgcost'; wrong number of arguments: AVGCOST() requires two arguments
 select avgcost(100,23.76);

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2010-01-11 13:15:28 +0000
+++ b/mysql-test/r/variables.result	2010-02-10 19:06:24 +0000
@@ -1261,12 +1261,12 @@ ERROR HY000: Variable 'lower_case_table_
 #
 SHOW VARIABLES like 'myisam_recover_options';
 Variable_name	Value
-myisam_recover_options	OFF
+myisam_recover_options	DEFAULT
 SELECT @@session.myisam_recover_options;
 ERROR HY000: Variable 'myisam_recover_options' is a GLOBAL variable
 SELECT @@global.myisam_recover_options;
 @@global.myisam_recover_options
-OFF
+DEFAULT
 SET @@session.myisam_recover_options= 'x';
 ERROR HY000: Variable 'myisam_recover_options' is a read only variable
 SET @@global.myisam_recover_options= 'x';

=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2009-10-15 21:38:29 +0000
+++ b/mysql-test/r/view.result	2010-02-10 19:06:24 +0000
@@ -155,13 +155,13 @@ v5	VIEW
 v6	VIEW
 show table status;
 Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
-t1	MyISAM	10	Fixed	5	9	45	#	1024	0	NULL	#	#	NULL	latin1_swedish_ci	NULL		
-v1	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
-v2	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
-v3	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
-v4	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
-v5	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
-v6	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	NULL	NULL	NULL	NULL	VIEW
+t1	MyISAM	10	Fixed	5	9	45	#	1024	0	NULL	#	#	#	latin1_swedish_ci	NULL		
+v1	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
+v2	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
+v3	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
+v4	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
+v5	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
+v6	NULL	NULL	NULL	NULL	NULL	NULL	#	NULL	NULL	NULL	#	#	#	NULL	NULL	NULL	VIEW
 drop view v1,v2,v3,v4,v5,v6;
 create view v1 (c,d,e,f) as select a,b,
 a in (select a+2 from t1), a = all (select a from t1) from t1;

=== modified file 'mysql-test/std_data/cacert.pem'
--- a/mysql-test/std_data/cacert.pem	2009-06-11 16:21:32 +0000
+++ b/mysql-test/std_data/cacert.pem	2010-01-29 10:42:31 +0000
@@ -1,17 +1,19 @@
 -----BEGIN CERTIFICATE-----
-MIICrTCCAhagAwIBAgIJAJXpePU0UOTVMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
-BAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYD
-VQQKEwhNeVNRTCBBQjAeFw0wOTAxMjgxMDQ5NDZaFw0xNDAxMjcxMDQ5NDZaMEQx
-CzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxh
-MREwDwYDVQQKEwhNeVNRTCBBQjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
-4XQHAe5R1+TXC8noZtWf+d5E0v1C59FWpn9SWEUCBjE5UiIwuJvi4Y+7xWGOXLAI
-/JzJx5gNXLBiTsE/zh0uX9fKlajLhxB0GN+QU0ZlpQ1BeYipEcNXeI/7cT499f6v
-XWabnTflivdCgHSWUOQ20/Lzs6kP6/e6OoZd/DPSjPECAwEAAaOBpjCBozAdBgNV
-HQ4EFgQU8uLqVWWkmuKsnZf1RWz294wRrd8wdAYDVR0jBG0wa4AU8uLqVWWkmuKs
-nZf1RWz294wRrd+hSKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxh
-MRAwDgYDVQQHEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAJXpePU0UOTV
-MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAMMTE5sDN+Z0ZlV7KvH3g
-6+aKvql8dTpRT3hYukeQlWua0nq74WPGVw0c4e/M/vbiMwmJcCYpB9pd4+dHqzSw
-aPyoenjY6UF8n7B4quWy3SIUk2LSHeJLW+kzJn2afN9gvipFhdVh/uU2TIyLGOur
-Z/vmJX2W7hF1uqPnbfa8Lrw=
+MIIDIjCCAougAwIBAgIJAJhuvLP+2mGwMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNV
+BAYTAkZJMRAwDgYDVQQIEwdUdXVzdWxhMRkwFwYDVQQKExBNb250eSBQcm9ncmFt
+IEFiMS4wLAYJKoZIhvcNAQkBFh9hYnN0cmFjdC5kZXZlbG9wZXJAYXNrbW9udHku
+b3JnMB4XDTEwMDEyODIxNTcyNVoXDTEwMDIyNzIxNTcyNVowajELMAkGA1UEBhMC
+RkkxEDAOBgNVBAgTB1R1dXN1bGExGTAXBgNVBAoTEE1vbnR5IFByb2dyYW0gQWIx
+LjAsBgkqhkiG9w0BCQEWH2Fic3RyYWN0LmRldmVsb3BlckBhc2ttb250eS5vcmcw
+gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMIaY4pwbst50S32xJH3bSXhPGep
+6gx1AWwZKsHTXL3VeMO6PHmC8zu5HM0zbOcrIJcXL3YVnpmE4b9OQxIiMSx1Yd+U
+u8/sTkxgpsEKhCbIzECIwPhppyT/JP5aSXCadEvg+PSjikv8dOVkD68wVG4CcFIX
+MFttsPebBVzEokZZAgMBAAGjgc8wgcwwHQYDVR0OBBYEFOCKaNHFFPrju8AwzWxS
+f96IKfRwMIGcBgNVHSMEgZQwgZGAFOCKaNHFFPrju8AwzWxSf96IKfRwoW6kbDBq
+MQswCQYDVQQGEwJGSTEQMA4GA1UECBMHVHV1c3VsYTEZMBcGA1UEChMQTW9udHkg
+UHJvZ3JhbSBBYjEuMCwGCSqGSIb3DQEJARYfYWJzdHJhY3QuZGV2ZWxvcGVyQGFz
+a21vbnR5Lm9yZ4IJAJhuvLP+2mGwMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF
+BQADgYEAsmCX2/k9AInq2qhXtnkLip6cB0iOerLTNAzEijZc/aVf4wUjkL3cqhmC
+kSTCwAHIOxp+ICwh6ky3xghXjoI9QnPFDVkRkzPT2tV0IoBaeQuI4e0CU2EY7L3P
+XoDqp3oq1XtVcr9ZZdP68fBYUG/qcrWcXWk45ZFaBmBv3TotsGk=
 -----END CERTIFICATE-----

=== modified file 'mysql-test/std_data/client-cert.pem'
--- a/mysql-test/std_data/client-cert.pem	2009-06-11 16:21:32 +0000
+++ b/mysql-test/std_data/client-cert.pem	2010-01-29 10:42:31 +0000
@@ -1,55 +1,60 @@
 Certificate:
     Data:
         Version: 3 (0x2)
-        Serial Number: 3 (0x3)
+        Serial Number: 2 (0x2)
         Signature Algorithm: sha1WithRSAEncryption
-        Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+        Issuer: C=FI, ST=Tuusula, O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx
         Validity
-            Not Before: Jan 28 11:04:39 2009 GMT
-            Not After : Jan 28 11:04:39 2010 GMT
-        Subject: C=SE, ST=Uppsala, O=MySQL AB/emailAddress=abstract.mysql.developer@xxxxxxxxx
+            Not Before: Jan 28 22:01:38 2010 GMT
+            Not After : Dec  7 22:01:38 2019 GMT
+        Subject: C=FI, ST=Tuusula, O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-            RSA Public Key: (512 bit)
-                Modulus (512 bit):
-                    00:e1:52:30:2c:d9:be:64:28:91:5d:7a:fd:d9:e9:
-                    14:35:7a:d2:94:4e:91:46:e0:db:9f:6b:79:f4:4c:
-                    ac:6e:07:61:34:86:74:62:a7:a8:44:af:fa:87:87:
-                    a8:7d:42:61:ff:ab:50:d4:7b:bf:75:fa:d5:d5:b3:
-                    74:fb:56:1e:37
+            RSA Public Key: (1024 bit)
+                Modulus (1024 bit):
+                    00:bd:dc:3d:f8:3c:0b:d4:d2:c0:a3:9c:34:2d:e7:
+                    11:ff:4d:43:35:17:f6:0d:91:01:92:9e:4f:4d:c0:
+                    38:d5:62:03:55:33:db:66:a2:91:d3:f2:b6:23:34:
+                    95:53:50:3d:4f:e3:0c:d7:76:fd:f6:54:64:e6:f6:
+                    dc:70:74:7c:6b:74:41:59:b0:19:5d:62:90:3c:a7:
+                    c8:5e:21:8f:2b:22:6b:c7:43:9b:be:79:84:60:da:
+                    16:c9:ce:ee:fd:66:cb:54:81:e2:b5:1c:cf:f9:74:
+                    de:38:2b:28:d4:31:33:55:d2:30:1c:a3:e4:c2:c7:
+                    31:46:43:d5:33:3d:8a:0b:47
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Basic Constraints: 
                 CA:FALSE
+            Netscape Comment: 
+                OpenSSL Generated Certificate
             X509v3 Subject Key Identifier: 
-                58:30:B5:9B:2C:05:94:06:BA:3D:3C:F0:B2:CD:1D:67:65:E3:7F:85
+                BE:E6:DB:19:8D:DB:72:9A:85:EE:B2:B8:5D:E7:FF:61:DF:09:08:AF
             X509v3 Authority Key Identifier: 
-                keyid:F2:E2:EA:55:65:A4:9A:E2:AC:9D:97:F5:45:6C:F6:F7:8C:11:AD:DF
-                DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
-                serial:95:E9:78:F5:34:50:E4:D5
+                keyid:E0:8A:68:D1:C5:14:FA:E3:BB:C0:30:CD:6C:52:7F:DE:88:29:F4:70
 
     Signature Algorithm: sha1WithRSAEncryption
-        05:19:e3:13:14:fc:c5:28:bf:69:f8:00:b3:25:cb:bd:ca:9f:
-        2f:4c:b3:a8:04:11:f0:74:27:bd:82:2c:b4:49:9b:a7:59:f0:
-        f7:87:d1:e0:ba:99:a2:fe:4b:1d:10:6f:e4:a2:b3:cd:7f:8b:
-        68:31:46:ee:cd:9e:e2:47:e1:4c:fa:74:d1:e2:8b:cc:a0:4b:
-        a8:24:d1:a4:c3:6b:2a:c6:28:cd:41:e0:06:48:e6:cf:f2:3c:
-        ca:37:95:d7:29:64:6b:91:91:83:e7:ac:c8:0b:87:bc:da:a6:
-        aa:f1:44:43:c8:74:7b:15:26:91:2e:03:c4:71:50:6c:f8:68:
-        dc:8c
+        41:95:6d:0a:a4:ee:af:68:cd:94:26:59:9a:18:b7:75:3c:c5:
+        0f:22:d3:5c:31:9b:85:a0:93:b3:f0:50:29:ba:1e:d3:5a:43:
+        0b:77:2d:98:87:a7:a7:39:0f:40:8d:03:d3:b3:67:43:77:bc:
+        3c:51:c2:f9:9e:7a:2d:39:c4:5c:16:d7:70:d6:74:d1:6c:e1:
+        6a:4d:fd:1f:10:af:64:3b:f4:64:e9:b2:b3:fb:c8:cd:c5:41:
+        cd:99:e0:ac:83:1d:81:2c:6b:99:ba:80:02:12:72:f7:3b:bb:
+        93:72:00:da:ff:d3:87:75:d2:3a:a4:ca:4d:c1:8b:c1:21:50:
+        cb:57
 -----BEGIN CERTIFICATE-----
-MIICfzCCAeigAwIBAgIBAzANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUIwHhcNMDkwMTI4MTEwNDM5WhcNMTAwMTI4MTEwNDM5WjBlMQswCQYDVQQG
-EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxMTAvBgkq
-hkiG9w0BCQEWImFic3RyYWN0Lm15c3FsLmRldmVsb3BlckBteXNxbC5jb20wXDAN
-BgkqhkiG9w0BAQEFAANLADBIAkEA4VIwLNm+ZCiRXXr92ekUNXrSlE6RRuDbn2t5
-9EysbgdhNIZ0YqeoRK/6h4eofUJh/6tQ1Hu/dfrV1bN0+1YeNwIDAQABo4GjMIGg
-MAkGA1UdEwQCMAAwHQYDVR0OBBYEFFgwtZssBZQGuj088LLNHWdl43+FMHQGA1Ud
-IwRtMGuAFPLi6lVlpJrirJ2X9UVs9veMEa3foUikRjBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUKCCQCV6Xj1NFDk1TANBgkqhkiG9w0BAQUFAAOBgQAFGeMTFPzFKL9p+ACz
-Jcu9yp8vTLOoBBHwdCe9giy0SZunWfD3h9Hgupmi/ksdEG/korPNf4toMUbuzZ7i
-R+FM+nTR4ovMoEuoJNGkw2sqxijNQeAGSObP8jzKN5XXKWRrkZGD56zIC4e82qaq
-8URDyHR7FSaRLgPEcVBs+GjcjA==
+MIICxTCCAi6gAwIBAgIBAjANBgkqhkiG9w0BAQUFADBqMQswCQYDVQQGEwJGSTEQ
+MA4GA1UECBMHVHV1c3VsYTEZMBcGA1UEChMQTW9udHkgUHJvZ3JhbSBBYjEuMCwG
+CSqGSIb3DQEJARYfYWJzdHJhY3QuZGV2ZWxvcGVyQGFza21vbnR5Lm9yZzAeFw0x
+MDAxMjgyMjAxMzhaFw0xOTEyMDcyMjAxMzhaMGoxCzAJBgNVBAYTAkZJMRAwDgYD
+VQQIEwdUdXVzdWxhMRkwFwYDVQQKExBNb250eSBQcm9ncmFtIEFiMS4wLAYJKoZI
+hvcNAQkBFh9hYnN0cmFjdC5kZXZlbG9wZXJAYXNrbW9udHkub3JnMIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQC93D34PAvU0sCjnDQt5xH/TUM1F/YNkQGSnk9N
+wDjVYgNVM9tmopHT8rYjNJVTUD1P4wzXdv32VGTm9txwdHxrdEFZsBldYpA8p8he
+IY8rImvHQ5u+eYRg2hbJzu79ZstUgeK1HM/5dN44KyjUMTNV0jAco+TCxzFGQ9Uz
+PYoLRwIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NM
+IEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUvubbGY3bcpqF7rK4Xef/
+Yd8JCK8wHwYDVR0jBBgwFoAU4Ipo0cUU+uO7wDDNbFJ/3ogp9HAwDQYJKoZIhvcN
+AQEFBQADgYEAQZVtCqTur2jNlCZZmhi3dTzFDyLTXDGbhaCTs/BQKboe01pDC3ct
+mIenpzkPQI0D07NnQ3e8PFHC+Z56LTnEXBbXcNZ00Wzhak39HxCvZDv0ZOmys/vI
+zcVBzZngrIMdgSxrmbqAAhJy9zu7k3IA2v/Th3XSOqTKTcGLwSFQy1c=
 -----END CERTIFICATE-----

=== modified file 'mysql-test/std_data/client-key.pem'
--- a/mysql-test/std_data/client-key.pem	2009-06-11 16:21:32 +0000
+++ b/mysql-test/std_data/client-key.pem	2010-01-29 10:42:31 +0000
@@ -1,9 +1,15 @@
 -----BEGIN RSA PRIVATE KEY-----
-MIIBOQIBAAJBAOFSMCzZvmQokV16/dnpFDV60pROkUbg259refRMrG4HYTSGdGKn
-qESv+oeHqH1CYf+rUNR7v3X61dWzdPtWHjcCAwEAAQJAXYooM8ZlcuEgj+VKU1ee
-qyEFIMqJJxqcMk+E/nWCM96WxCP3zHNSrqNfSpI3ld7QzMwhdRz+gFLxT2gGNpIw
-MQIhAPxzM/lDihe67X3ADYtDl9ZjA8Pm430x9sXlcxI17tCZAiEA5H1SyFl4mUee
-9VnfSC2XGW7lwz72ZygfVX+b7tLWF08CIEh40gzW5MfXM+KLxdea+fXjyursV5ZT
-R6KcMiKiNQLRAiAcmHqlzFzFgisotai2Fc6VRkXHG7gmzOSvBJt1VjmpDQIge6jf
-2N7whTdvC4ferB+zUlgWQdyvx1c3T4gnt6PYdaY=
+MIICXgIBAAKBgQC93D34PAvU0sCjnDQt5xH/TUM1F/YNkQGSnk9NwDjVYgNVM9tm
+opHT8rYjNJVTUD1P4wzXdv32VGTm9txwdHxrdEFZsBldYpA8p8heIY8rImvHQ5u+
+eYRg2hbJzu79ZstUgeK1HM/5dN44KyjUMTNV0jAco+TCxzFGQ9UzPYoLRwIDAQAB
+AoGBAJa2lprPT7UJ99Ho1aL6ota/RnKHKtNqII17DgjyZis9OtgP6kJ3GrvdF6iq
+vT79my4nVrJTyxYXuGF/5U1/qqNjuPPBE1Xbu1ubQlFv8CT0kKYynQ7Z3ls8fAHC
+B3VJXnUVlG+GHtUEFFG4FQVX1fn/Sga67ioJ6ivAiBlHKaPBAkEA5f2ToWlj4u9O
+KgfRkN54wdIp4yu2c40pbhMfKGjGGsBAHk92+qSBpzEmxLcI6Ay+4/QysSR4jYmK
+jCJuxiTu1QJBANNU3Hx8Il2SF/2BqGLcIh2SHxzKQIT5wAyD2jb+P2cHvbk6pKGR
+VTmw5bibxXmYMS6J/L2zUF2xtFe+Svwz96sCQEnKYSqBqOWvyBFeLtPfPTlal8vm
+Q4SxfuBtTCrn6t+8XRYcgt0KGPsunvSwkS/6nuh+eiExxWgMACLUDVyPjv0CQQC4
+sJJc7LOv6Oy0bWr2swHRrBEqvQsz63zOszCzHPHWHirNxZV5aiT8XT/2XZRwlvRs
+gsVyGFLk/1fn0vN/g/8vAkEAxUdzUKvC1ZwjzGhgcz2bQU0tEZN4C9jBCiwOI2ud
+BpAsPG0xAGGL2+hz0B0n88XiTHobiTZ1bg4Z41i4pXx2ZA==
 -----END RSA PRIVATE KEY-----

=== modified file 'mysql-test/std_data/server-cert.pem'
--- a/mysql-test/std_data/server-cert.pem	2009-06-11 16:21:32 +0000
+++ b/mysql-test/std_data/server-cert.pem	2010-01-29 10:42:31 +0000
@@ -3,53 +3,59 @@ Certificate:
         Version: 3 (0x2)
         Serial Number: 1 (0x1)
         Signature Algorithm: sha1WithRSAEncryption
-        Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+        Issuer: C=FI, ST=Tuusula, O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx
         Validity
-            Not Before: Jan 28 10:55:13 2009 GMT
-            Not After : Jan 28 10:55:13 2010 GMT
-        Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=localhost/emailAddress=abstract.mysql.developer@xxxxxxxxx
+            Not Before: Jan 28 21:59:14 2010 GMT
+            Not After : Dec  7 21:59:14 2019 GMT
+        Subject: C=FI, ST=Tuusula, O=Monty Program Ab, CN=localhost/emailAddress=abstract.developer@xxxxxxxxxxxx
         Subject Public Key Info:
             Public Key Algorithm: rsaEncryption
-            RSA Public Key: (512 bit)
-                Modulus (512 bit):
-                    00:b6:8f:e5:b7:b4:86:83:13:8a:f9:bf:63:cb:64:
-                    2d:b9:51:d1:de:ab:7b:45:1f:aa:b5:66:73:13:f9:
-                    a6:07:d5:ba:7c:fa:92:bd:37:e2:ad:87:db:3e:b6:
-                    6a:12:64:f8:ee:17:e3:15:06:2f:a8:82:68:bf:57:
-                    8d:c3:04:98:27
+            RSA Public Key: (1024 bit)
+                Modulus (1024 bit):
+                    00:cc:79:74:2a:14:7e:77:06:b0:ec:1b:b6:da:70:
+                    4c:4f:0e:94:04:8a:e7:69:f4:4c:9c:67:22:41:56:
+                    3a:96:53:9e:95:9d:17:55:80:41:c0:13:d6:94:0f:
+                    cd:2c:51:fe:a4:6e:f2:74:d8:5d:3b:3a:80:e3:85:
+                    5b:a5:bc:7d:5c:25:55:e5:40:77:fe:f3:cb:5b:cd:
+                    da:a5:f4:36:64:30:a2:a0:7f:93:b3:c4:56:75:2a:
+                    c0:f7:65:2a:d7:e6:ff:88:25:03:e0:b4:40:2e:74:
+                    4c:cb:46:95:73:cb:25:5c:87:0e:ec:0f:5a:19:c2:
+                    b6:dc:9e:e8:f0:30:b1:9c:99
                 Exponent: 65537 (0x10001)
         X509v3 extensions:
             X509v3 Basic Constraints: 
                 CA:FALSE
+            Netscape Comment: 
+                OpenSSL Generated Certificate
             X509v3 Subject Key Identifier: 
-                D9:9A:B8:5F:22:EA:04:10:C8:25:7D:82:57:E6:2E:FD:19:29:E7:DA
+                6D:13:3B:40:52:3C:AF:18:EA:33:D1:B7:56:21:1B:05:FE:0B:9E:38
             X509v3 Authority Key Identifier: 
-                keyid:F2:E2:EA:55:65:A4:9A:E2:AC:9D:97:F5:45:6C:F6:F7:8C:11:AD:DF
-                DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
-                serial:95:E9:78:F5:34:50:E4:D5
+                keyid:E0:8A:68:D1:C5:14:FA:E3:BB:C0:30:CD:6C:52:7F:DE:88:29:F4:70
 
     Signature Algorithm: sha1WithRSAEncryption
-        54:07:2d:21:0b:a5:af:3b:58:23:32:5e:56:7f:ab:58:63:48:
-        91:aa:38:90:89:16:f9:cc:bf:a4:0e:78:2b:9f:c5:1b:58:a6:
-        e6:08:8f:2e:ae:97:03:21:9b:f1:cd:c0:26:8f:1d:d7:28:27:
-        a0:8e:81:09:1b:1c:0f:c9:a5:41:3a:2d:44:3f:9c:fa:87:ff:
-        c8:4c:2b:44:f7:1b:c1:3e:4f:01:7f:e9:26:cc:9f:1c:06:b5:
-        0b:27:d1:10:90:be:93:0c:9c:e7:b0:d1:ea:27:99:4e:06:14:
-        0c:7a:e9:c1:52:c5:33:68:bc:61:0d:db:81:3b:57:48:57:bf:
-        42:9a
+        97:db:65:23:7f:f1:15:3c:1e:83:ac:0e:0a:50:a0:0c:22:b8:
+        45:d4:ca:21:05:47:3b:3d:03:b5:6c:4b:8d:bb:5f:57:c3:c7:
+        4e:71:23:cf:33:a3:7f:a0:3d:bd:58:75:b8:37:22:16:2f:e9:
+        ed:ae:9b:94:29:81:6e:34:79:cf:41:bd:3d:8d:17:d7:22:1c:
+        1b:58:c7:0f:79:13:56:1d:e8:d8:4e:e5:07:3f:79:1b:dd:c4:
+        06:9b:c5:b6:02:34:43:c5:bf:e5:87:ad:f1:c1:8a:f2:be:c2:
+        00:1d:d4:27:1f:87:c8:80:31:ec:6e:97:95:b4:84:40:d1:73:
+        42:71
 -----BEGIN CERTIFICATE-----
-MIICkzCCAfygAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
-MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
-UUwgQUIwHhcNMDkwMTI4MTA1NTEzWhcNMTAwMTI4MTA1NTEzWjB5MQswCQYDVQQG
-EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNV
-BAMTCWxvY2FsaG9zdDExMC8GCSqGSIb3DQEJARYiYWJzdHJhY3QubXlzcWwuZGV2
-ZWxvcGVyQG15c3FsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC2j+W3tIaD
-E4r5v2PLZC25UdHeq3tFH6q1ZnMT+aYH1bp8+pK9N+Kth9s+tmoSZPjuF+MVBi+o
-gmi/V43DBJgnAgMBAAGjgaMwgaAwCQYDVR0TBAIwADAdBgNVHQ4EFgQU2Zq4XyLq
-BBDIJX2CV+Yu/Rkp59owdAYDVR0jBG0wa4AU8uLqVWWkmuKsnZf1RWz294wRrd+h
-SKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdV
-cHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAJXpePU0UOTVMA0GCSqGSIb3DQEB
-BQUAA4GBAFQHLSELpa87WCMyXlZ/q1hjSJGqOJCJFvnMv6QOeCufxRtYpuYIjy6u
-lwMhm/HNwCaPHdcoJ6COgQkbHA/JpUE6LUQ/nPqH/8hMK0T3G8E+TwF/6SbMnxwG
-tQsn0RCQvpMMnOew0eonmU4GFAx66cFSxTNovGEN24E7V0hXv0Ka
+MIIC2TCCAkKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBqMQswCQYDVQQGEwJGSTEQ
+MA4GA1UECBMHVHV1c3VsYTEZMBcGA1UEChMQTW9udHkgUHJvZ3JhbSBBYjEuMCwG
+CSqGSIb3DQEJARYfYWJzdHJhY3QuZGV2ZWxvcGVyQGFza21vbnR5Lm9yZzAeFw0x
+MDAxMjgyMTU5MTRaFw0xOTEyMDcyMTU5MTRaMH4xCzAJBgNVBAYTAkZJMRAwDgYD
+VQQIEwdUdXVzdWxhMRkwFwYDVQQKExBNb250eSBQcm9ncmFtIEFiMRIwEAYDVQQD
+Ewlsb2NhbGhvc3QxLjAsBgkqhkiG9w0BCQEWH2Fic3RyYWN0LmRldmVsb3BlckBh
+c2ttb250eS5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMx5dCoUfncG
+sOwbttpwTE8OlASK52n0TJxnIkFWOpZTnpWdF1WAQcAT1pQPzSxR/qRu8nTYXTs6
+gOOFW6W8fVwlVeVAd/7zy1vN2qX0NmQwoqB/k7PEVnUqwPdlKtfm/4glA+C0QC50
+TMtGlXPLJVyHDuwPWhnCttye6PAwsZyZAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJ
+YIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1Ud
+DgQWBBRtEztAUjyvGOoz0bdWIRsF/gueODAfBgNVHSMEGDAWgBTgimjRxRT647vA
+MM1sUn/eiCn0cDANBgkqhkiG9w0BAQUFAAOBgQCX22Ujf/EVPB6DrA4KUKAMIrhF
+1MohBUc7PQO1bEuNu19Xw8dOcSPPM6N/oD29WHW4NyIWL+ntrpuUKYFuNHnPQb09
+jRfXIhwbWMcPeRNWHejYTuUHP3kb3cQGm8W2AjRDxb/lh63xwYryvsIAHdQnH4fI
+gDHsbpeVtIRA0XNCcQ==
 -----END CERTIFICATE-----

=== modified file 'mysql-test/std_data/server-key.pem'
--- a/mysql-test/std_data/server-key.pem	2009-06-11 16:21:32 +0000
+++ b/mysql-test/std_data/server-key.pem	2010-01-29 10:42:31 +0000
@@ -1,9 +1,15 @@
 -----BEGIN RSA PRIVATE KEY-----
-MIIBOQIBAAJBALaP5be0hoMTivm/Y8tkLblR0d6re0UfqrVmcxP5pgfVunz6kr03
-4q2H2z62ahJk+O4X4xUGL6iCaL9XjcMEmCcCAwEAAQJASA5VwgNb0CKHiPm0ntOk
-hG+54SRX3DmafEy6gRjZIl/bZ/asSLhXUZ+CeohyrQh7BZgYWvykd8pRISL9eKsU
-GQIhAOXkUrOtP/EtjyqNluEqZdG+RZi/7p61JS3Ce13Myu+LAiEAy0uMlV34AJpM
-b40FPKqlHxw8DD/Dt1iKhNVAg8+LDVUCIFjv7fbJDbW2VG63/Cj8CAwOukoP5rbL
-iaicVrHBKrllAiB9+MiaXeopZXNrxDS0jQFYr8Q9yt1aJVFgUkxx4Q9HKQIgZPs0
-KlF3NNNWw78INaAEkyf0IEssnLMsuoCWw0DIOak=
+MIICXgIBAAKBgQDMeXQqFH53BrDsG7bacExPDpQEiudp9EycZyJBVjqWU56VnRdV
+gEHAE9aUD80sUf6kbvJ02F07OoDjhVulvH1cJVXlQHf+88tbzdql9DZkMKKgf5Oz
+xFZ1KsD3ZSrX5v+IJQPgtEAudEzLRpVzyyVchw7sD1oZwrbcnujwMLGcmQIDAQAB
+AoGBAMdMYkNZsmJFbVDVOobzCg3Mgc1jrmeBrOKNS8AvUe+QFXRyp3m5B102eOHb
+/PmD+hU/5qao9UZzoYkiRM/oRq45jrqJEYwWrX007bKK0F9hnErtC1ImM1nBFVhx
+6+6cr+ShUkvtj8+wJ2d5bIccUzGCUfFR5tb5BnePTXK8IVoBAkEA7WGNxHAVKgjS
+AzlpHr5fvpivA07hNVJizTwZdWGGYeETilZhkkuMRwREceeohF6ILMf0FTZdFSa/
+8EeLa3icIQJBANyDKFjynKwWy5pyRSz75mVwrEi+4eTQPsCPNWLkbpbEPwqPLYWJ
+2VSFkISXF7b7Od48JkQWgiB8/kXqMDEdsXkCQQCzZvj3ryWvoP7nhOoXXBWMPGR4
+gZLe86bMKVGsTsp7CtnzwRj4sbQQr/7yfvvzHmaYQX4M0gtDQwfolomd7YdBAkEA
+y24ETuqjNu9grf81aiaJipPDnOjcJOcovSRgr/blPxmUvv0Pld5yLNN7W5a4PgrO
+fAMpmi7ZpXcqbP17sBQgoQJAWTDFKAmfHPVdDGZuCw4yceP5d+Tv7ABglZUvpPKx
+kAvGN1WBASUuCQJDOIgzl6gvYX07S5p147i9mv7UBWOpvw==
 -----END RSA PRIVATE KEY-----

=== modified file 'mysql-test/suite/maria/r/maria3.result'
--- a/mysql-test/suite/maria/r/maria3.result	2009-09-18 01:04:43 +0000
+++ b/mysql-test/suite/maria/r/maria3.result	2010-02-12 14:21:13 +0000
@@ -301,7 +301,7 @@ check table t1 extended;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 drop table t1;
-show variables like 'maria%';
+select lower(variable_name) as Variable_name, Variable_value as Value from information_schema.session_variables where variable_name like "maria%" and variable_name not like "maria_used_for_temp_tables" order by 1;
 Variable_name	Value
 maria_block_size	8192
 maria_checkpoint_interval	30
@@ -309,16 +309,15 @@ maria_force_start_after_recovery_failure
 maria_log_file_size	4294959104
 maria_log_purge_type	immediate
 maria_max_sort_file_size	9223372036853727232
-maria_page_checksum	OFF
 maria_pagecache_age_threshold	300
 maria_pagecache_buffer_size	8384512
 maria_pagecache_division_limit	100
+maria_page_checksum	OFF
 maria_recover	OFF
 maria_repair_threads	1
 maria_sort_buffer_size	8388608
 maria_stats_method	nulls_unequal
 maria_sync_log_dir	NEWFILE
-maria_used_for_temp_tables	ON
 show status like 'maria%';
 Variable_name	Value
 Maria_pagecache_blocks_not_flushed	#

=== modified file 'mysql-test/suite/maria/t/maria-recovery2-master.opt'
--- a/mysql-test/suite/maria/t/maria-recovery2-master.opt	2009-01-15 14:29:14 +0000
+++ b/mysql-test/suite/maria/t/maria-recovery2-master.opt	2010-02-10 19:06:24 +0000
@@ -1 +1 @@
---skip-stack-trace --skip-core-file --loose-maria-log-dir-path=$MYSQLTEST_VARDIR/tmp
+--skip-stack-trace --skip-core-file --loose-maria-log-dir-path=$MYSQLTEST_VARDIR/tmp --myisam-recover=

=== modified file 'mysql-test/suite/maria/t/maria3.test'
--- a/mysql-test/suite/maria/t/maria3.test	2009-06-02 09:58:27 +0000
+++ b/mysql-test/suite/maria/t/maria3.test	2010-02-12 14:21:13 +0000
@@ -259,7 +259,7 @@ drop table t1;
 
 # Fix if we are using safemalloc
 --replace_result 8388572 8388600
-show variables like 'maria%';
+select lower(variable_name) as Variable_name, Variable_value as Value from information_schema.session_variables where variable_name like "maria%" and variable_name not like "maria_used_for_temp_tables" order by 1;
 --replace_column 2 #
 show status like 'maria%';
 

=== added file 'mysql-test/suite/parts/t/partition_repair_myisam-master.opt'
--- a/mysql-test/suite/parts/t/partition_repair_myisam-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_repair_myisam-master.opt	2010-02-10 21:26:06 +0000
@@ -0,0 +1 @@
+--myisam-recover=off

=== modified file 'mysql-test/suite/rpl/t/rpl_rotate_logs.test'
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2009-03-12 09:48:41 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2010-01-27 21:53:08 +0000
@@ -153,7 +153,7 @@ disable_query_log;
 while ($1)
 {
 #eval means expand $ expressions
- eval insert into t3 values($1 + 4);
+ eval insert HIGH_PRIORITY into t3 values($1 + 4);
  dec $1;
 }
 enable_query_log;

=== modified file 'mysql-test/t/grant.test'
--- a/mysql-test/t/grant.test	2009-06-15 15:53:45 +0000
+++ b/mysql-test/t/grant.test	2010-01-29 10:42:31 +0000
@@ -35,7 +35,7 @@ revoke delete on mysqltest.* from mysqlt
 show grants for mysqltest_1@localhost;
 grant select on mysqltest.* to mysqltest_1@localhost require NONE;
 show grants for mysqltest_1@localhost;
-grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "Monty Program Ab";
 show grants for mysqltest_1@localhost;
 revoke all privileges on mysqltest.* from mysqltest_1@localhost;
 show grants for mysqltest_1@localhost;

=== modified file 'mysql-test/t/openssl_1.test'
--- a/mysql-test/t/openssl_1.test	2009-05-25 13:00:18 +0000
+++ b/mysql-test/t/openssl_1.test	2010-01-29 10:42:31 +0000
@@ -15,8 +15,10 @@ insert into t1 values (5);
 
 grant select on test.* to ssl_user1@localhost require SSL;
 grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@xxxxxxxxx";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@xxxxxxxxx" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
+grant select on test.* to ssl_user3@localhost require cipher
+"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx";
+grant select on test.* to ssl_user4@localhost require cipher
+"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx" ISSUER "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@xxxxxxxxxxxx";
 grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
 flush privileges;
 

=== modified file 'mysql-test/t/partition_innodb_semi_consistent.test'
--- a/mysql-test/t/partition_innodb_semi_consistent.test	2009-01-13 22:12:16 +0000
+++ b/mysql-test/t/partition_innodb_semi_consistent.test	2010-01-28 14:49:14 +0000
@@ -187,6 +187,7 @@ SELECT * FROM t1;
 
 --echo # Switch to connection con2
 connection con2;
+--reap
 SELECT * FROM t1;
 
 connection default;

=== modified file 'mysql-test/t/query_cache_debug.test'
--- a/mysql-test/t/query_cache_debug.test	2009-09-07 20:50:10 +0000
+++ b/mysql-test/t/query_cache_debug.test	2010-01-29 10:42:31 +0000
@@ -1,5 +1,4 @@
 --source include/not_embedded.inc
---source include/big_test.inc
 --source include/have_query_cache.inc
 --source include/have_debug.inc
 

=== modified file 'mysql-test/t/show_check-master.opt'
--- a/mysql-test/t/show_check-master.opt	2009-12-03 11:19:05 +0000
+++ b/mysql-test/t/show_check-master.opt	2010-01-27 21:53:08 +0000
@@ -1 +1 @@
---log-output=table --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="" --slow-query-log-file=""
+--log-output=file --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="foo" --slow-query-log-file=""

=== modified file 'mysql-test/t/sp-destruct.test'
--- a/mysql-test/t/sp-destruct.test	2009-11-21 11:18:21 +0000
+++ b/mysql-test/t/sp-destruct.test	2010-02-10 19:06:24 +0000
@@ -17,6 +17,7 @@ call mtr.add_suppression("Column count o
 
 # Backup proc table
 let $MYSQLD_DATADIR= `select @@datadir`;
+flush table mysql.proc;
 --copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
 --copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
 --copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI

=== modified file 'mysql-test/t/table_elim.test'
--- a/mysql-test/t/table_elim.test	2009-09-16 19:05:03 +0000
+++ b/mysql-test/t/table_elim.test	2010-02-18 12:03:52 +0000
@@ -336,3 +336,54 @@ select t1.* 
 from t1 left join t2 on (t2.pk=3 and t2.b=3) or (t2.pk= 4 and t2.b=3);
 
 drop table t1, t2;
+
+--echo #
+--echo # LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB
+--echo #
+
+CREATE TABLE t1 (
+  `pk` int(11) NOT NULL AUTO_INCREMENT,
+  `col_int_nokey` int(11) DEFAULT NULL,
+  `col_int_key` int(11) DEFAULT NULL,
+  `col_date_key` date DEFAULT NULL,
+  `col_date_nokey` date DEFAULT NULL,
+  `col_time_key` time DEFAULT NULL,
+  `col_time_nokey` time DEFAULT NULL,
+  `col_datetime_key` datetime DEFAULT NULL,
+  `col_datetime_nokey` datetime DEFAULT NULL,
+  `col_varchar_key` varchar(1) DEFAULT NULL,
+  `col_varchar_nokey` varchar(1) DEFAULT NULL,
+  PRIMARY KEY (`pk`),
+  KEY `col_int_key` (`col_int_key`),
+  KEY `col_date_key` (`col_date_key`),
+  KEY `col_time_key` (`col_time_key`),
+  KEY `col_datetime_key` (`col_datetime_key`),
+  KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+);
+CREATE TABLE t2 LIKE t1;
+
+INSERT INTO t1 VALUES 
+ (10,7,8,NULL,NULL,'01:27:35','01:27:35','2002-02-26 06:14:37','2002-02-26 06:14:37','v','v'),
+ (11,1,9,'2006-06-14','2006-06-14','19:48:31','19:48:31','1900-01-01 00:00:00','1900-01-01 00:00:00','r','r');
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT table2.col_int_key AS field1 
+FROM ( 
+  t2 AS table1 
+  RIGHT OUTER JOIN 
+  ( 
+    ( t1 AS table2 STRAIGHT_JOIN 
+      t1 AS table3 ON (
+               (table3.col_varchar_nokey = table2.col_varchar_key ) AND 
+               (table3.pk = table2.col_int_key)) 
+    )
+  ) ON 
+    (
+      (table3.col_varchar_key = table2.col_varchar_key) OR 
+      (table3.col_int_key = table2.pk)
+    )
+)
+HAVING field1 < 216;
+
+DROP TABLE t1, t2;
+

=== modified file 'mysql-test/t/udf.test'
--- a/mysql-test/t/udf.test	2010-01-11 13:15:28 +0000
+++ b/mysql-test/t/udf.test	2010-01-22 21:19:21 +0000
@@ -56,9 +56,9 @@ select reverse_lookup();
 --disable_result_log
 select reverse_lookup("127.0.0.1");
 select reverse_lookup(127,0,0,1);
+select reverse_lookup("localhost");
 --enable_result_log
 
-select reverse_lookup("localhost");
 --error ER_CANT_INITIALIZE_UDF
 select avgcost();
 --error ER_CANT_INITIALIZE_UDF

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2009-10-15 21:38:29 +0000
+++ b/mysql-test/t/view.test	2010-02-10 19:06:24 +0000
@@ -87,7 +87,7 @@ explain extended select c from v6;
 # show table/table status test
 show tables;
 show full tables;
---replace_column 8 # 12 # 13 #
+--replace_column 8 # 12 # 13 # 14 #
 show table status;
 
 drop view v1,v2,v3,v4,v5,v6;

=== modified file 'mysys/my_file.c'
--- a/mysys/my_file.c	2006-12-23 19:20:40 +0000
+++ b/mysys/my_file.c	2010-01-28 11:35:10 +0000
@@ -51,7 +51,7 @@ static uint set_max_open_files(uint max_
     DBUG_PRINT("info", ("rlim_cur: %u  rlim_max: %u",
 			(uint) rlimit.rlim_cur,
 			(uint) rlimit.rlim_max));
-    if (rlimit.rlim_cur == RLIM_INFINITY)
+    if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY)
       rlimit.rlim_cur = max_file_limit;
     if (rlimit.rlim_cur >= max_file_limit)
       DBUG_RETURN(rlimit.rlim_cur);		/* purecov: inspected */

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2009-12-03 11:19:05 +0000
+++ b/mysys/my_thr_init.c	2010-01-29 18:42:22 +0000
@@ -317,7 +317,7 @@ my_bool my_thread_init(void)
   /*
     Skip initialization if the thread specific variable is already initialized
   */
-  if (THR_KEY_mysys.id)
+  if (THR_KEY_mysys.init)
     goto end;
   tmp= &THR_KEY_mysys;
 #endif

=== modified file 'sql-bench/bench-init.pl.sh'
--- a/sql-bench/bench-init.pl.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/bench-init.pl.sh	2010-02-10 21:26:06 +0000
@@ -39,8 +39,8 @@ require "$pwd/server-cfg" || die "Can't 
 
 $|=1;				# Output data immediately
 
-$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=0;
-$opt_cmp=$opt_user=$opt_password=$opt_connect_options="";
+$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=$opt_temporary_tables=0;
+$opt_cmp=$opt_user=$opt_password=$opt_connect_options=$opt_connect_command= "";
 $opt_server="mysql"; $opt_dir="output";
 $opt_host="localhost";$opt_database="test";
 $opt_machine=""; $opt_suffix="";
@@ -59,7 +59,7 @@ $log_prog_args=join(" ", skip_arguments(
 					"use-old-results","skip-test",
 					"optimization","hw",
 					"machine", "dir", "suffix", "log"));
-GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","only-missing-tests") || usage();
+GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","connect-command=s","only-missing-tests","temporary-tables") || usage();
 
 usage() if ($opt_help);
 $server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc,
@@ -454,6 +454,9 @@ All benchmarks takes the following optio
   create all MySQL tables as InnoDB tables use:
   --create-options=ENGINE=InnoDB
 
+--temporary-tables
+  Use temporary tables for all tests.
+
 --database (Default $opt_database)
   In which database the test tables are created.
 
@@ -595,6 +598,10 @@ All benchmarks takes the following optio
   Add options, which uses at DBI connect.
   For example --connect-options=mysql_read_default_file=/etc/my.cnf.
 
+--connect-command='SQL command'
+  Initialization command to execute when logged in. Useful for setting
+  up the environment.
+
 EOF
   exit(0);
 }

=== modified file 'sql-bench/server-cfg.sh'
--- a/sql-bench/server-cfg.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/server-cfg.sh	2010-02-10 21:26:06 +0000
@@ -159,6 +159,7 @@ sub new
   $limits{'max_index'}		= 16; # Max number of keys
   $limits{'max_index_parts'}	= 16; # Max segments/key
   $limits{'max_tables'}		= (($machine || '') =~ "^win") ? 5000 : 65000;
+  $limits{'max_temporary_tables'}= 400;
   $limits{'max_text_size'}	= 1000000; # Good enough for tests
   $limits{'multi_drop'}		= 1; # Drop table can take many tables
   $limits{'order_by_position'}  = 1; # Can use 'ORDER BY 1'
@@ -189,6 +190,7 @@ sub new
     $self->{'transactions'}	= 1;	# Transactions enabled
     $limits{'max_columns'}	= 90;	# Max number of columns in table
     $limits{'max_tables'}	= 32;   # No comments
+    $limits{'max_temporary_tables'}= $limits{"max_tables"};
   }
   if (defined($main::opt_create_options) &&
       $main::opt_create_options =~ /engine=bdb/i)
@@ -200,6 +202,7 @@ sub new
   {
     $limits{'working_blobs'}	= 0; # Blobs not implemented yet
     $limits{'max_tables'}	= 500;
+    $limits{'max_temporary_tables'}= $limits{"max_tables"};
     $self->{'transactions'}	= 1;	# Transactions enabled
   }
 
@@ -249,6 +252,11 @@ sub connect
 		      die "Got error: '$DBI::errstr' when connecting to " . $self->{'data_source'} ." with user: '$main::opt_user' password: '$main::opt_password'\n";
 
   $dbh->do("SET OPTION LOG_OFF=1,UPDATE_LOG=0");
+  if ($main::opt_connect_command ne "")
+  {
+    $dbh->do($main::opt_connect_command) or
+      die "Can't execute connect_command: $main::opt_connect_command  error: $DBI::errstr\n";
+  }
   return $dbh;
 }
 
@@ -265,7 +273,14 @@ sub create
   my($self,$table_name,$fields,$index,$options) = @_;
   my($query,@queries);
 
-  $query="create table $table_name (";
+  if ($main::opt_temporary_tables)
+  {
+    $query="create temporary table $table_name (";
+  }
+  else
+  {
+    $query="create table $table_name (";
+  }
   foreach $field (@$fields)
   {
 #    $field =~ s/ decimal/ double(10,2)/i;
@@ -388,6 +403,7 @@ sub new
   $limits{'max_conditions'}	= 74;
   $limits{'max_columns'}	= 75;
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 32000;
   $limits{'query_size'}		= 65535;
   $limits{'max_index'}		= 5;
@@ -617,7 +633,9 @@ sub new
   $limits{'max_conditions'}	= 9999;		# This makes Pg real slow
   $limits{'max_index'}		= 64;		# Big enough
   $limits{'max_index_parts'}	= 16;
-  $limits{'max_tables'}		= 5000;		# 10000 crashes pg 7.0.2
+  $limits{'max_tables'}		= 65000;
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 65000;	# Good enough for test
   $limits{'multi_drop'}		= 1;
   $limits{'order_by_position'}  = 1;
@@ -868,6 +886,8 @@ sub new
   $limits{'max_conditions'}	= 9999;		# Probably big enough
   $limits{'max_columns'}	= 2000;		# From crash-me
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 65492;	# According to tests
   $limits{'query_size'}		= 65535;	# Probably a limit
   $limits{'max_index'}		= 64;		# Probably big enough
@@ -1099,6 +1119,7 @@ sub new
 			# above this value .... but can handle 2419 columns
 			# maybe something for crash-me ... but how to check ???
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 4095;		# max returned ....
   $limits{'query_size'}		= 65535;	# Not a limit, big enough
   $limits{'max_index'}		= 64;		# Big enough
@@ -1369,6 +1390,8 @@ sub new
   $limits{'max_conditions'}	= 9999; # (Actually not a limit)
   $limits{'max_columns'}	= 254;	# Max number of columns in table
   $limits{'max_tables'}		= 65000; # Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 2000; # Limit for blob test-connect
   $limits{'query_size'}		= 65525; # Max size with default buffers.
   $limits{'max_index'}		= 16; # Max number of keys
@@ -1642,6 +1665,8 @@ sub new
   $limits{'max_column_name'}	= 18; # max table and column name
   $limits{'max_columns'}	= 994;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_index'}		= 64; # Max number of keys
   $limits{'max_index_parts'}	= 15; # Max segments/key
   $limits{'max_text_size'}	= 65535;  # Max size with default buffers. ??
@@ -1830,6 +1855,8 @@ sub new
   $limits{'max_conditions'}	= 97; # We get 'Query is too complex'
   $limits{'max_columns'}	= 255;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 255;  # Max size with default buffers.
   $limits{'query_size'}		= 65535; # Not a limit, big enough
   $limits{'max_index'}		= 32; # Max number of keys
@@ -2015,6 +2042,8 @@ sub new
   $limits{'max_conditions'}	= 1030; # We get 'Query is too complex'
   $limits{'max_columns'}	= 250;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 9830;  # Max size with default buffers.
   $limits{'query_size'}		= 9830; # Max size with default buffers.
   $limits{'max_index'}		= 64; # Max number of keys
@@ -2211,6 +2240,8 @@ sub new
   $limits{'max_conditions'}	= 1030; # We get 'Query is too complex'
   $limits{'max_columns'}	= 250;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 9830;  # Max size with default buffers.
   $limits{'query_size'}		= 9830; # Max size with default buffers.
   $limits{'max_index'}		= 64; # Max number of keys
@@ -2443,6 +2474,8 @@ sub new
   $limits{'max_conditions'}	= 50; # (Actually not a limit)
   $limits{'max_columns'}	= 254;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 2000; # Limit for blob test-connect
   $limits{'query_size'}		= 65525; # Max size with default buffers.
   $limits{'max_index'}		= 16; # Max number of keys
@@ -2647,6 +2680,8 @@ sub new
   $limits{'max_conditions'}	= 418; # We get 'Query is too complex'
   $limits{'max_columns'}	= 500;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
+
   $limits{'max_text_size'}	= 254;  # Max size with default buffers.
   $limits{'query_size'}		= 254; # Max size with default buffers.
   $limits{'max_index'}		= 48; # Max number of keys
@@ -2825,6 +2860,7 @@ sub new
   $limits{'max_conditions'}	= 9999; # (Actually not a limit)
   $limits{'max_columns'}	= 252;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 15000; # Max size with default buffers.
   $limits{'query_size'}		= 1000000; # Max size with default buffers.
   $limits{'max_index'}		= 32; # Max number of keys
@@ -3027,6 +3063,7 @@ sub new
   $limits{'max_conditions'}	= 9999; # (Actually not a limit)
   $limits{'max_columns'}	= 252;	# Max number of columns in table
   $limits{'max_tables'}		= 65000;	# Should be big enough
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 15000; # Max size with default buffers.
   $limits{'query_size'}		= 1000000; # Max size with default buffers.
   $limits{'max_index'}		= 65000; # Max number of keys
@@ -3223,6 +3260,7 @@ sub new
   # The following should be 8192, but is smaller because Frontbase crashes..
   $limits{'max_columns'}	= 150;	# Max number of columns in table
   $limits{'max_tables'}		= 5000;	# 10000 crashed FrontBase
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 65000; # Max size with default buffers.
   $limits{'query_size'}		= 8000000; # Max size with default buffers.
   $limits{'max_index'}		= 38; # Max number of keys
@@ -3435,6 +3473,7 @@ sub new
   $limits{'max_conditions'}	= 9999; # (Actually not a limit) *
   $limits{'max_columns'}	= 1023;	# Max number of columns in table *
   $limits{'max_tables'}		= 65000;	# Should be big enough * unlimited actually
+  $limits{'max_temporary_tables'}= $limits{"max_tables"};
   $limits{'max_text_size'}	= 15000; # Max size with default buffers. 
   $limits{'query_size'}		= 64*1024; # Max size with default buffers. *64 kb by default. May be set by system variable 
   $limits{'max_index'}		= 510; # Max number of keys *

=== modified file 'sql-bench/test-ATIS.sh'
--- a/sql-bench/test-ATIS.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-ATIS.sh	2010-02-17 20:10:02 +0000
@@ -28,7 +28,7 @@ use Cwd;
 use DBI;
 use Benchmark;
 
-$opt_loop_count=100;		# Run selects this many times
+$opt_loop_count=5000;		# Run selects this many times
 
 $pwd = cwd(); $pwd = "." if ($pwd eq '');
 require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";

=== modified file 'sql-bench/test-alter-table.sh'
--- a/sql-bench/test-alter-table.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-alter-table.sh	2010-02-17 20:10:02 +0000
@@ -25,7 +25,7 @@ use DBI;
 use Benchmark;
 
 $opt_start_field_count=8;	# start with this many fields
-$opt_loop_count=100;		# How many tests to do
+$opt_loop_count=10000;		# How many tests to do
 $opt_row_count=1000; 		# Rows in the table
 $opt_field_count=1000;		# Add until this many fields.
 $opt_time_limit=10*60;		# Don't wait more than 10 min for some tests

=== modified file 'sql-bench/test-big-tables.sh'
--- a/sql-bench/test-big-tables.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-big-tables.sh	2010-02-17 20:10:02 +0000
@@ -25,7 +25,7 @@ use Cwd;
 use DBI;
 use Benchmark;
 
-$opt_loop_count=1000; # Change this to make test harder/easier
+$opt_loop_count=70000; # Change this to make test harder/easier
 $opt_field_count=1000;
 
 $pwd = cwd(); $pwd = "." if ($pwd eq '');

=== modified file 'sql-bench/test-connect.sh'
--- a/sql-bench/test-connect.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-connect.sh	2010-02-17 20:10:02 +0000
@@ -28,7 +28,7 @@ use Cwd;
 use DBI;
 use Benchmark;
 
-$opt_loop_count=100000;	# Change this to make test harder/easier
+$opt_loop_count=500000;	# Change this to make test harder/easier
 $str_length=65000;	# This is the length of blob strings in PART:5
 $max_test=20;		# How many times to test if the server is busy
 
@@ -161,41 +161,48 @@ if ($opt_fast && defined($server->{vacuu
 {
   $server->vacuum(0,\$dbh);
 }
-$dbh->disconnect;
+if (!$main::opt_temporary_tables)
+{
+    $dbh->disconnect;
+}
 
 #
 # First test connect/select/disconnect
 #
-print "Testing connect/select 1 row from table/disconnect\n";
+if (!$main::opt_temporary_tables)
+{
+  print "Testing connect/select 1 row from table/disconnect\n";
 
-$loop_time=new Benchmark;
-$errors=0;
+  $loop_time=new Benchmark;
+  $errors=0;
 
-for ($i=0 ; $i < $small_loop_count ; $i++)
-{
-  for ($j=0; $j < $max_test ; $j++)
+  for ($i=0 ; $i < $small_loop_count ; $i++)
   {
-    last if ($dbh = DBI->connect($server->{'data_source'}, $opt_user, $opt_password));
-    $errors++;
-  }
-  die $DBI::errstr if ($j == $max_test);
+    for ($j=0; $j < $max_test ; $j++)
+    {
+        last if ($dbh = DBI->connect($server->{'data_source'}, $opt_user, $opt_password));
+        $errors++;
+    }
+    die $DBI::errstr if ($j == $max_test);
 
-  $sth = $dbh->do("select a,i,s,$i from bench1") # Select * from table with 1 record
+    $sth = $dbh->do("select a,i,s,$i from bench1") # Select * from table with 1 record
     or die $DBI::errstr;
-  $dbh->disconnect;
-}
+    $dbh->disconnect;
+  }
 
-$end_time=new Benchmark;
-print "Warning: $errors connections didn't work without a time delay\n" if ($errors);
-print "Time to connect+select_1_row ($small_loop_count): " .
+  $end_time=new Benchmark;
+  print "Warning: $errors connections didn't work without a time delay\n" if ($errors);
+  print "Time to connect+select_1_row ($small_loop_count): " .
   timestr(timediff($end_time, $loop_time),"all") . "\n\n";
 
+  $dbh = $server->connect();
+}
+
 #
 # The same test, but without connect/disconnect
 #
 print "Testing select 1 row from table\n";
 
-$dbh = $server->connect();
 $loop_time=new Benchmark;
 
 for ($i=0 ; $i < $opt_loop_count ; $i++)

=== modified file 'sql-bench/test-create.sh'
--- a/sql-bench/test-create.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-create.sh	2010-02-10 21:26:06 +0000
@@ -47,7 +47,15 @@ if ($opt_small_test)
   $create_loop_count/=1000;
 }
 
-$max_tables=min($limits->{'max_tables'},$opt_loop_count);
+if ($opt_temporary_tables)
+{
+    $max_tables=min($limits->{'max_tables'},$opt_loop_count);
+}
+else
+{
+  $max_tables=min($limits->{'max_tables'},$opt_loop_count);
+  $max_tables=400;
+}
 
 if ($opt_small_test)
 {
@@ -71,7 +79,7 @@ $dbh = $server->connect();
 if ($opt_force) # If tables used in this test exist, drop 'em
 {
   print "Okay..Let's make sure that our tables don't exist yet.\n\n";
-  for ($i=1 ; $i <= $max_tables ; $i++)
+  for ($i=1 ; $i <= max($max_tables, $create_loop_count) ; $i++)
   {
     $dbh->do("drop table bench_$i" . $server->{'drop_attr'});
   }
@@ -245,7 +253,7 @@ for ($i=2 ; $i <= $keys ; $i++)
 }
 
 $loop_time=new Benchmark;
-for ($i=1 ; $i <= $opt_loop_count ; $i++)
+for ($i=1 ; $i <= $create_loop_count ; $i++)
 {
   do_many($dbh,$server->create("bench_$i", \@fields, \@keys));
   $dbh->do("drop table bench_$i" . $server->{'drop_attr'}) or die $DBI::errstr;

=== modified file 'sql-bench/test-select.sh'
--- a/sql-bench/test-select.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-select.sh	2010-02-17 20:10:02 +0000
@@ -26,7 +26,7 @@ use Getopt::Long;
 use Benchmark;
 
 $opt_loop_count=10000;
-$opt_medium_loop_count=1000;
+$opt_medium_loop_count=7000;
 $opt_small_loop_count=10;
 $opt_regions=6;
 $opt_groups=100;

=== modified file 'sql-bench/test-transactions.sh'
--- a/sql-bench/test-transactions.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-transactions.sh	2010-02-17 20:10:02 +0000
@@ -28,8 +28,8 @@ use Benchmark;
 
 $opt_groups=27;		    # Characters are 'A' -> Z
 
-$opt_loop_count=10000;	    # Change this to make test harder/easier
-$opt_medium_loop_count=100; # Change this to make test harder/easier
+$opt_loop_count=500000;	    # Change this to make test harder/easier
+$opt_medium_loop_count=10000; # Change this to make test harder/easier
 
 $pwd = cwd(); $pwd = "." if ($pwd eq '');
 require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";

=== modified file 'sql-bench/test-wisconsin.sh'
--- a/sql-bench/test-wisconsin.sh	2009-05-29 13:40:55 +0000
+++ b/sql-bench/test-wisconsin.sh	2010-02-17 20:10:02 +0000
@@ -21,7 +21,7 @@ use Cwd;
 use DBI;
 use Benchmark;
 
-$opt_loop_count=10;
+$opt_loop_count=5000;
 
 $pwd = cwd(); $pwd = "." if ($pwd eq '');
 require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2009-12-03 15:26:54 +0000
+++ b/sql-common/client.c	2010-01-29 18:42:22 +0000
@@ -1863,6 +1863,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 		       uint port, const char *unix_socket,ulong client_flag)
 {
   char		buff[NAME_LEN+USERNAME_LENGTH+100];
+  char		error_string[1024];
   char		*end,*host_info= NULL;
   my_socket	sock;
   in_addr_t	ip_addr;
@@ -1939,7 +1940,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 #if defined(HAVE_SMEM)
   if ((!mysql->options.protocol ||
        mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) &&
-      (!host || !strcmp(host,LOCAL_HOST)))
+      (!host || !strcmp(host,LOCAL_HOST)) &&
+      mysql->options.shared_memory_base_name)
   {
     if ((create_shared_memory(mysql,net, mysql->options.connect_timeout)) ==
 	INVALID_HANDLE_VALUE)
@@ -1948,7 +1950,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 		 ("host: '%s'  socket: '%s'  shared memory: %s  have_tcpip: %d",
 		  host ? host : "<null>",
 		  unix_socket ? unix_socket : "<null>",
-		  (int) mysql->options.shared_memory_base_name,
+		  mysql->options.shared_memory_base_name,
 		  (int) have_tcpip));
       if (mysql->options.protocol == MYSQL_PROTOCOL_MEMORY)
 	goto error;
@@ -2331,9 +2333,14 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
     /* Connect to the server */
     DBUG_PRINT("info", ("IO layer change in progress..."));
     if (sslconnect(ssl_fd, mysql->net.vio,
-                   (long) (mysql->options.connect_timeout)))
+                   (long) (mysql->options.connect_timeout),
+                   error_string))
     {
-      set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR,
+                               unknown_sqlstate,
+                               "SSL error: %s",
+                               error_string[0] ? error_string :
+                               ER(CR_SSL_CONNECTION_ERROR));
       goto error;
     }
     DBUG_PRINT("info", ("IO layer change done!"));
@@ -2746,6 +2753,13 @@ void mysql_detach_stmt_list(LIST **stmt_
 }
 
 
+/*
+  Close a MySQL connection and free all resources attached to it.
+
+  This function is coded in such that it can be called multiple times
+  (As some clients call this after mysql_real_connect() fails)
+*/
+
 void STDCALL mysql_close(MYSQL *mysql)
 {
   DBUG_ENTER("mysql_close");
@@ -2779,10 +2793,16 @@ void STDCALL mysql_close(MYSQL *mysql)
     }
 #endif
     if (mysql != mysql->master)
+    {
       mysql_close(mysql->master);
+      mysql->master= 0;
+    }
 #ifndef MYSQL_SERVER
     if (mysql->thd)
+    {
       (*mysql->methods->free_embedded_thd)(mysql);
+      mysql->thd= 0;
+    }
 #endif
     if (mysql->free_me)
       my_free((uchar*) mysql,MYF(0));

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2009-12-03 11:19:05 +0000
+++ b/sql/CMakeLists.txt	2010-01-29 18:42:22 +0000
@@ -97,7 +97,7 @@ SET_TARGET_PROPERTIES(mysqld PROPERTIES 
 
 SET (MYSQLD_CORE_LIBS mysys zlib dbug strings yassl taocrypt vio regex sql libevent)
 TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_CORE_LIBS} ${MYSQLD_STATIC_ENGINE_LIBS})
-TARGET_LINK_LIBRARIES(mysqld ws2_32.lib)
+TARGET_LINK_LIBRARIES(mysqld ws2_32.lib psapi.lib)
 
 
 IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-01-15 15:27:55 +0000
+++ b/sql/item.cc	2010-01-27 21:53:08 +0000
@@ -7119,7 +7119,7 @@ double Item_cache_decimal::val_real()
   DBUG_ASSERT(fixed);
   double res;
   if (!value_cached && !cache_value())
-    return NULL;
+    return 0.0;
   my_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &res);
   return res;
 }

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	2009-10-15 21:38:29 +0000
+++ b/sql/lock.cc	2010-02-10 19:06:24 +0000
@@ -1049,10 +1049,14 @@ int lock_table_name(THD *thd, TABLE_LIST
     DBUG_RETURN(-1);
 
   table_list->table=table;
+  table->s->deleting= table_list->deleting;
 
   /* Return 1 if table is in use */
   DBUG_RETURN(test(remove_table_from_cache(thd, db, table_list->table_name,
-             check_in_use ? RTFC_NO_FLAG : RTFC_WAIT_OTHER_THREAD_FLAG)));
+                                           (check_in_use ?
+                                            RTFC_NO_FLAG :
+                                            RTFC_WAIT_OTHER_THREAD_FLAG),
+                                           table_list->deleting)));
 }
 
 

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-12-03 11:19:05 +0000
+++ b/sql/mysql_priv.h	2010-02-10 19:06:24 +0000
@@ -1636,7 +1636,7 @@ uint prep_alter_part_table(THD *thd, TAB
 #define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
 #define RTFC_CHECK_KILLED_FLAG      0x0004
 bool remove_table_from_cache(THD *thd, const char *db, const char *table,
-                             uint flags);
+                             uint flags, my_bool deleting);
 
 #define NORMAL_PART_NAME 0
 #define TEMP_PART_NAME 1

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-01-15 15:27:55 +0000
+++ b/sql/mysqld.cc	2010-02-11 19:15:24 +0000
@@ -598,6 +598,7 @@ char *mysqld_unix_port, *opt_mysql_tmpdi
 const char **errmesg;			/**< Error messages */
 const char *myisam_recover_options_str="OFF";
 const char *myisam_stats_method_str="nulls_unequal";
+const char *opt_thread_handling= thread_handling_typelib.type_names[0];
 
 /** name of reference on left espression in rewritten IN subquery */
 const char *in_left_expr_name= "<left expr>";
@@ -1173,11 +1174,14 @@ static void __cdecl kill_server(int sig_
   /*
    Send event to smem_event_connect_request for aborting
    */
-  if (!SetEvent(smem_event_connect_request))
+  if (opt_enable_shared_memory)
   {
-    DBUG_PRINT("error",
-               ("Got error: %ld from SetEvent of smem_event_connect_request",
-                GetLastError()));
+    if (!SetEvent(smem_event_connect_request))
+    {
+      DBUG_PRINT("error",
+                 ("Got error: %ld from SetEvent of smem_event_connect_request",
+                  GetLastError()));
+    }
   }
 #endif
 
@@ -2704,7 +2708,7 @@ static void init_signals(void)
   {
     /* Change limits so that we will get a core file */
     STRUCT_RLIMIT rl;
-    rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
+    rl.rlim_cur = rl.rlim_max = (rlim_t) RLIM_INFINITY;
     if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
       sql_print_warning("setrlimit could not change the size of core files to 'infinity';  We may not be able to generate a core file on signals");
   }
@@ -7287,7 +7291,8 @@ The minimum value for this variable is 4
    1024, 0},
   {"thread_handling", OPT_THREAD_HANDLING,
    "Define threads usage for handling queries:  "
-   "one-thread-per-connection or no-threads", 0, 0,
+   "one-thread-per-connection or no-threads",
+   (uchar**) &opt_thread_handling, (uchar**) &opt_thread_handling,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"updatable_views_with_limit", OPT_UPDATABLE_VIEWS_WITH_LIMIT,
    "1 = YES = Don't issue an error message (warning only) if a VIEW without presence of a key of the underlying table is used in queries with a LIMIT clause for updating. 0 = NO = Prohibit update of a VIEW, which does not contain a key of the underlying table and the query uses a LIMIT clause (usually get from GUI tools).",
@@ -7959,7 +7964,13 @@ static int mysql_init_variables(void)
   refresh_version= 1L;	/* Increments on each reload */
   global_query_id= thread_id= 1L;
   strmov(server_version, MYSQL_SERVER_VERSION);
-  myisam_recover_options_str= sql_mode_str= "OFF";
+  sql_mode_str= "";
+
+  /* By default, auto-repair MyISAM tables after crash */
+  myisam_recover_options_str= "DEFAULT";
+  myisam_recover_options=     HA_RECOVER_DEFAULT;
+  ha_open_options|= HA_OPEN_ABORT_IF_CRASHED;
+
   myisam_stats_method_str= "nulls_unequal";
   my_bind_addr = htonl(INADDR_ANY);
   threads.empty();
@@ -8613,26 +8624,31 @@ mysqld_get_one_option(int optid,
 #endif
   case OPT_MYISAM_RECOVER:
   {
-    if (!argument)
-    {
-      myisam_recover_options=    HA_RECOVER_DEFAULT;
-      myisam_recover_options_str= myisam_recover_typelib.type_names[0];
-    }
-    else if (!argument[0])
+    if (argument && (!argument[0] ||
+                     my_strcasecmp(system_charset_info, argument, "OFF") == 0))
     {
       myisam_recover_options= HA_RECOVER_NONE;
       myisam_recover_options_str= "OFF";
+      ha_open_options&= ~HA_OPEN_ABORT_IF_CRASHED;
     }
     else
     {
-      myisam_recover_options_str=argument;
-      myisam_recover_options=
-        find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name,
-                              &error);
-      if (error)
-        return 1;
+      if (!argument)
+      {
+        myisam_recover_options=     HA_RECOVER_DEFAULT;
+        myisam_recover_options_str= myisam_recover_typelib.type_names[0];
+      }
+      else
+      {
+        myisam_recover_options_str=argument;
+        myisam_recover_options=
+          find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name,
+                                &error);
+        if (error)
+          return 1;
+      }
+      ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
     }
-    ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
     break;
   }
   case OPT_CONCURRENT_INSERT:
@@ -8707,14 +8723,15 @@ mysqld_get_one_option(int optid,
     break;
   }
   case OPT_ONE_THREAD:
-    global_system_variables.thread_handling=
-      SCHEDULER_ONE_THREAD_PER_CONNECTION;
+    global_system_variables.thread_handling= SCHEDULER_NO_THREADS;
+    opt_thread_handling= thread_handling_typelib.type_names[global_system_variables.thread_handling];
     break;
   case OPT_THREAD_HANDLING:
   {
     int id;
     if (!find_opt_type(argument, &thread_handling_typelib, opt->name, &id))
       global_system_variables.thread_handling= id - 1;
+    opt_thread_handling= thread_handling_typelib.type_names[global_system_variables.thread_handling];
     break;
   }
   case OPT_FT_BOOLEAN_SYNTAX:

=== modified file 'sql/net_serv.cc'
--- a/sql/net_serv.cc	2009-09-07 20:50:10 +0000
+++ b/sql/net_serv.cc	2010-01-29 10:42:31 +0000
@@ -219,7 +219,7 @@ my_bool net_realloc(NET *net, size_t len
     -1   Don't know if data is ready or not
 */
 
-#if !defined(EMBEDDED_LIBRARY)
+#if !defined(EMBEDDED_LIBRARY) && defined(DBUG_OFF)
 
 static int net_data_is_ready(my_socket sd)
 {
@@ -280,13 +280,18 @@ static int net_data_is_ready(my_socket s
 
 void net_clear(NET *net, my_bool clear_buffer)
 {
-#if !defined(EMBEDDED_LIBRARY)
+#if !defined(EMBEDDED_LIBRARY) && defined(DBUG_OFF)
   size_t count;
   int ready;
 #endif
   DBUG_ENTER("net_clear");
 
-#if !defined(EMBEDDED_LIBRARY)
+/*
+  We don't do a clear in case of DBUG_OFF to catch bugs
+  in the protocol handling
+*/
+
+#if !defined(EMBEDDED_LIBRARY) && defined(DBUG_OFF)
   if (clear_buffer)
   {
     while ((ready= net_data_is_ready(net->vio->sd)) > 0)

=== modified file 'sql/opt_table_elimination.cc'
--- a/sql/opt_table_elimination.cc	2009-09-16 19:05:03 +0000
+++ b/sql/opt_table_elimination.cc	2010-02-18 12:03:52 +0000
@@ -1220,8 +1220,16 @@ void build_eq_mods_for_cond(Dep_analysis
           bound_item= item;
       }
     }
-    exchange_sort<Dep_value_field>(fvl, compare_field_values, NULL);
-    add_module_expr(ctx, eq_mod, *and_level, NULL, bound_item, fvl);
+    /* 
+      Multiple equality is only useful if it includes at least one field from
+      the table that we could potentially eliminate:
+    */
+    if (fvl->elements)
+    {
+      
+      exchange_sort<Dep_value_field>(fvl, compare_field_values, NULL);
+      add_module_expr(ctx, eq_mod, *and_level, NULL, bound_item, fvl);
+    }
     break;
   }
   default:

=== modified file 'sql/rpl_record.cc'
--- a/sql/rpl_record.cc	2009-10-22 00:15:45 +0000
+++ b/sql/rpl_record.cc	2010-01-28 11:35:10 +0000
@@ -366,7 +366,6 @@ int prepare_record(TABLE *const table, 
   */
   for (Field **field_ptr= table->field+skip; *field_ptr; ++field_ptr)
   {
-    uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG;
     Field *const f= *field_ptr;
     if ((f->flags &  NO_DEFAULT_VALUE_FLAG) &&
         (f->real_type() != MYSQL_TYPE_ENUM))

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-12-06 17:51:48 +0000
+++ b/sql/slave.cc	2010-01-29 10:42:31 +0000
@@ -3803,10 +3803,11 @@ static int connect_to_master(THD* thd, M
       suppress_warnings= 0;
       mi->report(ERROR_LEVEL, last_errno,
                  "error %s to master '%s@%s:%d'"
-                 " - retry-time: %d  retries: %lu",
+                 " - retry-time: %d  retries: %lu  message: %s",
                  (reconnect ? "reconnecting" : "connecting"),
                  mi->user, mi->host, mi->port,
-                 mi->connect_retry, master_retry_count);
+                 mi->connect_retry, master_retry_count,
+                 mysql_error(mysql));
     }
     /*
       By default we try forever. The reason is that failure will trigger

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-01-15 15:27:55 +0000
+++ b/sql/sql_base.cc	2010-02-10 19:06:24 +0000
@@ -930,7 +930,7 @@ bool close_cached_tables(THD *thd, TABLE
     for (TABLE_LIST *table= tables; table; table= table->next_local)
     {
       if (remove_table_from_cache(thd, table->db, table->table_name,
-                                  RTFC_OWNED_BY_THD_FLAG))
+                                  RTFC_OWNED_BY_THD_FLAG, table->deleting))
 	found=1;
     }
     if (!found)
@@ -8404,6 +8404,11 @@ void remove_db_from_cache(const char *db
     if (!strcmp(table->s->db.str, db))
     {
       table->s->version= 0L;			/* Free when thread is ready */
+      /*
+        This functions only called from DROP DATABASE code, so we are going
+        to drop all tables so we mark them as deleting
+      */
+      table->s->deleting= TRUE;
       if (!table->in_use)
 	relink_unused(table);
     }
@@ -8446,7 +8451,7 @@ void flush_tables()
 */
 
 bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
-                             uint flags)
+                             uint flags, my_bool deleting)
 {
   char key[MAX_DBKEY_LENGTH];
   uint key_length;
@@ -8540,7 +8545,10 @@ bool remove_table_from_cache(THD *thd, c
       }
     }
     while (unused_tables && !unused_tables->s->version)
+    {
+      unused_tables->s->deleting= deleting;
       VOID(hash_delete(&open_cache,(uchar*) unused_tables));
+    }
 
     DBUG_PRINT("info", ("Removing table from table_def_cache"));
     /* Remove table from table definition cache if it's not in use */
@@ -8734,7 +8742,8 @@ int abort_and_upgrade_lock(ALTER_PARTITI
   /* If MERGE child, forward lock handling to parent. */
   mysql_lock_abort(lpt->thd, lpt->table->parent ? lpt->table->parent :
                    lpt->table, TRUE);
-  VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags));
+  VOID(remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name, flags,
+                               FALSE));
   VOID(pthread_mutex_unlock(&LOCK_open));
   DBUG_RETURN(0);
 }
@@ -8759,7 +8768,7 @@ void close_open_tables_and_downgrade(ALT
 {
   VOID(pthread_mutex_lock(&LOCK_open));
   remove_table_from_cache(lpt->thd, lpt->db, lpt->table_name,
-                          RTFC_WAIT_OTHER_THREAD_FLAG);
+                          RTFC_WAIT_OTHER_THREAD_FLAG, FALSE);
   VOID(pthread_mutex_unlock(&LOCK_open));
   /* If MERGE child, forward lock handling to parent. */
   mysql_lock_downgrade_write(lpt->thd, lpt->table->parent ? lpt->table->parent :

=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc	2010-01-15 15:27:55 +0000
+++ b/sql/sql_cache.cc	2010-01-29 10:42:31 +0000
@@ -377,9 +377,11 @@ TODO list:
 
 static void debug_wait_for_kill(const char *info)
 {
-  DBUG_ENTER("debug_wait_for_kill");
   const char *prev_info;
   THD *thd;
+  char buff[1024];
+  DBUG_ENTER("debug_wait_for_kill");
+
   thd= current_thd;
   prev_info= thd->proc_info;
   thd->proc_info= info;
@@ -387,8 +389,16 @@ static void debug_wait_for_kill(const ch
   while(!thd->killed)
     my_sleep(1000);
   thd->killed= THD::NOT_KILLED;
+  /*
+    Remove the set debug variable, to ensure we don't get stuck on it again
+    This is needed as for MyISAM, invalidate_table() may be called twice
+    (Once from mysql_delete() and once from mi_update_status())
+  */
+  sprintf(buff, "-d,%s", info);
+  DBUG_SET(buff);
   sql_print_information("Exit debug_wait_for_kill");
   thd->proc_info= prev_info;
+
   DBUG_VOID_RETURN;
 }
 
@@ -914,15 +924,18 @@ void query_cache_insert(NET *net, const 
 
 void query_cache_abort(NET *net)
 {
+  THD *thd;
   DBUG_ENTER("query_cache_abort");
-  THD *thd= current_thd;
 
   /* See the comment on double-check locking usage above. */
   if (net->query_cache_query == 0)
     DBUG_VOID_RETURN;
 
   if (query_cache.try_lock())
+  {
+    net->query_cache_query = 0;
     DBUG_VOID_RETURN;
+  }
 
   /*
     While we were waiting another thread might have changed the status
@@ -932,6 +945,7 @@ void query_cache_abort(NET *net)
                                    net->query_cache_query);
   if (query_block)
   {
+    thd= current_thd;
     thd_proc_info(thd, "storing result in query cache");
     DUMP(&query_cache);
     BLOCK_LOCK_WR(query_block);
@@ -941,6 +955,7 @@ void query_cache_abort(NET *net)
     DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1););
   }
 
+  DBUG_ASSERT(!net->query_cache_query);
   query_cache.unlock();
   DBUG_VOID_RETURN;
 }
@@ -970,8 +985,12 @@ void query_cache_end_of_result(THD *thd)
 #endif
 
   if (query_cache.try_lock())
+  {
+    thd->net.query_cache_query= 0;
     DBUG_VOID_RETURN;
+  }
 
+  /* thd->net.query_cache_query may have changed during resize */
   query_block= ((Query_cache_block*) thd->net.query_cache_query);
   if (query_block)
   {
@@ -997,8 +1016,8 @@ void query_cache_end_of_result(THD *thd)
         to this function. In the release version that query should be ignored
         and removed from QC.
       */
-      DBUG_ASSERT(0);
       query_cache.free_query(query_block);
+      thd->net.query_cache_query= 0;
       query_cache.unlock();
       DBUG_VOID_RETURN;
     }

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2009-12-03 11:19:05 +0000
+++ b/sql/sql_connect.cc	2010-01-29 10:42:31 +0000
@@ -798,6 +798,7 @@ static int check_connection(THD *thd)
   DBUG_PRINT("info", ("client capabilities: %lu", thd->client_capabilities));
   if (thd->client_capabilities & CLIENT_SSL)
   {
+    char error_string[1024];
     /* Do the SSL layering. */
     if (!ssl_acceptor_fd)
     {
@@ -806,7 +807,7 @@ static int check_connection(THD *thd)
       return 1;
     }
     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, error_string))
     {
       DBUG_PRINT("error", ("Failed to accept new SSL connection"));
       inc_host_errors(&thd->remote.sin_addr);

=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc	2010-01-15 15:27:55 +0000
+++ b/sql/sql_delete.cc	2010-02-10 19:06:24 +0000
@@ -1088,6 +1088,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST
   HA_CREATE_INFO create_info;
   char path[FN_REFLEN + 1];
   TABLE *table;
+  TABLE_LIST *tbl;
   bool error;
   uint path_length;
   bool is_temporary_table= false;
@@ -1108,6 +1109,9 @@ bool mysql_truncate(THD *thd, TABLE_LIST
     if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
       goto trunc_by_del;
 
+    for (tbl= table_list; tbl; tbl= tbl->next_local)
+      tbl->deleting= TRUE; /* to trigger HA_PREPARE_FOR_DROP */
+
     table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
 
     create_info.options|= HA_LEX_CREATE_TMP_TABLE;

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-01-15 15:27:55 +0000
+++ b/sql/sql_parse.cc	2010-01-29 10:42:31 +0000
@@ -1252,12 +1252,14 @@ bool dispatch_command(enum enum_server_c
       ha_maria::implicit_commit(thd, FALSE);
 #endif
 
-      net_end_statement(thd);
-      query_cache_end_of_result(thd);
       /*
         Multiple queries exits, execute them individually
       */
       close_thread_tables(thd);
+
+      net_end_statement(thd);
+      query_cache_end_of_result(thd);
+
       ulong length= (ulong)(packet_end - beginning_of_next_stmt);
 
       log_slow_statement(thd);
@@ -1645,13 +1647,22 @@ bool dispatch_command(enum enum_server_c
   ha_maria::implicit_commit(thd, FALSE);
 #endif
 
-  net_end_statement(thd);
-  query_cache_end_of_result(thd);
-
+  if (!(sql_command_flags[thd->lex->sql_command] & CF_CHANGES_DATA))
+  {
+    /* No changes in data;  We can send ok at once to the client */
+    net_end_statement(thd);
+    query_cache_end_of_result(thd);
+  }
   thd->proc_info= "closing tables";
   /* Free tables */
   close_thread_tables(thd);
 
+  if (sql_command_flags[thd->lex->sql_command] & CF_CHANGES_DATA)
+  {
+    net_end_statement(thd);
+    query_cache_end_of_result(thd);
+  }
+
   log_slow_statement(thd);
 
   thd_proc_info(thd, "cleaning up");

=== modified file 'sql/sql_profile.cc'
--- a/sql/sql_profile.cc	2009-10-15 21:38:29 +0000
+++ b/sql/sql_profile.cc	2010-01-29 18:42:22 +0000
@@ -131,6 +131,23 @@ int make_profile_table_for_show(THD *thd
 #define RUSAGE_USEC(tv)  ((tv).tv_sec*1000*1000 + (tv).tv_usec)
 #define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
 
+#ifdef __WIN__
+inline ULONGLONG FileTimeToQuadWord(FILETIME *ft)
+{
+  ULONGLONG nrv = 0;
+  nrv |= ft->dwHighDateTime;
+  nrv <<= 32;
+  nrv |= ft->dwLowDateTime;
+  return nrv;
+}
+
+
+// Get time difference between to FILETIME objects in seconds.
+inline double GetTimeDiffInSeconds(FILETIME *a, FILETIME *b)
+{
+  return ((FileTimeToQuadWord(a) - FileTimeToQuadWord(b)) / 1e7);
+}
+#endif /* __WIN__ */
 
 PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, const char
                                    *status_arg)
@@ -221,6 +238,11 @@ void PROF_MEASUREMENT::collect()
   time_usecs= (double) my_getsystime() / 10.0;  /* 1 sec was 1e7, now is 1e6 */
 #ifdef HAVE_GETRUSAGE
   getrusage(RUSAGE_SELF, &rusage);
+#elif defined(__WIN__)
+  FILETIME ftDummy;
+  GetProcessTimes(GetCurrentProcess(), &ftDummy, &ftDummy, &ftKernel, &ftUser);
+  GetProcessIoCounters(GetCurrentProcess(), &io_count);
+  GetProcessMemoryInfo(GetCurrentProcess(), &mem_count, sizeof(mem_count));
 #endif
 }
 
@@ -590,6 +612,23 @@ int PROFILING::fill_statistics_info(THD 
       table->field[5]->store_decimal(&cpu_stime_decimal);
       table->field[4]->set_notnull();
       table->field[5]->set_notnull();
+#elif defined(__WIN__)
+      my_decimal cpu_utime_decimal, cpu_stime_decimal;
+
+      double2my_decimal(E_DEC_FATAL_ERROR,
+                        GetTimeDiffInSeconds(&entry->ftUser,
+                                             &previous->ftUser),
+                        &cpu_utime_decimal);
+      double2my_decimal(E_DEC_FATAL_ERROR,
+                        GetTimeDiffInSeconds(&entry->ftKernel,
+                                             &previous->ftKernel),
+                        &cpu_stime_decimal);
+
+      // Store the result.
+      table->field[4]->store_decimal(&cpu_utime_decimal);
+      table->field[5]->store_decimal(&cpu_stime_decimal);
+      table->field[4]->set_notnull();
+      table->field[5]->set_notnull();
 #else
       /* TODO: Add CPU-usage info for non-BSD systems */
 #endif
@@ -612,6 +651,17 @@ int PROFILING::fill_statistics_info(THD 
       table->field[9]->store((uint32)(entry->rusage.ru_oublock -
                              previous->rusage.ru_oublock));
       table->field[9]->set_notnull();
+#elif defined(__WIN__)
+      ULONGLONG reads_delta = entry->io_count.ReadOperationCount - 
+                              previous->io_count.ReadOperationCount;
+      ULONGLONG writes_delta = entry->io_count.WriteOperationCount - 
+                              previous->io_count.WriteOperationCount;
+
+      table->field[8]->store((uint32)reads_delta);
+      table->field[8]->set_notnull();
+
+      table->field[9]->store((uint32)writes_delta);
+      table->field[9]->set_notnull();
 #else
       /* TODO: Add block IO info for non-BSD systems */
 #endif
@@ -634,6 +684,13 @@ int PROFILING::fill_statistics_info(THD 
       table->field[13]->store((uint32)(entry->rusage.ru_minflt -
                              previous->rusage.ru_minflt), true);
       table->field[13]->set_notnull();
+#elif defined(__WIN__)
+      /* Windows APIs don't easily distinguish between hard and soft page
+         faults, so we just fill the 'major' column and leave the second NULL.
+      */
+      table->field[12]->store((uint32)(entry->mem_count.PageFaultCount -
+                             previous->mem_count.PageFaultCount), true);
+      table->field[12]->set_notnull();
 #else
       /* TODO: Add page fault info for non-BSD systems */
 #endif

=== modified file 'sql/sql_profile.h'
--- a/sql/sql_profile.h	2009-09-07 20:50:10 +0000
+++ b/sql/sql_profile.h	2010-01-29 18:42:22 +0000
@@ -36,6 +36,10 @@ int make_profile_table_for_show(THD *thd
 #if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
 #include "mysql_priv.h"
 
+#ifdef __WIN__
+#include <psapi.h>
+#endif
+
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
@@ -165,6 +169,10 @@ private:
   char *status;
 #ifdef HAVE_GETRUSAGE
   struct rusage rusage;
+#elif defined(__WIN__)
+  FILETIME ftKernel, ftUser;
+  IO_COUNTERS io_count;
+  PROCESS_MEMORY_COUNTERS mem_count;
 #endif
 
   char *function;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-01-15 15:27:55 +0000
+++ b/sql/sql_table.cc	2010-02-10 19:06:24 +0000
@@ -1880,6 +1880,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
   {
     TABLE_SHARE *share;
     table->db_type= NULL;
+
     if ((share= get_cached_table_share(table->db, table->table_name)))
       table->db_type= share->db_type();
 
@@ -1974,9 +1975,10 @@ int mysql_rm_table_part2(THD *thd, TABLE
     {
       TABLE *locked_table;
       abort_locked_tables(thd, db, table->table_name);
+      table->deleting= TRUE;
       remove_table_from_cache(thd, db, table->table_name,
 	                      RTFC_WAIT_OTHER_THREAD_FLAG |
-			      RTFC_CHECK_KILLED_FLAG);
+			      RTFC_CHECK_KILLED_FLAG, FALSE);
       /*
         If the table was used in lock tables, remember it so that
         unlock_table_names can free it
@@ -4213,9 +4215,10 @@ void wait_while_table_is_used(THD *thd,T
   /* Wait until all there are no other threads that has this table open */
   remove_table_from_cache(thd, table->s->db.str,
                           table->s->table_name.str,
-                          RTFC_WAIT_OTHER_THREAD_FLAG);
+                          RTFC_WAIT_OTHER_THREAD_FLAG, FALSE);
   /* extra() call must come only after all instances above are closed */
-  VOID(table->file->extra(function));
+  if (function != HA_EXTRA_NOT_USED)
+    VOID(table->file->extra(function));
   DBUG_VOID_RETURN;
 }
 
@@ -4717,7 +4720,7 @@ static bool mysql_admin_table(THD* thd, 
       remove_table_from_cache(thd, table->table->s->db.str,
                               table->table->s->table_name.str,
                               RTFC_WAIT_OTHER_THREAD_FLAG |
-                              RTFC_CHECK_KILLED_FLAG);
+                              RTFC_CHECK_KILLED_FLAG, FALSE);
       thd->exit_cond(old_message);
       DBUG_EXECUTE_IF("wait_in_mysql_admin_table", wait_for_kill_signal(thd););
       if (thd->killed)
@@ -4975,7 +4978,8 @@ send_result_message:
         {
           pthread_mutex_lock(&LOCK_open);
           remove_table_from_cache(thd, table->table->s->db.str,
-                                  table->table->s->table_name.str, RTFC_NO_FLAG);
+                                  table->table->s->table_name.str,
+                                  RTFC_NO_FLAG, FALSE);
           pthread_mutex_unlock(&LOCK_open);
         }
         /* May be something modified consequently we have to invalidate cache */
@@ -6738,7 +6742,9 @@ view_err:
         from concurrent DDL statements.
       */
       VOID(pthread_mutex_lock(&LOCK_open));
-      wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+      wait_while_table_is_used(thd, table,
+                               thd->locked_tables ? HA_EXTRA_NOT_USED :
+                               HA_EXTRA_FORCE_REOPEN);
       VOID(pthread_mutex_unlock(&LOCK_open));
       DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
       error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
@@ -6746,7 +6752,9 @@ view_err:
       break;
     case DISABLE:
       VOID(pthread_mutex_lock(&LOCK_open));
-      wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+      wait_while_table_is_used(thd, table,
+                               thd->locked_tables ? HA_EXTRA_NOT_USED :
+                               HA_EXTRA_FORCE_REOPEN);
       VOID(pthread_mutex_unlock(&LOCK_open));
       error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
       /* COND_refresh will be signaled in close_thread_tables() */
@@ -7192,7 +7200,9 @@ view_err:
   else
   {
     VOID(pthread_mutex_lock(&LOCK_open));
-    wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+    wait_while_table_is_used(thd, table, 
+                             thd->locked_tables ? HA_EXTRA_NOT_USED :
+                             HA_EXTRA_FORCE_REOPEN);
     VOID(pthread_mutex_unlock(&LOCK_open));
     thd_proc_info(thd, "manage keys");
     alter_table_manage_keys(table, table->file->indexes_are_disabled(),

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-01-15 15:27:55 +0000
+++ b/sql/table.cc	2010-02-10 19:06:24 +0000
@@ -1977,7 +1977,11 @@ int closefrm(register TABLE *table, bool
   DBUG_PRINT("enter", ("table: 0x%lx", (long) table));
 
   if (table->db_stat)
+  {
+    if (table->s->deleting)
+      table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
     error=table->file->close();
+  }
   my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR));
   table->alias= 0;
   if (table->field)

=== modified file 'sql/table.h'
--- a/sql/table.h	2010-01-15 15:27:55 +0000
+++ b/sql/table.h	2010-02-10 19:06:24 +0000
@@ -431,6 +431,7 @@ typedef struct st_table_share
   bool is_view;
   bool name_lock, replace_with_name_lock;
   bool waiting_on_cond;                 /* Protection against free */
+  bool deleting;                        /* going to delete this table */
   ulong table_map_id;                   /* for row-based replication */
   ulonglong table_map_version;
 
@@ -1379,7 +1380,7 @@ struct TABLE_LIST
   */
   bool          create;
   bool          internal_tmp_table;
-
+  bool          deleting;               /* going to delete this table */
 
   /* View creation context. */
 

=== modified file 'sql/udf_example.def'
--- a/sql/udf_example.def	2007-10-29 14:01:40 +0000
+++ b/sql/udf_example.def	2010-01-29 18:42:22 +0000
@@ -3,8 +3,10 @@ VERSION		1.0
 EXPORTS
   lookup
   lookup_init
+  lookup_deinit
   reverse_lookup
   reverse_lookup_init
+  reverse_lookup_deinit
   metaphon_init
   metaphon_deinit
   metaphon

=== modified file 'storage/maria/ft_maria.c'
--- a/storage/maria/ft_maria.c	2007-07-02 17:45:15 +0000
+++ b/storage/maria/ft_maria.c	2010-01-27 21:53:08 +0000
@@ -22,8 +22,8 @@
 #include "ma_ftdefs.h"
 
 FT_INFO *maria_ft_init_search(uint flags, void *info, uint keynr,
-			      uchar *query, uint query_len, CHARSET_INFO *cs,
-			      uchar *record)
+			      uchar *query, size_t query_len,
+                              CHARSET_INFO *cs, uchar *record)
 {
   FT_INFO *res;
   if (flags & FT_BOOL)

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2009-12-03 11:34:11 +0000
+++ b/storage/maria/ha_maria.cc	2010-02-12 14:21:13 +0000
@@ -2255,9 +2255,12 @@ int ha_maria::extra(enum ha_extra_functi
     extern_lock(F_UNLOCK) (which resets file->trn) followed by maria_close()
     without calling commit/rollback in between.  If file->trn is not set
     we can't remove file->share from the transaction list in the extra() call.
+
+    table->in_use is not set in the case this is a done as part of closefrm()
+    as part of drop table.
   */
 
-  if (!file->trn &&
+  if (file->s->now_transactional && !file->trn && table->in_use && 
       (operation == HA_EXTRA_PREPARE_FOR_DROP ||
        operation == HA_EXTRA_PREPARE_FOR_RENAME))
   {
@@ -3275,11 +3278,11 @@ static struct st_mysql_sys_var* system_v
   MYSQL_SYSVAR(block_size),
   MYSQL_SYSVAR(checkpoint_interval),
   MYSQL_SYSVAR(force_start_after_recovery_failures),
-  MYSQL_SYSVAR(page_checksum),
   MYSQL_SYSVAR(log_dir_path),
   MYSQL_SYSVAR(log_file_size),
   MYSQL_SYSVAR(log_purge_type),
   MYSQL_SYSVAR(max_sort_file_size),
+  MYSQL_SYSVAR(page_checksum),
   MYSQL_SYSVAR(pagecache_age_threshold),
   MYSQL_SYSVAR(pagecache_buffer_size),
   MYSQL_SYSVAR(pagecache_division_limit),

=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c	2010-01-06 21:27:53 +0000
+++ b/storage/maria/ma_blockrec.c	2010-02-10 19:06:24 +0000
@@ -430,8 +430,9 @@ my_bool _ma_once_end_block_record(MARIA_
   if (share->bitmap.file.file >= 0)
   {
     if (flush_pagecache_blocks(share->pagecache, &share->bitmap.file,
-                               share->temporary ? FLUSH_IGNORE_CHANGED :
-                               FLUSH_RELEASE))
+                               ((share->temporary || share->deleting) ?
+                                FLUSH_IGNORE_CHANGED :
+                                FLUSH_RELEASE)))
       res= 1;
     /*
       File must be synced as it is going out of the maria_open_list and so
@@ -1688,7 +1689,8 @@ static my_bool get_head_or_tail_page(MAR
     if (!page_link.changed)
       goto crashed;
 
-    DBUG_ASSERT((res->buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == page_type);
+    DBUG_ASSERT((uint) (res->buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) ==
+                page_type);
     if (!(dir= find_free_position(page_type == HEAD_PAGE ? info : 0,
                                   res->buff, block_size, &res->rownr,
                                   &res->length, &res->empty_space)))

=== modified file 'storage/maria/ma_close.c'
--- a/storage/maria/ma_close.c	2009-02-05 22:38:30 +0000
+++ b/storage/maria/ma_close.c	2010-02-10 19:06:24 +0000
@@ -79,7 +79,7 @@ int maria_close(register MARIA_HA *info)
       if ((*share->once_end)(share))
         error= my_errno;
       if (flush_pagecache_blocks(share->pagecache, &share->kfile,
-                                 (share->temporary ?
+                                 ((share->temporary || share->deleting) ?
                                   FLUSH_IGNORE_CHANGED :
                                   FLUSH_RELEASE)))
         error= my_errno;
@@ -177,6 +177,7 @@ int maria_close(register MARIA_HA *info)
   {
     (void) pthread_mutex_destroy(&share->intern_lock);
     (void) pthread_mutex_destroy(&share->close_lock);
+    (void) pthread_cond_destroy(&share->key_del_cond);
     my_free((uchar *)share, MYF(0));
     /*
       If share cannot be freed, it's because checkpoint has previously

=== modified file 'storage/maria/ma_extra.c'
--- a/storage/maria/ma_extra.c	2009-10-06 06:13:56 +0000
+++ b/storage/maria/ma_extra.c	2010-02-10 19:06:24 +0000
@@ -305,6 +305,12 @@ int maria_extra(MARIA_HA *info, enum ha_
     pthread_mutex_unlock(&THR_LOCK_maria);
     break;
   case HA_EXTRA_PREPARE_FOR_DROP:
+    /* Signals about intent to delete this table */
+    share->deleting= TRUE;
+    share->global_changed= FALSE;     /* force writing changed flag */
+    /* To force repair if reopened */
+    _ma_mark_file_changed(info);
+    /* Fall trough */
   case HA_EXTRA_PREPARE_FOR_RENAME:
   {
     my_bool do_flush= test(function != HA_EXTRA_PREPARE_FOR_DROP);

=== modified file 'storage/maria/ma_locking.c'
--- a/storage/maria/ma_locking.c	2009-10-06 06:13:56 +0000
+++ b/storage/maria/ma_locking.c	2010-02-10 19:06:24 +0000
@@ -387,6 +387,9 @@ int _ma_test_if_changed(register MARIA_H
   open_count is not maintained on disk for temporary tables.
 */
 
+#define _MA_ALREADY_MARKED_FILE_CHANGED                                 \
+  ((share->state.changed & STATE_CHANGED) && share->global_changed)
+
 int _ma_mark_file_changed(MARIA_HA *info)
 {
   uchar buff[3];
@@ -394,8 +397,6 @@ int _ma_mark_file_changed(MARIA_HA *info
   int error= 1;
   DBUG_ENTER("_ma_mark_file_changed");
 
-#define _MA_ALREADY_MARKED_FILE_CHANGED                                 \
-  ((share->state.changed & STATE_CHANGED) && share->global_changed)
   if (_MA_ALREADY_MARKED_FILE_CHANGED)
     DBUG_RETURN(0);
   pthread_mutex_lock(&share->intern_lock); /* recheck under mutex */

=== modified file 'storage/maria/ma_recovery.c'
--- a/storage/maria/ma_recovery.c	2009-10-26 11:35:42 +0000
+++ b/storage/maria/ma_recovery.c	2010-02-10 19:06:24 +0000
@@ -312,11 +312,14 @@ int maria_apply_log(LSN from_lsn, enum m
 
   now= my_getsystime();
   in_redo_phase= TRUE;
+  trnman_init(max_trid_in_control_file);
   if (run_redo_phase(from_lsn, apply))
   {
     ma_message_no_user(0, "Redo phase failed");
+    trnman_destroy();
     goto err;
   }
+  trnman_destroy();
 
   if ((uncommitted_trans=
        end_of_redo_phase(should_run_undo_phase)) == (uint)-1)

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2009-11-29 23:08:56 +0000
+++ b/storage/maria/maria_def.h	2010-02-10 19:06:24 +0000
@@ -390,6 +390,7 @@ typedef struct st_maria_share
   my_bool now_transactional;
   my_bool have_versioning;
   my_bool key_del_used;                         /* != 0 if key_del is locked */
+  my_bool deleting;                     /* we are going to delete this table */
 #ifdef THREAD
   THR_LOCK lock;
   void (*lock_restore_status)(void *);

=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c	2010-01-15 15:27:55 +0000
+++ b/storage/myisam/ft_boolean_search.c	2010-01-28 14:49:14 +0000
@@ -299,7 +299,7 @@ static int ftb_parse_query_internal(MYSQ
 }
 
 
-static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
+static int _ftb_parse_query(FTB *ftb, uchar *query, mysql_ft_size_t len,
                             struct st_mysql_ftparser *parser)
 {
   MYSQL_FTPARSER_PARAM *param;
@@ -321,7 +321,7 @@ static int _ftb_parse_query(FTB *ftb, uc
   param->mysql_add_word= ftb_query_add_word;
   param->mysql_ftparam= (void *)&ftb_param;
   param->cs= ftb->charset;
-  param->doc= (char*) query;
+  param->doc= query;
   param->length= len;
   param->flags= 0;
   param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -540,7 +540,7 @@ static void _ftb_init_index_search(FT_IN
 
 
 FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, uchar *query,
-                                 uint query_len, CHARSET_INFO *cs)
+                                 mysql_ft_size_t query_len, CHARSET_INFO *cs)
 {
   FTB       *ftb;
   FTB_EXPR  *ftbe;
@@ -679,8 +679,9 @@ static int ftb_check_phrase_internal(MYS
     -1 is returned if error occurs.
 */
 
-static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
-                FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
+static int _ftb_check_phrase(FTB *ftb, const uchar *document,
+                             mysql_ft_size_t len,
+                             FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
 {
   MY_FTB_PHRASE_PARAM ftb_param;
   MYSQL_FTPARSER_PARAM *param;
@@ -701,7 +702,7 @@ static int _ftb_check_phrase(FTB *ftb, c
   param->mysql_add_word= ftb_phrase_add_word;
   param->mysql_ftparam= (void *)&ftb_param;
   param->cs= ftb->charset;
-  param->doc= (char *) document;
+  param->doc= document;
   param->length= len;
   param->flags= 0;
   param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -999,7 +1000,7 @@ float ft_boolean_find_relevance(FT_INFO 
   {
     if (!ftsi.pos)
       continue;
-    param->doc= (char *)ftsi.pos;
+    param->doc= ftsi.pos;
     param->length= ftsi.len;
     if (unlikely(parser->parse(param)))
       return 0;

=== modified file 'storage/myisam/ft_myisam.c'
--- a/storage/myisam/ft_myisam.c	2007-07-02 17:45:15 +0000
+++ b/storage/myisam/ft_myisam.c	2010-01-27 21:53:08 +0000
@@ -23,8 +23,8 @@
 #include "ftdefs.h"
 
 FT_INFO *ft_init_search(uint flags, void *info, uint keynr,
-                        uchar *query, uint query_len, CHARSET_INFO *cs,
-                        uchar *record)
+                        uchar *query, size_t query_len,
+                        CHARSET_INFO *cs, uchar *record)
 {
   FT_INFO *res;
   if (flags & FT_BOOL)

=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c	2009-11-30 13:36:06 +0000
+++ b/storage/myisam/ft_nlq_search.c	2010-01-27 21:53:08 +0000
@@ -204,7 +204,8 @@ static int FT_DOC_cmp(void *unused __att
 
 
 FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, uchar *query,
-			    uint query_len, uint flags, uchar *record)
+			    mysql_ft_size_t query_len, uint flags,
+                            uchar *record)
 {
   TREE	      wtree;
   ALL_IN_ONE  aio;

=== modified file 'storage/myisam/ft_parser.c'
--- a/storage/myisam/ft_parser.c	2009-11-30 13:36:06 +0000
+++ b/storage/myisam/ft_parser.c	2010-01-28 14:49:14 +0000
@@ -175,7 +175,7 @@ uchar ft_get_word(CHARSET_INFO *cs, cons
     if ((param->trunc=(doc<end && *doc == FTB_TRUNC)))
       doc++;
 
-    if (((length >= ft_min_word_len && !is_stopword((char*) word->pos,
+    if (((length >= ft_min_word_len && !is_stopword(word->pos,
                                                     word->len))
          || param->trunc) && length < ft_max_word_len)
     {
@@ -298,13 +298,13 @@ static int ft_parse_internal(MYSQL_FTPAR
   DBUG_ENTER("ft_parse_internal");
 
   while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
-    if (param->mysql_add_word(param, (char*) w.pos, w.len, 0))
+    if (param->mysql_add_word(param, w.pos, w.len, 0))
       DBUG_RETURN(1);
   DBUG_RETURN(0);
 }
 
 
-int ft_parse(TREE *wtree, const uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, mysql_ft_size_t doclen,
              struct st_mysql_ftparser *parser,
              MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
 {
@@ -319,7 +319,7 @@ int ft_parse(TREE *wtree, const uchar *d
   param->mysql_add_word= ft_add_word;
   param->mysql_ftparam= &my_param;
   param->cs= wtree->custom_arg;
-  param->doc= (char*) doc;
+  param->doc= doc;
   param->length= doclen;
   param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
   DBUG_RETURN(parser->parse(param));

=== modified file 'storage/myisam/ft_stopwords.c'
--- a/storage/myisam/ft_stopwords.c	2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ft_stopwords.c	2010-01-28 14:49:14 +0000
@@ -20,8 +20,8 @@
 
 typedef struct st_ft_stopwords
 {
-  const char * pos;
-  uint   len;
+  const uchar* pos;
+  size_t len;
 } FT_STOPWORD;
 
 static TREE *stopwords3=NULL;
@@ -30,15 +30,15 @@ static int FT_STOPWORD_cmp(void* cmp_arg
 			   FT_STOPWORD *w1, FT_STOPWORD *w2)
 {
   return ha_compare_text(default_charset_info,
-			 (uchar *)w1->pos,w1->len,
-			 (uchar *)w2->pos,w2->len,0,0);
+			 w1->pos, w1->len,
+			 w2->pos, w2->len, 0, 0);
 }
 
 static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action,
                              void *arg __attribute__((unused)))
 {
   if (action == free_free)
-    my_free((uchar*) w->pos, MYF(0));
+    my_free((void*) w->pos, MYF(0));
 }
 
 static int ft_add_stopword(const char *w)

=== modified file 'storage/myisam/ftdefs.h'
--- a/storage/myisam/ftdefs.h	2009-11-29 23:08:56 +0000
+++ b/storage/myisam/ftdefs.h	2010-01-27 21:53:08 +0000
@@ -97,8 +97,8 @@
 
 typedef struct st_ft_word {
   const uchar *pos;
-  uint	 len;
   double weight;
+  size_t len;
 } FT_WORD;
 
 int is_stopword(const uchar *word, size_t len);
@@ -111,7 +111,8 @@ uchar ft_simple_get_word(CHARSET_INFO *,
                          FT_WORD *, my_bool);
 
 typedef struct _st_ft_seg_iterator {
-  uint        num, len;
+  uint        num;
+  mysql_ft_size_t len;
   HA_KEYSEG  *seg;
   const uchar *rec, *pos;
 } FT_SEG_ITERATOR;
@@ -128,8 +129,9 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *, 
 uint _mi_ft_parse(TREE *, MI_INFO *, uint, const uchar *,
                   MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
 
-FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, uint, uint, uchar *);
-FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, uint, CHARSET_INFO *);
+FT_INFO *ft_init_nlq_search(MI_INFO *, uint, uchar *, mysql_ft_size_t, uint,
+                            uchar *);
+FT_INFO *ft_init_boolean_search(MI_INFO *, uint, uchar *, mysql_ft_size_t, CHARSET_INFO *);
 
 extern const struct _ft_vft _ft_vft_nlq;
 int ft_nlq_read_next(FT_INFO *, char *);

=== modified file 'storage/myisam/mi_close.c'
--- a/storage/myisam/mi_close.c	2009-09-07 20:50:10 +0000
+++ b/storage/myisam/mi_close.c	2010-02-10 19:06:24 +0000
@@ -64,8 +64,9 @@ int mi_close(register MI_INFO *info)
                     if (share->kfile >= 0) abort(););
     if (share->kfile >= 0 &&
 	flush_key_blocks(share->key_cache, share->kfile,
-			 share->temporary ? FLUSH_IGNORE_CHANGED :
-			 FLUSH_RELEASE))
+                         ((share->temporary || share->deleting) ?
+                          FLUSH_IGNORE_CHANGED :
+                          FLUSH_RELEASE)))
       error=my_errno;
     if (share->kfile >= 0)
     {

=== modified file 'storage/myisam/mi_extra.c'
--- a/storage/myisam/mi_extra.c	2009-10-06 06:13:56 +0000
+++ b/storage/myisam/mi_extra.c	2010-02-10 19:06:24 +0000
@@ -256,8 +256,13 @@ int mi_extra(MI_INFO *info, enum ha_extr
     share->last_version= 0L;			/* Impossible version */
     pthread_mutex_unlock(&THR_LOCK_myisam);
     break;
-  case HA_EXTRA_PREPARE_FOR_RENAME:
   case HA_EXTRA_PREPARE_FOR_DROP:
+    /* Signals about intent to delete this table */
+    share->deleting= TRUE;
+    share->global_changed= FALSE;     /* force writing changed flag */
+    _mi_mark_file_changed(info);
+    /* Fall trough */
+  case HA_EXTRA_PREPARE_FOR_RENAME:
     pthread_mutex_lock(&THR_LOCK_myisam);
     share->last_version= 0L;			/* Impossible version */
     pthread_mutex_lock(&share->intern_lock);

=== modified file 'storage/myisam/mi_open.c'
--- a/storage/myisam/mi_open.c	2009-12-03 11:19:05 +0000
+++ b/storage/myisam/mi_open.c	2010-02-10 19:06:24 +0000
@@ -58,6 +58,8 @@ MI_INFO *test_if_reopen(char *filename)
   {
     MI_INFO *info=(MI_INFO*) pos->data;
     MYISAM_SHARE *share=info->s;
+    DBUG_ASSERT(strcmp(share->unique_file_name,filename) ||
+                share->last_version);
     if (!strcmp(share->unique_file_name,filename) && share->last_version)
       return info;
   }

=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h	2009-12-03 11:34:11 +0000
+++ b/storage/myisam/myisamdef.h	2010-02-10 19:06:24 +0000
@@ -221,6 +221,7 @@ typedef struct st_mi_isam_share
   my_bool changed,                      /* If changed since lock */
     global_changed,                     /* If changed since open */
     not_flushed, temporary, delay_key_write, concurrent_insert;
+  my_bool deleting;                     /* we are going to delete this table */
 #ifdef THREAD
   THR_LOCK lock;
   pthread_mutex_t intern_lock;          /* Locking for use with _locking */

=== modified file 'storage/xtradb/buf/buf0buf.c'
--- a/storage/xtradb/buf/buf0buf.c	2010-01-06 12:00:14 +0000
+++ b/storage/xtradb/buf/buf0buf.c	2010-01-28 11:35:10 +0000
@@ -76,10 +76,10 @@ inline void _increment_page_get_statisti
 					block->page.offset, DPAH_SIZE << 3);
 	block_hash_byte = block_hash >> 3;
 	block_hash_offset = (byte) block_hash & 0x07;
-	if (block_hash_byte < 0 || block_hash_byte >= DPAH_SIZE)
-		fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", block_hash_byte, block_hash_offset);
-	if (block_hash_offset < 0 || block_hash_offset > 7)
-		fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", block_hash_byte, block_hash_offset);
+	if (block_hash_byte >= DPAH_SIZE)
+          fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", (unsigned long) block_hash_byte, (unsigned long) block_hash_offset);
+	if (block_hash_offset > 7)
+          fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", (unsigned long) block_hash_byte, (unsigned long) block_hash_offset);
 	if ((trx->distinct_page_access_hash[block_hash_byte] & ((byte) 0x01 << block_hash_offset)) == 0)
 		trx->distinct_page_access++;
 	trx->distinct_page_access_hash[block_hash_byte] |= (byte) 0x01 << block_hash_offset;

=== modified file 'storage/xtradb/handler/i_s.cc'
--- a/storage/xtradb/handler/i_s.cc	2010-01-15 15:58:25 +0000
+++ b/storage/xtradb/handler/i_s.cc	2010-01-28 11:35:10 +0000
@@ -2992,7 +2992,7 @@ i_s_innodb_admin_command_fill(
 	char**	query_str;
 	char*	ptr;
 	char	quote	= '\0';
-	char*	command_head = "XTRA_";
+	const char*	command_head = "XTRA_";
 
 	DBUG_ENTER("i_s_innodb_admin_command_fill");
 

=== modified file 'support-files/compiler_warnings.supp'
--- a/support-files/compiler_warnings.supp	2010-01-06 21:27:53 +0000
+++ b/support-files/compiler_warnings.supp	2010-01-28 14:49:14 +0000
@@ -4,6 +4,7 @@
 #
 
 integer.cpp: .*control reaches end of non-void function.*: 1288-1427
+integer.cpp: .*no return statement in function returning non-void.*: 1288-1427
 DictTabInfo.cpp : .*invalid access to non-static.*
 DictTabInfo.cpp : .*macro was used incorrectly.*
 DbdihMain.cpp : .*unused variable.* : 6666-7013
@@ -27,7 +28,17 @@ _flex_tmp.c: .*not enough actual paramet
 pars0lex.l: .*conversion from 'ulint' to 'int', possible loss of data.*
 btr/btr0cur\.c: .*value computed is not used.*: 3175-3375
 include/buf0buf\.ic: unused parameter ‘mtr’
+fil/fil0fil\.c: pointer targets in passing argument.*differ in signedness
 fil/fil0fil\.c: comparison between signed and unsigned : 3100-3199
+fil/fil0fil\.c: unused parameter
+log/log0recv\.c: unused variable
+os/os0file\.c: unused parameter
+os/os0file\.c: pointer targets in assignment differ in signedness
+handler/i_s\.cc: unused variable
+sync/sync0rw\.c: unused parameter
+sync/sync0sync\.c: unused parameter
+sync/sync0sync\.c: unused variable
+ut/ut0ut\.c: ignoring return value of
 
 #
 # bdb is not critical to keep up to date
@@ -50,6 +61,11 @@ db_vrfy.c : .*comparison is always false
 .*/extra/libevent/select\.c : .*comparison between signed and unsigned.* : 270-280
 
 #
+# Ignore warnings from system libraries
+#
+/usr/share/aclocal/audiofile.m4 : .*
+
+#
 # Ignore all conversion warnings on windows 64
 # (Is safe as we are not yet supporting strings >= 2G)
 #
@@ -87,10 +103,15 @@ storage/maria/ma_pagecache.c: .*'info_ch
 # I think these are due to mix of C and C++.
 #
 storage/pbxt/ : typedef.*was ignored in this declaration
+ha_pbxt\.cc : variable.*might be clobbered by.*longjmp
 
 #
 # Yassl
 include/runtime.hpp: .*pure_error.*
+.*/extra/yassl/taocrypt/.*: comparison with string literal
+.*/extra/yassl/taocrypt/src/blowfish\.cpp: array subscript is above array bounds
+.*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value
+.*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function
 
 #
 # Groff warnings on OpenSUSE.
@@ -102,6 +123,8 @@ include/runtime.hpp: .*pure_error.*
 #
 listener.cc : .*conversion from 'SOCKET' to 'int'.*
 net_serv.cc : .*conversion from 'SOCKET' to 'int'.*
+set_var.cc:  right-hand operand of comma has no effect : 1000-1400
+
 
 # allow a little moving space for the warning below
 mi_packrec.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600

=== modified file 'unittest/mysys/waiting_threads-t.c'
--- a/unittest/mysys/waiting_threads-t.c	2009-09-15 10:46:35 +0000
+++ b/unittest/mysys/waiting_threads-t.c	2010-01-28 14:49:14 +0000
@@ -258,7 +258,7 @@ void do_tests()
 #define test_kill_strategy(X)                   \
   diag("kill strategy: " #X);                   \
   DBUG_EXECUTE("reset_file",                    \
-               { rewind(DBUG_FILE); ftruncate(fileno(DBUG_FILE), 0); }); \
+               { rewind(DBUG_FILE); (void) ftruncate(fileno(DBUG_FILE), 0); }); \
   DBUG_PRINT("info", ("kill strategy: " #X));   \
   kill_strategy=X;                              \
   do_one_test();

=== modified file 'vio/viossl.c'
--- a/vio/viossl.c	2008-02-07 08:55:49 +0000
+++ b/vio/viossl.c	2010-01-29 10:42:31 +0000
@@ -74,8 +74,11 @@ report_errors(SSL* ssl)
   }
 
   if (ssl)
-    DBUG_PRINT("error", ("error: %s",
-                         ERR_error_string(SSL_get_error(ssl, l), buf)));
+  {
+    int error= SSL_get_error(ssl, l);
+    DBUG_PRINT("error", ("error: %s (%d)",
+                         ERR_error_string(error, buf), error));
+  }
 
   DBUG_PRINT("info", ("socket_errno: %d", socket_errno));
   DBUG_VOID_RETURN;
@@ -174,16 +177,17 @@ 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*), char *error_string)
 {
   SSL *ssl;
   my_bool unused;
   my_bool was_blocking;
-
   DBUG_ENTER("ssl_do");
   DBUG_PRINT("enter", ("ptr: 0x%lx, sd: %d  ctx: 0x%lx",
                        (long) ptr, vio->sd, (long) ptr->ssl_context));
 
+  error_string[0]= 0;
+
   /* Set socket to blocking if not already set */
   vio_blocking(vio, 1, &was_blocking);
 
@@ -191,6 +195,7 @@ static int ssl_do(struct st_VioSSLFd *pt
   {
     DBUG_PRINT("error", ("SSL_new failure"));
     report_errors(ssl);
+    strmov(error_string, "SSL_new failed");
     vio_blocking(vio, was_blocking, &unused);
     DBUG_RETURN(1);
   }
@@ -203,6 +208,7 @@ static int ssl_do(struct st_VioSSLFd *pt
   {
     DBUG_PRINT("error", ("SSL_connect/accept failure"));
     report_errors(ssl);
+    ERR_error_string(SSL_get_error(ssl, 0), error_string);
     SSL_free(ssl);
     vio_blocking(vio, was_blocking, &unused);
     DBUG_RETURN(1);
@@ -250,17 +256,19 @@ 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,
+              char *error_string)
 {
   DBUG_ENTER("sslaccept");
-  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept));
+  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept, error_string));
 }
 
 
-int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
+int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+               char *error_string)
 {
   DBUG_ENTER("sslconnect");
-  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect));
+  DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, error_string));
 }