[packages/percona-server/v5.1.x: 18/21] up to 5.1.70, using percona tarball 5.1.70-rel14.8

glen glen at pld-linux.org
Wed Oct 21 16:09:40 CEST 2015


commit 9f8d0edd0c0ae213101ec789f9d69a7c6ca48856
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Fri Aug 9 03:20:01 2013 +0300

    up to 5.1.70, using percona tarball 5.1.70-rel14.8

 bug45702.patch                                     |  725 ---
 bug53761.patch                                     |  472 --
 bug813587.patch                                    |   29 -
 bug860910.patch                                    |   92 -
 ...e_query_cache_28249_test_sporadic_failure.patch |    8 -
 innodb_bug47167_test_fix.patch                     |   44 -
 innodb_fake_changes.patch                          |  768 ----
 innodb_kill_idle_transaction.patch                 |  402 --
 mysql-acc-pslist.patch                             |   80 -
 mysql-bug-34192.patch                              |   58 -
 mysql-bug580324.patch                              |  102 -
 mysql-bug677407.patch                              |  138 -
 mysql-bugfix48929.patch                            |  162 -
 mysql-control_online_alter_index.patch             |  107 -
 mysql-error_pad.patch                              |  266 --
 mysql-fix-bug671764.patch                          |   27 -
 mysql-i_s_innodb_buffer_pool_pages.patch           |  791 ----
 mysql-info.patch                                   |   15 -
 mysql-innodb_adjust_defaults.patch                 |   47 -
 mysql-innodb_admin_command_base.patch              |  192 -
 mysql-innodb_buffer_pool_shm.patch                 |  101 -
 mysql-innodb_bug60788.patch                        |  123 -
 mysql-innodb_deadlock_count.patch                  |  163 -
 mysql-innodb_dict_size_limit.patch                 |  485 --
 mysql-innodb_expand_fast_index_creation.patch      | 1434 ------
 mysql-innodb_expand_import.patch                   | 1072 -----
 mysql-innodb_expand_undo_slots.patch               |  144 -
 mysql-innodb_extend_slow.patch                     |  976 ----
 mysql-innodb_extra_rseg.patch                      |  384 --
 mysql-innodb_fast_checksum.patch                   |  287 --
 mysql-innodb_fast_shutdown.patch                   |  235 -
 mysql-innodb_files_extend.patch                    |  576 ---
 mysql-innodb_fix_misc.patch                        |  859 ----
 mysql-innodb_io_patches.patch                      | 1764 -------
 mysql-innodb_lru_dump_restore.patch                |  754 ---
 mysql-innodb_opt_lru_count.patch                   |  305 --
 mysql-innodb_overwrite_relay_log_info.patch        |  493 --
 mysql-innodb_pass_corrupt_table.patch              | 1345 ------
 mysql-innodb_purge_thread.patch                    |  514 ---
 mysql-innodb_recovery_patches.patch                |  513 ---
 mysql-innodb_rw_lock.patch                         | 1309 ------
 mysql-innodb_separate_doublewrite.patch            | 1096 -----
 mysql-innodb_show_enhancements.patch               |  259 --
 mysql-innodb_show_lock_name.patch                  |  371 --
 mysql-innodb_show_status.patch                     |  446 --
 mysql-innodb_show_sys_tables.patch                 |  736 ---
 mysql-innodb_split_buf_pool_mutex.patch            | 3951 ----------------
 mysql-innodb_stats.patch                           | 1830 --------
 mysql-innodb_swap_builtin_plugin.patch             |  211 -
 mysql-innodb_thread_concurrency_timer_based.patch  |  197 -
 mysql-libs.patch                                   |   16 -
 mysql-log_connection_error.patch                   |  161 -
 mysql-microsec_process.patch                       |   50 -
 mysql-microslow.patch                              |  699 ---
 mysql-mysql-syslog.patch                           |  133 -
 mysql-mysql_dump_ignore_ct.patch                   |   62 -
 mysql-mysql_remove_eol_carret.patch                |   74 -
 mysql-optimizer_fix.patch                          |  168 -
 mysql-profiling_slow.patch                         |  405 --
 mysql-query_cache_enhance.patch                    | 3481 --------------
 mysql-remove_fcntl_excessive_calls.patch           |   71 -
 mysql-response-time-distribution.patch             |  888 ----
 mysql-show_patches.patch                           |  263 --
 mysql-show_slave_status_nolock.patch               |  369 --
 mysql-show_temp_51.patch                           |  622 ---
 mysql-slow_extended.patch                          | 3090 -------------
 ...plit_buf_pool_mutex_fixed_optimistic_safe.patch | 1281 ------
 mysql-sql_no_fcache.patch                          |  434 --
 mysql-suppress_log_warning_1592.patch              |  154 -
 mysql-system-users.patch                           |   22 +-
 mysql-userstat.patch                               | 3453 --------------
 mysql-userstats.patch                              | 1466 ------
 mysql.spec                                         |  182 +-
 response_time_distribution.patch                   | 4842 --------------------
 slave_timeout_fix.patch                            |   11 -
 subunit.patch                                      |  199 -
 utf8_general50_ci.patch                            |  440 --
 warning_fixes.patch                                |   24 -
 xtradb_bug317074.patch                             |   57 -
 79 files changed, 33 insertions(+), 50542 deletions(-)
---
diff --git a/mysql.spec b/mysql.spec
index 0580524..c9e54a3 100644
--- a/mysql.spec
+++ b/mysql.spec
@@ -8,6 +8,10 @@
 # - segfaults on select from non-mysql user (caused by builder environment):
 #     https://bugs.launchpad.net/pld-linux/+bug/381904
 #     (profiling disabled temporaily to workaround this)
+# - add avoid-version for:
+#        /usr/lib64/mysql/plugin/mypluglib.so
+#        /usr/lib64/mysql/plugin/mypluglib.so.0
+#        /usr/lib64/mysql/plugin/mypluglib.so.0.0.0
 #
 # Conditional build:
 %bcond_with	autodeps	# BR packages needed only for resolving deps
@@ -21,6 +25,8 @@
 %bcond_with	tests		# FIXME: don't run correctly
 %bcond_with	ndb		# NDB is now a separate product, this here is broken, so disable it
 
+%define		rel	1
+%define		percona_rel	14.8
 %include	/usr/lib/rpm/macros.perl
 Summary:	MySQL: a very fast and reliable SQL database engine
 Summary(de.UTF-8):	MySQL: ist eine SQL-Datenbank
@@ -31,13 +37,13 @@ Summary(ru.UTF-8):	MySQL - быстрый SQL-сервер
 Summary(uk.UTF-8):	MySQL - швидкий SQL-сервер
 Summary(zh_CN.UTF-8):	MySQL数据库服务器
 Name:		mysql
-Version:	5.1.63
-Release:	0.1
+Version:	5.1.70
+Release:	%{percona_rel}.%{rel}
 License:	GPL + MySQL FLOSS Exception
 Group:		Applications/Databases
-#Source0Download: http://dev.mysql.com/downloads/mysql/5.1.html#source
-Source0:	http://vesta.informatik.rwth-aachen.de/mysql/Downloads/MySQL-5.1/%{name}-%{version}.tar.gz
-# Source0-md5:	672167c3f03f969febae66c43859d76d
+# Source0Download: http://www.percona.com/downloads/Percona-Server-5.1/LATEST/source/
+Source0:	http://www.percona.com/downloads/Percona-Server-5.1/LATEST/source/Percona-Server-%{version}-rel%{percona_rel}.tar.gz
+# Source0-md5:	164230ac7b449eb69f0918fc5b8b09f2
 Source100:	http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz
 # Source100-md5:	7b9b618cb9b378f949bb1b91ddcc4f54
 Source1:	%{name}.init
@@ -53,15 +59,12 @@ Source11:	%{name}-ndb-cpc.init
 Source12:	%{name}-ndb-cpc.sysconfig
 Source13:	%{name}-client.conf
 Source14:	my.cnf
-Source15:	percona.sh
 Patch0:		%{name}-libs.patch
 Patch1:		%{name}-libwrap.patch
 Patch2:		%{name}-c++.patch
-Patch3:		%{name}-info.patch
 Patch4:		%{name}-sql-cxx-pic.patch
 Patch5:		%{name}-noproc.patch
 Patch6:		%{name}-system-users.patch
-Patch7:		%{name}-bug-34192.patch
 Patch8:		%{name}-client-config.patch
 Patch9:		%{name}-build.patch
 Patch10:	%{name}-alpha.patch
@@ -72,75 +75,6 @@ Patch14:	%{name}-bug-43594.patch
 Patch15:	plugin-avoid-version.patch
 Patch16:	%{name}-fix-dummy-thread-race-condition.patch
 Patch18:	%{name}-sphinx.patch
-# <percona patches, http://www.percona.com/percona-lab.html>
-Patch100:	%{name}-innodb_swap_builtin_plugin.patch
-Patch101:	%{name}-show_patches.patch
-Patch102:	%{name}-slow_extended.patch
-Patch103:	%{name}-profiling_slow.patch
-Patch104:	%{name}-microsec_process.patch
-Patch105:	%{name}-userstat.patch
-Patch106:	%{name}-optimizer_fix.patch
-Patch107:	%{name}-show_temp_51.patch
-Patch108:	%{name}-suppress_log_warning_1592.patch
-Patch109:	%{name}-innodb_show_enhancements.patch
-Patch110:	%{name}-innodb_show_status.patch
-Patch111:	%{name}-innodb_io_patches.patch
-Patch112:	%{name}-innodb_opt_lru_count.patch
-Patch113:	%{name}-i_s_innodb_buffer_pool_pages.patch
-Patch114:	%{name}-innodb_expand_undo_slots.patch
-Patch115:	%{name}-innodb_extra_rseg.patch
-Patch116:	%{name}-innodb_overwrite_relay_log_info.patch
-Patch117:	%{name}-innodb_thread_concurrency_timer_based.patch
-Patch118:	%{name}-innodb_dict_size_limit.patch
-Patch119:	%{name}-innodb_split_buf_pool_mutex.patch
-Patch120:	%{name}-innodb_expand_import.patch
-Patch121:	%{name}-innodb_recovery_patches.patch
-Patch122:	%{name}-innodb_purge_thread.patch
-Patch123:	%{name}-innodb_admin_command_base.patch
-Patch124:	%{name}-innodb_show_lock_name.patch
-Patch125:	%{name}-innodb_extend_slow.patch
-Patch126:	%{name}-innodb_lru_dump_restore.patch
-Patch127:	%{name}-innodb_separate_doublewrite.patch
-Patch128:	%{name}-innodb_pass_corrupt_table.patch
-Patch129:	%{name}-innodb_stats.patch
-Patch130:	%{name}-innodb_fast_checksum.patch
-Patch131:	%{name}-innodb_files_extend.patch
-Patch132:	%{name}-innodb_show_sys_tables.patch
-Patch133:	%{name}-innodb_fix_misc.patch
-Patch134:	%{name}-innodb_adjust_defaults.patch
-Patch135:	innodb_kill_idle_transaction.patch
-Patch136:	innodb_fake_changes.patch
-Patch137:	%{name}-innodb_deadlock_count.patch
-Patch138:	%{name}-bug580324.patch
-Patch139:	%{name}-bugfix48929.patch
-Patch140:	%{name}-query_cache_enhance.patch
-Patch141:	%{name}-control_online_alter_index.patch
-Patch142:	%{name}-log_connection_error.patch
-Patch143:	%{name}-mysql-syslog.patch
-Patch144:	%{name}-innodb_buffer_pool_shm.patch
-Patch145:	%{name}-error_pad.patch
-Patch146:	response_time_distribution.patch
-Patch147:	%{name}-remove_fcntl_excessive_calls.patch
-Patch148:	%{name}-sql_no_fcache.patch
-Patch149:	%{name}-show_slave_status_nolock.patch
-Patch150:	%{name}-innodb_fast_shutdown.patch
-Patch151:	%{name}-bug677407.patch
-Patch152:	%{name}-fix-bug671764.patch
-Patch153:	%{name}-mysql_remove_eol_carret.patch
-Patch154:	%{name}-innodb_expand_fast_index_creation.patch
-Patch155:	%{name}-innodb_bug60788.patch
-Patch156:	slave_timeout_fix.patch
-Patch157:	utf8_general50_ci.patch
-Patch158:	bug813587.patch
-Patch159:	innodb_bug47167_test_fix.patch
-Patch160:	disable_query_cache_28249_test_sporadic_failure.patch
-Patch161:	bug53761.patch
-Patch162:	xtradb_bug317074.patch
-Patch163:	subunit.patch
-Patch164:	warning_fixes.patch
-Patch165:	bug860910.patch
-Patch166:	bug45702.patch
-# </percona>
 URL:		http://www.mysql.com/products/community/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -556,7 +490,7 @@ This package contains the standard MySQL NDB CPC Daemon.
 Ten pakiet zawiera standardowego demona MySQL NDB CPC.
 
 %prep
-%setup -q %{?with_sphinx:-a100}
+%setup -q -n Percona-Server-%{version}-rel%{percona_rel} %{?with_sphinx:-a100}
 %if %{with sphinx}
 # http://www.sphinxsearch.com/docs/manual-0.9.9.html#sphinxse-mysql51
 mv sphinx-*/mysqlse storage/sphinx
@@ -564,8 +498,7 @@ mv sphinx-*/mysqlse storage/sphinx
 %endif
 %patch0 -p1
 #%{?with_tcpd:%patch1 -p1}  # WHATS PURPOSE OF THIS PATCH?
-#%patch2 -p1 # NEEDS CHECK, which exact program needs -lc++
-%patch3 -p1
+#patch2 -p1 # NEEDS CHECK, which exact program needs -lc++
 %ifarch alpha
 # this is strange: mysqld functions for UDF modules are not explicitly defined,
 # so -rdynamic is used; in such case gcc3+ld on alpha doesn't like C++ vtables
@@ -576,7 +509,6 @@ mv sphinx-*/mysqlse storage/sphinx
 %endif
 %patch5 -p1
 %patch6 -p1
-%patch7 -p1
 %patch8 -p1
 %patch9 -p1
 %patch11 -p1
@@ -587,75 +519,6 @@ mv sphinx-*/mysqlse storage/sphinx
 %patch14 -p0
 %patch15 -p1
 %patch16 -p1
-# <percona %patches>
-%patch100 -p1
-%patch101 -p1
-%patch102 -p1
-%patch103 -p1
-%patch104 -p1
-%patch105 -p1
-%patch106 -p1
-%patch107 -p1
-%patch108 -p1
-%patch109 -p1
-%patch110 -p1
-%patch111 -p1
-%patch112 -p1
-%patch113 -p1
-%patch114 -p1
-%patch115 -p1
-%patch116 -p1
-%patch117 -p1
-%patch118 -p1
-%patch119 -p1
-%patch120 -p1
-%patch121 -p1
-%patch122 -p1
-%patch123 -p1
-%patch124 -p1
-%patch125 -p1
-%patch126 -p1
-%patch127 -p1
-%patch128 -p1
-%patch129 -p1
-%patch130 -p1
-%patch131 -p1
-%patch132 -p1
-%patch133 -p1
-%patch134 -p1
-%patch135 -p1
-%patch136 -p1
-%patch137 -p1
-%patch138 -p1
-%patch139 -p1
-%patch140 -p1
-%patch141 -p1
-%patch142 -p1
-%patch143 -p1
-%patch144 -p1
-%patch145 -p1
-%patch146 -p1
-%patch147 -p1
-%patch148 -p1
-%patch149 -p1
-%patch150 -p1
-%patch151 -p1
-%patch152 -p1
-%patch153 -p1
-%patch154 -p1
-%patch155 -p1
-%patch156 -p1
-%patch157 -p1
-%patch158 -p1
-%patch159 -p1
-%patch160 -p1
-%patch161 -p1
-%patch162 -p1
-%patch163 -p1
-%patch164 -p1
-%patch165 -p1
-%patch166 -p1
-# </percona>
 
 %build
 %if "%{pld_release}" == "ac"
@@ -725,15 +588,13 @@ echo -e "all:\ninstall:\nclean:\nlink_sources:\n" > libmysqld/examples/Makefile
 %{__make} \
 	benchdir=$RPM_BUILD_ROOT%{_datadir}/sql-bench
 
-%{__make} -C Docs mysql.info
-
 %{?with_tests:%{__make} test}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql,skel} \
 	   $RPM_BUILD_ROOT/var/{log/{archive,}/mysql,lib/mysql} \
-	   $RPM_BUILD_ROOT{%{_infodir},%{_mysqlhome}}
+	   $RPM_BUILD_ROOT%{_mysqlhome}
 
 # Make install
 %{__make} install \
@@ -742,8 +603,6 @@ install -d $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mysql,skel} \
 	libsdir=/tmp
 # libsdir is to avoid installing innodb static libs in $RPM_BUILD_ROOT../libs
 
-install Docs/mysql.info $RPM_BUILD_ROOT%{_infodir}
-
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysql
 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/mysql
 install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/mysql
@@ -827,7 +686,9 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/mysqlman.1*
 rm $RPM_BUILD_ROOT%{_bindir}/resolveip
 rm $RPM_BUILD_ROOT%{_mandir}/man1/resolveip.1*
 rm $RPM_BUILD_ROOT%{_mandir}/man1/comp_err.1*
-rm $RPM_BUILD_ROOT%{_datadir}/mysql/ChangeLog
+# not an .info file
+%{__rm} $RPM_BUILD_ROOT/usr/share/info/mysql.info
+
 
 # we don't package those (we have no -test or -testsuite pkg) and some of them just segfault
 rm $RPM_BUILD_ROOT%{_bindir}/mysql_client_test
@@ -846,6 +707,8 @@ rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.{ini,cnf}
 rm -f $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/ha_*.{a,la}
 rm -f $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/ha_example.*
 rm -f $RPM_BUILD_ROOT%{_libdir}/mysql/plugin/sphinx.{a,la}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugin/mypluglib.{a,la}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/plugin/libdaemon_example.*
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -855,7 +718,6 @@ rm -rf $RPM_BUILD_ROOT
 %useradd -u 89 -d %{_mysqlhome} -s /bin/sh -g mysql -c "MySQL Server" mysql
 
 %post
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
 /sbin/chkconfig --add mysql
 %service mysql restart
 
@@ -866,8 +728,6 @@ if [ "$1" = "0" ]; then
 fi
 
 %postun
-[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>&1
-
 if [ "$1" = "0" ]; then
 	%userremove mysql
 	%groupremove mysql
@@ -999,7 +859,7 @@ done
 
 %files
 %defattr(644,root,root,755)
-%doc support-files/*.cnf support-files/*.ini ChangeLog
+%doc support-files/*.cnf support-files/*.ini
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/mysql
 %attr(754,root,root) /etc/rc.d/init.d/mysql
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mysql
@@ -1017,6 +877,7 @@ done
 %dir %{_libdir}/mysql
 %dir %{_libdir}/mysql/plugin
 %attr(755,root,root) %{_libdir}/mysql/plugin/ha_innodb.so
+%attr(755,root,root) %{_libdir}/mysql/plugin/mypluglib.*
 %if %{with sphinx}
 %attr(755,root,root) %{_libdir}/mysql/plugin/sphinx.so
 %endif
@@ -1044,7 +905,6 @@ done
 %attr(750,mysql,mysql) %dir /var/log/archive/mysql
 %attr(640,mysql,mysql) %ghost /var/log/mysql/*
 
-%{_infodir}/mysql.info*
 # This is template for configuration file which is created after 'service mysql init'
 %{_datadir}/mysql/mysqld.conf
 %{_datadir}/mysql/mysql_system_tables.sql
diff --git a/bug45702.patch b/bug45702.patch
deleted file mode 100644
index 9100a73..0000000
--- a/bug45702.patch
+++ /dev/null
@@ -1,725 +0,0 @@
---- a/include/my_sys.h
-+++ b/include/my_sys.h
-@@ -346,8 +346,8 @@
- typedef struct st_dynamic_array
- {
-   uchar *buffer;
--  uint elements,max_element;
--  uint alloc_increment;
-+  ulong elements, max_element;
-+  ulong alloc_increment;
-   uint size_of_element;
- } DYNAMIC_ARRAY;
- 
-@@ -809,23 +809,23 @@
- #define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO)
- #define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO)
- extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
--                                   void *init_buffer, uint init_alloc, 
--                                   uint alloc_increment
-+                                   void *init_buffer, ulong init_alloc,
-+                                   ulong alloc_increment
-                                    CALLER_INFO_PROTO);
- /* init_dynamic_array() function is deprecated */
- extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
--                                  uint init_alloc,uint alloc_increment
-+                                  ulong init_alloc, ulong alloc_increment
-                                   CALLER_INFO_PROTO);
- extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
- extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
- extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
--extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
--extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
--extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
-+extern my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar * element, ulong array_index);
-+extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, ulong max_elements);
-+extern void get_dynamic(DYNAMIC_ARRAY *array, uchar * element, ulong array_index);
- extern void delete_dynamic(DYNAMIC_ARRAY *array);
--extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
-+extern void delete_dynamic_element(DYNAMIC_ARRAY *array, ulong array_index);
- extern void freeze_size(DYNAMIC_ARRAY *array);
--extern int  get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element);
-+extern long get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element);
- #define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
- #define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
- #define push_dynamic(A,B) insert_dynamic((A),(B))
---- a/mysys/array.c
-+++ b/mysys/array.c
-@@ -44,8 +44,8 @@
- */
- 
- my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
--                            void *init_buffer, uint init_alloc, 
--                            uint alloc_increment CALLER_INFO_PROTO)
-+                            void *init_buffer, ulong init_alloc, 
-+                            ulong alloc_increment CALLER_INFO_PROTO)
- {
-   DBUG_ENTER("init_dynamic_array");
-   if (!alloc_increment)
-@@ -76,8 +76,8 @@
- } 
- 
- my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
--                           uint init_alloc, 
--                           uint alloc_increment CALLER_INFO_PROTO)
-+                           ulong init_alloc,
-+                           ulong alloc_increment CALLER_INFO_PROTO)
- {
-   /* placeholder to preserve ABI */
-   return my_init_dynamic_array_ci(array, element_size, init_alloc, 
-@@ -200,7 +200,7 @@
-     FALSE	Ok
- */
- 
--my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
-+my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar* element, ulong idx)
- {
-   if (idx >= array->elements)
-   {
-@@ -232,11 +232,11 @@
-     TRUE	Allocation of new memory failed
- */
- 
--my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements)
-+my_bool allocate_dynamic(DYNAMIC_ARRAY *array, ulong max_elements)
- {
-   if (max_elements >= array->max_element)
-   {
--    uint size;
-+    ulong size;
-     uchar *new_ptr;
-     size= (max_elements + array->alloc_increment)/array->alloc_increment;
-     size*= array->alloc_increment;
-@@ -277,11 +277,11 @@
-       idx	Index of element wanted. 
- */
- 
--void get_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx)
-+void get_dynamic(DYNAMIC_ARRAY *array, uchar* element, ulong idx)
- {
-   if (idx >= array->elements)
-   {
--    DBUG_PRINT("warning",("To big array idx: %d, array size is %d",
-+    DBUG_PRINT("warning",("To big array idx: %lu, array size is %lu",
-                           idx,array->elements));
-     bzero(element,array->size_of_element);
-     return;
-@@ -324,7 +324,7 @@
-       idx        Index of element to be deleted
- */
- 
--void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
-+void delete_dynamic_element(DYNAMIC_ARRAY *array, ulong idx)
- {
-   char *ptr= (char*) array->buffer+array->size_of_element*idx;
-   array->elements--;
-@@ -344,7 +344,7 @@
- 
- void freeze_size(DYNAMIC_ARRAY *array)
- {
--  uint elements=max(array->elements,1);
-+  ulong elements= max(array->elements, 1);
- 
-   /*
-     Do nothing if we are using a static buffer
-@@ -372,7 +372,7 @@
- 
- */
- 
--int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element)
-+long get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element)
- {
-   size_t ret;
-   if (array->buffer > element)
---- a/storage/myisam/mi_check.c
-+++ b/storage/myisam/mi_check.c
-@@ -2435,7 +2435,7 @@
- 
-     if (_create_index_by_sort(&sort_param,
- 			      (my_bool) (!(param->testflag & T_VERBOSE)),
--			      (uint) param->sort_buffer_length))
-+			      param->sort_buffer_length))
-     {
-       param->retry_repair=1;
-       goto err;
---- a/storage/myisam/myisamdef.h
-+++ b/storage/myisam/myisamdef.h
-@@ -347,10 +347,10 @@
-   int (*key_write)(struct st_mi_sort_param *, const void *);
-   void (*lock_in_memory)(MI_CHECK *);
-   NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **,
--                     uint , struct st_buffpek *, IO_CACHE *);
--  NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
-+                         ulong, struct st_buffpek *, IO_CACHE *);
-+  NEAR ulong (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
-   NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *,
--                       uint, uint);
-+                       uint, ulong);
- } MI_SORT_PARAM;
- 
- 	/* Some defines used by isam-funktions */
---- a/storage/myisam/sort.c
-+++ b/storage/myisam/sort.c
-@@ -47,42 +47,42 @@
- 
- /* Functions defined in this file */
- 
--static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys,
-+static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, ulong keys,
-                                     uchar **sort_keys,
--                                    DYNAMIC_ARRAY *buffpek,int *maxbuffer,
-+                                    DYNAMIC_ARRAY *buffpek, long *maxbuffer,
-                                     IO_CACHE *tempfile,
-                                     IO_CACHE *tempfile_for_exceptions);
- static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys,
--                             uint count, BUFFPEK *buffpek,IO_CACHE *tempfile);
-+                             ulong count, BUFFPEK *buffpek,IO_CACHE *tempfile);
- static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key,
- 			    IO_CACHE *tempfile);
- static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys,
--                              uint count);
--static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys,
-+                              ulong count);
-+static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, ulong keys,
-                                   uchar * *sort_keys,
--                                  BUFFPEK *buffpek,int *maxbuffer,
-+                                  BUFFPEK *buffpek, long *maxbuffer,
-                                   IO_CACHE *t_file);
--static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
--                                  uint sort_length);
--static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys,
-+static ulong NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
-+                                   uint sort_length);
-+static int NEAR_F merge_buffers(MI_SORT_PARAM *info, ulong keys,
-                                 IO_CACHE *from_file, IO_CACHE *to_file,
-                                 uchar * *sort_keys, BUFFPEK *lastbuff,
-                                 BUFFPEK *Fb, BUFFPEK *Tb);
--static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int,
-+static int NEAR_F merge_index(MI_SORT_PARAM *, ulong, uchar **, BUFFPEK *, long,
-                               IO_CACHE *);
- static int flush_ft_buf(MI_SORT_PARAM *info);
- 
- static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys,
--                                    uint count, BUFFPEK *buffpek,
-+                                    ulong count, BUFFPEK *buffpek,
-                                     IO_CACHE *tempfile);
--static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
-+static ulong NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek,
-                                          uint sort_length);
- static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file,
--                                  uchar *key, uint sort_length, uint count);
-+                                  uchar *key, uint sort_length, ulong count);
- static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
- 					 IO_CACHE *to_file,
- 					 uchar* key, uint sort_length,
--					 uint count);
-+					 ulong count);
- static inline int
- my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
- 
-@@ -103,8 +103,9 @@
- int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
- 			  ulong sortbuff_size)
- {
--  int error,maxbuffer,skr;
--  uint memavl,old_memavl,keys,sort_length;
-+  int error;
-+  long maxbuffer, skr;
-+  ulong memavl, old_memavl, keys, sort_length;
-   DYNAMIC_ARRAY buffpek;
-   ha_rows records;
-   uchar **sort_keys;
-@@ -138,25 +139,25 @@
- 
-   while (memavl >= MIN_SORT_BUFFER)
-   {
--    if ((records < UINT_MAX32) && 
-+    if ((records < ULONG_MAX) &&
-        ((my_off_t) (records + 1) * 
-         (sort_length + sizeof(char*)) <= (my_off_t) memavl))
--      keys= (uint)records+1;
-+      keys= (ulong) records + 1;
-     else
-       do
-       {
- 	skr=maxbuffer;
--	if (memavl < sizeof(BUFFPEK)*(uint) maxbuffer ||
--	    (keys=(memavl-sizeof(BUFFPEK)*(uint) maxbuffer)/
-+        if (memavl < sizeof(BUFFPEK) * (ulong) maxbuffer ||
-+            (keys = (memavl - sizeof(BUFFPEK) * (ulong) maxbuffer) /
-              (sort_length+sizeof(char*))) <= 1 ||
--            keys < (uint) maxbuffer)
-+            keys < (ulong) maxbuffer)
- 	{
- 	  mi_check_print_error(info->sort_info->param,
- 			       "myisam_sort_buffer_size is too small");
- 	  goto err;
- 	}
-       }
--      while ((maxbuffer= (int) (records/(keys-1)+1)) != skr);
-+      while ((maxbuffer= (long) (records / (keys - 1) + 1)) != skr);
- 
-     if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+
- 				       HA_FT_MAXBYTELEN, MYF(0))))
-@@ -182,7 +183,7 @@
-   (*info->lock_in_memory)(info->sort_info->param);/* Everything is allocated */
- 
-   if (!no_messages)
--    printf("  - Searching for keys, allocating buffer for %d keys\n",keys);
-+    printf("  - Searching for keys, allocating buffer for %lu keys\n", keys);
- 
-   if ((records=find_all_keys(info,keys,sort_keys,&buffpek,&maxbuffer,
-                                   &tempfile,&tempfile_for_exceptions))
-@@ -192,7 +193,7 @@
-   {
-     if (!no_messages)
-       printf("  - Dumping %lu keys\n", (ulong) records);
--    if (write_index(info,sort_keys, (uint) records))
-+    if (write_index(info,sort_keys, (ulong) records))
-       goto err; /* purecov: inspected */
-   }
-   else
-@@ -256,13 +257,13 @@
- 
- /* Search after all keys and place them in a temp. file */
- 
--static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
-+static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, ulong keys,
- 				    uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
--				    int *maxbuffer, IO_CACHE *tempfile,
-+				    long *maxbuffer, IO_CACHE *tempfile,
- 				    IO_CACHE *tempfile_for_exceptions)
- {
-   int error;
--  uint idx;
-+  ulong idx;
-   DBUG_ENTER("find_all_keys");
- 
-   idx=error=0;
-@@ -312,8 +313,8 @@
- {
-   MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg;
-   int error;
--  uint memavl,old_memavl,keys,sort_length;
--  uint idx, maxbuffer;
-+  ulong memavl,old_memavl,keys,sort_length;
-+  ulong idx, maxbuffer;
-   uchar **sort_keys=0;
- 
-   LINT_INIT(keys);
-@@ -349,7 +350,7 @@
-     sort_keys= (uchar **) NULL;
- 
-     memavl=       max(sort_param->sortbuff_size, MIN_SORT_BUFFER);
--    idx=          (uint)sort_param->sort_info->max_records;
-+    idx=          (ulong) sort_param->sort_info->max_records;
-     sort_length=  sort_param->key_length;
-     maxbuffer=    1;
- 
-@@ -360,21 +361,21 @@
-         keys= idx+1;
-       else
-       {
--        uint skr;
-+        ulong skr;
-         do
-         {
-           skr= maxbuffer;
-           if (memavl < sizeof(BUFFPEK)*maxbuffer ||
-               (keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
-                (sort_length+sizeof(char*))) <= 1 ||
--              keys < (uint) maxbuffer)
-+              keys < maxbuffer)
-           {
-             mi_check_print_error(sort_param->sort_info->param,
-                                  "myisam_sort_buffer_size is too small");
-             goto err;
-           }
-         }
--        while ((maxbuffer= (int) (idx/(keys-1)+1)) != skr);
-+        while ((maxbuffer= (idx/(keys-1)+1)) != skr);
-       }
-       if ((sort_keys= (uchar**)
-            my_malloc(keys*(sort_length+sizeof(char*))+
-@@ -403,7 +404,7 @@
-     }
- 
-     if (sort_param->sort_info->param->testflag & T_VERBOSE)
--      printf("Key %d - Allocating buffer for %d keys\n",
-+      printf("Key %d - Allocating buffer for %lu keys\n",
-              sort_param->key + 1, keys);
-     sort_param->sort_keys= sort_keys;
- 
-@@ -560,7 +561,7 @@
-     }
-     if (sinfo->buffpek.elements)
-     {
--      uint maxbuffer=sinfo->buffpek.elements-1;
-+      ulong maxbuffer=sinfo->buffpek.elements-1;
-       if (!mergebuf)
-       {
-         length=param->sort_buffer_length;
-@@ -583,7 +584,7 @@
-           printf("Key %d  - Merging %u keys\n",sinfo->key+1, sinfo->keys);
-         if (merge_many_buff(sinfo, keys, (uchar **)mergebuf,
- 			    dynamic_element(&sinfo->buffpek, 0, BUFFPEK *),
--			    (int*) &maxbuffer, &sinfo->tempfile))
-+			    (long *) &maxbuffer, &sinfo->tempfile))
-         {
-           got_error=1;
-           continue;
-@@ -648,7 +649,7 @@
-         /* Write all keys in memory to file for later merge */
- 
- static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
--                             uint count, BUFFPEK *buffpek, IO_CACHE *tempfile)
-+                             ulong count, BUFFPEK *buffpek, IO_CACHE *tempfile)
- {
-   uchar **end;
-   uint sort_length=info->key_length;
-@@ -690,7 +691,7 @@
- 
- static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
- 				    register uchar **sort_keys,
--                                    uint count, BUFFPEK *buffpek,
-+                                    ulong count, BUFFPEK *buffpek,
- 				    IO_CACHE *tempfile)
- {
-   uchar **end;
-@@ -736,7 +737,7 @@
- /* Write index */
- 
- static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
--                              register uint count)
-+                              register ulong count)
- {
-   DBUG_ENTER("write_index");
- 
-@@ -753,11 +754,11 @@
- 
-         /* Merge buffers to make < MERGEBUFF2 buffers */
- 
--static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
-+static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, ulong keys,
-                                   uchar **sort_keys, BUFFPEK *buffpek,
--                                  int *maxbuffer, IO_CACHE *t_file)
-+                                  long *maxbuffer, IO_CACHE *t_file)
- {
--  register int i;
-+  register long i;
-   IO_CACHE t_file2, *from_file, *to_file, *temp;
-   BUFFPEK *lastbuff;
-   DBUG_ENTER("merge_many_buff");
-@@ -787,7 +788,7 @@
-     if (flush_io_cache(to_file))
-       break;                                    /* purecov: inspected */
-     temp=from_file; from_file=to_file; to_file=temp;
--    *maxbuffer= (int) (lastbuff-buffpek)-1;
-+    *maxbuffer= (long) (lastbuff-buffpek)-1;
-   }
- cleanup:
-   close_cached_file(to_file);                   /* This holds old result */
-@@ -816,17 +817,17 @@
-     -1	Error
- */
- 
--static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
--                                  uint sort_length)
-+static ulong NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
-+                                   uint sort_length)
- {
--  register uint count;
--  uint length;
-+  register ulong count;
-+  ulong length;
- 
--  if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
-+  if ((count=(ulong) min((ha_rows) buffpek->max_keys,buffpek->count)))
-   {
-     if (my_pread(fromfile->file,(uchar*) buffpek->base,
-                  (length= sort_length*count),buffpek->file_pos,MYF_RW))
--      return((uint) -1);                        /* purecov: inspected */
-+      return((ulong) -1);                        /* purecov: inspected */
-     buffpek->key=buffpek->base;
-     buffpek->file_pos+= length;                 /* New filepos */
-     buffpek->count-=    count;
-@@ -835,15 +836,15 @@
-   return (count*sort_length);
- } /* read_to_buffer */
- 
--static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
--                                         uint sort_length)
-+static ulong NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
-+                                          uint sort_length)
- {
--  register uint count;
-+  register ulong count;
-   uint16 length_of_key = 0;
--  uint idx;
-+  ulong idx;
-   uchar *buffp;
- 
--  if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
-+  if ((count= (ulong) min((ha_rows) buffpek->max_keys,buffpek->count)))
-   {
-     buffp = buffpek->base;
- 
-@@ -851,11 +852,11 @@
-     {
-       if (my_pread(fromfile->file,(uchar*)&length_of_key,sizeof(length_of_key),
-                    buffpek->file_pos,MYF_RW))
--        return((uint) -1);
-+        return((ulong) -1);
-       buffpek->file_pos+=sizeof(length_of_key);
-       if (my_pread(fromfile->file,(uchar*) buffp,length_of_key,
-                    buffpek->file_pos,MYF_RW))
--        return((uint) -1);
-+        return((ulong) -1);
-       buffpek->file_pos+=length_of_key;
-       buffp = buffp + sort_length;
-     }
-@@ -869,9 +870,9 @@
- 
- static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
- 					 IO_CACHE *to_file, uchar* key,
--                                         uint sort_length, uint count)
-+                                         uint sort_length, ulong count)
- {
--  uint idx;
-+  ulong idx;
-   uchar *bufs = key;
- 
-   for (idx=1;idx<=count;idx++)
-@@ -887,7 +888,7 @@
- 
- static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)),
- 				  IO_CACHE *to_file, uchar *key,
--				  uint sort_length, uint count)
-+				  uint sort_length, ulong count)
- {
-   return my_b_write(to_file, key, (size_t) sort_length*count);
- }
-@@ -898,12 +899,13 @@
- */
- 
- static int NEAR_F
--merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
-+merge_buffers(MI_SORT_PARAM *info, ulong keys, IO_CACHE *from_file,
-               IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff,
-               BUFFPEK *Fb, BUFFPEK *Tb)
- {
--  int error;
--  uint sort_length,maxcount;
-+  ulong error;
-+  uint sort_length;
-+  ulong maxcount;
-   ha_rows count;
-   my_off_t UNINIT_VAR(to_start_filepos);
-   uchar *strpos;
-@@ -913,7 +915,7 @@
-   DBUG_ENTER("merge_buffers");
- 
-   count=error=0;
--  maxcount=keys/((uint) (Tb-Fb) +1);
-+  maxcount= keys / ((ulong) (Tb-Fb) + 1);
-   DBUG_ASSERT(maxcount > 0);
-   LINT_INIT(to_start_filepos);
-   if (to_file)
-@@ -921,7 +923,7 @@
-   strpos=(uchar*) sort_keys;
-   sort_length=info->key_length;
- 
--  if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
-+  if (init_queue(&queue, (uint) (Tb-Fb)+1, offsetof(BUFFPEK,key), 0,
-                  (int (*)(void*, uchar *,uchar*)) info->key_cmp,
-                  (void*) info))
-     DBUG_RETURN(1); /* purecov: inspected */
-@@ -931,9 +933,8 @@
-     count+= buffpek->count;
-     buffpek->base= strpos;
-     buffpek->max_keys=maxcount;
--    strpos+= (uint) (error=(int) info->read_to_buffer(from_file,buffpek,
--                                                      sort_length));
--    if (error == -1)
-+    strpos+= (error= info->read_to_buffer(from_file,buffpek, sort_length));
-+    if (error == (ulong) -1)
-       goto err; /* purecov: inspected */
-     queue_insert(&queue,(uchar*) buffpek);
-   }
-@@ -965,10 +966,10 @@
-       buffpek->key+=sort_length;
-       if (! --buffpek->mem_count)
-       {
--        if (!(error=(int) info->read_to_buffer(from_file,buffpek,sort_length)))
-+        if (!(error= info->read_to_buffer(from_file,buffpek,sort_length)))
-         {
-           uchar *base=buffpek->base;
--          uint max_keys=buffpek->max_keys;
-+          ulong max_keys=buffpek->max_keys;
- 
-           VOID(queue_remove(&queue,0));
- 
-@@ -993,7 +994,7 @@
-           break;                /* One buffer have been removed */
-         }
-       }
--      else if (error == -1)
-+      else if (error == (ulong) -1)
-         goto err;               /* purecov: inspected */
-       queue_replaced(&queue);   /* Top element has been replaced */
-     }
-@@ -1026,23 +1027,23 @@
-       }
-     }
-   }
--  while ((error=(int) info->read_to_buffer(from_file,buffpek,sort_length)) != -1 &&
--         error != 0);
-+  while ((error= info->read_to_buffer(from_file, buffpek, sort_length)) !=
-+         (ulong) -1 && error != 0);
- 
-   lastbuff->count=count;
-   if (to_file)
-     lastbuff->file_pos=to_start_filepos;
- err:
-   delete_queue(&queue);
--  DBUG_RETURN(error);
-+  DBUG_RETURN(error != 0);
- } /* merge_buffers */
- 
- 
-         /* Do a merge to output-file (save only positions) */
- 
- static int NEAR_F
--merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys,
--            BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile)
-+merge_index(MI_SORT_PARAM *info, ulong keys, uchar **sort_keys,
-+            BUFFPEK *buffpek, long maxbuffer, IO_CACHE *tempfile)
- {
-   DBUG_ENTER("merge_index");
-   if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
---- /dev/null
-+++ b/mysql-test/r/percona_bug45702.result
-@@ -0,0 +1,21 @@
-+CREATE TABLE t1 (a BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
-+INSERT INTO t1 VALUES (), (), (), (), (), (), (), ();
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+SET @old_myisam_sort_buffer_size = @@myisam_sort_buffer_size;
-+SET @@myisam_sort_buffer_size = 4 * 1024 * 1024 * 1024;
-+REPAIR TABLE t1;
-+Table	Op	Msg_type	Msg_text
-+test.t1	repair	status	OK
-+- recovering (with sort) MyISAM-table 'MYSQLD_DATADIR/test/t1'
-+Data records: 4096
-+- Fixing index 1
-+SET @@myisam_sort_buffer_size = @old_myisam_sort_buffer_size;
-+DROP TABLE t1;
---- /dev/null
-+++ b/mysql-test/t/percona_bug45702.test
-@@ -0,0 +1,34 @@
-+###############################################################################
-+# Bug #45702: Impossible to specify myisam_sort_buffer > 4GB on 64 bit machines
-+###############################################################################
-+
-+--source include/have_64bit.inc
-+
-+# Check that having data larger than MIN_SORT_BUFFER bytes can be handled by
-+# _create_index_by_sort() with myisam_sort_buffer_size = 4 GB without errors.
-+# The full test with large data volumes can not be a part of the test suite.
-+
-+CREATE TABLE t1 (a BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
-+INSERT INTO t1 VALUES (), (), (), (), (), (), (), ();
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+INSERT INTO t1 SELECT NULL FROM t1;
-+
-+SET @old_myisam_sort_buffer_size = @@myisam_sort_buffer_size;
-+SET @@myisam_sort_buffer_size = 4 * 1024 * 1024 * 1024;
-+
-+REPAIR TABLE t1;
-+
-+--let $MYSQLD_DATADIR= `select @@datadir`
-+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-+--exec $MYISAMCHK -r --sort_buffer_size=4G $MYSQLD_DATADIR/test/t1
-+
-+SET @@myisam_sort_buffer_size = @old_myisam_sort_buffer_size;
-+
-+DROP TABLE t1;
---- a/sql/opt_range.cc
-+++ b/sql/opt_range.cc
-@@ -11524,7 +11524,7 @@
-   }
-   if (min_max_ranges.elements > 0)
-   {
--    fprintf(DBUG_FILE, "%*susing %d quick_ranges for MIN/MAX:\n",
-+    fprintf(DBUG_FILE, "%*susing %lu quick_ranges for MIN/MAX:\n",
-             indent, "", min_max_ranges.elements);
-   }
- }
---- a/mysys/my_pread.c
-+++ b/mysys/my_pread.c
-@@ -48,6 +48,7 @@
-                 myf MyFlags)
- {
-   size_t readbytes;
-+  size_t total_readbytes= 0;
-   int error= 0;
-   DBUG_ENTER("my_pread");
-   DBUG_PRINT("my",("Fd: %d  Seek: %lu  Buffer: 0x%lx  Count: %u  MyFlags: %d",
-@@ -68,6 +69,9 @@
-     if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count)))
-       my_errno= errno ? errno : -1;
- #endif
-+    if (readbytes > 0)
-+      total_readbytes+= readbytes;
-+
-     if (error || readbytes != Count)
-     {
-       DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
-@@ -80,6 +84,24 @@
-         continue;                              /* Interrupted */
-       }
- #endif
-+      if (readbytes > 0 && readbytes < Count && errno == 0)
-+      {
-+        /*
-+          pread() may return less bytes than requested even if enough bytes are
-+          available according to the Linux man page.
-+          This makes determining the end-of-file condition a bit harder.
-+          We just do another pread() call to see if more bytes can be read,
-+          since all my_pread() users expect it to always return all available
-+          bytes. For end-of-file 0 bytes is returned. This can never be the case
-+          for a partial read, since according to the man page, -1 is returned
-+          with errno set to EINTR if no data has been read.
-+        */
-+        Buffer+= readbytes;
-+        offset+= readbytes;
-+        Count-= readbytes;
-+
-+        continue;
-+      }
-       if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
-       {
- 	if (readbytes == (size_t) -1)
-@@ -94,7 +116,7 @@
-     }
-     if (MyFlags & (MY_NABP | MY_FNABP))
-       DBUG_RETURN(0);				/* Read went ok; Return 0 */
--    DBUG_RETURN(readbytes);			/* purecov: inspected */
-+    DBUG_RETURN(total_readbytes);			/* purecov: inspected */
-   }
- } /* my_pread */
- 
diff --git a/bug53761.patch b/bug53761.patch
deleted file mode 100644
index 5c2e7c9..0000000
--- a/bug53761.patch
+++ /dev/null
@@ -1,472 +0,0 @@
-# name       : bug53761.patch
-# maintainer : Alexey
-#
-# Backport of the fix for MySQL bug #53761 to 5.1
-#
---- a/storage/innodb_plugin/btr/btr0cur.c
-+++ b/storage/innodb_plugin/btr/btr0cur.c
-@@ -3238,6 +3238,7 @@
- {
- 	btr_path_t*	slot;
- 	rec_t*		rec;
-+	page_t*		page;
- 
- 	ut_a(cursor->path_arr);
- 
-@@ -3260,8 +3261,155 @@
- 
- 	slot = cursor->path_arr + (root_height - height);
- 
-+	page = page_align(rec);
-+
- 	slot->nth_rec = page_rec_get_n_recs_before(rec);
--	slot->n_recs = page_get_n_recs(page_align(rec));
-+	slot->n_recs = page_get_n_recs(page);
-+	slot->page_no = page_get_page_no(page);
-+	slot->page_level = btr_page_get_level_low(page);
-+}
-+
-+/*******************************************************************//**
-+Estimate the number of rows between slot1 and slot2 for any level on a
-+B-tree. This function starts from slot1->page and reads a few pages to
-+the right, counting their records. If we reach slot2->page quickly then
-+we know exactly how many records there are between slot1 and slot2 and
-+we set is_n_rows_exact to TRUE. If we cannot reach slot2->page quickly
-+then we calculate the average number of records in the pages scanned
-+so far and assume that all pages that we did not scan up to slot2->page
-+contain the same number of records, then we multiply that average to
-+the number of pages between slot1->page and slot2->page (which is
-+n_rows_on_prev_level). In this case we set is_n_rows_exact to FALSE.
-+ at return	number of rows (exact or estimated) */
-+static
-+ib_int64_t
-+btr_estimate_n_rows_in_range_on_level(
-+/*==================================*/
-+	dict_index_t*	index,			/*!< in: index */
-+	btr_path_t*	slot1,			/*!< in: left border */
-+	btr_path_t*	slot2,			/*!< in: right border */
-+	ib_int64_t	n_rows_on_prev_level,	/*!< in: number of rows
-+						on the previous level for the
-+						same descend paths; used to
-+						determine the numbe of pages
-+						on this level */
-+	ibool*		is_n_rows_exact)	/*!< out: TRUE if the returned
-+						value is exact i.e. not an
-+						estimation */
-+{
-+	ulint		space;
-+	ib_int64_t	n_rows;
-+	ulint		n_pages_read;
-+	ulint		page_no;
-+	ulint		zip_size;
-+	ulint		level;
-+
-+	space = dict_index_get_space(index);
-+
-+	n_rows = 0;
-+	n_pages_read = 0;
-+
-+	/* Assume by default that we will scan all pages between
-+	slot1->page_no and slot2->page_no */
-+	*is_n_rows_exact = TRUE;
-+
-+	/* add records from slot1->page_no which are to the right of
-+	the record which serves as a left border of the range, if any */
-+	if (slot1->nth_rec < slot1->n_recs) {
-+		n_rows += slot1->n_recs - slot1->nth_rec;
-+	}
-+
-+	/* add records from slot2->page_no which are to the left of
-+	the record which servers as a right border of the range, if any */
-+	if (slot2->nth_rec > 1) {
-+		n_rows += slot2->nth_rec - 1;
-+	}
-+
-+	/* count the records in the pages between slot1->page_no and
-+	slot2->page_no (non inclusive), if any */
-+
-+	zip_size = fil_space_get_zip_size(space);
-+
-+	/* Do not read more than this number of pages in order not to hurt
-+	performance with this code which is just an estimation. If we read
-+	this many pages before reaching slot2->page_no then we estimate the
-+	average from the pages scanned so far */
-+	#define N_PAGES_READ_LIMIT	10
-+
-+	page_no = slot1->page_no;
-+	level = slot1->page_level;
-+
-+	do {
-+		mtr_t		mtr;
-+		page_t*		page;
-+		buf_block_t*	block;
-+
-+		mtr_start(&mtr);
-+
-+		/* fetch the page */
-+		block = buf_page_get(space, zip_size, page_no, RW_S_LATCH,
-+				     &mtr);
-+
-+		page = buf_block_get_frame(block);
-+
-+		/* It is possible that the tree has been reorganized in the
-+		meantime and this is a different page. If this happens the
-+		calculated estimate will be bogus, which is not fatal as
-+		this is only an estimate. We are sure that a page with
-+		page_no exists because InnoDB never frees pages, only
-+		reuses them. */
-+		if (fil_page_get_type(page) != FIL_PAGE_INDEX
-+		    || ut_dulint_cmp(btr_page_get_index_id(page), index->id)
-+		    || btr_page_get_level_low(page) != level) {
-+
-+			/* The page got reused for something else */
-+			goto inexact;
-+		}
-+
-+		n_pages_read++;
-+
-+		if (page_no != slot1->page_no) {
-+			/* Do not count the records on slot1->page_no,
-+			we already counted them before this loop. */
-+			n_rows += page_get_n_recs(page);
-+		}
-+
-+		page_no = btr_page_get_next(page, &mtr);
-+
-+		mtr_commit(&mtr);
-+
-+		if (n_pages_read == N_PAGES_READ_LIMIT
-+		    || page_no == FIL_NULL) {
-+			/* Either we read too many pages or
-+			we reached the end of the level without passing
-+			through slot2->page_no, the tree must have changed
-+			in the meantime */
-+			goto inexact;
-+		}
-+
-+	} while (page_no != slot2->page_no);
-+
-+	return(n_rows);
-+
-+inexact:
-+
-+	*is_n_rows_exact = FALSE;
-+
-+	/* We did interrupt before reaching slot2->page */
-+
-+	if (n_pages_read > 0) {
-+		/* The number of pages on this level is
-+		n_rows_on_prev_level, multiply it by the
-+		average number of recs per page so far */
-+		n_rows = n_rows_on_prev_level
-+			* n_rows / n_pages_read;
-+	} else {
-+		/* The tree changed before we could even
-+		start with slot1->page_no */
-+		n_rows = 10;
-+	}
-+
-+	return(n_rows);
- }
- 
- /*******************************************************************//**
-@@ -3286,6 +3434,7 @@
- 	ibool		diverged_lot;
- 	ulint		divergence_level;
- 	ib_int64_t	n_rows;
-+	ibool		is_n_rows_exact;
- 	ulint		i;
- 	mtr_t		mtr;
- 
-@@ -3328,6 +3477,7 @@
- 	/* We have the path information for the range in path1 and path2 */
- 
- 	n_rows = 1;
-+	is_n_rows_exact = TRUE;
- 	diverged = FALSE;	    /* This becomes true when the path is not
- 				    the same any more */
- 	diverged_lot = FALSE;	    /* This becomes true when the paths are
-@@ -3343,7 +3493,7 @@
- 		if (slot1->nth_rec == ULINT_UNDEFINED
- 		    || slot2->nth_rec == ULINT_UNDEFINED) {
- 
--			if (i > divergence_level + 1) {
-+			if (i > divergence_level + 1 && !is_n_rows_exact) {
- 				/* In trees whose height is > 1 our algorithm
- 				tends to underestimate: multiply the estimate
- 				by 2: */
-@@ -3355,7 +3505,9 @@
- 			to over 1 / 2 of the estimated rows in the whole
- 			table */
- 
--			if (n_rows > index->table->stat_n_rows / 2) {
-+			if (n_rows > index->table->stat_n_rows / 2
-+			    && !is_n_rows_exact) {
-+
- 				n_rows = index->table->stat_n_rows / 2;
- 
- 				/* If there are just 0 or 1 rows in the table,
-@@ -3381,10 +3533,15 @@
- 					divergence_level = i;
- 				}
- 			} else {
--				/* Maybe the tree has changed between
--				searches */
--
--				return(10);
-+				/* It is possible that
-+				slot1->nth_rec >= slot2->nth_rec
-+				if, for example, we have a single page
-+				tree which contains (inf, 5, 6, supr)
-+				and we select where x > 20 and x < 30;
-+				in this case slot1->nth_rec will point
-+				to the supr record and slot2->nth_rec
-+				will point to 6 */
-+				n_rows = 0;
- 			}
- 
- 		} else if (diverged && !diverged_lot) {
-@@ -3408,8 +3565,9 @@
- 			}
- 		} else if (diverged_lot) {
- 
--			n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
--				/ 2;
-+			n_rows = btr_estimate_n_rows_in_range_on_level(
-+				index, slot1, slot2, n_rows,
-+				&is_n_rows_exact);
- 		}
- 	}
- }
---- a/storage/innodb_plugin/include/btr0cur.h
-+++ b/storage/innodb_plugin/include/btr0cur.h
-@@ -670,6 +670,11 @@
- 				order); value ULINT_UNDEFINED
- 				denotes array end */
- 	ulint	n_recs;		/*!< number of records on the page */
-+	ulint	page_no;	/*!< no of the page containing the record */
-+	ulint	page_level;	/*!< level of the page, if later we fetch
-+				the page under page_no and it is no different
-+				level then we know that the tree has been
-+				reorganized */
- };
- 
- #define BTR_PATH_ARRAY_N_SLOTS	250	/*!< size of path array (in slots) */
---- a/mysql-test/suite/innodb_plugin/r/innodb_gis.result
-+++ b/mysql-test/suite/innodb_plugin/r/innodb_gis.result
-@@ -572,7 +572,7 @@
- EXPLAIN 
- SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
--1	SIMPLE	t2	ref	p	p	28	const	1	Using where
-+1	SIMPLE	t2	ref	p	p	28	const	2	Using where
- SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
- COUNT(*)
- 2
---- a/mysql-test/suite/innodb_plugin/r/innodb_mysql.result
-+++ b/mysql-test/suite/innodb_plugin/r/innodb_mysql.result
-@@ -889,13 +889,13 @@
- id	1
- select_type	SIMPLE
- table	t1
--type	range
-+type	index
- possible_keys	bkey
--key	bkey
--key_len	5
-+key	PRIMARY
-+key_len	4
- ref	NULL
--rows	16
--Extra	Using where; Using index; Using filesort
-+rows	32
-+Extra	Using where
- SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
- a	b
- 1	2
-@@ -934,12 +934,12 @@
- id	1
- select_type	SIMPLE
- table	t1
--type	range
-+type	index
- possible_keys	bkey
- key	bkey
- key_len	5
- ref	NULL
--rows	16
-+rows	32
- Extra	Using where; Using index
- SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
- a	b
-@@ -989,7 +989,7 @@
- key	bkey
- key_len	5
- ref	const
--rows	8
-+rows	16
- Extra	Using where; Using index; Using filesort
- SELECT * FROM t2 WHERE b=1 ORDER BY a;
- a	b	c
-@@ -1018,7 +1018,7 @@
- key	bkey
- key_len	10
- ref	const,const
--rows	8
-+rows	16
- Extra	Using where; Using index
- SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
- a	b	c
-@@ -1047,7 +1047,7 @@
- key	bkey
- key_len	10
- ref	const,const
--rows	8
-+rows	16
- Extra	Using where; Using index
- SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
- a	b	c
-@@ -1076,7 +1076,7 @@
- key	bkey
- key_len	10
- ref	const,const
--rows	8
-+rows	16
- Extra	Using where; Using index
- SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
- a	b	c
-@@ -1211,7 +1211,7 @@
- key	b
- key_len	5
- ref	const
--rows	1
-+rows	2
- Extra	Using where; Using index
- SELECT * FROM t1 WHERE b=2 ORDER BY a ASC;
- a	b
-@@ -1226,7 +1226,7 @@
- key	b
- key_len	5
- ref	const
--rows	1
-+rows	2
- Extra	Using where; Using index
- SELECT * FROM t1 WHERE b=2 ORDER BY a DESC;
- a	b
-@@ -1370,7 +1370,7 @@
- INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
- EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
--1	SIMPLE	t1	index	t1_b	PRIMARY	4	NULL	8	Using where
-+1	SIMPLE	t1	range	t1_b	t1_b	5	NULL	8	Using where
- SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
- a	b	c
- 8	1	1
-@@ -1729,7 +1729,7 @@
- FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
- 1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
--2	DERIVED	t1	index	c3,c2	c2	10	NULL	5	
-+2	DERIVED	t1	ALL	c3,c2	c3	5		5	Using filesort
- DROP TABLE t1;
- CREATE TABLE t1 (c1 REAL, c2 REAL, c3 REAL, KEY (c3), KEY (c2, c3))
- ENGINE=InnoDB;
-@@ -1743,7 +1743,7 @@
- FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
- 1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
--2	DERIVED	t1	index	c3,c2	c2	18	NULL	5	
-+2	DERIVED	t1	ALL	c3,c2	c3	9		5	Using filesort
- DROP TABLE t1;
- CREATE TABLE t1 (c1 DECIMAL(12,2), c2 DECIMAL(12,2), c3 DECIMAL(12,2), 
- KEY (c3), KEY (c2, c3))
-@@ -1758,7 +1758,7 @@
- FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
- 1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
--2	DERIVED	t1	index	c3,c2	c2	14	NULL	5	
-+2	DERIVED	t1	ALL	c3,c2	c3	7		5	Using filesort
- DROP TABLE t1;
- End of 5.1 tests
- drop table if exists t1, t2, t3;
-@@ -1834,7 +1834,7 @@
- key	b
- key_len	5
- ref	NULL
--rows	3
-+rows	5
- Extra	Using where; Using index
- EXPLAIN SELECT c FROM bar WHERE c>2;;
- id	1
-@@ -2430,7 +2430,7 @@
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
- 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
--2	DERIVED	t1	index_merge	PRIMARY,idx	idx,PRIMARY	5,4	NULL	3537	Using sort_union(idx,PRIMARY); Using where
-+2	DERIVED	t1	index_merge	PRIMARY,idx	idx,PRIMARY	5,4	NULL	1536	Using sort_union(idx,PRIMARY); Using where
- SELECT COUNT(*) FROM
- (SELECT * FROM t1 FORCE INDEX (idx,PRIMARY)
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
---- a/mysql-test/r/index_merge_innodb.result
-+++ b/mysql-test/r/index_merge_innodb.result
-@@ -346,7 +346,7 @@
- FROM t1
- WHERE c = 1 AND b = 1 AND d = 1;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
--1	SIMPLE	t1	index_merge	c,bd	c,bd	5,10	NULL	1	Using intersect(c,bd); Using where; Using index
-+1	SIMPLE	t1	ref	c,bd	bd	10	const,const	2	Using where
- CREATE TABLE t2 ( a INT )
- SELECT a
- FROM t1
---- a/mysql-test/r/rowid_order_innodb.result
-+++ b/mysql-test/r/rowid_order_innodb.result
-@@ -15,7 +15,7 @@
- (10, 1, 1);
- explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
--1	SIMPLE	t1	index_merge	key1,key2	key1,key2	5,5	NULL	4	Using sort_union(key1,key2); Using where
-+1	SIMPLE	t1	index_merge	key1,key2	key1,key2	5,5	NULL	5	Using sort_union(key1,key2); Using where
- select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
- pk1	key1	key2
- -100	1	1
---- a/mysql-test/r/type_bit_innodb.result
-+++ b/mysql-test/r/type_bit_innodb.result
-@@ -233,7 +233,7 @@
- 127	403
- explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
- id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
--1	SIMPLE	t1	range	a	a	2	NULL	19	Using where; Using index; Using filesort
-+1	SIMPLE	t1	range	a	a	2	NULL	27	Using where; Using index; Using filesort
- select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
- a+0	b+0
- 44	307
---- a/mysql-test/r/endspace.result
-+++ b/mysql-test/r/endspace.result
-@@ -201,12 +201,12 @@
- text1
- teststring	
- teststring 
--select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
-+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%' order by 1, 2;
- text1	length(text1)
- teststring		11
- teststring	10
- teststring 	11
--select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
-+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t' order by 1, 2;
- text1	length(text1)
- teststring		11
- teststring	10
---- a/mysql-test/t/endspace.test
-+++ b/mysql-test/t/endspace.test
-@@ -93,8 +93,8 @@
- select * from t1 where text1 like 'teststring_%';
- 
- # The following gives wrong result in InnoDB
--select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
--select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
-+select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%' order by 1, 2;
-+select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t' order by 1, 2;
- select concat('|', text1, '|') from t1 order by text1;
- drop table t1;
- 
diff --git a/bug813587.patch b/bug813587.patch
deleted file mode 100644
index a33a67b..0000000
--- a/bug813587.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-# name       : bug813587.patch
-# maintainer : Alexey
-#
-# Fix for LP bug #813587 / MySQL bug #51196 / MySQL bug #61790
-#
-# Clear MySQL connection errors in ha_federated::close(), since they
-# can affect queries on other tables due to table cache eviction.
-#
---- a/storage/federated/ha_federated.cc
-+++ b/storage/federated/ha_federated.cc
-@@ -1641,6 +1641,7 @@
- 
- int ha_federated::close(void)
- {
-+  THD *thd= current_thd;
-   DBUG_ENTER("ha_federated::close");
- 
-   free_result();
-@@ -1651,6 +1652,10 @@
-   mysql_close(mysql);
-   mysql= NULL;
- 
-+  /* Clear possible errors from mysql_close(), see LP bug #813587. */
-+  if (thd)
-+    thd->clear_error();
-+
-   DBUG_RETURN(free_share(share));
- }
- 
diff --git a/bug860910.patch b/bug860910.patch
deleted file mode 100644
index 2590b62..0000000
--- a/bug860910.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-# name       : bug860910.patch
-# maintainer : Alexey
-#
-# Fixes LP bug #860910 / MySQL bug #62557
-#
---- /dev/null
-+++ b/mysql-test/suite/rpl/r/percona_bug860910.result
-@@ -0,0 +1,17 @@
-+*** Set up master (server_1) <-> master (server_2) replication  ***
-+include/rpl_init.inc [topology=1->2->1]
-+
-+SELECT @@global.log_slave_updates;
-+@@global.log_slave_updates
-+1
-+SELECT @@global.log_slave_updates;
-+@@global.log_slave_updates
-+1
-+CREATE TABLE t1(a INT);
-+SET @var:=0;
-+INSERT INTO t1 VALUES (@var);
-+INSERT INTO t1 VALUES (1);
-+DROP TABLE t1;
-+include/rpl_sync.inc
-+include/check_slave_param.inc [Exec_Master_Log_Pos]
-+include/rpl_end.inc
---- /dev/null
-+++ b/mysql-test/suite/rpl/t/percona_bug860910.cnf
-@@ -0,0 +1,8 @@
-+!include ../my.cnf
-+
-+[mysqld.1]
-+log-slave-updates
-+
-+[mysqld.2]
-+log-slave-updates
-+
---- /dev/null
-+++ b/mysql-test/suite/rpl/t/percona_bug860910.test
-@@ -0,0 +1,38 @@
-+########################################################################
-+# Bug #860910: SHOW SLAVE STATUS gives wrong output with master-master
-+#              and using SET uservars
-+########################################################################
-+
-+--echo *** Set up master (server_1) <-> master (server_2) replication  ***
-+--let $rpl_topology= 1->2->1
-+--source include/rpl_init.inc
-+--echo
-+
-+--connection server_1
-+SELECT @@global.log_slave_updates;
-+
-+--connection server_2
-+SELECT @@global.log_slave_updates;
-+
-+--connection server_1
-+CREATE TABLE t1(a INT);
-+SET @var:=0;
-+INSERT INTO t1 VALUES (@var);
-+INSERT INTO t1 VALUES (1);
-+
-+DROP TABLE t1;
-+
-+# The following would hang with the bug not fixed due to incorrect
-+# Exec_Master_Log_Pos
-+--source include/rpl_sync.inc
-+
-+--connection server_2
-+--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
-+
-+--connection server_1
-+--let $slave_param= Exec_Master_Log_Pos
-+--let $slave_param_value= $master_log_pos
-+--source include/check_slave_param.inc
-+
-+# Cleanup
-+--source include/rpl_end.inc
---- a/sql/log.cc
-+++ b/sql/log.cc
-@@ -4629,6 +4629,12 @@
-                                  user_var_event->length,
-                                  user_var_event->type,
-                                  user_var_event->charset_number);
-+            /*
-+              These User_var_log_events must be logged with event_info's
-+              server_id, rather than the current one.
-+            */
-+            e.server_id= event_info->server_id;
-+
-             if (e.write(file))
-               goto err;
-             if (file == &log_file)
diff --git a/disable_query_cache_28249_test_sporadic_failure.patch b/disable_query_cache_28249_test_sporadic_failure.patch
deleted file mode 100644
index e1598a2..0000000
--- a/disable_query_cache_28249_test_sporadic_failure.patch
+++ /dev/null
@@ -1,8 +0,0 @@
---- a/mysql-test/t/disabled.def
-+++ b/mysql-test/t/disabled.def
-@@ -12,4 +12,4 @@
- kill                     : Bug#11748945 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
- read_many_rows_innodb    : Bug#11748886 2010-11-15 mattiasj report already exists
- main.log_tables-big      : Bug#11756699 2010-11-15 mattiasj report already exists
--
-+main.query_cache_28249   : http://bugs.mysql.com/bug.php?id=41098
diff --git a/innodb_bug47167_test_fix.patch b/innodb_bug47167_test_fix.patch
deleted file mode 100644
index 8a6671e..0000000
--- a/innodb_bug47167_test_fix.patch
+++ /dev/null
@@ -1,44 +0,0 @@
---- a/mysql-test/suite/innodb_plugin/r/innodb_bug47167.result
-+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug47167.result
-@@ -1,7 +1,4 @@
- set @old_innodb_file_format_check=@@innodb_file_format_check;
--select @old_innodb_file_format_check;
-- at old_innodb_file_format_check
--Antelope
- set global innodb_file_format_check = Barracuda;
- select @@innodb_file_format_check;
- @@innodb_file_format_check
-@@ -11,9 +8,9 @@
- @@innodb_file_format_check
- Barracuda
- set global innodb_file_format_check = @old_innodb_file_format_check;
--select @@innodb_file_format_check;
--@@innodb_file_format_check
--Antelope
-+select @@innodb_file_format_check = @old_innodb_file_format_check;
-+@@innodb_file_format_check = @old_innodb_file_format_check
-+1
- set global innodb_file_format_check = cheetah;
- ERROR HY000: Incorrect arguments to SET
- set global innodb_file_format_check = Bear;
---- a/mysql-test/suite/innodb_plugin/t/innodb_bug47167.test
-+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug47167.test
-@@ -9,9 +9,6 @@
- # 'old_innodb_file_format_check'
- set @old_innodb_file_format_check=@@innodb_file_format_check;
- 
--# @old_innodb_file_format_check shall have the value of 'Antelope'
--select @old_innodb_file_format_check;
--
- # Reset the value in 'innodb_file_format_check' to 'Barracuda'
- set global innodb_file_format_check = Barracuda;
- 
-@@ -27,7 +24,7 @@
- set global innodb_file_format_check = @old_innodb_file_format_check;
- 
- # Check whether 'innodb_file_format_check' get its original value.
--select @@innodb_file_format_check;
-+select @@innodb_file_format_check = @old_innodb_file_format_check;
- 
- # Following are negative tests, all should fail.
- --disable_warnings
diff --git a/innodb_fake_changes.patch b/innodb_fake_changes.patch
deleted file mode 100644
index 14b33fd..0000000
--- a/innodb_fake_changes.patch
+++ /dev/null
@@ -1,768 +0,0 @@
-# name       : innodb_fake_changes.patch
-# introduced : 5.1.58
-# maintainer : Yasufumi
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/storage/innodb_plugin/btr/btr0cur.c
-+++ b/storage/innodb_plugin/btr/btr0cur.c
-@@ -1046,6 +1046,11 @@
- 	rec_t*		rec;
- 	roll_ptr_t	roll_ptr;
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip LOCK, UNDO */
-+		return(DB_SUCCESS);
-+	}
-+
- 	/* Check if we have to wait for a lock: enqueue an explicit lock
- 	request if yes */
- 
-@@ -1177,7 +1182,7 @@
- 	}
- #endif /* UNIV_DEBUG */
- 
--	ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- 	max_size = page_get_max_insert_size_after_reorganize(page, 1);
- 	leaf = page_is_leaf(page);
- 
-@@ -1272,6 +1277,12 @@
- 		goto fail_err;
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip CHANGE, LOG */
-+		*big_rec = big_rec_vec;
-+		return(err); /* == DB_SUCCESS */
-+	}
-+
- 	page_cursor = btr_cur_get_page_cur(cursor);
- 
- 	/* Now, try the insert */
-@@ -1414,10 +1425,10 @@
- 
- 	*big_rec = NULL;
- 
--	ut_ad(mtr_memo_contains(mtr,
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr,
- 				dict_index_get_lock(btr_cur_get_index(cursor)),
- 				MTR_MEMO_X_LOCK));
--	ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor),
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, btr_cur_get_block(cursor),
- 				MTR_MEMO_PAGE_X_FIX));
- 
- 	/* Try first an optimistic insert; reset the cursor flag: we do not
-@@ -1483,6 +1494,16 @@
- 		}
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip CHANGE, LOG */
-+		if (n_extents > 0) {
-+			fil_space_release_free_extents(index->space,
-+						       n_reserved);
-+		}
-+		*big_rec = big_rec_vec;
-+		return(DB_SUCCESS);
-+	}
-+
- 	if (dict_index_get_page(index)
- 	    == buf_block_get_page_no(btr_cur_get_block(cursor))) {
- 
-@@ -1539,6 +1560,11 @@
- 
- 	ut_ad(cursor && update && thr && roll_ptr);
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip LOCK, UNDO */
-+		return(DB_SUCCESS);
-+	}
-+
- 	rec = btr_cur_get_rec(cursor);
- 	index = cursor->index;
- 
-@@ -1837,6 +1863,14 @@
- 		return(err);
- 	}
- 
-+	if (trx->fake_changes) {
-+		/* skip CHANGE, LOG */
-+		if (UNIV_LIKELY_NULL(heap)) {
-+			mem_heap_free(heap);
-+		}
-+		return(err); /* == DB_SUCCESS */
-+	}
-+
- 	if (block->is_hashed) {
- 		/* The function row_upd_changes_ord_field_binary works only
- 		if the update vector was built for a clustered index, we must
-@@ -1939,7 +1973,7 @@
- 	rec = btr_cur_get_rec(cursor);
- 	index = cursor->index;
- 	ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
--	ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- 	/* The insert buffer tree should never be updated in place. */
- 	ut_ad(!dict_index_is_ibuf(index));
- 
-@@ -2053,6 +2087,11 @@
- 		goto err_exit;
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip CHANGE, LOG */
-+		goto err_exit; /* == DB_SUCCESS */
-+	}
-+
- 	/* Ok, we may do the replacement. Store on the page infimum the
- 	explicit locks on rec, before deleting rec (see the comment in
- 	btr_cur_pessimistic_update). */
-@@ -2203,9 +2242,9 @@
- 	rec = btr_cur_get_rec(cursor);
- 	index = cursor->index;
- 
--	ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, dict_index_get_lock(index),
- 				MTR_MEMO_X_LOCK));
--	ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
-+	ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- #ifdef UNIV_ZIP_DEBUG
- 	ut_a(!page_zip || page_zip_validate(page_zip, page));
- #endif /* UNIV_ZIP_DEBUG */
-@@ -2293,6 +2332,9 @@
- 
- 		ut_ad(big_rec_vec == NULL);
- 
-+		/* fake_changes should not cause undo. so never reaches here */
-+		ut_ad(!(trx->fake_changes));
-+
- 		btr_rec_free_updated_extern_fields(
- 			index, rec, page_zip, offsets, update,
- 			trx_is_recv(trx) ? RB_RECOVERY : RB_NORMAL, mtr);
-@@ -2331,6 +2373,12 @@
- 		ut_ad(flags & BTR_KEEP_POS_FLAG);
- 	}
- 
-+	if (trx->fake_changes) {
-+		/* skip CHANGE, LOG */
-+		err = DB_SUCCESS;
-+		goto return_after_reservations;
-+	}
-+
- 	/* Store state of explicit locks on rec on the page infimum record,
- 	before deleting rec. The page infimum acts as a dummy carrier of the
- 	locks, taking care also of lock releases, before we can move the locks
-@@ -2686,6 +2734,11 @@
- 	ut_ad(dict_index_is_clust(index));
- 	ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip LOCK, UNDO, CHANGE, LOG */
-+		return(DB_SUCCESS);
-+	}
-+
- 	err = lock_clust_rec_modify_check_and_lock(flags, block,
- 						   rec, index, offsets, thr);
- 
-@@ -2823,6 +2876,11 @@
- 	rec_t*		rec;
- 	ulint		err;
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		/* skip LOCK, CHANGE, LOG */
-+		return(DB_SUCCESS);
-+	}
-+
- 	block = btr_cur_get_block(cursor);
- 	rec = btr_cur_get_rec(cursor);
- 
---- a/storage/innodb_plugin/handler/ha_innodb.cc
-+++ b/storage/innodb_plugin/handler/ha_innodb.cc
-@@ -369,6 +369,12 @@
-   "The value 3 regards innodb_flush_log_at_trx_commit (default).",
-   NULL, NULL, 3, 0, 3, 0);
- 
-+static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
-+  "In the transaction after enabled, UPDATE, INSERT and DELETE only move the cursor to the records "
-+  "and do nothing other operations (no changes, no ibuf, no undo, no transaction log) in the transaction. "
-+  "This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.",
-+  NULL, NULL, FALSE);
-+
- 
- static handler *innobase_create_handler(handlerton *hton,
-                                         TABLE_SHARE *table,
-@@ -1400,6 +1406,8 @@
- 	trx->check_unique_secondary = !thd_test_options(
- 		thd, OPTION_RELAXED_UNIQUE_CHECKS);
- 
-+	trx->fake_changes = THDVAR(thd, fake_changes);
-+
- #ifdef EXTENDED_SLOWLOG
- 	if (thd_log_slow_verbosity(thd) & SLOG_V_INNODB) {
- 		trx->take_stats = TRUE;
-@@ -2816,6 +2824,11 @@
- 		trx_search_latch_release_if_reserved(trx);
- 	}
- 
-+	if (trx->fake_changes && (all || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
-+		innobase_rollback(hton, thd, all); /* rollback implicitly */
-+		thd->main_da.reset_diagnostics_area(); /* because debug assertion code complains, if something left */
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
- 	/* The flag trx->active_trans is set to 1 in
- 
- 	1. ::external_lock(),
-@@ -7141,6 +7154,12 @@
- 
- 	trx = innobase_trx_allocate(thd);
- 
-+	if (trx->fake_changes) {
-+		innobase_commit_low(trx);
-+		trx_free_for_mysql(trx);
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
-+
- 	/* Latch the InnoDB data dictionary exclusively so that no deadlocks
- 	or lock waits can happen in it during a table create operation.
- 	Drop table etc. do this latching in row0mysql.c. */
-@@ -7346,6 +7365,10 @@
- 		DBUG_RETURN(HA_ERR_CRASHED);
- 	}
- 
-+	if (prebuilt->trx->fake_changes) {
-+		goto fallback;
-+	}
-+
- 	/* Truncate the table in InnoDB */
- 
- 	error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
-@@ -7406,6 +7429,12 @@
- 
- 	trx = innobase_trx_allocate(thd);
- 
-+	if (trx->fake_changes) {
-+		innobase_commit_low(trx);
-+		trx_free_for_mysql(trx);
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
-+
- 	name_len = strlen(name);
- 
- 	ut_a(name_len < 1000);
-@@ -7494,6 +7523,12 @@
- 	trx->mysql_thd = NULL;
- #else
- 	trx = innobase_trx_allocate(thd);
-+	if (trx->fake_changes) {
-+		my_free(namebuf, MYF(0));
-+		innobase_commit_low(trx);
-+		trx_free_for_mysql(trx);
-+		return; /* ignore */
-+	}
- #endif
- 	row_drop_database_for_mysql(namebuf, trx);
- 	my_free(namebuf, MYF(0));
-@@ -7601,6 +7636,11 @@
- 	trx_search_latch_release_if_reserved(parent_trx);
- 
- 	trx = innobase_trx_allocate(thd);
-+	if (trx->fake_changes) {
-+		innobase_commit_low(trx);
-+		trx_free_for_mysql(trx);
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
- 
- 	error = innobase_rename_table(trx, from, to, TRUE);
- 
-@@ -10373,6 +10413,10 @@
- 		return(0);
- 	}
- 
-+	if (trx->fake_changes) {
-+		return(0);
-+	}
-+
- 	thd_get_xid(thd, (MYSQL_XID*) &trx->xid);
- 
- 	/* Release a possible FIFO ticket and search latch. Since we will
-@@ -11905,6 +11949,7 @@
-   MYSQL_SYSVAR(use_purge_thread),
-   MYSQL_SYSVAR(pass_corrupt_table),
-   MYSQL_SYSVAR(lazy_drop_table),
-+  MYSQL_SYSVAR(fake_changes),
-   NULL
- };
- 
---- a/storage/innodb_plugin/handler/handler0alter.cc
-+++ b/storage/innodb_plugin/handler/handler0alter.cc
-@@ -652,6 +652,9 @@
- 	/* In case MySQL calls this in the middle of a SELECT query, release
- 	possible adaptive hash latch to avoid deadlocks of threads. */
- 	trx_search_latch_release_if_reserved(prebuilt->trx);
-+	if (prebuilt->trx->fake_changes) {
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
- 
- 	/* Check if the index name is reserved. */
- 	if (innobase_index_name_is_reserved(user_thd, key_info, num_of_keys)) {
-@@ -678,6 +681,13 @@
- 	/* Create a background transaction for the operations on
- 	the data dictionary tables. */
- 	trx = innobase_trx_allocate(user_thd);
-+	if (trx->fake_changes) {
-+		mem_heap_free(heap);
-+		trx_general_rollback_for_mysql(trx, NULL);
-+		trx_free_for_mysql(trx);
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
-+
- 	trx_start_if_not_started(trx);
- 
- 	/* Create table containing all indexes to be built in this
-@@ -964,6 +974,10 @@
- 	trx_search_latch_release_if_reserved(prebuilt->trx);
- 	trx = prebuilt->trx;
- 
-+	if (trx->fake_changes) {
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
-+
- 	/* Test and mark all the indexes to be dropped */
- 
- 	row_mysql_lock_data_dictionary(trx);
-@@ -1168,6 +1182,12 @@
- 	/* Create a background transaction for the operations on
- 	the data dictionary tables. */
- 	trx = innobase_trx_allocate(user_thd);
-+	if (trx->fake_changes) {
-+		trx_general_rollback_for_mysql(trx, NULL);
-+		trx_free_for_mysql(trx);
-+		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-+	}
-+
- 	trx_start_if_not_started(trx);
- 
- 	/* Flag this transaction as a dictionary operation, so that
---- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c
-+++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c
-@@ -2613,6 +2613,8 @@
- 
- 	ut_a(trx_sys_multiple_tablespace_format);
- 
-+	ut_ad(!(thr_get_trx(thr)->fake_changes));
-+
- 	do_merge = FALSE;
- 
- 	mutex_enter(&ibuf_mutex);
---- a/storage/innodb_plugin/include/trx0trx.h
-+++ b/storage/innodb_plugin/include/trx0trx.h
-@@ -509,6 +509,7 @@
- 					150 bytes in the undo log size as then
- 					we skip XA steps */
- 	ulint		flush_log_at_trx_commit_session;
-+	ulint		fake_changes;
- 	ulint		flush_log_later;/* In 2PC, we hold the
- 					prepare_commit mutex across
- 					both phases. In that case, we
---- a/storage/innodb_plugin/lock/lock0lock.c
-+++ b/storage/innodb_plugin/lock/lock0lock.c
-@@ -3907,6 +3907,10 @@
- 
- 	trx = thr_get_trx(thr);
- 
-+	if (trx->fake_changes && mode == LOCK_IX) {
-+		mode = LOCK_IS;
-+	}
-+
- 	lock_mutex_enter_kernel();
- 
- 	/* Look for stronger locks the same trx already has on the table */
-@@ -5108,6 +5112,11 @@
- 	}
- 
- 	trx = thr_get_trx(thr);
-+
-+	if (trx->fake_changes) {
-+		return(DB_SUCCESS);
-+	}
-+
- 	next_rec = page_rec_get_next_const(rec);
- 	next_rec_heap_no = page_rec_get_heap_no(next_rec);
- 
-@@ -5276,6 +5285,10 @@
- 		return(DB_SUCCESS);
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		return(DB_SUCCESS);
-+	}
-+
- 	heap_no = rec_offs_comp(offsets)
- 		? rec_get_heap_no_new(rec)
- 		: rec_get_heap_no_old(rec);
-@@ -5334,6 +5347,10 @@
- 		return(DB_SUCCESS);
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes) {
-+		return(DB_SUCCESS);
-+	}
-+
- 	heap_no = page_rec_get_heap_no(rec);
- 
- 	/* Another transaction cannot have an implicit lock on the record,
-@@ -5421,6 +5438,10 @@
- 		return(DB_SUCCESS);
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
-+		mode = LOCK_S;
-+	}
-+
- 	heap_no = page_rec_get_heap_no(rec);
- 
- 	lock_mutex_enter_kernel();
-@@ -5498,6 +5519,10 @@
- 		return(DB_SUCCESS);
- 	}
- 
-+	if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
-+		mode = LOCK_S;
-+	}
-+
- 	heap_no = page_rec_get_heap_no(rec);
- 
- 	lock_mutex_enter_kernel();
---- a/storage/innodb_plugin/que/que0que.c
-+++ b/storage/innodb_plugin/que/que0que.c
-@@ -1418,6 +1418,12 @@
- 
- 	ut_a(trx->error_state == DB_SUCCESS);
- 
-+	if (trx->fake_changes) {
-+		/* fake_changes should not access to system tables */
-+		fprintf(stderr, "InnoDB: ERROR: innodb_fake_changes tried to access to system tables.\n");
-+		return(DB_ERROR);
-+	}
-+
- 	if (reserve_dict_mutex) {
- 		mutex_enter(&dict_sys->mutex);
- 	}
---- a/storage/innodb_plugin/row/row0ins.c
-+++ b/storage/innodb_plugin/row/row0ins.c
-@@ -1512,6 +1512,11 @@
- 	if (UNIV_LIKELY_NULL(heap)) {
- 		mem_heap_free(heap);
- 	}
-+
-+	if (trx->fake_changes) {
-+		err = DB_SUCCESS;
-+	}
-+
- 	return(err);
- }
- 
-@@ -2014,7 +2019,7 @@
- 	}
- 
- 	btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
--				    mode | BTR_INSERT | ignore_sec_unique,
-+				    thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : (mode | BTR_INSERT | ignore_sec_unique),
- 				    &cursor, 0, __FILE__, __LINE__, &mtr);
- 
- 	if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
-@@ -2074,7 +2079,7 @@
- 
- 			btr_cur_search_to_nth_level(index, 0, entry,
- 						    PAGE_CUR_LE,
--						    mode | BTR_INSERT,
-+						    thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : (mode | BTR_INSERT),
- 						    &cursor, 0,
- 						    __FILE__, __LINE__, &mtr);
- 		}
-@@ -2162,6 +2167,22 @@
- 	mtr_commit(&mtr);
- 
- 	if (UNIV_LIKELY_NULL(big_rec)) {
-+
-+		if (thr_get_trx(thr)->fake_changes) {
-+			/* skip store extern */
-+			if (modify) {
-+				dtuple_big_rec_free(big_rec);
-+			} else {
-+				dtuple_convert_back_big_rec(index, entry, big_rec);
-+			}
-+
-+			if (UNIV_LIKELY_NULL(heap)) {
-+				mem_heap_free(heap);
-+			}
-+
-+			return(err);
-+		}
-+
- 		mtr_start(&mtr);
- 
- 		btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
---- a/storage/innodb_plugin/row/row0mysql.c
-+++ b/storage/innodb_plugin/row/row0mysql.c
-@@ -1189,6 +1189,7 @@
- 		prebuilt->table->stat_n_rows--;
- 	}
- 
-+	if (!(trx->fake_changes))
- 	row_update_statistics_if_needed(prebuilt->table);
- 	trx->op_info = "";
- 
-@@ -1449,6 +1450,7 @@
- 	that changes indexed columns, UPDATEs that change only non-indexed
- 	columns would not affect statistics. */
- 	if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
-+		if (!(trx->fake_changes))
- 		row_update_statistics_if_needed(prebuilt->table);
- 	}
- 
-@@ -1667,6 +1669,7 @@
- 		srv_n_rows_updated++;
- 	}
- 
-+	if (!(trx->fake_changes))
- 	row_update_statistics_if_needed(table);
- 
- 	return(err);
---- a/storage/innodb_plugin/row/row0upd.c
-+++ b/storage/innodb_plugin/row/row0upd.c
-@@ -1591,8 +1591,9 @@
- 
- 	mtr_start(&mtr);
- 
--	found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
--				       &mtr);
-+	found = row_search_index_entry(index, entry,
-+				       trx->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_LEAF,
-+				       &pcur, &mtr);
- 	btr_cur = btr_pcur_get_btr_cur(&pcur);
- 
- 	rec = btr_cur_get_rec(btr_cur);
-@@ -1822,9 +1823,11 @@
- 		the previous invocation of this function. Mark the
- 		off-page columns in the entry inherited. */
- 
-+		if (!(trx->fake_changes)) {
- 		change_ownership = row_upd_clust_rec_by_insert_inherit(
- 			NULL, NULL, entry, node->update);
- 		ut_a(change_ownership);
-+		}
- 		/* fall through */
- 	case UPD_NODE_INSERT_CLUSTERED:
- 		/* A lock wait occurred in row_ins_index_entry() in
-@@ -1854,7 +1857,7 @@
- 		delete-marked old record, mark them disowned by the
- 		old record and owned by the new entry. */
- 
--		if (rec_offs_any_extern(offsets)) {
-+		if (rec_offs_any_extern(offsets) && !(trx->fake_changes)) {
- 			change_ownership = row_upd_clust_rec_by_insert_inherit(
- 				rec, offsets, entry, node->update);
- 
-@@ -1982,7 +1985,8 @@
- 	the same transaction do not modify the record in the meantime.
- 	Therefore we can assert that the restoration of the cursor succeeds. */
- 
--	ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
-+	ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_TREE,
-+				       pcur, mtr));
- 
- 	ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
- 				    dict_table_is_comp(index->table)));
-@@ -1990,7 +1994,8 @@
- 	err = btr_cur_pessimistic_update(
- 		BTR_NO_LOCKING_FLAG | BTR_KEEP_POS_FLAG, btr_cur,
- 		&heap, &big_rec, node->update, node->cmpl_info, thr, mtr);
--	if (big_rec) {
-+	/* skip store extern for fake_changes */
-+	if (big_rec && !(thr_get_trx(thr)->fake_changes)) {
- 		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
- 		rec_t*		rec;
- 		rec_offs_init(offsets_);
-@@ -2132,7 +2137,8 @@
- 
- 	ut_a(pcur->rel_pos == BTR_PCUR_ON);
- 
--	success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr);
-+	success = btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_LEAF,
-+					    pcur, mtr);
- 
- 	if (!success) {
- 		err = DB_RECORD_NOT_FOUND;
---- a/storage/innodb_plugin/trx/trx0trx.c
-+++ b/storage/innodb_plugin/trx/trx0trx.c
-@@ -114,6 +114,8 @@
- 
- 	trx->flush_log_at_trx_commit_session = 3; /* means to use innodb_flush_log_at_trx_commit value */
- 
-+	trx->fake_changes = FALSE;
-+
- 	trx->check_foreigns = TRUE;
- 	trx->check_unique_secondary = TRUE;
- 
---- /dev/null
-+++ b/mysql-test/r/percona_innodb_fake_changes.result
-@@ -0,0 +1,55 @@
-+DROP TABLE IF EXISTS t1;
-+# Checking variables
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+Variable_name	Value
-+innodb_fake_changes	OFF
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+VARIABLE_VALUE
-+OFF
-+SET innodb_fake_changes=1;
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+Variable_name	Value
-+innodb_fake_changes	ON
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+VARIABLE_VALUE
-+ON
-+SET innodb_fake_changes=default;
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+Variable_name	Value
-+innodb_fake_changes	OFF
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+VARIABLE_VALUE
-+OFF
-+# Explicit COMMIT should fail when innodb_fake_changes is enabled
-+# DML should be fine
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+INSERT INTO t1 VALUES (1);
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+INSERT INTO t1 VALUES (2);
-+UPDATE t1 SET a=0;
-+DELETE FROM t1 LIMIT 1;
-+SELECT * FROM t1;
-+a
-+1
-+COMMIT;
-+ERROR HY000: Got error 131 during COMMIT
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
-+# DDL must result in error
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
-+ERROR HY000: Can't create table 'test.t2' (errno: 131)
-+DROP TABLE t1;
-+ERROR 42S02: Unknown table 't1'
-+TRUNCATE TABLE t1;
-+ERROR HY000: Got error 131 during COMMIT
-+ALTER TABLE t1 ENGINE=MyISAM;
-+ERROR HY000: Got error 131 during COMMIT
-+ROLLBACK;
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
---- /dev/null
-+++ b/mysql-test/r/percona_innodb_fake_changes_locks.result
-@@ -0,0 +1,19 @@
-+DROP TABLE IF EXISTS t1;
-+# Verifying that X_LOCK not acquired
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+INSERT INTO t1 VALUES (1);
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+SELECT * FROM t1 FOR UPDATE;
-+a
-+1
-+SET innodb_lock_wait_timeout=3;
-+UPDATE t1 SET a=2;
-+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-+SELECT * FROM t1 LOCK IN SHARE MODE;
-+a
-+1
-+ROLLBACK;
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
---- /dev/null
-+++ b/mysql-test/t/percona_innodb_fake_changes.test
-@@ -0,0 +1,49 @@
-+--source include/have_innodb_plugin.inc
-+
-+--disable_warnings
-+DROP TABLE IF EXISTS t1;
-+--enable_warnings
-+
-+
-+--echo # Checking variables
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+SET innodb_fake_changes=1;
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+SET innodb_fake_changes=default;
-+SHOW VARIABLES LIKE 'innodb_fake_changes';
-+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
-+
-+--echo # Explicit COMMIT should fail when innodb_fake_changes is enabled
-+--echo # DML should be fine
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+INSERT INTO t1 VALUES (1);
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+INSERT INTO t1 VALUES (2);
-+UPDATE t1 SET a=0;
-+DELETE FROM t1 LIMIT 1;
-+SELECT * FROM t1;
-+--error 1180
-+COMMIT;
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
-+
-+--echo # DDL must result in error
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+--error 1005
-+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
-+--error 1051
-+DROP TABLE t1;
-+--error 1180
-+TRUNCATE TABLE t1;
-+--error 1180
-+ALTER TABLE t1 ENGINE=MyISAM;
-+ROLLBACK;
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
---- /dev/null
-+++ b/mysql-test/t/percona_innodb_fake_changes_locks.test
-@@ -0,0 +1,24 @@
-+--source include/have_innodb_plugin.inc
-+
-+--disable_warnings
-+DROP TABLE IF EXISTS t1;
-+--enable_warnings
-+
-+--echo # Verifying that X_LOCK not acquired
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+INSERT INTO t1 VALUES (1);
-+--connect (conn1,localhost,root,,)
-+--connection conn1
-+SET autocommit=0;
-+SET innodb_fake_changes=1;
-+BEGIN;
-+SELECT * FROM t1 FOR UPDATE;
-+--connection default
-+SET innodb_lock_wait_timeout=3;
-+--error 1205
-+UPDATE t1 SET a=2;
-+SELECT * FROM t1 LOCK IN SHARE MODE;
-+--connection conn1
-+ROLLBACK;
-+SET innodb_fake_changes=default;
-+DROP TABLE t1;
diff --git a/innodb_kill_idle_transaction.patch b/innodb_kill_idle_transaction.patch
deleted file mode 100644
index 9f7251c..0000000
--- a/innodb_kill_idle_transaction.patch
+++ /dev/null
@@ -1,402 +0,0 @@
-# name       : innodb_kill_idle_transaction.patch
-# introduced : 5.1.58
-# maintainer : Yasufumi
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/include/mysql/plugin.h
-+++ b/include/mysql/plugin.h
-@@ -847,6 +847,12 @@
- */
- void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
-                      const void *ha_data);
-+
-+int thd_command(const MYSQL_THD thd);
-+long long thd_start_time(const MYSQL_THD thd);
-+void thd_kill(MYSQL_THD thd);
-+#define EXTENDED_FOR_KILLIDLE
-+
- #ifdef __cplusplus
- }
- #endif
---- a/include/mysql/plugin.h.pp
-+++ b/include/mysql/plugin.h.pp
-@@ -150,3 +150,6 @@
- void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
- void thd_set_ha_data(void* thd, const struct handlerton *hton,
-                      const void *ha_data);
-+int thd_command(const void* thd);
-+long long thd_start_time(const void* thd);
-+void thd_kill(void* thd);
---- a/sql/sql_class.cc
-+++ b/sql/sql_class.cc
-@@ -470,6 +470,26 @@
-   return buffer;
- }
- 
-+/* extend for kill session of idle transaction from engine */
-+extern "C"
-+int thd_command(const THD* thd)
-+{
-+  return (int) thd->command;
-+}
-+
-+extern "C"
-+long long thd_start_time(const THD* thd)
-+{
-+  return (long long) thd->start_time;
-+}
-+
-+extern "C"
-+void thd_kill(THD* thd)
-+{
-+  pthread_mutex_lock(&thd->LOCK_thd_data);
-+  thd->awake(THD::KILL_CONNECTION);
-+  pthread_mutex_unlock(&thd->LOCK_thd_data);
-+}
- 
- /**
-   Implementation of Drop_table_error_handler::handle_error().
---- a/storage/innodb_plugin/handler/ha_innodb.cc
-+++ b/storage/innodb_plugin/handler/ha_innodb.cc
-@@ -2517,6 +2517,10 @@
- 
- 	innobase_commit_concurrency_init_default();
- 
-+#ifndef EXTENDED_FOR_KILLIDLE
-+	srv_kill_idle_transaction = 0;
-+#endif
-+
- 	/* Since we in this module access directly the fields of a trx
- 	struct, and due to different headers and flags it might happen that
- 	mutex_t has a different size in this module and in InnoDB
-@@ -11231,6 +11235,48 @@
- 	return(false);
- }
- 
-+/***********************************************************************
-+functions for kill session of idle transaction */
-+extern "C"
-+ibool
-+innobase_thd_is_idle(
-+/*=================*/
-+	const void*	thd)	/*!< in: thread handle (THD*) */
-+{
-+#ifdef EXTENDED_FOR_KILLIDLE
-+	return(thd_command((const THD*) thd) == COM_SLEEP);
-+#else
-+	return(FALSE);
-+#endif
-+}
-+
-+extern "C"
-+ib_int64_t
-+innobase_thd_get_start_time(
-+/*========================*/
-+	const void*	thd)	/*!< in: thread handle (THD*) */
-+{
-+#ifdef EXTENDED_FOR_KILLIDLE
-+	return((ib_int64_t)thd_start_time((const THD*) thd));
-+#else
-+	return(0); /*dummy value*/
-+#endif
-+}
-+
-+extern "C"
-+void
-+innobase_thd_kill(
-+/*==============*/
-+	void*	thd)
-+{
-+#ifdef EXTENDED_FOR_KILLIDLE
-+	thd_kill((THD*) thd);
-+#else
-+	return;
-+#endif
-+}
-+
-+
- static SHOW_VAR innodb_status_variables_export[]= {
-   {"Innodb",                   (char*) &show_innodb_vars, SHOW_FUNC},
-   {NullS, NullS, SHOW_LONG}
-@@ -11474,6 +11520,15 @@
-   "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
-   NULL, NULL, 500L, 1L, ~0L, 0);
- 
-+static MYSQL_SYSVAR_LONG(kill_idle_transaction, srv_kill_idle_transaction,
-+  PLUGIN_VAR_RQCMDARG,
-+#ifdef EXTENDED_FOR_KILLIDLE
-+  "If non-zero value, the idle session with transaction which is idle over the value in seconds is killed by InnoDB.",
-+#else
-+  "No effect for this build.",
-+#endif
-+  NULL, NULL, 0, 0, LONG_MAX, 0);
-+
- static MYSQL_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
-   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR,
-   "Number of file I/O threads in InnoDB.",
-@@ -11767,6 +11822,7 @@
-   MYSQL_SYSVAR(fast_checksum),
-   MYSQL_SYSVAR(commit_concurrency),
-   MYSQL_SYSVAR(concurrency_tickets),
-+  MYSQL_SYSVAR(kill_idle_transaction),
-   MYSQL_SYSVAR(data_file_path),
-   MYSQL_SYSVAR(doublewrite_file),
-   MYSQL_SYSVAR(data_home_dir),
---- a/storage/innodb_plugin/include/srv0srv.h
-+++ b/storage/innodb_plugin/include/srv0srv.h
-@@ -282,6 +282,7 @@
- extern ulint	srv_activity_count;
- extern ulint	srv_fatal_semaphore_wait_threshold;
- extern ulint	srv_dml_needed_delay;
-+extern lint	srv_kill_idle_transaction;
- 
- extern mutex_t*	kernel_mutex_temp;/* mutex protecting the server, trx structs,
- 				query threads, and lock table: we allocate
---- a/storage/innodb_plugin/include/trx0trx.h
-+++ b/storage/innodb_plugin/include/trx0trx.h
-@@ -600,6 +600,8 @@
- 	ulint		mysql_process_no;/* since in Linux, 'top' reports
- 					process id's and not thread id's, we
- 					store the process number too */
-+	time_t		idle_start;
-+	ib_int64_t	last_stmt_start;
- 	/*------------------------------*/
- 	ulint		n_mysql_tables_in_use; /* number of Innobase tables
- 					used in the processing of the current
---- a/storage/innodb_plugin/srv/srv0srv.c
-+++ b/storage/innodb_plugin/srv/srv0srv.c
-@@ -86,6 +86,11 @@
- #include "trx0i_s.h"
- #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
- 
-+/* prototypes of new functions added to ha_innodb.cc for kill_idle_transaction */
-+ibool		innobase_thd_is_idle(const void* thd);
-+ib_int64_t	innobase_thd_get_start_time(const void* thd);
-+void		innobase_thd_kill(void* thd);
-+
- /* prototypes for new functions added to ha_innodb.cc */
- ibool	innobase_get_slow_log();
- 
-@@ -100,6 +105,9 @@
- /* The following is the maximum allowed duration of a lock wait. */
- UNIV_INTERN ulint	srv_fatal_semaphore_wait_threshold = 600;
- 
-+/**/
-+UNIV_INTERN lint	srv_kill_idle_transaction = 0;
-+
- /* How much data manipulation language (DML) statements need to be delayed,
- in microseconds, in order to reduce the lagging of the purge thread. */
- UNIV_INTERN ulint	srv_dml_needed_delay = 0;
-@@ -2557,6 +2565,36 @@
- 		old_sema = sema;
- 	}
- 
-+	if (srv_kill_idle_transaction && trx_sys) {
-+		trx_t*	trx;
-+		time_t	now;
-+rescan_idle:
-+		now = time(NULL);
-+		mutex_enter(&kernel_mutex);
-+		trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
-+		while (trx) {
-+			if (trx->conc_state == TRX_ACTIVE
-+			    && trx->mysql_thd
-+			    && innobase_thd_is_idle(trx->mysql_thd)) {
-+				ib_int64_t	start_time; /* as stmt ID */
-+
-+				start_time = innobase_thd_get_start_time(trx->mysql_thd);
-+				if (trx->last_stmt_start != start_time) {
-+					trx->idle_start = now;
-+					trx->last_stmt_start = start_time;
-+				} else if (difftime(now, trx->idle_start)
-+					   > srv_kill_idle_transaction) {
-+					/* kill the session */
-+					mutex_exit(&kernel_mutex);
-+					innobase_thd_kill(trx->mysql_thd);
-+					goto rescan_idle;
-+				}
-+			}
-+			trx = UT_LIST_GET_NEXT(mysql_trx_list, trx);
-+		}
-+		mutex_exit(&kernel_mutex);
-+	}
-+
- 	/* Flush stderr so that a database user gets the output
- 	to possible MySQL error file */
- 
---- a/storage/innodb_plugin/trx/trx0trx.c
-+++ b/storage/innodb_plugin/trx/trx0trx.c
-@@ -137,6 +137,9 @@
- 	trx->mysql_relay_log_file_name = "";
- 	trx->mysql_relay_log_pos = 0;
- 
-+	trx->idle_start = 0;
-+	trx->last_stmt_start = 0;
-+
- 	mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);
- 
- 	trx->rseg = NULL;
---- /dev/null
-+++ b/mysql-test/r/percona_innodb_kill_idle_trx.result
-@@ -0,0 +1,41 @@
-+DROP TABLE IF EXISTS t1;
-+SET autocommit=0;
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	0
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	0
-+SET GLOBAL innodb_kill_idle_transaction=1;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	1
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	1
-+BEGIN;
-+INSERT INTO t1 VALUES (1),(2),(3);
-+COMMIT;
-+SELECT * FROM t1;
-+a
-+1
-+2
-+3
-+BEGIN;
-+INSERT INTO t1 VALUES (4),(5),(6);
-+SELECT * FROM t1;
-+ERROR HY000: MySQL server has gone away
-+SELECT * FROM t1;
-+a
-+1
-+2
-+3
-+DROP TABLE t1;
-+SET GLOBAL innodb_kill_idle_transaction=0;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	0
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	0
---- /dev/null
-+++ b/mysql-test/r/percona_innodb_kill_idle_trx_locks.result
-@@ -0,0 +1,45 @@
-+DROP TABLE IF EXISTS t1;
-+SET autocommit=0;
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	0
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	0
-+SET GLOBAL innodb_kill_idle_transaction=5;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	5
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	5
-+BEGIN;
-+INSERT INTO t1 VALUES (1),(2),(3);
-+COMMIT;
-+SELECT * FROM t1;
-+a
-+1
-+2
-+3
-+### Locking rows. Lock should be released when idle trx is killed.
-+BEGIN;
-+SELECT * FROM t1 FOR UPDATE;
-+a
-+1
-+2
-+3
-+UPDATE t1 set a=4;
-+SELECT * FROM t1;
-+a
-+4
-+4
-+4
-+DROP TABLE t1;
-+SET GLOBAL innodb_kill_idle_transaction=0;
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+Variable_name	Value
-+innodb_kill_idle_transaction	0
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
-+VARIABLE_NAME	VARIABLE_VALUE
-+INNODB_KILL_IDLE_TRANSACTION	0
---- /dev/null
-+++ b/mysql-test/t/percona_innodb_kill_idle_trx.test
-@@ -0,0 +1,28 @@
-+--source include/have_innodb.inc
-+--disable_warnings
-+DROP TABLE IF EXISTS t1; 
-+--enable_warnings
-+
-+SET autocommit=0;
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+
-+--source include/percona_innodb_kill_idle_trx_show.inc
-+SET GLOBAL innodb_kill_idle_transaction=1;
-+--source include/percona_innodb_kill_idle_trx_show.inc
-+
-+BEGIN;
-+INSERT INTO t1 VALUES (1),(2),(3);
-+COMMIT;
-+SELECT * FROM t1;
-+
-+BEGIN;
-+INSERT INTO t1 VALUES (4),(5),(6);
-+sleep 3;
-+
-+--enable_reconnect
-+--error 2006 --error CR_SERVER_GONE_ERROR
-+SELECT * FROM t1;
-+SELECT * FROM t1;
-+DROP TABLE t1;
-+SET GLOBAL innodb_kill_idle_transaction=0;
-+--source include/percona_innodb_kill_idle_trx_show.inc
---- /dev/null
-+++ b/mysql-test/t/percona_innodb_kill_idle_trx_locks.test
-@@ -0,0 +1,31 @@
-+--source include/have_innodb.inc
-+--disable_warnings
-+DROP TABLE IF EXISTS t1;
-+--enable_warnings
-+
-+SET autocommit=0;
-+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-+
-+--source include/percona_innodb_kill_idle_trx_show.inc
-+SET GLOBAL innodb_kill_idle_transaction=5;
-+--source include/percona_innodb_kill_idle_trx_show.inc
-+
-+connect (conn1,localhost,root,,);
-+connection conn1;
-+
-+BEGIN;
-+INSERT INTO t1 VALUES (1),(2),(3);
-+COMMIT;
-+SELECT * FROM t1;
-+
-+--echo ### Locking rows. Lock should be released when idle trx is killed.
-+BEGIN;
-+SELECT * FROM t1 FOR UPDATE;
-+
-+connection default;
-+UPDATE t1 set a=4;
-+
-+SELECT * FROM t1;
-+DROP TABLE t1;
-+SET GLOBAL innodb_kill_idle_transaction=0;
-+--source include/percona_innodb_kill_idle_trx_show.inc
---- /dev/null
-+++ b/mysql-test/include/percona_innodb_kill_idle_trx_show.inc
-@@ -0,0 +1,2 @@
-+SHOW GLOBAL VARIABLES LIKE 'innodb_kill_idle_transaction';
-+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_kill_idle_transaction';
diff --git a/mysql-acc-pslist.patch b/mysql-acc-pslist.patch
deleted file mode 100644
index f447f4f..0000000
--- a/mysql-acc-pslist.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-diff -r 1a59073d658d mysql-test/r/create.result
---- a/mysql-test/r/create.result	Sat Sep 13 17:31:30 2008 -0700
-+++ b/mysql-test/r/create.result	Sat Sep 13 17:31:40 2008 -0700
-@@ -1720,7 +1720,8 @@
-   `COMMAND` varchar(16) NOT NULL DEFAULT '',
-   `TIME` bigint(7) NOT NULL DEFAULT '0',
-   `STATE` varchar(64) DEFAULT NULL,
--  `INFO` longtext
-+  `INFO` longtext,
-+  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8
- drop table t1;
- create temporary table t1 like information_schema.processlist;
-@@ -1734,7 +1735,8 @@
-   `COMMAND` varchar(16) NOT NULL DEFAULT '',
-   `TIME` bigint(7) NOT NULL DEFAULT '0',
-   `STATE` varchar(64) DEFAULT NULL,
--  `INFO` longtext
-+  `INFO` longtext,
-+  `TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000'
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8
- drop table t1;
- create table t1 like information_schema.character_sets;
-diff -r 1a59073d658d sql/sql_show.cc
---- a/sql/sql_show.cc	Sat Sep 13 17:31:30 2008 -0700
-+++ b/sql/sql_show.cc	Sat Sep 13 17:31:40 2008 -0700
-@@ -1803,7 +1803,7 @@
-   TABLE *table= tables->table;
-   CHARSET_INFO *cs= system_charset_info;
-   char *user;
--  time_t now= my_time(0);
-+  ulonglong unow= my_micro_time();
-   DBUG_ENTER("fill_process_list");
- 
-   user= thd->security_ctx->master_access & PROCESS_ACL ?
-@@ -1873,8 +1873,8 @@
-         table->field[4]->store(command_name[tmp->command].str,
-                                command_name[tmp->command].length, cs);
-       /* MYSQL_TIME */
--      table->field[5]->store((longlong)(tmp->start_time ?
--                                      now - tmp->start_time : 0), FALSE);
-+      const ulonglong utime= tmp->start_utime ? unow - tmp->start_utime : 0;
-+      table->field[5]->store(utime / 1000000, TRUE);
-       /* STATE */
- #ifndef EMBEDDED_LIBRARY
-       val= (char*) (tmp->locked ? "Locked" :
-@@ -1896,11 +1896,15 @@
-         table->field[7]->set_notnull();
-       }
- 
-+      /* TIME_MS */
-+      table->field[8]->store((double)(utime / 1000.0));
-+
-       if (schema_table_store_record(thd, table))
-       {
-         VOID(pthread_mutex_unlock(&LOCK_thread_count));
-         DBUG_RETURN(1);
-       }
-+
-     }
-   }
- 
-@@ -5531,7 +5535,7 @@
-     into it two numbers, based on modulus of base-10 numbers.  In the ones
-     position is the number of decimals.  Tens position is unused.  In the
-     hundreds and thousands position is a two-digit decimal number representing
--    length.  Encode this value with  (decimals*100)+length  , where
-+    length.  Encode this value with  (length*100)+decimals  , where
-     0<decimals<10 and 0<=length<100 .
- 
-   @param
-@@ -6539,6 +6543,8 @@
-   {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
-   {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
-    SKIP_OPEN_TABLE},
-+  {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
-+    0, 0, "Time_ms", SKIP_OPEN_TABLE},
-   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
- };
- 
diff --git a/mysql-bug-34192.patch b/mysql-bug-34192.patch
deleted file mode 100644
index d6491d4..0000000
--- a/mysql-bug-34192.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From: Chad MILLERDate: February 1 2008 5:53pm
-Subject: bk commit into 5.0 tree (cmiller:1.2572) BUG#34192
-
-Below is the list of changes that have just been committed into a local
-5.0 repository of cmiller.  When cmiller does a push these changes
-will be propagated to the main repository and, within 24 hours after the
-push, to the public repository.
-For information on how to access the public repository
-see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
-
-ChangeSet at stripped, 2008-02-01 11:53:48-05:00, cmiller at stripped +1 -0
-  Bug#34192: mysqldump from mysql 5.0.51 silently fails on dumping \
-  	databases from 4.0 server
-  
-  Contribution from Arkadiusz Miskiewicz.  No CLA required for this size.
-  
-  mysqldump treated a failure to set the results charset as a severe
-  error.  
-  
-  Now, don't try to set the charset for the SHOW CREATE TABLE statement,
-  if the dumper doesn't want SET NAMES or the remote server doesn't 
-  support changing charsets.
-  
-  (The original patch tried to set the charset to binary and back in 
-  any case, and only exited-with-failure if the dumper wanted it and
-  the remote server supported it.)
-
-  client/mysqldump.c at stripped, 2008-02-01 11:53:46-05:00, cmiller at stripped +13 -3
-    Don't set the charset for receiving results if it's not wanted or if
-    the server doesn't support it.
-
-diff -Nrup a/client/mysqldump.c b/client/mysqldump.c
---- a/client/mysqldump.c	2007-12-04 22:07:00 -05:00
-+++ b/client/mysqldump.c	2008-02-01 11:53:46 -05:00
-@@ -1705,10 +1705,20 @@ static uint get_table_structure(char *ta
- 
-       my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
- 
--      if (switch_character_set_results(mysql, "binary") ||
--          mysql_query_with_error_report(mysql, &result, buff) ||
--          switch_character_set_results(mysql, default_charset))
-+      if (opt_set_charset)  /* Was forced to false if server is too old. */
-+      {
-+        if (switch_character_set_results(mysql, "binary") != 0)
-+          DBUG_RETURN(0);
-+      }
-+
-+      if (mysql_query_with_error_report(mysql, &result, buff) != 0)
-         DBUG_RETURN(0);
-+
-+      if (opt_set_charset)  /* Was forced to false if server is too old. */
-+      {
-+        if (switch_character_set_results(mysql, default_charset) != 0)
-+          DBUG_RETURN(0);
-+      }
- 
-       if (path)
-       {
diff --git a/mysql-bug580324.patch b/mysql-bug580324.patch
deleted file mode 100644
index 3459c76..0000000
--- a/mysql-bug580324.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-# name       : bug580324.patch
-# introduced : 11 or before
-# maintainer : Oleg
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/sql/sql_base.cc
-+++ b/sql/sql_base.cc
-@@ -233,8 +233,12 @@
- uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
-                           bool tmp_table)
- {
--  uint key_length= (uint) (strmov(strmov(key, table_list->db)+1,
--                                  table_list->table_name)-key)+1;
-+  char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2);
-+  *db_end++= '\0';
-+  char *table_end= strnmov(db_end, table_list->table_name,
-+                           key + MAX_DBKEY_LENGTH - 1 - db_end);
-+  *table_end++= '\0';
-+  uint key_length= (uint) (table_end-key);
-   if (tmp_table)
-   {
-     int4store(key + key_length, thd->server_id);
---- a/sql/sql_parse.cc
-+++ b/sql/sql_parse.cc
-@@ -1344,10 +1344,12 @@
-     break;
- #else
-   {
--    char *fields, *packet_end= packet + packet_length, *arg_end;
-+    char *fields, *packet_end= packet + packet_length, *wildcard;
-     /* Locked closure of all tables */
-     TABLE_LIST table_list;
--    LEX_STRING conv_name;
-+    char db_buff[NAME_LEN+1];
-+    uint32 db_length;
-+    uint dummy_errors;
- 
-     /* used as fields initializator */
-     lex_start(thd);
-@@ -1359,26 +1361,22 @@
-     /*
-       We have name + wildcard in packet, separated by endzero
-     */
--    arg_end= strend(packet);
--    uint arg_length= arg_end - packet;
--    
--    /* Check given table name length. */
--    if (arg_length >= packet_length || arg_length > NAME_LEN)
-+    wildcard= strend(packet);
-+    db_length= wildcard - packet;
-+    wildcard++;
-+    uint query_length= (uint) (packet_end - wildcard); // Don't count end \0
-+    if (db_length > NAME_LEN || query_length > NAME_LEN)
-     {
-       my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
-       break;
-     }
--    thd->convert_string(&conv_name, system_charset_info,
--			packet, arg_length, thd->charset());
--    if (check_table_name(conv_name.str, conv_name.length, FALSE))
--    {
--      /* this is OK due to convert_string() null-terminating the string */
--      my_error(ER_WRONG_TABLE_NAME, MYF(0), conv_name.str);
-+    db_length= copy_and_convert(db_buff, sizeof(db_buff)-1,
-+                                system_charset_info, packet, db_length,
-+                                thd->charset(), &dummy_errors);
-+    db_buff[db_length]= '\0';
-+    table_list.alias= table_list.table_name= db_buff;
-+    if (!(fields= (char *) thd->memdup(wildcard, query_length + 1)))
-       break;
--    }
--
--    table_list.alias= table_list.table_name= conv_name.str;
--    packet= arg_end + 1;
- 
-     if (is_schema_db(table_list.db, table_list.db_length))
-     {
-@@ -1387,9 +1385,6 @@
-         table_list.schema_table= schema_table;
-     }
- 
--    uint query_length= (uint) (packet_end - packet); // Don't count end \0
--    if (!(fields= (char *) thd->memdup(packet, query_length + 1)))
--      break;
-     thd->set_query(fields, query_length);
-     general_log_print(thd, command, "%s %s", table_list.table_name, fields);
-     if (lower_case_table_names)
---- a/strings/ctype-utf8.c
-+++ b/strings/ctype-utf8.c
-@@ -4118,6 +4118,10 @@
- {
-   int code;
-   char hex[]= "0123456789abcdef";
-+
-+  if (s >= e)
-+    return MY_CS_TOOSMALL;
-+
-   if (wc < 128 && filename_safe_char[wc])
-   {
-     *s= (uchar) wc;
diff --git a/mysql-bug677407.patch b/mysql-bug677407.patch
deleted file mode 100644
index 996e8d8..0000000
--- a/mysql-bug677407.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-# name       : bug677407
-# introduced : 13
-# maintainer : Alexey
-
-LP bug#677407 / MySQL Bug#48883: Stale data from INNODB_LOCKS table.
-
-The innodb.innodb_information_schema test could fail sporadically due to
-the flawed logic in the INFORMATION_SCHEMA.INNODB_LOCKS caching
-mechanism.
-
-The logic for how to check when to update the table cache for
-INNODB_LOCKS with real data was flawed. This could result in both not
-updating the cache often enough (when the table is queried repeatedly
-with less than 100 milliseconds in-between) resulting in stale data; as
-well as updating too often (when multiple queries against the table
-start at around the same time).
-
-Fixed by updating the "last updated" timestamp in the right place, when
-the cache is updated, not when it is read.
-
-I hereby grant Percona the following BSD license to this patch for
-inclusion in Percona Server:
-
-Copyright (c) 2010, Kristian Nielsen 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 the author 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
-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.
-
---- a/storage/innodb_plugin/trx/trx0i_s.c
-+++ b/storage/innodb_plugin/trx/trx0i_s.c
-@@ -157,10 +157,6 @@
- 	ullint		last_read;	/*!< last time the cache was read;
- 					measured in microseconds since
- 					epoch */
--	mutex_t		last_read_mutex;/*!< mutex protecting the
--					last_read member - it is updated
--					inside a shared lock of the
--					rw_lock member */
- 	i_s_table_cache_t innodb_trx;	/*!< innodb_trx table */
- 	i_s_table_cache_t innodb_locks;	/*!< innodb_locks table */
- 	i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */
-@@ -1142,13 +1138,6 @@
- {
- 	ullint	now;
- 
--	/* Here we read cache->last_read without acquiring its mutex
--	because last_read is only updated when a shared rw lock on the
--	whole cache is being held (see trx_i_s_cache_end_read()) and
--	we are currently holding an exclusive rw lock on the cache.
--	So it is not possible for last_read to be updated while we are
--	reading it. */
--
- #ifdef UNIV_SYNC_DEBUG
- 	ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
- #endif
-@@ -1246,6 +1235,12 @@
- /*===================================*/
- 	trx_i_s_cache_t*	cache)	/*!< in/out: cache */
- {
-+	ullint	now;
-+
-+#ifdef UNIV_SYNC_DEBUG
-+	ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX));
-+#endif
-+
- 	if (!can_cache_be_updated(cache)) {
- 
- 		return(1);
-@@ -1258,6 +1253,10 @@
- 
- 	mutex_exit(&kernel_mutex);
- 
-+	/* update cache last read time */
-+	now = ut_time_us(NULL);
-+	cache->last_read = now;
-+
- 	return(0);
- }
- 
-@@ -1288,16 +1287,12 @@
- 	release kernel_mutex
- 	release trx_i_s_cache_t::rw_lock
- 	acquire trx_i_s_cache_t::rw_lock, S
--	acquire trx_i_s_cache_t::last_read_mutex
--	release trx_i_s_cache_t::last_read_mutex
- 	release trx_i_s_cache_t::rw_lock */
- 
- 	rw_lock_create(&cache->rw_lock, SYNC_TRX_I_S_RWLOCK);
- 
- 	cache->last_read = 0;
- 
--	mutex_create(&cache->last_read_mutex, SYNC_TRX_I_S_LAST_READ);
--
- 	table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
- 	table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
- 	table_cache_init(&cache->innodb_lock_waits,
-@@ -1348,18 +1343,10 @@
- /*===================*/
- 	trx_i_s_cache_t*	cache)	/*!< in: cache */
- {
--	ullint	now;
--
- #ifdef UNIV_SYNC_DEBUG
- 	ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED));
- #endif
- 
--	/* update cache last read time */
--	now = ut_time_us(NULL);
--	mutex_enter(&cache->last_read_mutex);
--	cache->last_read = now;
--	mutex_exit(&cache->last_read_mutex);
--
- 	rw_lock_s_unlock(&cache->rw_lock);
- }
- 
diff --git a/mysql-bugfix48929.patch b/mysql-bugfix48929.patch
deleted file mode 100644
index 266ba7b..0000000
--- a/mysql-bugfix48929.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-# name       : bugfix48929.patch
-# introduced : 11 or before
-# maintainer : Oleg
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/configure.in
-+++ b/configure.in
-@@ -815,7 +815,7 @@
- AC_HEADER_STDC
- AC_HEADER_SYS_WAIT
- AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
-- ieeefp.h limits.h memory.h pwd.h select.h \
-+ ieeefp.h limits.h memory.h pwd.h select.h poll.h \
-  stdlib.h stddef.h \
-  strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
-  sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
---- a/sql/mysqld.cc
-+++ b/sql/mysqld.cc
-@@ -56,6 +56,10 @@
- #include "sp_rcontext.h"
- #include "sp_cache.h"
- 
-+#ifdef HAVE_POLL_H
-+#include <poll.h>
-+#endif
-+
- #define mysqld_charset &my_charset_latin1
- 
- #ifdef HAVE_purify
-@@ -5137,31 +5141,58 @@
- #ifndef EMBEDDED_LIBRARY
- pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
- {
--  my_socket sock,new_sock;
-+  my_socket UNINIT_VAR(sock),new_sock;
-   uint error_count=0;
--  uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1);
--  fd_set readFDs,clientFDs;
-   THD *thd;
-   struct sockaddr_in cAddr;
--  int ip_flags=0,socket_flags=0,flags;
-+#if !defined(HAVE_POLL)
-+  int ip_flags= 0;
-+#endif
-+#if defined(HAVE_SYS_UN_H) && !defined(HAVE_POLL)
-+  int socket_flags= 0;
-+#endif
-+  int UNINIT_VAR(flags),retval;
-   st_vio *vio_tmp;
-+#ifdef HAVE_POLL
-+  int socket_count= 0;
-+  struct pollfd fds[2]; // for ip_sock and unix_sock
-+#else
-+  fd_set readFDs,clientFDs;
-+  uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1);
-+#endif
-+
-   DBUG_ENTER("handle_connections_sockets");
- 
-   LINT_INIT(new_sock);
- 
-   (void) my_pthread_getprio(pthread_self());		// For debugging
- 
-+#ifndef HAVE_POLL
-   FD_ZERO(&clientFDs);
-+#endif
-+
-   if (ip_sock != INVALID_SOCKET)
-   {
-+#ifdef HAVE_POLL
-+    fds[socket_count].fd= ip_sock;
-+    fds[socket_count].events= POLLIN;
-+    socket_count++;
-+#else
-     FD_SET(ip_sock,&clientFDs);
--#ifdef HAVE_FCNTL
-+#endif
-+#if !defined (HAVE_POLL) && defined(HAVE_FCNTL)
-     ip_flags = fcntl(ip_sock, F_GETFL, 0);
- #endif
-   }
- #ifdef HAVE_SYS_UN_H
-+#ifdef HAVE_POLL
-+  fds[socket_count].fd= unix_sock;
-+  fds[socket_count].events= POLLIN;
-+  socket_count++;
-+#else
-   FD_SET(unix_sock,&clientFDs);
--#ifdef HAVE_FCNTL
-+#endif
-+#if defined(HAVE_FCNTL) && defined(HAVE_SYS_UN_H) && !defined(HAVE_POLL)
-   socket_flags=fcntl(unix_sock, F_GETFL, 0);
- #endif
- #endif
-@@ -5170,12 +5201,15 @@
-   MAYBE_BROKEN_SYSCALL;
-   while (!abort_loop)
-   {
--    readFDs=clientFDs;
--#ifdef HPUX10
--    if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0)
--      continue;
-+#ifdef HAVE_POLL
-+    retval= poll(fds, socket_count, -1);
- #else
--    if (select((int) max_used_connection,&readFDs,0,0,0) < 0)
-+    readFDs=clientFDs;
-+
-+    retval= select((int) max_used_connection,&readFDs,0,0,0);
-+#endif
-+
-+    if (retval < 0)
-     {
-       if (socket_errno != SOCKET_EINTR)
-       {
-@@ -5185,7 +5219,7 @@
-       MAYBE_BROKEN_SYSCALL
-       continue;
-     }
--#endif	/* HPUX10 */
-+
-     if (abort_loop)
-     {
-       MAYBE_BROKEN_SYSCALL;
-@@ -5193,6 +5227,21 @@
-     }
- 
-     /* Is this a new connection request ? */
-+#ifdef HAVE_POLL
-+    for (int i= 0; i < socket_count; ++i) 
-+    {
-+      if (fds[i].revents & POLLIN)
-+      {
-+        sock= fds[i].fd;
-+#ifdef HAVE_FCNTL
-+        flags= fcntl(sock, F_GETFL, 0);
-+#else
-+        flags= 0;
-+#endif // HAVE_FCNTL
-+        break;
-+      }
-+    }
-+#else  // HAVE_POLL
- #ifdef HAVE_SYS_UN_H
-     if (FD_ISSET(unix_sock,&readFDs))
-     {
-@@ -5200,11 +5249,12 @@
-       flags= socket_flags;
-     }
-     else
--#endif
-+#endif // HAVE_SYS_UN_H
-     {
-       sock = ip_sock;
-       flags= ip_flags;
-     }
-+#endif // HAVE_POOL
- 
- #if !defined(NO_FCNTL_NONBLOCK)
-     if (!(test_flags & TEST_BLOCKING))
diff --git a/mysql-control_online_alter_index.patch b/mysql-control_online_alter_index.patch
deleted file mode 100644
index 5a921fb..0000000
--- a/mysql-control_online_alter_index.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-# name       : control_online_alter_index.patch
-# introduced : 12
-# maintainer : Yasufumi
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/sql/handler.h
-+++ b/sql/handler.h
-@@ -171,6 +171,19 @@
- #define HA_ONLINE_DROP_UNIQUE_INDEX             (1L << 9) /*drop uniq. online*/
- #define HA_ONLINE_ADD_PK_INDEX                  (1L << 10)/*add prim. online*/
- #define HA_ONLINE_DROP_PK_INDEX                 (1L << 11)/*drop prim. online*/
-+
-+#define HA_ONLINE_ALTER_INDEX_MASK	(HA_ONLINE_ADD_INDEX_NO_WRITES \
-+						| HA_ONLINE_DROP_INDEX_NO_WRITES \
-+						| HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES \
-+						| HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES \
-+						| HA_ONLINE_ADD_PK_INDEX_NO_WRITES \
-+						| HA_ONLINE_DROP_PK_INDEX_NO_WRITES \
-+						| HA_ONLINE_ADD_INDEX \
-+						| HA_ONLINE_DROP_INDEX \
-+						| HA_ONLINE_ADD_UNIQUE_INDEX \
-+						| HA_ONLINE_DROP_UNIQUE_INDEX \
-+						| HA_ONLINE_ADD_PK_INDEX \
-+						| HA_ONLINE_DROP_PK_INDEX)
- /*
-   HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
-   supported at all.
---- a/sql/mysqld.cc
-+++ b/sql/mysqld.cc
-@@ -5914,6 +5914,7 @@
-   OPT_USERSTAT_RUNNING,
-   OPT_THREAD_STATISTICS,
-   OPT_OPTIMIZER_FIX,
-+  OPT_ONLINE_ALTER_INDEX,
-   OPT_SUPPRESS_LOG_WARNING_1592,
-   OPT_QUERY_CACHE_STRIP_COMMENTS,
-   OPT_USE_GLOBAL_LONG_QUERY_TIME,
-@@ -5946,6 +5947,13 @@
-    "from libc.so",
-    &opt_allow_suspicious_udfs, &opt_allow_suspicious_udfs,
-    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-+  {"fast_index_creation",
-+   OPT_ONLINE_ALTER_INDEX,
-+   "If disabled, suppresses online operations for indexes of ALTER TABLE "
-+   "(e.g. fast index creation of InnoDB Plugin) for the session.",
-+   (uchar**) &global_system_variables.online_alter_index,
-+   (uchar**) &global_system_variables.online_alter_index,
-+   0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-   {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode "
-    "will also set transaction isolation level 'serializable'.", 0, 0, 0,
-    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
---- a/sql/set_var.cc
-+++ b/sql/set_var.cc
-@@ -760,6 +760,11 @@
- sys_engine_condition_pushdown(&vars, "engine_condition_pushdown",
- 			      &SV::engine_condition_pushdown);
- 
-+/* Control online operations of ALTER TABLE */
-+static sys_var_thd_bool
-+sys_online_alter_index(&vars, "fast_index_creation",
-+			&SV::online_alter_index);
-+
- #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- /* ndb thread specific variable settings */
- static sys_var_thd_ulong
---- a/sql/sql_class.h
-+++ b/sql/sql_class.h
-@@ -383,6 +383,8 @@
-   my_bool ndb_use_transactions;
-   my_bool ndb_index_stat_enable;
- 
-+  my_bool online_alter_index;
-+
-   my_bool old_alter_table;
-   my_bool old_passwords;
- 
---- a/sql/sql_partition.cc
-+++ b/sql/sql_partition.cc
-@@ -4381,7 +4381,12 @@
-         alter_info->no_parts= curr_part_no - new_part_no;
-       }
-     }
--    if (!(flags= table->file->alter_table_flags(alter_info->flags)))
-+    flags= table->file->alter_table_flags(alter_info->flags);
-+    if (!thd->variables.online_alter_index)
-+    {
-+      flags&= ~((uint)HA_ONLINE_ALTER_INDEX_MASK);
-+    }
-+    if (!flags)
-     {
-       my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0));
-       DBUG_RETURN(1);
---- a/sql/sql_table.cc
-+++ b/sql/sql_table.cc
-@@ -7023,6 +7023,10 @@
-     uint  *idx_end_p;
- 
-     alter_flags= table->file->alter_table_flags(alter_info->flags);
-+    if (!thd->variables.online_alter_index)
-+    {
-+      alter_flags&= ~((ulong)HA_ONLINE_ALTER_INDEX_MASK);
-+    }
-     DBUG_PRINT("info", ("alter_flags: %lu", alter_flags));
-     /* Check dropped indexes. */
-     for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count;
diff --git a/mysql-error_pad.patch b/mysql-error_pad.patch
deleted file mode 100644
index 5402dab..0000000
--- a/mysql-error_pad.patch
+++ /dev/null
@@ -1,266 +0,0 @@
-# name       : error_pad.patch
-# introduced : 12
-# maintainer : Oleg
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/extra/comp_err.c
-+++ b/extra/comp_err.c
-@@ -32,11 +32,12 @@
- #include <assert.h>
- #include <my_dir.h>
- 
--#define MAX_ROWS  1000
-+#define MAX_ROWS  5000
- #define HEADER_LENGTH 32                /* Length of header in errmsg.sys */
- #define DEFAULT_CHARSET_DIR "../sql/share/charsets"
- #define ER_PREFIX "ER_"
- #define WARN_PREFIX "WARN_"
-+#define PADD_PREFIX "PADD_"
- static char *OUTFILE= (char*) "errmsg.sys";
- static char *HEADERFILE= (char*) "mysqld_error.h";
- static char *NAMEFILE= (char*) "mysqld_ername.h";
-@@ -91,6 +92,7 @@
-   const char *sql_code1;		/* sql state */
-   const char *sql_code2;		/* ODBC state */
-   struct errors *next_error;            /* Pointer to next error */
-+  my_bool is_padding;                   /* If true - padd this er_name while er_code != d_code*/
-   DYNAMIC_ARRAY msg;                    /* All language texts for this error */
- };
- 
-@@ -129,6 +131,7 @@
- 
- 
- static struct languages *parse_charset_string(char *str);
-+static struct errors *parse_padd_string(char *ptr, int er_count);
- static struct errors *parse_error_string(char *ptr, int er_count);
- static struct message *parse_message_string(struct message *new_message,
- 					    char *str);
-@@ -231,6 +234,11 @@
- 
-   for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error)
-   {
-+    if (tmp_error->is_padding)
-+    {
-+      er_last= tmp_error->d_code;
-+      continue;
-+    }
-     /*
-        generating mysqld_error.h
-        fprintf() will automatically add \r on windows
-@@ -320,12 +328,29 @@
- 		"language\n", tmp_error->er_name, tmp_lang->lang_short_name);
- 	goto err;
-       }
--      if (copy_rows(to, tmp->text, row_nr, start_pos))
-+      if (tmp_error->is_padding)
-       {
--	fprintf(stderr, "Failed to copy rows to %s\n", outfile);
--	goto err;
-+        int padd_to= tmp_error->d_code;
-+        char* padd_message= tmp->text;
-+        while ((int) row_nr + er_offset < padd_to)
-+        {
-+          if (copy_rows(to, padd_message,row_nr,start_pos))
-+          {
-+            fprintf(stderr, "Failed to copy rows to %s\n", outfile);
-+            goto err;
-+          }
-+          row_nr++;
-+        }
-+      }
-+      else
-+      {
-+        if (copy_rows(to, tmp->text, row_nr, start_pos))
-+        {
-+          fprintf(stderr, "Failed to copy rows to %s\n", outfile);
-+          goto err;
-+        }
-+        row_nr++;
-       }
--      row_nr++;
-     }
- 
-     /* continue with header of the errmsg.sys file */
-@@ -476,14 +501,26 @@
- 	DBUG_RETURN(0);
-       continue;
-     }
--    if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX))
-+    if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) || is_prefix(str, PADD_PREFIX))
-     {
--      if (!(current_error= parse_error_string(str, rcount)))
-+      if (is_prefix(str, PADD_PREFIX))
-       {
--	fprintf(stderr, "Failed to parse the error name string\n");
--	DBUG_RETURN(0);
-+        if (!(current_error= parse_padd_string(str, rcount)))
-+        {
-+          fprintf(stderr, "Failed to parse the error padd string\n");
-+          DBUG_RETURN(0);
-+        }
-+        rcount= current_error->d_code - er_offset;  /* Count number of unique errors */
-+      }
-+      else
-+      {
-+        if (!(current_error= parse_error_string(str, rcount)))
-+        {
-+          fprintf(stderr, "Failed to parse the error name string\n");
-+          DBUG_RETURN(0);
-+        }
-+        rcount++;                         /* Count number of unique errors */
-       }
--      rcount++;                         /* Count number of unique errors */
- 
-       /* add error to the list */
-       *tail_error= current_error;
-@@ -824,78 +861,122 @@
-   DBUG_RETURN(new_message);
- }
- 
-+static struct errors* create_new_error(my_bool is_padding, char *er_name, int d_code, const char *sql_code1, const char *sql_code2)
-+{
-+  struct errors *new_error;
-+  DBUG_ENTER("create_new_error");
-+  /* create a new element */
-+  new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME));
-+  if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0))
-+    DBUG_RETURN(0);				/* OOM: Fatal error */
-+  new_error->is_padding= is_padding;
-+  DBUG_PRINT("info", ("is_padding: %s", (is_padding ? "true" : "false")));
-+  new_error->er_name= er_name;
-+  DBUG_PRINT("info", ("er_name: %s", er_name));
-+  new_error->d_code= d_code;
-+  DBUG_PRINT("info", ("d_code: %d", d_code));
-+  new_error->sql_code1= sql_code1;
-+  DBUG_PRINT("info", ("sql_code1: %s", sql_code1));
-+  new_error->sql_code2= sql_code2;
-+  DBUG_PRINT("info", ("sql_code2: %s", sql_code2));
-+  DBUG_RETURN(new_error);
-+}
- 
- /*
--  Parsing the string with error name and codes; returns the pointer to
-+  Parsing the string with padd syntax (name + error to pad); returns the pointer to
-   the errors struct
- */
- 
--static struct errors *parse_error_string(char *str, int er_count)
-+static struct errors *parse_padd_string(char* str, int er_count)
- {
--  struct errors *new_error;
-+  char *er_name;
-+  uint d_code;
-+  char *start;
-   DBUG_ENTER("parse_error_string");
-   DBUG_PRINT("enter", ("str: %s", str));
- 
--  /* create a new element */
--  new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME));
-+  start= str;
-+  str= skip_delimiters(str);
- 
--  if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0))
-+  /* getting the error name */
-+
-+  if (!(er_name= get_word(&str)))
-     DBUG_RETURN(0);				/* OOM: Fatal error */
- 
--  /* getting the error name */
-   str= skip_delimiters(str);
- 
--  if (!(new_error->er_name= get_word(&str)))
-+  if (!(d_code= parse_error_offset(start)))
-+  {
-+    fprintf(stderr, "Failed to parse the error padd string '%s' '%s' (d_code doesn't parse)!\n",er_name,str);
-+    DBUG_RETURN(0);
-+  }
-+  if (d_code < (uint) er_offset + er_count)
-+  {
-+    fprintf(stderr, "Error to padding less current error number!\n");
-+    DBUG_RETURN(0);
-+  }
-+  DBUG_RETURN(create_new_error(TRUE,er_name,d_code,empty_string,empty_string));
-+}
-+
-+/*
-+  Parsing the string with error name and codes; returns the pointer to
-+  the errors struct
-+*/
-+
-+static struct errors *parse_error_string(char *str, int er_count)
-+{
-+  char *er_name;
-+  int d_code;
-+  const char *sql_code1= empty_string;
-+  const char *sql_code2= empty_string;
-+  DBUG_ENTER("parse_error_string");
-+  DBUG_PRINT("enter", ("str: %s", str));
-+
-+  str= skip_delimiters(str);
-+
-+  /* getting the error name */
-+
-+  if (!(er_name= get_word(&str)))
-     DBUG_RETURN(0);				/* OOM: Fatal error */
--  DBUG_PRINT("info", ("er_name: %s", new_error->er_name));
- 
-   str= skip_delimiters(str);
- 
-   /* getting the code1 */
--
--  new_error->d_code= er_offset + er_count;
--  DBUG_PRINT("info", ("d_code: %d", new_error->d_code));
-+  d_code= er_offset + er_count;
- 
-   str= skip_delimiters(str);
- 
-   /* if we reached EOL => no more codes, but this can happen */
-   if (!*str)
-   {
--    new_error->sql_code1= empty_string;
--    new_error->sql_code2= empty_string;
-     DBUG_PRINT("info", ("str: %s", str));
--    DBUG_RETURN(new_error);
-+    goto complete_create;
-   }
--
-   /* getting the sql_code 1 */
--
--  if (!(new_error->sql_code1= get_word(&str)))
-+  if (!(sql_code1= get_word(&str)))
-     DBUG_RETURN(0);				/* OOM: Fatal error */
--  DBUG_PRINT("info", ("sql_code1: %s", new_error->sql_code1));
- 
-   str= skip_delimiters(str);
- 
-   /* if we reached EOL => no more codes, but this can happen */
-   if (!*str)
-   {
--    new_error->sql_code2= empty_string;
-     DBUG_PRINT("info", ("str: %s", str));
--    DBUG_RETURN(new_error);
-+    goto complete_create;
-   }
--
-   /* getting the sql_code 2 */
--  if (!(new_error->sql_code2= get_word(&str)))
-+  if (!(sql_code2= get_word(&str)))
-     DBUG_RETURN(0);				/* OOM: Fatal error */
--  DBUG_PRINT("info", ("sql_code2: %s", new_error->sql_code2));
- 
-   str= skip_delimiters(str);
-+
-   if (*str)
-   {
-     fprintf(stderr, "The error line did not end with sql/odbc code!");
-     DBUG_RETURN(0);
-   }
--
--  DBUG_RETURN(new_error);
-+complete_create:
-+  DBUG_RETURN(create_new_error(FALSE,er_name,d_code,sql_code1,sql_code2));
- }
- 
- 
diff --git a/mysql-fix-bug671764.patch b/mysql-fix-bug671764.patch
deleted file mode 100644
index bda76b2..0000000
--- a/mysql-fix-bug671764.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-# name       : fix-bug671764.patch
-# introduced : 12
-# maintainer : Alexander
-#
-#!!! notice !!!
-# Any small change to this file in the main branch
-# should be done or reviewed by the maintainer!
---- a/configure.in
-+++ b/configure.in
-@@ -2772,7 +2772,7 @@
-     MAN_DROP="$MAN_DROP embedded"
-     grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
-   fi
--  if test X"$with_plugin_innobase" != Xyes
-+  if test X"$with_plugin_innodb_plugin" != Xyes
-   then
-     MAN_DROP="$MAN_DROP innodb"
-     grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
-@@ -2851,7 +2851,7 @@
- fi
- 
- # "innochecksum" is not in the "innobase/" subdirectory, but should be switched
--AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innobase" = Xyes])
-+AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innodb_plugin" = Xyes])
<Skipped 47311 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/percona-server.git/commitdiff/bf636d07b36bfd2921b9ecf2033c78270355c98c



More information about the pld-cvs-commit mailing list