List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:March 21 2011 2:28am
Subject:bzr push into mysql-trunk branch (chris.powers:3269 to 3270)
View as plain text  
 3270 Christopher Powers	2011-03-20 [merge]
      merge with mysql-trunk

    added:
      mysql-test/r/optimizer_debug_sync.result
      mysql-test/suite/innodb/r/innodb_bug11789106.result
      mysql-test/suite/innodb/r/innodb_bug60196.result
      mysql-test/suite/innodb/t/innodb_bug11789106.test
      mysql-test/suite/innodb/t/innodb_bug60196-master.opt
      mysql-test/suite/innodb/t/innodb_bug60196.test
      mysql-test/suite/rpl/r/rpl_grant_plugin.result
      mysql-test/suite/rpl/t/rpl_grant_plugin-master.opt
      mysql-test/suite/rpl/t/rpl_grant_plugin-slave.opt
      mysql-test/suite/rpl/t/rpl_grant_plugin.test
      mysql-test/t/optimizer_debug_sync.test
    modified:
      README
      client/mysqladmin.cc
      client/mysqldump.c
      client/mysqltest.cc
      cmake/mysql_version.cmake
      include/decimal.h
      include/mysql.h.pp
      include/typelib.h
      mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
      mysql-test/include/have_plugin_auth.inc
      mysql-test/include/icp_tests.inc
      mysql-test/r/archive.result
      mysql-test/r/cast.result
      mysql-test/r/func_math.result
      mysql-test/r/func_time.result
      mysql-test/r/gis.result
      mysql-test/r/grant.result
      mysql-test/r/grant2.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/mysqladmin.result
      mysql-test/r/mysqldump.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/plugin_auth_qa.result
      mysql-test/r/plugin_auth_qa_1.result
      mysql-test/r/plugin_auth_qa_2.result
      mysql-test/r/sp.result
      mysql-test/r/sp_notembedded.result
      mysql-test/r/subselect_innodb.result
      mysql-test/r/system_mysql_db.result
      mysql-test/r/type_date.result
      mysql-test/r/union.result
      mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
      mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_user_privileges.result
      mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc
      mysql-test/suite/innodb/r/innodb_monitor.result
      mysql-test/suite/innodb/t/innodb_monitor.test
      mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result
      mysql-test/suite/large_tests/t/rpl_slave_net_timeout.test
      mysql-test/suite/perfschema/r/server_init.result
      mysql-test/suite/perfschema/t/server_init.test
      mysql-test/suite/rpl/r/rpl_checksum_cache.result
      mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
      mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
      mysql-test/suite/rpl/r/rpl_ignore_table.result
      mysql-test/suite/rpl/r/rpl_slow_query_log.result
      mysql-test/suite/rpl/r/rpl_stm_000001.result
      mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
      mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
      mysql-test/suite/rpl/r/rpl_stop_slave.result
      mysql-test/suite/rpl/t/rpl_checksum_cache.test
      mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
      mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
      mysql-test/suite/rpl/t/rpl_semi_sync.test
      mysql-test/suite/rpl/t/rpl_slow_query_log.test
      mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test
      mysql-test/suite/rpl/t/rpl_stop_slave.test
      mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
      mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
      mysql-test/t/archive.test
      mysql-test/t/cast.test
      mysql-test/t/func_math.test
      mysql-test/t/func_time.test
      mysql-test/t/gis.test
      mysql-test/t/mysql_client_test-master.opt
      mysql-test/t/mysql_client_test.test
      mysql-test/t/mysqladmin.test
      mysql-test/t/mysqldump.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/sp.test
      mysql-test/t/subselect_innodb.test
      mysql-test/t/type_date.test
      mysys/default.c
      mysys/my_getopt.c
      mysys/my_init.c
      mysys/my_thr_init.c
      mysys/mysys_priv.h
      mysys/typelib.c
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      sql-common/client.c
      sql-common/client_plugin.c
      sql/ha_partition.cc
      sql/item.cc
      sql/item.h
      sql/item_func.h
      sql/item_subselect.cc
      sql/item_subselect.h
      sql/item_sum.cc
      sql/item_timefunc.cc
      sql/my_decimal.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_range.cc
      sql/rpl_slave.cc
      sql/sql_acl.cc
      sql/sql_base.cc
      sql/sql_db.cc
      sql/sql_handler.cc
      sql/sql_help.cc
      sql/sql_lex.h
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_union.cc
      sql/strfunc.cc
      sql/table.cc
      storage/archive/ha_archive.cc
      storage/innobase/CMakeLists.txt
      storage/innobase/btr/btr0cur.c
      storage/innobase/btr/btr0sea.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0flu.c
      storage/innobase/buf/buf0lru.c
      storage/innobase/dict/dict0load.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/fil/fil0fil.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/handler/i_s.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/buf0flu.h
      storage/innobase/include/buf0flu.ic
      storage/innobase/include/data0type.ic
      storage/innobase/include/fil0fil.h
      storage/innobase/include/ha_prototypes.h
      storage/innobase/include/log0log.h
      storage/innobase/include/log0log.ic
      storage/innobase/include/log0recv.h
      storage/innobase/include/mtr0mtr.h
      storage/innobase/include/srv0mon.h
      storage/innobase/include/srv0srv.h
      storage/innobase/include/srv0start.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/univ.i
      storage/innobase/lock/lock0lock.c
      storage/innobase/log/log0log.c
      storage/innobase/log/log0recv.c
      storage/innobase/mem/mem0dbg.c
      storage/innobase/mtr/mtr0mtr.c
      storage/innobase/page/page0zip.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0sel.c
      storage/innobase/scripts/persistent_storage.sql
      storage/innobase/srv/srv0mon.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/srv/srv0start.c
      storage/innobase/sync/sync0arr.c
      storage/innobase/sync/sync0rw.c
      storage/innobase/sync/sync0sync.c
      storage/innobase/trx/trx0sys.c
      storage/innobase/trx/trx0trx.c
      storage/innobase/ut/ut0dbg.c
      storage/myisam/myisamchk.c
      storage/myisammrg/myrg_open.c
      strings/decimal.c
      tests/mysql_client_test.c
      unittest/gunit/item-t.cc
 3269 cpowers	2011-03-20 [merge]
      merge

    modified:
      mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
=== modified file 'README'
--- a/README	2011-03-08 19:14:42 +0000
+++ b/README	2011-03-18 11:01:13 +0000
@@ -1,4 +1,4 @@
-MySQL Server
+MySQL Server 5.6
 
 This is a release of MySQL, a dual-license SQL database server.
 For the avoidance of doubt, this particular copy of the software 
@@ -54,2210 +54,3 @@ You can browse the MySQL Reference Manua
 in any of several formats at the URL given earlier in this file.
 Source distributions include a local copy of the manual in the
 Docs directory.
-
-********************************************************************
-
-Third-Party Component Notices
-
-*********************************************************************
-
-%%The following software may be included in this product:
-FindGTest.cmake (part of CMake 2.8.0)
-
-Use of any of this software is governed by the terms of the license below:
-
-# Copyright 2009 Kitware, Inc.
-# Copyright 2009 Philip Lowman 
-# Copyright 2009 Daniel Blezek 
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#===========================================================================
-# (To distributed this file outside of CMake, substitute the full
-#  License text for the above reference.)
-#
-# Thanks to Daniel Blezek  for the GTEST_ADD_TESTS code
-
-
-Text of Copyright.txt mentioned above:
-
-CMake - Cross Platform Makefile Generator
-Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer in the
-  documentation and/or other materials provided with the distribution.
-
-* Neither the names of Kitware, Inc., the Insight Software Consortium,
-  nor the names of their contributors may be used to endorse or promote
-  products derived from this software without specific prior written
-  permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Cmake
-
-Use of any of this software is governed by the terms of the license below:
-
-CMake is distributed under BSD License
-
-    Copyright (c) 2008, Kitware, Inc.
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are
-    met:
-
-        * Redistributions of source code must retain the above copyright
-          notice, this list of conditions and the following disclaimer.
-        * Redistributions in binary form must reproduce the above copyright
-          notice, this list of conditions and the following disclaimer in
-          the documentation and/or other materials provided with the
-          distribution.
-        * Neither the name of Kitware, Inc. nor the names of its
-          contributors may be used to endorse or promote products derived
-          from this software without specific prior written permission.
-
-    THIS SOFTWARE IS PROVIDED BY Kitware, Inc. "AS IS" AND ANY EXPRESS OR
-    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-    DISCLAIMED. IN NO EVENT SHALL Kitware Inc. BE LIABLE FOR ANY DIRECT,
-    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-    POSSIBILITY OF SUCH DAMAGE.
-
-Additional License(s)
-
-cmake-2.4.8/Utilities/cmtar/compat/gethostname.c:
- gethostname.c: minimal substitute for missing gethostname() function
- created 2000-Mar-02 jmk
- requires SVR4 uname() and -lc
-
- by Jim Knoble 
- Copyright ? 2000 Jim Knoble
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without fee,
- provided that the above copyright notice appear in all copies and
- that both that copyright notice and this permission notice appear in
- supporting documentation.
-
- This software is provided "as is", without warranty of any kind,
- express or implied, including but not limited to the warranties of
- merchantability, fitness for a particular purpose and
- noninfringement. In no event shall the author(s) be liable for any
- claim, damages or other liability, whether in an action of contract,
- tort or otherwise, arising from, out of or in connection with the
- software or the use or other dealings in the software.
-
-----------------------------------
-
-*  Originally written by Steven M. Bellovin  while
-*  at the University of North Carolina at Chapel Hill.  Later tweaked by
-*  a couple of people on Usenet.  Completely overhauled by Rich $alz
-*   and Jim Berets  in August, 1990.
-*
-*  This code is in the public domain and has no copyright.
-
--------------------------------
-
- THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT.
- You may freely copy it for use as a template for your own field types.
- If you develop a field type that might be of general use, please send
- it back to the ncurses maintainers for inclusion in the next version.
- 
-**************************************************************************
-                                                                     
-    * Author : Per Foreby, perf@strippede                               
-    * Author : Juergen Pfeifer, juergen.pfeifer@stripped                  
-
-**************************************************************************
-
-----------------------------------------
-
-  Copyright (c) 2002 Insight Consortium. All rights reserved.
-  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for
-  details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notices for more information.
-
---------------------------------------------
-
- Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  
-
-   As a special exception, when this file is copied by Bison into a
-   Bison output file, you may use that output file without restriction.
-   This special exception was added by the Free Software Foundation
-   in version 1.24 of Bison.  
-
----------------------------------------------------
-
-cmake-2.4.8/Utilities/cmzlib/zlib.h:
- zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.1.4, March 11th, 2002
-
-  Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must
-     not be misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source
-     distribution.
-
-  Jean-loup Gailly        Mark Adler
-
-----------------------------------------------
-
- This source code was modified by Martin Hedenfalk for use in Curl. His
- latest changes were done 2000-09-18.
-
- It has since been patched away like a madman by Daniel Stenberg to make it
- better applied to curl conditions, and to make it not use globals, pollute
- name space and more. This source code awaits a rewrite to work around the
- paragraph 2 in the BSD licenses as explained below.
-
- Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Hgskolan
- It has since been patched and modified a lot by Daniel Stenberg to make it
- better applied to curl conditions, and to make it not use globals, pollute
- name space and more. This source code awaits a rewrite to work around the
- paragraph 2 in the BSD licenses as explained below.
-
- Copyright (c) 1998, 1999 Kungliga Tekniska Hgskolan
- (Royal Institute of Technology, Stockholm, Sweden).
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the Institute nor the names of its contributors
-    may be used to endorse or promote products derived from this software
-    without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.  
-
----------------------------------------------
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
- CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
-
---------------------------------------------------
-
-cmake-2.4.8/Utilities/cmcurl/inet_pton.c,
-cmake-2.4.8/Source/CTest/Curl/inet_pton.c:
- This is from the BIND 4.9.4 release, modified to compile by itself 
-
- Copyright (c) 1996 by Internet Software Consortium.
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
- OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-
--------------------------------------------------------
-
-* Copyright (C) 2001 by Eric Kidd. All rights reserved.
-* Copyright (C) 2001 by Luke Howard. All rights reserved.
-* Copyright (C) 2002 Ximian, Inc.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-* 1. Redistributions of source code must retain the above copyright
-*    notice, this list of conditions and the following disclaimer.
-* 2. Redistributions in binary form must reproduce the above copyright
-*    notice, this list of conditions and the following disclaimer in the
-*    documentation and/or other materials provided with the distribution.
-* 3. The name of the author may not be used to endorse or promote products
-*    derived from this software without specific prior written permission. 
-*  
-* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE. 
-
----------------------------------------------------
-
- Copyright (c) 1994
-  The Regents of the University of California.  All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- Chuck Karish of Mindcraft, Inc.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. Neither the name of the University nor the names of its contributors
- Copyright (c) 1985, 1986 The Regents of the University of California.
- All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- James A. Woods, derived from original work by Spencer Thomas
- and Joseph Orost.
-
-------------------------------------------------
-
- Copyright (c) 1989, 1993, 1994
-  The Regents of the University of California.  All rights reserved.
-
- This code is derived from software contributed to Berkeley by
- Guido van Rossum.
-
- Copyright (c) 1990 The Regents of the University of California.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. All advertising materials mentioning features or use of this software
-    must display the following acknowledgement:
-    This product includes software developed by the University of
-    California, Berkeley and its contributors.
- 4. Neither the name of the University nor the names of its contributors
-    may be used to endorse or promote products derived from this software
-    without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-------------------------------------------------------
-
-  Project                     ___| | | |  _ \| |
-                             / __| | | | |_) | |
-                            | (__| |_| |  _ <| |___
-                             \___|\___/|_| \_\_____|
-
- Copyright (C) 1998 - 2004, Daniel Stenberg, , et al.
-
- Copyright (C) 2004, Daniel Stenberg, , et al.
-
- This software is licensed as described in the file COPYING, which
- you should have received as part of this distribution. The terms
- are also available at http://curl.haxx.se/docs/copyright.html.
-
- You may opt to use, copy, modify, merge, publish, distribute and/or sell
- copies of the Software, and permit persons to whom the Software is
- furnished to do so, under the terms of the COPYING file.
-
- This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- KIND, either express or implied.
-
-------------------------------------------------------------
-
-***************************************************************************
- Copyright (c) 1998 Free Software Foundation, Inc.                   
- Copyright (c) 1998,2000 Free Software Foundation, Inc.              
-                                                                     
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, distribute with modifications, sublicense, and/or sell  copies
- of the Software, and to permit persons to whom the Software is furnished
- to do so, subject to the following conditions:            
-                                                                     
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.              
-                                                                     
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN
- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- USE OR OTHER DEALINGS IN THE SOFTWARE.                          
-                                                                     
-                                                                     
- Except as contained in this notice, the name(s) of the above copyright
- holders shall not be used in advertising or otherwise to promote the sale,
- use or other dealings in this Software without prior written
- authorization.                                                      
-***************************************************************************
-
-------------------------------------------------------
-
- Copyright (c) 1997 Todd C. Miller 
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
-    derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Fred Fish's Dbug Library
-
-Use of any of this software is governed by the terms of the license below:
-
- *				   N O T I C E	                                                *
- *									                                                      *
- *		      Copyright Abandoned, 1987, Fred Fish		                      *
- *									                                                      *
- *									                                                      *
- *	This previously copyrighted work has been placed into the  public     *
- *	domain	by  the  author  and  may be freely used for any purpose,     *
- *	private or commercial.						                                    *
- *									                                                      *
- *	Because of the number of inquiries I was receiving about the  use     *
- *	of this product in commercially developed works I have decided to     *
- *	simply make it public domain to further its unrestricted use.	I       *
- *	specifically  would  be  most happy to see this material become a     *
- *	part of the standard Unix distributions by AT&T and the  Berkeley     *
- *	Computer  Science  Research Group, and a standard part of the GNU     *
- *	system from the Free Software Foundation.			                        *
- *									                                                      *
- *	I would appreciate it, as a courtesy, if this notice is  left  in     *
- *	all copies and derivative works.  Thank you.			                    *
- *									                                                      *
- *	The author makes no warranty of any kind  with	respect  to  this     *
- *	product  and  explicitly disclaims any implied warranties of mer-     *
- *	chantability or fitness for any particular purpose.		                *
-
-***************************************************************************
-
-%%The following software may be included in this product:
-dbug_analyze.c (part of Fred Fish's Dbug Library)
-
-Use of any of this software is governed by the terms of the license below:
-
-*              Copyright Abandoned, 1987, Fred Fish                       *
-*                                                                         *
-*                                                                         *
-*    This previously copyrighted work has been placed into the  public    *
-*    domain    by  the  author  and  may be freely used for any purpose,  *
-*    private or commercial.                                               *
-*                                                                         *
-*    Because of the number of inquiries I was receiving about the  use    *
-*    of this product in commercially developed works I have decided to    *
-*    simply make it public domain to further its unrestricted use.    I   *
-*    specifically  would  be  most happy to see this material become a    *
-*    part of the standard Unix distributions by AT&T and the  Berkeley    *
-*    Computer  Science  Research Group, and a standard part of the GNU    *
-*    system from the Free Software Foundation.                            *
-*                                                                         *
-*    I would appreciate it, as a courtesy, if this notice is  left  in    *
-*    all copies and derivative works.  Thank you.                         *
-*                                                                         *
-*    The author makes no warranty of any kind  with    respect  to  this  *
-*    product  and  explicitly disclaims any implied warranties of mer-    *
-*    chantability or fitness for any particular purpose.                  *
-
-***************************************************************************
-
-%%The following software may be included in this product:
-GNU Libtool, only ltmain.sh, libtool, auto-gen fil
-
-Use of any of this software is governed by the terms of the license below:
-
-ltmain.sh inclusion:
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007  Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit , 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-libtool inclusion:
-# libtoolT - Provide generalized library-building support services.
-# Generated automatically by  (GNU mysql 5.1.30)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 
-# 2006, 2007 Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit , 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-Auto-generated files:
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building
-# support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit , 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-Additional License(s)
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-innochecksum.c
-
-Use of any of this software is governed by the terms of the license below:
-
-GNU GENERAL PUBLIC LICENSE
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
-51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most
-of the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom to
-distribute copies of free software (and charge for this service if you wish),
-that you receive source code or can get it if you want it, that you can change
-the software or use pieces of it in new free programs; and that you know you can
-do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show them
-these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually
-obtain patent licenses, in effect making the program proprietary. To prevent
-this, we have made it clear that any patent must be licensed for everyone's free
-use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification follow.
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program or
-work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or
-translated into another language. (Hereinafter, translation is included without
-limitation in the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such modifications
-or work under the terms of Section 1 above, provided that you also meet all of
-these conditions:
-
-    a) You must cause the modified files to carry prominent notices stating that
-you changed the files and the date of any change. 
-    b) You must cause any work that you distribute or publish, that in whole or
-in part contains or is derived from the Program or any part thereof, to be
-licensed as a whole at no charge to all third parties under the terms of this
-License. 
-    c) If the modified program normally reads commands interactively when run,
-you must cause it, when started running for such interactive use in the most
-ordinary way, to print or display an announcement including an appropriate
-copyright notice and a notice that there is no warranty (or else, saying that
-you provide a warranty) and that users may redistribute the program under these
-conditions, and telling the user how to view a copy of this License. (Exception:
-if the Program itself is interactive but does not normally print such an
-announcement, your work based on the Program is not required to print an
-announcement.) 
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License, and
-its terms, do not apply to those sections when you distribute them as separate
-works. But when you distribute the same sections as part of a whole which is a
-work based on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the entire whole,
-and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on the
-Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this License.
-
-3. You may copy and distribute the Program (or a work based on it, under Section
-2) in object code or executable form under the terms of Sections 1 and 2 above
-provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or, 
-    b) Accompany it with a written offer, valid for at least three years, to
-give any third party, for a charge no more than your cost of physically
-performing source distribution, a complete machine-readable copy of the
-corresponding source code, to be distributed under the terms of Sections 1 and 2
-above on a medium customarily used for software interchange; or, 
-    c) Accompany it with the information you received as to the offer to
-distribute corresponding source code. (This alternative is allowed only for
-noncommercial distribution and only if you received the program in object code
-or executable form with such an offer, in accord with Subsection b above.) 
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface
-definition files, plus the scripts used to control compilation and installation
-of the executable. However, as a special exception, the source code distributed
-need not include anything that is normally distributed (in either source or
-binary form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component itself
-accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source code
-from the same place counts as distribution of the source code, even though third
-parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not
-accept this License. Therefore, by modifying or distributing the Program (or any
-work based on the Program), you indicate your acceptance of this License to do
-so, and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to
-copy, distribute or modify the Program subject to these terms and conditions.
-You may not impose any further restrictions on the recipients' exercise of the
-rights granted herein. You are not responsible for enforcing compliance by third
-parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed
-on you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your
-obligations under this License and any other pertinent obligations, then as a
-consequence you may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by all those
-who receive copies directly or indirectly through you, then the only way you
-could satisfy both it and this License would be to refrain entirely from
-distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and the
-section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices. Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose that
-choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original copyright
-holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded. In such
-case, this License incorporates the limitation as if written in the body of this
-License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems
-or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies
-a version number of this License which applies to it and "any later version",
-you have the option of following the terms and conditions either of that version
-or of any later version published by the Free Software Foundation. If the
-Program does not specify a version number of this License, you may choose any
-version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of
-all derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
-PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED
-IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS
-IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
-NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
-ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
-PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
-SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY
-TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
-THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
-PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-END OF TERMS AND CONDITIONS
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible use
-to the public, the best way to achieve this is to make it free software which
-everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach
-them to the start of each source file to most effectively convey the exclusion
-of warranty; and each file should have at least the "copyright" line and a
-pointer to where the full notice is found.
-
-one line to give the program's name and an idea of what it does.
-Copyright (C) yyyy  name of author
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it
-starts in an interactive mode:
-
-Gnomovision version 69, Copyright (C) year name of author
-Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
-type `show w'.  This is free software, and you are welcome
-to redistribute it under certain conditions; type `show c' 
-for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may be
-called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school,
-if any, to sign a "copyright disclaimer" for the program, if necessary. Here is
-a sample; alter the names:
-
-Yoyodyne, Inc., hereby disclaims all copyright
-interest in the program `Gnomovision'
-(which makes passes at compilers) written 
-by James Hacker.
-
-signature of Ty Coon, 1 April 1989
-Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may consider
-it more useful to permit linking proprietary applications with the library. If
-this is what you want to do, use the GNU Lesser General Public License instead
-of this License.
-
-Additional Documentation License(s)
-
-innochecksum.c is documented in the MySQL Reference
-Manual at http://dev.mysql.com/doc/refman/5.1/en/innochecksum.html
-The Reference Manual is not licensed under the GPL; rather, it
-is offered under normal copyright, but with permission to
-copy/redistribute electronically.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-lib_sql.cc
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
-     * Copyright (c)  2000
-     * SWsoft  company
-     *
-     * This material is provided "as is", with absolutely no warranty expressed
-     * or implied. Any use is at your own risk.
-     *
-     * Permission to use or copy this software for any purpose is hereby granted
-     * without fee, provided the above notices are retained on all copies.
-     * Permission to modify the code and to distribute modified code is granted,
-     * provided the above notices are retained, and a notice that the code was
-     * modified is included with the above copyright notice.
-     *
-
-      This code was modified by the MySQL team
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-libevent
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright (c) 2000-2004 Niels Provos 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-Additional License(s)
-
-http://creativecommons.org/licenses/publicdomain
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Async DNS Library
-
-Use of any of this software is governed by the terms of the license below:
-
-/* Async DNS Library
- * Adam Langley 
- * http://www.imperialviolet.org/eventdns.html
- * Public Domain code
- *
- * This software is Public Domain. To view a copy of the public domain dedication,
- * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
- * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
- *
- * I ask and expect, but do not require, that all derivative works contain an
- * attribution similar to:
- * 	Parts developed by Adam Langley 
- *
- * You may wish to replace the word "Parts" with something else depending on
- * the amount of original code.
- *
- * (Derivative works does not include programs which link against, run or include
- * the source verbatim in their source distributions)
- *
- * Version: 0.1b
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-log.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/*      $OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $  */
-
-/*
- * log.c
- *
- * Based on err.c, which was adapted from OpenBSD libc *err* *warn* code.
- *
- * Copyright (c) 2005 Nick Mathewson 
- *
- * Copyright (c) 2000 Dug Song 
- *
- * Copyright (c) 1993
- *      The Regents of the University of California.  All rights
-reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-min_heap.h
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright (c) 2006 Maxim Yegorushkin 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-win32.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * Copyright 2000-2002 Niels Provos 
- * Copyright 2003 Michael A. Davis 
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-regex++
-
-Use of any of this software is governed by the terms of the license below:
-
-Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
-   software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
-   explicit claim or by omission.  Since few users ever read sources,
-   credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.  Since few users
-   ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-/*-
- * Copyright (c) 1994
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)COPYRIGHT	8.1 (Berkeley) 3/16/94
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-Richard A. O'Keefe strings package
-
-Use of any of this software is governed by the terms of the license below:
-
-These files are in the public domain.  This includes getopt.c, which
-is the work of Henry Spencer, University of Toronto Zoology, who says of
-it "None of this software is derived from Bell software. I had no access
-to the source for Bell's versions at the time I wrote it.  This software
-is hereby explicitly placed in the public domain.  It may  be  used  for
-any purpose on any machine by anyone." I would greatly prefer it if *my*
-material received no military use.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-t_ctype.h
-
-Use of any of this software is governed by the terms of the license below:
-
-http://bioinfo.mbb.yale.edu/genome/yeast/cluster/database/mysql/include/t_ctype.h 
-
-/*
-  Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
-  Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
-  Permission to use, copy, modify, distribute and sell this software
-   and its documentation for any purpose is hereby granted without fee,
-   provided that the above copyright notice appear in all copies.
-   Smaphan Raruenrom and Pruet Boonma makes no representations about 
-   the suitability of this software for any purpose.  It is provided
-    "as is" without express or implied warranty.
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-SHA-1 in C
-
-Use of any of this software is governed by the terms of the license below:
-
-	  SHA-1 in C
-	  By Steve Reid 
-	  100% Public Domain
-
-Additional License(s)
-
-100% Public Domain
-
-***************************************************************************
-
-%%The following software may be included in this product:
-TCMalloc (part of google-perftools)
-
-Use of any of this software is governed by the terms of the license below:
-
-# Copyright (c) 1998-2006, Google Inc.
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-# 
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Additional License(s)
-
-*** File src/tests/ptmalloc/thread-m.h contains this GPLv2 (or later)
-text:
-
-/* Basic platform-independent macro definitions for mutexes and
-   thread-specific data.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Wolfram Gloger , 1996.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite
-   330, Boston, MA 02111-1307, USA.  */
-
-
-
-*** File src/tests/ptmalloc/malloc-machine.h contains this BSD like text:
-
-/* Basic platform-independent macro definitions for mutexes,
-   thread-specific data and parameters for malloc.
-   Posix threads (pthreads) version.
-   Copyright (C) 2004 Wolfram Gloger .
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that (i) the above copyright notices and this permission
-notice appear in all copies of the software and related documentation,
-and (ii) the name of Wolfram Gloger may not be used in any advertising
-or publicity relating to the software.
-
-THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL,
-INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY
-DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY
-OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-The tz database
-
-Use of any of this software is governed by the terms of the license below:
-
-Sources for Time Zone and Daylight Saving Time Data
-@(#)tz-link.htm 7.54
-
-Please send corrections to this web page to the time zone mailing list.
-The tz database
-
-The public-domain time zone database contains code and data that represent the
-history of local time for many representative locations around the globe. It is
-updated periodically to reflect changes made by political bodies to time zone
-boundaries, UTC offsets, and daylight-saving rules. This database (often called
-tz or zoneinfo) is used by several implementations, including the GNU C Library
-used in GNU/Linux, FreeBSD, NetBSD, OpenBSD, Cygwin, DJGPP, HP-UX, IRIX, Mac OS
-X, OpenVMS, Solaris, Tru64, and UnixWare.
-
-Each location in the database represents a national region where all clocks
-keeping local time have agreed since 1970. Locations are identified by continent
-or ocean and then by the name of the location, which is typically the largest
-city within the region. For example, America/New_York represents most of the US
-eastern time zone; America/Phoenix represents most of Arizona, which uses
-mountain time without daylight saving time (DST); America/Detroit represents
-most of Michigan, which uses eastern time but with different DST rules in 1975;
-and other entries represent smaller regions like Starke County, Indiana, which
-switched from central to eastern time in 1991 and switched back in 2006. To use
-the database on an extended POSIX implementation set the TZ environment variable
-to the location's full name, e.g., TZ="America/New_York".
-
-In the tz database's FTP distribution the code is in the file tzcodeC.tar.gz,
-where C is the code's version; similarly, the data are in tzdataD.tar.gz, where
-D is the data's version. The following shell commands download these files to a
-GNU/Linux or similar host; see the downloaded README file for what to do next.
-
-wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
-gzip -dc tzcode*.tar.gz | tar -xf -
-gzip -dc tzdata*.tar.gz | tar -xf -
-
-The code lets you compile the tz source files into machine-readable binary
-files, one for each location. It also lets you read a tz binary file and
-interpret time stamps for that location.
-
-The data are by no means authoritative. If you find errors, please send changes
-to the time zone mailing list. You can also subscribe to the mailing list,
-retrieve the archive of old messages (in gzip compressed format), or retrieve
-archived older versions of code and data; there is also a smaller HTTP mirror.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-UnicodeData.txt
-
-Use of any of this software is governed by the terms of the license below:
-
-Unicode Terms of Use
-
-    For the general privacy policy governing access to this site, see the
-    Unicode Privacy Policy. For trademark usage, see the Unicode
-    Consortium (R) Trademarks and Logo Policy.
-    Notice to End User: Terms of Use
-    Carefully read the following legal agreement ("Agreement"). Use or
-    copying of the software and/or codes provided with this agreement (The
-    "Software") constitutes your acceptance of these terms
-
-       1. Unicode Copyright.
-             1. Copyright (c) 1991-2008 Unicode, Inc. All rights reserved.
-             2. Certain documents and files on this website contain a
-             legend indicating that "Modification is permitted." Any person
-             is hereby authorized, without fee, to modify such documents
-             and files to create derivative works conforming to the
-             Unicode (R) Standard, subject to Terms and Conditions herein.
-             3. Any person is hereby authorized, without fee, to view, use,
-             reproduce, and distribute all documents and files solely for
-             informational purposes in the creation of products supporting
-             the Unicode Standard, subject to the Terms and Conditions
-             herein.
-             4. Further specifications of rights and restrictions
-             pertaining to the use of the particular set of data files
-             known as the "Unicode Character Database" can be found in
-             Exhibit 1.
-             5. Each version of the Unicode Standard has further
-             specifications of rights and restrictions of use. For the book
-             editions, these are found on the back of the title page. For
-             the online edition, certain files (such as the PDF files for
-             book chapters and code charts) carry specific restrictions.
-             All other files are covered under these general Terms of Use.
-             To request a permission to reproduce any part of the Unicode
-             Standard, please contact the Unicode Consortium.
-             6. No license is granted to "mirror" the Unicode website where
-             a fee is charged for access to the "mirror" site.
-             7. Modification is not permitted with respect to this
-             document. All copies of this document must be verbatim.
-       2. Restricted Rights Legend. Any technical data or software which is
-       licensed to the United States of America, its agencies and/or
-       instrumentalities under this Agreement is commercial technical data
-       or commercial computer software developed exclusively at private
-       expense as defined in FAR 2.101, or DFARS 252.227-7014 (June 1995),
-       as applicable. For technical data, use, duplication, or disclosure
-       by the Government is subject to restrictions as set forth in DFARS
-       202.227-7015 Technical Data, Commercial and Items (Nov 1995) and
-       this Agreement. For Software, in accordance with FAR 12-212 or DFARS
-       227-7202, as applicable, use, duplication or disclosure by the
-       Government is subject to the restrictions set forth in this
-       Agreement.
-       3. Warranties and Disclaimers.
-             1. This publication and/or website may include technical or
-             typographical errors or other inaccuracies . Changes are
-             periodically added to the information herein; these changes
-             will be incorporated in new editions of the publication and/or
-             website. Unicode may make improvements and/or changes in the
-             product(s) and/or program(s) described in this publication
-             and/or website at any time.
-             2. If this file has been purchased on magnetic or optical
-             media from Unicode, Inc. the sole and exclusive remedy for any
-             claim will be exchange of the defective media within ninety
-             (90) days of original purchase.
-             3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR
-             SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
-             EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
-             LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-             PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS
-             LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN
-             THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE
-             REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE
-             WEBSITE.
-       4. Waiver of Damages. In no event shall Unicode or its licensors be
-       liable for any special, incidental, indirect or consequential
-       damages of any kind, or any damages whatsoever, whether or not
-       Unicode was advised of the possibility of the damage, including,
-       without limitation, those resulting from the following: loss of use,
-       data or profits, in connection with the use, modification or
-       distribution of this information or its derivatives.
-       5. Trademarks.
-             1. Unicode and the Unicode logo are registered trademarks of
-             Unicode, Inc. 
-             2. This site contains product names and corporate names of
-             other companies. All product names and company names and logos
-             mentioned herein are the trademarks or registered trademarks
-             of their respective owners. Other products and corporate names
-             mentioned herein which are trademarks of a third party are
-             used only for explanation and for the owners' benefit and with
-             no intent to infringe.
-             3. Use of third party products or information referred to
-             herein is at the user's risk.
-       6. Miscellaneous.
-             1. Jurisdiction and Venue. This server is operated from a
-             location in the State of California, United States of America.
-             Unicode makes no representation that the materials are
-             appropriate for use in other locations. If you access this
-             server from other locations, you are responsible for
-             compliance with local laws. This Agreement, all use of this
-             site and any claims and damages resulting from use of this
-             site are governed solely by the laws of the State of
-             California without regard to any principles which would apply
-             the laws of a different jurisdiction. The user agrees that any
-             disputes regarding this site shall be resolved solely in the
-             courts located in Santa Clara County, California. The user
-             agrees said courts have personal jurisdiction and agree to
-             waive any right to transfer the dispute to any other forum.
-             2. Modification by Unicode Unicode shall have the right to
-             modify this Agreement at any time by posting it to this site.
-             The user may not assign any part of this Agreement without
-             Unicode's prior written consent.
-             3. Taxes. The user agrees to pay any taxes arising from access
-             to this website or use of the information herein, except for
-             those based on Unicode's net income.
-             4. Severability.  If any provision of this Agreement is
-             declared invalid or unenforceable, the remaining provisions of
-             this Agreement shall remain in effect.
-             5. Entire Agreement. This Agreement constitutes the entire
-             agreement between the parties. 
-
-EXHIBIT 1
-UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
-    Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/ . Unicode Software includes any source code
-published in the Unicode Standard or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/.
-
-    NOTICE TO USER: Carefully read the following legal agreement. BY
-DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES
-("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND
-AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU
-DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES
-OR SOFTWARE.
-
-    COPYRIGHT AND PERMISSION NOTICE
-
-    Copyright (c) 1991-2008 Unicode, Inc. All rights reserved. Distributed under
-the Terms of Use in http://www.unicode.org/copyright.html.
-
-    Permission is hereby granted, free of charge, to any person obtaining a copy
-of the Unicode data files and any associated documentation (the "Data Files") or
-Unicode software and any associated documentation (the "Software") to deal in
-the Data Files or Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files or
-Software are furnished to do so, provided that (a) the above copyright notice(s)
-and this permission notice appear with all copies of the Data Files or Software,
-(b) both the above copyright notice(s) and this permission notice appear in
-associated documentation, and (c) there is clear notice in each modified Data
-File or in the Software as well as in the documentation associated with the Data
-File(s) or Software that the data or software has been modified.
-
-    THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
-PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
-OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-    Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in these Data Files or Software without prior written authorization of the
-copyright holder.
-
-    Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
-registered in some jurisdictions. All other trademarks and registered trademarks
-mentioned herein are the property of their respective owners.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-zlib
-
-Use of any of this software is governed by the terms of the license below:
-
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.3, July 18th, 2005
-
-  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly jloup@gzip.org
-  Mark Adler madler@stripped
-
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-dtoa.c
-
-Use of any of this software is governed by the terms of the license below:
-
-/****************************************************************
-
-  This file incorporates work covered by the following copyright and
-  permission notice:
-
-  The author of this software is David M. Gay.
-
-  Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
-
-  Permission to use, copy, modify, and distribute this software for any
-  purpose without fee is hereby granted, provided that this entire
-  notice is included in all copies of any software which is or includes a copy
-  or modification of this software and in all copies of the supporting
-  documentation for such software.
-
-  THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
-  WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
-  REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
-  OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
-
- ***************************************************************/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-getarg.{c,h}
-
-Use of any of this software is governed by the terms of the license below:
-
-/* Copyright (C) 2003 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
-
-/*
- * Copyright (c) 1997, 1999 Kungliga Tekniska H366gskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-MD5 message-digest algorithm (md5_hash.cpp)
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest.  This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * The code has been modified by Mikael Ronstroem to handle
- * calculating a hash value of a key that is always a multiple
- * of 4 bytes long. Word 0 of the calculated 4-word hash value
- * is returned as the hash value.
- */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-nt_servc.{cc,h}
-
-Use of any of this software is governed by the terms of the license below:
-
-/**
-  @file
-
-  @brief
-  Windows NT Service class library.
-
-  Copyright Abandoned 1998 Irena Pancirov - Irnet Snc
-  This file is public domain and comes with NO WARRANTY of any kind
-*/
-
-***************************************************************************
-
-%%The following software may be included in this product:
-GNU Readline
-
-Use of any of this software is governed by the terms of the license below:
-
-GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    
-    Copyright (C)   
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  , 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
-
-***************************************************************************
-
-%%The following software may be included in this product:
-pstack (part of GNU Binutils)
-
-Use of any of this software is governed by the terms of the license below:
-
-pstack is comprised of various .c and .h files; all begin like this:
-
-/* bucomm.h -- binutils common include file.
-   Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-
-This file is part of GNU Binutils.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-libiberty.h (part of pstack GNU Binutils)
-
-Use of any of this software is governed by the terms of the license below:
-
-See
-http://www.koders.com/c/fid99F596804BBE22C076522B848D5575F142079064.aspx
-
-/* Function declarations for libiberty.
-   Written by Cygnus Support, 1994.
-
-   The libiberty library provides a number of functions which are
-   missing on some operating systems.  We do not declare those here,
-   to avoid conflicts with the system header files on operating
-   systems that do support those functions.  In this file we only
-   declare those functions which are specific to libiberty.  */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-ieee.h (part of pstack GNU Binutils)
-
-Use of any of this software is governed by the terms of the license below:
-
-See
-http://src.opensolaris.org/source/xref//sfw/usr/src/cmd/gdb/gdb-6.3/include/ieee.h
-
-
-/* IEEE Standard 695-1980 "Universal Format for Object Modules"
-   header file
-   Contributed by Cygnus Support.  */
-
-***************************************************************************
-
-%%The following software may be included in this product:
-pstack.c (part of pstack GNU Binutils)
-
-Use of any of this software is governed by the terms of the license below:
-
-/*
- pstack.c -- asynchronous stack trace of a running process
- Copyright (c) 1999 Ross Thompson
- Author: Ross Thompson 
- Critical bug fix: Tim Waugh
-*/
-
-/*
- This file is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-**********************************************************************

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2011-01-16 04:02:29 +0000
+++ b/client/mysqladmin.cc	2011-02-11 14:38:34 +0000
@@ -375,7 +375,8 @@ int main(int argc,char *argv[])
       /* Return 0 if all commands are PING */
       for (; argc > 0; argv++, argc--)
       {
-        if (find_type(argv[0], &command_typelib, 2) != ADMIN_PING)
+        if (find_type(argv[0], &command_typelib, FIND_TYPE_BASIC) !=
+            ADMIN_PING)
         {
           error= 1;
           break;
@@ -598,7 +599,7 @@ static int execute_commands(MYSQL *mysql
 
   for (; argc > 0 ; argv++,argc--)
   {
-    switch (find_type(argv[0],&command_typelib,2)) {
+    switch (find_type(argv[0],&command_typelib, FIND_TYPE_BASIC)) {
     case ADMIN_CREATE:
     {
       char buff[FN_REFLEN+20];
@@ -937,7 +938,7 @@ static int execute_commands(MYSQL *mysql
 
       if (typed_password[0])
       {
-        bool old= (find_type(argv[0], &command_typelib, 2) ==
+        bool old= (find_type(argv[0], &command_typelib, FIND_TYPE_BASIC) ==
                    ADMIN_OLD_PASSWORD);
 #ifdef __WIN__
         size_t pw_len= strlen(typed_password);

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2011-02-21 07:15:46 +0000
+++ b/client/mysqldump.c	2011-03-17 09:47:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -4669,7 +4669,7 @@ static ulong find_set(TYPELIB *lib, cons
       for (; pos != end && *pos != ','; pos++) ;
       var_len= (uint) (pos - start);
       strmake(buff, start, min(sizeof(buff) - 1, var_len));
-      find= find_type(buff, lib, var_len);
+      find= find_type(buff, lib, FIND_TYPE_BASIC);
       if (!find)
       {
         *err_pos= (char*) start;

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-03-07 15:17:39 +0000
+++ b/client/mysqltest.cc	2011-03-17 09:43:28 +0000
@@ -8021,7 +8021,7 @@ void get_command_type(struct st_command*
 
   save= command->query[command->first_word_len];
   command->query[command->first_word_len]= 0;
-  type= find_type(command->query, &command_typelib, 1+2);
+  type= find_type(command->query, &command_typelib, FIND_TYPE_NO_PREFIX);
   command->query[command->first_word_len]= save;
   if (type > 0)
   {

=== modified file 'cmake/mysql_version.cmake'
--- a/cmake/mysql_version.cmake	2010-11-24 10:50:17 +0000
+++ b/cmake/mysql_version.cmake	2011-03-17 09:47:50 +0000
@@ -17,7 +17,7 @@
 # Global constants, only to be changed between major releases.
 #
 
-SET(SHARED_LIB_MAJOR_VERSION "16")
+SET(SHARED_LIB_MAJOR_VERSION "18")
 SET(PROTOCOL_VERSION "10")
 SET(DOT_FRM_VERSION "6")
 

=== modified file 'include/decimal.h'
--- a/include/decimal.h	2007-05-24 10:24:36 +0000
+++ b/include/decimal.h	2011-03-03 14:25:41 +0000
@@ -29,14 +29,14 @@ typedef struct st_decimal_t {
 
 int internal_str2dec(const char *from, decimal_t *to, char **end,
                      my_bool fixed);
-int decimal2string(decimal_t *from, char *to, int *to_len,
+int decimal2string(const decimal_t *from, char *to, int *to_len,
                    int fixed_precision, int fixed_decimals,
                    char filler);
 int decimal2ulonglong(decimal_t *from, ulonglong *to);
 int ulonglong2decimal(ulonglong from, decimal_t *to);
 int decimal2longlong(decimal_t *from, longlong *to);
 int longlong2decimal(longlong from, decimal_t *to);
-int decimal2double(decimal_t *from, double *to);
+int decimal2double(const decimal_t *from, double *to);
 int double2decimal(double from, decimal_t *to);
 int decimal_actual_fraction(decimal_t *from);
 int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
@@ -47,17 +47,17 @@ int decimal_bin_size(int precision, int
 int decimal_result_size(decimal_t *from1, decimal_t *from2, char op,
                         int param);
 
-int decimal_intg(decimal_t *from);
-int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_cmp(decimal_t *from1, decimal_t *from2);
-int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to,
+int decimal_intg(const decimal_t *from);
+int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_cmp(const decimal_t *from1, const decimal_t *from2);
+int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to,
                 int scale_incr);
-int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to);
-int decimal_round(decimal_t *from, decimal_t *to, int new_scale,
+int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to);
+int decimal_round(const decimal_t *from, decimal_t *to, int new_scale,
                   decimal_round_mode mode);
-int decimal_is_zero(decimal_t *from);
+int decimal_is_zero(const decimal_t *from);
 void max_decimal(int precision, int frac, decimal_t *to);
 
 #define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)

=== modified file 'include/mysql.h.pp'
--- a/include/mysql.h.pp	2010-10-25 13:49:55 +0000
+++ b/include/mysql.h.pp	2011-02-11 14:38:34 +0000
@@ -227,7 +227,7 @@ typedef struct st_typelib {
 extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
 extern int find_type_or_exit(const char *x, TYPELIB *typelib,
                              const char *option);
-extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
 extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
 extern const char *get_type(TYPELIB *typelib,unsigned int nr);
 extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);

=== modified file 'include/typelib.h'
--- a/include/typelib.h	2010-07-05 16:22:19 +0000
+++ b/include/typelib.h	2011-02-11 14:38:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,7 +29,17 @@ typedef struct st_typelib {	/* Different
 extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
 extern int find_type_or_exit(const char *x, TYPELIB *typelib,
                              const char *option);
-extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+#define FIND_TYPE_BASIC           0
+/** makes @c find_type() require the whole name, no prefix */
+#define FIND_TYPE_NO_PREFIX      (1 << 0)
+/** always implicitely on, so unused, but old code may pass it */
+#define FIND_TYPE_NO_OVERWRITE   (1 << 1)
+/** makes @c find_type() accept a number */
+#define FIND_TYPE_ALLOW_NUMBER   (1 << 2)
+/** makes @c find_type() treat ',' as terminator */
+#define FIND_TYPE_COMMA_TERM     (1 << 3)
+
+extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
 extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
 extern const char *get_type(TYPELIB *typelib,unsigned int nr);
 extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);

=== modified file 'mysql-test/extra/rpl_tests/rpl_stop_middle_group.test'
--- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2011-03-17 13:20:36 +0000
@@ -23,8 +23,8 @@ insert into tm set a=null; # to simulate
 commit;
 
 connection slave;
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
-call mtr.add_suppression("Slave SQL.*The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed.");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+call mtr.add_suppression("Slave SQL.*Slave SQL Thread stopped with incomplete event group having non-transactional changes");
 
 # slave will catch the killed status but won't shut down immediately
 # only after the whole group has done (commit)

=== modified file 'mysql-test/include/have_plugin_auth.inc'
--- a/mysql-test/include/have_plugin_auth.inc	2010-08-09 08:32:50 +0000
+++ b/mysql-test/include/have_plugin_auth.inc	2011-03-18 09:31:39 +0000
@@ -2,3 +2,4 @@ disable_query_log;
 --require r/true.require
 select (PLUGIN_LIBRARY LIKE 'auth_test_plugin%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS 
   WHERE PLUGIN_NAME='test_plugin_server';
+enable_query_log;

=== modified file 'mysql-test/include/icp_tests.inc'
--- a/mysql-test/include/icp_tests.inc	2011-01-31 11:56:15 +0000
+++ b/mysql-test/include/icp_tests.inc	2011-03-17 11:48:04 +0000
@@ -821,3 +821,20 @@ SELECT * FROM t1 WHERE i2 IN (3, 6) LIMI
 INSERT INTO t1 (i2) VALUES (1);
 
 DROP TABLE t1;
+
+--echo #
+--echo # Bug #11766678 - 59843:
+--echo # USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
+--echo #
+
+CREATE TABLE t1 (
+  col999 FLOAT NOT NULL,
+  COL1000 VARBINARY(179) NOT NULL,
+  col1003 DATE DEFAULT NULL,
+  KEY idx4267 (col1000, col1003)
+);
+
+INSERT INTO t1 VALUES (),();
+SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
+
+DROP TABLE t1;

=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result	2010-12-08 12:55:40 +0000
+++ b/mysql-test/r/archive.result	2011-03-03 09:22:17 +0000
@@ -12807,3 +12807,19 @@ DROP TABLE t1;
 #
 CREATE TABLE `a/../`(a INT) ENGINE=ARCHIVE;
 DROP TABLE `a/../`;
+#
+# BUG#57162 - valgrind errors, random data when returning
+#             ordered data from archive tables
+#
+SET sort_buffer_size=32804;
+CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
+e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
+INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
+SELECT * FROM t1 ORDER BY f LIMIT 1;
+a	b	c	d	e	f
+-1	b	c	d	e	1
+DROP TABLE t1;
+SET sort_buffer_size=DEFAULT;

=== modified file 'mysql-test/r/cast.result'
--- a/mysql-test/r/cast.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/cast.result	2011-03-15 14:56:11 +0000
@@ -451,4 +451,19 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1,
 1
 1
 DROP TABLE t1;
+#
+# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING 
+#   DOESN'T ADHERE TO MAX_ALLOWED_PACKET
+SET @@GLOBAL.max_allowed_packet=2048;
+SELECT CONVERT('a', BINARY(2049));
+CONVERT('a', BINARY(2049))
+NULL
+Warnings:
+Warning	1301	Result of cast_as_binary() was larger than max_allowed_packet (2048) - truncated
+SELECT CONVERT('a', CHAR(2049));
+CONVERT('a', CHAR(2049))
+NULL
+Warnings:
+Warning	1301	Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
+SET @@GLOBAL.max_allowed_packet=default;
 End of 5.1 tests

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2011-01-14 15:36:19 +0000
+++ b/mysql-test/r/func_math.result	2011-03-18 12:25:56 +0000
@@ -656,3 +656,11 @@ Warning	1366	Incorrect decimal value: ''
 SELECT 1 div null;
 1 div null
 NULL
+#
+# Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
+#
+select (1.175494351E-37 div 1.7976931348623157E+308);
+(1.175494351E-37 div 1.7976931348623157E+308)
+0
+Warnings:
+Warning	1292	Truncated incorrect DECIMAL value: ''

=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-02-21 08:23:02 +0000
+++ b/mysql-test/r/func_time.result	2011-03-17 09:47:50 +0000
@@ -1408,3 +1408,15 @@ NULL	1	NULL
 SET storage_engine=NULL;
 ERROR 42000: Variable 'storage_engine' can't be set to the value of 'NULL'
 #
+# Bug #59686 crash in String::copy() with time data type
+#
+SELECT min(timestampadd(month, 1>'', from_days('%Z')));
+min(timestampadd(month, 1>'', from_days('%Z')))
+NULL
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '%Z'
+create table t1(a time);
+insert into t1 values ('00:00:00'),('00:01:00');
+select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
+1
+drop table t1;

=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2011-03-08 19:14:42 +0000
+++ b/mysql-test/r/gis.result	2011-03-17 11:33:17 +0000
@@ -1043,6 +1043,10 @@ create spatial index i on t1 (a);
 ERROR 42000: A SPATIAL index may only contain a geometrical type column
 drop table t1;
 End of 5.1 tests
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+CREATE SPATIAL INDEX i on t0 (a);
+ERROR 42000: A SPATIAL index may only contain a geometrical type column
+INSERT INTO t0 VALUES (1);
 CREATE TABLE t1(
 col0 BINARY NOT NULL,
 col2 TIMESTAMP,
@@ -1071,8 +1075,8 @@ col2 LINESTRING,
 SPATIAL INDEX i1 (col1, col2)
 );
 ERROR HY000: Incorrect arguments to SPATIAL INDEX
-DROP TABLE t1;
-DROP TABLE t2;
+DROP TABLE t0, t1, t2;
+End of 5.5 tests
 DROP DATABASE IF EXISTS gis_ogs;
 CREATE DATABASE gis_ogs;
 USE gis_ogs;

=== modified file 'mysql-test/r/grant.result'
--- a/mysql-test/r/grant.result	2011-03-09 14:30:37 +0000
+++ b/mysql-test/r/grant.result	2011-03-18 14:58:27 +0000
@@ -54,7 +54,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
@@ -125,7 +125,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
@@ -172,7 +172,7 @@ max_updates	20
 max_connections	30
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
@@ -284,7 +284,6 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'authentication_string' doesn't have a default value
 insert into mysql.db (host, db, user, select_priv) values
 ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
 alter table mysql.db order by db asc;

=== modified file 'mysql-test/r/grant2.result'
--- a/mysql-test/r/grant2.result	2010-08-09 08:32:50 +0000
+++ b/mysql-test/r/grant2.result	2011-03-18 14:16:17 +0000
@@ -287,7 +287,6 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'authentication_string' doesn't have a default value
 create user mysqltest_A@'%';
 rename user mysqltest_B@'%' to mysqltest_C@'%';
 drop user mysqltest_C@'%';
@@ -355,7 +354,6 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'authentication_string' doesn't have a default value
 INSERT INTO mysql.db (host, db, user, select_priv) VALUES
 ('%','TESTDB','mysqltest_1','Y');
 FLUSH PRIVILEGES;

=== modified file 'mysql-test/r/innodb_icp.result'
--- a/mysql-test/r/innodb_icp.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/innodb_icp.result	2011-03-17 11:48:04 +0000
@@ -759,5 +759,22 @@ pk	i1	c1	i2
 2	1	she	6
 INSERT INTO t1 (i2) VALUES (1);
 DROP TABLE t1;
+#
+# Bug #11766678 - 59843:
+# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
+#
+CREATE TABLE t1 (
+col999 FLOAT NOT NULL,
+COL1000 VARBINARY(179) NOT NULL,
+col1003 DATE DEFAULT NULL,
+KEY idx4267 (col1000, col1003)
+);
+INSERT INTO t1 VALUES (),();
+Warnings:
+Warning	1364	Field 'col999' doesn't have a default value
+Warning	1364	Field 'COL1000' doesn't have a default value
+SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
+col999
+DROP TABLE t1;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/innodb_icp_none.result'
--- a/mysql-test/r/innodb_icp_none.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/innodb_icp_none.result	2011-03-17 11:48:04 +0000
@@ -758,5 +758,22 @@ pk	i1	c1	i2
 2	1	she	6
 INSERT INTO t1 (i2) VALUES (1);
 DROP TABLE t1;
+#
+# Bug #11766678 - 59843:
+# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
+#
+CREATE TABLE t1 (
+col999 FLOAT NOT NULL,
+COL1000 VARBINARY(179) NOT NULL,
+col1003 DATE DEFAULT NULL,
+KEY idx4267 (col1000, col1003)
+);
+INSERT INTO t1 VALUES (),();
+Warnings:
+Warning	1364	Field 'col999' doesn't have a default value
+Warning	1364	Field 'COL1000' doesn't have a default value
+SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
+col999
+DROP TABLE t1;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_icp.result'
--- a/mysql-test/r/myisam_icp.result	2011-01-31 11:56:15 +0000
+++ b/mysql-test/r/myisam_icp.result	2011-03-17 11:48:04 +0000
@@ -757,4 +757,21 @@ pk	i1	c1	i2
 2	1	she	6
 INSERT INTO t1 (i2) VALUES (1);
 DROP TABLE t1;
+#
+# Bug #11766678 - 59843:
+# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
+#
+CREATE TABLE t1 (
+col999 FLOAT NOT NULL,
+COL1000 VARBINARY(179) NOT NULL,
+col1003 DATE DEFAULT NULL,
+KEY idx4267 (col1000, col1003)
+);
+INSERT INTO t1 VALUES (),();
+Warnings:
+Warning	1364	Field 'col999' doesn't have a default value
+Warning	1364	Field 'COL1000' doesn't have a default value
+SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
+col999
+DROP TABLE t1;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_icp_none.result'
--- a/mysql-test/r/myisam_icp_none.result	2011-01-31 11:56:15 +0000
+++ b/mysql-test/r/myisam_icp_none.result	2011-03-17 11:48:04 +0000
@@ -756,4 +756,21 @@ pk	i1	c1	i2
 2	1	she	6
 INSERT INTO t1 (i2) VALUES (1);
 DROP TABLE t1;
+#
+# Bug #11766678 - 59843:
+# USING UNINITIALISED VALUE IN USES_INDEX_FIELDS_ONLY
+#
+CREATE TABLE t1 (
+col999 FLOAT NOT NULL,
+COL1000 VARBINARY(179) NOT NULL,
+col1003 DATE DEFAULT NULL,
+KEY idx4267 (col1000, col1003)
+);
+INSERT INTO t1 VALUES (),();
+Warnings:
+Warning	1364	Field 'col999' doesn't have a default value
+Warning	1364	Field 'COL1000' doesn't have a default value
+SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
+col999
+DROP TABLE t1;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/mysqladmin.result'
--- a/mysql-test/r/mysqladmin.result	2011-01-16 03:25:30 +0000
+++ b/mysql-test/r/mysqladmin.result	2011-03-17 12:34:53 +0000
@@ -11,3 +11,10 @@ mysqld is alive
 # Displaying the output :
 mysqld is alive
 mysqld is alive
+#
+# BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
+#                with no .cnf or .ini extension.
+#
+# Creating an empty file 'cnf_file'
+# Using --defaults-extra-file option with 'cnf_file'.
+mysqld is alive

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2011-02-21 07:28:19 +0000
+++ b/mysql-test/r/mysqldump.result	2011-03-17 12:45:19 +0000
@@ -4631,6 +4631,7 @@ DELIMITER ;
 /*!50003 SET collation_connection  = @saved_col_connection */ ;
 ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
 DROP DATABASE `test-database`;
+USE `test`;
 #
 # End of 5.1 tests
 #
@@ -4685,3 +4686,35 @@ DELIMITER ;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 DROP TABLE t1;
+#
+# Verify that two modes can be given in --compatible;
+# and are reflected in SET SQL_MODE in the mysqldump output.
+# Also verify that a prefix of the mode's name is enough.
+#
+CREATE TABLE t1 (a INT);
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;

=== added file 'mysql-test/r/optimizer_debug_sync.result'
--- a/mysql-test/r/optimizer_debug_sync.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/optimizer_debug_sync.result	2011-03-01 14:57:53 +0000
@@ -0,0 +1,23 @@
+
+BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...)
+
+CREATE TABLE t(i INT NOT NULL PRIMARY KEY, f INT) ENGINE = InnoDB;
+INSERT INTO t VALUES (1,1),(2,2);
+BEGIN;
+UPDATE t SET f=100 WHERE i=2;
+set optimizer_switch='semijoin=off';
+SET DEBUG_SYNC='before_index_end_in_subselect WAIT_FOR callit';
+SELECT f FROM t WHERE i IN ( SELECT i FROM t );
+SELECT MAX(i) FROM t FOR UPDATE;
+SELECT MAX(i) FROM t FOR UPDATE;
+SET DEBUG_SYNC='now SIGNAL callit';
+COMMIT;
+f
+1
+2
+SET DEBUG_SYNC='RESET';
+MAX(i)
+2
+MAX(i)
+2
+DROP TABLE t;

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2011-02-08 17:48:20 +0000
+++ b/mysql-test/r/plugin_auth.result	2011-03-18 14:58:27 +0000
@@ -345,4 +345,62 @@ select USER(),CURRENT_USER();
 USER()	CURRENT_USER()
 uplain@localhost	uplain@localhost
 DROP USER uplain@localhost;
+#
+# Bug #59038 : mysql.user.authentication_string column 
+#   causes configuration wizard to fail
+INSERT INTO mysql.user(
+Host, 
+User, 
+Password,  
+Select_priv, 
+Insert_priv,
+Update_priv, 
+Delete_priv, 
+Create_priv, 
+Drop_priv,  
+Reload_priv, 
+Shutdown_priv,
+Process_priv, 
+File_priv, 
+Grant_priv, 
+References_priv,  
+Index_priv, 
+Alter_priv,
+Show_db_priv, 
+Super_priv, 
+Create_tmp_table_priv, 
+Lock_tables_priv,  
+Execute_priv,
+Repl_slave_priv, 
+Repl_client_priv, 
+/*!50001 
+Create_view_priv, 
+Show_view_priv, 
+Create_routine_priv, 
+Alter_routine_priv, 
+Create_user_priv, 
+*/ 
+ssl_type, 
+ssl_cipher,
+x509_issuer, 
+x509_subject, 
+max_questions, 
+max_updates, 
+max_connections)
+VALUES (
+'localhost', 
+'inserttest', '', 
+'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
+'Y', 'Y',  'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 
+/*!50001 'Y', 'Y', 'Y', 'Y', 'Y', */'', '', '', '', '0', '0', '0');
+FLUSH PRIVILEGES;
+DROP USER inserttest@localhost;
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE 
+COLUMN_NAME IN ('authentication_string', 'plugin') AND 
+TABLE_NAME='user' AND
+TABLE_SCHEMA='mysql'
+ORDER BY COLUMN_NAME;
+IS_NULLABLE	COLUMN_NAME
+YES	authentication_string
+YES	plugin
 End of 5.5 tests

=== modified file 'mysql-test/r/plugin_auth_qa.result'
--- a/mysql-test/r/plugin_auth_qa.result	2010-10-20 14:56:09 +0000
+++ b/mysql-test/r/plugin_auth_qa.result	2011-03-18 14:16:17 +0000
@@ -105,7 +105,7 @@ CREATE USER plug_dest IDENTIFIED BY 'plu
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 plug	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 DROP USER plug, plug_dest;
 CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -115,7 +115,7 @@ DROP USER plug;
 CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 DROP USER plug_dest;
 GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -125,7 +125,7 @@ CREATE USER plug_dest IDENTIFIED BY 'plu
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 plug	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 DROP USER plug, plug_dest;
 GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -135,7 +135,7 @@ DROP USER plug;
 CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 DROP USER plug_dest;
 CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -145,7 +145,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* T
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 plug	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 DROP USER plug, plug_dest;
 CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -155,7 +155,7 @@ DROP USER plug;
 GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 DROP USER plug_dest;
 CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
 GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
@@ -210,7 +210,7 @@ DROP USER plwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plüg_dest		
+plüg_dest		NULL
 DROP USER plüg_dest;
 SET NAMES ascii;
 CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
@@ -221,7 +221,7 @@ DROP USER 'plüg';
 CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-pl??g_dest		
+pl??g_dest		NULL
 DROP USER 'plüg_dest';
 SET NAMES latin1;
 ========== test 1.1.1.5 ====================================
@@ -235,7 +235,7 @@ DROP USER 'plug';
 CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plüg_dest		
+plüg_dest		NULL
 DROP USER 'plüg_dest';
 SET NAMES utf8;
 CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
@@ -248,7 +248,7 @@ DROP USER 'plüg';
 CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plüg_dest		
+plüg_dest		NULL
 DROP USER 'plüg_dest';
 CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
@@ -258,7 +258,7 @@ DROP USER plüg;
 CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plüg_dest		
+plüg_dest		NULL
 DROP USER plüg_dest;
 ========== test 1.1.1.2/1.1.2.2=============================
 SET @auth_name= 'test_plugin_server';
@@ -278,7 +278,7 @@ DROP USER plug;
 CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-hh's_plug_dest		
+hh's_plug_dest		NULL
 DROP USER 'hh''s_plug_dest';
 ========== test 1.1.1.4 ====================================
 CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
@@ -294,7 +294,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* T
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 grant_user	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 DROP USER grant_user,plug_dest;
 set @save_sql_mode= @@sql_mode;
 SET @@sql_mode=no_auto_create_user;
@@ -315,13 +315,13 @@ CREATE USER plug_dest IDENTIFIED BY 'plu
 SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string	password
 grant_user	test_plugin_server	plug_dest	
-plug_dest			*939AEE68989794C0F408277411C26055CDF41119
+plug_dest		NULL	*939AEE68989794C0F408277411C26055CDF41119
 DROP USER plug_dest;
 GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
 SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string	password
 grant_user	test_plugin_server	plug_dest	
-plug_dest			*560881EB651416CEF77314D07D55EDCD5FC1BD6D
+plug_dest		NULL	*560881EB651416CEF77314D07D55EDCD5FC1BD6D
 DROP USER grant_user,plug_dest;
 set @@sql_mode= @save_sql_mode;
 DROP DATABASE test_user_db;

=== modified file 'mysql-test/r/plugin_auth_qa_1.result'
--- a/mysql-test/r/plugin_auth_qa_1.result	2011-02-08 17:48:20 +0000
+++ b/mysql-test/r/plugin_auth_qa_1.result	2011-03-18 14:58:27 +0000
@@ -21,7 +21,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* T
 GRANT PROXY ON plug_dest TO plug_user;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 plug_user	test_plugin_server	plug_dest
 1)
 current_user()
@@ -74,7 +74,7 @@ GRANT PROXY ON new_dest TO plug_user;
 ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-new_dest		
+new_dest		NULL
 plug_user	test_plugin_server	plug_dest
 DROP USER plug_user,new_dest;
 CREATE USER plug_user
@@ -92,7 +92,7 @@ GRANT PROXY ON new_dest TO plug_user;
 ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES)
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-new_dest		
+new_dest		NULL
 plug_user	test_plugin_server	plug_dest
 DROP USER plug_user,new_dest;
 CREATE USER plug_user
@@ -114,13 +114,13 @@ connection default;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 new_user	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 disconnect plug_user;
 UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
 FLUSH PRIVILEGES;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 plug_user	test_plugin_server	plug_dest
 DROP USER plug_dest,plug_user;
 ========== test 1.3 ========================================
@@ -136,26 +136,26 @@ connection default;
 disconnect plug_user;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-plug_dest		
+plug_dest		NULL
 plug_user	test_plugin_server	plug_dest
 UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
 FLUSH PRIVILEGES;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 new_user	test_plugin_server	plug_dest
-plug_dest		
+plug_dest		NULL
 UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
 FLUSH PRIVILEGES;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 new_user	test_plugin_server	new_dest
-plug_dest		
+plug_dest		NULL
 UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
 FLUSH PRIVILEGES;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 new_user	new_plugin_server	new_dest
-plug_dest		
+plug_dest		NULL
 connect(plug_user,localhost,new_user,new_dest);
 ERROR HY000: Plugin 'new_plugin_server' is not loaded
 UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
@@ -164,7 +164,7 @@ FLUSH PRIVILEGES;
 GRANT PROXY ON new_dest TO new_user;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-new_dest		
+new_dest		NULL
 new_user	test_plugin_server	new_dest
 connect(plug_user,localhost,new_user,new_dest);
 select USER(),CURRENT_USER();
@@ -177,9 +177,9 @@ FLUSH PRIVILEGES;
 CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-new_dest		
+new_dest		NULL
 new_user	test_plugin_server	new_dest
-plug_dest		
+plug_dest		NULL
 GRANT ALL PRIVILEGES ON test.* TO new_user;
 connect(plug_user,localhost,new_dest,new_dest_passwd);
 select USER(),CURRENT_USER();
@@ -194,7 +194,7 @@ CREATE USER proxied_user IDENTIFIED BY '
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 	test_plugin_server	proxied_user
-proxied_user		
+proxied_user		NULL
 connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
 SELECT USER(),CURRENT_USER();
 USER()	CURRENT_USER()
@@ -231,7 +231,7 @@ CREATE USER proxied_user IDENTIFIED BY '
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 	test_plugin_server	proxied_user
-proxied_user		
+proxied_user		NULL
 connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
 SELECT USER(),CURRENT_USER();
 USER()	CURRENT_USER()
@@ -274,11 +274,11 @@ GRANT PROXY ON proxied_user_5 TO ''@'';
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
 	test_plugin_server	proxied_user
-proxied_user_1		
-proxied_user_2		
-proxied_user_3		
-proxied_user_4		
-proxied_user_5		
+proxied_user_1		NULL
+proxied_user_2		NULL
+proxied_user_3		NULL
+proxied_user_4		NULL
+proxied_user_5		NULL
 connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
 connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
 connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);

=== modified file 'mysql-test/r/plugin_auth_qa_2.result'
--- a/mysql-test/r/plugin_auth_qa_2.result	2010-10-25 10:24:26 +0000
+++ b/mysql-test/r/plugin_auth_qa_2.result	2011-03-18 14:16:17 +0000
@@ -7,7 +7,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* T
 GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-qa_test_1_dest		
+qa_test_1_dest		NULL
 qa_test_1_user	qa_auth_interface	qa_test_1_dest
 SELECT @@proxy_user;
 @@proxy_user
@@ -20,7 +20,7 @@ current_user()	user()	@@local.proxy_user
 qa_test_1_user@%	qa_test_1_user@localhost	NULL	NULL
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-qa_test_1_dest		
+qa_test_1_dest		NULL
 qa_test_1_user	qa_auth_interface	qa_test_1_dest
 DROP USER qa_test_1_user;
 DROP USER qa_test_1_dest;
@@ -33,8 +33,8 @@ GRANT PROXY ON qa_test_2_dest TO qa_test
 GRANT PROXY ON authenticated_as TO qa_test_2_user;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-authenticated_as		
-qa_test_2_dest		
+authenticated_as		NULL
+qa_test_2_dest		NULL
 qa_test_2_user	qa_auth_interface	qa_test_2_dest
 SELECT @@proxy_user;
 @@proxy_user
@@ -47,8 +47,8 @@ current_user()	user()	@@local.proxy_user
 authenticated_as@%	user_name@localhost	'qa_test_2_user'@'%'	'qa_test_2_user'@'%'
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string
-authenticated_as		
-qa_test_2_dest		
+authenticated_as		NULL
+qa_test_2_dest		NULL
 qa_test_2_user	qa_auth_interface	qa_test_2_dest
 DROP USER qa_test_2_user;
 DROP USER qa_test_2_dest;
@@ -83,8 +83,8 @@ GRANT PROXY ON qa_test_5_dest TO qa_test
 GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
 SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string	password
-			*DFCACE76914AD7BD801FC1A1ECF6562272621A22
-qa_test_5_dest			*DFCACE76914AD7BD801FC1A1ECF6562272621A22
+		NULL	*DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_5_dest		NULL	*DFCACE76914AD7BD801FC1A1ECF6562272621A22
 qa_test_5_user	qa_auth_interface	qa_test_5_dest	
 exec MYSQL PLUGIN_AUTH_OPT -h localhost -P MASTER_MYPORT --user=qa_test_5_user  --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
 ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES)
@@ -98,7 +98,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* T
 GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
 SELECT user,plugin,authentication_string,password FROM mysql.user;
 user	plugin	authentication_string	password
-qa_test_6_dest			*DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_dest		NULL	*DFCACE76914AD7BD801FC1A1ECF6562272621A22
 qa_test_6_user	qa_auth_interface	qa_test_6_dest	
 root			
 root			
@@ -109,7 +109,7 @@ ERROR 1045 (28000): Access denied for us
 GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
 SELECT user,plugin,authentication_string,password FROM mysql.user;
 user	plugin	authentication_string	password
-qa_test_6_dest			*DFCACE76914AD7BD801FC1A1ECF6562272621A22
+qa_test_6_dest		NULL	*DFCACE76914AD7BD801FC1A1ECF6562272621A22
 qa_test_6_user	qa_auth_interface	qa_test_6_dest	
 root			
 root			
@@ -121,7 +121,7 @@ ERROR 1045 (28000): Access denied for us
 REVOKE PROXY ON qa_test_6_dest FROM root;
 SELECT user,plugin,authentication_string FROM mysql.user;
 user	plugin	authentication_string
-qa_test_6_dest		
+qa_test_6_dest		NULL
 qa_test_6_user	qa_auth_interface	qa_test_6_dest
 root		
 root		

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2011-03-10 08:33:54 +0000
+++ b/mysql-test/r/sp.result	2011-03-17 11:33:17 +0000
@@ -7452,6 +7452,24 @@ c1
 # Cleanup
 drop table t1;
 drop procedure p1;
+# 
+# BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW) 
+#               FAILS IN SET_FIELD_ITERATOR
+# 
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE VIEW v1 AS SELECT a FROM t2;
+CREATE PROCEDURE proc() SELECT * FROM t1 NATURAL JOIN v1;
+ALTER TABLE t2 CHANGE COLUMN a b CHAR;
+
+CALL proc();
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+CALL proc();
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+
+DROP TABLE t1,t2;
+DROP VIEW v1;
+DROP PROCEDURE proc;
 
 # --
 # -- Bug 11765684 - 58674: SP-cache does not detect changes in

=== modified file 'mysql-test/r/sp_notembedded.result'
--- a/mysql-test/r/sp_notembedded.result	2010-08-09 08:32:50 +0000
+++ b/mysql-test/r/sp_notembedded.result	2011-03-18 14:16:17 +0000
@@ -249,8 +249,6 @@ max_updates, max_connections, max_user_c
 VALUES('%', 'mysqltest_1', password(''), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N',
 'N', 'N', 'N', 'Y', 'Y', 'N', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'Y', 'Y', 'N', '',
 '', '', '', '0', '0', '0', '0');
-Warnings:
-Warning	1364	Field 'authentication_string' doesn't have a default value
 FLUSH PRIVILEGES;
 CREATE PROCEDURE p1(i INT) BEGIN END;
 DROP PROCEDURE p1;

=== modified file 'mysql-test/r/subselect_innodb.result'
--- a/mysql-test/r/subselect_innodb.result	2011-02-17 13:25:01 +0000
+++ b/mysql-test/r/subselect_innodb.result	2011-03-17 09:43:28 +0000
@@ -433,3 +433,12 @@ col_time_key	col_datetime_key
 DROP TABLE t1;
 DROP TABLE t2;
 # End of Bug #58756
+#
+# Bug#60085 crash in Item::save_in_field() with time data type
+#
+CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
+INSERT INTO t1 VALUES ('2011-05-13', 0);
+SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
+a	b
+2011-05-13	0
+DROP TABLE t1;

=== modified file 'mysql-test/r/system_mysql_db.result'
--- a/mysql-test/r/system_mysql_db.result	2011-03-14 18:43:19 +0000
+++ b/mysql-test/r/system_mysql_db.result	2011-03-18 14:58:27 +0000
@@ -122,8 +122,8 @@ user	CREATE TABLE `user` (
   `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
   `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
   `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
-  `plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
-  `authentication_string` text COLLATE utf8_bin NOT NULL,
+  `plugin` char(64) COLLATE utf8_bin DEFAULT '',
+  `authentication_string` text COLLATE utf8_bin,
   PRIMARY KEY (`Host`,`User`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
 show create table func;

=== modified file 'mysql-test/r/type_date.result'
--- a/mysql-test/r/type_date.result	2010-11-18 13:50:08 +0000
+++ b/mysql-test/r/type_date.result	2011-02-17 13:59:06 +0000
@@ -300,6 +300,18 @@ the_date	the_time	the_date	the_time
 2010-01-01	01:01:01	2010-01-01	01:01:01
 DROP TABLE t1;
 DROP VIEW v1;
+#
+# Bug#59685 crash in String::length with date types
+#
+CREATE TABLE t1(a DATE, b YEAR, KEY(a));
+INSERT INTO t1 VALUES ('2011-01-01',2011);
+SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
+b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a)
+1
+SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1;
+b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE)
+1
+DROP TABLE t1;
 End of 5.1 tests
 #
 # Bug #33629: last_day function can return null, but has 'not null'

=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2011-01-10 12:45:53 +0000
+++ b/mysql-test/r/union.result	2011-03-01 14:57:53 +0000
@@ -480,7 +480,7 @@ id	select_type	table	type	possible_keys
 2	UNION	t2	const	PRIMARY	PRIMARY	4	const	1	100.00	
 NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
 Warnings:
-Note	1003	(select '1' AS `a`,'1' AS `b` from `test`.`t1` where ('1' = 1)) union (select '1' AS `a`,'10' AS `b` from `test`.`t2` where ('1' = 1))
+Note	1003	(select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1) union (select '1' AS `a`,'10' AS `b` from `test`.`t2` where 1)
 (select * from t1 where a=5) union (select * from t2 where a=1);
 a	b
 1	10

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_is_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result	2010-01-15 11:42:15 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result	2011-03-18 11:20:23 +0000
@@ -15,11 +15,11 @@ def	information_schema	COLLATIONS	IS_DEF
 def	information_schema	COLLATIONS	SORTLEN	6	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(3)				
 def	information_schema	COLLATION_CHARACTER_SET_APPLICABILITY	CHARACTER_SET_NAME	2		NO	varchar	32	96	NULL	NULL	utf8	utf8_general_ci	varchar(32)				
 def	information_schema	COLLATION_CHARACTER_SET_APPLICABILITY	COLLATION_NAME	1		NO	varchar	32	96	NULL	NULL	utf8	utf8_general_ci	varchar(32)				
-def	information_schema	COLUMNS	CHARACTER_MAXIMUM_LENGTH	9	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	COLUMNS	CHARACTER_OCTET_LENGTH	10	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	COLUMNS	CHARACTER_MAXIMUM_LENGTH	9	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	COLUMNS	CHARACTER_OCTET_LENGTH	10	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	COLUMNS	CHARACTER_SET_NAME	13	NULL	YES	varchar	32	96	NULL	NULL	utf8	utf8_general_ci	varchar(32)				
 def	information_schema	COLUMNS	COLLATION_NAME	14	NULL	YES	varchar	32	96	NULL	NULL	utf8	utf8_general_ci	varchar(32)				
-def	information_schema	COLUMNS	COLUMN_COMMENT	19		NO	varchar	255	765	NULL	NULL	utf8	utf8_general_ci	varchar(255)				
+def	information_schema	COLUMNS	COLUMN_COMMENT	19		NO	varchar	1024	3072	NULL	NULL	utf8	utf8_general_ci	varchar(1024)				
 def	information_schema	COLUMNS	COLUMN_DEFAULT	6	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	COLUMNS	COLUMN_KEY	16		NO	varchar	3	9	NULL	NULL	utf8	utf8_general_ci	varchar(3)				
 def	information_schema	COLUMNS	COLUMN_NAME	4		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -27,9 +27,9 @@ def	information_schema	COLUMNS	COLUMN_TY
 def	information_schema	COLUMNS	DATA_TYPE	8		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	COLUMNS	EXTRA	17		NO	varchar	27	81	NULL	NULL	utf8	utf8_general_ci	varchar(27)				
 def	information_schema	COLUMNS	IS_NULLABLE	7		NO	varchar	3	9	NULL	NULL	utf8	utf8_general_ci	varchar(3)				
-def	information_schema	COLUMNS	NUMERIC_PRECISION	11	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	COLUMNS	NUMERIC_SCALE	12	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	COLUMNS	ORDINAL_POSITION	5	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	COLUMNS	NUMERIC_PRECISION	11	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	COLUMNS	NUMERIC_SCALE	12	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	COLUMNS	ORDINAL_POSITION	5	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	COLUMNS	PRIVILEGES	18		NO	varchar	80	240	NULL	NULL	utf8	utf8_general_ci	varchar(80)				
 def	information_schema	COLUMNS	TABLE_CATALOG	1		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	COLUMNS	TABLE_NAME	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -71,14 +71,14 @@ def	information_schema	EVENTS	SQL_MODE	1
 def	information_schema	EVENTS	STARTS	13	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	EVENTS	STATUS	15		NO	varchar	18	54	NULL	NULL	utf8	utf8_general_ci	varchar(18)				
 def	information_schema	EVENTS	TIME_ZONE	5		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	FILES	AUTOEXTEND_SIZE	19	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	FILES	AVG_ROW_LENGTH	28	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	FILES	CHECKSUM	36	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	AUTOEXTEND_SIZE	19	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	AVG_ROW_LENGTH	28	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	CHECKSUM	36	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	FILES	CHECK_TIME	35	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	FILES	CREATE_TIME	33	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	FILES	CREATION_TIME	20	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	FILES	DATA_FREE	32	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	FILES	DATA_LENGTH	29	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	DATA_FREE	32	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	DATA_LENGTH	29	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	FILES	DELETED_ROWS	12	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	ENGINE	10		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	FILES	EXTENT_SIZE	16	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
@@ -88,27 +88,27 @@ def	information_schema	FILES	FILE_NAME	2
 def	information_schema	FILES	FILE_TYPE	3		NO	varchar	20	60	NULL	NULL	utf8	utf8_general_ci	varchar(20)				
 def	information_schema	FILES	FREE_EXTENTS	14	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	FULLTEXT_KEYS	11	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	FILES	INDEX_LENGTH	31	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	FILES	INITIAL_SIZE	17	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	INDEX_LENGTH	31	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	INITIAL_SIZE	17	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	FILES	LAST_ACCESS_TIME	22	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	FILES	LAST_UPDATE_TIME	21	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	FILES	LOGFILE_GROUP_NAME	8	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	FILES	LOGFILE_GROUP_NUMBER	9	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
-def	information_schema	FILES	MAXIMUM_SIZE	18	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	FILES	MAX_DATA_LENGTH	30	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	MAXIMUM_SIZE	18	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	MAX_DATA_LENGTH	30	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	FILES	RECOVER_TIME	23	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	ROW_FORMAT	26	NULL	YES	varchar	10	30	NULL	NULL	utf8	utf8_general_ci	varchar(10)				
 def	information_schema	FILES	STATUS	37		NO	varchar	20	60	NULL	NULL	utf8	utf8_general_ci	varchar(20)				
 def	information_schema	FILES	TABLESPACE_NAME	4	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	FILES	TABLE_CATALOG	5		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	FILES	TABLE_NAME	7	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	FILES	TABLE_ROWS	27	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	TABLE_ROWS	27	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	FILES	TABLE_SCHEMA	6	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	FILES	TOTAL_EXTENTS	15	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	TRANSACTION_COUNTER	24	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	UPDATE_COUNT	13	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(4)				
 def	information_schema	FILES	UPDATE_TIME	34	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	FILES	VERSION	25	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	FILES	VERSION	25	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	GLOBAL_STATUS	VARIABLE_NAME	1		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	GLOBAL_STATUS	VARIABLE_VALUE	2	NULL	YES	varchar	1024	3072	NULL	NULL	utf8	utf8_general_ci	varchar(1024)				
 def	information_schema	GLOBAL_VARIABLES	VARIABLE_NAME	1		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -131,7 +131,7 @@ def	information_schema	PARAMETERS	CHARAC
 def	information_schema	PARAMETERS	COLLATION_NAME	13	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PARAMETERS	DATA_TYPE	7		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PARAMETERS	DTD_IDENTIFIER	14	NULL	NO	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
-def	information_schema	PARAMETERS	NUMERIC_PRECISION	10	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
+def	information_schema	PARAMETERS	NUMERIC_PRECISION	10	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARAMETERS	NUMERIC_SCALE	11	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
 def	information_schema	PARAMETERS	ORDINAL_POSITION	4	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(21)				
 def	information_schema	PARAMETERS	PARAMETER_MODE	5	NULL	YES	varchar	5	15	NULL	NULL	utf8	utf8_general_ci	varchar(5)				
@@ -140,31 +140,32 @@ def	information_schema	PARAMETERS	ROUTIN
 def	information_schema	PARAMETERS	SPECIFIC_CATALOG	1		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	PARAMETERS	SPECIFIC_NAME	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PARAMETERS	SPECIFIC_SCHEMA	2		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	PARTITIONS	AVG_ROW_LENGTH	14	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	PARTITIONS	CHECKSUM	22	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	AVG_ROW_LENGTH	14	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	CHECKSUM	22	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARTITIONS	CHECK_TIME	21	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	PARTITIONS	CREATE_TIME	19	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	PARTITIONS	DATA_FREE	18	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	PARTITIONS	DATA_LENGTH	15	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	PARTITIONS	INDEX_LENGTH	17	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	PARTITIONS	MAX_DATA_LENGTH	16	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	DATA_FREE	18	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	DATA_LENGTH	15	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	INDEX_LENGTH	17	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	MAX_DATA_LENGTH	16	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARTITIONS	NODEGROUP	24		NO	varchar	12	36	NULL	NULL	utf8	utf8_general_ci	varchar(12)				
 def	information_schema	PARTITIONS	PARTITION_COMMENT	23		NO	varchar	80	240	NULL	NULL	utf8	utf8_general_ci	varchar(80)				
 def	information_schema	PARTITIONS	PARTITION_DESCRIPTION	12	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	PARTITIONS	PARTITION_EXPRESSION	10	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	PARTITIONS	PARTITION_METHOD	8	NULL	YES	varchar	18	54	NULL	NULL	utf8	utf8_general_ci	varchar(18)				
 def	information_schema	PARTITIONS	PARTITION_NAME	4	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	PARTITIONS	PARTITION_ORDINAL_POSITION	6	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	PARTITION_ORDINAL_POSITION	6	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARTITIONS	SUBPARTITION_EXPRESSION	11	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	PARTITIONS	SUBPARTITION_METHOD	9	NULL	YES	varchar	12	36	NULL	NULL	utf8	utf8_general_ci	varchar(12)				
 def	information_schema	PARTITIONS	SUBPARTITION_NAME	5	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	PARTITIONS	SUBPARTITION_ORDINAL_POSITION	7	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	SUBPARTITION_ORDINAL_POSITION	7	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARTITIONS	TABLESPACE_NAME	25	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PARTITIONS	TABLE_CATALOG	1		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	PARTITIONS	TABLE_NAME	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	PARTITIONS	TABLE_ROWS	13	0	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	PARTITIONS	TABLE_ROWS	13	0	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	PARTITIONS	TABLE_SCHEMA	2		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PARTITIONS	UPDATE_TIME	20	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
+def	information_schema	PLUGINS	LOAD_OPTION	11		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PLUGINS	PLUGIN_AUTHOR	8	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	PLUGINS	PLUGIN_DESCRIPTION	9	NULL	YES	longtext	4294967295	4294967295	NULL	NULL	utf8	utf8_general_ci	longtext				
 def	information_schema	PLUGINS	PLUGIN_LIBRARY	6	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -209,7 +210,7 @@ def	information_schema	ROUTINES	EXTERNAL
 def	information_schema	ROUTINES	EXTERNAL_NAME	16	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	ROUTINES	IS_DETERMINISTIC	19		NO	varchar	3	9	NULL	NULL	utf8	utf8_general_ci	varchar(3)				
 def	information_schema	ROUTINES	LAST_ALTERED	24	0000-00-00 00:00:00	NO	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	ROUTINES	NUMERIC_PRECISION	9	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
+def	information_schema	ROUTINES	NUMERIC_PRECISION	9	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	ROUTINES	NUMERIC_SCALE	10	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(21)				
 def	information_schema	ROUTINES	PARAMETER_STYLE	18		NO	varchar	8	24	NULL	NULL	utf8	utf8_general_ci	varchar(8)				
 def	information_schema	ROUTINES	ROUTINE_BODY	14		NO	varchar	8	24	NULL	NULL	utf8	utf8_general_ci	varchar(8)				
@@ -242,6 +243,7 @@ def	information_schema	STATISTICS	CARDIN
 def	information_schema	STATISTICS	COLLATION	9	NULL	YES	varchar	1	3	NULL	NULL	utf8	utf8_general_ci	varchar(1)				
 def	information_schema	STATISTICS	COLUMN_NAME	8		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	STATISTICS	COMMENT	15	NULL	YES	varchar	16	48	NULL	NULL	utf8	utf8_general_ci	varchar(16)				
+def	information_schema	STATISTICS	INDEX_COMMENT	16		NO	varchar	1024	3072	NULL	NULL	utf8	utf8_general_ci	varchar(1024)				
 def	information_schema	STATISTICS	INDEX_NAME	6		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	STATISTICS	INDEX_SCHEMA	5		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	STATISTICS	INDEX_TYPE	14		NO	varchar	16	48	NULL	NULL	utf8	utf8_general_ci	varchar(16)				
@@ -253,33 +255,33 @@ def	information_schema	STATISTICS	SUB_PA
 def	information_schema	STATISTICS	TABLE_CATALOG	1		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	STATISTICS	TABLE_NAME	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	STATISTICS	TABLE_SCHEMA	2		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	TABLES	AUTO_INCREMENT	14	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLES	AVG_ROW_LENGTH	9	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLES	CHECKSUM	19	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	AUTO_INCREMENT	14	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	AVG_ROW_LENGTH	9	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	CHECKSUM	19	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLES	CHECK_TIME	17	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
 def	information_schema	TABLES	CREATE_OPTIONS	20	NULL	YES	varchar	255	765	NULL	NULL	utf8	utf8_general_ci	varchar(255)				
 def	information_schema	TABLES	CREATE_TIME	15	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	TABLES	DATA_FREE	13	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLES	DATA_LENGTH	10	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	DATA_FREE	13	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	DATA_LENGTH	10	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLES	ENGINE	5	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	TABLES	INDEX_LENGTH	12	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLES	MAX_DATA_LENGTH	11	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	INDEX_LENGTH	12	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	MAX_DATA_LENGTH	11	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLES	ROW_FORMAT	7	NULL	YES	varchar	10	30	NULL	NULL	utf8	utf8_general_ci	varchar(10)				
 def	information_schema	TABLES	TABLE_CATALOG	1		NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	information_schema	TABLES	TABLE_COLLATION	18	NULL	YES	varchar	32	96	NULL	NULL	utf8	utf8_general_ci	varchar(32)				
-def	information_schema	TABLES	TABLE_COMMENT	21		NO	varchar	80	240	NULL	NULL	utf8	utf8_general_ci	varchar(80)				
+def	information_schema	TABLES	TABLE_COMMENT	21		NO	varchar	2048	6144	NULL	NULL	utf8	utf8_general_ci	varchar(2048)				
 def	information_schema	TABLES	TABLE_NAME	3		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	TABLES	TABLE_ROWS	8	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	TABLE_ROWS	8	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLES	TABLE_SCHEMA	2		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	TABLES	TABLE_TYPE	4		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	TABLES	UPDATE_TIME	16	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime				
-def	information_schema	TABLES	VERSION	6	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLESPACES	AUTOEXTEND_SIZE	6	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLES	VERSION	6	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLESPACES	AUTOEXTEND_SIZE	6	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLESPACES	ENGINE	2		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	TABLESPACES	EXTENT_SIZE	5	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLESPACES	EXTENT_SIZE	5	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLESPACES	LOGFILE_GROUP_NAME	4	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
-def	information_schema	TABLESPACES	MAXIMUM_SIZE	7	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
-def	information_schema	TABLESPACES	NODEGROUP_ID	8	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLESPACES	MAXIMUM_SIZE	7	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
+def	information_schema	TABLESPACES	NODEGROUP_ID	8	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(21) unsigned				
 def	information_schema	TABLESPACES	TABLESPACE_COMMENT	9	NULL	YES	varchar	2048	6144	NULL	NULL	utf8	utf8_general_ci	varchar(2048)				
 def	information_schema	TABLESPACES	TABLESPACE_NAME	1		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
 def	information_schema	TABLESPACES	TABLESPACE_TYPE	3	NULL	YES	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)				
@@ -419,7 +421,7 @@ NULL	information_schema	COLUMNS	NUMERIC_
 3.0000	information_schema	COLUMNS	COLUMN_KEY	varchar	3	9	utf8	utf8_general_ci	varchar(3)
 3.0000	information_schema	COLUMNS	EXTRA	varchar	27	81	utf8	utf8_general_ci	varchar(27)
 3.0000	information_schema	COLUMNS	PRIVILEGES	varchar	80	240	utf8	utf8_general_ci	varchar(80)
-3.0000	information_schema	COLUMNS	COLUMN_COMMENT	varchar	255	765	utf8	utf8_general_ci	varchar(255)
+3.0000	information_schema	COLUMNS	COLUMN_COMMENT	varchar	1024	3072	utf8	utf8_general_ci	varchar(1024)
 3.0000	information_schema	COLUMN_PRIVILEGES	GRANTEE	varchar	81	243	utf8	utf8_general_ci	varchar(81)
 3.0000	information_schema	COLUMN_PRIVILEGES	TABLE_CATALOG	varchar	512	1536	utf8	utf8_general_ci	varchar(512)
 3.0000	information_schema	COLUMN_PRIVILEGES	TABLE_SCHEMA	varchar	64	192	utf8	utf8_general_ci	varchar(64)
@@ -520,7 +522,7 @@ NULL	information_schema	PARAMETERS	ORDIN
 3.0000	information_schema	PARAMETERS	DATA_TYPE	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 NULL	information_schema	PARAMETERS	CHARACTER_MAXIMUM_LENGTH	int	NULL	NULL	NULL	NULL	int(21)
 NULL	information_schema	PARAMETERS	CHARACTER_OCTET_LENGTH	int	NULL	NULL	NULL	NULL	int(21)
-NULL	information_schema	PARAMETERS	NUMERIC_PRECISION	int	NULL	NULL	NULL	NULL	int(21)
+NULL	information_schema	PARAMETERS	NUMERIC_PRECISION	bigint	NULL	NULL	NULL	NULL	bigint(21) unsigned
 NULL	information_schema	PARAMETERS	NUMERIC_SCALE	int	NULL	NULL	NULL	NULL	int(21)
 3.0000	information_schema	PARAMETERS	CHARACTER_SET_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	PARAMETERS	COLLATION_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
@@ -561,6 +563,7 @@ NULL	information_schema	PARTITIONS	CHECK
 3.0000	information_schema	PLUGINS	PLUGIN_AUTHOR	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 1.0000	information_schema	PLUGINS	PLUGIN_DESCRIPTION	longtext	4294967295	4294967295	utf8	utf8_general_ci	longtext
 3.0000	information_schema	PLUGINS	PLUGIN_LICENSE	varchar	80	240	utf8	utf8_general_ci	varchar(80)
+3.0000	information_schema	PLUGINS	LOAD_OPTION	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 NULL	information_schema	PROCESSLIST	ID	bigint	NULL	NULL	NULL	NULL	bigint(4)
 3.0000	information_schema	PROCESSLIST	USER	varchar	16	48	utf8	utf8_general_ci	varchar(16)
 3.0000	information_schema	PROCESSLIST	HOST	varchar	64	192	utf8	utf8_general_ci	varchar(64)
@@ -588,7 +591,7 @@ NULL	information_schema	PROCESSLIST	TIME
 3.0000	information_schema	ROUTINES	DATA_TYPE	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 NULL	information_schema	ROUTINES	CHARACTER_MAXIMUM_LENGTH	int	NULL	NULL	NULL	NULL	int(21)
 NULL	information_schema	ROUTINES	CHARACTER_OCTET_LENGTH	int	NULL	NULL	NULL	NULL	int(21)
-NULL	information_schema	ROUTINES	NUMERIC_PRECISION	int	NULL	NULL	NULL	NULL	int(21)
+NULL	information_schema	ROUTINES	NUMERIC_PRECISION	bigint	NULL	NULL	NULL	NULL	bigint(21) unsigned
 NULL	information_schema	ROUTINES	NUMERIC_SCALE	int	NULL	NULL	NULL	NULL	int(21)
 3.0000	information_schema	ROUTINES	CHARACTER_SET_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	ROUTINES	COLLATION_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
@@ -639,6 +642,7 @@ NULL	information_schema	STATISTICS	SUB_P
 3.0000	information_schema	STATISTICS	NULLABLE	varchar	3	9	utf8	utf8_general_ci	varchar(3)
 3.0000	information_schema	STATISTICS	INDEX_TYPE	varchar	16	48	utf8	utf8_general_ci	varchar(16)
 3.0000	information_schema	STATISTICS	COMMENT	varchar	16	48	utf8	utf8_general_ci	varchar(16)
+3.0000	information_schema	STATISTICS	INDEX_COMMENT	varchar	1024	3072	utf8	utf8_general_ci	varchar(1024)
 3.0000	information_schema	TABLES	TABLE_CATALOG	varchar	512	1536	utf8	utf8_general_ci	varchar(512)
 3.0000	information_schema	TABLES	TABLE_SCHEMA	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	TABLES	TABLE_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
@@ -659,7 +663,7 @@ NULL	information_schema	TABLES	CHECK_TIM
 3.0000	information_schema	TABLES	TABLE_COLLATION	varchar	32	96	utf8	utf8_general_ci	varchar(32)
 NULL	information_schema	TABLES	CHECKSUM	bigint	NULL	NULL	NULL	NULL	bigint(21) unsigned
 3.0000	information_schema	TABLES	CREATE_OPTIONS	varchar	255	765	utf8	utf8_general_ci	varchar(255)
-3.0000	information_schema	TABLES	TABLE_COMMENT	varchar	80	240	utf8	utf8_general_ci	varchar(80)
+3.0000	information_schema	TABLES	TABLE_COMMENT	varchar	2048	6144	utf8	utf8_general_ci	varchar(2048)
 3.0000	information_schema	TABLESPACES	TABLESPACE_NAME	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	TABLESPACES	ENGINE	varchar	64	192	utf8	utf8_general_ci	varchar(64)
 3.0000	information_schema	TABLESPACES	TABLESPACE_TYPE	varchar	64	192	utf8	utf8_general_ci	varchar(64)

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result	2009-10-23 11:02:20 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result	2011-03-18 11:14:42 +0000
@@ -479,9 +479,9 @@ def	test	tb1	f27	27	NULL	YES	int	NULL	NU
 def	test	tb1	f28	28	NULL	YES	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned zerofill				
 def	test	tb1	f29	29	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)				
 def	test	tb1	f3	3	NULL	YES	char	1	1	NULL	NULL	latin1	latin1_swedish_ci	char(1)				
-def	test	tb1	f30	30	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	test	tb1	f31	31	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned zerofill				
-def	test	tb1	f32	32	NULL	YES	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned zerofill				
+def	test	tb1	f30	30	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	test	tb1	f31	31	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned zerofill				
+def	test	tb1	f32	32	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned zerofill				
 def	test	tb1	f33	33	10	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0)				
 def	test	tb1	f34	34	10	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0) unsigned				
 def	test	tb1	f35	35	0000000010	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0) unsigned zerofill				
@@ -602,9 +602,9 @@ def	test	tb3	f143	26	99999	NO	int	NULL	N
 def	test	tb3	f144	27	0000099999	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned zerofill				
 def	test	tb3	f145	28	0000099999	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned zerofill				
 def	test	tb3	f146	29	999999	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)				
-def	test	tb3	f147	30	999999	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	test	tb3	f148	31	00000000000000999999	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned zerofill				
-def	test	tb3	f149	32	00000000000000999999	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned zerofill				
+def	test	tb3	f147	30	999999	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	test	tb3	f148	31	00000000000000999999	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned zerofill				
+def	test	tb3	f149	32	00000000000000999999	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned zerofill				
 def	test	tb3	f150	33	1000	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0)				
 def	test	tb3	f151	34	999	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0) unsigned				
 def	test	tb3	f152	35	0000001000	NO	decimal	NULL	NULL	10	0	NULL	NULL	decimal(10,0) unsigned zerofill				

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2011-03-14 18:43:19 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2011-03-18 14:58:27 +0000
@@ -214,7 +214,7 @@ def	mysql	time_zone_transition_type	Time
 def	mysql	time_zone_transition_type	Transition_type_id	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned	PRI		select,insert,update,references	
 def	mysql	user	Alter_priv	17	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	user	Alter_routine_priv	28	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
-def	mysql	user	authentication_string	42	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
+def	mysql	user	authentication_string	42	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text			select,insert,update,references	
 def	mysql	user	Create_priv	8	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	user	Create_routine_priv	27	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	user	Create_tablespace_priv	32	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
@@ -236,7 +236,7 @@ def	mysql	user	max_questions	37	0	NO	int
 def	mysql	user	max_updates	38	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references	
 def	mysql	user	max_user_connections	40	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned			select,insert,update,references	
 def	mysql	user	Password	3		NO	char	41	41	NULL	NULL	latin1	latin1_bin	char(41)			select,insert,update,references	
-def	mysql	user	plugin	41		NO	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
+def	mysql	user	plugin	41		YES	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)			select,insert,update,references	
 def	mysql	user	Process_priv	12	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	user	References_priv	15	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	user	Reload_priv	10	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result	2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result	2011-03-18 11:20:23 +0000
@@ -97,13 +97,13 @@ def	mysql	host	Select_priv	3	N	NO	enum	1
 def	mysql	host	Show_view_priv	16	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	host	Trigger_priv	20	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	host	Update_priv	5	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
-def	mysql	ndb_binlog_index	deletes	6	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	mysql	ndb_binlog_index	epoch	3	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned	PRI			
+def	mysql	ndb_binlog_index	deletes	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	mysql	ndb_binlog_index	epoch	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned	PRI			
 def	mysql	ndb_binlog_index	File	2	NULL	NO	varchar	255	255	NULL	NULL	latin1	latin1_swedish_ci	varchar(255)				
-def	mysql	ndb_binlog_index	inserts	4	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	mysql	ndb_binlog_index	Position	1	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	mysql	ndb_binlog_index	schemaops	7	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
-def	mysql	ndb_binlog_index	updates	5	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20) unsigned				
+def	mysql	ndb_binlog_index	inserts	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	mysql	ndb_binlog_index	Position	1	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	mysql	ndb_binlog_index	schemaops	7	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
+def	mysql	ndb_binlog_index	updates	5	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
 def	mysql	plugin	dl	2		NO	varchar	128	384	NULL	NULL	utf8	utf8_general_ci	varchar(128)				
 def	mysql	plugin	name	1		NO	varchar	64	192	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
 def	mysql	proc	body	11	NULL	NO	longblob	4294967295	4294967295	NULL	NULL	NULL	NULL	longblob				
@@ -134,6 +134,13 @@ def	mysql	procs_priv	Routine_name	4		NO
 def	mysql	procs_priv	Routine_type	5	NULL	NO	enum	9	27	NULL	NULL	utf8	utf8_bin	enum('FUNCTION','PROCEDURE')	PRI			
 def	mysql	procs_priv	Timestamp	8	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP		
 def	mysql	procs_priv	User	3		NO	char	16	48	NULL	NULL	utf8	utf8_bin	char(16)	PRI			
+def	mysql	proxies_priv	Grantor	6		NO	char	77	231	NULL	NULL	utf8	utf8_bin	char(77)	MUL			
+def	mysql	proxies_priv	Host	1		NO	char	60	180	NULL	NULL	utf8	utf8_bin	char(60)	PRI			
+def	mysql	proxies_priv	Proxied_host	3		NO	char	60	180	NULL	NULL	utf8	utf8_bin	char(60)	PRI			
+def	mysql	proxies_priv	Proxied_user	4		NO	char	16	48	NULL	NULL	utf8	utf8_bin	char(16)	PRI			
+def	mysql	proxies_priv	Timestamp	7	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP		
+def	mysql	proxies_priv	User	2		NO	char	16	48	NULL	NULL	utf8	utf8_bin	char(16)	PRI			
+def	mysql	proxies_priv	With_grant	5	0	NO	tinyint	NULL	NULL	3	0	NULL	NULL	tinyint(1)				
 def	mysql	servers	Db	3		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
 def	mysql	servers	Host	2		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
 def	mysql	servers	Owner	9		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
@@ -143,17 +150,18 @@ def	mysql	servers	Server_name	1		NO	char
 def	mysql	servers	Socket	7		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
 def	mysql	servers	Username	4		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
 def	mysql	servers	Wrapper	8		NO	char	64	192	NULL	NULL	utf8	utf8_general_ci	char(64)				
+def	mysql	slave_master_info	Bind	18	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	slave_master_info	Connect_retry	9	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
 def	mysql	slave_master_info	Enabled_ssl	10	NULL	NO	tinyint	NULL	NULL	3	0	NULL	NULL	tinyint(1)				
 def	mysql	slave_master_info	Heartbeat	17	NULL	NO	float	NULL	NULL	12	NULL	NULL	NULL	float				
 def	mysql	slave_master_info	Host	5	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
-def	mysql	slave_master_info	Ignored_server_ids	18	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
+def	mysql	slave_master_info	Ignored_server_ids	19	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	slave_master_info	Master_id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned	PRI			
 def	mysql	slave_master_info	Master_log_name	3	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
-def	mysql	slave_master_info	Master_log_pos	4	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
+def	mysql	slave_master_info	Master_log_pos	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
 def	mysql	slave_master_info	Number_of_lines	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
 def	mysql	slave_master_info	Port	8	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
-def	mysql	slave_master_info	Retry_count	19	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
+def	mysql	slave_master_info	Retry_count	21	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
 def	mysql	slave_master_info	Ssl_ca	11	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	slave_master_info	Ssl_capath	12	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	slave_master_info	Ssl_cert	13	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
@@ -165,10 +173,10 @@ def	mysql	slave_master_info	User_passwor
 def	mysql	slave_master_info	Uuid	20	NULL	YES	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	slave_relay_log_info	Master_id	1	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned	PRI			
 def	mysql	slave_relay_log_info	Master_log_name	5	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
-def	mysql	slave_relay_log_info	Master_log_pos	6	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
+def	mysql	slave_relay_log_info	Master_log_pos	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
 def	mysql	slave_relay_log_info	Number_of_lines	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
 def	mysql	slave_relay_log_info	Relay_log_name	3	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
-def	mysql	slave_relay_log_info	Relay_log_pos	4	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
+def	mysql	slave_relay_log_info	Relay_log_pos	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned				
 def	mysql	slave_relay_log_info	Sql_delay	7	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)				
 def	mysql	slow_log	db	7	NULL	NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)				
 def	mysql	slow_log	insert_id	9	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)				
@@ -180,6 +188,7 @@ def	mysql	slow_log	rows_sent	5	NULL	NO	i
 def	mysql	slow_log	server_id	10	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned				
 def	mysql	slow_log	sql_text	11	NULL	NO	mediumtext	16777215	16777215	NULL	NULL	utf8	utf8_general_ci	mediumtext				
 def	mysql	slow_log	start_time	1	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP		
+def	mysql	slow_log	thread_id	12	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)				
 def	mysql	slow_log	user_host	2	NULL	NO	mediumtext	16777215	16777215	NULL	NULL	utf8	utf8_general_ci	mediumtext				
 def	mysql	tables_priv	Column_priv	8		NO	set	31	93	NULL	NULL	utf8	utf8_general_ci	set('Select','Insert','Update','References')				
 def	mysql	tables_priv	Db	2		NO	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)	PRI			
@@ -205,6 +214,7 @@ def	mysql	time_zone_transition_type	Time
 def	mysql	time_zone_transition_type	Transition_type_id	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned	PRI			
 def	mysql	user	Alter_priv	17	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	user	Alter_routine_priv	28	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
+def	mysql	user	authentication_string	42	NULL	NO	text	65535	65535	NULL	NULL	utf8	utf8_bin	text				
 def	mysql	user	Create_priv	8	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	user	Create_routine_priv	27	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	user	Create_tablespace_priv	32	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
@@ -226,6 +236,7 @@ def	mysql	user	max_questions	37	0	NO	int
 def	mysql	user	max_updates	38	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned				
 def	mysql	user	max_user_connections	40	0	NO	int	NULL	NULL	10	0	NULL	NULL	int(11) unsigned				
 def	mysql	user	Password	3		NO	char	41	41	NULL	NULL	latin1	latin1_bin	char(41)				
+def	mysql	user	plugin	41		NO	char	64	192	NULL	NULL	utf8	utf8_bin	char(64)				
 def	mysql	user	Process_priv	12	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	user	References_priv	15	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	user	Reload_priv	10	N	NO	enum	1	3	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
@@ -446,6 +457,13 @@ NULL	mysql	proc	modified	timestamp	NULL
 3.0000	mysql	procs_priv	Grantor	char	77	231	utf8	utf8_bin	char(77)
 3.0000	mysql	procs_priv	Proc_priv	set	27	81	utf8	utf8_general_ci	set('Execute','Alter Routine','Grant')
 NULL	mysql	procs_priv	Timestamp	timestamp	NULL	NULL	NULL	NULL	timestamp
+3.0000	mysql	proxies_priv	Host	char	60	180	utf8	utf8_bin	char(60)
+3.0000	mysql	proxies_priv	User	char	16	48	utf8	utf8_bin	char(16)
+3.0000	mysql	proxies_priv	Proxied_host	char	60	180	utf8	utf8_bin	char(60)
+3.0000	mysql	proxies_priv	Proxied_user	char	16	48	utf8	utf8_bin	char(16)
+NULL	mysql	proxies_priv	With_grant	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
+3.0000	mysql	proxies_priv	Grantor	char	77	231	utf8	utf8_bin	char(77)
+NULL	mysql	proxies_priv	Timestamp	timestamp	NULL	NULL	NULL	NULL	timestamp
 3.0000	mysql	servers	Server_name	char	64	192	utf8	utf8_general_ci	char(64)
 3.0000	mysql	servers	Host	char	64	192	utf8	utf8_general_ci	char(64)
 3.0000	mysql	servers	Db	char	64	192	utf8	utf8_general_ci	char(64)
@@ -458,7 +476,7 @@ NULL	mysql	servers	Port	int	NULL	NULL	NU
 NULL	mysql	slave_master_info	Master_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
 NULL	mysql	slave_master_info	Number_of_lines	int	NULL	NULL	NULL	NULL	int(10) unsigned
 1.0000	mysql	slave_master_info	Master_log_name	text	65535	65535	utf8	utf8_bin	text
-NULL	mysql	slave_master_info	Master_log_pos	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	slave_master_info	Master_log_pos	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 1.0000	mysql	slave_master_info	Host	text	65535	65535	utf8	utf8_bin	text
 1.0000	mysql	slave_master_info	User_name	text	65535	65535	utf8	utf8_bin	text
 1.0000	mysql	slave_master_info	User_password	text	65535	65535	utf8	utf8_bin	text
@@ -472,15 +490,16 @@ NULL	mysql	slave_master_info	Enabled_ssl
 1.0000	mysql	slave_master_info	Ssl_key	text	65535	65535	utf8	utf8_bin	text
 NULL	mysql	slave_master_info	Ssl_verify_servert_cert	tinyint	NULL	NULL	NULL	NULL	tinyint(1)
 NULL	mysql	slave_master_info	Heartbeat	float	NULL	NULL	NULL	NULL	float
+1.0000	mysql	slave_master_info	Bind	text	65535	65535	utf8	utf8_bin	text
 1.0000	mysql	slave_master_info	Ignored_server_ids	text	65535	65535	utf8	utf8_bin	text
-NULL	mysql	slave_master_info	Retry_count	int	NULL	NULL	NULL	NULL	int(10) unsigned
 1.0000	mysql	slave_master_info	Uuid	text	65535	65535	utf8	utf8_bin	text
+NULL	mysql	slave_master_info	Retry_count	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	slave_relay_log_info	Master_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
 NULL	mysql	slave_relay_log_info	Number_of_lines	int	NULL	NULL	NULL	NULL	int(10) unsigned
 1.0000	mysql	slave_relay_log_info	Relay_log_name	text	65535	65535	utf8	utf8_bin	text
-NULL	mysql	slave_relay_log_info	Relay_log_pos	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	slave_relay_log_info	Relay_log_pos	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 1.0000	mysql	slave_relay_log_info	Master_log_name	text	65535	65535	utf8	utf8_bin	text
-NULL	mysql	slave_relay_log_info	Master_log_pos	int	NULL	NULL	NULL	NULL	int(10) unsigned
+NULL	mysql	slave_relay_log_info	Master_log_pos	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	slave_relay_log_info	Sql_delay	int	NULL	NULL	NULL	NULL	int(11)
 NULL	mysql	slow_log	start_time	timestamp	NULL	NULL	NULL	NULL	timestamp
 1.0000	mysql	slow_log	user_host	mediumtext	16777215	16777215	utf8	utf8_general_ci	mediumtext
@@ -493,6 +512,7 @@ NULL	mysql	slow_log	last_insert_id	int	N
 NULL	mysql	slow_log	insert_id	int	NULL	NULL	NULL	NULL	int(11)
 NULL	mysql	slow_log	server_id	int	NULL	NULL	NULL	NULL	int(10) unsigned
 1.0000	mysql	slow_log	sql_text	mediumtext	16777215	16777215	utf8	utf8_general_ci	mediumtext
+NULL	mysql	slow_log	thread_id	int	NULL	NULL	NULL	NULL	int(11)
 3.0000	mysql	tables_priv	Host	char	60	180	utf8	utf8_bin	char(60)
 3.0000	mysql	tables_priv	Db	char	64	192	utf8	utf8_bin	char(64)
 3.0000	mysql	tables_priv	User	char	16	48	utf8	utf8_bin	char(16)
@@ -555,3 +575,5 @@ NULL	mysql	user	max_questions	int	NULL	N
 NULL	mysql	user	max_updates	int	NULL	NULL	NULL	NULL	int(11) unsigned
 NULL	mysql	user	max_connections	int	NULL	NULL	NULL	NULL	int(11) unsigned
 NULL	mysql	user	max_user_connections	int	NULL	NULL	NULL	NULL	int(11) unsigned
+3.0000	mysql	user	plugin	char	64	192	utf8	utf8_bin	char(64)
+1.0000	mysql	user	authentication_string	text	65535	65535	utf8	utf8_bin	text

=== modified file 'mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result	2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result	2011-03-18 11:20:23 +0000
@@ -40,6 +40,11 @@ def	mysql	procs_priv	0	mysql	PRIMARY	2	D
 def	mysql	procs_priv	0	mysql	PRIMARY	3	User	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	procs_priv	0	mysql	PRIMARY	4	Routine_name	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	procs_priv	0	mysql	PRIMARY	5	Routine_type	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	1	mysql	Grantor	1	Grantor	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	1	Host	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	2	User	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	3	Proxied_host	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	4	Proxied_user	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	servers	0	mysql	PRIMARY	1	Server_name	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_master_info	0	mysql	PRIMARY	1	Master_id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_relay_log_info	0	mysql	PRIMARY	1	Master_id	A	#CARD#	NULL	NULL		BTREE		
@@ -95,6 +100,11 @@ def	mysql	procs_priv	0	mysql	PRIMARY	2	D
 def	mysql	procs_priv	0	mysql	PRIMARY	3	User	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	procs_priv	0	mysql	PRIMARY	4	Routine_name	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	procs_priv	0	mysql	PRIMARY	5	Routine_type	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	1	mysql	Grantor	1	Grantor	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	1	Host	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	2	User	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	3	Proxied_host	A	#CARD#	NULL	NULL		BTREE		
+def	mysql	proxies_priv	0	mysql	PRIMARY	4	Proxied_user	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	servers	0	mysql	PRIMARY	1	Server_name	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_master_info	0	mysql	PRIMARY	1	Master_id	A	#CARD#	NULL	NULL		BTREE		
 def	mysql	slave_relay_log_info	0	mysql	PRIMARY	1	Master_id	A	#CARD#	NULL	NULL		BTREE		

=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result	2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result	2011-03-18 11:20:23 +0000
@@ -23,6 +23,7 @@ def	mysql	PRIMARY	mysql	ndb_binlog_index
 def	mysql	PRIMARY	mysql	plugin	PRIMARY KEY
 def	mysql	PRIMARY	mysql	proc	PRIMARY KEY
 def	mysql	PRIMARY	mysql	procs_priv	PRIMARY KEY
+def	mysql	PRIMARY	mysql	proxies_priv	PRIMARY KEY
 def	mysql	PRIMARY	mysql	servers	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_master_info	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_relay_log_info	PRIMARY KEY
@@ -54,6 +55,7 @@ def	mysql	PRIMARY	mysql	ndb_binlog_index
 def	mysql	PRIMARY	mysql	plugin	PRIMARY KEY
 def	mysql	PRIMARY	mysql	proc	PRIMARY KEY
 def	mysql	PRIMARY	mysql	procs_priv	PRIMARY KEY
+def	mysql	PRIMARY	mysql	proxies_priv	PRIMARY KEY
 def	mysql	PRIMARY	mysql	servers	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_master_info	PRIMARY KEY
 def	mysql	PRIMARY	mysql	slave_relay_log_info	PRIMARY KEY

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result	2010-07-06 22:01:07 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result	2011-03-18 11:20:23 +0000
@@ -336,6 +336,29 @@ user_comment	Procedure privileges
 Separator	-----------------------------------------------------
 TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
+TABLE_NAME	proxies_priv
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Fixed
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	NULL
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	User proxy privileges
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
 TABLE_NAME	servers
 TABLE_TYPE	BASE TABLE
 ENGINE	MyISAM
@@ -380,7 +403,7 @@ CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
 user_comment	Master Information
 Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
+TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
 TABLE_NAME	slave_relay_log_info
 TABLE_TYPE	BASE TABLE
@@ -403,7 +426,7 @@ CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
 user_comment	Relay Log Information
 Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
+TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
 TABLE_NAME	slow_log
 TABLE_TYPE	BASE TABLE
@@ -927,6 +950,29 @@ user_comment	Procedure privileges
 Separator	-----------------------------------------------------
 TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
+TABLE_NAME	proxies_priv
+TABLE_TYPE	BASE TABLE
+ENGINE	MyISAM
+VERSION	10
+ROW_FORMAT	Fixed
+TABLE_ROWS	#TBLR#
+AVG_ROW_LENGTH	#ARL#
+DATA_LENGTH	#DL#
+MAX_DATA_LENGTH	#MDL#
+INDEX_LENGTH	#IL#
+DATA_FREE	#DF#
+AUTO_INCREMENT	NULL
+CREATE_TIME	#CRT#
+UPDATE_TIME	#UT#
+CHECK_TIME	#CT#
+TABLE_COLLATION	utf8_bin
+CHECKSUM	NULL
+CREATE_OPTIONS	#CO#
+TABLE_COMMENT	#TC#
+user_comment	User proxy privileges
+Separator	-----------------------------------------------------
+TABLE_CATALOG	def
+TABLE_SCHEMA	mysql
 TABLE_NAME	servers
 TABLE_TYPE	BASE TABLE
 ENGINE	MyISAM
@@ -971,7 +1017,7 @@ CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
 user_comment	Master Information
 Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
+TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
 TABLE_NAME	slave_relay_log_info
 TABLE_TYPE	BASE TABLE
@@ -994,7 +1040,7 @@ CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
 user_comment	Relay Log Information
 Separator	-----------------------------------------------------
-TABLE_CATALOG	NULL
+TABLE_CATALOG	def
 TABLE_SCHEMA	mysql
 TABLE_NAME	slow_log
 TABLE_TYPE	BASE TABLE

=== modified file 'mysql-test/suite/funcs_1/r/is_user_privileges.result'
--- a/mysql-test/suite/funcs_1/r/is_user_privileges.result	2010-08-09 08:32:50 +0000
+++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result	2011-03-18 14:16:17 +0000
@@ -128,7 +128,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -170,7 +170,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -212,7 +212,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 #
 # Add GRANT OPTION db_datadict.* to testuser1;
 GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
@@ -278,7 +278,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -320,7 +320,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -362,7 +362,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 # Establish connection testuser1 (user=testuser1)
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -414,7 +414,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -456,7 +456,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -498,7 +498,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -572,7 +572,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -614,7 +614,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -656,7 +656,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
 #
 # Here <SELECT YES> is shown correctly for testuser1;
@@ -722,7 +722,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -764,7 +764,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -806,7 +806,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -858,7 +858,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -900,7 +900,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -942,7 +942,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION
@@ -1046,7 +1046,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -1088,7 +1088,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -1130,7 +1130,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -1229,7 +1229,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -1271,7 +1271,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -1313,7 +1313,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''
@@ -1365,7 +1365,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -1407,7 +1407,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -1449,7 +1449,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -1508,7 +1508,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -1550,7 +1550,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -1592,7 +1592,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 SHOW GRANTS;
 Grants for testuser1@localhost
 GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -1666,7 +1666,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser2
 Password	
@@ -1708,7 +1708,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 Host	localhost
 User	testuser3
 Password	
@@ -1750,7 +1750,7 @@ max_updates	0
 max_connections	0
 max_user_connections	0
 plugin	
-authentication_string	
+authentication_string	NULL
 # Switch to connection testuser1
 SELECT * FROM information_schema.user_privileges
 WHERE grantee LIKE '''testuser%'''

=== modified file 'mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc'
--- a/mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc	2010-06-29 07:10:56 +0000
+++ b/mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc	2011-03-14 14:44:14 +0000
@@ -4,22 +4,22 @@ DROP DATABASE IF EXISTS innodb;
 CREATE DATABASE innodb;
 
 CREATE TABLE innodb.table_stats (
-	database_name			VARCHAR(512) NOT NULL,
-	table_name			VARCHAR(512) NOT NULL,
+	database_name			VARCHAR(64) NOT NULL,
+	table_name			VARCHAR(64) NOT NULL,
 	stats_timestamp			TIMESTAMP NOT NULL,
 	n_rows				BIGINT UNSIGNED NOT NULL,
 	clustered_index_size		BIGINT UNSIGNED NOT NULL,
 	sum_of_other_index_sizes	BIGINT UNSIGNED NOT NULL,
 	PRIMARY KEY (database_name, table_name)
-) ENGINE=INNODB;
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
 
 CREATE TABLE innodb.index_stats (
-	database_name			VARCHAR(512) NOT NULL,
-	table_name			VARCHAR(512) NOT NULL,
-	index_name			VARCHAR(512) NOT NULL,
+	database_name			VARCHAR(64) NOT NULL,
+	table_name			VARCHAR(64) NOT NULL,
+	index_name			VARCHAR(64) NOT NULL,
 	stat_timestamp			TIMESTAMP NOT NULL,
 	/* there are at least:
-	stat_name='index_size'
+	stat_name='size'
 	stat_name='n_leaf_pages'
 	stat_name='n_diff_pfx%' */
 	stat_name			VARCHAR(64) NOT NULL,
@@ -29,7 +29,7 @@ CREATE TABLE innodb.index_stats (
 	PRIMARY KEY (database_name, table_name, index_name, stat_name),
 	FOREIGN KEY (database_name, table_name)
 	  REFERENCES table_stats (database_name, table_name)
-) ENGINE=INNODB;
+) ENGINE=INNODB DEFAULT CHARSET=utf8;
 
 -- enable_warnings
 -- enable_query_log

=== added file 'mysql-test/suite/innodb/r/innodb_bug11789106.result'
Files a/mysql-test/suite/innodb/r/innodb_bug11789106.result	1970-01-01 00:00:00 +0000 and b/mysql-test/suite/innodb/r/innodb_bug11789106.result	2011-02-25 09:39:09 +0000 differ

=== added file 'mysql-test/suite/innodb/r/innodb_bug60196.result'
--- a/mysql-test/suite/innodb/r/innodb_bug60196.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug60196.result	2011-03-09 17:15:55 +0000
@@ -0,0 +1,73 @@
+CREATE TABLE Bug_60196_FK1 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE Bug_60196_FK2 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE Bug_60196 (
+FK1_Key INT NOT NULL,
+FK2_Key INT NOT NULL,
+PRIMARY KEY (FK2_Key, FK1_Key),
+KEY FK1_Key (FK1_Key),
+KEY FK2_Key (FK2_Key),
+CONSTRAINT FK_FK1 FOREIGN KEY (FK1_Key)
+REFERENCES Bug_60196_FK1 (Primary_Key)
+ON DELETE CASCADE
+ON UPDATE CASCADE,
+CONSTRAINT FK_FK2 FOREIGN KEY (FK2_Key)
+REFERENCES Bug_60196_FK2 (Primary_Key)
+ON DELETE CASCADE
+ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO Bug_60196_FK1 VALUES (1), (2), (3), (4), (5);
+INSERT INTO Bug_60196_FK2 VALUES (1), (2), (3), (4), (5);
+INSERT INTO Bug_60196 VALUES (1, 1);
+INSERT INTO Bug_60196 VALUES (1, 2);
+INSERT INTO Bug_60196 VALUES (1, 3);
+INSERT INTO Bug_60196 VALUES (1, 99);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`bug_60196`, CONSTRAINT `FK_FK2` FOREIGN KEY (`FK2_Key`) REFERENCES `Bug_60196_FK2` (`Primary_Key`) ON DELETE CASCADE ON UPDATE CASCADE)
+INSERT INTO Bug_60196 VALUES (99, 1);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`bug_60196`, CONSTRAINT `FK_FK1` FOREIGN KEY (`FK1_Key`) REFERENCES `Bug_60196_FK1` (`Primary_Key`) ON DELETE CASCADE ON UPDATE CASCADE)
+SELECT * FROM bug_60196_FK1;
+Primary_Key
+1
+2
+3
+4
+5
+SELECT * FROM bug_60196_FK2;
+Primary_Key
+1
+2
+3
+4
+5
+SELECT * FROM bug_60196;
+FK1_Key	FK2_Key
+1	1
+1	2
+1	3
+# Stop server
+# Restart server.
+#
+# Try to insert more to the example table with foreign keys.
+# Bug60196 causes the foreign key file not to be found after
+# the resstart above.
+#
+SELECT * FROM Bug_60196;
+FK1_Key	FK2_Key
+1	1
+1	2
+1	3
+INSERT INTO Bug_60196 VALUES (2, 1);
+INSERT INTO Bug_60196 VALUES (2, 2);
+INSERT INTO Bug_60196 VALUES (2, 3);
+SELECT * FROM Bug_60196;
+FK1_Key	FK2_Key
+1	1
+1	2
+1	3
+2	1
+2	2
+2	3
+
+# Clean up.
+DROP TABLE Bug_60196;
+DROP TABLE Bug_60196_FK1;
+DROP TABLE Bug_60196_FK2;

=== modified file 'mysql-test/suite/innodb/r/innodb_monitor.result'
--- a/mysql-test/suite/innodb/r/innodb_monitor.result	2011-02-17 14:06:09 +0000
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result	2011-02-28 09:35:01 +0000
@@ -172,6 +172,10 @@ dml_inserts	enabled
 dml_deletes	enabled
 dml_updates	enabled
 ddl_background_drop_tables	disabled
+icp_attempts	disabled
+icp_no_match	disabled
+icp_out_of_range	disabled
+icp_match	disabled
 set global innodb_monitor_enable = all;
 select name, status from information_schema.innodb_metrics;
 name	status
@@ -347,6 +351,10 @@ dml_inserts	enabled
 dml_deletes	enabled
 dml_updates	enabled
 ddl_background_drop_tables	enabled
+icp_attempts	enabled
+icp_no_match	enabled
+icp_out_of_range	enabled
+icp_match	enabled
 set global innodb_monitor_enable = aaa;
 ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa'
 set global innodb_monitor_disable = All;
@@ -524,6 +532,10 @@ dml_inserts	disabled
 dml_deletes	disabled
 dml_updates	disabled
 ddl_background_drop_tables	disabled
+icp_attempts	disabled
+icp_no_match	disabled
+icp_out_of_range	disabled
+icp_match	disabled
 set global innodb_monitor_reset_all = all;
 select name, count, status from information_schema.innodb_metrics;
 name	count	status
@@ -699,6 +711,10 @@ dml_inserts	0	disabled
 dml_deletes	0	disabled
 dml_updates	0	disabled
 ddl_background_drop_tables	0	disabled
+icp_attempts	0	disabled
+icp_no_match	0	disabled
+icp_out_of_range	0	disabled
+icp_match	0	disabled
 set  global innodb_monitor_enable = "%lock%";
 select name, status from information_schema.innodb_metrics
 where name like "%lock%";
@@ -928,6 +944,10 @@ dml_inserts	enabled
 dml_deletes	enabled
 dml_updates	enabled
 ddl_background_drop_tables	enabled
+icp_attempts	enabled
+icp_no_match	enabled
+icp_out_of_range	enabled
+icp_match	enabled
 set global innodb_monitor_disable="%%%%%";
 select name, status from information_schema.innodb_metrics;
 name	status
@@ -1103,6 +1123,10 @@ dml_inserts	disabled
 dml_deletes	disabled
 dml_updates	disabled
 ddl_background_drop_tables	disabled
+icp_attempts	disabled
+icp_no_match	disabled
+icp_out_of_range	disabled
+icp_match	disabled
 set global innodb_monitor_enable="%";
 select name, status from information_schema.innodb_metrics;
 name	status
@@ -1278,6 +1302,10 @@ dml_inserts	enabled
 dml_deletes	enabled
 dml_updates	enabled
 ddl_background_drop_tables	enabled
+icp_attempts	enabled
+icp_no_match	enabled
+icp_out_of_range	enabled
+icp_match	enabled
 set global innodb_monitor_disable="%_%";
 select name, status from information_schema.innodb_metrics;
 name	status
@@ -1453,6 +1481,10 @@ dml_inserts	disabled
 dml_deletes	disabled
 dml_updates	disabled
 ddl_background_drop_tables	disabled
+icp_attempts	disabled
+icp_no_match	disabled
+icp_out_of_range	disabled
+icp_match	disabled
 set global innodb_monitor_enable="log%%%%";
 select name, status from information_schema.innodb_metrics;
 name	status
@@ -1628,6 +1660,10 @@ dml_inserts	disabled
 dml_deletes	disabled
 dml_updates	disabled
 ddl_background_drop_tables	disabled
+icp_attempts	disabled
+icp_no_match	disabled
+icp_out_of_range	disabled
+icp_match	disabled
 set global innodb_monitor_enable="os_%a_fs_ncs";
 set global innodb_monitor_enable="os%pending%";
 select name, status from information_schema.innodb_metrics
@@ -1866,6 +1902,30 @@ where name like "file_num_open_files";
 name	max_count	min_count	count	max_count_reset	min_count_reset	count_reset	status
 file_num_open_files	3	3	3	3	3	3	enabled
 set global innodb_monitor_disable = file_num_open_files;
+set global innodb_monitor_enable = "icp%";
+create table monitor_test(a char(3), b int, c char(2),
+primary key (a(1), c(1)), key(b)) engine = innodb;
+insert into monitor_test values("13", 2, "aa");
+select a from monitor_test where b < 1 for update;
+a
+select name, count from information_schema.innodb_metrics
+where name like "icp%";
+name	count
+icp_attempts	1
+icp_no_match	0
+icp_out_of_range	1
+icp_match	0
+select a from monitor_test where b < 3 for update;
+a
+13
+select name, count from information_schema.innodb_metrics
+where name like "icp%";
+name	count
+icp_attempts	2
+icp_no_match	0
+icp_out_of_range	1
+icp_match	1
+drop table monitor_test;
 set global innodb_monitor_enable = default;
 set global innodb_monitor_disable = default;
 set global innodb_monitor_reset = default;

=== added file 'mysql-test/suite/innodb/t/innodb_bug11789106.test'
--- a/mysql-test/suite/innodb/t/innodb_bug11789106.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug11789106.test	2011-02-25 09:39:09 +0000
@@ -0,0 +1,17 @@
+# Test for bug #11789106: FAILING ASSERTION: templ->mbmaxlen > templ->mbminlen
+# templ->mysql_col_len == len
+
+-- source include/have_innodb.inc
+
+create table table_11789106(`a` point,`b` int,`c` char(2),
+			   primary key (`a`(1),`c`(1)), key (`b`))
+character set latin2 engine=innodb;
+
+insert into table_11789106 values (geomfromtext('point(1 1)'),'','');
+
+# This will trigger the assertion failure in
+# row_sel_field_store_in_mysql_format_func()
+select `a` from table_11789106 where `b` < '1' for update;
+
+drop table table_11789106;
+

=== added file 'mysql-test/suite/innodb/t/innodb_bug60196-master.opt'
--- a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt	2011-03-07 15:42:07 +0000
@@ -0,0 +1 @@
+--lower-case-table-names=2

=== added file 'mysql-test/suite/innodb/t/innodb_bug60196.test'
--- a/mysql-test/suite/innodb/t/innodb_bug60196.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug60196.test	2011-03-09 17:15:55 +0000
@@ -0,0 +1,87 @@
+# Bug#60196 - Setting lowercase_table_names to 2 on Windows causing
+# Foreign Key problems after an engine is restarted.
+
+# This test case needs InnoDB, a lowercase file system,
+# lower-case-table-names=2, and cannot use the embedded server
+# because it restarts the server.
+--source include/not_embedded.inc
+--source include/have_lowercase2.inc
+--source include/have_case_insensitive_file_system.inc
+--source include/have_innodb.inc
+
+#
+# Create test data.
+#
+CREATE TABLE Bug_60196_FK1 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE Bug_60196_FK2 (Primary_Key INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE Bug_60196 (
+  FK1_Key INT NOT NULL,
+  FK2_Key INT NOT NULL,
+  PRIMARY KEY (FK2_Key, FK1_Key),
+  KEY FK1_Key (FK1_Key),
+  KEY FK2_Key (FK2_Key),
+  CONSTRAINT FK_FK1 FOREIGN KEY (FK1_Key)
+    REFERENCES Bug_60196_FK1 (Primary_Key)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE,
+  CONSTRAINT FK_FK2 FOREIGN KEY (FK2_Key)
+    REFERENCES Bug_60196_FK2 (Primary_Key)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO Bug_60196_FK1 VALUES (1), (2), (3), (4), (5);
+INSERT INTO Bug_60196_FK2 VALUES (1), (2), (3), (4), (5);
+INSERT INTO Bug_60196 VALUES (1, 1);
+INSERT INTO Bug_60196 VALUES (1, 2);
+INSERT INTO Bug_60196 VALUES (1, 3);
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO Bug_60196 VALUES (1, 99);
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO Bug_60196 VALUES (99, 1);
+
+SELECT * FROM bug_60196_FK1;
+SELECT * FROM bug_60196_FK2;
+SELECT * FROM bug_60196;
+
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Send a shutdown request to the server
+-- shutdown_server 10
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+--echo #
+--echo # Try to insert more to the example table with foreign keys.
+--echo # Bug60196 causes the foreign key file not to be found after
+--echo # the resstart above.
+--echo #
+SELECT * FROM Bug_60196;
+INSERT INTO Bug_60196 VALUES (2, 1);
+INSERT INTO Bug_60196 VALUES (2, 2);
+INSERT INTO Bug_60196 VALUES (2, 3);
+SELECT * FROM Bug_60196;
+
+--echo
+--echo # Clean up.
+DROP TABLE Bug_60196;
+DROP TABLE Bug_60196_FK1;
+DROP TABLE Bug_60196_FK2;
+

=== modified file 'mysql-test/suite/innodb/t/innodb_monitor.test'
--- a/mysql-test/suite/innodb/t/innodb_monitor.test	2011-02-17 14:06:09 +0000
+++ b/mysql-test/suite/innodb/t/innodb_monitor.test	2011-02-28 09:35:01 +0000
@@ -340,6 +340,28 @@ where name like "file_num_open_files";
 
 set global innodb_monitor_disable = file_num_open_files;
 
+# Test ICP module counters
+set global innodb_monitor_enable = "icp%";
+
+create table monitor_test(a char(3), b int, c char(2),
+primary key (a(1), c(1)), key(b)) engine = innodb;
+
+insert into monitor_test values("13", 2, "aa");
+
+select a from monitor_test where b < 1 for update;
+
+# should have icp_attempts = 1 and icp_out_of_range = 1
+select name, count from information_schema.innodb_metrics
+where name like "icp%";
+
+# should have icp_attempts = 2 and icp_match = 1
+select a from monitor_test where b < 3 for update;
+
+select name, count from information_schema.innodb_metrics
+where name like "icp%";
+
+drop table monitor_test;
+
 -- disable_warnings
 set global innodb_monitor_enable = default;
 set global innodb_monitor_disable = default;

=== modified file 'mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result'
--- a/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result	2010-02-28 17:39:28 +0000
+++ b/mysql-test/suite/large_tests/r/rpl_slave_net_timeout.result	2011-03-17 10:31:42 +0000
@@ -1,25 +1,20 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
+include/master-slave.inc
+[connection master]
 set @save_general_log = @@global.general_log;
 set @save_log_output = @@global.log_output;
 set @save_slave_net_timeout = @@global.slave_net_timeout;
 set @@global.general_log = ON;
 set @@global.log_output = 'table,file';
 include/stop_slave.inc
-set @@global.slave_net_timeout = @@global.net_read_timeout * 2;
 change master to master_host = '127.0.0.1',master_port = MASTER_PORT,
 master_user = 'root', master_heartbeat_period = 0;
+set @@global.slave_net_timeout = @@global.net_read_timeout * 2;
 include/start_slave.inc
 include/stop_slave.inc
 select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time desc limit 1 into @ts_last;
 select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time asc limit 1 into @ts_prev;
-select @result as 'Must be 1';
-Must be 1
-1
+include/assert.inc [time between last reconnection and the reconnection before that should be >= slave_net_timeout]
 set @@global.general_log = @save_general_log;
 set @@global.log_output = @save_log_output;
 set @@global.slave_net_timeout = @save_slave_net_timeout;
+include/rpl_end.inc

=== modified file 'mysql-test/suite/large_tests/t/rpl_slave_net_timeout.test'
--- a/mysql-test/suite/large_tests/t/rpl_slave_net_timeout.test	2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/large_tests/t/rpl_slave_net_timeout.test	2011-03-17 10:31:42 +0000
@@ -21,11 +21,6 @@ set @@global.log_output = 'table,file';
 
 connection slave;
 --source include/stop_slave.inc
---disable_warnings
-set @@global.slave_net_timeout = @@global.net_read_timeout * 2;
---enable_warnings
-let $idle_time=`select @@global.slave_net_timeout * 2`;
-
 #
 # if heartbeat is disabled then reconnecting to the idle master
 # should happen with `slave_net_timeout' period.
@@ -42,6 +37,9 @@ let $idle_time=`select @@global.slave_ne
 eval change master to master_host = '127.0.0.1',master_port = $MASTER_MYPORT,
 master_user = 'root', master_heartbeat_period = 0;
 
+set @@global.slave_net_timeout = @@global.net_read_timeout * 2;
+let $idle_time=`select @@global.slave_net_timeout * 2`;
+
 let $slave_net_timeout = `select @@global.slave_net_timeout`;
 
 --source include/start_slave.inc
@@ -64,11 +62,9 @@ connection master;
 select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time desc limit 1 into @ts_last;
 select event_time from (select event_time from mysql.general_log as t_1 where command_type like 'Connect' order by event_time desc limit 2) as t_2 order by event_time asc limit 1 into @ts_prev;
 
---disable_query_log
-eval select time_to_sec(@ts_last) - $slave_net_timeout >= time_to_sec(@ts_prev) into @result;
---enable_query_log
-
-select @result as 'Must be 1';
+--let $assert_cond= time_to_sec(@ts_last) - time_to_sec(@ts_prev) >= $slave_net_timeout
+--let $assert_text= time between last reconnection and the reconnection before that should be >= slave_net_timeout
+--source include/assert.inc
 
 # cleanup 
 
@@ -79,4 +75,5 @@ set @@global.log_output = @save_log_outp
 connection slave;
 set @@global.slave_net_timeout = @save_slave_net_timeout;
 
+--let $rpl_only_running_threads= 1
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/perfschema/r/server_init.result'
--- a/mysql-test/suite/perfschema/r/server_init.result	2011-01-13 11:31:20 +0000
+++ b/mysql-test/suite/perfschema/r/server_init.result	2011-03-17 11:23:31 +0000
@@ -12,10 +12,6 @@ where name like "wait/synch/mutex/mysys/
 count(name)
 1
 select count(name) from mutex_instances
-where name like "wait/synch/mutex/mysys/THR_LOCK_isam";
-count(name)
-1
-select count(name) from mutex_instances
 where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
 count(name)
 1

=== modified file 'mysql-test/suite/perfschema/t/server_init.test'
--- a/mysql-test/suite/perfschema/t/server_init.test	2011-01-13 11:31:20 +0000
+++ b/mysql-test/suite/perfschema/t/server_init.test	2011-03-17 11:23:31 +0000
@@ -38,9 +38,6 @@ select count(name) from mutex_instances
  where name like "wait/synch/mutex/mysys/THR_LOCK_open";
 
 select count(name) from mutex_instances
- where name like "wait/synch/mutex/mysys/THR_LOCK_isam";
-
-select count(name) from mutex_instances
  where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
 
 select count(name) from mutex_instances

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum_cache.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum_cache.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_checksum_cache.result	2011-03-18 13:11:47 +0000
@@ -2,7 +2,7 @@ include/master-slave.inc
 [connection master]
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*");
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
-call mtr.add_suppression("Slave SQL: slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table; waiting for the group completion");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 set @save_binlog_cache_size = @@global.binlog_cache_size;
 set @save_binlog_checksum = @@global.binlog_checksum;
 set @save_master_verify_checksum = @@global.master_verify_checksum;

=== modified file 'mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result'
--- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result	2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result	2011-03-16 16:38:30 +0000
@@ -5,7 +5,7 @@ include/rpl_init.inc [topology=1->2->3->
 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
 CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
 include/rpl_sync.inc
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 
 *** Testing schema A->B->C->D->A ***
 

=== added file 'mysql-test/suite/rpl/r/rpl_grant_plugin.result'
--- a/mysql-test/suite/rpl/r/rpl_grant_plugin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_grant_plugin.result	2011-02-11 10:27:31 +0000
@@ -0,0 +1,6 @@
+include/master-slave.inc
+[connection master]
+include/assert.inc [Logged query must match the one issued.]
+include/assert.inc [Logged query must match the one issued.]
+include/assert.inc [Logged query must match the one issued but properly escaped.]
+include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat_basic.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2011-03-17 13:20:36 +0000
@@ -208,7 +208,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b VA
 INSERT INTO t1 VALUES (1, 'on slave', NULL);
 INSERT INTO t1 VALUES (1, 'on master', NULL);
 call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* Error_code: 1062");
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
 include/stop_slave.inc
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_ignore_table.result'
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result	2011-03-18 14:58:27 +0000
@@ -30,7 +30,6 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'authentication_string' doesn't have a default value
 GRANT SELECT ON *.* TO mysqltest6@localhost;
 GRANT INSERT ON *.* TO mysqltest6@localhost;
 GRANT INSERT ON test.* TO mysqltest6@localhost;

=== modified file 'mysql-test/suite/rpl/r/rpl_slow_query_log.result'
--- a/mysql-test/suite/rpl/r/rpl_slow_query_log.result	2011-02-24 15:48:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result	2011-03-17 13:20:36 +0000
@@ -1,7 +1,7 @@
 include/master-slave.inc
 [connection master]
 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-call mtr.add_suppression("Slave SQL: slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table; waiting for the group completion");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 include/stop_slave.inc
 SET @old_log_output= @@log_output;
 SET GLOBAL log_output= 'TABLE';

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_000001.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_000001.result	2011-02-22 07:52:45 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result	2011-03-18 14:58:27 +0000
@@ -63,7 +63,6 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'authentication_string' doesn't have a default value
 select select_priv,user from mysql.user where user = _binary'blafasel2';
 select_priv	user
 N	blafasel2

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result	2011-03-17 13:20:36 +0000
@@ -70,6 +70,6 @@ include/start_slave.inc
 # Clean up
 DROP TABLE t1;
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2011-03-17 13:20:36 +0000
@@ -11,8 +11,8 @@ insert into tm set a=null;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 commit;
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
-call mtr.add_suppression("Slave SQL.*The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed.");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+call mtr.add_suppression("Slave SQL.*Slave SQL Thread stopped with incomplete event group having non-transactional changes");
 include/wait_for_slave_sql_to_stop.inc
 include/check_slave_no_error.inc
 include/assert.inc [Everything that was read, was executed]
@@ -31,7 +31,7 @@ Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 commit;
 include/wait_for_slave_sql_error.inc [errno=1593]
-Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
+Last_SQL_Error = 'Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
 include/assert.inc [Not everything that was read, was executed]
 include/assert.inc [There is one row in table tm]
 include/assert.inc [There is no row in table ti]
@@ -43,7 +43,7 @@ set @@global.debug="+d,stop_slave_middle
 set @@global.debug="+d,incomplete_group_in_relay_log";
 update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
 include/wait_for_slave_sql_error.inc [errno=1593]
-Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
+Last_SQL_Error = 'Fatal error: ... Slave SQL Thread stopped with incomplete event group having non-transactional changes. If the group consists solely of row-based events, you can try to restart the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).'
 include/assert.inc [Not everything that was read, was executed]
 include/assert.inc [The max value for field 'a' is 2]
 include/assert.inc [The max value for field 'a' is 1]

=== modified file 'mysql-test/suite/rpl/r/rpl_stop_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result	2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result	2011-03-17 12:12:25 +0000
@@ -75,7 +75,7 @@ include/wait_for_slave_sql_to_start.inc
 # Test end
 SET GLOBAL debug= '$debug_save';
 include/restart_slave.inc
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 [connection master]
 DROP TABLE t1, t2;
 
@@ -93,6 +93,7 @@ DROP TABLE t1, t2;
 CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
 CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
 INSERT INTO t1 VALUES(1, 1);
+[connection master]
 SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
 [connection slave]
 include/restart_slave.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum_cache.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test	2011-03-18 13:11:47 +0000
@@ -4,7 +4,7 @@
 --disable_warnings
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*");
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
-call mtr.add_suppression("Slave SQL: slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table; waiting for the group completion");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 --enable_warnings
 
 connection master;

=== modified file 'mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test'
--- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test	2011-03-17 13:20:36 +0000
@@ -30,7 +30,7 @@ CREATE TABLE t1 (a INT NOT NULL AUTO_INC
 CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
 --source include/rpl_sync.inc
 --connection server_4
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 --echo
 
 #

=== added file 'mysql-test/suite/rpl/t/rpl_grant_plugin-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_grant_plugin-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_grant_plugin-master.opt	2011-02-11 10:27:31 +0000
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD

=== added file 'mysql-test/suite/rpl/t/rpl_grant_plugin-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_grant_plugin-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_grant_plugin-slave.opt	2011-02-11 10:27:31 +0000
@@ -0,0 +1,2 @@
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD

=== added file 'mysql-test/suite/rpl/t/rpl_grant_plugin.test'
--- a/mysql-test/suite/rpl/t/rpl_grant_plugin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_grant_plugin.test	2011-02-15 10:57:05 +0000
@@ -0,0 +1,64 @@
+#
+# Only needs to be run once. Make it row format,
+# because row runs are included in all pb2 platforms,
+# whereas statement (for instance) is not.
+#
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+-- source include/have_plugin_auth.inc
+
+#
+# BUG#59708: 'CREATE USER ... IDENTIFIED WITH ..' statement is
+#            binlogged wrongly
+#
+# The test case checks that the statement in the binary log matches
+# the one that was issued. Assertions are added for 'CREATE USER ...'
+# as well for 'GRANT ALL ...'
+#
+--disable_query_log
+--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1)
+--let $assert_text= Logged query must match the one issued.
+
+--let $query= CREATE USER 'b59708_user1'@'%' IDENTIFIED WITH 'test_plugin_server' AS 'CN=analyst, OU=division1, O=oracle, C=US'
+--let $binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1)
+--eval $query
+--let $logged_query= query_get_value(SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_position , Info, 1)
+--let $assert_cond= `SELECT "$logged_query" LIKE "%$query"`
+--source include/assert.inc
+
+-- sync_slave_with_master
+-- connection master
+
+--let $query= GRANT ALL ON test.* TO 'b59708_user2'@'%' IDENTIFIED WITH 'test_plugin_server' AS 'CN=analyst, OU=division1, O=oracle, C=US'
+--let $binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1)
+--eval $query
+--let $logged_query= query_get_value(SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_position , Info, 1)
+--let $assert_cond= `SELECT "$logged_query" LIKE "%$query"`
+--let $assert_text= Logged query must match the one issued.
+--source include/assert.inc
+
+-- sync_slave_with_master
+-- connection master
+
+## testing with escaped characters
+--let $query= CREATE USER 'b59708_user\''@'localhost\'' IDENTIFIED WITH 'test_plugin_server' AS '\'CN=analyst, OU=division1, O=oracle, C=US'
+--let $binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1)
+--eval $query
+--let $logged_query= query_get_value(SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_position , Info, 1)
+--let $assert_cond= `SELECT "$logged_query" LIKE "%$query"`
+--let $assert_text= Logged query must match the one issued but properly escaped.
+--source include/assert.inc
+
+-- sync_slave_with_master
+-- connection master
+
+DROP USER b59708_user1;
+DROP USER b59708_user2;
+DROP USER 'b59708_user\''@'localhost\'';
+
+-- sync_slave_with_master
+-- connection master
+
+--enable_query_log
+
+-- source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat_basic.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2011-03-17 13:20:36 +0000
@@ -328,7 +328,7 @@ INSERT INTO t1 VALUES (1, 'on slave', NU
 INSERT INTO t1 VALUES (1, 'on master', NULL);
 --connection slave
 call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* Error_code: 1062");
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 let $slave_errno= ER_DUP_ENTRY
 --source include/wait_for_slave_sql_error.inc
 let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);

=== modified file 'mysql-test/suite/rpl/t/rpl_semi_sync.test'
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test	2011-03-17 13:20:36 +0000
@@ -16,6 +16,7 @@ call mtr.add_suppression("Semi-sync mast
 connection slave;
 call mtr.add_suppression("Master server does not support semi-sync");
 call mtr.add_suppression("Semi-sync slave .* reply");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 enable_query_log;
 connection master;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_slow_query_log.test'
--- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test	2011-02-24 15:48:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test	2011-03-17 13:20:36 +0000
@@ -29,7 +29,7 @@ source include/master-slave.inc;
 source include/have_binlog_format_statement.inc;
 
 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-call mtr.add_suppression("Slave SQL: slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table; waiting for the group completion");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 
 # Prepare slave for different long_query_time we need to stop the slave 
 # and restart it as long_query_time variable is dynamic and, after 

=== modified file 'mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test	2011-03-17 13:20:36 +0000
@@ -19,7 +19,7 @@ SET @@session.binlog_direct_non_transact
 # clean up
 --connection slave
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 --connection master
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test	2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test	2011-03-17 12:12:25 +0000
@@ -48,7 +48,7 @@ SET GLOBAL debug= '$debug_save';
 source include/restart_slave_sql.inc;
 
 connection slave;
-call mtr.add_suppression("Slave SQL.*slave SQL thread is being stopped in the middle of applying of a group having updated a non-transaction table");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 connection master;
 
 --source include/rpl_connection_master.inc
@@ -71,11 +71,13 @@ CREATE TABLE t1 (c1 INT KEY, c2 INT) ENG
 CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
 INSERT INTO t1 VALUES(1, 1);
 
+sync_slave_with_master;
+
+--source include/rpl_connection_master.inc
+
 let $debug_save= `SELECT @@GLOBAL.debug`;
 SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
 
-sync_slave_with_master;
-
 --source include/rpl_connection_slave.inc
 source include/restart_slave_sql.inc;
 

=== modified file 'mysql-test/suite/sys_vars/r/optimizer_switch_basic.result'
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result	2011-02-17 13:25:01 +0000
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result	2011-03-17 09:43:28 +0000
@@ -60,6 +60,13 @@ set session optimizer_switch="index_merg
 ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge'
 set session optimizer_switch="foobar";
 ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'foobar'
+#
+# Bug#59894 set optimizer_switch to e or d causes invalid
+# memory writes/valgrind warnings
+
+set global optimizer_switch = 'd';
+set global optimizer_switch = 'e';
+ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'e'
 SET @@global.optimizer_switch = @start_global_value;
 SELECT @@global.optimizer_switch;
 @@global.optimizer_switch

=== modified file 'mysql-test/suite/sys_vars/t/optimizer_switch_basic.test'
--- a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test	2010-01-29 06:33:00 +0000
+++ b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test	2011-02-11 14:00:09 +0000
@@ -46,5 +46,13 @@ set session optimizer_switch="index_merg
 --error ER_WRONG_VALUE_FOR_VAR
 set session optimizer_switch="foobar";
 
+--echo #
+--echo # Bug#59894 set optimizer_switch to e or d causes invalid
+--echo # memory writes/valgrind warnings
+--echo
+set global optimizer_switch = 'd'; # means default
+--error ER_WRONG_VALUE_FOR_VAR
+set global optimizer_switch = 'e';
+
 SET @@global.optimizer_switch = @start_global_value;
 SELECT @@global.optimizer_switch;

=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test	2010-12-08 12:55:40 +0000
+++ b/mysql-test/t/archive.test	2011-03-03 09:22:17 +0000
@@ -1730,3 +1730,18 @@ DROP TABLE t1;
 CREATE TABLE `a/../`(a INT) ENGINE=ARCHIVE;
 remove_file $MYSQLD_DATADIR/test/a@002f@002e@002e@stripped;
 DROP TABLE `a/../`;
+
+--echo #
+--echo # BUG#57162 - valgrind errors, random data when returning
+--echo #             ordered data from archive tables
+--echo #
+SET sort_buffer_size=32804;
+CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
+  e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
+INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
+SELECT * FROM t1 ORDER BY f LIMIT 1;
+DROP TABLE t1;
+SET sort_buffer_size=DEFAULT;

=== modified file 'mysql-test/t/cast.test'
--- a/mysql-test/t/cast.test	2010-04-11 06:52:42 +0000
+++ b/mysql-test/t/cast.test	2011-03-15 14:56:11 +0000
@@ -280,5 +280,19 @@ SELECT 1 FROM
 ) AS s LIMIT 1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING 
+--echo #   DOESN'T ADHERE TO MAX_ALLOWED_PACKET
+
+SET @@GLOBAL.max_allowed_packet=2048;
+# reconnect to make the new max packet size take effect
+--connect (newconn, localhost, root,,)
+
+SELECT CONVERT('a', BINARY(2049));  
+SELECT CONVERT('a', CHAR(2049));  
+
+connection default;
+disconnect newconn;
+SET @@GLOBAL.max_allowed_packet=default;
 
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2011-01-14 15:36:19 +0000
+++ b/mysql-test/t/func_math.test	2011-03-18 12:25:56 +0000
@@ -500,3 +500,8 @@ SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_f
 --echo # Bug #59498 div function broken in mysql-trunk
 --echo #
 SELECT 1 div null;
+
+--echo #
+--echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
+--echo #
+select (1.175494351E-37 div 1.7976931348623157E+308);

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-02-21 08:23:02 +0000
+++ b/mysql-test/t/func_time.test	2011-03-17 09:47:50 +0000
@@ -909,4 +909,12 @@ SELECT MONTHNAME(0), MONTHNAME(0) IS NUL
 SET storage_engine=NULL;
 
 --echo #
+--echo # Bug #59686 crash in String::copy() with time data type
+--echo #
+
+SELECT min(timestampadd(month, 1>'', from_days('%Z')));
 
+create table t1(a time);
+insert into t1 values ('00:00:00'),('00:01:00');
+select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
+drop table t1;

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2011-03-08 19:14:42 +0000
+++ b/mysql-test/t/gis.test	2011-03-17 11:33:17 +0000
@@ -773,7 +773,14 @@ drop table t1;
 #
 # Bug #50574 5.5.x allows spatial indexes on non-spatial 
 #           columns, causing crashes!
+# Bug#11767480 SPATIAL INDEXES ON NON-SPATIAL COLUMNS 
+#              CAUSE CRASHES.
 #
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+--error ER_SPATIAL_MUST_HAVE_GEOM_COL
+CREATE SPATIAL INDEX i on t0 (a);
+INSERT INTO t0 VALUES (1);
+
 --error ER_SPATIAL_MUST_HAVE_GEOM_COL
 CREATE TABLE t1(
   col0 BINARY NOT NULL,
@@ -811,8 +818,11 @@ CREATE TABLE t3 (
 );
 
 # cleanup
-DROP TABLE t1;
-DROP TABLE t2;
+DROP TABLE t0, t1, t2;
+
+
+--echo End of 5.5 tests
+
 
 # Conformance tests
 #

=== modified file 'mysql-test/t/mysql_client_test-master.opt'
--- a/mysql-test/t/mysql_client_test-master.opt	2010-11-02 11:53:54 +0000
+++ b/mysql-test/t/mysql_client_test-master.opt	2011-03-18 10:21:40 +0000
@@ -1 +1,5 @@
---general-log=1 --general-log-file=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE
+--general-log=1 
+--general-log-file=$MYSQLTEST_VARDIR/log/master.log 
+--log-output=FILE,TABLE
+$PLUGIN_AUTH_OPT
+$PLUGIN_AUTH_LOAD

=== modified file 'mysql-test/t/mysql_client_test.test'
--- a/mysql-test/t/mysql_client_test.test	2010-11-23 15:18:44 +0000
+++ b/mysql-test/t/mysql_client_test.test	2011-03-18 10:21:40 +0000
@@ -1,5 +1,7 @@
 # This test should work in embedded server after we fix mysqltest
 -- source include/not_embedded.inc
+# need to have the dynamic loading turned on for the client plugin tests
+--source include/have_plugin_auth.inc
 
 SET @old_general_log= @@global.general_log;
 SET @old_slow_query_log= @@global.slow_query_log;
@@ -12,7 +14,7 @@ SET @old_slow_query_log= @@global.slow_q
 # var/log/mysql_client_test.trace
 
 --exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
+--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M $PLUGIN_AUTH_CLIENT_OPT >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
 
 # End of 4.1 tests
 echo ok;

=== modified file 'mysql-test/t/mysqladmin.test'
--- a/mysql-test/t/mysqladmin.test	2011-01-16 03:25:30 +0000
+++ b/mysql-test/t/mysqladmin.test	2011-03-17 12:34:53 +0000
@@ -50,3 +50,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug106
 --cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
 
 --remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
+
+--echo #
+--echo # BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
+--echo #                with no .cnf or .ini extension.
+--echo #
+
+--echo # Creating an empty file 'cnf_file'
+--write_file $MYSQLTEST_VARDIR/tmp/cnf_file
+EOF
+
+--echo # Using --defaults-extra-file option with 'cnf_file'.
+--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
+
+--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2011-02-21 07:28:19 +0000
+++ b/mysql-test/t/mysqldump.test	2011-03-17 12:45:19 +0000
@@ -2210,6 +2210,8 @@ ALTER DATABASE `test-database` CHARACTER
 --exec $MYSQL_DUMP --quote-names --compact test-database
 
 DROP DATABASE `test-database`;
+# Switching back to test database.
+USE `test`;
 
 --echo #
 --echo # End of 5.1 tests
@@ -2227,5 +2229,15 @@ INSERT INTO t1 (a) VALUES (1),(2),(3);
 --exec $MYSQL_DUMP --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
 DROP TABLE t1;
 
+--echo #
+--echo # Verify that two modes can be given in --compatible;
+--echo # and are reflected in SET SQL_MODE in the mysqldump output.
+--echo # Also verify that a prefix of the mode's name is enough.
+--echo #
+CREATE TABLE t1 (a INT);
+# no_t = no_table_options; no_f = no_field_options
+--exec $MYSQL_DUMP --compatible=no_t,no_f --skip-comments test
+DROP TABLE t1;
+
 # Wait till we reached the initial number of concurrent sessions
 --source include/wait_until_count_sessions.inc

=== added file 'mysql-test/t/optimizer_debug_sync.test'
--- a/mysql-test/t/optimizer_debug_sync.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/optimizer_debug_sync.test	2011-03-02 11:51:03 +0000
@@ -0,0 +1,61 @@
+# This test checks various optimizer-related functions using
+# the debug-sync facility.
+
+--source include/have_debug_sync.inc
+--source include/have_innodb.inc
+--source include/have_materialization.inc
+
+--echo
+--echo BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...)
+--echo
+
+CREATE TABLE t(i INT NOT NULL PRIMARY KEY, f INT) ENGINE = InnoDB;
+INSERT INTO t VALUES (1,1),(2,2);
+
+BEGIN;
+UPDATE t SET f=100 WHERE i=2;
+
+--connect (con1,localhost,root,,)
+
+set optimizer_switch='semijoin=off';
+
+SET DEBUG_SYNC='before_index_end_in_subselect WAIT_FOR callit';
+--send SELECT f FROM t WHERE i IN ( SELECT i FROM t )
+
+--connection default
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'debug sync point: before_index_end_in_subselect';
+--source include/wait_show_condition.inc
+
+--connect (con2,localhost,root,,)
+--send SELECT MAX(i) FROM t FOR UPDATE
+
+--connect (con3,localhost,root,,)
+--send SELECT MAX(i) FROM t FOR UPDATE
+
+--connection default
+
+let $wait_condition=
+  SELECT COUNT(*) = 2 FROM information_schema.processlist 
+  WHERE state = 'Optimizing' and info = 'SELECT MAX(i) FROM t FOR UPDATE';
+--source include/wait_condition.inc
+
+SET DEBUG_SYNC='now SIGNAL callit';
+COMMIT;
+
+--connection con1
+--reap
+SET DEBUG_SYNC='RESET';
+
+--connection con2
+--reap
+
+--connection con3
+--reap
+
+DROP TABLE t;
+
+--exit
+
+--echo # End of BUG#56080

=== modified file 'mysql-test/t/plugin_auth.test'
--- a/mysql-test/t/plugin_auth.test	2011-02-08 17:48:20 +0000
+++ b/mysql-test/t/plugin_auth.test	2011-03-18 14:58:27 +0000
@@ -434,4 +434,61 @@ connection default;
 disconnect cleartext_con;
 DROP USER uplain@localhost;
 
+--echo #
+--echo # Bug #59038 : mysql.user.authentication_string column 
+--echo #   causes configuration wizard to fail
+
+INSERT INTO mysql.user(
+  Host, 
+  User, 
+  Password,  
+  Select_priv, 
+  Insert_priv,
+  Update_priv, 
+  Delete_priv, 
+  Create_priv, 
+  Drop_priv,  
+  Reload_priv, 
+  Shutdown_priv,
+  Process_priv, 
+  File_priv, 
+  Grant_priv, 
+  References_priv,  
+  Index_priv, 
+  Alter_priv,
+  Show_db_priv, 
+  Super_priv, 
+  Create_tmp_table_priv, 
+  Lock_tables_priv,  
+  Execute_priv,
+  Repl_slave_priv, 
+  Repl_client_priv, 
+  /*!50001 
+  Create_view_priv, 
+  Show_view_priv, 
+  Create_routine_priv, 
+  Alter_routine_priv, 
+  Create_user_priv, 
+  */ 
+  ssl_type, 
+  ssl_cipher,
+  x509_issuer, 
+  x509_subject, 
+  max_questions, 
+  max_updates, 
+  max_connections)
+VALUES (
+  'localhost', 
+  'inserttest', '', 
+  'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
+  'Y', 'Y',  'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 
+  /*!50001 'Y', 'Y', 'Y', 'Y', 'Y', */'', '', '', '', '0', '0', '0');
+FLUSH PRIVILEGES;
+DROP USER inserttest@localhost;
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE 
+  COLUMN_NAME IN ('authentication_string', 'plugin') AND 
+  TABLE_NAME='user' AND
+  TABLE_SCHEMA='mysql'
+ORDER BY COLUMN_NAME;
+
 --echo End of 5.5 tests

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2011-03-10 08:33:54 +0000
+++ b/mysql-test/t/sp.test	2011-03-17 11:33:17 +0000
@@ -8713,6 +8713,30 @@ call p1(3, 2);
 drop table t1;
 drop procedure p1;
 
+
+--echo # 
+--echo # BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW) 
+--echo #               FAILS IN SET_FIELD_ITERATOR
+--echo # 
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE VIEW v1 AS SELECT a FROM t2;
+CREATE PROCEDURE proc() SELECT * FROM t1 NATURAL JOIN v1;
+ALTER TABLE t2 CHANGE COLUMN a b CHAR;
+
+--echo
+--error ER_VIEW_INVALID
+CALL proc();
+--error ER_VIEW_INVALID
+CALL proc();
+
+--echo
+DROP TABLE t1,t2;
+DROP VIEW v1;
+DROP PROCEDURE proc;
+
+
 --echo
 --echo # --
 --echo # -- Bug 11765684 - 58674: SP-cache does not detect changes in

=== modified file 'mysql-test/t/subselect_innodb.test'
--- a/mysql-test/t/subselect_innodb.test	2010-12-17 09:41:21 +0000
+++ b/mysql-test/t/subselect_innodb.test	2011-02-17 13:59:06 +0000
@@ -449,3 +449,12 @@ DROP TABLE t1;
 DROP TABLE t2;
 
 --echo # End of Bug #58756
+
+--echo #
+--echo # Bug#60085 crash in Item::save_in_field() with time data type
+--echo #
+
+CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
+INSERT INTO t1 VALUES ('2011-05-13', 0);
+SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a); 
+DROP TABLE t1;

=== modified file 'mysql-test/t/type_date.test'
--- a/mysql-test/t/type_date.test	2010-11-04 13:18:27 +0000
+++ b/mysql-test/t/type_date.test	2011-02-11 09:54:16 +0000
@@ -266,6 +266,18 @@ SELECT * FROM t1 JOIN v1 ON addtime( t1.
 DROP TABLE t1;
 DROP VIEW v1;
 
+--echo #
+--echo # Bug#59685 crash in String::length with date types
+--echo #
+
+CREATE TABLE t1(a DATE, b YEAR, KEY(a));
+INSERT INTO t1 VALUES ('2011-01-01',2011);
+
+SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
+SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'mysys/default.c'
--- a/mysys/default.c	2011-03-04 15:38:00 +0000
+++ b/mysys/default.c	2011-03-17 09:47:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -378,7 +378,7 @@ static int handle_default_option(void *i
   if (!option)
     return 0;
 
-  if (find_type((char *)group_name, ctx->group, 3))
+  if (find_type((char *)group_name, ctx->group, FIND_TYPE_NO_PREFIX))
   {
     if (!(tmp= alloc_root(ctx->alloc, strlen(option) + 1)))
       return 1;

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2011-01-17 09:52:59 +0000
+++ b/mysys/my_getopt.c	2011-02-11 14:38:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -696,7 +696,7 @@ static int setval(const struct my_option
       break;
     case GET_ENUM:
       {
-        int type= find_type(argument, opts->typelib, 2);
+        int type= find_type(argument, opts->typelib, FIND_TYPE_BASIC);
         if (type == 0)
         {
           /*

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2011-03-01 13:39:58 +0000
+++ b/mysys/my_init.c	2011-03-17 11:23:31 +0000
@@ -474,7 +474,7 @@ PSI_mutex_key key_LOCK_gethostbyname_r;
 PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
   key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
   key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
-  key_THR_LOCK_isam, key_THR_LOCK_lock, key_THR_LOCK_malloc,
+  key_THR_LOCK_lock, key_THR_LOCK_malloc,
   key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
   key_THR_LOCK_open, key_THR_LOCK_threads,
   key_TMPDIR_mutex, key_THR_LOCK_myisam_mmap;
@@ -498,7 +498,6 @@ static PSI_mutex_info all_mysys_mutexes[
   { &key_my_thread_var_mutex, "my_thread_var::mutex", 0},
   { &key_THR_LOCK_charset, "THR_LOCK_charset", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_heap, "THR_LOCK_heap", PSI_FLAG_GLOBAL},
-  { &key_THR_LOCK_isam, "THR_LOCK_isam", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_lock, "THR_LOCK_lock", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_malloc, "THR_LOCK_malloc", PSI_FLAG_GLOBAL},
   { &key_THR_LOCK_mutex, "THR_LOCK::mutex", 0},

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2011-03-01 13:39:58 +0000
+++ b/mysys/my_thr_init.c	2011-03-17 11:23:31 +0000
@@ -24,7 +24,7 @@
 
 pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
 mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open,
-              THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_myisam, THR_LOCK_heap,
+              THR_LOCK_lock, THR_LOCK_myisam, THR_LOCK_heap,
               THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads,
               THR_LOCK_myisam_mmap;
 
@@ -88,9 +88,6 @@ void my_thread_global_reinit(void)
   my_init_mysys_psi_keys();
 #endif
 
-  mysql_mutex_destroy(&THR_LOCK_isam);
-  mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW);
-
   mysql_mutex_destroy(&THR_LOCK_heap);
   mysql_mutex_init(key_THR_LOCK_heap, &THR_LOCK_heap, MY_MUTEX_INIT_FAST);
 
@@ -212,7 +209,6 @@ my_bool my_thread_global_init(void)
 #endif /* TARGET_OS_LINUX */
 
   mysql_mutex_init(key_THR_LOCK_lock, &THR_LOCK_lock, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW);
   mysql_mutex_init(key_THR_LOCK_myisam, &THR_LOCK_myisam, MY_MUTEX_INIT_SLOW);
   mysql_mutex_init(key_THR_LOCK_myisam_mmap, &THR_LOCK_myisam_mmap, MY_MUTEX_INIT_FAST);
   mysql_mutex_init(key_THR_LOCK_heap, &THR_LOCK_heap, MY_MUTEX_INIT_FAST);
@@ -275,7 +271,6 @@ void my_thread_global_end(void)
   mysql_mutex_destroy(&THR_LOCK_malloc);
   mysql_mutex_destroy(&THR_LOCK_open);
   mysql_mutex_destroy(&THR_LOCK_lock);
-  mysql_mutex_destroy(&THR_LOCK_isam);
   mysql_mutex_destroy(&THR_LOCK_myisam);
   mysql_mutex_destroy(&THR_LOCK_myisam_mmap);
   mysql_mutex_destroy(&THR_LOCK_heap);

=== modified file 'mysys/mysys_priv.h'
--- a/mysys/mysys_priv.h	2011-01-13 11:31:20 +0000
+++ b/mysys/mysys_priv.h	2011-03-17 11:23:31 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ extern PSI_mutex_key key_LOCK_gethostbyn
 extern PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
   key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
   key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
-  key_THR_LOCK_isam, key_THR_LOCK_lock, key_THR_LOCK_malloc,
+  key_THR_LOCK_lock, key_THR_LOCK_malloc,
   key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
   key_THR_LOCK_open, key_THR_LOCK_threads,
   key_TMPDIR_mutex, key_THR_LOCK_myisam_mmap;
@@ -59,7 +59,7 @@ extern PSI_thread_key key_thread_alarm;
 #endif /* HAVE_PSI_INTERFACE */
 
 extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
-extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net;
+extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_net;
 extern mysql_mutex_t THR_LOCK_charset;
 
 #include <mysql/psi/mysql_file.h>

=== modified file 'mysys/typelib.c'
--- a/mysys/typelib.c	2010-03-13 21:17:47 +0000
+++ b/mysys/typelib.c	2011-02-11 14:00:09 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ int find_type_or_exit(const char *x, TYP
   int res;
   const char **ptr;
 
-  if ((res= find_type((char *) x, typelib, 2)) <= 0)
+  if ((res= find_type((char *) x, typelib, FIND_TYPE_BASIC)) <= 0)
   {
     ptr= typelib->type_names;
     if (!*x)
@@ -48,16 +48,13 @@ int find_type_or_exit(const char *x, TYP
   Search after a string in a list of strings. Endspace in x is not compared.
 
   @param x              String to find
-  @param lib            TYPELIB (struct of pointer to values + count)
-  @param full_name      bitmap of what to do
-                        If & 1 accept only whole names
-                        If & 2 don't expand if half field
-                        If & 4 allow #number# as type
-                        If & 8 use ',' as string terminator
-
-  @note
-  If part, uniq field is found and full_name == 0 then x is expanded
-  to full field.
+  @param typelib        TYPELIB (struct of pointer to values + count)
+  @param flags          flags to tune behaviour: a combination of
+                        FIND_TYPE_NO_PREFIX
+                        FIND_TYPE_ALLOW_NUMBER
+                        FIND_TYPE_COMMA_TERM.
+                        FIND_TYPE_NO_OVERWRITE can be passed but is
+                        superfluous (is always implicitely on).
 
   @retval
     -1  Too many matching values
@@ -68,15 +65,17 @@ int find_type_or_exit(const char *x, TYP
 */
 
 
-int find_type(char *x, const TYPELIB *typelib, uint full_name)
+int find_type(const char *x, const TYPELIB *typelib, uint flags)
 {
   int find,pos;
   int UNINIT_VAR(findpos);                       /* guarded by find */
-  reg1 char * i;
-  reg2 const char *j;
+  const char *i;
+  const char *j;
   DBUG_ENTER("find_type");
   DBUG_PRINT("enter",("x: '%s'  lib: 0x%lx", x, (long) typelib));
 
+  DBUG_ASSERT(!(flags & ~(FIND_TYPE_NO_PREFIX | FIND_TYPE_ALLOW_NUMBER |
+                          FIND_TYPE_NO_OVERWRITE | FIND_TYPE_COMMA_TERM)));
   if (!typelib->count)
   {
     DBUG_PRINT("exit",("no count"));
@@ -86,24 +85,26 @@ int find_type(char *x, const TYPELIB *ty
   for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
   {
     for (i=x ; 
-    	*i && (!(full_name & 8) || !is_field_separator(*i)) &&
+    	*i && (!(flags & FIND_TYPE_COMMA_TERM) || !is_field_separator(*i)) &&
         my_toupper(&my_charset_latin1,*i) == 
     		my_toupper(&my_charset_latin1,*j) ; i++, j++) ;
     if (! *j)
     {
       while (*i == ' ')
 	i++;					/* skip_end_space */
-      if (! *i || ((full_name & 8) && is_field_separator(*i)))
+      if (! *i || ((flags & FIND_TYPE_COMMA_TERM) && is_field_separator(*i)))
 	DBUG_RETURN(pos+1);
     }
-    if ((!*i && (!(full_name & 8) || !is_field_separator(*i))) && 
-        (!*j || !(full_name & 1)))
+    if ((!*i &&
+         (!(flags & FIND_TYPE_COMMA_TERM) || !is_field_separator(*i))) &&
+        (!*j || !(flags & FIND_TYPE_NO_PREFIX)))
     {
       find++;
       findpos=pos;
     }
   }
-  if (find == 0 && (full_name & 4) && x[0] == '#' && strend(x)[-1] == '#' &&
+  if (find == 0 && (flags & FIND_TYPE_ALLOW_NUMBER) && x[0] == '#' &&
+      strend(x)[-1] == '#' &&
       (findpos=atoi(x+1)-1) >= 0 && (uint) findpos < typelib->count)
     find=1;
   else if (find == 0 || ! x[0])
@@ -111,13 +112,11 @@ int find_type(char *x, const TYPELIB *ty
     DBUG_PRINT("exit",("Couldn't find type"));
     DBUG_RETURN(0);
   }
-  else if (find != 1 || (full_name & 1))
+  else if (find != 1 || (flags & FIND_TYPE_NO_PREFIX))
   {
     DBUG_PRINT("exit",("Too many possybilities"));
     DBUG_RETURN(-1);
   }
-  if (!(full_name & 2))
-    (void) strmov(x,typelib->type_names[findpos]);
   DBUG_RETURN(findpos+1);
 } /* find_type */
 
@@ -192,7 +191,7 @@ my_ulonglong find_typeset(char *x, TYPEL
       x++;
     if (x[0] && x[1])      /* skip separator if found */
       x++;
-    if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
+    if ((find= find_type(i, lib, FIND_TYPE_COMMA_TERM) - 1) < 0)
       DBUG_RETURN(0);
     result|= (ULL(1) << find);
   }
@@ -276,7 +275,7 @@ static TYPELIB on_off_default_typelib= {
 static uint parse_name(const TYPELIB *lib, const char **strpos, const char *end)
 {
   const char *pos= *strpos;
-  uint find= find_type((char*)pos, lib, 8);
+  uint find= find_type(pos, lib, FIND_TYPE_COMMA_TERM);
   for (; pos != end && *pos != '=' && *pos !=',' ; pos++);
   *strpos= pos;
   return find;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-03-19 01:36:46 +0000
+++ b/scripts/mysql_system_tables.sql	2011-03-21 02:16:39 +0000
@@ -28,7 +28,7 @@ set @had_db_table= @@warning_count != 0;
 CREATE TABLE IF NOT EXISTS host (  Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges;  Merged with database privileges';
 
 
-CREATE TABLE IF NOT EXISTS user (   Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0  NOT NULL, max_updates int(11) unsigned DEFAULT 0  NOT NULL, max_connections int(11) unsigned DEFAULT 0  NOT NULL, max_user_connections int(11) unsigned DEFAULT 0  NOT NULL, plugin char(64) DEFAULT '' NOT NULL, authentication_string TEXT NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS user (   Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0  NOT NULL, max_updates int(11) unsigned DEFAULT 0  NOT NULL, max_connections int(11) unsigned DEFAULT 0  NOT NULL, max_user_connections int(11) unsigned DEFAULT 0  NOT NULL, plugin char(64) DEFAULT '', authentication_string TEXT, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
 
 -- Remember for later if user table already existed
 set @had_user_table= @@warning_count != 0;

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2011-03-14 18:43:19 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2011-03-18 14:58:27 +0000
@@ -642,8 +642,8 @@ DROP PREPARE stmt;
 
 drop procedure mysql.die;
 
-ALTER TABLE user ADD plugin char(64) DEFAULT '' NOT NULL,  ADD authentication_string TEXT NOT NULL;
-ALTER TABLE user MODIFY plugin char(64) DEFAULT '' NOT NULL;
+ALTER TABLE user ADD plugin char(64) DEFAULT '',  ADD authentication_string TEXT;
+ALTER TABLE user MODIFY plugin char(64) DEFAULT '';
 
 -- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
 -- older versions

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2011-03-09 21:28:05 +0000
+++ b/sql-common/client.c	2011-03-21 02:16:39 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1146,11 +1146,11 @@ enum option_id {
   OPT_ssl_key, OPT_ssl_cert, OPT_ssl_ca, OPT_ssl_capath, 
   OPT_character_sets_dir, OPT_default_character_set, OPT_interactive_timeout, 
   OPT_connect_timeout, OPT_local_infile, OPT_disable_local_infile, 
-  OPT_replication_probe, OPT_enable_reads_from_master, OPT_repl_parse_query,
   OPT_ssl_cipher, OPT_max_allowed_packet, OPT_protocol, OPT_shared_memory_base_name, 
   OPT_multi_results, OPT_multi_statements, OPT_multi_queries, OPT_secure_auth, 
   OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth,
-  OPT_bind_address
+  OPT_bind_address,
+  OPT_keep_this_one_last
 };
 
 static TYPELIB option_types={array_elements(default_options)-1,
@@ -1200,6 +1200,9 @@ void mysql_read_default_options(struct s
   DBUG_ENTER("mysql_read_default_options");
   DBUG_PRINT("enter",("file: %s  group: %s",filename,group ? group :"NULL"));
 
+  compile_time_assert(OPT_keep_this_one_last ==
+                      array_elements(default_options));
+
   argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
   groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
 
@@ -1224,7 +1227,7 @@ void mysql_read_default_options(struct s
 	/* Change all '_' in variable name to '-' */
 	for (end= *option ; *(end= strcend(end,'_')) ; )
 	  *end= '-';
-	switch (find_type(*option+2,&option_types,2)) {
+	switch (find_type(*option + 2, &option_types, FIND_TYPE_BASIC)) {
 	case OPT_port:
 	  if (opt_arg)
 	    options->port=atoi(opt_arg);
@@ -1340,8 +1343,8 @@ void mysql_read_default_options(struct s
 	    options->max_allowed_packet= atoi(opt_arg);
 	  break;
         case OPT_protocol:
-          if ((options->protocol= find_type(opt_arg,
-					    &sql_protocol_typelib,0)) <= 0)
+          if ((options->protocol= find_type(opt_arg, &sql_protocol_typelib,
+                                            FIND_TYPE_BASIC)) <= 0)
           {
             fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
             exit(1);

=== modified file 'sql-common/client_plugin.c'
--- a/sql-common/client_plugin.c	2011-01-11 09:09:21 +0000
+++ b/sql-common/client_plugin.c	2011-03-17 14:06:30 +0000
@@ -163,6 +163,7 @@ add_plugin(MYSQL *mysql, struct st_mysql
 
   p->next= plugin_list[plugin->type];
   plugin_list[plugin->type]= p;
+  net_clear_error(&mysql->net);
 
   return plugin;
 

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-03-09 17:55:32 +0000
+++ b/sql/ha_partition.cc	2011-03-18 10:31:17 +0000
@@ -3523,7 +3523,7 @@ int ha_partition::delete_row(const uchar
     Called from item_sum.cc by Item_func_group_concat::clear(),
     Item_sum_count_distinct::clear(), and Item_func_group_concat::clear().
     Called from sql_delete.cc by mysql_delete().
-    Called from sql_select.cc by JOIN::reinit().
+    Called from sql_select.cc by JOIN::reset().
     Called from sql_union.cc by st_select_lex_unit::exec().
 */
 
@@ -4610,7 +4610,8 @@ int ha_partition::index_read_idx_map(uch
           break;
       }
     }
-    m_last_part= part;
+    if (part <= m_part_spec.end_part)
+      m_last_part= part;
   }
   else
   {
@@ -6605,7 +6606,14 @@ void ha_partition::print_error(int error
   {
     /* In case m_file has not been initialized, like in bug#42438 */
     if (m_file)
+    {
+      if (m_last_part >= m_tot_parts)
+      {
+        DBUG_ASSERT(0);
+        m_last_part= 0;
+      }
       m_file[m_last_part]->print_error(error, errflag);
+    }
     else
       handler::print_error(error, errflag);
   }

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-03-15 13:03:22 +0000
+++ b/sql/item.cc	2011-03-17 09:47:50 +0000
@@ -1071,7 +1071,9 @@ int Item::save_in_field_no_warnings(Fiel
   sql_mode_t sql_mode= thd->variables.sql_mode;
   thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
   thd->count_cuted_fields= CHECK_FIELD_IGNORE;
+
   res= save_in_field(field, no_conversions);
+
   thd->count_cuted_fields= tmp;
   dbug_tmp_restore_column_map(table->write_set, old_map);
   thd->variables.sql_mode= sql_mode;
@@ -7631,16 +7633,43 @@ longlong Item_cache_int::val_int()
 bool  Item_cache_datetime::cache_value_int()
 {
   if (!example)
-    return FALSE;
+    return false;
 
-  value_cached= TRUE;
+  value_cached= true;
   // Mark cached string value obsolete
-  str_value_cached= FALSE;
-  /* Assume here that the underlying item will do correct conversion.*/
-  int_value= example->val_int_result();
+  str_value_cached= false;
+
+  MYSQL_TIME ltime;
+  const bool eval_error= 
+    (field_type() == MYSQL_TYPE_TIME) ?
+    example->get_time(&ltime) :
+    example->get_date(&ltime, TIME_FUZZY_DATE);
+
+  if (eval_error)
+    int_value= 0;
+  else
+  {
+    switch(field_type())
+    {
+    case MYSQL_TYPE_DATETIME:
+    case MYSQL_TYPE_TIMESTAMP:
+      int_value= TIME_to_ulonglong_datetime(&ltime);
+      break;
+    case MYSQL_TYPE_TIME:
+      int_value= TIME_to_ulonglong_time(&ltime);
+      break;
+    default:
+      int_value= TIME_to_ulonglong_date(&ltime);
+      break;
+    }
+    if (ltime.neg)
+      int_value= -int_value;
+  }
+
   null_value= example->null_value;
   unsigned_flag= example->unsigned_flag;
-  return TRUE;
+
+  return true;
 }
 
 

=== modified file 'sql/item.h'
--- a/sql/item.h	2011-03-11 09:35:38 +0000
+++ b/sql/item.h	2011-03-17 09:47:50 +0000
@@ -3563,7 +3563,7 @@ class Item_cache_datetime: public Item_c
 {
 protected:
   String str_value;
-  ulonglong int_value;
+  longlong int_value;
   bool str_value_cached;
 public:
   Item_cache_datetime(enum_field_types field_type_arg):

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2011-03-11 09:35:38 +0000
+++ b/sql/item_func.h	2011-03-17 11:48:04 +0000
@@ -130,7 +130,8 @@ public:
   virtual bool have_rev_func() const { return 0; }
   virtual Item *key_item() const { return args[0]; }
   virtual bool const_item() const { return const_item_cache; }
-  inline Item **arguments() const { return args; }
+  inline Item **arguments() const
+  { DBUG_ASSERT(argument_count() > 0); return args; }
   void set_arguments(List<Item> &list);
   inline uint argument_count() const { return arg_count; }
   inline void remove_arguments() { arg_count=0; }

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-03-08 19:14:42 +0000
+++ b/sql/item_subselect.cc	2011-03-17 09:47:50 +0000
@@ -38,6 +38,7 @@
 #include "set_var.h"
 #include "sql_select.h"
 #include "sql_parse.h"                          // check_stack_overrun
+#include "debug_sync.h"
 
 inline Item * and_items(Item* cond, Item *item)
 {
@@ -120,7 +121,10 @@ void Item_subselect::cleanup()
   if (old_engine)
   {
     if (engine)
+    {
       engine->cleanup();
+      delete engine;
+    }
     engine= old_engine;
     old_engine= 0;
   }
@@ -279,30 +283,31 @@ bool Item_subselect::walk(Item_processor
 
 bool Item_subselect::exec()
 {
-  int res;
+  DBUG_ENTER("Item_subselect::exec");
 
   /*
     Do not execute subselect in case of a fatal error
     or if the query has been killed.
   */
   if (thd->is_error() || thd->killed)
-    return 1;
+    DBUG_RETURN(true);
 
   DBUG_ASSERT(!thd->lex->context_analysis_only);
   /*
     Simulate a failure in sub-query execution. Used to test e.g.
     out of memory or query being killed conditions.
   */
-  DBUG_EXECUTE_IF("subselect_exec_fail", return 1;);
+  DBUG_EXECUTE_IF("subselect_exec_fail", DBUG_RETURN(true););
 
-  res= engine->exec();
+  bool res= engine->exec();
 
   if (engine_changed)
   {
     engine_changed= 0;
-    return exec();
+    res= exec();
+    DBUG_RETURN(res);
   }
-  return (res);
+  DBUG_RETURN(res);
 }
 
 
@@ -1886,18 +1891,13 @@ void Item_in_subselect::fix_after_pullou
 
 
 /**
-  Try to create an engine to compute the subselect via materialization,
-  and if this fails, revert to execution via the IN=>EXISTS transformation.
+  Create an engine to compute the subquery via materialization.
 
   @details
     The purpose of this method is to hide the implementation details
     of this Item's execution. The method creates a new engine for
     materialized execution, and initializes the engine.
 
-    The initialization of the new engine is divided in two parts - a permanent
-    one that lives across prepared statements, and one that is repeated for each
-    execution.
-
   @returns
     @retval TRUE  memory allocation error occurred, or was not able to create
                   temporary table
@@ -1906,43 +1906,29 @@ void Item_in_subselect::fix_after_pullou
 
 bool Item_in_subselect::setup_engine()
 {
-  subselect_hash_sj_engine *hash_engine;
   DBUG_ENTER("Item_in_subselect::setup_engine");
 
-  if (engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE)
-  {
-    /* Create/initialize objects in permanent memory. */
-    Query_arena *arena= thd->stmt_arena;
-    Query_arena backup;
-    if (arena->is_conventional())
-      arena= 0;
-    else
-      thd->set_n_backup_active_arena(arena, &backup);
+  /* The decision whether to materialize is already taken. */
+  DBUG_ASSERT(exec_method == Item_exists_subselect::EXEC_MATERIALIZATION);
 
-    subselect_single_select_engine *old_engine= 
-      static_cast<subselect_single_select_engine*>(engine);
-    if (!(hash_engine= new subselect_hash_sj_engine(thd, this,
-                                                    old_engine)) ||
-        hash_engine->init_permanent(unit->get_unit_column_types()))
-    {
-      /*
-        For some reason we cannot use materialization for this IN predicate.
-        Delete all materialization-related objects, and return error.
-      */
-      delete hash_engine;
-      if (arena)
-        thd->restore_active_arena(arena, &backup);
-      DBUG_RETURN(TRUE);
-    }
-    engine= hash_engine;
+  DBUG_ASSERT(engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE);
 
-    if (arena)
-      thd->restore_active_arena(arena, &backup);
-  }
-  else
+  old_engine= engine;
+
+  if (!(engine= new subselect_hash_sj_engine(thd, this,
+                  static_cast<subselect_single_select_engine*>(old_engine))))
+    DBUG_RETURN(true);
+  if (((subselect_hash_sj_engine *) engine)
+        ->setup(unit->get_unit_column_types()))
   {
-    DBUG_ASSERT(engine->engine_type() == subselect_engine::HASH_SJ_ENGINE);
-    hash_engine= static_cast<subselect_hash_sj_engine*>(engine);
+    /*
+      For some reason we cannot use materialization for this IN predicate.
+      Delete all materialization-related objects, and return error.
+    */
+    delete engine;
+    engine= old_engine;
+    old_engine= NULL;
+    DBUG_RETURN(true);
   }
 
   /*
@@ -1955,10 +1941,7 @@ bool Item_in_subselect::setup_engine()
   */
   unit->global_parameters->select_limit= NULL;
 
-  /* Initializations done in runtime memory, repeated for each execution. */
-  const bool res= hash_engine->init_runtime();
-
-  DBUG_RETURN(res);
+  DBUG_RETURN(false);
 }
 
 
@@ -2096,7 +2079,6 @@ void subselect_single_select_engine::cle
 void subselect_union_engine::cleanup()
 {
   DBUG_ENTER("subselect_union_engine::cleanup");
-  unit->reinit_exec_mechanism();
   result->cleanup();
   DBUG_VOID_RETURN;
 }
@@ -2123,23 +2105,13 @@ bool subselect_union_engine::is_executed
     FALSE - Otherwise
 */
 
-bool subselect_union_engine::no_rows()
+bool subselect_union_engine::no_rows() const
 {
   /* Check if we got any rows when reading UNION result from temp. table: */
   return test(!unit->fake_select_lex->join->send_records);
 }
 
 
-void subselect_uniquesubquery_engine::cleanup()
-{
-  DBUG_ENTER("subselect_uniquesubquery_engine::cleanup");
-  /* Tell handler we don't need the index anymore */
-  if (tab->table->file->inited)
-    tab->table->file->ha_index_end();
-  DBUG_VOID_RETURN;
-}
-
-
 subselect_union_engine::subselect_union_engine(st_select_lex_unit *u,
 					       select_result_interceptor *result_arg,
 					       Item_subselect *item_arg)
@@ -2176,7 +2148,7 @@ subselect_union_engine::subselect_union_
   @retval 1  if error
 */
 
-int subselect_single_select_engine::prepare()
+bool subselect_single_select_engine::prepare()
 {
   if (prepared)
     return 0;
@@ -2203,12 +2175,14 @@ int subselect_single_select_engine::prep
   return 0;
 }
 
-int subselect_union_engine::prepare()
+
+bool subselect_union_engine::prepare()
 {
   return unit->prepare(thd, result, SELECT_NO_UNLOCK);
 }
 
-int subselect_uniquesubquery_engine::prepare()
+
+bool subselect_uniquesubquery_engine::prepare()
 {
   /* Should never be called. */
   DBUG_ASSERT(FALSE);
@@ -2231,7 +2205,7 @@ int subselect_uniquesubquery_engine::pre
     FALSE - Otherwise
 */
 
-bool subselect_single_select_engine::no_rows()
+bool subselect_single_select_engine::no_rows() const
 { 
   return !item->assigned();
 }
@@ -2301,7 +2275,7 @@ int rr_sequential(READ_RECORD *info);
 int join_read_always_key_or_null(JOIN_TAB *tab);
 int join_read_next_same_or_null(READ_RECORD *info);
 
-int subselect_single_select_engine::exec()
+bool subselect_single_select_engine::exec()
 {
   DBUG_ENTER("subselect_single_select_engine::exec");
   int rc= 0;
@@ -2334,11 +2308,7 @@ int subselect_single_select_engine::exec
       select_lex->uncacheable != UNCACHEABLE_EXPLAIN
       && executed)
   {
-    if (join->reinit())
-    {
-      rc= 1;
-      goto exit;
-    }
+    join->reset();
     item->reset();
     item->assigned((executed= 0));
   }
@@ -2404,10 +2374,10 @@ exit:
   DBUG_RETURN(rc);
 }
 
-int subselect_union_engine::exec()
+bool subselect_union_engine::exec()
 {
   char const *save_where= thd->where;
-  int res= unit->exec();
+  const bool res= unit->exec();
   thd->where= save_where;
   return res;
 }
@@ -2431,7 +2401,7 @@ int subselect_union_engine::exec()
     TRUE  - Error
 */
 
-int subselect_uniquesubquery_engine::scan_table()
+bool subselect_uniquesubquery_engine::scan_table()
 {
   int error;
   TABLE *table= tab->table;
@@ -2596,7 +2566,7 @@ bool subselect_uniquesubquery_engine::co
     TRUE  - an error occured while scanning
 */
 
-int subselect_uniquesubquery_engine::exec()
+bool subselect_uniquesubquery_engine::exec()
 {
   DBUG_ENTER("subselect_uniquesubquery_engine::exec");
   int error;
@@ -2699,7 +2669,7 @@ int subselect_uniquesubquery_engine::exe
     1
 */
 
-int subselect_indexsubquery_engine::exec()
+bool subselect_indexsubquery_engine::exec()
 {
   DBUG_ENTER("subselect_indexsubquery_engine::exec");
   int error;
@@ -2786,26 +2756,26 @@ int subselect_indexsubquery_engine::exec
 }
 
 
-uint subselect_single_select_engine::cols()
+uint subselect_single_select_engine::cols() const
 {
   return select_lex->item_list.elements;
 }
 
 
-uint subselect_union_engine::cols()
+uint subselect_union_engine::cols() const
 {
   DBUG_ASSERT(unit->is_prepared());  // should be called after fix_fields()
   return unit->types.elements;
 }
 
 
-uint8 subselect_single_select_engine::uncacheable()
+uint8 subselect_single_select_engine::uncacheable() const
 {
   return select_lex->uncacheable;
 }
 
 
-uint8 subselect_union_engine::uncacheable()
+uint8 subselect_union_engine::uncacheable() const
 {
   return unit->uncacheable;
 }
@@ -2892,13 +2862,13 @@ subselect_single_select_engine::save_joi
   return FALSE;
 }
 
-table_map subselect_single_select_engine::upper_select_const_tables()
+table_map subselect_single_select_engine::upper_select_const_tables() const
 {
   return calc_const_tables(select_lex->outer_select()->leaf_tables);
 }
 
 
-table_map subselect_union_engine::upper_select_const_tables()
+table_map subselect_union_engine::upper_select_const_tables() const
 {
   return calc_const_tables(unit->outer_select()->leaf_tables);
 }
@@ -3066,7 +3036,7 @@ bool subselect_uniquesubquery_engine::ch
   @retval
     FALSE there are some tables in subquery
 */
-bool subselect_single_select_engine::no_tables()
+bool subselect_single_select_engine::no_tables() const
 {
   return(select_lex->table_list.elements == 0);
 }
@@ -3082,7 +3052,7 @@ bool subselect_single_select_engine::no_
     FALSE  can guarantee that the subquery never return NULL
     TRUE   otherwise
 */
-bool subselect_single_select_engine::may_be_null()
+bool subselect_single_select_engine::may_be_null() const
 {
   return ((no_tables() && !join->conds && !join->having) ? maybe_null : 1);
 }
@@ -3096,7 +3066,7 @@ bool subselect_single_select_engine::may
   @retval
     FALSE there are some tables in subquery
 */
-bool subselect_union_engine::no_tables()
+bool subselect_union_engine::no_tables() const
 {
   for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select())
   {
@@ -3116,7 +3086,7 @@ bool subselect_union_engine::no_tables()
     FALSE there are some tables in subquery
 */
 
-bool subselect_uniquesubquery_engine::no_tables()
+bool subselect_uniquesubquery_engine::no_tables() const
 {
   /* returning value is correct, but this method should never be called */
   return 0;
@@ -3129,8 +3099,7 @@ bool subselect_uniquesubquery_engine::no
 
 
 /**
-  Create all structures needed for IN execution that can live between PS
-  reexecution.
+  Create all structures needed for subquery execution using hash semijoin.
 
   @detail
   - Create a temporary table to store the result of the IN subquery. The
@@ -3148,7 +3117,7 @@ bool subselect_uniquesubquery_engine::no
   @retval FALSE otherwise
 */
 
-bool subselect_hash_sj_engine::init_permanent(List<Item> *tmp_columns)
+bool subselect_hash_sj_engine::setup(List<Item> *tmp_columns)
 {
   /* The result sink where we will materialize the subquery result. */
   select_union  *tmp_result_sink;
@@ -3158,7 +3127,7 @@ bool subselect_hash_sj_engine::init_perm
   uint          tmp_key_parts; /* Number of keyparts in tmp_key. */
   Item_in_subselect *item_in= (Item_in_subselect *) item;
 
-  DBUG_ENTER("subselect_hash_sj_engine::init_permanent");
+  DBUG_ENTER("subselect_hash_sj_engine::setup");
 
   /* 1. Create/initialize materialization related objects. */
 
@@ -3204,8 +3173,8 @@ bool subselect_hash_sj_engine::init_perm
     Make sure there is only one index on the temp table, and it doesn't have
     the extra key part created when s->uniques > 0.
   */
-  DBUG_ASSERT(tmp_table->s->keys == 1 && tmp_columns->elements == tmp_key_parts);
-
+  DBUG_ASSERT(tmp_table->s->keys == 1 &&
+              tmp_columns->elements == tmp_key_parts);
 
   /* 2. Create/initialize execution related objects. */
 
@@ -3300,43 +3269,24 @@ bool subselect_hash_sj_engine::init_perm
   if (cond->fix_fields(thd, &cond))
     DBUG_RETURN(TRUE);
 
-  DBUG_RETURN(FALSE);
-}
-
-
-/**
-  Initialize members of the engine that need to be re-initilized at each
-  execution.
-
-  @retval TRUE  if a memory allocation error occurred
-  @retval FALSE if success
-*/
-
-bool subselect_hash_sj_engine::init_runtime()
-{
   /*
     Create and optimize the JOIN that will be used to materialize
     the subquery if not yet created.
   */
   materialize_engine->prepare();
-  /*
-    Repeat name resolution for 'cond' since cond is not part of any
-    clause of the query, and it is not 'fixed' during JOIN::prepare.
-  */
-  if (cond && !cond->fixed && cond->fix_fields(thd, &cond))
-    return TRUE;
   /* Let our engine reuse this query plan for materialization. */
-  materialize_join= materialize_engine->join;
-  materialize_join->change_result(result);
-  return FALSE;
+  materialize_engine->join->change_result(result);
+
+  DBUG_RETURN(FALSE);
 }
 
 
 subselect_hash_sj_engine::~subselect_hash_sj_engine()
 {
+  /* Assure that cleanup has been called for this engine. */
+  DBUG_ASSERT(!tab);
+
   delete result;
-  if (tab)
-    free_tmp_table(thd, tab->table);
 }
 
 
@@ -3349,10 +3299,16 @@ subselect_hash_sj_engine::~subselect_has
 
 void subselect_hash_sj_engine::cleanup()
 {
-  is_materialized= FALSE;
+  DBUG_ENTER("subselect_hash_sj_engine::cleanup");
+  is_materialized= false;
   result->cleanup(); /* Resets the temp table as well. */
+  DEBUG_SYNC(thd, "before_index_end_in_subselect");
+  if (tab->table->file->inited)
+    tab->table->file->ha_index_end();  // Close the scan over the index
+  free_tmp_table(thd, tab->table);
+  tab= NULL;
   materialize_engine->cleanup();
-  subselect_uniquesubquery_engine::cleanup();
+  DBUG_VOID_RETURN;
 }
 
 
@@ -3367,7 +3323,7 @@ void subselect_hash_sj_engine::cleanup()
   @retval FALSE otherwise
 */
 
-int subselect_hash_sj_engine::exec()
+bool subselect_hash_sj_engine::exec()
 {
   Item_in_subselect *item_in= (Item_in_subselect *) item;
 
@@ -3379,17 +3335,17 @@ int subselect_hash_sj_engine::exec()
   */
   if (!is_materialized)
   {
-    int res= 0;
+    bool res= false;
     SELECT_LEX *save_select= thd->lex->current_select;
     thd->lex->current_select= materialize_engine->select_lex;
-    if ((res= materialize_join->optimize()))
+    if ((res= materialize_engine->join->optimize()))
       goto err; /* purecov: inspected */
 
     if (materialize_engine->save_join_if_explain())
       goto err;
 
-    materialize_join->exec();
-    if ((res= test(materialize_join->error || thd->is_fatal_error)))
+    materialize_engine->join->exec();
+    if ((res= test(materialize_engine->join->error || thd->is_fatal_error)))
       goto err;
 
     /*

=== modified file 'sql/item_subselect.h'
--- a/sql/item_subselect.h	2011-03-08 19:14:42 +0000
+++ b/sql/item_subselect.h	2011-03-17 07:40:26 +0000
@@ -44,7 +44,8 @@ typedef Comp_creator* (*chooser_compare_
 
 class Item_subselect :public Item_result_field
 {
-  my_bool value_assigned; /* value already assigned to subselect */
+private:
+  bool value_assigned; /* value already assigned to subselect */
 public:
   /* thread handler, will be assigned in fix_fields only */
   THD *thd;
@@ -109,13 +110,13 @@ public:
 		     select_result_interceptor *result);
 
   ~Item_subselect();
-  void cleanup();
+  virtual void cleanup();
   virtual void reset()
   {
     null_value= 1;
   }
   virtual trans_res select_transformer(JOIN *join);
-  bool assigned() { return value_assigned; }
+  bool assigned() const { return value_assigned; }
   void assigned(bool a) { value_assigned= a; }
   enum Type type() const;
   bool is_null()
@@ -190,10 +191,10 @@ public:
   Item_singlerow_subselect(st_select_lex *select_lex);
   Item_singlerow_subselect() :Item_subselect(), value(0), row (0) {}
 
-  void cleanup();
+  virtual void cleanup();
   subs_type substype() { return SINGLEROW_SUBS; }
 
-  void reset();
+  virtual void reset();
   trans_res select_transformer(JOIN *join);
   void store(uint i, Item* item);
   double val_real();
@@ -240,7 +241,7 @@ public:
   Item_maxmin_subselect(THD *thd, Item_subselect *parent,
 			st_select_lex *select_lex, bool max);
   virtual void print(String *str, enum_query_type query_type);
-  void cleanup();
+  virtual void cleanup();
   bool any_value() { return was_values; }
   void register_value() { was_values= TRUE; }
   void reset_value_registration() { was_values= FALSE; }
@@ -292,7 +293,7 @@ public:
     return RES_OK;
   }
   subs_type substype() { return EXISTS_SUBS; }
-  void reset() 
+  virtual void reset() 
   {
     value= 0;
   }
@@ -380,9 +381,9 @@ public:
     optimizer(NULL), was_null(FALSE), abort_on_null(FALSE),
     pushed_cond_guards(NULL), upper_item(NULL)
   {}
-  void cleanup();
+  virtual void cleanup();
   subs_type substype() { return IN_SUBS; }
-  void reset() 
+  virtual void reset() 
   {
     value= 0;
     null_value= 0;
@@ -455,15 +456,13 @@ public:
                          INDEXSUBQUERY_ENGINE, HASH_SJ_ENGINE};
 
   subselect_engine(Item_subselect *si, select_result_interceptor *res)
-    :thd(0)
-  {
-    result= res;
-    item= si;
-    res_type= STRING_RESULT;
-    res_field_type= MYSQL_TYPE_VAR_STRING;
-    maybe_null= 0;
-  }
+    :result(res), thd(NULL), item(si), res_type(STRING_RESULT),
+    res_field_type(MYSQL_TYPE_VAR_STRING), maybe_null(false)
+  {}
   virtual ~subselect_engine() {}; // to satisfy compiler
+  /**
+    Cleanup engine after complete query execution, free all resources.
+  */
   virtual void cleanup()= 0;
 
   /*
@@ -471,8 +470,8 @@ public:
     Should be called before prepare().
   */
   void set_thd(THD *thd_arg);
-  THD * get_thd() { return thd; }
-  virtual int prepare()= 0;
+  THD * get_thd() const { return thd; }
+  virtual bool prepare()= 0;
   virtual void fix_length_and_dec(Item_cache** row)= 0;
   /*
     Execute the engine
@@ -494,23 +493,23 @@ public:
       1 - Either an execution error, or the engine was "changed", and the
           caller should call exec() again for the new engine.
   */
-  virtual int exec()= 0;
-  virtual uint cols()= 0; /* return number of columns in select */
-  virtual uint8 uncacheable()= 0; /* query is uncacheable */
-  enum Item_result type() { return res_type; }
-  enum_field_types field_type() { return res_field_type; }
+  virtual bool exec()= 0;
+  virtual uint cols() const = 0; /* return number of columns in select */
+  virtual uint8 uncacheable() const = 0; /* query is uncacheable */
+  virtual enum Item_result type() const { return res_type; }
+  virtual enum_field_types field_type() const { return res_field_type; }
   virtual void exclude()= 0;
-  virtual bool may_be_null() { return maybe_null; };
-  virtual table_map upper_select_const_tables()= 0;
+  virtual bool may_be_null() const { return maybe_null; };
+  virtual table_map upper_select_const_tables() const = 0;
   static table_map calc_const_tables(TABLE_LIST *);
   virtual void print(String *str, enum_query_type query_type)= 0;
   virtual bool change_result(Item_subselect *si,
                              select_result_interceptor *result)= 0;
-  virtual bool no_tables()= 0;
+  virtual bool no_tables() const = 0;
   virtual bool is_executed() const { return FALSE; }
   /* Check if subquery produced any rows during last query execution */
-  virtual bool no_rows() = 0;
-  virtual enum_engine_type engine_type() { return ABSTRACT_ENGINE; }
+  virtual bool no_rows() const = 0;
+  virtual enum_engine_type engine_type() const { return ABSTRACT_ENGINE; }
 
 protected:
   void set_row(List<Item> &item_list, Item_cache **row);
@@ -519,30 +518,31 @@ protected:
 
 class subselect_single_select_engine: public subselect_engine
 {
-  my_bool prepared; /* simple subselect is prepared */
-  my_bool optimized; /* simple subselect is optimized */
-  my_bool executed; /* simple subselect is executed */
+private:
+  bool prepared; /* simple subselect is prepared */
+  bool executed; /* simple subselect is executed */
   st_select_lex *select_lex; /* corresponding select_lex */
   JOIN * join; /* corresponding JOIN structure */
 public:
   subselect_single_select_engine(st_select_lex *select,
 				 select_result_interceptor *result,
 				 Item_subselect *item);
-  void cleanup();
-  int prepare();
-  void fix_length_and_dec(Item_cache** row);
-  int exec();
-  uint cols();
-  uint8 uncacheable();
-  void exclude();
-  table_map upper_select_const_tables();
+  virtual void cleanup();
+  virtual bool prepare();
+  virtual void fix_length_and_dec(Item_cache** row);
+  virtual bool exec();
+  virtual uint cols() const;
+  virtual uint8 uncacheable() const;
+  virtual void exclude();
+  virtual table_map upper_select_const_tables() const;
   virtual void print (String *str, enum_query_type query_type);
-  bool change_result(Item_subselect *si, select_result_interceptor *result);
-  bool no_tables();
-  bool may_be_null();
-  bool is_executed() const { return executed; }
-  bool no_rows();
-  virtual enum_engine_type engine_type() { return SINGLE_SELECT_ENGINE; }
+  virtual bool change_result(Item_subselect *si,
+                             select_result_interceptor *result);
+  virtual bool no_tables() const;
+  virtual bool may_be_null() const;
+  virtual bool is_executed() const { return executed; }
+  virtual bool no_rows() const;
+  virtual enum_engine_type engine_type() const { return SINGLE_SELECT_ENGINE; }
   bool save_join_if_explain(); 
 
   friend class subselect_hash_sj_engine;
@@ -552,25 +552,28 @@ public:
 
 class subselect_union_engine: public subselect_engine
 {
-  st_select_lex_unit *unit;  /* corresponding unit structure */
 public:
   subselect_union_engine(st_select_lex_unit *u,
 			 select_result_interceptor *result,
 			 Item_subselect *item);
-  void cleanup();
-  int prepare();
-  void fix_length_and_dec(Item_cache** row);
-  int exec();
-  uint cols();
-  uint8 uncacheable();
-  void exclude();
-  table_map upper_select_const_tables();
+  virtual void cleanup();
+  virtual bool prepare();
+  virtual void fix_length_and_dec(Item_cache** row);
+  virtual bool exec();
+  virtual uint cols() const;
+  virtual uint8 uncacheable() const;
+  virtual void exclude();
+  virtual table_map upper_select_const_tables() const;
   virtual void print (String *str, enum_query_type query_type);
-  bool change_result(Item_subselect *si, select_result_interceptor *result);
-  bool no_tables();
-  bool is_executed() const;
-  bool no_rows();
-  virtual enum_engine_type engine_type() { return UNION_ENGINE; }
+  virtual bool change_result(Item_subselect *si,
+                             select_result_interceptor *result);
+  virtual bool no_tables() const;
+  virtual bool is_executed() const;
+  virtual bool no_rows() const;
+  virtual enum_engine_type engine_type() const { return UNION_ENGINE; }
+
+private:
+  st_select_lex_unit *unit;  /* corresponding unit structure */
 };
 
 
@@ -614,26 +617,28 @@ public:
   {
     set_thd(thd_arg);
   }
-  void cleanup();
-  int prepare();
-  void fix_length_and_dec(Item_cache** row);
-  int exec();
-  uint cols() { return 1; }
-  uint8 uncacheable() { return UNCACHEABLE_DEPENDENT; }
-  void exclude();
-  table_map upper_select_const_tables() { return 0; }
+  virtual void cleanup() {}
+  virtual bool prepare();
+  virtual void fix_length_and_dec(Item_cache** row);
+  virtual bool exec();
+  virtual uint cols() const { return 1; }
+  virtual uint8 uncacheable() const { return UNCACHEABLE_DEPENDENT; }
+  virtual void exclude();
+  virtual table_map upper_select_const_tables() const { return 0; }
   virtual void print (String *str, enum_query_type query_type);
-  bool change_result(Item_subselect *si, select_result_interceptor *result);
-  bool no_tables();
-  int scan_table();
+  virtual bool change_result(Item_subselect *si,
+                             select_result_interceptor *result);
+  virtual bool no_tables() const;
+  bool scan_table();
   bool copy_ref_key();
-  bool no_rows() { return empty_result_set; }
-  virtual enum_engine_type engine_type() { return UNIQUESUBQUERY_ENGINE; }
+  virtual bool no_rows() const { return empty_result_set; }
+  virtual enum_engine_type engine_type() const { return UNIQUESUBQUERY_ENGINE; }
 };
 
 
 class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
 {
+private:
   /* FALSE for 'ref', TRUE for 'ref-or-null'. */
   bool check_null;
   /* 
@@ -676,9 +681,9 @@ public:
      check_null(chk_null),
      having(having_arg)
   {}
-  int exec();
+  virtual bool exec();
   virtual void print (String *str, enum_query_type query_type);
-  virtual enum_engine_type engine_type() { return INDEXSUBQUERY_ENGINE; }
+  virtual enum_engine_type engine_type() const { return INDEXSUBQUERY_ENGINE; }
 };
 
 /*
@@ -711,21 +716,17 @@ inline bool Item_subselect::is_uncacheab
 
 class subselect_hash_sj_engine: public subselect_uniquesubquery_engine
 {
-protected:
+private:
   /* TRUE if the subquery was materialized into a temp table. */
   bool is_materialized;
   /*
     The old engine already chosen at parse time and stored in permanent memory.
-    Through this member we can re-create and re-prepare materialize_join for
-    each execution of a prepared statement. We also reuse the functionality
-    of subselect_single_select_engine::[prepare | cols].
+    Through this member we can re-create and re-prepare the join object
+    used to materialize the subquery for each execution of a prepared
+    statement. We also reuse the functionality of
+    subselect_single_select_engine::[prepare | cols].
   */
   subselect_single_select_engine *materialize_engine;
-  /*
-    QEP to execute the subquery and materialize its result into a
-    temporary table. Created during the first call to exec().
-  */
-  JOIN *materialize_join;
   /* Temp table context of the outer select's JOIN. */
   TMP_TABLE_PARAM *tmp_param;
 
@@ -734,23 +735,22 @@ public:
                                subselect_single_select_engine *old_engine)
     :subselect_uniquesubquery_engine(thd, NULL, in_predicate, NULL),
     is_materialized(FALSE), materialize_engine(old_engine),
-    materialize_join(NULL), tmp_param(NULL)
+    tmp_param(NULL)
   {}
   ~subselect_hash_sj_engine();
 
-  bool init_permanent(List<Item> *tmp_columns);
-  bool init_runtime();
-  void cleanup();
-  int prepare() 
+  bool setup(List<Item> *tmp_columns);
+  virtual void cleanup();
+  virtual bool prepare() 
   { 
     return materialize_engine->prepare();
   }
-  int exec();
-  void print (String *str, enum_query_type query_type);
-  uint cols()
+  virtual bool exec();
+  virtual void print (String *str, enum_query_type query_type);
+  virtual uint cols() const
   {
     return materialize_engine->cols();
   }
-  virtual enum_engine_type engine_type() { return HASH_SJ_ENGINE; }
+  virtual enum_engine_type engine_type() const { return HASH_SJ_ENGINE; }
 };
 #endif /* ITEM_SUBSELECT_INCLUDED */

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2011-03-11 09:35:38 +0000
+++ b/sql/item_sum.cc	2011-03-17 09:47:50 +0000
@@ -1904,7 +1904,10 @@ double Item_sum_hybrid::val_real()
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0.0;
-  return value->val_real();
+  double retval= value->val_real();
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == 0.0);
+  return retval;
 }
 
 longlong Item_sum_hybrid::val_int()
@@ -1912,7 +1915,10 @@ longlong Item_sum_hybrid::val_int()
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_int();
+  longlong retval= value->val_int();
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == 0);
+  return retval;
 }
 
 
@@ -1921,7 +1927,10 @@ my_decimal *Item_sum_hybrid::val_decimal
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_decimal(val);
+  my_decimal *retval= value->val_decimal(val);
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == NULL);
+  return retval;
 }
 
 
@@ -1931,7 +1940,10 @@ Item_sum_hybrid::val_str(String *str)
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_str(str);
+  String *retval= value->val_str(str);
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == NULL);
+  return retval;
 }
 
 

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2011-03-09 20:54:55 +0000
+++ b/sql/item_timefunc.cc	2011-03-17 11:11:39 +0000
@@ -2525,6 +2525,19 @@ String *Item_char_typecast::val_str(Stri
   String *res;
   uint32 length;
 
+  if (cast_length >= 0 &&
+      ((unsigned) cast_length) > current_thd->variables.max_allowed_packet)
+  {
+    push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+			ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+			ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+			cast_cs == &my_charset_bin ?
+                        "cast_as_binary" : func_name(),
+                        current_thd->variables.max_allowed_packet);
+    null_value= 1;
+    return 0;
+  }
+
   if (!charset_conversion)
   {
     if (!(res= args[0]->val_str(str)))

=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h	2011-03-09 20:54:55 +0000
+++ b/sql/my_decimal.h	2011-03-18 12:25:56 +0000
@@ -178,7 +178,7 @@ void max_my_decimal(my_decimal *to, int
 {
   DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION)&&
               (frac <= DECIMAL_MAX_SCALE));
-  max_decimal(precision, frac, (decimal_t*) to);
+  max_decimal(precision, frac, to);
 }
 
 inline void max_internal_decimal(my_decimal *to)
@@ -277,14 +277,19 @@ inline
 int binary2my_decimal(uint mask, const uchar *bin, my_decimal *d, int prec,
 		      int scale)
 {
-  return check_result(mask, bin2decimal(bin, (decimal_t*) d, prec, scale));
+  return check_result(mask, bin2decimal(bin, d, prec, scale));
 }
 
 
 inline
 int my_decimal_set_zero(my_decimal *d)
 {
-  decimal_make_zero(((decimal_t*) d));
+  /*
+    We need the up-cast here, since my_decimal has sign() member functions,
+    which conflicts with decimal_t::size
+    (and decimal_make_zero is a macro, rather than a funcion).
+  */
+  decimal_make_zero(static_cast<decimal_t*>(d));
   return 0;
 }
 
@@ -292,7 +297,7 @@ int my_decimal_set_zero(my_decimal *d)
 inline
 bool my_decimal_is_zero(const my_decimal *decimal_value)
 {
-  return decimal_is_zero((decimal_t*) decimal_value);
+  return decimal_is_zero(decimal_value);
 }
 
 
@@ -300,7 +305,7 @@ inline
 int my_decimal_round(uint mask, const my_decimal *from, int scale,
                      bool truncate, my_decimal *to)
 {
-  return check_result(mask, decimal_round((decimal_t*) from, to, scale,
+  return check_result(mask, decimal_round(from, to, scale,
 					  (truncate ? TRUNCATE : HALF_UP)));
 }
 
@@ -308,14 +313,14 @@ int my_decimal_round(uint mask, const my
 inline
 int my_decimal_floor(uint mask, const my_decimal *from, my_decimal *to)
 {
-  return check_result(mask, decimal_round((decimal_t*) from, to, 0, FLOOR));
+  return check_result(mask, decimal_round(from, to, 0, FLOOR));
 }
 
 
 inline
 int my_decimal_ceiling(uint mask, const my_decimal *from, my_decimal *to)
 {
-  return check_result(mask, decimal_round((decimal_t*) from, to, 0, CEILING));
+  return check_result(mask, decimal_round(from, to, 0, CEILING));
 }
 
 
@@ -337,7 +342,7 @@ int my_decimal2int(uint mask, const my_d
 {
   my_decimal rounded;
   /* decimal_round can return only E_DEC_TRUNCATED */
-  decimal_round((decimal_t*)d, &rounded, 0, HALF_UP);
+  decimal_round(d, &rounded, 0, HALF_UP);
   return check_result(mask, (unsigned_flag ?
 			     decimal2ulonglong(&rounded, (ulonglong *)l) :
 			     decimal2longlong(&rounded, l)));
@@ -348,15 +353,14 @@ inline
 int my_decimal2double(uint, const my_decimal *d, double *result)
 {
   /* No need to call check_result as this will always succeed */
-  return decimal2double((decimal_t*) d, result);
+  return decimal2double(d, result);
 }
 
 
 inline
 int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end)
 {
-  return check_result_and_overflow(mask, string2decimal(str,(decimal_t*)d,end),
-                                   d);
+  return check_result_and_overflow(mask, string2decimal(str, d, end), d);
 }
 
 
@@ -379,7 +383,7 @@ my_decimal *date2my_decimal(MYSQL_TIME *
 inline
 int double2my_decimal(uint mask, double val, my_decimal *d)
 {
-  return check_result_and_overflow(mask, double2decimal(val, (decimal_t*)d), d);
+  return check_result_and_overflow(mask, double2decimal(val, d), d);
 }
 
 
@@ -409,7 +413,7 @@ int my_decimal_add(uint mask, my_decimal
 		   const my_decimal *b)
 {
   return check_result_and_overflow(mask,
-                                   decimal_add((decimal_t*)a,(decimal_t*)b,res),
+                                   decimal_add(a, b, res),
                                    res);
 }
 
@@ -419,7 +423,7 @@ int my_decimal_sub(uint mask, my_decimal
 		   const my_decimal *b)
 {
   return check_result_and_overflow(mask,
-                                   decimal_sub((decimal_t*)a,(decimal_t*)b,res),
+                                   decimal_sub(a, b, res),
                                    res);
 }
 
@@ -429,7 +433,7 @@ int my_decimal_mul(uint mask, my_decimal
 		   const my_decimal *b)
 {
   return check_result_and_overflow(mask,
-                                   decimal_mul((decimal_t*)a,(decimal_t*)b,res),
+                                   decimal_mul(a, b, res),
                                    res);
 }
 
@@ -439,8 +443,7 @@ int my_decimal_div(uint mask, my_decimal
 		   const my_decimal *b, int div_scale_inc)
 {
   return check_result_and_overflow(mask,
-                                   decimal_div((decimal_t*)a,(decimal_t*)b,res,
-                                               div_scale_inc),
+                                   decimal_div(a, b, res, div_scale_inc),
                                    res);
 }
 
@@ -450,7 +453,7 @@ int my_decimal_mod(uint mask, my_decimal
 		   const my_decimal *b)
 {
   return check_result_and_overflow(mask,
-                                   decimal_mod((decimal_t*)a,(decimal_t*)b,res),
+                                   decimal_mod(a, b, res),
                                    res);
 }
 
@@ -462,14 +465,14 @@ int my_decimal_mod(uint mask, my_decimal
 inline
 int my_decimal_cmp(const my_decimal *a, const my_decimal *b)
 {
-  return decimal_cmp((decimal_t*) a, (decimal_t*) b);
+  return decimal_cmp(a, b);
 }
 
 
 inline
 int my_decimal_intg(const my_decimal *a)
 {
-  return decimal_intg((decimal_t*) a);
+  return decimal_intg(a);
 }
 
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-03-18 22:24:30 +0000
+++ b/sql/mysqld.cc	2011-03-21 02:16:39 +0000
@@ -2337,7 +2337,7 @@ LONG WINAPI my_unhandler_exception_filte
 }
 
 
-static void init_signals(void)
+void my_init_signals(void)
 {
   if(opt_console)
     SetConsoleCtrlHandler(console_event_handler,TRUE);
@@ -2558,11 +2558,11 @@ bugs.\n");
 
 #ifndef EMBEDDED_LIBRARY
 
-static void init_signals(void)
+void my_init_signals(void)
 {
   sigset_t set;
   struct sigaction sa;
-  DBUG_ENTER("init_signals");
+  DBUG_ENTER("my_init_signals");
 
   my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
 
@@ -4658,7 +4658,7 @@ int mysqld_main(int argc, char **argv)
   if (init_common_variables())
     unireg_abort(1);				// Will do exit
 
-  init_signals();
+  my_init_signals();
 #if defined(__ia64__) || defined(__ia64)
   /*
     Peculiar things with ia64 platforms - it seems we only have half the

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-03-16 08:58:26 +0000
+++ b/sql/mysqld.h	2011-03-21 02:16:39 +0000
@@ -76,6 +76,7 @@ bool is_secure_file_path(char *path);
 // These are needed for unit testing.
 void set_remaining_args(int argc, char **argv);
 int init_common_variables();
+void my_init_signals();
 
 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;
 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *files_charset_info ;

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2011-03-03 22:26:19 +0000
+++ b/sql/opt_range.cc	2011-03-17 11:48:04 +0000
@@ -10136,11 +10136,11 @@ check_group_min_max_predicates(Item *con
 
   /* Test if cond references only group-by or non-group fields. */
   Item_func *pred= (Item_func*) cond;
-  Item **arguments= pred->arguments();
   Item *cur_arg;
   DBUG_PRINT("info", ("Analyzing: %s", pred->func_name()));
   for (uint arg_idx= 0; arg_idx < pred->argument_count (); arg_idx++)
   {
+    Item **arguments= pred->arguments();
     cur_arg= arguments[arg_idx]->real_item();
     DBUG_PRINT("info", ("cur_arg: %s", cur_arg->full_name()));
     if (cur_arg->type() == Item::FIELD_ITEM)

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-03-14 13:55:44 +0000
+++ b/sql/rpl_slave.cc	2011-03-17 13:20:36 +0000
@@ -1030,18 +1030,18 @@ static bool sql_slave_killed(THD* thd, R
         && rli->is_in_group())
     {
       char msg_stopped[]=
-        "... The slave SQL is stopped, leaving the current group "
-        "of events unfinished with a non-transaction table changed. "
-        "If the group consists solely of Row-based events, you can try "
-        "restarting the slave with --slave-exec-mode=IDEMPOTENT, which "
+        "... Slave SQL Thread stopped with incomplete event group "
+        "having non-transactional changes. "
+        "If the group consists solely of row-based events, you can try "
+        "to restart the slave with --slave-exec-mode=IDEMPOTENT, which "
         "ignores duplicate key, key not found, and similar errors (see "
         "documentation for details).";
 
       if (rli->abort_slave)
       {
-        DBUG_PRINT("info", ("Slave SQL thread is being stopped in the middle of"
-                            " a group having updated a non-trans table, giving"
-                            " it some grace period"));
+        DBUG_PRINT("info", ("Request to stop slave SQL Thread received while "
+                            "applying a group that has non-transactional "
+                            "changes; waiting for completion of the group ... "));
 
         /*
           Slave sql thread shutdown in face of unfinished group modified 
@@ -1065,9 +1065,9 @@ static bool sql_slave_killed(THD* thd, R
         if (ret == 0)
         {
           rli->report(WARNING_LEVEL, 0,
-                      "slave SQL thread is being stopped in the middle "
-                      "of applying of a group having updated a non-transaction "
-                      "table; waiting for the group completion ... ");
+                      "Request to stop slave SQL Thread received while "
+                      "applying a group that has non-transactional "
+                      "changes; waiting for completion of the group ... ");
         }
         else
         {

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-03-09 20:54:55 +0000
+++ b/sql/sql_acl.cc	2011-03-18 14:58:27 +0000
@@ -2402,8 +2402,10 @@ static int replace_user_table(THD *thd,
       {
         table->field[next_field]->store(combo.plugin.str, combo.plugin.length,
                                         system_charset_info);
+        table->field[next_field]->set_notnull();
         table->field[next_field + 1]->store(combo.auth.str, combo.auth.length,
                                             system_charset_info);
+        table->field[next_field + 1]->set_notnull();
       }
       else
       {
@@ -6396,25 +6398,47 @@ static int handle_grant_data(TABLE_LIST
   @param str     A String to store the user list.
   @param user    A LEX_USER which will be appended into user list.
   @param comma   If TRUE, append a ',' before the the user.
-  @param passwd  If TRUE, append ' IDENTIFIED BY PASSWORD ...' after the user,
-                 if the given user has password.
+  @param ident   If TRUE, append ' IDENTIFIED BY/WITH...' after the user,
+                 if the given user has credentials set with 'IDENTIFIED BY/WITH'
  */
 static void append_user(String *str, LEX_USER *user, bool comma= TRUE,
-                        bool passwd= FALSE)
+                        bool ident= FALSE)
 {
+  String from_user(user->user.str, user->user.length, system_charset_info);
+  String from_plugin(user->plugin.str, user->plugin.length, system_charset_info);
+  String from_auth(user->auth.str, user->auth.length, system_charset_info);
+  String from_host(user->host.str, user->host.length, system_charset_info);
+
   if (comma)
     str->append(',');
-  str->append('\'');
-  str->append(user->user.str);
-  str->append(STRING_WITH_LEN("'@'"));
-  str->append(user->host.str);
-  str->append('\'');
-
-  if (passwd && user->password.str)
-  {
-    str->append(STRING_WITH_LEN(" IDENTIFIED BY PASSWORD '"));
-    str->append(user->password.str, user->password.length);
-    str->append('\'');
+  append_query_string(system_charset_info, &from_user, str);
+  str->append(STRING_WITH_LEN("@"));
+  append_query_string(system_charset_info, &from_host, str);
+
+  if (ident)
+  {
+    if (user->plugin.str && (user->plugin.length > 0))
+    {
+      /** 
+          The plugin identifier is allowed to be specified,
+          both with and without quote marks. We log it with
+          quotes always.
+        */
+      str->append(STRING_WITH_LEN(" IDENTIFIED WITH "));
+      append_query_string(system_charset_info, &from_plugin, str);
+
+      if (user->auth.str && (user->auth.length > 0))
+      {
+        str->append(STRING_WITH_LEN(" AS "));
+        append_query_string(system_charset_info, &from_auth, str);
+      }
+    }
+    else if (user->password.str)
+    {
+      str->append(STRING_WITH_LEN(" IDENTIFIED BY PASSWORD '"));
+      str->append(user->password.str, user->password.length);
+      str->append('\'');
+    }
   }
 }
 
@@ -8451,6 +8475,94 @@ static bool parse_com_change_user_packet
   DBUG_RETURN (0);
 }
 
+#ifndef EMBEDDED_LIBRARY
+/**
+  Get a null character terminated string from a user-supplied buffer.
+
+  @param buffer[in, out]    Pointer to the buffer to be scanned.
+  @param max_bytes_available[in, out]  Limit the bytes to scan.
+  @param string_length[out] The number of characters scanned not including
+                            the null character.
+
+  @remark The string_length does not include the terminating null character.
+          However, after the call, the buffer is increased by string_length+1
+          bytes, beyond the null character if there still available bytes to
+          scan.
+
+  @return pointer to beginning of the string scanned.
+    @retval NULL The buffer content is malformed
+*/
+
+static
+char *get_null_terminated_string(char **buffer,
+                                 size_t *max_bytes_available,
+                                 size_t *string_length)
+{
+  char *str= (char *)memchr(*buffer, '\0', *max_bytes_available);
+
+  if (str == NULL)
+    return NULL;
+
+  *string_length= (size_t)(str - *buffer);
+  *max_bytes_available-= *string_length + 1;
+  str= *buffer;
+  *buffer += *string_length + 1;  
+
+  return str;
+}
+
+/**
+  Get a length encoded string from a user-supplied buffer.
+
+  @param buffer[in, out] The buffer to scan; updates position after scan.
+  @param max_bytes_available[in, out] Limit the number of bytes to scan
+  @param string_length[out] Number of characters scanned
+  
+  @remark In case the length is zero, then the total size of the string is
+    considered to be 1 byte; the size byte.
+
+  @return pointer to first byte after the header in buffer.
+    @retval NULL The buffer content is malformed
+*/
+
+static
+char *get_length_encoded_string(char **buffer,
+                                size_t *max_bytes_available,
+                                size_t *string_length)
+{
+  if (*max_bytes_available == 0)
+    return NULL;
+
+  /* Do double cast to prevent overflow from signed / unsigned conversion */
+  size_t str_len= (size_t)(unsigned char)**buffer;
+
+  /*
+    If the length encoded string has the length 0
+    the total size of the string is only one byte long (the size byte)
+  */
+  if (str_len == 0)
+  {
+    ++*buffer;
+    *string_length= 0;
+    /*
+      Return a pointer to the 0 character so the return value will be
+      an empty string.
+    */
+    return *buffer-1;
+  }
+
+  if (str_len >= *max_bytes_available)
+    return NULL;
+
+  char *str= *buffer+1;
+  *string_length= str_len;
+  *max_bytes_available-= *string_length + 1;
+  *buffer+= *string_length + 1;
+  return str;
+}
+#endif
+
+
 /* the packet format is described in send_client_reply_packet() */
 static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
                                            uchar **buff, ulong pkt_len)
@@ -8515,50 +8627,76 @@ static ulong parse_client_handshake_pack
   }
 #endif
 
-  if (end >= (char*) net->read_pos + pkt_len + 2)
+  if (end > (char *)net->read_pos + pkt_len)
     return packet_error;
 
   if ((mpvio->client_capabilities & CLIENT_TRANSACTIONS) &&
       opt_using_transactions)
     net->return_status= mpvio->server_status;
+ 
+  /*
+    In order to safely scan a head for '\0' string terminators
+    we must keep track of how many bytes remain in the allocated
+    buffer or we might read past the end of the buffer.
+  */
+  size_t bytes_remaining_in_packet= pkt_len - (end - (char *)net->read_pos);
 
-  char *user= end;
-  char *passwd= strend(user) + 1;
-  uint user_len= passwd - user - 1, db_len;
-  char *db= passwd;
-  char db_buff[NAME_LEN + 1];           // buffer to store db in utf8
-  char user_buff[USERNAME_LENGTH + 1];	// buffer to store user in utf8
-  uint dummy_errors;
+  size_t user_len;
+  char *user= get_null_terminated_string(&end, &bytes_remaining_in_packet,
+                                         &user_len);
+  if (user == NULL)
+    return packet_error;
 
   /*
-    Old clients send null-terminated string as password; new clients send
+    Old clients send a null-terminated string as password; new clients send
     the size (1 byte) + string (not null-terminated). Hence in case of empty
     password both send '\0'.
-
-    This strlen() can't be easily deleted without changing protocol.
-
-    Cast *passwd to an unsigned char, so that it doesn't extend the sign for
-    *passwd > 127 and become 2**32-127+ after casting to uint.
   */
-  uint passwd_len= mpvio->client_capabilities & CLIENT_SECURE_CONNECTION ?
-                   (uchar) (*passwd++) : strlen(passwd);
-  
-  if (mpvio->client_capabilities & CLIENT_CONNECT_WITH_DB)
+  size_t passwd_len= 0;
+  char *passwd= NULL;
+
+  if (mpvio->client_capabilities & CLIENT_SECURE_CONNECTION)
   {
-    db= db + passwd_len + 1;
-    /* strlen() can't be easily deleted without changing protocol */
-    db_len= strlen(db);
+    /*
+      4.1+ password. First byte is password length.
+    */
+    passwd= get_length_encoded_string(&end, &bytes_remaining_in_packet,
+                                      &passwd_len);
   }
   else
   {
-    db= 0;
-    db_len= 0;
+    /*
+      Old passwords are zero terminated strings.
+    */
+    passwd= get_null_terminated_string(&end, &bytes_remaining_in_packet,
+                                       &passwd_len);
   }
 
-  if (passwd + passwd_len + db_len > (char *) net->read_pos + pkt_len)
+  if (passwd == NULL)
     return packet_error;
 
-  char *client_plugin= passwd + passwd_len + (db ? db_len + 1 : 0);
+  size_t db_len= 0;
+  char *db= NULL;
+
+  if (mpvio->client_capabilities & CLIENT_CONNECT_WITH_DB)
+  {
+    db= get_null_terminated_string(&end, &bytes_remaining_in_packet,
+                                   &db_len);
+    if (db == NULL)
+      return packet_error;
+  }
+
+  size_t client_plugin_len= 0;
+  char *client_plugin= get_null_terminated_string(&end,
+                                                  &bytes_remaining_in_packet,
+                                                  &client_plugin_len);
+  if (client_plugin == NULL)
+    client_plugin= &empty_c_string[0];
+ 
+  char db_buff[NAME_LEN + 1];           // buffer to store db in utf8
+  char user_buff[USERNAME_LENGTH + 1];	// buffer to store user in utf8
+  uint dummy_errors;
+  
 
   /* Since 4.1 all database names are stored in utf8 */
   if (db)
@@ -8604,18 +8742,18 @@ static ulong parse_client_handshake_pack
   if (find_mpvio_user(mpvio))
     return packet_error;
 
-  if (mpvio->client_capabilities & CLIENT_PLUGIN_AUTH)
-  {
-    if ((client_plugin + strlen(client_plugin)) > 
-          (char *) net->read_pos + pkt_len)
-      return packet_error;
-  }
-  else
+  if (!(mpvio->client_capabilities & CLIENT_PLUGIN_AUTH))
   {
+    /*
+      An old client is connecting
+    */
     if (mpvio->client_capabilities & CLIENT_SECURE_CONNECTION)
       client_plugin= native_password_plugin_name.str;
     else
     {
+      /*
+        A really old client is connecting
+      */
       client_plugin= old_password_plugin_name.str;
       /*
         For a passwordless accounts we use native_password_plugin.

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-03-09 20:54:55 +0000
+++ b/sql/sql_base.cc	2011-03-17 11:11:39 +0000
@@ -7663,9 +7663,10 @@ static bool setup_natural_join_row_types
                                          List<TABLE_LIST> *from_clause,
                                          Name_resolution_context *context)
 {
+  DBUG_ENTER("setup_natural_join_row_types");
   thd->where= "from clause";
   if (from_clause->elements == 0)
-    return FALSE; /* We come here in the case of UNIONs. */
+    DBUG_RETURN(false); /* We come here in the case of UNIONs. */
 
   List_iterator_fast<TABLE_LIST> table_ref_it(*from_clause);
   TABLE_LIST *table_ref; /* Current table reference. */
@@ -7673,10 +7674,6 @@ static bool setup_natural_join_row_types
   TABLE_LIST *left_neighbor;
   /* Table reference to the right of the current. */
   TABLE_LIST *right_neighbor= NULL;
-  bool save_first_natural_join_processing=
-    context->select_lex->first_natural_join_processing;
-
-  context->select_lex->first_natural_join_processing= FALSE;
 
   /* Note that tables in the list are in reversed order */
   for (left_neighbor= table_ref_it++; left_neighbor ; )
@@ -7688,12 +7685,11 @@ static bool setup_natural_join_row_types
       1) for stored procedures,
       2) for multitable update after lock failure and table reopening.
     */
-    if (save_first_natural_join_processing)
+    if (context->select_lex->first_natural_join_processing)
     {
-      context->select_lex->first_natural_join_processing= FALSE;
       if (store_top_level_join_columns(thd, table_ref,
                                        left_neighbor, right_neighbor))
-        return TRUE;
+        DBUG_RETURN(true);
       if (left_neighbor)
       {
         TABLE_LIST *first_leaf_on_the_right;
@@ -7713,8 +7709,9 @@ static bool setup_natural_join_row_types
   DBUG_ASSERT(right_neighbor);
   context->first_name_resolution_table=
     right_neighbor->first_leaf_for_name_resolution();
+  context->select_lex->first_natural_join_processing= false;
 
-  return FALSE;
+  DBUG_RETURN (false);
 }
 
 

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2011-03-15 10:54:06 +0000
+++ b/sql/sql_db.cc	2011-03-17 09:47:50 +0000
@@ -1046,9 +1046,9 @@ static bool find_db_tables_and_rm_known_
     }
     if (!(extension= strrchr(file->name, '.')))
       extension= strend(file->name);
-    if (find_type(extension, &deletable_extentions,1+2) <= 0)
+    if (find_type(extension, &deletable_extentions, FIND_TYPE_NO_PREFIX) <= 0)
     {
-      if (find_type(extension, ha_known_exts(),1+2) <= 0)
+      if (find_type(extension, ha_known_exts(), FIND_TYPE_NO_PREFIX) <= 0)
 	*found_other_files= true;
       continue;
     }

=== modified file 'sql/sql_handler.cc'
--- a/sql/sql_handler.cc	2010-11-18 16:34:56 +0000
+++ b/sql/sql_handler.cc	2011-02-11 14:38:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -613,7 +613,8 @@ retry:
 
   if (keyname)
   {
-    if ((keyno=find_type(keyname, &table->s->keynames, 1+2)-1)<0)
+    if ((keyno= find_type(keyname, &table->s->keynames,
+                          FIND_TYPE_NO_PREFIX) - 1) < 0)
     {
       my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
       goto err;

=== modified file 'sql/sql_help.cc'
--- a/sql/sql_help.cc	2010-10-20 21:34:37 +0000
+++ b/sql/sql_help.cc	2011-02-11 14:38:34 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -284,10 +284,12 @@ int get_topics_for_keyword(THD *thd, TAB
   Field *rtopic_id, *rkey_id;
   DBUG_ENTER("get_topics_for_keyword");
 
-  if ((iindex_topic= find_type((char*) primary_key_name,
-			       &topics->s->keynames, 1+2)-1)<0 ||
-      (iindex_relations= find_type((char*) primary_key_name,
-				   &relations->s->keynames, 1+2)-1)<0)
+  if ((iindex_topic=
+       find_type(primary_key_name, &topics->s->keynames,
+                 FIND_TYPE_NO_PREFIX) - 1) < 0 ||
+      (iindex_relations=
+       find_type(primary_key_name, &relations->s->keynames,
+                 FIND_TYPE_NO_PREFIX) - 1) < 0)
   {
     my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
     DBUG_RETURN(-1);

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2011-03-11 09:35:38 +0000
+++ b/sql/sql_lex.h	2011-03-17 07:40:26 +0000
@@ -596,7 +596,7 @@ public:
   inline bool is_union (); 
 
   friend void lex_start(THD *thd);
-  friend int subselect_union_engine::exec();
+  friend bool subselect_union_engine::exec();
 
   List<Item> *get_unit_column_types();
 };

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-03-11 09:35:38 +0000
+++ b/sql/sql_select.cc	2011-03-17 12:45:19 +0000
@@ -2645,10 +2645,14 @@ void JOIN::restore_tmp()
 }
 
 
-int
-JOIN::reinit()
+/**
+  Reset the state of this join object so that it is ready for a
+  new execution.
+*/
+
+void JOIN::reset()
 {
-  DBUG_ENTER("JOIN::reinit");
+  DBUG_ENTER("JOIN::reset");
 
   unit->offset_limit_cnt= (ha_rows)(select_lex->offset_limit ?
                                     select_lex->offset_limit->val_uint() :
@@ -2699,7 +2703,7 @@ JOIN::reinit()
   if (!(select_options & SELECT_DESCRIBE))
     init_ftfuncs(thd, select_lex, test(order));
 
-  DBUG_RETURN(0);
+  DBUG_VOID_RETURN;
 }
 
 /**
@@ -3394,14 +3398,12 @@ JOIN::exec()
 
 
 /**
-  Clean up join.
+  Clean up and destroy join object.
 
-  @return
-    Return error that hold JOIN.
+  @return false if previous execution was successful, and true otherwise
 */
 
-int
-JOIN::destroy()
+bool JOIN::destroy()
 {
   DBUG_ENTER("JOIN::destroy");
   select_lex->join= 0;
@@ -3427,6 +3429,11 @@ JOIN::destroy()
   cond_equal= 0;
 
   cleanup(1);
+  if (join_tab)
+  {
+    for (JOIN_TAB *tab= join_tab; tab < join_tab+tables; tab++)
+      tab->table= NULL;
+  }
  /* Cleanup items referencing temporary table columns */
   cleanup_item_list(tmp_all_fields1);
   cleanup_item_list(tmp_all_fields3);
@@ -3443,7 +3450,7 @@ JOIN::destroy()
 
   delete_dynamic(&keyuse);
   delete procedure;
-  DBUG_RETURN(error);
+  DBUG_RETURN(test(error));
 }
 
 
@@ -3539,8 +3546,8 @@ mysql_select(THD *thd, Item ***rref_poin
           subselect execution. So we need to restore them.
         */
         Item_subselect *subselect= select_lex->master_unit()->item;
-        if (subselect && subselect->is_uncacheable() && join->reinit())
-          DBUG_RETURN(TRUE);
+        if (subselect && subselect->is_uncacheable())
+          join->reset();
       }
       else
       {
@@ -3592,6 +3599,8 @@ mysql_select(THD *thd, Item ***rref_poin
     select_lex->where= join->conds_history;
     select_lex->having= join->having_history;
   }
+  if (select_options & SELECT_DESCRIBE)
+    free_join= 0;
 
 err:
   if (free_join)
@@ -10036,12 +10045,14 @@ static bool uses_index_fields_only(Item
     {
       /* This is a function, apply condition recursively to arguments */
       Item_func *item_func= (Item_func*)item;
-      Item **child;
-      Item **item_end= (item_func->arguments()) + item_func->argument_count();
-      for (child= item_func->arguments(); child != item_end; child++)
-      {
-        if (!uses_index_fields_only(*child, tbl, keyno, other_tbls_ok))
-          return FALSE;
+      if (item_func->argument_count() > 0)
+      {        
+        Item **item_end= (item_func->arguments()) + item_func->argument_count();
+        for (Item **child= item_func->arguments(); child != item_end; child++)
+        {
+          if (!uses_index_fields_only(*child, tbl, keyno, other_tbls_ok))
+            return FALSE;
+        }
       }
       return TRUE;
     }
@@ -11388,7 +11399,12 @@ bool error_if_full_join(JOIN *join)
 
 
 /**
-  cleanup JOIN_TAB.
+  Cleanup table of join operation.
+
+  @note
+    Notice that this is not a complete cleanup. In some situations, the
+    object may be reused after a cleanup operation, hence we cannot set
+    the table pointer to NULL in this function.
 */
 
 void JOIN_TAB::cleanup()
@@ -23335,7 +23351,6 @@ bool mysql_explain_union(THD *thd, SELEC
     unit->fake_select_lex->options|= SELECT_DESCRIBE;
     if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK | SELECT_DESCRIBE)))
       res= unit->exec();
-    res|= unit->cleanup();
   }
   else
   {

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2011-03-09 20:54:55 +0000
+++ b/sql/sql_select.h	2011-03-17 09:43:28 +0000
@@ -1918,9 +1918,9 @@ public:
 	      Item *having, ORDER *proc_param, SELECT_LEX *select,
 	      SELECT_LEX_UNIT *unit);
   int optimize();
-  int reinit();
+  void reset();
   void exec();
-  int destroy();
+  bool destroy();
   void restore_tmp();
   bool alloc_func_list();
   bool flatten_subqueries();

=== modified file 'sql/sql_union.cc'
--- a/sql/sql_union.cc	2010-11-11 09:40:06 +0000
+++ b/sql/sql_union.cc	2011-03-01 14:57:53 +0000
@@ -214,16 +214,16 @@ bool st_select_lex_unit::prepare(THD *th
       /* fast reinit for EXPLAIN */
       for (sl= first_sl; sl; sl= sl->next_select())
       {
-	sl->join->result= result;
-	select_limit_cnt= HA_POS_ERROR;
-	offset_limit_cnt= 0;
-	if (!sl->join->procedure &&
-	    result->prepare(sl->join->fields_list, this))
-	{
-	  DBUG_RETURN(TRUE);
-	}
-	sl->join->select_options|= SELECT_DESCRIBE;
-	sl->join->reinit();
+        sl->join->result= result;
+        select_limit_cnt= HA_POS_ERROR;
+        offset_limit_cnt= 0;
+        if (!sl->join->procedure &&
+            result->prepare(sl->join->fields_list, this))
+        {
+          DBUG_RETURN(TRUE);
+        }
+        sl->join->select_options|= SELECT_DESCRIBE;
+        sl->join->reset();
       }
     }
     DBUG_RETURN(FALSE);
@@ -469,8 +469,8 @@ bool st_select_lex_unit::exec()
   DBUG_ENTER("st_select_lex_unit::exec");
 
   if (executed && !uncacheable && !describe)
-    DBUG_RETURN(FALSE);
-  executed= 1;
+    DBUG_RETURN(false);
+  executed= true;
   
   if (uncacheable || !item || !item->assigned() || describe)
   {
@@ -496,19 +496,22 @@ bool st_select_lex_unit::exec()
       thd->lex->current_select= sl;
 
       if (optimized)
-	saved_error= sl->join->reinit();
+      {
+        saved_error= false;
+        sl->join->reset();
+      }
       else
       {
         set_limit(sl);
-	if (sl == global_parameters || describe)
-	{
-	  offset_limit_cnt= 0;
-	  /*
-	    We can't use LIMIT at this stage if we are using ORDER BY for the
-	    whole query
-	  */
-	  if (sl->order_list.first || describe)
-	    select_limit_cnt= HA_POS_ERROR;
+        if (sl == global_parameters || describe)
+        {
+          offset_limit_cnt= 0;
+          /*
+            We can't use LIMIT at this stage if we are using ORDER BY for the
+            whole query
+          */
+          if (sl->order_list.first || describe)
+            select_limit_cnt= HA_POS_ERROR;
         }
 
         /*
@@ -520,62 +523,62 @@ bool st_select_lex_unit::exec()
           (select_limit_cnt == HA_POS_ERROR || sl->braces) ?
           sl->options & ~OPTION_FOUND_ROWS : sl->options | found_rows_for_union;
 
-	saved_error= sl->join->optimize();
+        saved_error= sl->join->optimize();
       }
       if (!saved_error)
       {
-	records_at_start= table->file->stats.records;
-	sl->join->exec();
+        records_at_start= table->file->stats.records;
+        sl->join->exec();
         if (sl == union_distinct)
-	{
-	  if (table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL))
-	    DBUG_RETURN(TRUE);
-	  table->no_keyread=1;
-	}
-	saved_error= sl->join->error;
-	offset_limit_cnt= (ha_rows)(sl->offset_limit ?
+        {
+          if (table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL))
+            DBUG_RETURN(true);
+          table->no_keyread=1;
+        }
+        saved_error= sl->join->error;
+        offset_limit_cnt= (ha_rows)(sl->offset_limit ?
                                     sl->offset_limit->val_uint() :
                                     0);
-	if (!saved_error)
-	{
-	  examined_rows+= thd->examined_row_count;
-	  if (union_result->flush())
-	  {
-	    thd->lex->current_select= lex_select_save;
-	    DBUG_RETURN(1);
-	  }
-	}
+        if (!saved_error)
+        {
+          examined_rows+= thd->examined_row_count;
+          if (union_result->flush())
+          {
+            thd->lex->current_select= lex_select_save;
+            DBUG_RETURN(true);
+          }
+        }
       }
       if (saved_error)
       {
-	thd->lex->current_select= lex_select_save;
-	DBUG_RETURN(saved_error);
+        thd->lex->current_select= lex_select_save;
+        DBUG_RETURN(saved_error);
       }
       /* Needed for the following test and for records_at_start in next loop */
       int error= table->file->info(HA_STATUS_VARIABLE);
       if(error)
       {
         table->file->print_error(error, MYF(0));
-        DBUG_RETURN(1);
+        DBUG_RETURN(true);
       }
       if (found_rows_for_union && !sl->braces && 
           select_limit_cnt != HA_POS_ERROR)
       {
-	/*
-	  This is a union without braces. Remember the number of rows that
-	  could also have been part of the result set.
-	  We get this from the difference of between total number of possible
-	  rows and actual rows added to the temporary table.
-	*/
-	add_rows+= (ulonglong) (thd->limit_found_rows - (ulonglong)
-			      ((table->file->stats.records -  records_at_start)));
+        /*
+          This is a union without braces. Remember the number of rows that
+          could also have been part of the result set.
+          We get this from the difference of between total number of possible
+          rows and actual rows added to the temporary table.
+        */
+        add_rows+= (ulonglong) (thd->limit_found_rows -
+                   (ulonglong)(table->file->stats.records - records_at_start));
       }
     }
   }
-  optimized= 1;
+  optimized= true;
 
   /* Send result to 'result' */
-  saved_error= TRUE;
+  saved_error= true;
   {
     List<Item_func_match> empty_list;
     empty_list.empty();
@@ -587,27 +590,27 @@ bool st_select_lex_unit::exec()
       JOIN *join= fake_select_lex->join;
       if (!join)
       {
-	/*
-	  allocate JOIN for fake select only once (prevent
-	  mysql_select automatic allocation)
+        /*
+          allocate JOIN for fake select only once (prevent
+          mysql_select automatic allocation)
           TODO: The above is nonsense. mysql_select() will not allocate the
           join if one already exists. There must be some other reason why we
           don't let it allocate the join. Perhaps this is because we need
           some special parameter values passed to join constructor?
 	*/
-	if (!(fake_select_lex->join= new JOIN(thd, item_list,
-					      fake_select_lex->options, result)))
+        if (!(fake_select_lex->join=
+            new JOIN(thd, item_list, fake_select_lex->options, result)))
 	{
-	  fake_select_lex->table_list.empty();
-	  DBUG_RETURN(TRUE);
+          fake_select_lex->table_list.empty();
+          DBUG_RETURN(true);
 	}
-        fake_select_lex->join->no_const_tables= TRUE;
+        fake_select_lex->join->no_const_tables= true;
 
-	/*
-	  Fake st_select_lex should have item list for correctref_array
-	  allocation.
-	*/
-	fake_select_lex->item_list= item_list;
+        /*
+          Fake st_select_lex should have item list for correctref_array
+          allocation.
+        */
+        fake_select_lex->item_list= item_list;
         saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
                               &result_table_list,
                               0, item_list, NULL,
@@ -630,7 +633,7 @@ bool st_select_lex_unit::exec()
             subquery execution rather than EXPLAIN line production. In order 
             to reset them back, we re-do all of the actions (yes it is ugly):
           */
-	  join->init(thd, item_list, fake_select_lex->options, result);
+          join->init(thd, item_list, fake_select_lex->options, result);
           saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
                                 &result_table_list,
                                 0, item_list, NULL,
@@ -643,7 +646,8 @@ bool st_select_lex_unit::exec()
         else
         {
           join->examined_rows= 0;
-          saved_error= join->reinit();
+          saved_error= false;
+          join->reset();
           join->exec();
         }
       }
@@ -655,8 +659,8 @@ bool st_select_lex_unit::exec()
         thd->examined_row_count+= examined_rows;
       }
       /*
-	Mark for slow query log if any of the union parts didn't use
-	indexes efficiently
+        Mark for slow query log if any of the union parts didn't use
+        indexes efficiently
       */
     }
   }
@@ -665,16 +669,25 @@ bool st_select_lex_unit::exec()
 }
 
 
+/**
+  Cleanup this query expression object after preparation or one round
+  of execution. After the cleanup, the object can be reused for a
+  new round of execution, but a new optimization will be needed before
+  the execution.
+
+  @return false if previous execution was successful, and true otherwise
+*/
+
 bool st_select_lex_unit::cleanup()
 {
-  int error= 0;
+  bool error= false;
   DBUG_ENTER("st_select_lex_unit::cleanup");
 
   if (cleaned)
   {
     DBUG_RETURN(FALSE);
   }
-  cleaned= 1;
+  cleaned= true;
 
   if (union_result)
   {
@@ -812,6 +825,13 @@ List<Item> *st_select_lex_unit::get_unit
   return &sl->item_list;
 }
 
+
+/**
+  Cleanup after preparation or one round of execution.
+
+  @return false if previous execution was successful, and true otherwise
+*/
+
 bool st_select_lex::cleanup()
 {
   bool error= FALSE;
@@ -827,7 +847,7 @@ bool st_select_lex::cleanup()
   for (SELECT_LEX_UNIT *lex_unit= first_inner_unit(); lex_unit ;
        lex_unit= lex_unit->next_unit())
   {
-    error= (bool) ((uint) error | (uint) lex_unit->cleanup());
+    error|= lex_unit->cleanup();
   }
   non_agg_fields.empty();
   inner_refs_list.empty();

=== modified file 'sql/strfunc.cc'
--- a/sql/strfunc.cc	2011-03-09 20:54:55 +0000
+++ b/sql/strfunc.cc	2011-03-17 09:43:28 +0000
@@ -97,7 +97,7 @@ ulonglong find_set(TYPELIB *lib, const c
 
 /*
   Function to find a string in a TYPELIB
-  (Same format as mysys/typelib.c)
+  (similar to find_type() of mysys/typelib.c)
 
   SYNOPSIS
    find_type()

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2011-03-11 09:35:38 +0000
+++ b/sql/table.cc	2011-03-17 09:47:50 +0000
@@ -1485,8 +1485,8 @@ static int open_binary_frm(THD *thd, TAB
   /* Fix key->name and key_part->field */
   if (key_parts)
   {
-    uint primary_key=(uint) (find_type((char*) primary_key_name,
-				       &share->keynames, 3) - 1);
+    uint primary_key=(uint) (find_type(primary_key_name, &share->keynames,
+                                       FIND_TYPE_NO_PREFIX) - 1);
     longlong ha_option= handler_file->ha_table_flags();
     keyinfo= share->key_info;
     key_part= keyinfo->key_part;

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2010-12-08 12:55:40 +0000
+++ b/storage/archive/ha_archive.cc	2011-03-03 09:22:17 +0000
@@ -1181,7 +1181,7 @@ int ha_archive::unpack_row(azio_stream *
   ptr+= table->s->null_bytes;
   for (Field **field=table->field ; *field ; field++)
   {
-    if (!((*field)->is_null()))
+    if (!((*field)->is_null_in_record(record)))
     {
       ptr= (*field)->unpack(record + (*field)->offset(table->record[0]), ptr);
     }

=== modified file 'storage/innobase/CMakeLists.txt'
--- a/storage/innobase/CMakeLists.txt	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/CMakeLists.txt	2011-03-15 16:17:31 +0000
@@ -42,6 +42,14 @@ ENDIF()
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DUNIV_DEBUG")
 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG")
 
+# Add -Wconversion if compiling with GCC
+## As of Mar 15 2011 this flag causes 3573+ warnings. If you are reading this
+## please fix them and enable the following code:
+#IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
+#  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
+#  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
+#ENDIF()
+
 IF(NOT MSVC)
 # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
 IF(NOT CMAKE_CROSSCOMPILING)

=== modified file 'storage/innobase/btr/btr0cur.c'
--- a/storage/innobase/btr/btr0cur.c	2011-02-08 12:16:14 +0000
+++ b/storage/innobase/btr/btr0cur.c	2011-03-15 10:57:47 +0000
@@ -4905,27 +4905,45 @@ btr_copy_blob_prefix(
 
 /*******************************************************************//**
 Copies the prefix of a compressed BLOB.  The clustered index record
-that points to this BLOB must be protected by a lock or a page latch. */
+that points to this BLOB must be protected by a lock or a page latch.
+@return	number of bytes written to buf */
 static
-void
+ulint
 btr_copy_zblob_prefix(
 /*==================*/
-	z_stream*	d_stream,/*!< in/out: the decompressing stream */
+	byte*		buf,	/*!< out: the externally stored part of
+				the field, or a prefix of it */
+	ulint		len,	/*!< in: length of buf, in bytes */
 	ulint		zip_size,/*!< in: compressed BLOB page size */
 	ulint		space_id,/*!< in: space id of the BLOB pages */
 	ulint		page_no,/*!< in: page number of the first BLOB page */
 	ulint		offset)	/*!< in: offset on the first BLOB page */
 {
-	ulint	page_type = FIL_PAGE_TYPE_ZBLOB;
+	ulint		page_type = FIL_PAGE_TYPE_ZBLOB;
+	mem_heap_t*	heap;
+	int		err;
+	z_stream	d_stream;
+
+	d_stream.next_out = buf;
+	d_stream.avail_out = len;
+	d_stream.next_in = Z_NULL;
+	d_stream.avail_in = 0;
+
+	/* Zlib inflate needs 32 kilobytes for the default
+	window size, plus a few kilobytes for small objects. */
+	heap = mem_heap_create(40000);
+	page_zip_set_alloc(&d_stream, heap);
 
 	ut_ad(ut_is_2pow(zip_size));
 	ut_ad(zip_size >= PAGE_ZIP_MIN_SIZE);
 	ut_ad(zip_size <= UNIV_PAGE_SIZE);
 	ut_ad(space_id);
 
+	err = inflateInit(&d_stream);
+	ut_a(err == Z_OK);
+
 	for (;;) {
 		buf_page_t*	bpage;
-		int		err;
 		ulint		next_page_no;
 
 		/* There is no latch on bpage directly.  Instead,
@@ -4941,7 +4959,7 @@ btr_copy_zblob_prefix(
 				" compressed BLOB"
 				" page %lu space %lu\n",
 				(ulong) page_no, (ulong) space_id);
-			return;
+			goto func_exit;
 		}
 
 		if (UNIV_UNLIKELY
@@ -4967,13 +4985,13 @@ btr_copy_zblob_prefix(
 			offset += 4;
 		}
 
-		d_stream->next_in = bpage->zip.data + offset;
-		d_stream->avail_in = zip_size - offset;
+		d_stream.next_in = bpage->zip.data + offset;
+		d_stream.avail_in = zip_size - offset;
 
-		err = inflate(d_stream, Z_NO_FLUSH);
+		err = inflate(&d_stream, Z_NO_FLUSH);
 		switch (err) {
 		case Z_OK:
-			if (!d_stream->avail_out) {
+			if (!d_stream.avail_out) {
 				goto end_of_blob;
 			}
 			break;
@@ -4990,13 +5008,13 @@ inflate_error:
 				" compressed BLOB"
 				" page %lu space %lu returned %d (%s)\n",
 				(ulong) page_no, (ulong) space_id,
-				err, d_stream->msg);
+				err, d_stream.msg);
 		case Z_BUF_ERROR:
 			goto end_of_blob;
 		}
 
 		if (next_page_no == FIL_NULL) {
-			if (!d_stream->avail_in) {
+			if (!d_stream.avail_in) {
 				ut_print_timestamp(stderr);
 				fprintf(stderr,
 					"  InnoDB: unexpected end of"
@@ -5005,7 +5023,7 @@ inflate_error:
 					(ulong) page_no,
 					(ulong) space_id);
 			} else {
-				err = inflate(d_stream, Z_FINISH);
+				err = inflate(&d_stream, Z_FINISH);
 				switch (err) {
 				case Z_STREAM_END:
 				case Z_BUF_ERROR:
@@ -5017,7 +5035,7 @@ inflate_error:
 
 end_of_blob:
 			buf_page_release_zip(bpage);
-			return;
+			goto func_exit;
 		}
 
 		buf_page_release_zip(bpage);
@@ -5029,6 +5047,12 @@ end_of_blob:
 		offset = FIL_PAGE_NEXT;
 		page_type = FIL_PAGE_TYPE_ZBLOB2;
 	}
+
+func_exit:
+	inflateEnd(&d_stream);
+	mem_heap_free(heap);
+	UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
+	return(d_stream.total_out);
 }
 
 /*******************************************************************//**
@@ -5054,28 +5078,8 @@ btr_copy_externally_stored_field_prefix_
 	}
 
 	if (UNIV_UNLIKELY(zip_size)) {
-		int		err;
-		z_stream	d_stream;
-		mem_heap_t*	heap;
-
-		/* Zlib inflate needs 32 kilobytes for the default
-		window size, plus a few kilobytes for small objects. */
-		heap = mem_heap_create(40000);
-		page_zip_set_alloc(&d_stream, heap);
-
-		err = inflateInit(&d_stream);
-		ut_a(err == Z_OK);
-
-		d_stream.next_out = buf;
-		d_stream.avail_out = len;
-		d_stream.avail_in = 0;
-
-		btr_copy_zblob_prefix(&d_stream, zip_size,
-				      space_id, page_no, offset);
-		inflateEnd(&d_stream);
-		mem_heap_free(heap);
-		UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
-		return(d_stream.total_out);
+		return(btr_copy_zblob_prefix(buf, len, zip_size,
+					     space_id, page_no, offset));
 	} else {
 		return(btr_copy_blob_prefix(buf, len, space_id,
 					    page_no, offset));

=== modified file 'storage/innobase/btr/btr0sea.c'
--- a/storage/innobase/btr/btr0sea.c	2011-02-18 16:16:09 +0000
+++ b/storage/innobase/btr/btr0sea.c	2011-02-28 14:02:27 +0000
@@ -1232,8 +1232,8 @@ btr_search_drop_page_hash_when_freed(
 	having to fear a deadlock. */
 
 	block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, NULL,
-				BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
-				&mtr);
+				 BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
+				 &mtr);
 	/* Because the buffer pool mutex was released by
 	buf_page_peek_if_search_hashed(), it is possible that the
 	block was removed from the buffer pool by another thread

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	2011-02-03 22:18:48 +0000
+++ b/storage/innobase/buf/buf0buf.c	2011-03-15 13:26:34 +0000
@@ -308,14 +308,14 @@ Gets the smallest oldest_modification ls
 zero if all modified pages have been flushed to disk.
 @return oldest modification in pool, zero if none */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 buf_pool_get_oldest_modification(void)
 /*==================================*/
 {
 	ulint		i;
 	buf_page_t*	bpage;
-	ib_uint64_t	lsn = 0;
-	ib_uint64_t	oldest_lsn = 0;
+	lsn_t		lsn = 0;
+	lsn_t		oldest_lsn = 0;
 
 	/* When we traverse all the flush lists we don't want another
 	thread to add a dirty page to any flush list. */
@@ -527,7 +527,7 @@ buf_page_is_corrupted(
 
 #ifndef UNIV_HOTBACKUP
 	if (recv_lsn_checks_on) {
-		ib_uint64_t	current_lsn;
+		lsn_t	current_lsn;
 
 		if (log_peek_lsn(&current_lsn)
 		    && UNIV_UNLIKELY
@@ -539,7 +539,7 @@ buf_page_is_corrupted(
 				"  InnoDB: Error: page %lu log sequence number"
 				" %llu\n"
 				"InnoDB: is in the future! Current system "
-				"log sequence number %llu.\n"
+				"log sequence number " LSN_PF ".\n"
 				"InnoDB: Your database may be corrupt or "
 				"you may have copied the InnoDB\n"
 				"InnoDB: tablespace but not the InnoDB "
@@ -1385,11 +1385,11 @@ buf_pool_drop_hash_index_instance(
 			/* block->is_hashed cannot be modified
 			when we have an x-latch on btr_search_latch;
 			see the comment in buf0buf.h */
-			
+
 			if (!block->is_hashed) {
 				continue;
 			}
-			
+
 			/* To follow the latching order, we
 			have to release btr_search_latch
 			before acquiring block->latch. */
@@ -1398,14 +1398,14 @@ buf_pool_drop_hash_index_instance(
 			we must rescan all blocks, because
 			some may become hashed again. */
 			*released_search_latch = TRUE;
-			
+
 			rw_lock_x_lock(&block->lock);
-			
+
 			/* This should be guaranteed by the
 			callers, which will be holding
 			btr_search_enabled_mutex. */
 			ut_ad(!btr_search_enabled);
-			
+
 			/* Because we did not buffer-fix the
 			block by calling buf_block_get_gen(),
 			it is possible that the block has been
@@ -1415,7 +1415,7 @@ buf_pool_drop_hash_index_instance(
 			block is mapped to.  All we want to do
 			is to drop any hash entries referring
 			to the page. */
-			
+
 			/* It is possible that
 			block->page.state != BUF_FILE_PAGE.
 			Even that does not matter, because
@@ -1423,18 +1423,18 @@ buf_pool_drop_hash_index_instance(
 			check block->is_hashed before doing
 			anything.  block->is_hashed can only
 			be set on uncompressed file pages. */
-			
+
 			btr_search_drop_page_hash_index(block);
-			
+
 			rw_lock_x_unlock(&block->lock);
-			
+
 			rw_lock_x_lock(&btr_search_latch);
-			
+
 			ut_ad(!btr_search_enabled);
 		}
 	}
 }
- 
+
 /********************************************************************//**
 Drops the adaptive hash index.  To prevent a livelock, this function
 is only to be called while holding btr_search_latch and while
@@ -2081,30 +2081,30 @@ buf_pool_resize(void)
 	ulint	min_change_size = 1048576 * srv_buf_pool_instances;
 
 	buf_pool_mutex_enter_all();
-  
+
   	if (srv_buf_pool_old_size == srv_buf_pool_size) {
-  
+
 		buf_pool_mutex_exit_all();
 
   		return;
 
   	} else if (srv_buf_pool_curr_size + min_change_size
 		   > srv_buf_pool_size) {
-  
+
 		change_size = (srv_buf_pool_curr_size - srv_buf_pool_size)
 			    / UNIV_PAGE_SIZE;
 
 		buf_pool_mutex_exit_all();
-  
+
   		/* Disable adaptive hash indexes and empty the index
   		in order to free up memory in the buffer pool chunks. */
 		buf_pool_shrink(change_size);
 
 	} else if (srv_buf_pool_curr_size + min_change_size
 		   < srv_buf_pool_size) {
- 
+
   		/* Enlarge the buffer pool by at least one megabyte */
-  
+
 		change_size = srv_buf_pool_size - srv_buf_pool_curr_size;
 
 		buf_pool_mutex_exit_all();
@@ -2117,10 +2117,10 @@ buf_pool_resize(void)
 
 		return;
 	}
-  
+
   	buf_pool_page_hash_rebuild();
 }
- 
+
 /****************************************************************//**
 Remove the sentinel block for the watch before replacing it with a real block.
 buf_page_watch_clear() or buf_page_watch_occurred() will notice that
@@ -2682,16 +2682,19 @@ buf_block_align_instance(
 	/* TODO: protect buf_pool->chunks with a mutex (it will
 	currently remain constant after buf_pool_init()) */
 	for (chunk = buf_pool->chunks, i = buf_pool->n_chunks; i--; chunk++) {
-		lint	offs = ptr - chunk->blocks->frame;
+		ulint	offs;
 
-		if (UNIV_UNLIKELY(offs < 0)) {
+		if (UNIV_UNLIKELY(ptr < chunk->blocks->frame)) {
 
 			continue;
 		}
+		/* else */
+
+		offs = ptr - chunk->blocks->frame;
 
 		offs >>= UNIV_PAGE_SIZE_SHIFT;
 
-		if (UNIV_LIKELY((ulint) offs < chunk->size)) {
+		if (UNIV_LIKELY(offs < chunk->size)) {
 			buf_block_t*	block = &chunk->blocks[offs];
 
 			/* The function buf_chunk_init() invokes
@@ -2866,7 +2869,7 @@ buf_page_get_gen(
 	ulint		rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
 	buf_block_t*	guess,	/*!< in: guessed block or NULL */
 	ulint		mode,	/*!< in: BUF_GET, BUF_GET_IF_IN_POOL,
-				BUF_GET_NO_LATCH, or
+				BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or
 				BUF_GET_IF_IN_POOL_OR_WATCH */
 	const char*	file,	/*!< in: file name */
 	ulint		line,	/*!< in: line where called */
@@ -2888,11 +2891,20 @@ buf_page_get_gen(
 	ut_ad((rw_latch == RW_S_LATCH)
 	      || (rw_latch == RW_X_LATCH)
 	      || (rw_latch == RW_NO_LATCH));
-	ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
-	ut_ad(mode == BUF_GET
-	      || mode == BUF_GET_IF_IN_POOL
-	      || mode == BUF_GET_NO_LATCH
-	      || mode == BUF_GET_IF_IN_POOL_OR_WATCH);
+#ifdef UNIV_DEBUG
+	switch (mode) {
+	case BUF_GET_NO_LATCH:
+		ut_ad(rw_latch == RW_NO_LATCH);
+		break;
+	case BUF_GET:
+	case BUF_GET_IF_IN_POOL:
+	case BUF_PEEK_IF_IN_POOL:
+	case BUF_GET_IF_IN_POOL_OR_WATCH:
+		break;
+	default:
+		ut_error;
+	}
+#endif /* UNIV_DEBUG */
 	ut_ad(zip_size == fil_space_get_zip_size(space));
 	ut_ad(ut_is_2pow(zip_size));
 #ifndef UNIV_LOG_DEBUG
@@ -2964,6 +2976,7 @@ loop2:
 		}
 
 		if (mode == BUF_GET_IF_IN_POOL
+		    || mode == BUF_PEEK_IF_IN_POOL
 		    || mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
 #ifdef UNIV_SYNC_DEBUG
 			ut_ad(!rw_lock_own(hash_lock, RW_LOCK_EX));
@@ -3017,7 +3030,8 @@ got_block:
 
 	must_read = buf_block_get_io_fix(block) == BUF_IO_READ;
 
-	if (must_read && mode == BUF_GET_IF_IN_POOL) {
+	if (must_read && (mode == BUF_GET_IF_IN_POOL
+			  || mode == BUF_PEEK_IF_IN_POOL)) {
 
 		/* The page is being read to buffer pool,
 		but we cannot wait around for the read to
@@ -3148,6 +3162,7 @@ wait_until_unfixed:
 		mutex_exit(&buf_pool->zip_mutex);
 		buf_pool->n_pend_unzip++;
 
+		bpage->state = BUF_BLOCK_ZIP_FREE;
 		buf_buddy_free(buf_pool, bpage, sizeof *bpage);
 
 		buf_pool_mutex_exit(buf_pool);
@@ -3273,7 +3288,9 @@ wait_until_unfixed:
 
 	access_time = buf_page_is_accessed(&block->page);
 
-	buf_page_set_accessed_make_young(&block->page, access_time);
+	if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
+		buf_page_set_accessed_make_young(&block->page, access_time);
+	}
 
 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
 	ut_a(!block->page.file_page_was_freed);
@@ -3326,7 +3343,7 @@ wait_until_unfixed:
 
 	mtr_memo_push(mtr, block, fix_type);
 
-	if (!access_time) {
+	if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) {
 		/* In the case of a first access, try to apply linear
 		read-ahead */
 
@@ -3938,6 +3955,7 @@ err_exit:
 				/* The block was added by some other thread. */
 				rw_lock_x_unlock(hash_lock);
 				watch_page = NULL;
+				bpage->state = BUF_BLOCK_ZIP_FREE;
 				buf_buddy_free(buf_pool, bpage, sizeof *bpage);
 				buf_buddy_free(buf_pool, data, zip_size);
 
@@ -5149,7 +5167,7 @@ buf_get_modified_ratio_pct(void)
 	buf_get_total_list_len(&lru_len, &free_len, &flush_list_len);
 
 	ratio = (100 * flush_list_len) / (1 + lru_len + free_len);
-  
+
 	/* 1 + is there to avoid division by zero */
 
 	return(ratio);

=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/buf/buf0flu.c	2011-03-14 15:03:04 +0000
@@ -295,7 +295,7 @@ buf_flush_insert_into_flush_list(
 /*=============================*/
 	buf_pool_t*	buf_pool,	/*!< buffer pool instance */
 	buf_block_t*	block,		/*!< in/out: block which is modified */
-	ib_uint64_t	lsn)		/*!< in: oldest modification */
+	lsn_t		lsn)		/*!< in: oldest modification */
 {
 	ut_ad(!buf_pool_mutex_own(buf_pool));
 	ut_ad(log_flush_order_mutex_own());
@@ -350,7 +350,7 @@ buf_flush_insert_sorted_into_flush_list(
 /*====================================*/
 	buf_pool_t*	buf_pool,	/*!< in: buffer pool instance */
 	buf_block_t*	block,		/*!< in/out: block which is modified */
-	ib_uint64_t	lsn)		/*!< in: oldest modification */
+	lsn_t		lsn)		/*!< in: oldest modification */
 {
 	buf_page_t*	prev_b;
 	buf_page_t*	b;
@@ -1009,10 +1009,10 @@ UNIV_INTERN
 void
 buf_flush_init_for_writing(
 /*=======================*/
-	byte*		page,		/*!< in/out: page */
-	void*		page_zip_,	/*!< in/out: compressed page, or NULL */
-	ib_uint64_t	newest_lsn)	/*!< in: newest modification lsn
-					to the page */
+	byte*	page,		/*!< in/out: page */
+	void*	page_zip_,	/*!< in/out: compressed page, or NULL */
+	lsn_t	newest_lsn)	/*!< in: newest modification lsn
+				to the page */
 {
 	ut_ad(page);
 
@@ -1620,7 +1620,7 @@ buf_flush_flush_list_batch(
 					of blocks flushed (it is not
 					guaranteed that the actual
 					number is that big, though) */
-	ib_uint64_t	lsn_limit)	/*!< all blocks whose
+	lsn_t		lsn_limit)	/*!< all blocks whose
 					oldest_modification is smaller
 					than this should be flushed (if
 					their number does not exceed
@@ -1733,7 +1733,7 @@ buf_flush_batch(
 	ulint		min_n,		/*!< in: wished minimum mumber of blocks
 					flushed (it is not guaranteed that the
 					actual number is that big, though) */
-	ib_uint64_t	lsn_limit)	/*!< in: in the case of BUF_FLUSH_LIST
+	lsn_t		lsn_limit)	/*!< in: in the case of BUF_FLUSH_LIST
 					all blocks whose oldest_modification is
 					smaller than this should be flushed
 					(if their number does not exceed
@@ -1940,7 +1940,7 @@ buf_flush_list(
 	ulint		min_n,		/*!< in: wished minimum mumber of blocks
 					flushed (it is not guaranteed that the
 					actual number is that big, though) */
-	ib_uint64_t	lsn_limit)	/*!< in the case BUF_FLUSH_LIST all
+	lsn_t		lsn_limit)	/*!< in the case BUF_FLUSH_LIST all
 					blocks whose oldest_modification is
 					smaller than this should be flushed
 					(if their number does not exceed
@@ -1998,7 +1998,7 @@ buf_flush_list(
 				page_count);
 	}
 
-	return(lsn_limit != IB_ULONGLONG_MAX && skipped
+	return(lsn_limit != LSN_MAX && skipped
 	       ? ULINT_UNDEFINED : total_page_count);
 }
  
@@ -2119,8 +2119,8 @@ buf_flush_stat_update(void)
 /*=======================*/
 {
 	buf_flush_stat_t*	item;
-	ib_uint64_t		lsn_diff;
-	ib_uint64_t		lsn;
+	lsn_t			lsn_diff;
+	lsn_t			lsn;
 	ulint			n_flushed;
 
 	lsn = log_get_lsn();
@@ -2168,14 +2168,13 @@ ulint
 buf_flush_get_desired_flush_rate(void)
 /*==================================*/
 {
-	lint		rate;
 	ulint		i;
-	ulint		redo_avg;
+	lsn_t		redo_avg;
 	ulint		n_dirty = 0;
-	ulint		n_flush_req;
-	ulint		lru_flush_avg;
-	ib_uint64_t	lsn = log_get_lsn();
-	ulint		log_capacity = log_get_capacity();
+	ib_uint64_t	n_flush_req;
+	ib_uint64_t	lru_flush_avg;
+	lsn_t		lsn = log_get_lsn();
+	lsn_t		log_capacity = log_get_capacity();
 
 	/* log_capacity should never be zero after the initialization
 	of log subsystem. */
@@ -2198,9 +2197,8 @@ buf_flush_get_desired_flush_rate(void)
 	/* redo_avg below is average at which redo is generated in
 	past BUF_FLUSH_STAT_N_INTERVAL + redo generated in the current
 	interval. */
-	redo_avg = (ulint) (buf_flush_stat_sum.redo
-			    / BUF_FLUSH_STAT_N_INTERVAL
-			    + (lsn - buf_flush_stat_cur.redo));
+	redo_avg = buf_flush_stat_sum.redo / BUF_FLUSH_STAT_N_INTERVAL
+		+ (lsn - buf_flush_stat_cur.redo);
 
 	/* An overflow can happen possibly if we flush more than 2^32
 	pages in BUF_FLUSH_STAT_N_INTERVAL. This is a very very
@@ -2221,11 +2219,14 @@ buf_flush_get_desired_flush_rate(void)
 	list is the difference between the required rate and the
 	number of pages that we are historically flushing from the
 	LRU list */
-	rate = n_flush_req - lru_flush_avg;
-	if (rate <= 0) {
+	if (n_flush_req <= lru_flush_avg) {
 		return(0);
 	} else {
-		return(ut_min(rate, PCT_IO(100)));
+		ib_uint64_t	rate;
+
+		rate = n_flush_req - lru_flush_avg;
+
+		return((ulint) (rate < PCT_IO(100) ? rate : PCT_IO(100)));
 	}
 }
 
@@ -2241,12 +2242,12 @@ page_cleaner_do_flush_batch(
 					we should attempt to flush. If
 					an lsn_limit is provided then
 					this value will have no affect */
-	ib_uint64_t	lsn_limit)	/*!< in: LSN up to which flushing
+	lsn_t		lsn_limit)	/*!< in: LSN up to which flushing
 					must happen */
 {
 	ulint n_flushed;
 
-	ut_ad(n_to_flush == ULINT_MAX || lsn_limit == IB_ULONGLONG_MAX);
+	ut_ad(n_to_flush == ULINT_MAX || lsn_limit == LSN_MAX);
 
 	n_flushed = buf_flush_list(n_to_flush, lsn_limit);
 	if (n_flushed == ULINT_UNDEFINED) {
@@ -2273,8 +2274,8 @@ ulint
 page_cleaner_flush_pages_if_needed(void)
 /*====================================*/
 {
-	ulint		n_pages_flushed = 0;
-	ib_uint64_t	lsn_limit = log_async_flush_lsn();
+	ulint	n_pages_flushed = 0;
+	lsn_t	lsn_limit = log_async_flush_lsn();
 
 	/* Currently we decide whether or not to flush and how much to
 	flush based on three factors.
@@ -2294,7 +2295,7 @@ page_cleaner_flush_pages_if_needed(void)
 	or 2 has occurred above then we flush a batch based on our
 	heuristics. */
 
-	if (lsn_limit != IB_ULONGLONG_MAX) {
+	if (lsn_limit != LSN_MAX) {
 
 		/* async flushing is requested */
 		n_pages_flushed = page_cleaner_do_flush_batch(ULINT_MAX,
@@ -2312,7 +2313,7 @@ page_cleaner_flush_pages_if_needed(void)
 		buffer pool under the limit wished by the user */
 
 		n_pages_flushed += page_cleaner_do_flush_batch(PCT_IO(100),
-							 IB_ULONGLONG_MAX);
+							       LSN_MAX);
 		MONITOR_INC(MONITOR_NUM_MAX_DIRTY_FLUSHES);
 		MONITOR_SET(MONITOR_FLUSH_MAX_DIRTY_PAGES, n_pages_flushed);
 	}
@@ -2328,7 +2329,7 @@ page_cleaner_flush_pages_if_needed(void)
 		if (n_flush) {
 			n_pages_flushed = page_cleaner_do_flush_batch(
 							n_flush,
-							IB_ULONGLONG_MAX);
+							LSN_MAX);
 
 			MONITOR_INC(MONITOR_NUM_ADAPTIVE_FLUSHES);
 			MONITOR_SET(MONITOR_FLUSH_ADAPTIVE_PAGES,
@@ -2406,7 +2407,7 @@ buf_flush_page_cleaner_thread(
 		} else {
 			n_flushed = page_cleaner_do_flush_batch(
 							PCT_IO(100),
-							IB_ULONGLONG_MAX);
+							LSN_MAX);
 		}
 	}
 
@@ -2430,8 +2431,7 @@ buf_flush_page_cleaner_thread(
 	dirtied until we enter SRV_SHUTDOWN_FLUSH_PHASE phase. */
 
 	do {
-		n_flushed = page_cleaner_do_flush_batch(PCT_IO(100),
-							IB_ULONGLONG_MAX);
+		n_flushed = page_cleaner_do_flush_batch(PCT_IO(100), LSN_MAX);
 
 		/* We sleep only if there are no pages to flush */
 		if (n_flushed == 0) {
@@ -2454,8 +2454,7 @@ buf_flush_page_cleaner_thread(
 	buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
 	do {
 
-		n_flushed = buf_flush_list(PCT_IO(100),
-						 IB_ULONGLONG_MAX);
+		n_flushed = buf_flush_list(PCT_IO(100), LSN_MAX);
 		buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
 
 	} while (n_flushed > 0);
@@ -2508,7 +2507,7 @@ buf_flush_validate_low(
 	}
 
 	while (bpage != NULL) {
-		const ib_uint64_t om = bpage->oldest_modification;
+		const lsn_t	om = bpage->oldest_modification;
 
 		ut_ad(buf_pool_from_bpage(bpage) == buf_pool);
 

=== modified file 'storage/innobase/buf/buf0lru.c'
--- a/storage/innobase/buf/buf0lru.c	2011-02-03 22:18:48 +0000
+++ b/storage/innobase/buf/buf0lru.c	2011-02-28 14:02:27 +0000
@@ -251,74 +251,78 @@ buf_LRU_drop_page_hash_for_tablespace(
 		sizeof(ulint) * BUF_LRU_DROP_SEARCH_HASH_SIZE);
 
 	buf_pool_mutex_enter(buf_pool);
+	num_entries = 0;
 
 scan_again:
-	num_entries = 0;
 	bpage = UT_LIST_GET_LAST(buf_pool->LRU);
 
 	while (bpage != NULL) {
-		mutex_t*	block_mutex = buf_page_get_mutex(bpage);
 		buf_page_t*	prev_bpage;
+		ibool		is_fixed;
 
-		mutex_enter(block_mutex);
 		prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
 
 		ut_a(buf_page_in_file(bpage));
 
 		if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE
 		    || bpage->space != id
-		    || bpage->buf_fix_count > 0
 		    || bpage->io_fix != BUF_IO_NONE) {
-			/* We leave the fixed pages as is in this scan.
-			To be dealt with later in the final scan. */
-			mutex_exit(block_mutex);
-			goto next_page;
+			/* Compressed pages are never hashed.
+			Skip blocks of other tablespaces.
+			Skip I/O-fixed blocks (to be dealt with later). */
+next_page:
+			bpage = prev_bpage;
+			continue;
 		}
 
-		if (((buf_block_t*) bpage)->is_hashed) {
+		mutex_enter(&((buf_block_t*) bpage)->mutex);
+		is_fixed = bpage->buf_fix_count > 0
+			|| !((buf_block_t*) bpage)->is_hashed;
+		mutex_exit(&((buf_block_t*) bpage)->mutex);
 
-			/* Store the offset(i.e.: page_no) in the array
-			so that we can drop hash index in a batch
-			later. */
-			page_arr[num_entries] = bpage->offset;
-			mutex_exit(block_mutex);
-			ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
-			++num_entries;
+		if (is_fixed) {
+			goto next_page;
+		}
 
-			if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
-				goto next_page;
-			}
+		/* Store the page number so that we can drop the hash
+		index in a batch later. */
+		page_arr[num_entries] = bpage->offset;
+		ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
+		++num_entries;
 
-			/* Array full. We release the buf_pool->mutex to
-			obey the latching order. */
-			buf_pool_mutex_exit(buf_pool);
+		if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
+			goto next_page;
+		}
 
-			buf_LRU_drop_page_hash_batch(
-				id, zip_size, page_arr, num_entries);
+		/* Array full. We release the buf_pool->mutex to obey
+		the latching order. */
+		buf_pool_mutex_exit(buf_pool);
 
-			num_entries = 0;
+		buf_LRU_drop_page_hash_batch(
+			id, zip_size, page_arr, num_entries);
 
-			buf_pool_mutex_enter(buf_pool);
-		} else {
-			mutex_exit(block_mutex);
-		}
+		num_entries = 0;
 
-next_page:
-		/* Note that we may have released the buf_pool mutex
-		above after reading the prev_bpage during processing
-		of a page_hash_batch (i.e.: when the array was full).
-		This means that prev_bpage can change in LRU list.
-		This is OK because this function is a 'best effort'
-		to drop as many search hash entries as possible and
-		it does not guarantee that ALL such entries will be
-		dropped. */
-		bpage = prev_bpage;
+		buf_pool_mutex_enter(buf_pool);
+
+		/* Note that we released the buf_pool mutex above
+		after reading the prev_bpage during processing of a
+		page_hash_batch (i.e.: when the array was full).
+		Because prev_bpage could belong to a compressed-only
+		block, it may have been relocated, and thus the
+		pointer cannot be trusted. Because bpage is of type
+		buf_block_t, it is safe to dereference.
+
+		bpage can change in the LRU list. This is OK because
+		this function is a 'best effort' to drop as many
+		search hash entries as possible and it does not
+		guarantee that ALL such entries will be dropped. */
 
 		/* If, however, bpage has been removed from LRU list
 		to the free list then we should restart the scan.
 		bpage->state is protected by buf_pool mutex. */
-		if (bpage && !buf_page_in_file(bpage)) {
-			ut_a(num_entries == 0);
+		if (bpage
+		    && buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
 			goto scan_again;
 		}
 	}
@@ -1957,6 +1961,7 @@ buf_LRU_block_remove_hashed_page(
 			buf_pool, bpage->zip.data,
 			page_zip_get_size(&bpage->zip));
 
+		bpage->state = BUF_BLOCK_ZIP_FREE;
 		buf_buddy_free(buf_pool, bpage, sizeof(*bpage));
 		buf_pool_mutex_exit_allow(buf_pool);
 

=== modified file 'storage/innobase/dict/dict0load.c'
--- a/storage/innobase/dict/dict0load.c	2011-02-10 09:16:50 +0000
+++ b/storage/innobase/dict/dict0load.c	2011-03-07 16:11:09 +0000
@@ -2262,10 +2262,12 @@ loop:
 	/* Since table names in SYS_FOREIGN are stored in a case-insensitive
 	order, we have to check that the table name matches also in a binary
 	string comparison. On Unix, MySQL allows table names that only differ
-	in character case. */
-
-	if (0 != ut_memcmp(field, table_name, len)) {
+	in character case.  If lower_case_table_names=2 then what is stored
+	may not be the same case, but the previous comparison showed that they
+	match with no-case.  */
 
+	if ((srv_lower_case_table_names != 2)
+	    && (0 != ut_memcmp(field, table_name, len))) {
 		goto next_rec;
 	}
 

=== modified file 'storage/innobase/dict/dict0stats.c'
--- a/storage/innobase/dict/dict0stats.c	2011-02-09 09:27:12 +0000
+++ b/storage/innobase/dict/dict0stats.c	2011-03-15 14:33:31 +0000
@@ -238,11 +238,11 @@ dict_stats_persistent_storage_check(
 {
 	/* definition for the table TABLE_STATS_NAME */
 	dict_col_meta_t	table_stats_columns[] = {
-		{"database_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 512},
+		{"database_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 192 /* NAME_LEN from mysql_com.h */},
 
-		{"table_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 512},
+		{"table_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 192 /* NAME_LEN from mysql_com.h */},
 
 		{"stats_timestamp", DATA_INT,
 			DATA_NOT_NULL | DATA_UNSIGNED, 4},
@@ -264,20 +264,20 @@ dict_stats_persistent_storage_check(
 
 	/* definition for the table INDEX_STATS_NAME */
 	dict_col_meta_t	index_stats_columns[] = {
-		{"database_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 512},
+		{"database_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 192 /* NAME_LEN from mysql_com.h */},
 
-		{"table_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 512},
+		{"table_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 192 /* NAME_LEN from mysql_com.h */},
 
-		{"index_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 512},
+		{"index_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 192 /* NAME_LEN from mysql_com.h */},
 
 		{"stat_timestamp", DATA_INT,
 			DATA_NOT_NULL | DATA_UNSIGNED, 4},
 
-		{"stat_name", DATA_VARCHAR,
-			DATA_NOT_NULL, 64},
+		{"stat_name", DATA_VARMYSQL,
+			DATA_NOT_NULL, 64*3},
 
 		{"stat_value", DATA_INT,
 			DATA_NOT_NULL | DATA_UNSIGNED, 8},
@@ -285,8 +285,8 @@ dict_stats_persistent_storage_check(
 		{"sample_size", DATA_INT,
 			DATA_UNSIGNED, 8},
 
-		{"stat_description", DATA_VARCHAR,
-			DATA_NOT_NULL, 1024}
+		{"stat_description", DATA_VARMYSQL,
+			DATA_NOT_NULL, 1024*3}
 	};
 	dict_table_schema_t	index_stats_schema = {
 		INDEX_STATS_NAME,

=== modified file 'storage/innobase/fil/fil0fil.c'
--- a/storage/innobase/fil/fil0fil.c	2010-12-01 08:52:55 +0000
+++ b/storage/innobase/fil/fil0fil.c	2011-03-09 07:32:36 +0000
@@ -1726,11 +1726,11 @@ static
 ulint
 fil_write_lsn_and_arch_no_to_file(
 /*==============================*/
-	ulint		sum_of_sizes,	/*!< in: combined size of previous files
-					in space, in database pages */
-	ib_uint64_t	lsn,		/*!< in: lsn to write */
-	ulint		arch_log_no __attribute__((unused)))
-					/*!< in: archived log number to write */
+	ulint	sum_of_sizes,	/*!< in: combined size of previous files
+				in space, in database pages */
+	lsn_t	lsn,		/*!< in: lsn to write */
+	ulint	arch_log_no __attribute__((unused)))
+				/*!< in: archived log number to write */
 {
 	byte*	buf1;
 	byte*	buf;
@@ -1757,9 +1757,8 @@ UNIV_INTERN
 ulint
 fil_write_flushed_lsn_to_data_files(
 /*================================*/
-	ib_uint64_t	lsn,		/*!< in: lsn to write */
-	ulint		arch_log_no)	/*!< in: latest archived log
-					file number */
+	lsn_t	lsn,		/*!< in: lsn to write */
+	ulint	arch_log_no)	/*!< in: latest archived log file number */
 {
 	fil_space_t*	space;
 	fil_node_t*	node;
@@ -1821,12 +1820,12 @@ fil_read_flushed_lsn_and_arch_log_no(
 	ulint*		min_arch_log_no,	/*!< in/out: */
 	ulint*		max_arch_log_no,	/*!< in/out: */
 #endif /* UNIV_LOG_ARCHIVE */
-	ib_uint64_t*	min_flushed_lsn,	/*!< in/out: */
-	ib_uint64_t*	max_flushed_lsn)	/*!< in/out: */
+	lsn_t*		min_flushed_lsn,	/*!< in/out: */
+	lsn_t*		max_flushed_lsn)	/*!< in/out: */
 {
-	byte*		buf;
-	byte*		buf2;
-	ib_uint64_t	flushed_lsn;
+	byte*	buf;
+	byte*	buf2;
+	lsn_t	flushed_lsn;
 
 	buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
 	/* Align the memory for a possible read from a raw device */
@@ -2878,7 +2877,7 @@ fil_reset_too_high_lsns(
 /*====================*/
 	const char*	name,		/*!< in: table name in the
 					databasename/tablename format */
-	ib_uint64_t	current_lsn)	/*!< in: reset lsn's if the lsn stamped
+	lsn_t		current_lsn)	/*!< in: reset lsn's if the lsn stamped
 					to FIL_PAGE_FILE_FLUSH_LSN in the
 					first page is too high */
 {
@@ -2886,7 +2885,7 @@ fil_reset_too_high_lsns(
 	char*		filepath;
 	byte*		page;
 	byte*		buf2;
-	ib_uint64_t	flush_lsn;
+	lsn_t		flush_lsn;
 	ulint		space_id;
 	ib_int64_t	file_size;
 	ib_int64_t	offset;
@@ -2951,8 +2950,8 @@ fil_reset_too_high_lsns(
 	fprintf(stderr,
 		"  InnoDB: Flush lsn in the tablespace file %lu"
 		" to be imported\n"
-		"InnoDB: is %llu, which exceeds current"
-		" system lsn %llu.\n"
+		"InnoDB: is " LSN_PF ", which exceeds current"
+		" system lsn " LSN_PF ".\n"
 		"InnoDB: We reset the lsn's in the file ",
 		(ulong) space_id,
 		flush_lsn, current_lsn);

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-03-11 09:35:38 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-03-17 11:33:17 +0000
@@ -42,6 +42,7 @@ this program; if not, write to the Free
 #include <mysql/plugin.h>
 #include <mysql/innodb_priv.h>
 #include <mysql/psi/psi.h>
+#include <my_sys.h>
 
 /** @file ha_innodb.cc */
 
@@ -453,7 +454,7 @@ static SHOW_VAR innodb_status_variables[
   {"os_log_pending_writes",
   (char*) &export_vars.innodb_os_log_pending_writes,	  SHOW_LONG},
   {"os_log_written",
-  (char*) &export_vars.innodb_os_log_written,		  SHOW_LONG},
+  (char*) &export_vars.innodb_os_log_written,		  SHOW_LONGLONG},
   {"page_size",
   (char*) &export_vars.innodb_page_size,		  SHOW_LONG},
   {"pages_created",
@@ -1323,6 +1324,20 @@ innobase_wildcasecmp(
 }
 
 /******************************************************************//**
+Strip dir name from a full path name and return only the file name
+@return file name or "null" if no file name */
+extern "C" UNIV_INTERN
+const char*
+innobase_basename(
+/*==============*/
+	const char*	path_name)	/*!< in: full path name */
+{
+	const char*	name = base_name(path_name);
+
+	return((name) ? name : "null");
+}
+
+/******************************************************************//**
 Makes all characters in a NUL-terminated UTF-8 string lower case. */
 extern "C" UNIV_INTERN
 void
@@ -2421,14 +2436,6 @@ innobase_init(
 
 			goto error;
 		}
-
-		if (innobase_log_file_size > UINT_MAX32) {
-			sql_print_error(
-				"innobase_log_file_size can't be over 4GB"
-				" on 32-bit systems");
-
-			goto error;
-		}
 	}
 
 	os_innodb_umask = (ulint)my_umask;
@@ -2602,7 +2609,7 @@ innobase_change_buffering_inited_ok:
 
 	srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
 	srv_n_log_files = (ulint) innobase_log_files_in_group;
-	srv_log_file_size = (ulint) innobase_log_file_size;
+	srv_log_file_size = (ib_uint64_t) innobase_log_file_size;
 
 #ifdef UNIV_LOG_ARCHIVE
 	srv_log_archive_on = (ulint) innobase_log_archive;
@@ -9759,7 +9766,8 @@ innodb_mutex_show_status(
 			if (mutex->count_using > 0) {
 				buf1len= my_snprintf(buf1, sizeof(buf1),
 					"%s:%s",
-					mutex->cmutex_name, mutex->cfile_name);
+					mutex->cmutex_name,
+					innobase_basename(mutex->cfile_name));
 				buf2len= my_snprintf(buf2, sizeof(buf2),
 					"count=%lu, spin_waits=%lu,"
 					" spin_rounds=%lu, "
@@ -9789,7 +9797,8 @@ innodb_mutex_show_status(
 		}
 #else /* UNIV_DEBUG */
 		buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu",
-				     mutex->cfile_name, (ulong) mutex->cline);
+				     innobase_basename(mutex->cfile_name),
+				     (ulong) mutex->cline);
 		buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
 				     (ulong) mutex->count_os_wait);
 
@@ -9805,7 +9814,8 @@ innodb_mutex_show_status(
 	if (block_mutex) {
 		buf1len = (uint) my_snprintf(buf1, sizeof buf1,
 					     "combined %s:%lu",
-					     block_mutex->cfile_name,
+					     innobase_basename(
+						block_mutex->cfile_name),
 					     (ulong) block_mutex->cline);
 		buf2len = (uint) my_snprintf(buf2, sizeof buf2,
 					     "os_waits=%lu",
@@ -9836,7 +9846,8 @@ innodb_mutex_show_status(
 		}
 
 		buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu",
-				     lock->cfile_name, (ulong) lock->cline);
+				     innobase_basename(lock->cfile_name),
+				     (ulong) lock->cline);
 		buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
 				      (ulong) lock->count_os_wait);
 
@@ -9851,7 +9862,8 @@ innodb_mutex_show_status(
 	if (block_lock) {
 		buf1len = (uint) my_snprintf(buf1, sizeof buf1,
 					     "combined %s:%lu",
-					     block_lock->cfile_name,
+					     innobase_basename(
+						block_lock->cfile_name),
 					     (ulong) block_lock->cline);
 		buf2len = (uint) my_snprintf(buf2, sizeof buf2,
 					     "os_waits=%lu",
@@ -12509,7 +12521,7 @@ mysql_declare_plugin(innobase)
   MYSQL_STORAGE_ENGINE_PLUGIN,
   &innobase_storage_engine,
   innobase_hton_name,
-  "Innobase Oy",
+  plugin_author,
   "Supports transactions, row-level locking, and foreign keys",
   PLUGIN_LICENSE_GPL,
   innobase_init, /* Plugin Init */

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	2011-02-18 13:00:57 +0000
+++ b/storage/innobase/handler/i_s.cc	2011-03-09 07:32:36 +0000
@@ -52,8 +52,6 @@ extern "C" {
 #include "page0zip.h"
 }
 
-static const char plugin_author[] = "Oracle Corporation";
-
 /** structure associates a name string with a file page type and/or buffer
 page state. */
 struct buffer_page_desc_str_struct{
@@ -123,9 +121,9 @@ struct buffer_page_info_struct{
 					/*!< Number of records on Page */
 	unsigned	data_size:UNIV_PAGE_SIZE_SHIFT;
 					/*!< Sum of the sizes of the records */
-	ib_uint64_t	newest_mod;	/*!< Log sequence number of
+	lsn_t		newest_mod;	/*!< Log sequence number of
 					the youngest modification */
-	ib_uint64_t	oldest_mod;	/*!< Log sequence number of
+	lsn_t		oldest_mod;	/*!< Log sequence number of
 					the oldest modification */
 	index_id_t	index_id;	/*!< Index ID if a index page */
 };
@@ -1149,7 +1147,7 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* plugin author (for SHOW PLUGINS) */
 	/* const char* */
-	STRUCT_FLD(author, "Innobase Oy"),
+	STRUCT_FLD(author, plugin_author),
 
 	/* general descriptive text (for SHOW PLUGINS) */
 	/* const char* */
@@ -2347,7 +2345,7 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 
 	/* plugin author (for SHOW PLUGINS) */
 	/* const char* */
-	STRUCT_FLD(author, "Oracle and/or its affiliates."),
+	STRUCT_FLD(author, plugin_author),
 
 	/* general descriptive text (for SHOW PLUGINS) */
 	/* const char* */

=== modified file 'storage/innobase/handler/i_s.h'
--- a/storage/innobase/handler/i_s.h	2010-12-14 15:05:11 +0000
+++ b/storage/innobase/handler/i_s.h	2011-02-28 09:31:25 +0000
@@ -26,6 +26,8 @@ Created July 18, 2007 Vasil Dimov
 #ifndef i_s_h
 #define i_s_h
 
+const char plugin_author[] = "Oracle Corporation";
+
 extern struct st_mysql_plugin	i_s_innodb_trx;
 extern struct st_mysql_plugin	i_s_innodb_locks;
 extern struct st_mysql_plugin	i_s_innodb_lock_waits;

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	2011-02-03 22:18:48 +0000
+++ b/storage/innobase/include/buf0buf.h	2011-03-09 07:32:36 +0000
@@ -36,11 +36,14 @@ Created 11/5/1995 Heikki Tuuri
 #ifndef UNIV_HOTBACKUP
 #include "ut0rbt.h"
 #include "os0proc.h"
+#include "log0log.h"
 
 /** @name Modes for buf_page_get_gen */
 /* @{ */
 #define BUF_GET			10	/*!< get always */
 #define	BUF_GET_IF_IN_POOL	11	/*!< get if in pool */
+#define BUF_PEEK_IF_IN_POOL	12	/*!< get if in pool, do not make
+					the block young in the LRU list */
 #define BUF_GET_NO_LATCH	14	/*!< get and bufferfix, but
 					set no latch; we have
 					separated this case, because
@@ -271,7 +274,7 @@ Gets the smallest oldest_modification ls
 zero if all modified pages have been flushed to disk.
 @return	oldest modification in pool, zero if none */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 buf_pool_get_oldest_modification(void);
 /*==================================*/
 /********************************************************************//**
@@ -401,7 +404,7 @@ buf_page_get_gen(
 	ulint		rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
 	buf_block_t*	guess,	/*!< in: guessed block or NULL */
 	ulint		mode,	/*!< in: BUF_GET, BUF_GET_IF_IN_POOL,
-				BUF_GET_NO_LATCH or
+				BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH or
 				BUF_GET_IF_IN_POOL_OR_WATCH */
 	const char*	file,	/*!< in: file name */
 	ulint		line,	/*!< in: line where called */
@@ -556,7 +559,7 @@ Gets the youngest modification log seque
 Returns zero if not file page or no modification occurred yet.
 @return	newest modification to page */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 buf_page_get_newest_modification(
 /*=============================*/
 	const buf_page_t*	bpage);	/*!< in: block containing the
@@ -1445,13 +1448,13 @@ struct buf_page_struct{
 					should hold: in_free_list
 					== (state == BUF_BLOCK_NOT_USED) */
 #endif /* UNIV_DEBUG */
-	ib_uint64_t	newest_modification;
+	lsn_t		newest_modification;
 					/*!< log sequence number of
 					the youngest modification to
 					this block, zero if not
 					modified. Protected by block
 					mutex */
-	ib_uint64_t	oldest_modification;
+	lsn_t		oldest_modification;
 					/*!< log sequence number of
 					the START of the log entry
 					written of the oldest

=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic	2011-01-25 09:24:38 +0000
+++ b/storage/innobase/include/buf0buf.ic	2011-03-09 07:32:36 +0000
@@ -822,13 +822,13 @@ Gets the youngest modification log seque
 Returns zero if not file page or no modification occurred yet.
 @return	newest modification to page */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 buf_page_get_newest_modification(
 /*=============================*/
 	const buf_page_t*	bpage)	/*!< in: block containing the
 					page frame */
 {
-	ib_uint64_t	lsn;
+	lsn_t		lsn;
 	mutex_t*	block_mutex = buf_page_get_mutex(bpage);
 
 	mutex_enter(block_mutex);

=== modified file 'storage/innobase/include/buf0flu.h'
--- a/storage/innobase/include/buf0flu.h	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/include/buf0flu.h	2011-03-09 07:32:36 +0000
@@ -82,10 +82,10 @@ UNIV_INTERN
 void
 buf_flush_init_for_writing(
 /*=======================*/
-	byte*		page,		/*!< in/out: page */
-	void*		page_zip_,	/*!< in/out: compressed page, or NULL */
-	ib_uint64_t	newest_lsn);	/*!< in: newest modification lsn
-					to the page */
+	byte*	page,		/*!< in/out: page */
+	void*	page_zip_,	/*!< in/out: compressed page, or NULL */
+	lsn_t	newest_lsn);	/*!< in: newest modification lsn
+				to the page */
 #ifndef UNIV_HOTBACKUP
 # if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
 /********************************************************************//**
@@ -130,7 +130,7 @@ buf_flush_list(
 	ulint		min_n,		/*!< in: wished minimum mumber of blocks
 					flushed (it is not guaranteed that the
 					actual number is that big, though) */
-	ib_uint64_t	lsn_limit);	/*!< in the case BUF_FLUSH_LIST all
+	lsn_t		lsn_limit);	/*!< in the case BUF_FLUSH_LIST all
 					blocks whose oldest_modification is
 					smaller than this should be flushed
 					(if their number does not exceed
@@ -172,9 +172,9 @@ void
 buf_flush_recv_note_modification(
 /*=============================*/
 	buf_block_t*	block,		/*!< in: block which is modified */
-	ib_uint64_t	start_lsn,	/*!< in: start lsn of the first mtr in a
+	lsn_t		start_lsn,	/*!< in: start lsn of the first mtr in a
 					set of mtr's */
-	ib_uint64_t	end_lsn);	/*!< in: end lsn of the last mtr in the
+	lsn_t		end_lsn);	/*!< in: end lsn of the last mtr in the
 					set of mtr's */
 /********************************************************************//**
 Returns TRUE if the file page block is immediately suitable for replacement,
@@ -198,8 +198,8 @@ how much redo the workload is generating
 
 struct buf_flush_stat_struct
 {
-	ib_uint64_t	redo;		/**< amount of redo generated. */
-	ulint		n_flushed;	/**< number of pages flushed. */
+	lsn_t	redo;		/**< amount of redo generated. */
+	ulint	n_flushed;	/**< number of pages flushed. */
 };
 
 /** Statistics for selecting flush rate of dirty pages. */

=== modified file 'storage/innobase/include/buf0flu.ic'
--- a/storage/innobase/include/buf0flu.ic	2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/buf0flu.ic	2011-03-09 07:32:36 +0000
@@ -35,7 +35,7 @@ buf_flush_insert_into_flush_list(
 /*=============================*/
 	buf_pool_t*	buf_pool,	/*!< buffer pool instance */
 	buf_block_t*	block,		/*!< in/out: block which is modified */
-	ib_uint64_t	lsn);		/*!< in: oldest modification */
+	lsn_t		lsn);		/*!< in: oldest modification */
 /********************************************************************//**
 Inserts a modified block into the flush list in the right sorted position.
 This function is used by recovery, because there the modifications do not
@@ -46,7 +46,7 @@ buf_flush_insert_sorted_into_flush_list(
 /*====================================*/
 	buf_pool_t*	buf_pool,	/*!< buffer pool instance */
 	buf_block_t*	block,		/*!< in/out: block which is modified */
-	ib_uint64_t	lsn);		/*!< in: oldest modification */
+	lsn_t		lsn);		/*!< in: oldest modification */
 
 /********************************************************************//**
 This function should be called at a mini-transaction commit, if a page was
@@ -99,9 +99,9 @@ void
 buf_flush_recv_note_modification(
 /*=============================*/
 	buf_block_t*	block,		/*!< in: block which is modified */
-	ib_uint64_t	start_lsn,	/*!< in: start lsn of the first mtr in a
+	lsn_t		start_lsn,	/*!< in: start lsn of the first mtr in a
 					set of mtr's */
-	ib_uint64_t	end_lsn)	/*!< in: end lsn of the last mtr in the
+	lsn_t		end_lsn)	/*!< in: end lsn of the last mtr in the
 					set of mtr's */
 {
 	buf_pool_t*	buf_pool = buf_pool_from_block(block);

=== modified file 'storage/innobase/include/data0type.ic'
--- a/storage/innobase/include/data0type.ic	2010-10-12 14:49:38 +0000
+++ b/storage/innobase/include/data0type.ic	2011-03-15 14:33:31 +0000
@@ -473,9 +473,11 @@ dtype_sql_name(
 		ut_snprintf(name, name_sz, "BINARY(%u)", len);
 		break;
 	case DATA_CHAR:
+	case DATA_MYSQL:
 		ut_snprintf(name, name_sz, "CHAR(%u)", len);
 		break;
 	case DATA_VARCHAR:
+	case DATA_VARMYSQL:
 		ut_snprintf(name, name_sz, "VARCHAR(%u)", len);
 		break;
 	case DATA_BINARY:

=== modified file 'storage/innobase/include/fil0fil.h'
--- a/storage/innobase/include/fil0fil.h	2010-12-10 15:37:43 +0000
+++ b/storage/innobase/include/fil0fil.h	2011-03-09 07:32:36 +0000
@@ -33,6 +33,7 @@ Created 10/25/1995 Heikki Tuuri
 #ifndef UNIV_HOTBACKUP
 #include "sync0rw.h"
 #include "ibuf0types.h"
+#include "log0log.h"
 #endif /* !UNIV_HOTBACKUP */
 
 /** When mysqld is run, the default directory "." is the mysqld datadir,
@@ -324,9 +325,8 @@ UNIV_INTERN
 ulint
 fil_write_flushed_lsn_to_data_files(
 /*================================*/
-	ib_uint64_t	lsn,		/*!< in: lsn to write */
-	ulint		arch_log_no);	/*!< in: latest archived log
-					file number */
+	lsn_t	lsn,		/*!< in: lsn to write */
+	ulint	arch_log_no);	/*!< in: latest archived log file number */
 /*******************************************************************//**
 Reads the flushed lsn and arch no fields from a data file at database
 startup. */
@@ -342,8 +342,8 @@ fil_read_flushed_lsn_and_arch_log_no(
 	ulint*		min_arch_log_no,	/*!< in/out: */
 	ulint*		max_arch_log_no,	/*!< in/out: */
 #endif /* UNIV_LOG_ARCHIVE */
-	ib_uint64_t*	min_flushed_lsn,	/*!< in/out: */
-	ib_uint64_t*	max_flushed_lsn);	/*!< in/out: */
+	lsn_t*		min_flushed_lsn,	/*!< in/out: */
+	lsn_t*		max_flushed_lsn);	/*!< in/out: */
 /*******************************************************************//**
 Increments the count of pending insert buffer page merges, if space is not
 being deleted.
@@ -495,7 +495,7 @@ fil_reset_too_high_lsns(
 /*====================*/
 	const char*	name,		/*!< in: table name in the
 					databasename/tablename format */
-	ib_uint64_t	current_lsn);	/*!< in: reset lsn's if the lsn stamped
+	lsn_t		current_lsn);	/*!< in: reset lsn's if the lsn stamped
 					to FIL_PAGE_FILE_FLUSH_LSN in the
 					first page is too high */
 #endif /* !UNIV_HOTBACKUP */

=== modified file 'storage/innobase/include/ha_prototypes.h'
--- a/storage/innobase/include/ha_prototypes.h	2010-12-02 10:31:19 +0000
+++ b/storage/innobase/include/ha_prototypes.h	2011-02-25 09:27:27 +0000
@@ -185,6 +185,15 @@ innobase_wildcasecmp(
 	const char*	b);	/*!< in: wildcard string to compare */
 
 /******************************************************************//**
+Strip dir name from a full path name and return only its file name.
+@return file name or "null" if no file name */
+UNIV_INTERN
+const char*
+innobase_basename(
+/*==============*/
+	const char*	path_name);	/*!< in: full path name */
+
+/******************************************************************//**
 Returns true if the thread is executing a SELECT statement.
 @return	true if thd is executing SELECT */
 

=== modified file 'storage/innobase/include/log0log.h'
--- a/storage/innobase/include/log0log.h	2010-12-02 17:10:06 +0000
+++ b/storage/innobase/include/log0log.h	2011-03-09 07:32:36 +0000
@@ -41,6 +41,11 @@ Created 12/9/1995 Heikki Tuuri
 #include "sync0rw.h"
 #endif /* !UNIV_HOTBACKUP */
 
+/* Type used for all log sequence number storage and arithmetics */
+typedef	ib_uint64_t		lsn_t;
+#define LSN_MAX			IB_UINT64_MAX
+#define LSN_PF			"%llu"
+
 /** Redo log buffer */
 typedef struct log_struct	log_t;
 /** Redo log group */
@@ -98,12 +103,12 @@ Writes to the log the string given. The
 log_release.
 @return	end lsn of the log record, zero if did not succeed */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 log_reserve_and_write_fast(
 /*=======================*/
 	const void*	str,	/*!< in: string */
 	ulint		len,	/*!< in: string length */
-	ib_uint64_t*	start_lsn);/*!< out: start lsn of the log record */
+	lsn_t*		start_lsn);/*!< out: start lsn of the log record */
 /***********************************************************************//**
 Releases the log mutex. */
 UNIV_INLINE
@@ -124,7 +129,7 @@ Opens the log for log_write_low. The log
 released with log_release.
 @return	start lsn of the log record */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_reserve_and_open(
 /*=================*/
 	ulint	len);	/*!< in: length of data to be catenated */
@@ -141,14 +146,14 @@ log_write_low(
 Closes the log.
 @return	lsn */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_close(void);
 /*===========*/
 /************************************************************//**
 Gets the current lsn.
 @return	current lsn */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 log_get_lsn(void);
 /*=============*/
 /****************************************************************
@@ -156,7 +161,7 @@ Gets the log group capacity. It is OK to
 holding log_sys->mutex because it is constant.
 @return	log group capacity */
 UNIV_INLINE
-ulint
+lsn_t
 log_get_capacity(void);
 /*==================*/
 /******************************************************//**
@@ -173,7 +178,7 @@ log_group_init(
 /*===========*/
 	ulint	id,			/*!< in: group id */
 	ulint	n_files,		/*!< in: number of log files */
-	ulint	file_size,		/*!< in: log file size in bytes */
+	lsn_t	file_size,		/*!< in: log file size in bytes */
 	ulint	space_id,		/*!< in: space id of the file space
 					which contains the log files of this
 					group */
@@ -198,14 +203,13 @@ UNIV_INTERN
 void
 log_write_up_to(
 /*============*/
-	ib_uint64_t	lsn,	/*!< in: log sequence number up to which
-				the log should be written,
-				IB_ULONGLONG_MAX if not specified */
-	ulint		wait,	/*!< in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
-				or LOG_WAIT_ALL_GROUPS */
-	ibool		flush_to_disk);
-				/*!< in: TRUE if we want the written log
-				also to be flushed to disk */
+	lsn_t	lsn,	/*!< in: log sequence number up to which
+			the log should be written, LSN_MAX if not specified */
+	ulint	wait,	/*!< in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
+			or LOG_WAIT_ALL_GROUPS */
+	ibool	flush_to_disk);
+			/*!< in: TRUE if we want the written log
+			also to be flushed to disk */
 /****************************************************************//**
 Does a syncronous flush of the log buffer to disk. */
 UNIV_INTERN
@@ -225,10 +229,10 @@ log_buffer_sync_in_background(
 /****************************************************************//**
 Checks if an asynchronous flushing of dirty pages is required in the
 background. This function is only called from the page cleaner thread.
-@return lsn to which the flushing should happen or IB_ULONGLONG_MAX
+@return lsn to which the flushing should happen or LSN_MAX
 if flushing is not required */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_async_flush_lsn(void);
 /*=====================*/
 /******************************************************//**
@@ -255,16 +259,16 @@ UNIV_INTERN
 void
 log_make_checkpoint_at(
 /*===================*/
-	ib_uint64_t	lsn,		/*!< in: make a checkpoint at this or a
-					later lsn, if IB_ULONGLONG_MAX, makes
-					a checkpoint at the latest lsn */
-	ibool		write_always);	/*!< in: the function normally checks if
-					the new checkpoint would have a
-					greater lsn than the previous one: if
-					not, then no physical write is done;
-					by setting this parameter TRUE, a
-					physical write will always be made to
-					log files */
+	lsn_t	lsn,		/*!< in: make a checkpoint at this or a
+				later lsn, if LSN_MAX, makes
+				a checkpoint at the latest lsn */
+	ibool	write_always);	/*!< in: the function normally checks if
+				the new checkpoint would have a
+				greater lsn than the previous one: if
+				not, then no physical write is done;
+				by setting this parameter TRUE, a
+				physical write will always be made to
+				log files */
 /****************************************************************//**
 Makes a checkpoint at the latest lsn and writes it to first page of each
 data file in the database, so that we know that the file spaces contain
@@ -382,8 +386,8 @@ log_group_read_log_seg(
 	ulint		type,		/*!< in: LOG_ARCHIVE or LOG_RECOVER */
 	byte*		buf,		/*!< in: buffer where to read */
 	log_group_t*	group,		/*!< in: log group */
-	ib_uint64_t	start_lsn,	/*!< in: read area start */
-	ib_uint64_t	end_lsn);	/*!< in: read area end */
+	lsn_t		start_lsn,	/*!< in: read area start */
+	lsn_t		end_lsn);	/*!< in: read area end */
 /******************************************************//**
 Writes a buffer to a log file group. */
 UNIV_INTERN
@@ -394,7 +398,7 @@ log_group_write_buf(
 	byte*		buf,		/*!< in: buffer */
 	ulint		len,		/*!< in: buffer len; must be divisible
 					by OS_FILE_LOG_BLOCK_SIZE */
-	ib_uint64_t	start_lsn,	/*!< in: start lsn of the buffer; must
+	lsn_t		start_lsn,	/*!< in: start lsn of the buffer; must
 					be divisible by
 					OS_FILE_LOG_BLOCK_SIZE */
 	ulint		new_data_offset);/*!< in: start offset of new data in
@@ -410,14 +414,14 @@ void
 log_group_set_fields(
 /*=================*/
 	log_group_t*	group,	/*!< in/out: group */
-	ib_uint64_t	lsn);	/*!< in: lsn for which the values should be
+	lsn_t		lsn);	/*!< in: lsn for which the values should be
 				set */
 /******************************************************//**
 Calculates the data capacity of a log group, when the log file headers are not
 included.
 @return	capacity in bytes */
 UNIV_INTERN
-ulint
+lsn_t
 log_group_get_capacity(
 /*===================*/
 	const log_group_t*	group);	/*!< in: log group */
@@ -509,8 +513,8 @@ UNIV_INLINE
 void
 log_block_init(
 /*===========*/
-	byte*		log_block,	/*!< in: pointer to the log buffer */
-	ib_uint64_t	lsn);		/*!< in: lsn within the log block */
+	byte*	log_block,	/*!< in: pointer to the log buffer */
+	lsn_t	lsn);		/*!< in: lsn within the log block */
 /************************************************************//**
 Initializes a log block in the log buffer in the old, < 3.23.52 format, where
 there was no checksum yet. */
@@ -518,8 +522,8 @@ UNIV_INLINE
 void
 log_block_init_in_old_format(
 /*=========================*/
-	byte*		log_block,	/*!< in: pointer to the log buffer */
-	ib_uint64_t	lsn);		/*!< in: lsn within the log block */
+	byte*	log_block,	/*!< in: pointer to the log buffer */
+	lsn_t	lsn);		/*!< in: lsn within the log block */
 /************************************************************//**
 Converts a lsn to a log block number.
 @return	log block number, it is > 0 and <= 1G */
@@ -527,7 +531,7 @@ UNIV_INLINE
 ulint
 log_block_convert_lsn_to_no(
 /*========================*/
-	ib_uint64_t	lsn);	/*!< in: lsn of a byte within the block */
+	lsn_t	lsn);	/*!< in: lsn of a byte within the block */
 /******************************************************//**
 Prints info of the log. */
 UNIV_INTERN
@@ -542,7 +546,7 @@ UNIV_INTERN
 ibool
 log_peek_lsn(
 /*=========*/
-	ib_uint64_t*	lsn);	/*!< out: if returns TRUE, current lsn is here */
+	lsn_t*	lsn);	/*!< out: if returns TRUE, current lsn is here */
 /**********************************************************************//**
 Refreshes the statistics used to print per-second averages. */
 UNIV_INTERN
@@ -573,7 +577,7 @@ extern log_t*	log_sys;
 #define LOG_RECOVER	98887331
 
 /* The counting of lsn's starts from this value: this must be non-zero */
-#define LOG_START_LSN		((ib_uint64_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
+#define LOG_START_LSN		((lsn_t) (16 * OS_FILE_LOG_BLOCK_SIZE))
 
 #define LOG_BUFFER_SIZE		(srv_log_buffer_size * UNIV_PAGE_SIZE)
 #define LOG_ARCHIVE_BUF_SIZE	(srv_log_buffer_size * UNIV_PAGE_SIZE / 4)
@@ -620,7 +624,7 @@ extern log_t*	log_sys;
 /* Offsets for a checkpoint field */
 #define LOG_CHECKPOINT_NO		0
 #define LOG_CHECKPOINT_LSN		8
-#define LOG_CHECKPOINT_OFFSET		16
+#define LOG_CHECKPOINT_OFFSET_LOW32	16
 #define LOG_CHECKPOINT_LOG_BUF_SIZE	20
 #define	LOG_CHECKPOINT_ARCHIVED_LSN	24
 #define	LOG_CHECKPOINT_GROUP_ARRAY	32
@@ -647,7 +651,8 @@ extern log_t*	log_sys;
 					checkpoint contains the above field:
 					the field was added to
 					InnoDB-3.23.50 */
-#define LOG_CHECKPOINT_SIZE		(16 + LOG_CHECKPOINT_ARRAY_END)
+#define LOG_CHECKPOINT_OFFSET_HIGH32	(16 + LOG_CHECKPOINT_ARRAY_END)
+#define LOG_CHECKPOINT_SIZE		(20 + LOG_CHECKPOINT_ARRAY_END)
 
 #define LOG_CHECKPOINT_FSP_MAGIC_N_VAL	1441231243
 
@@ -699,15 +704,15 @@ struct log_group_struct{
 	/* The following fields are protected by log_sys->mutex */
 	ulint		id;		/*!< log group id */
 	ulint		n_files;	/*!< number of files in the group */
-	ulint		file_size;	/*!< individual log file size in bytes,
+	lsn_t		file_size;	/*!< individual log file size in bytes,
 					including the log file header */
 	ulint		space_id;	/*!< file space which implements the log
 					group */
 	ulint		state;		/*!< LOG_GROUP_OK or
 					LOG_GROUP_CORRUPTED */
-	ib_uint64_t	lsn;		/*!< lsn used to fix coordinates within
+	lsn_t		lsn;		/*!< lsn used to fix coordinates within
 					the log group */
-	ulint		lsn_offset;	/*!< the offset of the above lsn */
+	lsn_t		lsn_offset;	/*!< the offset of the above lsn */
 	ulint		n_pending_writes;/*!< number of currently pending flush
 					writes for this log group */
 	byte**		file_header_bufs_ptr;/*!< unaligned buffers */
@@ -736,7 +741,7 @@ struct log_group_struct{
 	ulint		next_archived_offset; /*!< like the preceding field */
 #endif /* UNIV_LOG_ARCHIVE */
 	/*-----------------------------*/
-	ib_uint64_t	scanned_lsn;	/*!< used only in recovery: recovery scan
+	lsn_t		scanned_lsn;	/*!< used only in recovery: recovery scan
 					succeeded up to this lsn in this log
 					group */
 	byte*		checkpoint_buf_ptr;/*!< unaligned checkpoint header */
@@ -751,7 +756,7 @@ struct log_struct{
 	byte		pad[64];	/*!< padding to prevent other memory
 					update hotspots from residing on the
 					same memory cache line */
-	ib_uint64_t	lsn;		/*!< log sequence number */
+	lsn_t		lsn;		/*!< log sequence number */
 	ulint		buf_free;	/*!< first free offset within the log
 					buffer */
 #ifndef UNIV_HOTBACKUP
@@ -800,13 +805,13 @@ struct log_struct{
 					later; this is advanced when a flush
 					operation is completed to all the log
 					groups */
-	ib_uint64_t	written_to_some_lsn;
+	lsn_t		written_to_some_lsn;
 					/*!< first log sequence number not yet
 					written to any log group; for this to
 					be advanced, it is enough that the
 					write i/o has been completed for any
 					one log group */
-	ib_uint64_t	written_to_all_lsn;
+	lsn_t		written_to_all_lsn;
 					/*!< first log sequence number not yet
 					written to some log group; for this to
 					be advanced, it is enough that the
@@ -822,16 +827,16 @@ struct log_struct{
 					flushed_to_disk_lsn or
 					write_lsn which are always
 					up-to-date and accurate. */
-	ib_uint64_t	write_lsn;	/*!< end lsn for the current running
+	lsn_t		write_lsn;	/*!< end lsn for the current running
 					write */
 	ulint		write_end_offset;/*!< the data in buffer has
 					been written up to this offset
 					when the current write ends:
 					this field will then be copied
 					to buf_next_to_write */
-	ib_uint64_t	current_flush_lsn;/*!< end lsn for the current running
+	lsn_t		current_flush_lsn;/*!< end lsn for the current running
 					write + flush operation */
-	ib_uint64_t	flushed_to_disk_lsn;
+	lsn_t		flushed_to_disk_lsn;
 					/*!< how far we have written the log
 					AND flushed to disk */
 	ulint		n_pending_writes;/*!< number of currently
@@ -868,42 +873,37 @@ struct log_struct{
 	/* @} */
 
 	/** Fields involved in checkpoints @{ */
-	ulint		log_group_capacity; /*!< capacity of the log group; if
+	lsn_t		log_group_capacity; /*!< capacity of the log group; if
 					the checkpoint age exceeds this, it is
 					a serious error because it is possible
 					we will then overwrite log and spoil
 					crash recovery */
-	ulint		max_modified_age_async;
+	lsn_t		max_modified_age_async;
 					/*!< when this recommended
 					value for lsn -
 					buf_pool_get_oldest_modification()
 					is exceeded, we start an
 					asynchronous preflush of pool pages */
-	ulint		max_modified_age_sync;
+	lsn_t		max_modified_age_sync;
 					/*!< when this recommended
 					value for lsn -
 					buf_pool_get_oldest_modification()
 					is exceeded, we start a
 					synchronous preflush of pool pages */
-	ulint		adm_checkpoint_interval;
-					/*!< administrator-specified checkpoint
-					interval in terms of log growth in
-					bytes; the interval actually used by
-					the database can be smaller */
-	ulint		max_checkpoint_age_async;
+	lsn_t		max_checkpoint_age_async;
 					/*!< when this checkpoint age
 					is exceeded we start an
 					asynchronous writing of a new
 					checkpoint */
-	ulint		max_checkpoint_age;
+	lsn_t		max_checkpoint_age;
 					/*!< this is the maximum allowed value
 					for lsn - last_checkpoint_lsn when a
 					new query step is started */
 	ib_uint64_t	next_checkpoint_no;
 					/*!< next checkpoint number */
-	ib_uint64_t	last_checkpoint_lsn;
+	lsn_t		last_checkpoint_lsn;
 					/*!< latest checkpoint lsn */
-	ib_uint64_t	next_checkpoint_lsn;
+	lsn_t		next_checkpoint_lsn;
 					/*!< next checkpoint lsn */
 	ulint		n_pending_checkpoint_writes;
 					/*!< number of currently pending
@@ -921,16 +921,16 @@ struct log_struct{
 	/** Fields involved in archiving @{ */
 	ulint		archiving_state;/*!< LOG_ARCH_ON, LOG_ARCH_STOPPING
 					LOG_ARCH_STOPPED, LOG_ARCH_OFF */
-	ib_uint64_t	archived_lsn;	/*!< archiving has advanced to this
+	lsn_t		archived_lsn;	/*!< archiving has advanced to this
 					lsn */
-	ulint		max_archived_lsn_age_async;
+	lsn_t		max_archived_lsn_age_async;
 					/*!< recommended maximum age of
 					archived_lsn, before we start
 					asynchronous copying to the archive */
-	ulint		max_archived_lsn_age;
+	lsn_t		max_archived_lsn_age;
 					/*!< maximum allowed age for
 					archived_lsn */
-	ib_uint64_t	next_archived_lsn;/*!< during an archive write,
+	lsn_t		next_archived_lsn;/*!< during an archive write,
 					until the write is completed, we
 					store the next value for
 					archived_lsn here: the write

=== modified file 'storage/innobase/include/log0log.ic'
--- a/storage/innobase/include/log0log.ic	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/include/log0log.ic	2011-03-09 07:32:36 +0000
@@ -193,7 +193,7 @@ UNIV_INLINE
 ulint
 log_block_convert_lsn_to_no(
 /*========================*/
-	ib_uint64_t	lsn)	/*!< in: lsn of a byte within the block */
+	lsn_t	lsn)	/*!< in: lsn of a byte within the block */
 {
 	return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) & 0x3FFFFFFFUL) + 1);
 }
@@ -261,8 +261,8 @@ UNIV_INLINE
 void
 log_block_init(
 /*===========*/
-	byte*		log_block,	/*!< in: pointer to the log buffer */
-	ib_uint64_t	lsn)		/*!< in: lsn within the log block */
+	byte*	log_block,	/*!< in: pointer to the log buffer */
+	lsn_t	lsn)		/*!< in: lsn within the log block */
 {
 	ulint	no;
 
@@ -283,8 +283,8 @@ UNIV_INLINE
 void
 log_block_init_in_old_format(
 /*=========================*/
-	byte*		log_block,	/*!< in: pointer to the log buffer */
-	ib_uint64_t	lsn)		/*!< in: lsn within the log block */
+	byte*	log_block,	/*!< in: pointer to the log buffer */
+	lsn_t	lsn)		/*!< in: lsn within the log block */
 {
 	ulint	no;
 
@@ -305,12 +305,12 @@ Writes to the log the string given. The
 log_release.
 @return	end lsn of the log record, zero if did not succeed */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 log_reserve_and_write_fast(
 /*=======================*/
 	const void*	str,	/*!< in: string */
 	ulint		len,	/*!< in: string length */
-	ib_uint64_t*	start_lsn)/*!< out: start lsn of the log record */
+	lsn_t*		start_lsn)/*!< out: start lsn of the log record */
 {
 	ulint		data_len;
 #ifdef UNIV_LOG_LSN_DEBUG
@@ -400,11 +400,11 @@ log_release(void)
 Gets the current lsn.
 @return	current lsn */
 UNIV_INLINE
-ib_uint64_t
+lsn_t
 log_get_lsn(void)
 /*=============*/
 {
-	ib_uint64_t	lsn;
+	lsn_t	lsn;
 
 	mutex_enter(&(log_sys->mutex));
 
@@ -420,7 +420,7 @@ Gets the log group capacity. It is OK to
 holding log_sys->mutex because it is constant.
 @return	log group capacity */
 UNIV_INLINE
-ulint
+lsn_t
 log_get_capacity(void)
 /*==================*/
 {

=== modified file 'storage/innobase/include/log0recv.h'
--- a/storage/innobase/include/log0recv.h	2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/log0recv.h	2011-03-09 07:32:36 +0000
@@ -44,13 +44,13 @@ recv_read_cp_info_for_backup(
 /*=========================*/
 	const byte*	hdr,	/*!< in: buffer containing the log group
 				header */
-	ib_uint64_t*	lsn,	/*!< out: checkpoint lsn */
-	ulint*		offset,	/*!< out: checkpoint offset in the log group */
+	lsn_t*		lsn,	/*!< out: checkpoint lsn */
+	lsn_t*		offset,	/*!< out: checkpoint offset in the log group */
 	ulint*		fsp_limit,/*!< out: fsp limit of space 0,
 				1000000000 if the database is running
 				with < version 3.23.50 of InnoDB */
 	ib_uint64_t*	cp_no,	/*!< out: checkpoint number */
-	ib_uint64_t*	first_header_lsn);
+	lsn_t*		first_header_lsn);
 				/*!< out: lsn of of the start of the
 				first log file */
 /*******************************************************************//**
@@ -62,7 +62,7 @@ recv_scan_log_seg_for_backup(
 /*=========================*/
 	byte*		buf,		/*!< in: buffer containing log data */
 	ulint		buf_len,	/*!< in: data length in that buffer */
-	ib_uint64_t*	scanned_lsn,	/*!< in/out: lsn of buffer start,
+	lsn_t*		scanned_lsn,	/*!< in/out: lsn of buffer start,
 					we return scanned lsn */
 	ulint*		scanned_checkpoint_no,
 					/*!< in/out: 4 lowest bytes of the
@@ -136,12 +136,12 @@ recv_recovery_from_checkpoint_start_func
 #ifdef UNIV_LOG_ARCHIVE
 	ulint		type,		/*!< in: LOG_CHECKPOINT or
 					LOG_ARCHIVE */
-	ib_uint64_t	limit_lsn,	/*!< in: recover up to this lsn
+	lsn_t		limit_lsn,	/*!< in: recover up to this lsn
 					if possible */
 #endif /* UNIV_LOG_ARCHIVE */
-	ib_uint64_t	min_flushed_lsn,/*!< in: min flushed lsn from
+	lsn_t		min_flushed_lsn,/*!< in: min flushed lsn from
 					data files */
-	ib_uint64_t	max_flushed_lsn);/*!< in: max flushed lsn from
+	lsn_t		max_flushed_lsn);/*!< in: max flushed lsn from
 					 data files */
 #ifdef UNIV_LOG_ARCHIVE
 /** Wrapper for recv_recovery_from_checkpoint_start_func().
@@ -202,11 +202,11 @@ recv_scan_log_recs(
 	const byte*	buf,		/*!< in: buffer containing a log
 					segment or garbage */
 	ulint		len,		/*!< in: buffer length */
-	ib_uint64_t	start_lsn,	/*!< in: buffer start lsn */
-	ib_uint64_t*	contiguous_lsn,	/*!< in/out: it is known that all log
+	lsn_t		start_lsn,	/*!< in: buffer start lsn */
+	lsn_t*		contiguous_lsn,	/*!< in/out: it is known that all log
 					groups contain contiguous log data up
 					to this lsn */
-	ib_uint64_t*	group_scanned_lsn);/*!< out: scanning succeeded up to
+	lsn_t*		group_scanned_lsn);/*!< out: scanning succeeded up to
 					this lsn */
 /******************************************************//**
 Resets the logs. The contents of log files will be lost! */
@@ -214,7 +214,7 @@ UNIV_INTERN
 void
 recv_reset_logs(
 /*============*/
-	ib_uint64_t	lsn,		/*!< in: reset to this lsn
+	lsn_t		lsn,		/*!< in: reset to this lsn
 					rounded up to be divisible by
 					OS_FILE_LOG_BLOCK_SIZE, after
 					which we add
@@ -235,8 +235,8 @@ recv_reset_log_files_for_backup(
 /*============================*/
 	const char*	log_dir,	/*!< in: log file directory path */
 	ulint		n_log_files,	/*!< in: number of log files */
-	ulint		log_file_size,	/*!< in: log file size */
-	ib_uint64_t	lsn);		/*!< in: new start lsn, must be
+	lsn_t		log_file_size,	/*!< in: log file size */
+	lsn_t		lsn);		/*!< in: new start lsn, must be
 					divisible by OS_FILE_LOG_BLOCK_SIZE */
 #endif /* UNIV_HOTBACKUP */
 /********************************************************//**
@@ -302,9 +302,9 @@ UNIV_INTERN
 ulint
 recv_recovery_from_archive_start(
 /*=============================*/
-	ib_uint64_t	min_flushed_lsn,/*!< in: min flushed lsn field from the
+	lsn_t		min_flushed_lsn,/*!< in: min flushed lsn field from the
 					data files */
-	ib_uint64_t	limit_lsn,	/*!< in: recover up to this lsn if
+	lsn_t		limit_lsn,	/*!< in: recover up to this lsn if
 					possible */
 	ulint		first_log_no);	/*!< in: number of the first archived
 					log file to use in the recovery; the
@@ -337,11 +337,11 @@ struct recv_struct{
 	ulint		len;	/*!< log record body length in bytes */
 	recv_data_t*	data;	/*!< chain of blocks containing the log record
 				body */
-	ib_uint64_t	start_lsn;/*!< start lsn of the log segment written by
+	lsn_t		start_lsn;/*!< start lsn of the log segment written by
 				the mtr which generated this log record: NOTE
 				that this is not necessarily the start lsn of
 				this log record */
-	ib_uint64_t	end_lsn;/*!< end lsn of the log segment written by
+	lsn_t		end_lsn;/*!< end lsn of the log segment written by
 				the mtr which generated this log record: NOTE
 				that this is not necessarily the end lsn of
 				this log record */
@@ -392,7 +392,7 @@ struct recv_sys_struct{
 	ibool		apply_batch_on;
 				/*!< this is TRUE when a log rec application
 				batch is running */
-	ib_uint64_t	lsn;	/*!< log sequence number */
+	lsn_t		lsn;	/*!< log sequence number */
 	ulint		last_log_buf_size;
 				/*!< size of the log buffer when the database
 				last time wrote to the log */
@@ -404,12 +404,12 @@ struct recv_sys_struct{
 				preceding buffer */
 	byte*		buf;	/*!< buffer for parsing log records */
 	ulint		len;	/*!< amount of data in buf */
-	ib_uint64_t	parse_start_lsn;
+	lsn_t		parse_start_lsn;
 				/*!< this is the lsn from which we were able to
 				start parsing log records and adding them to
 				the hash table; zero if a suitable
 				start point not found yet */
-	ib_uint64_t	scanned_lsn;
+	lsn_t		scanned_lsn;
 				/*!< the log data has been scanned up to this
 				lsn */
 	ulint		scanned_checkpoint_no;
@@ -418,10 +418,10 @@ struct recv_sys_struct{
 	ulint		recovered_offset;
 				/*!< start offset of non-parsed log records in
 				buf */
-	ib_uint64_t	recovered_lsn;
+	lsn_t		recovered_lsn;
 				/*!< the log records have been parsed up to
 				this lsn */
-	ib_uint64_t	limit_lsn;/*!< recovery should be made at most
+	lsn_t		limit_lsn;/*!< recovery should be made at most
 				up to this lsn */
 	ibool		found_corrupt_log;
 				/*!< this is set to TRUE if we during log

=== modified file 'storage/innobase/include/mtr0mtr.h'
--- a/storage/innobase/include/mtr0mtr.h	2010-07-29 10:44:35 +0000
+++ b/storage/innobase/include/mtr0mtr.h	2011-03-14 11:45:13 +0000
@@ -189,6 +189,9 @@ functions).  The page number parameter w
 					MLOG_FILE_CREATE, MLOG_FILE_CREATE2 */
 /* @} */
 
+/* included here because it needs MLOG_LSN defined */
+#include "log0log.h"
+
 /***************************************************************//**
 Starts a mini-transaction and creates a mini-transaction handle
 and buffer in the memory buffer given by the caller.
@@ -386,9 +389,9 @@ struct mtr_struct{
 				have been written to the mtr log */
 	ulint		log_mode; /* specifies which operations should be
 				logged; default value MTR_LOG_ALL */
-	ib_uint64_t	start_lsn;/* start lsn of the possible log entry for
+	lsn_t		start_lsn;/* start lsn of the possible log entry for
 				this mtr */
-	ib_uint64_t	end_lsn;/* end lsn of the possible log entry for
+	lsn_t		end_lsn;/* end lsn of the possible log entry for
 				this mtr */
 #ifdef UNIV_DEBUG
 	ulint		magic_n;

=== modified file 'storage/innobase/include/srv0mon.h'
--- a/storage/innobase/include/srv0mon.h	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/include/srv0mon.h	2011-02-28 09:35:01 +0000
@@ -340,6 +340,12 @@ enum monitor_id_value {
 	MONITOR_MODULE_DDL_STATS,
 	MONITOR_BACKGROUND_DROP_TABLE,
 
+	MONITOR_MODULE_ICP,
+	MONITOR_ICP_ATTEMPTS,
+	MONITOR_ICP_NO_MATCH,
+	MONITOR_ICP_OUT_OF_RANGE,
+	MONITOR_ICP_MATCH,
+
 	/* This is used only for control system to turn
 	on/off and reset all monitor counters */
 	MONITOR_ALL_COUNTER,

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/include/srv0srv.h	2011-03-09 07:32:36 +0000
@@ -43,6 +43,7 @@ Created 10/10/1995 Heikki Tuuri
 
 #include "univ.i"
 #ifndef UNIV_HOTBACKUP
+#include "log0log.h"
 #include "sync0sync.h"
 #include "os0sync.h"
 #include "que0types.h"
@@ -139,7 +140,7 @@ extern ibool	srv_created_new_raw;
 
 extern ulint	srv_n_log_groups;
 extern ulint	srv_n_log_files;
-extern ulint	srv_log_file_size;
+extern ib_uint64_t	srv_log_file_size;
 extern ulint	srv_log_buffer_size;
 extern ulong	srv_flush_log_at_trx_commit;
 extern char	srv_adaptive_flushing;
@@ -285,7 +286,7 @@ extern ulint srv_log_write_requests;
 extern ulint srv_log_writes;
 
 /* amount of data written to the log files in bytes */
-extern ulint srv_os_log_written;
+extern lsn_t srv_os_log_written;
 
 /* amount of writes being done to the log files */
 extern ulint srv_os_log_pending_writes;
@@ -777,7 +778,7 @@ struct export_var_struct{
 	ulint innodb_log_waits;			/*!< srv_log_waits */
 	ulint innodb_log_write_requests;	/*!< srv_log_write_requests */
 	ulint innodb_log_writes;		/*!< srv_log_writes */
-	ulint innodb_os_log_written;		/*!< srv_os_log_written */
+	lsn_t innodb_os_log_written;		/*!< srv_os_log_written */
 	ulint innodb_os_log_fsyncs;		/*!< fil_n_log_flushes */
 	ulint innodb_os_log_pending_writes;	/*!< srv_os_log_pending_writes */
 	ulint innodb_os_log_pending_fsyncs;	/*!< fil_n_pending_log_flushes */

=== modified file 'storage/innobase/include/srv0start.h'
--- a/storage/innobase/include/srv0start.h	2010-12-02 17:10:06 +0000
+++ b/storage/innobase/include/srv0start.h	2011-03-09 07:32:36 +0000
@@ -27,6 +27,7 @@ Created 10/10/1995 Heikki Tuuri
 #define srv0start_h
 
 #include "univ.i"
+#include "log0log.h"
 #include "ut0byte.h"
 
 /*********************************************************************//**
@@ -87,9 +88,9 @@ int
 innobase_shutdown_for_mysql(void);
 /*=============================*/
 /** Log sequence number at shutdown */
-extern	ib_uint64_t	srv_shutdown_lsn;
+extern	lsn_t	srv_shutdown_lsn;
 /** Log sequence number immediately after startup */
-extern	ib_uint64_t	srv_start_lsn;
+extern	lsn_t	srv_start_lsn;
 
 #ifdef HAVE_DARWIN_THREADS
 /** TRUE if the F_FULLFSYNC option is available */

=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h	2011-01-30 21:11:14 +0000
+++ b/storage/innobase/include/trx0trx.h	2011-03-09 07:32:36 +0000
@@ -31,6 +31,7 @@ Created 3/26/1996 Heikki Tuuri
 #include "dict0types.h"
 #ifndef UNIV_HOTBACKUP
 #include "lock0types.h"
+#include "log0log.h"
 #include "usr0types.h"
 #include "que0types.h"
 #include "mem0mem.h"
@@ -448,9 +449,9 @@ struct trx_lock_struct {
 					hold lock_sys->mutex, except when
 					they are holding trx->mutex and
 					wait_lock==NULL */
-	ulint		deadlock_mark;	/*!< a mark field used in deadlock
-					checking algorithm. This is only
-					covered by the lock_sys->mutex. */
+	ib_uint64_t	deadlock_mark;	/*!< A mark field that is initialized
+					to and checked against lock_mark_counter
+				       	by lock_deadlock_recursive(). */
 	ibool		was_chosen_as_deadlock_victim;
 					/*!< when the transaction decides to
 				       	wait for a lock, it sets this to FALSE;
@@ -660,7 +661,7 @@ struct trx_struct{
 	XID		xid;		/*!< X/Open XA transaction
 					identification to identify a
 					transaction branch */
-	ib_uint64_t	commit_lsn;	/*!< lsn at the time of the commit */
+	lsn_t		commit_lsn;	/*!< lsn at the time of the commit */
 	table_id_t	table_id;	/*!< Table to drop iff dict_operation
 					is TRUE, or 0. */
 	/*------------------------------*/

=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i	2011-02-17 12:03:56 +0000
+++ b/storage/innobase/include/univ.i	2011-03-09 07:32:36 +0000
@@ -402,6 +402,7 @@ typedef unsigned long long int	ullint;
 
 /* Maximum value for ib_uint64_t */
 #define IB_ULONGLONG_MAX	((ib_uint64_t) (~0ULL))
+#define IB_UINT64_MAX		IB_ULONGLONG_MAX
 
 /** The generic InnoDB system object identifier data type */
 typedef ib_uint64_t	ib_id_t;

=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c	2011-02-18 13:00:57 +0000
+++ b/storage/innobase/lock/lock0lock.c	2011-03-04 01:47:48 +0000
@@ -424,9 +424,12 @@ lock_deadlock_recursive(
 	ulint*	cost,		/*!< in/out: number of calculation steps thus
 				far: if this exceeds LOCK_MAX_N_STEPS_...
 				we return LOCK_VICTIM_EXCEED_MAX_DEPTH */
-	ulint	depth);		/*!< in: recursion depth: if this exceeds
+	ulint	depth,		/*!< in: recursion depth: if this exceeds
 				LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
 				return LOCK_VICTIM_EXCEED_MAX_DEPTH */
+	const ib_uint64_t
+		mark_start);	/*!< in: Value of lock_mark_count at the start
+				of the deadlock check. */
 
 /*********************************************************************//**
 Gets the nth bit of a record lock.
@@ -3474,6 +3477,9 @@ lock_deadlock_lock_print(
 	}
 }
 
+/** Used in deadlock tracking. Protected by lock_sys->mutex. */
+static ib_uint64_t	lock_mark_counter = 0;
+
 /********************************************************************//**
 Checks if a lock request results in a deadlock.
 @return TRUE if a deadlock was detected and we chose trx as a victim;
@@ -3486,7 +3492,6 @@ lock_deadlock_occurs(
 	lock_t*	lock,	/*!< in: lock the transaction is requesting */
 	trx_t*	trx)	/*!< in/out: transaction */
 {
-	trx_t*		mark_trx;
 	ulint		cost	= 0;
 
 	ut_ad(trx);
@@ -3500,25 +3505,9 @@ retry:
 	does not produce a cycle. First mark all active transactions
 	with 0: */
 
-	/* To obey the latching order. Since we have the lock mutex, this
-	transaction's state can't be changed. */
-	trx_mutex_exit(trx);
-
-	rw_lock_s_lock(&trx_sys->lock);
-
-	for (mark_trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
-	     mark_trx != NULL;
-	     mark_trx = UT_LIST_GET_NEXT(trx_list, mark_trx)) {
-
-		ut_ad(mark_trx->in_trx_list);
-		mark_trx->lock.deadlock_mark = 0;
-	}
+	switch (lock_deadlock_recursive(
+		trx, trx, lock, &cost, 0, lock_mark_counter)) {
 
-	rw_lock_s_unlock(&trx_sys->lock);
-
-	trx_mutex_enter(trx);
-
-	switch (lock_deadlock_recursive(trx, trx, lock, &cost, 0)) {
 	case LOCK_VICTIM_IS_OTHER:
 		/* We chose some other trx as a victim: retry if there still
 		is a deadlock */
@@ -3592,9 +3581,12 @@ lock_deadlock_recursive(
 	ulint*	cost,		/*!< in/out: number of calculation steps thus
 				far: if this exceeds LOCK_MAX_N_STEPS_...
 				we return LOCK_VICTIM_EXCEED_MAX_DEPTH */
-	ulint	depth)		/*!< in: recursion depth: if this exceeds
+	ulint	depth,		/*!< in: recursion depth: if this exceeds
 				LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we
 				return LOCK_VICTIM_EXCEED_MAX_DEPTH */
+	const ib_uint64_t
+		mark_start)	/*!< in: Value of lock_mark_count at the start
+				of the deadlock check. */
 {
 	lock_victim_t	ret;
 	lock_t*		lock;
@@ -3605,8 +3597,9 @@ lock_deadlock_recursive(
 	ut_a(wait_lock);
 	ut_ad(lock_mutex_own());
 	ut_ad(trx->in_trx_list);
+	ut_ad(mark_start <= lock_mark_counter);
 
-	if (trx->lock.deadlock_mark) {
+	if (trx->lock.deadlock_mark > mark_start) {
 		/* We have already exhaustively searched the subtree starting
 		from this trx */
 
@@ -3645,7 +3638,14 @@ lock_deadlock_recursive(
 
 		if (lock == NULL || lock == wait_lock) {
 			/* We can mark this subtree as searched */
-			trx->lock.deadlock_mark = 1;
+			ut_a(trx->lock.deadlock_mark <= mark_start);
+			trx->lock.deadlock_mark = ++lock_mark_counter;
+
+			/* We are not prepared for an overflow. This 64-bit
+			counter should never wrap around. At 10^9 increments
+			per second, it would take 10^3 years of uptime. */
+
+			ut_a(lock_mark_counter > 0);
 
 			return(LOCK_VICTIM_NONE);
 		}
@@ -3765,7 +3765,7 @@ lock_deadlock_recursive(
 				ret = lock_deadlock_recursive(
 					start, lock_trx,
 					lock_trx->lock.wait_lock,
-					cost, depth + 1);
+					cost, depth + 1, mark_start);
 
 				if (ret != LOCK_VICTIM_NONE) {
 

=== modified file 'storage/innobase/log/log0log.c'
--- a/storage/innobase/log/log0log.c	2011-02-22 02:58:40 +0000
+++ b/storage/innobase/log/log0log.c	2011-03-09 07:32:36 +0000
@@ -196,11 +196,11 @@ Returns the oldest modified block lsn in
 exists.
 @return	LSN of oldest modification */
 static
-ib_uint64_t
+lsn_t
 log_buf_pool_get_oldest_modification(void)
 /*======================================*/
 {
-	ib_uint64_t	lsn;
+	lsn_t	lsn;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
 
@@ -219,7 +219,7 @@ Opens the log for log_write_low. The log
 released with log_release.
 @return	start lsn of the log record */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_reserve_and_open(
 /*=================*/
 	ulint	len)	/*!< in: length of data to be catenated */
@@ -363,16 +363,16 @@ part_loop:
 Closes the log.
 @return	lsn */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_close(void)
 /*===========*/
 {
 	byte*		log_block;
 	ulint		first_rec_group;
-	ib_uint64_t	oldest_lsn;
-	ib_uint64_t	lsn;
+	lsn_t		oldest_lsn;
+	lsn_t		lsn;
 	log_t*		log	= log_sys;
-	ib_uint64_t	checkpoint_age;
+	lsn_t		checkpoint_age;
 
 	ut_ad(mutex_own(&(log->mutex)));
 	ut_ad(!recv_no_log_write);
@@ -415,16 +415,16 @@ log_close(void)
 			ut_print_timestamp(stderr);
 			fprintf(stderr,
 				"  InnoDB: ERROR: the age of the last"
-				" checkpoint is %lu,\n"
+				" checkpoint is " LSN_PF ",\n"
 				"InnoDB: which exceeds the log group"
-				" capacity %lu.\n"
+				" capacity " LSN_PF ".\n"
 				"InnoDB: If you are using big"
 				" BLOB or TEXT rows, you must set the\n"
 				"InnoDB: combined size of log files"
 				" at least 10 times bigger than the\n"
 				"InnoDB: largest such row.\n",
-				(ulong) checkpoint_age,
-				(ulong) log->log_group_capacity);
+				checkpoint_age,
+				log->log_group_capacity);
 		}
 	}
 
@@ -490,7 +490,7 @@ Calculates the data capacity of a log gr
 included.
 @return	capacity in bytes */
 UNIV_INTERN
-ulint
+lsn_t
 log_group_get_capacity(
 /*===================*/
 	const log_group_t*	group)	/*!< in: log group */
@@ -505,10 +505,10 @@ Calculates the offset within a log group
 included.
 @return	size offset (<= offset) */
 UNIV_INLINE
-ulint
+lsn_t
 log_group_calc_size_offset(
 /*=======================*/
-	ulint			offset,	/*!< in: real offset within the
+	lsn_t			offset,	/*!< in: real offset within the
 					log group */
 	const log_group_t*	group)	/*!< in: log group */
 {
@@ -522,10 +522,10 @@ Calculates the offset within a log group
 included.
 @return	real offset (>= offset) */
 UNIV_INLINE
-ulint
+lsn_t
 log_group_calc_real_offset(
 /*=======================*/
-	ulint			offset,	/*!< in: size offset within the
+	lsn_t			offset,	/*!< in: size offset within the
 					log group */
 	const log_group_t*	group)	/*!< in: log group */
 {
@@ -539,36 +539,31 @@ log_group_calc_real_offset(
 Calculates the offset of an lsn within a log group.
 @return	offset within the log group */
 static
-ulint
+lsn_t
 log_group_calc_lsn_offset(
 /*======================*/
-	ib_uint64_t		lsn,	/*!< in: lsn, must be within 4 GB of
-					group->lsn */
+	lsn_t			lsn,	/*!< in: lsn */
 	const log_group_t*	group)	/*!< in: log group */
 {
-	ib_uint64_t	gr_lsn;
-	ib_int64_t	gr_lsn_size_offset;
-	ib_int64_t	difference;
-	ib_int64_t	group_size;
-	ib_int64_t	offset;
+	lsn_t	gr_lsn;
+	lsn_t	gr_lsn_size_offset;
+	lsn_t	difference;
+	lsn_t	group_size;
+	lsn_t	offset;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
 
-	/* If total log file size is > 2 GB we can easily get overflows
-	with 32-bit integers. Use 64-bit integers instead. */
-
 	gr_lsn = group->lsn;
 
-	gr_lsn_size_offset = (ib_int64_t)
-		log_group_calc_size_offset(group->lsn_offset, group);
+	gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset, group);
 
-	group_size = (ib_int64_t) log_group_get_capacity(group);
+	group_size = log_group_get_capacity(group);
 
 	if (lsn >= gr_lsn) {
 
-		difference = (ib_int64_t) (lsn - gr_lsn);
+		difference = lsn - gr_lsn;
 	} else {
-		difference = (ib_int64_t) (gr_lsn - lsn);
+		difference = gr_lsn - lsn;
 
 		difference = difference % group_size;
 
@@ -577,14 +572,13 @@ log_group_calc_lsn_offset(
 
 	offset = (gr_lsn_size_offset + difference) % group_size;
 
-	ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */
-
 	/* fprintf(stderr,
-	"Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
-	(ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference);
+	"Offset is " LSN_PF " gr_lsn_offset is " LSN_PF
+	" difference is " LSN_PF "\n",
+	offset, gr_lsn_size_offset, difference);
 	*/
 
-	return(log_group_calc_real_offset((ulint)offset, group));
+	return(log_group_calc_real_offset(offset, group));
 }
 #endif /* !UNIV_HOTBACKUP */
 
@@ -642,7 +636,7 @@ void
 log_group_set_fields(
 /*=================*/
 	log_group_t*	group,	/*!< in/out: group */
-	ib_uint64_t	lsn)	/*!< in: lsn for which the values should be
+	lsn_t		lsn)	/*!< in: lsn for which the values should be
 				set */
 {
 	group->lsn_offset = log_group_calc_lsn_offset(lsn, group);
@@ -660,12 +654,12 @@ log_calc_max_ages(void)
 /*===================*/
 {
 	log_group_t*	group;
-	ulint		margin;
+	lsn_t		margin;
 	ulint		free;
 	ibool		success		= TRUE;
-	ulint		smallest_capacity;
-	ulint		archive_margin;
-	ulint		smallest_archive_margin;
+	lsn_t		smallest_capacity;
+	lsn_t		archive_margin;
+	lsn_t		smallest_archive_margin;
 
 	mutex_enter(&(log_sys->mutex));
 
@@ -673,8 +667,8 @@ log_calc_max_ages(void)
 
 	ut_ad(group);
 
-	smallest_capacity = ULINT_MAX;
-	smallest_archive_margin = ULINT_MAX;
+	smallest_capacity = LSN_MAX;
+	smallest_archive_margin = LSN_MAX;
 
 	while (group) {
 		if (log_group_get_capacity(group) < smallest_capacity) {
@@ -712,8 +706,6 @@ log_calc_max_ages(void)
 		margin = smallest_capacity - free;
 	}
 
-	margin = ut_min(margin, log_sys->adm_checkpoint_interval);
-
 	margin = margin - margin / 10;	/* Add still some extra safety */
 
 	log_sys->log_group_capacity = smallest_capacity;
@@ -826,7 +818,6 @@ log_init(void)
 	os_event_set(log_sys->one_flushed_event);
 
 	/*----------------------------*/
-	log_sys->adm_checkpoint_interval = ULINT_MAX;
 
 	log_sys->next_checkpoint_no = 0;
 	log_sys->last_checkpoint_lsn = log_sys->lsn;
@@ -900,7 +891,7 @@ log_group_init(
 /*===========*/
 	ulint	id,			/*!< in: group id */
 	ulint	n_files,		/*!< in: number of log files */
-	ulint	file_size,		/*!< in: log file size in bytes */
+	lsn_t	file_size,		/*!< in: log file size in bytes */
 	ulint	space_id,		/*!< in: space id of the file space
 					which contains the log files of this
 					group */
@@ -1163,11 +1154,11 @@ log_group_file_header_flush(
 	log_group_t*	group,		/*!< in: log group */
 	ulint		nth_file,	/*!< in: header to the nth file in the
 					log file space */
-	ib_uint64_t	start_lsn)	/*!< in: log file data starts at this
+	lsn_t		start_lsn)	/*!< in: log file data starts at this
 					lsn */
 {
 	byte*	buf;
-	ulint	dest_offset;
+	lsn_t	dest_offset;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
 	ut_ad(!recv_no_log_write);
@@ -1198,8 +1189,8 @@ log_group_file_header_flush(
 		srv_os_log_pending_writes++;
 
 		fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, 0,
-		       dest_offset / UNIV_PAGE_SIZE,
-		       dest_offset % UNIV_PAGE_SIZE,
+		       (ulint) (dest_offset / UNIV_PAGE_SIZE),
+		       (ulint) (dest_offset % UNIV_PAGE_SIZE),
 		       OS_FILE_LOG_BLOCK_SIZE,
 		       buf, group);
 
@@ -1230,7 +1221,7 @@ log_group_write_buf(
 	byte*		buf,		/*!< in: buffer */
 	ulint		len,		/*!< in: buffer len; must be divisible
 					by OS_FILE_LOG_BLOCK_SIZE */
-	ib_uint64_t	start_lsn,	/*!< in: start lsn of the buffer; must
+	lsn_t		start_lsn,	/*!< in: start lsn of the buffer; must
 					be divisible by
 					OS_FILE_LOG_BLOCK_SIZE */
 	ulint		new_data_offset)/*!< in: start offset of new data in
@@ -1238,15 +1229,15 @@ log_group_write_buf(
 					if we have to write a new log file
 					header */
 {
-	ulint	write_len;
-	ibool	write_header;
-	ulint	next_offset;
-	ulint	i;
+	ulint		write_len;
+	ibool		write_header;
+	lsn_t		next_offset;
+	ulint		i;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
 	ut_ad(!recv_no_log_write);
 	ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
-	ut_a(((ulint) start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
+	ut_a(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
 
 	if (new_data_offset == 0) {
 		write_header = TRUE;
@@ -1265,17 +1256,21 @@ loop:
 	    && write_header) {
 		/* We start to write a new log file instance in the group */
 
-		log_group_file_header_flush(group,
-					    next_offset / group->file_size,
+		ut_a(next_offset / group->file_size <= ULINT_MAX);
+
+		log_group_file_header_flush(group, (ulint)
+					    (next_offset / group->file_size),
 					    start_lsn);
-		srv_os_log_written+= OS_FILE_LOG_BLOCK_SIZE;
+		srv_os_log_written += OS_FILE_LOG_BLOCK_SIZE;
 		srv_log_writes++;
 	}
 
 	if ((next_offset % group->file_size) + len > group->file_size) {
 
-		write_len = group->file_size
-			- (next_offset % group->file_size);
+		/* if the above condition holds, then the below expression
+		is < len which is ulint, so the typecast is ok */
+		write_len = (ulint)
+			(group->file_size - (next_offset % group->file_size));
 	} else {
 		write_len = len;
 	}
@@ -1285,11 +1280,11 @@ loop:
 
 		fprintf(stderr,
 			"Writing log file segment to group %lu"
-			" offset %lu len %lu\n"
-			"start lsn %llu\n"
+			" offset " LSN_PF " len %lu\n"
+			"start lsn " LSN_PF "\n"
 			"First block n:o %lu last block n:o %lu\n",
-			(ulong) group->id, (ulong) next_offset,
-			(ulong) write_len,
+			(ulong) group->id, next_offset,
+			write_len,
 			start_lsn,
 			(ulong) log_block_get_hdr_no(buf),
 			(ulong) log_block_get_hdr_no(
@@ -1319,13 +1314,16 @@ loop:
 
 		srv_os_log_pending_writes++;
 
+		ut_a(next_offset / UNIV_PAGE_SIZE <= ULINT_MAX);
+
 		fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, 0,
-		       next_offset / UNIV_PAGE_SIZE,
-		       next_offset % UNIV_PAGE_SIZE, write_len, buf, group);
+		       (ulint) (next_offset / UNIV_PAGE_SIZE),
+		       (ulint) (next_offset % UNIV_PAGE_SIZE), write_len, buf,
+		       group);
 
 		srv_os_log_pending_writes--;
 
-		srv_os_log_written+= write_len;
+		srv_os_log_written += write_len;
 		srv_log_writes++;
 	}
 
@@ -1349,14 +1347,14 @@ UNIV_INTERN
 void
 log_write_up_to(
 /*============*/
-	ib_uint64_t	lsn,	/*!< in: log sequence number up to which
-				the log should be written,
-				IB_ULONGLONG_MAX if not specified */
-	ulint		wait,	/*!< in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
-				or LOG_WAIT_ALL_GROUPS */
-	ibool		flush_to_disk)
-				/*!< in: TRUE if we want the written log
-				also to be flushed to disk */
+	lsn_t	lsn,	/*!< in: log sequence number up to which
+			the log should be written,
+			IB_ULONGLONG_MAX if not specified */
+	ulint	wait,	/*!< in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
+			or LOG_WAIT_ALL_GROUPS */
+	ibool	flush_to_disk)
+			/*!< in: TRUE if we want the written log
+			also to be flushed to disk */
 {
 	log_group_t*	group;
 	ulint		start_offset;
@@ -1450,7 +1448,7 @@ loop:
 #ifdef UNIV_DEBUG
 	if (log_debug_writes) {
 		fprintf(stderr,
-			"Writing log from %llu up to lsn %llu\n",
+			"Writing log from " LSN_PF " up to lsn " LSN_PF "\n",
 			log_sys->written_to_all_lsn,
 			log_sys->lsn);
 	}
@@ -1576,7 +1574,7 @@ void
 log_buffer_flush_to_disk(void)
 /*==========================*/
 {
-	ib_uint64_t	lsn;
+	lsn_t	lsn;
 
 	mutex_enter(&(log_sys->mutex));
 
@@ -1598,7 +1596,7 @@ log_buffer_sync_in_background(
 /*==========================*/
 	ibool	flush)	/*!< in: flush the logs to disk */
 {
-	ib_uint64_t	lsn;
+	lsn_t	lsn;
 
 	mutex_enter(&(log_sys->mutex));
 
@@ -1618,8 +1616,8 @@ void
 log_flush_margin(void)
 /*==================*/
 {
-	log_t*		log	= log_sys;
-	ib_uint64_t	lsn	= 0;
+	log_t*	log	= log_sys;
+	lsn_t	lsn	= 0;
 
 	mutex_enter(&(log->mutex));
 
@@ -1650,9 +1648,8 @@ static
 ibool
 log_preflush_pool_modified_pages(
 /*=============================*/
-	ib_uint64_t	new_oldest)	/*!< in: try to advance
-					oldest_modified_lsn at least
-					to this lsn */
+	lsn_t	new_oldest)	/*!< in: try to advance oldest_modified_lsn
+				at least to this lsn */
 {
 	ulint	n_pages;
 
@@ -1775,6 +1772,7 @@ log_group_checkpoint(
 	ib_uint64_t	archived_lsn;
 	ib_uint64_t	next_archived_lsn;
 #endif /* UNIV_LOG_ARCHIVE */
+	lsn_t		lsn_offset;
 	ulint		write_offset;
 	ulint		fold;
 	byte*		buf;
@@ -1790,9 +1788,12 @@ log_group_checkpoint(
 	mach_write_to_8(buf + LOG_CHECKPOINT_NO, log_sys->next_checkpoint_no);
 	mach_write_to_8(buf + LOG_CHECKPOINT_LSN, log_sys->next_checkpoint_lsn);
 
-	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
-			log_group_calc_lsn_offset(
-				log_sys->next_checkpoint_lsn, group));
+	lsn_offset = log_group_calc_lsn_offset(log_sys->next_checkpoint_lsn,
+					       group);
+	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET_LOW32,
+			lsn_offset & 0xFFFFFFFFUL);
+	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET_HIGH32,
+			lsn_offset >> 32);
 
 	mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
 
@@ -1920,8 +1921,9 @@ log_reset_first_header_and_checkpoint(
 	mach_write_to_8(buf + LOG_CHECKPOINT_NO, 0);
 	mach_write_to_8(buf + LOG_CHECKPOINT_LSN, lsn);
 
-	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
+	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET_LOW32,
 			LOG_FILE_HDR_SIZE + LOG_BLOCK_HDR_SIZE);
+	mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET_HIGH32, 0);
 
 	mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, 2 * 1024 * 1024);
 
@@ -2000,7 +2002,7 @@ log_checkpoint(
 				parameter TRUE, a physical write will always be
 				made to log files */
 {
-	ib_uint64_t	oldest_lsn;
+	lsn_t	oldest_lsn;
 
 	if (recv_recovery_is_on()) {
 		recv_apply_hashed_log_recs(TRUE);
@@ -2057,8 +2059,8 @@ log_checkpoint(
 
 #ifdef UNIV_DEBUG
 	if (log_debug_writes) {
-		fprintf(stderr, "Making checkpoint no %lu at lsn %llu\n",
-			(ulong) log_sys->next_checkpoint_no,
+		fprintf(stderr, "Making checkpoint no %llu at lsn " LSN_PF "\n",
+			log_sys->next_checkpoint_no,
 			oldest_lsn);
 	}
 #endif /* UNIV_DEBUG */
@@ -2084,16 +2086,16 @@ UNIV_INTERN
 void
 log_make_checkpoint_at(
 /*===================*/
-	ib_uint64_t	lsn,		/*!< in: make a checkpoint at this or a
-					later lsn, if IB_ULONGLONG_MAX, makes
-					a checkpoint at the latest lsn */
-	ibool		write_always)	/*!< in: the function normally checks if
-					the new checkpoint would have a
-					greater lsn than the previous one: if
-					not, then no physical write is done;
-					by setting this parameter TRUE, a
-					physical write will always be made to
-					log files */
+	lsn_t	lsn,		/*!< in: make a checkpoint at this or a
+				later lsn, if IB_ULONGLONG_MAX, makes
+				a checkpoint at the latest lsn */
+	ibool	write_always)	/*!< in: the function normally checks if
+				the new checkpoint would have a
+				greater lsn than the previous one: if
+				not, then no physical write is done;
+				by setting this parameter TRUE, a
+				physical write will always be made to
+				log files */
 {
 	/* Preflush pages synchronously */
 
@@ -2105,23 +2107,33 @@ log_make_checkpoint_at(
 /****************************************************************//**
 Checks if an asynchronous flushing of dirty pages is required in the
 background. This function is only called from the page cleaner thread.
-@return lsn to which the flushing should happen or IB_ULONGLONG_MAX
+@return lsn to which the flushing should happen or LSN_MAX
 if flushing is not required */
 UNIV_INTERN
-ib_uint64_t
+lsn_t
 log_async_flush_lsn(void)
 /*=====================*/
 {
-	ib_int64_t	age_diff;
-	ib_uint64_t	oldest_lsn;
+	lsn_t	age;
+	lsn_t	oldest_lsn;
+	lsn_t	new_lsn = LSN_MAX;
 
 	mutex_enter(&log_sys->mutex);
+
 	oldest_lsn = log_buf_pool_get_oldest_modification();
-	age_diff = log_sys->lsn - oldest_lsn
-		   - log_sys->max_modified_age_async;
+
+	ut_a(log_sys->lsn >= oldest_lsn);
+	age = log_sys->lsn - oldest_lsn;
+
+	if (age > log_sys->max_modified_age_async) {
+		/* An asynchronous preflush is required */
+		ut_a(log_sys->lsn >= log_sys->max_modified_age_async);
+		new_lsn = log_sys->lsn - log_sys->max_modified_age_async;
+	}
+
 	mutex_exit(&log_sys->mutex);
 
-	return(age_diff > 0 ? oldest_lsn + age_diff : IB_ULONGLONG_MAX);
+	return(new_lsn);
 }
 
 /****************************************************************//**
@@ -2135,10 +2147,10 @@ log_checkpoint_margin(void)
 /*=======================*/
 {
 	log_t*		log		= log_sys;
-	ib_uint64_t	age;
-	ib_uint64_t	checkpoint_age;
+	lsn_t		age;
+	lsn_t		checkpoint_age;
 	ib_uint64_t	advance;
-	ib_uint64_t	oldest_lsn;
+	lsn_t		oldest_lsn;
 	ibool		checkpoint_sync;
 	ibool		do_checkpoint;
 	ibool		success;
@@ -2188,7 +2200,7 @@ loop:
 	mutex_exit(&(log->mutex));
 
 	if (advance) {
-		ib_uint64_t	new_oldest = oldest_lsn + advance;
+		lsn_t	new_oldest = oldest_lsn + advance;
 
 		success = log_preflush_pool_modified_pages(new_oldest);
 
@@ -2224,11 +2236,11 @@ log_group_read_log_seg(
 	ulint		type,		/*!< in: LOG_ARCHIVE or LOG_RECOVER */
 	byte*		buf,		/*!< in: buffer where to read */
 	log_group_t*	group,		/*!< in: log group */
-	ib_uint64_t	start_lsn,	/*!< in: read area start */
-	ib_uint64_t	end_lsn)	/*!< in: read area end */
+	lsn_t		start_lsn,	/*!< in: read area start */
+	lsn_t		end_lsn)	/*!< in: read area end */
 {
 	ulint	len;
-	ulint	source_offset;
+	lsn_t	source_offset;
 	ibool	sync;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
@@ -2237,13 +2249,17 @@ log_group_read_log_seg(
 loop:
 	source_offset = log_group_calc_lsn_offset(start_lsn, group);
 
+	ut_a(end_lsn - start_lsn <= ULINT_MAX);
 	len = (ulint) (end_lsn - start_lsn);
 
 	ut_ad(len != 0);
 
 	if ((source_offset % group->file_size) + len > group->file_size) {
 
-		len = group->file_size - (source_offset % group->file_size);
+		/* If the above condition is true then len (which is ulint)
+		is > the expression below, so the typecast is ok */
+		len = (ulint) (group->file_size -
+			(source_offset % group->file_size));
 	}
 
 #ifdef UNIV_LOG_ARCHIVE
@@ -2257,8 +2273,11 @@ loop:
 
 	MONITOR_INC(MONITOR_LOG_IO);
 
+	ut_a(source_offset / UNIV_PAGE_SIZE <= ULINT_MAX);
+
 	fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0,
-	       source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE,
+	       (ulint) (source_offset / UNIV_PAGE_SIZE),
+	       (ulint) (source_offset % UNIV_PAGE_SIZE),
 	       len, buf, NULL);
 
 	start_lsn += len;
@@ -2371,14 +2390,14 @@ log_group_archive(
 /*==============*/
 	log_group_t*	group)	/*!< in: log group */
 {
-	os_file_t	 file_handle;
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
+	os_file_t	file_handle;
+	lsn_t		start_lsn;
+	lsn_t		end_lsn;
 	char		name[1024];
 	byte*		buf;
 	ulint		len;
 	ibool		ret;
-	ulint		next_offset;
+	lsn_t		next_offset;
 	ulint		n_files;
 	ulint		open_mode;
 
@@ -2485,7 +2504,8 @@ loop:
 	MONITOR_INC(MONITOR_LOG_IO);
 
 	fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->archive_space_id,
-	       next_offset / UNIV_PAGE_SIZE, next_offset % UNIV_PAGE_SIZE,
+	       (ulint) (next_offset / UNIV_PAGE_SIZE),
+	       (ulint) (next_offset % UNIV_PAGE_SIZE),
 	       ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,
 	       &log_archive_io);
 
@@ -3119,7 +3139,7 @@ void
 logs_empty_and_mark_files_at_shutdown(void)
 /*=======================================*/
 {
-	ib_uint64_t		lsn;
+	lsn_t			lsn;
 	ulint			arch_log_no;
 	ulint			count = 0;
 	ulint			total_trx;
@@ -3298,7 +3318,7 @@ loop:
 	log_archive_all();
 #endif /* UNIV_LOG_ARCHIVE */
 
-	log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+	log_make_checkpoint_at(LSN_MAX, TRUE);
 
 	mutex_enter(&(log_sys->mutex));
 
@@ -3371,8 +3391,8 @@ loop:
 	if (lsn < srv_start_lsn) {
 		fprintf(stderr,
 			"InnoDB: Error: log sequence number"
-			" at shutdown %llu\n"
-			"InnoDB: is lower than at startup %llu!\n",
+			" at shutdown " LSN_PF "\n"
+			"InnoDB: is lower than at startup " LSN_PF "!\n",
 			lsn, srv_start_lsn);
 	}
 
@@ -3450,7 +3470,7 @@ UNIV_INTERN
 ibool
 log_peek_lsn(
 /*=========*/
-	ib_uint64_t*	lsn)	/*!< out: if returns TRUE, current lsn is here */
+	lsn_t*	lsn)	/*!< out: if returns TRUE, current lsn is here */
 {
 	if (0 == mutex_enter_nowait(&(log_sys->mutex))) {
 		*lsn = log_sys->lsn;
@@ -3477,10 +3497,10 @@ log_print(
 	mutex_enter(&(log_sys->mutex));
 
 	fprintf(file,
-		"Log sequence number %llu\n"
-		"Log flushed up to   %llu\n"
-		"Pages flushed up to %llu\n"
-		"Last checkpoint at  %llu\n",
+		"Log sequence number " LSN_PF "\n"
+		"Log flushed up to   " LSN_PF "\n"
+		"Pages flushed up to " LSN_PF "\n"
+		"Last checkpoint at  " LSN_PF "\n",
 		log_sys->lsn,
 		log_sys->flushed_to_disk_lsn,
 		log_buf_pool_get_oldest_modification(),

=== modified file 'storage/innobase/log/log0recv.c'
--- a/storage/innobase/log/log0recv.c	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/log/log0recv.c	2011-03-14 13:00:56 +0000
@@ -146,7 +146,7 @@ UNIV_INTERN ulint	recv_n_pool_free_frame
 /** The maximum lsn we see for a page during the recovery process. If this
 is bigger than the lsn we are able to scan up to, that is an indication that
 the recovery failed and the database may be corrupt. */
-UNIV_INTERN ib_uint64_t	recv_max_page_lsn;
+UNIV_INTERN lsn_t	recv_max_page_lsn;
 
 #ifdef UNIV_PFS_THREAD
 UNIV_INTERN mysql_pfs_key_t	trx_rollback_clean_thread_key;
@@ -410,24 +410,23 @@ void
 recv_truncate_group(
 /*================*/
 	log_group_t*	group,		/*!< in: log group */
-	ib_uint64_t	recovered_lsn,	/*!< in: recovery succeeded up to this
+	lsn_t		recovered_lsn,	/*!< in: recovery succeeded up to this
 					lsn */
-	ib_uint64_t	limit_lsn,	/*!< in: this was the limit for
+	lsn_t		limit_lsn,	/*!< in: this was the limit for
 					recovery */
-	ib_uint64_t	checkpoint_lsn,	/*!< in: recovery was started from this
+	lsn_t		checkpoint_lsn,	/*!< in: recovery was started from this
 					checkpoint */
-	ib_uint64_t	archived_lsn)	/*!< in: the log has been archived up to
+	lsn_t		archived_lsn)	/*!< in: the log has been archived up to
 					this lsn */
 {
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
-	ib_uint64_t	finish_lsn1;
-	ib_uint64_t	finish_lsn2;
-	ib_uint64_t	finish_lsn;
-	ulint		len;
+	lsn_t		start_lsn;
+	lsn_t		end_lsn;
+	lsn_t		finish_lsn1;
+	lsn_t		finish_lsn2;
+	lsn_t		finish_lsn;
 	ulint		i;
 
-	if (archived_lsn == IB_ULONGLONG_MAX) {
+	if (archived_lsn == LSN_MAX) {
 		/* Checkpoint was taken in the NOARCHIVELOG mode */
 		archived_lsn = checkpoint_lsn;
 	}
@@ -440,7 +439,7 @@ recv_truncate_group(
 					 OS_FILE_LOG_BLOCK_SIZE)
 		+ recv_sys->last_log_buf_size;
 
-	if (limit_lsn != IB_ULONGLONG_MAX) {
+	if (limit_lsn != LSN_MAX) {
 		/* We do not know how far we should erase log records: erase
 		as much as possible */
 
@@ -465,11 +464,13 @@ recv_truncate_group(
 	if (start_lsn != recovered_lsn) {
 		/* Copy the last incomplete log block to the log buffer and
 		edit its data length: */
+		lsn_t	diff = recovered_lsn - start_lsn;
+
+		ut_a(diff <= 0xFFFFUL);
 
 		ut_memcpy(log_sys->buf, recv_sys->last_block,
 			  OS_FILE_LOG_BLOCK_SIZE);
-		log_block_set_data_len(log_sys->buf,
-				       (ulint) (recovered_lsn - start_lsn));
+		log_block_set_data_len(log_sys->buf, (ulint) diff);
 	}
 
 	if (start_lsn >= finish_lsn) {
@@ -478,6 +479,8 @@ recv_truncate_group(
 	}
 
 	for (;;) {
+		ulint	len;
+
 		end_lsn = start_lsn + RECV_SCAN_SIZE;
 
 		if (end_lsn > finish_lsn) {
@@ -514,12 +517,11 @@ recv_copy_group(
 						group */
 	log_group_t*	group,			/*!< in: copy to this log
 						group */
-	ib_uint64_t	recovered_lsn)		/*!< in: recovery succeeded up
+	lsn_t		recovered_lsn)		/*!< in: recovery succeeded up
 						to this lsn */
 {
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
-	ulint		len;
+	lsn_t		start_lsn;
+	lsn_t		end_lsn;
 
 	if (group->scanned_lsn >= recovered_lsn) {
 
@@ -531,6 +533,8 @@ recv_copy_group(
 	start_lsn = ut_uint64_align_down(group->scanned_lsn,
 					 OS_FILE_LOG_BLOCK_SIZE);
 	for (;;) {
+		ulint	len;
+
 		end_lsn = start_lsn + RECV_SCAN_SIZE;
 
 		if (end_lsn > recovered_lsn) {
@@ -567,9 +571,9 @@ recv_synchronize_groups(
 						log group */
 {
 	log_group_t*	group;
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
-	ib_uint64_t	recovered_lsn;
+	lsn_t		start_lsn;
+	lsn_t		end_lsn;
+	lsn_t		recovered_lsn;
 
 	recovered_lsn = recv_sys->recovered_lsn;
 
@@ -706,7 +710,9 @@ recv_find_max_checkpoint(
 			group->lsn = mach_read_from_8(
 				buf + LOG_CHECKPOINT_LSN);
 			group->lsn_offset = mach_read_from_4(
-				buf + LOG_CHECKPOINT_OFFSET);
+				buf + LOG_CHECKPOINT_OFFSET_LOW32);
+			group->lsn_offset |= ((lsn_t) mach_read_from_4(
+				buf + LOG_CHECKPOINT_OFFSET_HIGH32)) << 32;
 			checkpoint_no = mach_read_from_8(
 				buf + LOG_CHECKPOINT_NO);
 
@@ -760,8 +766,8 @@ recv_read_cp_info_for_backup(
 /*=========================*/
 	const byte*	hdr,	/*!< in: buffer containing the log group
 				header */
-	ib_uint64_t*	lsn,	/*!< out: checkpoint lsn */
-	ulint*		offset,	/*!< out: checkpoint offset in the log group */
+	lsn_t*		lsn,	/*!< out: checkpoint lsn */
+	lsn_t*		offset,	/*!< out: checkpoint offset in the log group */
 	ulint*		fsp_limit,/*!< out: fsp limit of space 0,
 				1000000000 if the database is running
 				with < version 3.23.50 of InnoDB */
@@ -796,7 +802,10 @@ recv_read_cp_info_for_backup(
 	cp_buf = hdr + max_cp;
 
 	*lsn = mach_read_from_8(cp_buf + LOG_CHECKPOINT_LSN);
-	*offset = mach_read_from_4(cp_buf + LOG_CHECKPOINT_OFFSET);
+	*offset = mach_read_from_4(
+		cp_buf + LOG_CHECKPOINT_OFFSET_LOW32);
+	*offset |= mach_read_from_4(
+		cp_buf + LOG_CHECKPOINT_OFFSET_HIGH32) << 32;
 
 	/* If the user is running a pre-3.23.50 version of InnoDB, its
 	checkpoint data does not contain the fsp limit info */
@@ -869,7 +878,7 @@ recv_scan_log_seg_for_backup(
 /*=========================*/
 	byte*		buf,		/*!< in: buffer containing log data */
 	ulint		buf_len,	/*!< in: data length in that buffer */
-	ib_uint64_t*	scanned_lsn,	/*!< in/out: lsn of buffer start,
+	lsn_t*		scanned_lsn,	/*!< in/out: lsn of buffer start,
 					we return scanned lsn */
 	ulint*		scanned_checkpoint_no,
 					/*!< in/out: 4 lowest bytes of the
@@ -1341,13 +1350,13 @@ static
 void
 recv_add_to_hash_table(
 /*===================*/
-	byte		type,		/*!< in: log record type */
-	ulint		space,		/*!< in: space id */
-	ulint		page_no,	/*!< in: page number */
-	byte*		body,		/*!< in: log record body */
-	byte*		rec_end,	/*!< in: log record end */
-	ib_uint64_t	start_lsn,	/*!< in: start lsn of the mtr */
-	ib_uint64_t	end_lsn)	/*!< in: end lsn of the mtr */
+	byte	type,		/*!< in: log record type */
+	ulint	space,		/*!< in: space id */
+	ulint	page_no,	/*!< in: page number */
+	byte*	body,		/*!< in: log record body */
+	byte*	rec_end,	/*!< in: log record end */
+	lsn_t	start_lsn,	/*!< in: start lsn of the mtr */
+	lsn_t	end_lsn)	/*!< in: end lsn of the mtr */
 {
 	recv_t*		recv;
 	ulint		len;
@@ -1472,10 +1481,10 @@ recv_recover_page_func(
 	recv_addr_t*	recv_addr;
 	recv_t*		recv;
 	byte*		buf;
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
-	ib_uint64_t	page_lsn;
-	ib_uint64_t	page_newest_lsn;
+	lsn_t		start_lsn;
+	lsn_t		end_lsn;
+	lsn_t		page_lsn;
+	lsn_t		page_newest_lsn;
 	ibool		modification_to_page;
 #ifndef UNIV_HOTBACKUP
 	ibool		success;
@@ -1590,7 +1599,7 @@ recv_recover_page_func(
 
 		if (recv->start_lsn >= page_lsn) {
 
-			ib_uint64_t	end_lsn;
+			lsn_t	end_lsn;
 
 			if (!modification_to_page) {
 
@@ -1847,10 +1856,10 @@ loop:
 		mutex_exit(&(recv_sys->mutex));
 		mutex_exit(&(log_sys->mutex));
 
- 		n_pages = buf_flush_list(ULINT_MAX, IB_ULONGLONG_MAX);
-  		ut_a(n_pages != ULINT_UNDEFINED);
-  
- 		buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
+		n_pages = buf_flush_list(ULINT_MAX, LSN_MAX);
+		ut_a(n_pages != ULINT_UNDEFINED);
+
+		buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
 
 		buf_pool_invalidate();
 
@@ -2070,7 +2079,7 @@ recv_parse_log_rec(
 
 #ifdef UNIV_LOG_LSN_DEBUG
 	if (*type == MLOG_LSN) {
-		ib_uint64_t	lsn = (ib_uint64_t) *space << 32 | *page_no;
+		lsn_t	lsn = (lsn_t) *space << 32 | *page_no;
 # ifdef UNIV_LOG_DEBUG
 		ut_a(lsn == log_sys->old_lsn);
 # else /* UNIV_LOG_DEBUG */
@@ -2096,21 +2105,20 @@ recv_parse_log_rec(
 /*******************************************************//**
 Calculates the new value for lsn when more data is added to the log. */
 static
-ib_uint64_t
+lsn_t
 recv_calc_lsn_on_data_add(
 /*======================*/
-	ib_uint64_t	lsn,	/*!< in: old lsn */
+	lsn_t		lsn,	/*!< in: old lsn */
 	ib_uint64_t	len)	/*!< in: this many bytes of data is
 				added, log block headers not included */
 {
-	ulint	frag_len;
-	ulint	lsn_len;
+	ulint		frag_len;
+	ib_uint64_t	lsn_len;
 
-	frag_len = (((ulint) lsn) % OS_FILE_LOG_BLOCK_SIZE)
-		- LOG_BLOCK_HDR_SIZE;
+	frag_len = (lsn % OS_FILE_LOG_BLOCK_SIZE) - LOG_BLOCK_HDR_SIZE;
 	ut_ad(frag_len < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
 	      - LOG_BLOCK_TRL_SIZE);
-	lsn_len = (ulint) len;
+	lsn_len = len;
 	lsn_len += (lsn_len + frag_len)
 		/ (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
 		   - LOG_BLOCK_TRL_SIZE)
@@ -2157,7 +2165,7 @@ recv_report_corrupt_log(
 	fprintf(stderr,
 		"InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
 		"InnoDB: Log record type %lu, space id %lu, page number %lu\n"
-		"InnoDB: Log parsing proceeded successfully up to %llu\n"
+		"InnoDB: Log parsing proceeded successfully up to " LSN_PF "\n"
 		"InnoDB: Previous log record type %lu, is multi %lu\n"
 		"InnoDB: Recv offset %lu, prev %lu\n",
 		(ulong) type, (ulong) space, (ulong) page_no,
@@ -2218,18 +2226,18 @@ recv_parse_log_recs(
 				to the hash table; this is set to FALSE if just
 				debug checking is needed */
 {
-	byte*		ptr;
-	byte*		end_ptr;
-	ulint		single_rec;
-	ulint		len;
-	ulint		total_len;
-	ib_uint64_t	new_recovered_lsn;
-	ib_uint64_t	old_lsn;
-	byte		type;
-	ulint		space;
-	ulint		page_no;
-	byte*		body;
-	ulint		n_recs;
+	byte*	ptr;
+	byte*	end_ptr;
+	ulint	single_rec;
+	ulint	len;
+	ulint	total_len;
+	lsn_t	new_recovered_lsn;
+	lsn_t	old_lsn;
+	byte	type;
+	ulint	space;
+	ulint	page_no;
+	byte*	body;
+	ulint	n_recs;
 
 	ut_ad(mutex_own(&(log_sys->mutex)));
 	ut_ad(recv_sys->parse_start_lsn != 0);
@@ -2467,7 +2475,7 @@ ibool
 recv_sys_add_to_parsing_buf(
 /*========================*/
 	const byte*	log_block,	/*!< in: log block */
-	ib_uint64_t	scanned_lsn)	/*!< in: lsn of how far we were able
+	lsn_t		scanned_lsn)	/*!< in: lsn of how far we were able
 					to find data in this log block */
 {
 	ulint	more_len;
@@ -2568,16 +2576,16 @@ recv_scan_log_recs(
 	const byte*	buf,		/*!< in: buffer containing a log
 					segment or garbage */
 	ulint		len,		/*!< in: buffer length */
-	ib_uint64_t	start_lsn,	/*!< in: buffer start lsn */
-	ib_uint64_t*	contiguous_lsn,	/*!< in/out: it is known that all log
+	lsn_t		start_lsn,	/*!< in: buffer start lsn */
+	lsn_t*		contiguous_lsn,	/*!< in/out: it is known that all log
 					groups contain contiguous log data up
 					to this lsn */
-	ib_uint64_t*	group_scanned_lsn)/*!< out: scanning succeeded up to
+	lsn_t*		group_scanned_lsn)/*!< out: scanning succeeded up to
 					this lsn */
 {
 	const byte*	log_block;
 	ulint		no;
-	ib_uint64_t	scanned_lsn;
+	lsn_t		scanned_lsn;
 	ibool		finished;
 	ulint		data_len;
 	ibool		more_data;
@@ -2609,7 +2617,7 @@ recv_scan_log_recs(
 				    log_block)) {
 				fprintf(stderr,
 					"InnoDB: Log block no %lu at"
-					" lsn %llu has\n"
+					" lsn " LSN_PF " has\n"
 					"InnoDB: ok header, but checksum field"
 					" contains %lu, should be %lu\n",
 					(ulong) no,
@@ -2690,7 +2698,7 @@ recv_scan_log_recs(
 
 				fprintf(stderr,
 					"InnoDB: Log scan progressed"
-					" past the checkpoint lsn %llu\n",
+					" past the checkpoint lsn " LSN_PF "\n",
 					recv_sys->scanned_lsn);
 				recv_init_crash_recovery();
 			}
@@ -2749,7 +2757,7 @@ recv_scan_log_recs(
 
 			fprintf(stderr,
 				"InnoDB: Doing recovery: scanned up to"
-				" log sequence number %llu\n",
+				" log sequence number " LSN_PF "\n",
 				*group_scanned_lsn);
 		}
 	}
@@ -2792,15 +2800,15 @@ void
 recv_group_scan_log_recs(
 /*=====================*/
 	log_group_t*	group,		/*!< in: log group */
-	ib_uint64_t*	contiguous_lsn,	/*!< in/out: it is known that all log
+	lsn_t*		contiguous_lsn,	/*!< in/out: it is known that all log
 					groups contain contiguous log data up
 					to this lsn */
-	ib_uint64_t*	group_scanned_lsn)/*!< out: scanning succeeded up to
+	lsn_t*		group_scanned_lsn)/*!< out: scanning succeeded up to
 					this lsn */
 {
-	ibool		finished;
-	ib_uint64_t	start_lsn;
-	ib_uint64_t	end_lsn;
+	ibool	finished;
+	lsn_t	start_lsn;
+	lsn_t	end_lsn;
 
 	finished = FALSE;
 
@@ -2825,7 +2833,7 @@ recv_group_scan_log_recs(
 	if (log_debug_writes) {
 		fprintf(stderr,
 			"InnoDB: Scanned group %lu up to"
-			" log sequence number %llu\n",
+			" log sequence number " LSN_PF "\n",
 			(ulong) group->id,
 			*group_scanned_lsn);
 	}
@@ -2884,34 +2892,30 @@ ulint
 recv_recovery_from_checkpoint_start_func(
 /*=====================================*/
 #ifdef UNIV_LOG_ARCHIVE
-	ulint		type,		/*!< in: LOG_CHECKPOINT or
-					LOG_ARCHIVE */
-	ib_uint64_t	limit_lsn,	/*!< in: recover up to this lsn
-					if possible */
+	ulint	type,		/*!< in: LOG_CHECKPOINT or LOG_ARCHIVE */
+	lsn_t	limit_lsn,	/*!< in: recover up to this lsn if possible */
 #endif /* UNIV_LOG_ARCHIVE */
-	ib_uint64_t	min_flushed_lsn,/*!< in: min flushed lsn from
-					data files */
-	ib_uint64_t	max_flushed_lsn)/*!< in: max flushed lsn from
-					data files */
+	lsn_t	min_flushed_lsn,/*!< in: min flushed lsn from data files */
+	lsn_t	max_flushed_lsn)/*!< in: max flushed lsn from data files */
 {
 	log_group_t*	group;
 	log_group_t*	max_cp_group;
 	log_group_t*	up_to_date_group;
 	ulint		max_cp_field;
-	ib_uint64_t	checkpoint_lsn;
+	lsn_t		checkpoint_lsn;
 	ib_uint64_t	checkpoint_no;
-	ib_uint64_t	old_scanned_lsn;
-	ib_uint64_t	group_scanned_lsn;
-	ib_uint64_t	contiguous_lsn;
+	lsn_t		old_scanned_lsn;
+	lsn_t		group_scanned_lsn;
+	lsn_t		contiguous_lsn;
 #ifdef UNIV_LOG_ARCHIVE
-	ib_uint64_t	archived_lsn;
+	lsn_t		archived_lsn;
 #endif /* UNIV_LOG_ARCHIVE */
 	byte*		buf;
 	byte		log_hdr_buf[LOG_FILE_HDR_SIZE];
 	ulint		err;
 
 #ifdef UNIV_LOG_ARCHIVE
-	ut_ad(type != LOG_CHECKPOINT || limit_lsn == IB_ULONGLONG_MAX);
+	ut_ad(type != LOG_CHECKPOINT || limit_lsn == LSN_MAX);
 /** TRUE when recovering from a checkpoint */
 # define TYPE_CHECKPOINT	(type == LOG_CHECKPOINT)
 /** Recover up to this log sequence number */
@@ -2920,7 +2924,7 @@ recv_recovery_from_checkpoint_start_func
 /** TRUE when recovering from a checkpoint */
 # define TYPE_CHECKPOINT	1
 /** Recover up to this log sequence number */
-# define LIMIT_LSN		IB_ULONGLONG_MAX
+# define LIMIT_LSN		LSN_MAX
 #endif /* UNIV_LOG_ARCHIVE */
 
 	if (TYPE_CHECKPOINT) {
@@ -3123,10 +3127,10 @@ recv_recovery_from_checkpoint_start_func
 					" ib_logfiles to start up"
 					" the database?\n"
 					"InnoDB: Log sequence number in"
-					" ib_logfiles is %llu, log\n"
+					" ib_logfiles is " LSN_PF ", log\n"
 					"InnoDB: sequence numbers stamped"
 					" to ibdata file headers are between\n"
-					"InnoDB: %llu and %llu.\n"
+					"InnoDB: " LSN_PF " and " LSN_PF ".\n"
 					"InnoDB: #########################"
 					"#################################\n",
 					checkpoint_lsn,
@@ -3156,7 +3160,8 @@ recv_recovery_from_checkpoint_start_func
 		fprintf(stderr,
 			"  InnoDB: ERROR: We were only able to scan the log"
 			" up to\n"
-			"InnoDB: %llu, but a checkpoint was at %llu.\n"
+			"InnoDB: " LSN_PF ", but a checkpoint was at "
+			LSN_PF ".\n"
 			"InnoDB: It is possible that"
 			" the database is now corrupt!\n",
 			group_scanned_lsn,
@@ -3167,8 +3172,8 @@ recv_recovery_from_checkpoint_start_func
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
 			"  InnoDB: ERROR: We were only able to scan the log"
-			" up to %llu\n"
-			"InnoDB: but a database page a had an lsn %llu."
+			" up to " LSN_PF "\n"
+			"InnoDB: but a database page a had an lsn " LSN_PF "."
 			" It is possible that the\n"
 			"InnoDB: database is now corrupt!\n",
 			group_scanned_lsn,
@@ -3343,7 +3348,7 @@ UNIV_INTERN
 void
 recv_reset_logs(
 /*============*/
-	ib_uint64_t	lsn,		/*!< in: reset to this lsn
+	lsn_t		lsn,		/*!< in: reset to this lsn
 					rounded up to be divisible by
 					OS_FILE_LOG_BLOCK_SIZE, after
 					which we add
@@ -3404,8 +3409,7 @@ recv_reset_logs(
 
 	/* Reset the checkpoint fields in logs */
 
-	log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
-	log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+	log_make_checkpoint_at(LSN_MAX, TRUE);
 
 	mutex_enter(&(log_sys->mutex));
 }
@@ -3420,8 +3424,8 @@ recv_reset_log_files_for_backup(
 /*============================*/
 	const char*	log_dir,	/*!< in: log file directory path */
 	ulint		n_log_files,	/*!< in: number of log files */
-	ulint		log_file_size,	/*!< in: log file size */
-	ib_uint64_t	lsn)		/*!< in: new start lsn, must be
+	lsn_t		log_file_size,	/*!< in: log file size */
+	lsn_t		lsn)		/*!< in: new start lsn, must be
 					divisible by OS_FILE_LOG_BLOCK_SIZE */
 {
 	os_file_t	log_file;

=== modified file 'storage/innobase/mem/mem0dbg.c'
--- a/storage/innobase/mem/mem0dbg.c	2010-07-16 21:00:50 +0000
+++ b/storage/innobase/mem/mem0dbg.c	2011-02-28 07:59:28 +0000
@@ -24,6 +24,8 @@ but is included in mem0mem.* !
 Created 6/9/1994 Heikki Tuuri
 *************************************************************************/
 
+#include "ha_prototypes.h"
+
 #ifdef UNIV_MEM_DEBUG
 # ifndef UNIV_HOTBACKUP
 /* The mutex which protects in the debug version the hash table
@@ -400,7 +402,7 @@ mem_hash_remove(
 		fprintf(stderr,
 			"Memory heap or buffer freed in %s line %lu"
 			" did not exist.\n",
-			file_name, (ulong) line);
+			innobase_basename(file_name), (ulong) line);
 		ut_error;
 	}
 
@@ -419,8 +421,9 @@ mem_hash_remove(
 			"in %s line %lu and tried to free in %s line %lu.\n"
 			"Hex dump of 400 bytes around memory heap"
 			" first block start:\n",
-			node->nth_heap, node->file_name, (ulong) node->line,
-			file_name, (ulong) line);
+			node->nth_heap,
+			innobase_basename(node->file_name), (ulong) node->line,
+			innobase_basename(file_name), (ulong) line);
 		ut_print_buf(stderr, (byte*)node->heap - 200, 400);
 		fputs("\nDump of the mem heap:\n", stderr);
 		mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
@@ -763,7 +766,8 @@ mem_validate_no_assert(void)
 					"Inconsistency in memory heap"
 					" or buffer created\n"
 					"in %s line %lu.\n",
-					node->file_name, node->line);
+					innobase_basename(node->file_name),
+					node->line);
 
 				mutex_exit(&mem_hash_mutex);
 
@@ -989,7 +993,8 @@ mem_print_info_low(
 		fprintf(outfile,
 			"%lu: file %s line %lu of size %lu phys.size %lu"
 			" with %lu blocks, type %lu\n",
-			node->nth_heap, node->file_name, node->line,
+			node->nth_heap,
+			innobase_basename(node->file_name), node->line,
 			allocated_mem, ph_size, n_blocks,
 			(node->heap)->type);
 next_heap:

=== modified file 'storage/innobase/mtr/mtr0mtr.c'
--- a/storage/innobase/mtr/mtr0mtr.c	2010-07-29 10:44:35 +0000
+++ b/storage/innobase/mtr/mtr0mtr.c	2011-03-15 16:01:03 +0000
@@ -52,6 +52,10 @@ mtr_memo_slot_release(
 	ut_ad(mtr);
 	ut_ad(slot);
 
+	/* slot release is a local operation for the current mtr.
+	We must not be holding the flush_order mutex while
+	doing this. */
+	ut_ad(!log_flush_order_mutex_own());
 #ifndef UNIV_DEBUG
 	UT_NOT_USED(mtr);
 #endif /* UNIV_DEBUG */
@@ -124,9 +128,7 @@ mtr_memo_slot_note_modification(
 	if (slot->object != NULL && slot->type == MTR_MEMO_PAGE_X_FIX) {
 		buf_block_t*	block = (buf_block_t*) slot->object;
 
-#ifdef UNIV_DEBUG
 		ut_ad(log_flush_order_mutex_own());
-#endif /* UNIV_DEBUG */
 		buf_flush_note_modification(block, mtr);
 	}
 }
@@ -330,7 +332,6 @@ mtr_memo_release(
 
 	offset = dyn_array_get_data_size(memo);
 
-	log_flush_order_mutex_enter();
 	while (offset > 0) {
 		offset -= sizeof(mtr_memo_slot_t);
 
@@ -349,7 +350,6 @@ mtr_memo_release(
 			break;
 		}
 	}
-	log_flush_order_mutex_exit();
 }
 #endif /* !UNIV_HOTBACKUP */
 

=== modified file 'storage/innobase/page/page0zip.c'
--- a/storage/innobase/page/page0zip.c	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/page/page0zip.c	2011-03-15 10:57:47 +0000
@@ -654,13 +654,13 @@ page_zip_dir_encode(
 Allocate memory for zlib. */
 static
 void*
-page_zip_malloc(
+page_zip_zalloc(
 /*============*/
 	void*	opaque,	/*!< in/out: memory heap */
 	uInt	items,	/*!< in: number of items to allocate */
 	uInt	size)	/*!< in: size of an item in bytes */
 {
-	return(mem_heap_alloc(opaque, items * size));
+	return(mem_heap_zalloc(opaque, items * size));
 }
 
 /**********************************************************************//**
@@ -685,7 +685,7 @@ page_zip_set_alloc(
 {
 	z_stream*	strm = stream;
 
-	strm->zalloc = page_zip_malloc;
+	strm->zalloc = page_zip_zalloc;
 	strm->zfree = page_zip_free;
 	strm->opaque = heap;
 }
@@ -2915,19 +2915,18 @@ zlib_error:
 
 	page_zip_set_alloc(&d_stream, heap);
 
-	if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT)
-			  != Z_OK)) {
-		ut_error;
-	}
-
 	d_stream.next_in = page_zip->data + PAGE_DATA;
 	/* Subtract the space reserved for
 	the page header and the end marker of the modification log. */
 	d_stream.avail_in = page_zip_get_size(page_zip) - (PAGE_DATA + 1);
-
 	d_stream.next_out = page + PAGE_ZIP_START;
 	d_stream.avail_out = UNIV_PAGE_SIZE - PAGE_ZIP_START;
 
+	if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT)
+			  != Z_OK)) {
+		ut_error;
+	}
+
 	/* Decode the zlib header and the index information. */
 	if (UNIV_UNLIKELY(inflate(&d_stream, Z_BLOCK) != Z_OK)) {
 

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/row/row0mysql.c	2011-03-09 07:32:36 +0000
@@ -2584,7 +2584,7 @@ row_import_tablespace_for_mysql(
 {
 	dict_table_t*	table;
 	ibool		success;
-	ib_uint64_t	current_lsn;
+	lsn_t		current_lsn;
 	ulint		err		= DB_SUCCESS;
 
 	ut_ad(trx->mysql_thd == NULL

=== modified file 'storage/innobase/row/row0sel.c'
--- a/storage/innobase/row/row0sel.c	2011-02-07 11:23:17 +0000
+++ b/storage/innobase/row/row0sel.c	2011-03-02 23:09:09 +0000
@@ -2662,8 +2662,18 @@ row_sel_field_store_in_mysql_format_func
 		ut_ad(templ->mysql_col_len >= len);
 		ut_ad(templ->mbmaxlen >= templ->mbminlen);
 
+		/* If field_no equals to templ->icp_rec_field_no,
+		we are examining a row pointed by "icp_rec_field_no".
+		There is possibility that icp_rec_field_no refers to
+		a field in a secondary index while templ->rec_field_no
+		points to field in a primary index. The length
+		should still be equal, unless the field pointed
+		by icp_rec_field_no has a prefix */
 		ut_ad(templ->mbmaxlen > templ->mbminlen
-		      || templ->mysql_col_len == len);
+		      || templ->mysql_col_len == len
+		      || (field_no == templ->icp_rec_field_no
+			  && field->prefix_len > 0));
+
 		/* The following assertion would fail for old tables
 		containing UTF-8 ENUM columns due to Bug #9526. */
 		ut_ad(!templ->mbmaxlen
@@ -3276,16 +3286,15 @@ row_sel_pop_cached_row_for_mysql(
 }
 
 /********************************************************************//**
-Pushes a row for MySQL to the fetch cache.
-@return TRUE on success, FALSE if the record contains incomplete BLOBs */
-UNIV_INLINE __attribute__((warn_unused_result))
-ibool
+Pushes a row for MySQL to the fetch cache. */
+UNIV_INLINE
+void
 row_sel_push_cache_row_for_mysql(
 /*=============================*/
 	byte*		mysql_rec,	/*!< in/out: MySQL record */
 	row_prebuilt_t*	prebuilt)	/*!< in/out: prebuilt struct */
 {
-	ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
+	ut_a(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
 	ut_a(!prebuilt->templ_contains_blob);
 
 	if (UNIV_UNLIKELY(prebuilt->fetch_cache[0] == NULL)) {
@@ -3317,12 +3326,7 @@ row_sel_push_cache_row_for_mysql(
 	memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
 	       mysql_rec, prebuilt->mysql_row_len);
 
-	if (++prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) {
-		return(FALSE);
-	}
-
-	row_sel_pop_cached_row_for_mysql(mysql_rec, prebuilt);
-	return(TRUE);
+	++prebuilt->n_fetch_cached;
 }
 
 /*********************************************************************//**
@@ -3426,6 +3430,8 @@ row_search_idx_cond_check(
 		return(ICP_MATCH);
 	}
 
+	MONITOR_INC(MONITOR_ICP_ATTEMPTS);
+
 	/* Convert to MySQL format those fields that are needed for
 	evaluating the index condition. */
 
@@ -3462,12 +3468,16 @@ row_search_idx_cond_check(
 				    mysql_rec, prebuilt, rec, FALSE,
 				    prebuilt->index, offsets)) {
 				ut_ad(dict_index_is_clust(prebuilt->index));
-				result = ICP_NO_MATCH;
+				return(ICP_NO_MATCH);
 			}
 		}
-		/* fall through */
+		MONITOR_INC(MONITOR_ICP_MATCH);
+		return(result);
 	case ICP_NO_MATCH:
+		MONITOR_INC(MONITOR_ICP_NO_MATCH);
+		return(result);
 	case ICP_OUT_OF_RANGE:
+		MONITOR_INC(MONITOR_ICP_OUT_OF_RANGE);
 		return(result);
 	}
 
@@ -4650,12 +4660,18 @@ requires_clust_rec:
 		not cache rows because there the cursor is a scrollable
 		cursor. */
 
+		ut_a(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
+
+		/* We only convert from InnoDB row format to MySQL row
+		format when ICP is disabled. */
+
 		if (!prebuilt->idx_cond
 		    && !row_sel_store_mysql_rec(
 			    buf, prebuilt, result_rec,
 			    result_rec != rec,
 			    result_rec != rec ? clust_index : index,
 			    offsets)) {
+
 			/* Only fresh inserts may contain incomplete
 			externally stored columns. Pretend that such
 			records do not exist. Such records may only be
@@ -4664,7 +4680,11 @@ requires_clust_rec:
 			transaction. Rollback happens at a lower
 			level, not here. */
 			goto next_rec;
-		} else if (row_sel_push_cache_row_for_mysql(buf, prebuilt)) {
+		}
+
+		row_sel_push_cache_row_for_mysql(buf, prebuilt);
+
+		if (prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) {
 			goto next_rec;
 		}
 	} else {

=== modified file 'storage/innobase/scripts/persistent_storage.sql'
--- a/storage/innobase/scripts/persistent_storage.sql	2011-01-14 14:36:20 +0000
+++ b/storage/innobase/scripts/persistent_storage.sql	2011-03-14 14:44:14 +0000
@@ -3,8 +3,8 @@ CREATE DATABASE innodb;
 
 -- DROP TABLE IF EXISTS innodb.table_stats;
 CREATE TABLE innodb.table_stats (
-	database_name			VARCHAR(512) NOT NULL,
-	table_name			VARCHAR(512) NOT NULL,
+	database_name			VARCHAR(64) NOT NULL,
+	table_name			VARCHAR(64) NOT NULL,
 	stats_timestamp			TIMESTAMP NOT NULL,
 	n_rows				BIGINT UNSIGNED NOT NULL,
 	clustered_index_size		BIGINT UNSIGNED NOT NULL,
@@ -14,9 +14,9 @@ CREATE TABLE innodb.table_stats (
 
 -- DROP TABLE IF EXISTS innodb.index_stats;
 CREATE TABLE innodb.index_stats (
-	database_name			VARCHAR(512) NOT NULL,
-	table_name			VARCHAR(512) NOT NULL,
-	index_name			VARCHAR(512) NOT NULL,
+	database_name			VARCHAR(64) NOT NULL,
+	table_name			VARCHAR(64) NOT NULL,
+	index_name			VARCHAR(64) NOT NULL,
 	stat_timestamp			TIMESTAMP NOT NULL,
 	/* there are at least:
 	stat_name='size'

=== modified file 'storage/innobase/srv/srv0mon.c'
--- a/storage/innobase/srv/srv0mon.c	2011-02-17 14:06:09 +0000
+++ b/storage/innobase/srv/srv0mon.c	2011-03-09 07:32:36 +0000
@@ -825,6 +825,26 @@ static monitor_info_t	innodb_counter_inf
 	 "Number of tables in background drop table list",
 	 0, 0, MONITOR_BACKGROUND_DROP_TABLE},
 
+	/* ===== Counters for ICP (Index Condition Pushdown) Module ===== */
+	{"module_icp", "icp", "Index Condition Pushdown",
+	 MONITOR_MODULE, 0, MONITOR_MODULE_ICP},
+
+	{"icp_attempts", "icp",
+	 "Number of attempts for index push-down condition checks",
+	 0, 0, MONITOR_ICP_ATTEMPTS},
+
+	{"icp_no_match", "icp",
+	 "Index push-down condition does not match",
+	 0, 0, MONITOR_ICP_NO_MATCH},
+
+	{"icp_out_of_range", "icp",
+	 "Index push-down condition out of range",
+	 0, 0, MONITOR_ICP_OUT_OF_RANGE},
+
+	{"icp_match", "icp",
+	 "Index push-down condition matches",
+	 0, 0, MONITOR_ICP_MATCH},
+
 	/* ========== To turn on/off reset all counters ========== */
 	{"all", "All Counters", "Turn on/off and reset all counters",
 	 MONITOR_MODULE, 0, MONITOR_ALL_COUNTER}
@@ -1154,7 +1174,7 @@ srv_mon_process_existing_counter(
 
 	/* innodb_os_log_written */
 	case MONITOR_OVLD_OS_LOG_WRITTEN:
-		value = srv_os_log_written;
+		value = (mon_type_t) srv_os_log_written;
 		break;
 
 	/* innodb_os_log_fsyncs */

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2011-02-22 10:00:07 +0000
+++ b/storage/innobase/srv/srv0srv.c	2011-03-09 07:32:36 +0000
@@ -163,7 +163,7 @@ UNIV_INTERN char**	srv_log_group_home_di
 UNIV_INTERN ulint	srv_n_log_groups	= ULINT_MAX;
 UNIV_INTERN ulint	srv_n_log_files		= ULINT_MAX;
 /* size in database pages */
-UNIV_INTERN ulint	srv_log_file_size	= ULINT_MAX;
+UNIV_INTERN ib_uint64_t	srv_log_file_size	= IB_UINT64_MAX;
 /* size in database pages */
 UNIV_INTERN ulint	srv_log_buffer_size	= ULINT_MAX;
 UNIV_INTERN ulong	srv_flush_log_at_trx_commit = 1;
@@ -272,7 +272,7 @@ UNIV_INTERN ulint srv_log_write_requests
 UNIV_INTERN ulint srv_log_writes = 0;
 
 /* amount of data written to the log files in bytes */
-UNIV_INTERN ulint srv_os_log_written = 0;
+UNIV_INTERN lsn_t srv_os_log_written = 0;
 
 /* amount of writes being done to the log files */
 UNIV_INTERN ulint srv_os_log_pending_writes = 0;
@@ -1848,8 +1848,8 @@ srv_error_monitor_thread(
 {
 	/* number of successive fatal timeouts observed */
 	ulint		fatal_cnt	= 0;
-	ib_uint64_t	old_lsn;
-	ib_uint64_t	new_lsn;
+	lsn_t		old_lsn;
+	lsn_t		new_lsn;
 	ib_int64_t	sig_count;
 
 	old_lsn = srv_start_lsn;
@@ -1873,9 +1873,9 @@ loop:
 	if (new_lsn < old_lsn) {
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
-			"  InnoDB: Error: old log sequence number %llu"
+			"  InnoDB: Error: old log sequence number " LSN_PF
 			" was greater\n"
-			"InnoDB: than the new log sequence number %llu!\n"
+			"InnoDB: than the new log sequence number " LSN_PF "!\n"
 			"InnoDB: Please submit a bug report"
 			" to http://bugs.mysql.com\n",
 			old_lsn, new_lsn);

=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/srv/srv0start.c	2011-03-14 13:00:56 +0000
@@ -90,9 +90,9 @@ Created 2/16/1996 Heikki Tuuri
 # include "zlib.h" /* for ZLIB_VERSION */
 
 /** Log sequence number immediately after startup */
-UNIV_INTERN ib_uint64_t	srv_start_lsn;
+UNIV_INTERN lsn_t	srv_start_lsn;
 /** Log sequence number at shutdown */
-UNIV_INTERN ib_uint64_t	srv_shutdown_lsn;
+UNIV_INTERN lsn_t	srv_shutdown_lsn;
 
 #ifdef HAVE_DARWIN_THREADS
 # include <sys/utsname.h>
@@ -528,9 +528,9 @@ static
 ulint
 srv_calc_low32(
 /*===========*/
-	ulint	file_size)	/*!< in: file size in database pages */
+	ib_uint64_t	file_size)	/*!< in: file size in database pages */
 {
-	return(0xFFFFFFFFUL & (file_size << UNIV_PAGE_SIZE_SHIFT));
+	return((ulint) (0xFFFFFFFFUL & (file_size << UNIV_PAGE_SIZE_SHIFT)));
 }
 
 /*********************************************************************//**
@@ -541,9 +541,9 @@ static
 ulint
 srv_calc_high32(
 /*============*/
-	ulint	file_size)	/*!< in: file size in database pages */
+	ib_uint64_t	file_size)	/*!< in: file size in database pages */
 {
-	return(file_size >> (32 - UNIV_PAGE_SIZE_SHIFT));
+	return((ulint) (file_size >> (32 - UNIV_PAGE_SIZE_SHIFT)));
 }
 
 /*********************************************************************//**
@@ -680,7 +680,11 @@ open_or_create_log_file(
 
 	ut_a(fil_validate());
 
-	fil_node_create(name, srv_log_file_size,
+	/* srv_log_file_size is measured in pages; if page size is 16KB,
+	then we have a limit of 64TB on 32 bit systems */
+	ut_a(srv_log_file_size <= ULINT_MAX);
+
+	fil_node_create(name, (ulint) srv_log_file_size,
 			2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
 #ifdef UNIV_LOG_ARCHIVE
 	/* If this is the first log group, create the file space object
@@ -721,9 +725,9 @@ open_or_create_data_files(
 	ulint*		max_arch_log_no,/*!< out: max of archived log
 					numbers in data files */
 #endif /* UNIV_LOG_ARCHIVE */
-	ib_uint64_t*	min_flushed_lsn,/*!< out: min of flushed lsn
+	lsn_t*		min_flushed_lsn,/*!< out: min of flushed lsn
 					values in data files */
-	ib_uint64_t*	max_flushed_lsn,/*!< out: max of flushed lsn
+	lsn_t*		max_flushed_lsn,/*!< out: max of flushed lsn
 					values in data files */
 	ulint*		sum_of_new_sizes)/*!< out: sum of sizes of the
 					new files added */
@@ -1000,8 +1004,8 @@ innobase_start_or_create_for_mysql(void)
 	ibool		log_file_created;
 	ibool		log_created	= FALSE;
 	ibool		log_opened	= FALSE;
-	ib_uint64_t	min_flushed_lsn;
-	ib_uint64_t	max_flushed_lsn;
+	lsn_t		min_flushed_lsn;
+	lsn_t		max_flushed_lsn;
 #ifdef UNIV_LOG_ARCHIVE
 	ulint		min_arch_log_no;
 	ulint		max_arch_log_no;
@@ -1422,11 +1426,18 @@ innobase_start_or_create_for_mysql(void)
 	}
 #endif /* UNIV_LOG_ARCHIVE */
 
-	if (srv_n_log_files * srv_log_file_size >= 262144) {
+	if (srv_n_log_files * srv_log_file_size >= ULINT_MAX) {
+		/* fil_io() takes ulint as an argument and we are passing
+		(next_offset / UNIV_PAGE_SIZE) to it in log_group_write_buf().
+		So (next_offset / UNIV_PAGE_SIZE) must be less than ULINT_MAX.
+		So next_offset must be < ULINT_MAX * UNIV_PAGE_SIZE. This
+		means that we are limited to ULINT_MAX * UNIV_PAGE_SIZE which
+		is 64 TB on 32 bit systems. */
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
 			" InnoDB: Error: combined size of log files"
-			" must be < 4 GB\n");
+			" must be < %lu GB\n",
+			ULINT_MAX / 1073741824 * UNIV_PAGE_SIZE);
 
 		return(DB_ERROR);
 	}
@@ -1576,7 +1587,7 @@ innobase_start_or_create_for_mysql(void)
 			return(DB_ERROR);
 		}
 
-		if (max_flushed_lsn < (ib_uint64_t) 1000) {
+		if (max_flushed_lsn < (lsn_t) 1000) {
 			ut_print_timestamp(stderr);
 			fprintf(stderr,
 				" InnoDB: Cannot initialize created"
@@ -2017,7 +2028,7 @@ innobase_start_or_create_for_mysql(void)
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
 			" InnoDB: %s started; "
-			"log sequence number %llu\n",
+			"log sequence number " LSN_PF "\n",
 			INNODB_VERSION_STR, srv_start_lsn);
 	}
 
@@ -2305,7 +2316,7 @@ innobase_shutdown_for_mysql(void)
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
 			"  InnoDB: Shutdown completed;"
-			" log sequence number %llu\n",
+			" log sequence number " LSN_PF "\n",
 			srv_shutdown_lsn);
 	}
 

=== modified file 'storage/innobase/sync/sync0arr.c'
--- a/storage/innobase/sync/sync0arr.c	2011-01-18 10:37:13 +0000
+++ b/storage/innobase/sync/sync0arr.c	2011-02-25 09:27:27 +0000
@@ -40,6 +40,7 @@ Created 9/5/1995 Heikki Tuuri
 #include "os0sync.h"
 #include "os0file.h"
 #include "srv0srv.h"
+#include "ha_prototypes.h"
 
 /*
 			WAIT ARRAY
@@ -478,8 +479,8 @@ sync_array_cell_print(
 	fprintf(file,
 		"--Thread %lu has waited at %s line %lu"
 		" for %.2f seconds the semaphore:\n",
-		(ulong) os_thread_pf(cell->thread), cell->file,
-		(ulong) cell->line,
+		(ulong) os_thread_pf(cell->thread),
+		innobase_basename(cell->file), (ulong) cell->line,
 		difftime(time(NULL), cell->reservation_time));
 
 	if (type == SYNC_MUTEX) {
@@ -493,7 +494,8 @@ sync_array_cell_print(
 			"Last time reserved in file %s line %lu, "
 #endif /* UNIV_SYNC_DEBUG */
 			"waiters flag %lu\n",
-			(void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
+			(void*) mutex, innobase_basename(mutex->cfile_name),
+			(ulong) mutex->cline,
 			(ulong) mutex->lock_word,
 #ifdef UNIV_SYNC_DEBUG
 			mutex->file_name, (ulong) mutex->line,
@@ -512,7 +514,7 @@ sync_array_cell_print(
 
 		fprintf(file,
 			" RW-latch at %p created in file %s line %lu\n",
-			(void*) rwlock, rwlock->cfile_name,
+			(void*) rwlock, innobase_basename(rwlock->cfile_name),
 			(ulong) rwlock->cline);
 		writer = rw_lock_get_writer(rwlock);
 		if (writer != RW_LOCK_NOT_LOCKED) {
@@ -533,7 +535,7 @@ sync_array_cell_print(
 			(ulong) rw_lock_get_reader_count(rwlock),
 			(ulong) rwlock->waiters,
 			rwlock->lock_word,
-			rwlock->last_s_file_name,
+			innobase_basename(rwlock->last_s_file_name),
 			(ulong) rwlock->last_s_line,
 			rwlock->last_x_file_name,
 			(ulong) rwlock->last_x_line);

=== modified file 'storage/innobase/sync/sync0rw.c'
--- a/storage/innobase/sync/sync0rw.c	2011-02-15 09:52:01 +0000
+++ b/storage/innobase/sync/sync0rw.c	2011-02-28 07:59:28 +0000
@@ -39,6 +39,7 @@ Created 9/11/1995 Heikki Tuuri
 #include "mem0mem.h"
 #include "srv0srv.h"
 #include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */
+#include "ha_prototypes.h"
 
 /*
 	IMPLEMENTATION OF THE RW_LOCK
@@ -407,7 +408,8 @@ lock_loop:
 			" cfile %s cline %lu rnds %lu\n",
 			(ulong) os_thread_pf(os_thread_get_curr_id()),
 			(void*) lock,
-			lock->cfile_name, (ulong) lock->cline, (ulong) i);
+			innobase_basename(lock->cfile_name),
+			(ulong) lock->cline, (ulong) i);
 	}
 
 	/* We try once again to obtain the lock */
@@ -442,7 +444,8 @@ lock_loop:
 				"Thread %lu OS wait rw-s-lock at %p"
 				" cfile %s cline %lu\n",
 				os_thread_pf(os_thread_get_curr_id()),
-				(void*) lock, lock->cfile_name,
+				(void*) lock,
+				innobase_basename(lock->cfile_name),
 				(ulong) lock->cline);
 		}
 
@@ -664,7 +667,8 @@ lock_loop:
 			"Thread %lu spin wait rw-x-lock at %p"
 			" cfile %s cline %lu rnds %lu\n",
 			os_thread_pf(os_thread_get_curr_id()), (void*) lock,
-			lock->cfile_name, (ulong) lock->cline, (ulong) i);
+			innobase_basename(lock->cfile_name),
+			(ulong) lock->cline, (ulong) i);
 	}
 
 	sync_array_reserve_cell(sync_primary_wait_array,
@@ -687,7 +691,8 @@ lock_loop:
 			"Thread %lu OS wait for rw-x-lock at %p"
 			" cfile %s cline %lu\n",
 			os_thread_pf(os_thread_get_curr_id()), (void*) lock,
-			lock->cfile_name, (ulong) lock->cline);
+			innobase_basename(lock->cfile_name),
+			(ulong) lock->cline);
 	}
 
 	/* these stats may not be accurate */

=== modified file 'storage/innobase/sync/sync0sync.c'
--- a/storage/innobase/sync/sync0sync.c	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/sync/sync0sync.c	2011-02-28 07:59:28 +0000
@@ -43,6 +43,7 @@ Created 9/5/1995 Heikki Tuuri
 #ifdef UNIV_SYNC_DEBUG
 # include "srv0start.h" /* srv_is_being_started */
 #endif /* UNIV_SYNC_DEBUG */
+#include "ha_prototypes.h"
 
 /*
 	REASONS FOR IMPLEMENTING THE SPIN LOCK MUTEX
@@ -544,7 +545,8 @@ spin_loop:
 		"Thread %lu spin wait mutex at %p"
 		" cfile %s cline %lu rnds %lu\n",
 		(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
-		mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
+		innobase_basename(mutex->cfile_name),
+		(ulong) mutex->cline, (ulong) i);
 #endif
 
 	mutex_spin_round_count += i;
@@ -621,7 +623,8 @@ spin_loop:
 	fprintf(stderr,
 		"Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n",
 		(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
-		mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
+		innobase_basename(mutex->cfile_name),
+		(ulong) mutex->cline, (ulong) i);
 #endif
 
 	mutex_os_wait_count++;
@@ -870,7 +873,8 @@ sync_print_warning(
 	if (mutex->magic_n == MUTEX_MAGIC_N) {
 		fprintf(stderr,
 			"Mutex created at %s %lu\n",
-			mutex->cfile_name, (ulong) mutex->cline);
+			innobase_basename(mutex->cfile_name),
+			(ulong) mutex->cline);
 
 		if (mutex_get_lock_word(mutex) != 0) {
 			ulint		line;

=== modified file 'storage/innobase/trx/trx0sys.c'
--- a/storage/innobase/trx/trx0sys.c	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/trx/trx0sys.c	2011-03-09 07:32:36 +0000
@@ -238,7 +238,7 @@ trx_sys_mark_upgraded_to_multiple_tables
 	mtr_commit(&mtr);
 
 	/* Flush the modified pages to disk and make a checkpoint */
-	log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+	log_make_checkpoint_at(LSN_MAX, TRUE);
 
 	trx_sys_multiple_tablespace_format = TRUE;
 }
@@ -407,7 +407,7 @@ start_again:
 		mtr_commit(&mtr);
 
 		/* Flush the modified pages to disk and make a checkpoint */
-		log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+		log_make_checkpoint_at(LSN_MAX, TRUE);
 
 		fprintf(stderr, "InnoDB: Doublewrite buffer created\n");
 

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	2011-02-22 05:11:15 +0000
+++ b/storage/innobase/trx/trx0trx.c	2011-03-09 07:32:36 +0000
@@ -734,7 +734,7 @@ Assign the transaction its history seria
 update UNDO log record to the assigned rollback segment.
 @return the LSN of the UNDO log write. */
 static
-ib_uint64_t
+lsn_t
 trx_write_serialisation_history(
 /*============================*/
 	trx_t*		trx)	/*!< in: transaction */
@@ -837,7 +837,7 @@ trx_commit(
 	trx_t*	trx)	/*!< in: transaction */
 {
 	trx_named_savept_t*	savep;
-	ib_uint64_t		lsn = 0;
+	lsn_t			lsn = 0;
 
 	ut_ad(trx->in_trx_list);
 	ut_ad(!trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY));
@@ -1188,7 +1188,7 @@ trx_commit_complete_for_mysql(
 /*==========================*/
 	trx_t*	trx)	/*!< in: trx handle */
 {
-	ib_uint64_t	lsn	= trx->commit_lsn;
+	lsn_t	lsn	= trx->commit_lsn;
 
 	ut_a(trx);
 
@@ -1522,7 +1522,7 @@ trx_prepare(
 	trx_t*	trx)	/*!< in/out: transaction */
 {
 	trx_rseg_t*	rseg;
-	ib_uint64_t	lsn;
+	lsn_t		lsn;
 	mtr_t		mtr;
 
 	rseg = trx->rseg;

=== modified file 'storage/innobase/ut/ut0dbg.c'
--- a/storage/innobase/ut/ut0dbg.c	2011-01-06 07:21:08 +0000
+++ b/storage/innobase/ut/ut0dbg.c	2011-02-25 09:27:27 +0000
@@ -25,6 +25,7 @@ Created 1/30/1994 Heikki Tuuri
 
 #include "univ.i"
 #include "ut0dbg.h"
+#include "ha_prototypes.h"
 
 #if defined(__GNUC__) && (__GNUC__ > 2)
 #else
@@ -55,12 +56,13 @@ ut_dbg_assertion_failed(
 	ut_print_timestamp(stderr);
 #ifdef UNIV_HOTBACKUP
 	fprintf(stderr, "  InnoDB: Assertion failure in file %s line %lu\n",
-		file, line);
+		innobase_basename(file), line);
 #else /* UNIV_HOTBACKUP */
 	fprintf(stderr,
 		"  InnoDB: Assertion failure in thread %lu"
 		" in file %s line %lu\n",
-		os_thread_pf(os_thread_get_curr_id()), file, line);
+		os_thread_pf(os_thread_get_curr_id()),
+		innobase_basename(file), line);
 #endif /* UNIV_HOTBACKUP */
 	if (expr) {
 		fprintf(stderr,
@@ -93,7 +95,8 @@ ut_dbg_stop_thread(
 {
 #ifndef UNIV_HOTBACKUP
 	fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
-		os_thread_pf(os_thread_get_curr_id()), file, line);
+		os_thread_pf(os_thread_get_curr_id()),
+		innobase_basename(file), line);
 	os_thread_sleep(1000000000);
 #endif /* !UNIV_HOTBACKUP */
 }

=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c	2010-10-20 19:02:59 +0000
+++ b/storage/myisam/myisamchk.c	2011-02-11 14:00:09 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -673,7 +673,8 @@ get_one_option(int optid,
     int method;
     enum_mi_stats_method UNINIT_VAR(method_conv);
     myisam_stats_method_str= argument;
-    if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0)
+    if ((method= find_type(argument, &myisam_stats_method_typelib,
+                           FIND_TYPE_BASIC)) <= 0)
     {
       fprintf(stderr, "Invalid value of stats_method: %s.\n", argument);
       exit(1);

=== modified file 'storage/myisammrg/myrg_open.c'
--- a/storage/myisammrg/myrg_open.c	2010-11-16 09:45:07 +0000
+++ b/storage/myisammrg/myrg_open.c	2011-02-11 14:00:09 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ MYRG_INFO *myrg_open(const char *name, i
     {
       if (!strncmp(buff+1,"INSERT_METHOD=",14))
       {			/* Lookup insert method */
-	int tmp=find_type(buff+15,&merge_insert_method,2);
+	int tmp= find_type(buff + 15, &merge_insert_method, FIND_TYPE_BASIC);
 	found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
       }
       continue;		/* Skip comments */
@@ -271,7 +271,7 @@ MYRG_INFO *myrg_parent_open(const char *
       {
         /* Compare buffer with global methods list: merge_insert_method. */
         insert_method= find_type(child_name_buff + 15,
-                                 &merge_insert_method, 2);
+                                 &merge_insert_method, FIND_TYPE_BASIC);
       }
       continue;
     }

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	2011-01-19 13:31:17 +0000
+++ b/strings/decimal.c	2011-03-03 14:25:41 +0000
@@ -248,7 +248,7 @@ void max_decimal(int precision, int frac
 }
 
 
-static dec1 *remove_leading_zeroes(decimal_t *from, int *intg_result)
+static dec1 *remove_leading_zeroes(const decimal_t *from, int *intg_result)
 {
   int intg= from->intg, i;
   dec1 *buf0= from->buf;
@@ -326,7 +326,7 @@ int decimal_actual_fraction(decimal_t *f
     E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW
 */
 
-int decimal2string(decimal_t *from, char *to, int *to_len,
+int decimal2string(const decimal_t *from, char *to, int *to_len,
                    int fixed_precision, int fixed_decimals,
                    char filler)
 {
@@ -942,7 +942,7 @@ fatal_error:
     E_DEC_OK/E_DEC_OVERFLOW/E_DEC_TRUNCATED
 */
 
-int decimal2double(decimal_t *from, double *to)
+int decimal2double(const decimal_t *from, double *to)
 {
   char strbuf[FLOATING_POINT_BUFFER], *end;
   int len= sizeof(strbuf);
@@ -1461,7 +1461,7 @@ int decimal_bin_size(int precision, int
 */
 
 int
-decimal_round(decimal_t *from, decimal_t *to, int scale,
+decimal_round(const decimal_t *from, decimal_t *to, int scale,
               decimal_round_mode mode)
 {
   int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1,
@@ -1695,7 +1695,7 @@ int decimal_result_size(decimal_t *from1
   return -1; /* shut up the warning */
 }
 
-static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
+static int do_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
       frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac),
@@ -1777,7 +1777,7 @@ static int do_add(decimal_t *from1, deci
 
 /* to=from1-from2.
    if to==0, return -1/0/+1 - the result of the comparison */
-static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
+static int do_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
       frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac);
@@ -1846,7 +1846,7 @@ static int do_sub(decimal_t *from1, deci
   /* ensure that always from1 > from2 (and intg1 >= intg2) */
   if (carry)
   {
-    swap_variables(decimal_t *,from1,from1);
+    swap_variables(const decimal_t *, from1, from2);
     swap_variables(dec1 *,start1, start2);
     swap_variables(int,intg1,intg2);
     swap_variables(int,frac1,frac2);
@@ -1912,35 +1912,35 @@ static int do_sub(decimal_t *from1, deci
   return error;
 }
 
-int decimal_intg(decimal_t *from)
+int decimal_intg(const decimal_t *from)
 {
   int res;
   remove_leading_zeroes(from, &res);
   return res;
 }
 
-int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
+int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   if (likely(from1->sign == from2->sign))
     return do_add(from1, from2, to);
   return do_sub(from1, from2, to);
 }
 
-int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
+int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   if (likely(from1->sign == from2->sign))
     return do_sub(from1, from2, to);
   return do_add(from1, from2, to);
 }
 
-int decimal_cmp(decimal_t *from1, decimal_t *from2)
+int decimal_cmp(const decimal_t *from1, const decimal_t *from2)
 {
   if (likely(from1->sign == from2->sign))
     return do_sub(from1, from2, 0);
   return from1->sign > from2->sign ? -1 : 1;
 }
 
-int decimal_is_zero(decimal_t *from)
+int decimal_is_zero(const decimal_t *from)
 {
   dec1 *buf1=from->buf,
        *end=buf1+ROUND_UP(from->intg)+ROUND_UP(from->frac);
@@ -1971,7 +1971,7 @@ int decimal_is_zero(decimal_t *from)
     XXX if this library is to be used with huge numbers of thousands of
     digits, fast multiplication must be implemented.
 */
-int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
+int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
       frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac),
@@ -2095,8 +2095,8 @@ int decimal_mul(decimal_t *from1, decima
   changed to malloc (or at least fallback to malloc if alloca() fails)
   but then, decimal_mul() should be rewritten too :(
 */
-static int do_div_mod(decimal_t *from1, decimal_t *from2,
-                       decimal_t *to, decimal_t *mod, int scale_incr)
+static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
+                      decimal_t *to, decimal_t *mod, int scale_incr)
 {
   int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1,
       frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2,
@@ -2181,9 +2181,12 @@ static int do_div_mod(decimal_t *from1,
   }
   buf0=to->buf;
   stop0=buf0+intg0+frac0;
+  DBUG_ASSERT(stop0 <= &to->buf[to->len]);
   if (likely(div_mod))
-    while (dintg++ < 0)
+    while (dintg++ < 0 && buf0 < &to->buf[to->len])
+    {
       *buf0++=0;
+    }
 
   len1=(i=ROUND_UP(prec1))+ROUND_UP(2*frac2+scale_incr+1) + 1;
   set_if_bigger(len1, 3);
@@ -2355,7 +2358,8 @@ done:
 */
 
 int
-decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to, int scale_incr)
+decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to,
+            int scale_incr)
 {
   return do_div_mod(from1, from2, to, 0, scale_incr);
 }
@@ -2387,7 +2391,7 @@ decimal_div(decimal_t *from1, decimal_t
    thus, there's no requirement for M or N to be integers
 */
 
-int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to)
+int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to)
 {
   return do_div_mod(from1, from2, 0, to, 0);
 }

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2011-03-15 13:03:22 +0000
+++ b/tests/mysql_client_test.c	2011-03-17 14:06:30 +0000
@@ -34,6 +34,7 @@
 #include <m_string.h>
 #include <mysqld_error.h>
 #include <sql_common.h>
+#include <mysql/client_plugin.h>
 
 #define VER "2.1"
 #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
@@ -59,6 +60,7 @@ static unsigned int test_count= 0;
 static unsigned int opt_count= 0;
 static unsigned int iter_count= 0;
 static my_bool have_innodb= FALSE;
+static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
 static const char *opt_basedir= "./";
 static const char *opt_vardir= "mysql-test/var";
@@ -245,6 +247,11 @@ static MYSQL *mysql_client_init(MYSQL* c
   if (res && shared_memory_base_name)
     mysql_options(res, MYSQL_SHARED_MEMORY_BASE_NAME, shared_memory_base_name);
 #endif
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(res, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(res, MYSQL_DEFAULT_AUTH, opt_default_auth);
   return res;
 }
 
@@ -328,6 +335,11 @@ static MYSQL* client_connect(ulong flag,
   /* enable local infile, in non-binary builds often disabled by default */
   mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0);
   mysql_options(mysql, MYSQL_OPT_PROTOCOL, &protocol);
+  if (opt_plugin_dir && *opt_plugin_dir)
+    mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
+
+  if (opt_default_auth && *opt_default_auth)
+    mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
 
   if (!(mysql_real_connect(mysql, opt_host, opt_user,
                            opt_password, opt_db ? opt_db:"test", opt_port,
@@ -19558,6 +19570,28 @@ static void test_bug57058()
 }
 
 
+/**
+  Bug#11766854: 60075: MYSQL_LOAD_CLIENT_PLUGIN DOESN'T CLEAR ERROR 
+*/
+
+static void test_bug11766854()
+{
+  struct st_mysql_client_plugin *plugin;
+
+  DBUG_ENTER("test_bug11766854");
+  myheader("test_bug11766854");
+
+  plugin= mysql_load_plugin(mysql, "foo", -1, 0);
+  DIE_UNLESS(plugin == 0);
+
+  plugin= mysql_load_plugin(mysql, "qa_auth_client", -1, 0);
+  DIE_UNLESS(plugin != 0);
+  DIE_IF(mysql_errno(mysql));
+
+  DBUG_VOID_RETURN;
+}
+
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -19615,6 +19649,12 @@ static struct my_option client_test_long
   {"getopt-ll-test", 'g', "Option for testing bug in getopt library",
    &opt_getopt_ll_test, &opt_getopt_ll_test, 0,
    GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
+  {"plugin_dir", 0, "Directory for client-side plugins.",
+   (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"default_auth", 0, "Default authentication client-side plugin to use.",
+   (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
+   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -19895,6 +19935,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug58036", test_bug58036 },
   { "test_bug57058", test_bug57058 },
   { "test_bug56976", test_bug56976 },
+  { "test_bug11766854", test_bug11766854 },
   { 0, 0 }
 };
 

=== modified file 'unittest/gunit/item-t.cc'
--- a/unittest/gunit/item-t.cc	2011-02-21 10:36:31 +0000
+++ b/unittest/gunit/item-t.cc	2011-03-18 12:25:56 +0000
@@ -24,6 +24,59 @@
 
 namespace {
 
+/*
+  A mock error handler for error_handler_hook.
+*/
+uint expected_error= 0;
+extern "C" void test_error_handler_hook(uint err, const char *str, myf MyFlags)
+{
+  EXPECT_EQ(expected_error, err) << str;
+}
+
+
+/**
+   A mock error handler which registers itself with the THD in the CTOR,
+   and unregisters in the DTOR. The function handle_condition() will
+   verify that it is called with the expected error number.
+   The DTOR will verify that handle_condition() has actually been called.
+*/
+class Mock_error_handler : public Internal_error_handler
+{
+public:
+  Mock_error_handler(THD *thd, uint expected_error)
+    : m_thd(thd),
+      m_expected_error(expected_error),
+      m_handle_called(0)
+  {
+    thd->push_internal_handler(this);
+  }
+
+  virtual ~Mock_error_handler()
+  {
+    // Strange Visual Studio bug: have to store 'this' in local variable.
+    Internal_error_handler *me= this;
+    EXPECT_EQ(me, m_thd->pop_internal_handler());
+    EXPECT_GE(m_handle_called, 0);
+  }
+
+  virtual bool handle_condition(THD *thd,
+                                uint sql_errno,
+                                const char* sqlstate,
+                                MYSQL_ERROR::enum_warning_level level,
+                                const char* msg,
+                                MYSQL_ERROR ** cond_hdl)
+  {
+    EXPECT_EQ(sql_errno, m_expected_error);
+    ++m_handle_called;
+    return true;
+  }
+private:
+  THD *m_thd;
+  uint m_expected_error;
+  int  m_handle_called;
+};
+
+
 class ItemTest : public ::testing::Test
 {
 protected:
@@ -39,9 +92,11 @@ protected:
     char *argv[] = { my_name, 0 };
     set_remaining_args(1, argv);
     init_common_variables();
+    my_init_signals();
     randominit(&sql_rand, 0, 0);
     xid_cache_init();
     delegates_init();
+    error_handler_hook= test_error_handler_hook;
   }
 
   static void TearDownTestCase()
@@ -54,10 +109,12 @@ protected:
 
   virtual void SetUp()
   {
+    expected_error= 0;
     m_thd= new THD(false);
     THD *stack_thd= m_thd;
     m_thd->thread_stack= (char*) &stack_thd;
     m_thd->store_globals();
+    lex_start(m_thd);
   }
 
   virtual void TearDown()
@@ -66,7 +123,7 @@ protected:
     delete m_thd;
   }
 
-  THD      *m_thd;
+  THD *m_thd;
 };
 
 
@@ -189,6 +246,38 @@ TEST_F(ItemTest, ItemFuncDesDecrypt)
 }
 
 
+TEST_F(ItemTest, ItemFuncIntDivOverflow)
+{
+  const char dividend_str[]=
+    "99999999999999999999999999999999999999999"
+    "99999999999999999999999999999999999999999";
+  const char divisor_str[]= "0.5";
+  Item_float *dividend= new Item_float(dividend_str, sizeof(dividend_str));
+  Item_float *divisor= new Item_float(divisor_str, sizeof(divisor_str));
+  Item_func_int_div* quotient= new Item_func_int_div(dividend, divisor);
+
+  Mock_error_handler error_handler(m_thd, ER_TRUNCATED_WRONG_VALUE);
+  EXPECT_FALSE(quotient->fix_fields(m_thd, NULL));
+  expected_error= ER_DATA_OUT_OF_RANGE;
+  quotient->val_int();
+}
+
+
+TEST_F(ItemTest, ItemFuncIntDivUnderflow)
+{
+  // Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
+  const char dividend_str[]= "1.175494351E-37";
+  const char divisor_str[]= "1.7976931348623157E+308";
+  Item_float *dividend= new Item_float(dividend_str, sizeof(dividend_str));
+  Item_float *divisor= new Item_float(divisor_str, sizeof(divisor_str));
+  Item_func_int_div* quotient= new Item_func_int_div(dividend, divisor);
+
+  Mock_error_handler error_handler(m_thd, ER_TRUNCATED_WRONG_VALUE);
+  EXPECT_FALSE(quotient->fix_fields(m_thd, NULL));
+  EXPECT_EQ(0, quotient->val_int());
+}
+
+
 /*
   This is not an exhaustive test. It simply demonstrates that more of the
   initializations in mysqld.cc are needed for testing Item_xxx classes.

Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20110321021639-ek6cl0rcraxi92kl.bundle
Thread
bzr push into mysql-trunk branch (chris.powers:3269 to 3270) Christopher Powers21 Mar