diff --git a/client/Makefile.am b/client/Makefile.am
index 940766ac66c9f37e8258f07924b72de74e3dc9b6..25b0c0cee007657cfe869ea9509398365b92f811 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -88,11 +88,12 @@ mysqlslap_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
 
 mysqltest_SOURCES=		mysqltest.c
 mysqltest_CFLAGS=		-DTHREAD -UUNDEF_THREADS_HACK
-mysqltest_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
+mysqltest_LDADD =		$(CXXLDFLAGS) \
 				@CLIENT_EXTRA_LDFLAGS@ \
 				$(LIBMYSQLCLIENT_LA) \
 				$(top_builddir)/mysys/libmysys.a \
-				$(top_builddir)/regex/libregex.a
+				$(top_builddir)/regex/libregex.a \
+				$(CLIENT_THREAD_LIBS)
 
 mysql_upgrade_SOURCES=          mysql_upgrade.c \
                                 $(top_srcdir)/mysys/my_getpagesize.c
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 6c5ca039a4171371c087e9f6a63cbcd2f0275825..4d2460dc4e708279ff9f9c3866f936a9ed4c21d2 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -269,6 +269,10 @@ get_one_option(int optid, const struct my_option *opt,
 }
 
 
+/**
+  Run a command using the shell, storing its output in the supplied dynamic
+  string.
+*/
 static int run_command(char* cmd,
                        DYNAMIC_STRING *ds_res)
 {
@@ -341,37 +345,15 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
 }
 
 
-/*
-  Try to get the full path to this exceutable
-
-  Return 0 if path found
-
-*/
-
-static my_bool get_full_path_to_executable(char* path)
-{
-  my_bool ret;
-  DBUG_ENTER("get_full_path_to_executable");
-#ifdef __WIN__
-  ret= (GetModuleFileName(NULL, path, FN_REFLEN) == 0);
-#else
-  /* my_readlink returns 0 if a symlink was read */
-  ret= (my_readlink(path, "/proc/self/exe", MYF(0)) != 0);
-  /* Might also want to try with /proc/$$/exe if the above fails */
-#endif
-  DBUG_PRINT("exit", ("path: %s", path));
-  DBUG_RETURN(ret);
-}
-
-
-/*
-  Look for the tool in the same directory as mysql_upgrade.
+/**
+  Look for the filename of given tool, with the presumption that it is in the
+  same directory as mysql_upgrade and that the same executable-searching 
+  mechanism will be used when we run our sub-shells with popen() later.
 */
-
-static void find_tool(char *tool_path, const char *tool_name)
+static void find_tool(char *tool_executable_name, const char *tool_name, 
+                      const char *self_name)
 {
-  size_t path_len;
-  char path[FN_REFLEN];
+  char *last_fn_libchar;
   DYNAMIC_STRING ds_tmp;
   DBUG_ENTER("find_tool");
   DBUG_PRINT("enter", ("progname: %s", my_progname));
@@ -379,77 +361,59 @@ static void find_tool(char *tool_path, const char *tool_name)
   if (init_dynamic_string(&ds_tmp, "", 32, 32))
     die("Out of memory");
 
-  /* Initialize path with the full path to this program */
-  if (get_full_path_to_executable(path))
+  last_fn_libchar= strrchr(self_name, FN_LIBCHAR);
+
+  if (last_fn_libchar == NULL)
   {
     /*
-      Easy way to get full executable path failed, try
-      other methods
+      mysql_upgrade was found by the shell searching the path.  A sibling
+      next to us should be found the same way.
     */
-    if (my_progname[0] == FN_LIBCHAR)
-    {
-      /* 1. my_progname contains full path */
-      strmake(path, my_progname, FN_REFLEN);
-    }
-    else if (my_progname[0] == '.')
-    {
-      /* 2. my_progname contains relative path, prepend wd */
-      char buf[FN_REFLEN];
-      my_getwd(buf, FN_REFLEN, MYF(0));
-      my_snprintf(path, FN_REFLEN, "%s%s", buf, my_progname);
-    }
-    else
-    {
-      /* 3. Just go for it and hope tool is in path */
-      path[0]= 0;
-    }
+    strncpy(tool_executable_name, tool_name, FN_REFLEN);
   }
-
-  DBUG_PRINT("info", ("path: '%s'", path));
-
-  /* Chop off binary name (i.e mysql-upgrade) from path */
-  dirname_part(path, path, &path_len);
-
-  /*
-    When running in a not yet installed build and using libtool,
-    the program(mysql_upgrade) will be in .libs/ and executed
-    through a libtool wrapper in order to use the dynamic libraries
-    from this build. The same must be done for the tools(mysql and
-    mysqlcheck). Thus if path ends in .libs/, step up one directory
-    and execute the tools from there
-  */
-  path[max(path_len-1, 0)]= 0;   /* Chop off last / */
-  if (strncmp(path + dirname_length(path), ".libs", 5) == 0)
+  else
   {
-    DBUG_PRINT("info", ("Chopping off .libs from '%s'", path));
-
-    /* Chop off .libs */
-    dirname_part(path, path, &path_len);
-  }
+    int len;
 
+    /*
+      mysql_upgrade was run absolutely or relatively.  We can find a sibling
+      by replacing our name after the LIBCHAR with the new tool name.
+    */
 
-  DBUG_PRINT("info", ("path: '%s'", path));
+    /*
+      When running in a not yet installed build and using libtool,
+      the program(mysql_upgrade) will be in .libs/ and executed
+      through a libtool wrapper in order to use the dynamic libraries
+      from this build. The same must be done for the tools(mysql and
+      mysqlcheck). Thus if path ends in .libs/, step up one directory
+      and execute the tools from there
+    */
+    if (((last_fn_libchar - 6) >= self_name) &&
+        (strncmp(last_fn_libchar - 5, ".libs", 5) == 0) &&
+        (*(last_fn_libchar - 6) == FN_LIBCHAR))
+    {
+      DBUG_PRINT("info", ("Chopping off \".libs\" from end of path"));
+      last_fn_libchar -= 6;
+    }
 
-  /* Format name of the tool to search for */
-  fn_format(tool_path, tool_name,
-            path, "", MYF(MY_REPLACE_DIR));
+    len= last_fn_libchar - self_name;
 
-  verbose("Looking for '%s' in: %s", tool_name, tool_path);
+    my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
+                len, self_name, FN_LIBCHAR, tool_name);
+  }
 
-  /* Make sure the tool exists */
-  if (my_access(tool_path, F_OK) != 0)
-    die("Can't find '%s'", tool_path);
+  verbose("Looking for '%s' as: %s", tool_name, tool_executable_name);
 
   /*
     Make sure it can be executed
   */
-  if (run_tool(tool_path,
+  if (run_tool(tool_executable_name,
                &ds_tmp, /* Get output from command, discard*/
                "--help",
                "2>&1",
                IF_WIN("> NUL", "> /dev/null"),
                NULL))
-    die("Can't execute '%s'", tool_path);
+    die("Can't execute '%s'", tool_executable_name);
 
   dynstr_free(&ds_tmp);
 
@@ -759,11 +723,20 @@ static const char *load_default_groups[]=
 
 int main(int argc, char **argv)
 {
+  char self_name[FN_REFLEN];
+
   MY_INIT(argv[0]);
 #ifdef __NETWARE__
   setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
 #endif
 
+#if __WIN__
+  if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
+#endif
+  {
+    strncpy(self_name, argv[0], FN_REFLEN);
+  }
+
   if (init_dynamic_string(&ds_args, "", 512, 256))
     die("Out of memory");
 
@@ -789,10 +762,10 @@ int main(int argc, char **argv)
   dynstr_append(&ds_args, " ");
 
   /* Find mysql */
-  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"));
+  find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
 
   /* Find mysqlcheck */
-  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"));
+  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
 
   /*
     Read the mysql_upgrade_info file to check if mysql_upgrade
diff --git a/config/ac-macros/character_sets.m4 b/config/ac-macros/character_sets.m4
index ea2763a1cd4dfb337027bfe0140e022b28740eb1..a9f7bd73858043bfa2dece8317f5f0985bdf4987 100644
--- a/config/ac-macros/character_sets.m4
+++ b/config/ac-macros/character_sets.m4
@@ -343,8 +343,8 @@ case $default_charset in
       default_charset_default_collation="ucs2_general_ci"
       define(UCSC1, ucs2_general_ci ucs2_bin)
       define(UCSC2, ucs2_czech_ci ucs2_danish_ci)
-      define(UCSC3, ucs2_esperanto_ci ucs2_estonian_ci ucs2_icelandic_ci)
-      define(UCSC4, ucs2_latvian_ci ucs2_lithuanian_ci)
+      define(UCSC3, ucs2_esperanto_ci ucs2_estonian_ci ucs2_hungarian_ci)
+      define(UCSC4, ucs2_icelandic_ci ucs2_latvian_ci ucs2_lithuanian_ci)
       define(UCSC5, ucs2_persian_ci ucs2_polish_ci ucs2_romanian_ci)
       define(UCSC6, ucs2_slovak_ci ucs2_slovenian_ci)
       define(UCSC7, ucs2_spanish2_ci ucs2_spanish_ci)
@@ -367,8 +367,8 @@ case $default_charset in
       else
         define(UTFC1, utf8_general_ci utf8_bin)
         define(UTFC2, utf8_czech_ci utf8_danish_ci)
-        define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_icelandic_ci)
-        define(UTFC4, utf8_latvian_ci utf8_lithuanian_ci)
+        define(UTFC3, utf8_esperanto_ci utf8_estonian_ci utf8_hungarian_ci)
+        define(UTFC4, utf8_icelandic_ci utf8_latvian_ci utf8_lithuanian_ci)
         define(UTFC5, utf8_persian_ci utf8_polish_ci utf8_romanian_ci)
         define(UTFC6, utf8_slovak_ci utf8_slovenian_ci)
         define(UTFC7, utf8_spanish2_ci utf8_spanish_ci)
diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test
index 91894e12726bb4d33724771e2795f24ba626c6ee..af7b72e4b34f47335482ce2a581fb63202f9646c 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -354,6 +354,7 @@ eval CREATE TABLE t7 (i INT NOT NULL,
 connection master;
 INSERT INTO t1 VALUES (1, "", 1);
 INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
+sync_slave_with_master;
 
 sync_slave_with_master;
 
@@ -365,6 +366,7 @@ source include/diff_tables.inc;
 connection master;
 INSERT INTO t2 VALUES (1, "", 1);
 INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
+sync_slave_with_master;
 
 sync_slave_with_master;
 
@@ -395,6 +397,7 @@ source include/wait_for_slave_to_start.inc;
 connection master;
 INSERT INTO t4 VALUES (1, "", 1);
 INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
+sync_slave_with_master;
 
 sync_slave_with_master;
 
@@ -444,6 +447,7 @@ source include/wait_for_slave_to_start.inc;
 connection master;
 INSERT INTO t7 VALUES (1, "", 1);
 INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
+sync_slave_with_master;
 
 sync_slave_with_master;
 
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index 42a2aa840eab397b31bd763a9544827afc4b9520..62d34c5ce8fe76a1a12770d6172616c491197727 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -131,3 +131,49 @@ drop table t1;
 select if(0, 18446744073709551610, 18446744073709551610);
 if(0, 18446744073709551610, 18446744073709551610)
 18446744073709551610
+CREATE TABLE t1(a DECIMAL(10,3));
+SELECT t1.a,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
+FROM t1;
+a	IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((ROUND(t1.a,2)=1), 2,
+IF((R
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/r/innodb-autoinc-optimize.result
new file mode 100644
index 0000000000000000000000000000000000000000..61739f0713ab8f0770460eca8b87c6de309f1bd7
--- /dev/null
+++ b/mysql-test/r/innodb-autoinc-optimize.result
@@ -0,0 +1,6 @@
+drop table if exists t1;
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+optimize table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	status	OK
diff --git a/mysql-test/r/innodb_bug35220.result b/mysql-test/r/innodb_bug35220.result
new file mode 100644
index 0000000000000000000000000000000000000000..195775f74c81a4a5a1d760b6fc7f814b96d13d18
--- /dev/null
+++ b/mysql-test/r/innodb_bug35220.result
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index da512cd0a4f4d551cf4ffe60148947d366df8504..1d4a05539d4fef4322b23c938a8077bb2f917321 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4398,4 +4398,15 @@ INSERT INTO t1 VALUES (1), (3);
 SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 a	b
 DROP TABLE t1,t2;
-End of 5.0 tests.
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk	a
+1	10
+3	30
+2	20
+DROP TABLE t1,t2;
+End of 5.1 tests.
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03.inc b/mysql-test/suite/funcs_1/triggers/triggers_03.inc
index f8a83315f0ccfd97372682e8018d648fa83b3d76..9ef6a9ac9af64af6c4efe6c1843ce8be933cda57 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc
@@ -13,12 +13,7 @@
 USE test;
 --source suite/funcs_1/include/tb3.inc
 
-# This test cannot be used for the embedded server because we check here
-# privilgeges.
---source include/not_embedded.inc
 
-USE test;
---source suite/funcs_1/include/tb3.inc
 
 --disable_abort_on_error
 
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
index 399b27508db894a53254a4af74647233a6b744a5..087f18e8e6b50503b017be3b17953f3ecff7aa0d 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc
@@ -8,8 +8,7 @@
 USE test;
 --source suite/funcs_1/include/tb3.inc
 
-USE test;
---source suite/funcs_1/include/tb3.inc
+
 
 # General setup for Trigger tests
 let $message= Testcase: 3.5:;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc
index 529eb6c77fd2d6342f4559843a7018ca9b0adb75..7230f240e2dddad1b04f7d74021ae78f806c6420 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc
@@ -13,13 +13,6 @@ eval
 load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt'
 into table tb3;
 
-USE test;
---source suite/funcs_1/include/tb3.inc
-
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
-eval
-load data infile '$MYSQLTEST_VARDIR/std_data_ln/funcs_1/memory_tb3.txt'
-into table tb3;
 
 --disable_abort_on_error
 
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
index 43a379dbe03b100fd9c01c5ea47e10f0ed489865..a8c83d58884678ae6c2411a11c6f186598a5c70f 100644
--- a/mysql-test/suite/rpl/t/disabled.def
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -13,3 +13,4 @@
 rpl_redirect               : Failure is sporadic and and the test is superfluous (mats)
 rpl_innodb_bug28430        : Failure on Solaris Bug #36793
 rpl_temporary              : BUG#38269 2008-07-21 Sven valgrind error in pushbuild
+rpl_flushlog_loop          : BUG#37733 2008-07-23 Sven disabled in 5.1-bugteam. the bug has been fixed in 5.1-rpl: please re-enable when that gets pushed to main
diff --git a/mysql-test/suite/sys_vars/README b/mysql-test/suite/sys_vars/README
new file mode 100644
index 0000000000000000000000000000000000000000..a84f00f1f6262e001e91a896fcedb9c3b06e2d17
--- /dev/null
+++ b/mysql-test/suite/sys_vars/README
@@ -0,0 +1,3 @@
+Some of these tests allocate more than 4GB RAM.
+So, assure that the machine on which the suite will be executed has more than 4GB RAM.
+
diff --git a/mysql-test/include/binlog_cache_size_basic.inc b/mysql-test/suite/sys_vars/inc/binlog_cache_size_basic.inc
similarity index 100%
rename from mysql-test/include/binlog_cache_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/binlog_cache_size_basic.inc
diff --git a/mysql-test/include/bulk_insert_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/bulk_insert_buffer_size_basic.inc
similarity index 100%
rename from mysql-test/include/bulk_insert_buffer_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/bulk_insert_buffer_size_basic.inc
diff --git a/mysql-test/include/delayed_insert_limit_basic.inc b/mysql-test/suite/sys_vars/inc/delayed_insert_limit_basic.inc
similarity index 100%
rename from mysql-test/include/delayed_insert_limit_basic.inc
rename to mysql-test/suite/sys_vars/inc/delayed_insert_limit_basic.inc
diff --git a/mysql-test/include/delayed_queue_size_basic.inc b/mysql-test/suite/sys_vars/inc/delayed_queue_size_basic.inc
similarity index 100%
rename from mysql-test/include/delayed_queue_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/delayed_queue_size_basic.inc
diff --git a/mysql-test/include/innodb_concurrency_tickets_basic.inc b/mysql-test/suite/sys_vars/inc/innodb_concurrency_tickets_basic.inc
similarity index 100%
rename from mysql-test/include/innodb_concurrency_tickets_basic.inc
rename to mysql-test/suite/sys_vars/inc/innodb_concurrency_tickets_basic.inc
diff --git a/mysql-test/include/innodb_max_purge_lag_basic.inc b/mysql-test/suite/sys_vars/inc/innodb_max_purge_lag_basic.inc
similarity index 100%
rename from mysql-test/include/innodb_max_purge_lag_basic.inc
rename to mysql-test/suite/sys_vars/inc/innodb_max_purge_lag_basic.inc
diff --git a/mysql-test/include/innodb_sync_spin_loops_basic.inc b/mysql-test/suite/sys_vars/inc/innodb_sync_spin_loops_basic.inc
similarity index 100%
rename from mysql-test/include/innodb_sync_spin_loops_basic.inc
rename to mysql-test/suite/sys_vars/inc/innodb_sync_spin_loops_basic.inc
diff --git a/mysql-test/include/join_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/join_buffer_size_basic.inc
similarity index 100%
rename from mysql-test/include/join_buffer_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/join_buffer_size_basic.inc
diff --git a/mysql-test/include/key_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc
similarity index 100%
rename from mysql-test/include/key_buffer_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc
diff --git a/mysql-test/include/key_cache_age_threshold_basic.inc b/mysql-test/suite/sys_vars/inc/key_cache_age_threshold_basic.inc
similarity index 100%
rename from mysql-test/include/key_cache_age_threshold_basic.inc
rename to mysql-test/suite/sys_vars/inc/key_cache_age_threshold_basic.inc
diff --git a/mysql-test/include/key_cache_block_size_basic.inc b/mysql-test/suite/sys_vars/inc/key_cache_block_size_basic.inc
similarity index 100%
rename from mysql-test/include/key_cache_block_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/key_cache_block_size_basic.inc
diff --git a/mysql-test/include/key_cache_division_limit_basic.inc b/mysql-test/suite/sys_vars/inc/key_cache_division_limit_basic.inc
similarity index 100%
rename from mysql-test/include/key_cache_division_limit_basic.inc
rename to mysql-test/suite/sys_vars/inc/key_cache_division_limit_basic.inc
diff --git a/mysql-test/include/log_warnings_basic.inc b/mysql-test/suite/sys_vars/inc/log_warnings_basic.inc
similarity index 100%
rename from mysql-test/include/log_warnings_basic.inc
rename to mysql-test/suite/sys_vars/inc/log_warnings_basic.inc
diff --git a/mysql-test/include/max_binlog_cache_size_basic.inc b/mysql-test/suite/sys_vars/inc/max_binlog_cache_size_basic.inc
similarity index 100%
rename from mysql-test/include/max_binlog_cache_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_binlog_cache_size_basic.inc
diff --git a/mysql-test/include/max_connect_errors_basic.inc b/mysql-test/suite/sys_vars/inc/max_connect_errors_basic.inc
similarity index 100%
rename from mysql-test/include/max_connect_errors_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_connect_errors_basic.inc
diff --git a/mysql-test/include/max_heap_table_size_basic.inc b/mysql-test/suite/sys_vars/inc/max_heap_table_size_basic.inc
similarity index 100%
rename from mysql-test/include/max_heap_table_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_heap_table_size_basic.inc
diff --git a/mysql-test/include/max_seeks_for_key_basic.inc b/mysql-test/suite/sys_vars/inc/max_seeks_for_key_basic.inc
similarity index 100%
rename from mysql-test/include/max_seeks_for_key_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_seeks_for_key_basic.inc
diff --git a/mysql-test/include/max_tmp_tables_basic.inc b/mysql-test/suite/sys_vars/inc/max_tmp_tables_basic.inc
similarity index 100%
rename from mysql-test/include/max_tmp_tables_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_tmp_tables_basic.inc
diff --git a/mysql-test/include/max_write_lock_count_basic.inc b/mysql-test/suite/sys_vars/inc/max_write_lock_count_basic.inc
similarity index 100%
rename from mysql-test/include/max_write_lock_count_basic.inc
rename to mysql-test/suite/sys_vars/inc/max_write_lock_count_basic.inc
diff --git a/mysql-test/include/min_examined_row_limit_basic.inc b/mysql-test/suite/sys_vars/inc/min_examined_row_limit_basic.inc
similarity index 100%
rename from mysql-test/include/min_examined_row_limit_basic.inc
rename to mysql-test/suite/sys_vars/inc/min_examined_row_limit_basic.inc
diff --git a/mysql-test/include/multi_range_count_basic.inc b/mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc
similarity index 100%
rename from mysql-test/include/multi_range_count_basic.inc
rename to mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc
diff --git a/mysql-test/include/myisam_max_sort_file_size_basic.inc b/mysql-test/suite/sys_vars/inc/myisam_max_sort_file_size_basic.inc
similarity index 100%
rename from mysql-test/include/myisam_max_sort_file_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/myisam_max_sort_file_size_basic.inc
diff --git a/mysql-test/include/myisam_repair_threads_basic.inc b/mysql-test/suite/sys_vars/inc/myisam_repair_threads_basic.inc
similarity index 100%
rename from mysql-test/include/myisam_repair_threads_basic.inc
rename to mysql-test/suite/sys_vars/inc/myisam_repair_threads_basic.inc
diff --git a/mysql-test/include/myisam_sort_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/myisam_sort_buffer_size_basic.inc
similarity index 100%
rename from mysql-test/include/myisam_sort_buffer_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/myisam_sort_buffer_size_basic.inc
diff --git a/mysql-test/include/net_retry_count_basic.inc b/mysql-test/suite/sys_vars/inc/net_retry_count_basic.inc
similarity index 100%
rename from mysql-test/include/net_retry_count_basic.inc
rename to mysql-test/suite/sys_vars/inc/net_retry_count_basic.inc
diff --git a/mysql-test/include/query_alloc_block_size_basic.inc b/mysql-test/suite/sys_vars/inc/query_alloc_block_size_basic.inc
similarity index 100%
rename from mysql-test/include/query_alloc_block_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/query_alloc_block_size_basic.inc
diff --git a/mysql-test/include/query_cache_limit_basic.inc b/mysql-test/suite/sys_vars/inc/query_cache_limit_basic.inc
similarity index 100%
rename from mysql-test/include/query_cache_limit_basic.inc
rename to mysql-test/suite/sys_vars/inc/query_cache_limit_basic.inc
diff --git a/mysql-test/include/query_cache_min_res_unit_basic.inc b/mysql-test/suite/sys_vars/inc/query_cache_min_res_unit_basic.inc
similarity index 100%
rename from mysql-test/include/query_cache_min_res_unit_basic.inc
rename to mysql-test/suite/sys_vars/inc/query_cache_min_res_unit_basic.inc
diff --git a/mysql-test/include/query_cache_size_basic.inc b/mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc
similarity index 100%
rename from mysql-test/include/query_cache_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/query_cache_size_basic.inc
diff --git a/mysql-test/include/query_prealloc_size_basic.inc b/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc
similarity index 92%
rename from mysql-test/include/query_prealloc_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc
index ac005b696fa68518c73e8547e6ace22e16b2fbf9..3a8608736c514a7d1b99016325543425bf90f307 100644
--- a/mysql-test/include/query_prealloc_size_basic.inc
+++ b/mysql-test/suite/sys_vars/inc/query_prealloc_size_basic.inc
@@ -21,9 +21,6 @@
 # Reference:                                                                   #
 #      http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html     #
 #                                                                              #
-# Last Modification:                                                           #
-# 2008-07-14 hhunger removed values for 64 bit platforms.                      #
-#                                                                              #
 ################################################################################
 
 --source include/load_sysvars.inc
@@ -77,9 +74,8 @@ SELECT @@session.query_prealloc_size   = 8192;
 SET @@global.query_prealloc_size   = 8192;
 SELECT @@global.query_prealloc_size  ;
 
-# Due to problems with 64 bit machines having less than 6 GB main memory.
-#SET @@global.query_prealloc_size   = 4294967295;
-#SELECT @@global.query_prealloc_size  ;
+SET @@global.query_prealloc_size   = 4294967295;
+SELECT @@global.query_prealloc_size  ;
 
 SET @@global.query_prealloc_size   = 655354;
 SELECT @@global.query_prealloc_size  ;
@@ -93,9 +89,8 @@ SELECT @@global.query_prealloc_size  ;
 SET @@session.query_prealloc_size   = 8192;
 SELECT @@session.query_prealloc_size  ;
 
-# Due to problems with 64 bit machines having less than 6 GB main memory.
-#SET @@session.query_prealloc_size   = 4294967295;
-#SELECT @@session.query_prealloc_size  ;
+SET @@session.query_prealloc_size   = 4294967295;
+SELECT @@session.query_prealloc_size  ;
 
 SET @@session.query_prealloc_size   = 655345;
 SELECT @@session.query_prealloc_size  ;
@@ -114,9 +109,8 @@ SELECT @@global.query_prealloc_size  ;
 SET @@global.query_prealloc_size   = -1024;
 SELECT @@global.query_prealloc_size  ;
 
-# Due to problems with 64 bit machines having less than 6 GB main memory.
-#SET @@global.query_prealloc_size   = 429496729533;
-#SELECT @@global.query_prealloc_size  ;
+SET @@global.query_prealloc_size   = 429496729533;
+SELECT @@global.query_prealloc_size  ;
 
 
 --Error ER_PARSE_ERROR
diff --git a/mysql-test/include/range_alloc_block_size_basic.inc b/mysql-test/suite/sys_vars/inc/range_alloc_block_size_basic.inc
similarity index 100%
rename from mysql-test/include/range_alloc_block_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/range_alloc_block_size_basic.inc
diff --git a/mysql-test/include/rpl_recovery_rank_basic.inc b/mysql-test/suite/sys_vars/inc/rpl_recovery_rank_basic.inc
similarity index 100%
rename from mysql-test/include/rpl_recovery_rank_basic.inc
rename to mysql-test/suite/sys_vars/inc/rpl_recovery_rank_basic.inc
diff --git a/mysql-test/include/server_id_basic.inc b/mysql-test/suite/sys_vars/inc/server_id_basic.inc
similarity index 100%
rename from mysql-test/include/server_id_basic.inc
rename to mysql-test/suite/sys_vars/inc/server_id_basic.inc
diff --git a/mysql-test/include/slave_transaction_retries_basic.inc b/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc
similarity index 100%
rename from mysql-test/include/slave_transaction_retries_basic.inc
rename to mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc
diff --git a/mysql-test/include/sort_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc
similarity index 100%
rename from mysql-test/include/sort_buffer_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc
diff --git a/mysql-test/include/sync_binlog_basic.inc b/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc
similarity index 100%
rename from mysql-test/include/sync_binlog_basic.inc
rename to mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc
diff --git a/mysql-test/include/timestamp_basic.inc b/mysql-test/suite/sys_vars/inc/timestamp_basic.inc
similarity index 100%
rename from mysql-test/include/timestamp_basic.inc
rename to mysql-test/suite/sys_vars/inc/timestamp_basic.inc
diff --git a/mysql-test/include/tmp_table_size_basic.inc b/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc
similarity index 100%
rename from mysql-test/include/tmp_table_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc
diff --git a/mysql-test/include/transaction_alloc_block_size_basic.inc b/mysql-test/suite/sys_vars/inc/transaction_alloc_block_size_basic.inc
similarity index 100%
rename from mysql-test/include/transaction_alloc_block_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/transaction_alloc_block_size_basic.inc
diff --git a/mysql-test/include/transaction_prealloc_size_basic.inc b/mysql-test/suite/sys_vars/inc/transaction_prealloc_size_basic.inc
similarity index 100%
rename from mysql-test/include/transaction_prealloc_size_basic.inc
rename to mysql-test/suite/sys_vars/inc/transaction_prealloc_size_basic.inc
diff --git a/mysql-test/include/wait_timeout_basic.inc b/mysql-test/suite/sys_vars/inc/wait_timeout_basic.inc
similarity index 100%
rename from mysql-test/include/wait_timeout_basic.inc
rename to mysql-test/suite/sys_vars/inc/wait_timeout_basic.inc
diff --git a/mysql-test/r/binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result
similarity index 100%
rename from mysql-test/r/binlog_cache_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result
diff --git a/mysql-test/r/binlog_cache_size_basic_64.result b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_64.result
similarity index 100%
rename from mysql-test/r/binlog_cache_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/binlog_cache_size_basic_64.result
diff --git a/mysql-test/r/bulk_insert_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result
similarity index 100%
rename from mysql-test/r/bulk_insert_buffer_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result
diff --git a/mysql-test/r/bulk_insert_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_64.result
similarity index 100%
rename from mysql-test/r/bulk_insert_buffer_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_64.result
diff --git a/mysql-test/r/delayed_insert_limit_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result
similarity index 100%
rename from mysql-test/r/delayed_insert_limit_basic_32.result
rename to mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result
diff --git a/mysql-test/r/delayed_insert_limit_basic_64.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_64.result
similarity index 100%
rename from mysql-test/r/delayed_insert_limit_basic_64.result
rename to mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_64.result
diff --git a/mysql-test/r/delayed_queue_size_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result
similarity index 100%
rename from mysql-test/r/delayed_queue_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result
diff --git a/mysql-test/r/delayed_queue_size_basic_64.result b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_64.result
similarity index 100%
rename from mysql-test/r/delayed_queue_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/delayed_queue_size_basic_64.result
diff --git a/mysql-test/r/innodb_concurrency_tickets_basic_32.result b/mysql-test/suite/sys_vars/r/innodb_concurrency_tickets_basic_32.result
similarity index 100%
rename from mysql-test/r/innodb_concurrency_tickets_basic_32.result
rename to mysql-test/suite/sys_vars/r/innodb_concurrency_tickets_basic_32.result
diff --git a/mysql-test/r/innodb_concurrency_tickets_basic_64.result b/mysql-test/suite/sys_vars/r/innodb_concurrency_tickets_basic_64.result
similarity index 100%
rename from mysql-test/r/innodb_concurrency_tickets_basic_64.result
rename to mysql-test/suite/sys_vars/r/innodb_concurrency_tickets_basic_64.result
diff --git a/mysql-test/r/innodb_max_purge_lag_basic_32.result b/mysql-test/suite/sys_vars/r/innodb_max_purge_lag_basic_32.result
similarity index 100%
rename from mysql-test/r/innodb_max_purge_lag_basic_32.result
rename to mysql-test/suite/sys_vars/r/innodb_max_purge_lag_basic_32.result
diff --git a/mysql-test/r/innodb_max_purge_lag_basic_64.result b/mysql-test/suite/sys_vars/r/innodb_max_purge_lag_basic_64.result
similarity index 100%
rename from mysql-test/r/innodb_max_purge_lag_basic_64.result
rename to mysql-test/suite/sys_vars/r/innodb_max_purge_lag_basic_64.result
diff --git a/mysql-test/r/innodb_sync_spin_loops_basic_32.result b/mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_32.result
similarity index 100%
rename from mysql-test/r/innodb_sync_spin_loops_basic_32.result
rename to mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_32.result
diff --git a/mysql-test/r/innodb_sync_spin_loops_basic_64.result b/mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_64.result
similarity index 100%
rename from mysql-test/r/innodb_sync_spin_loops_basic_64.result
rename to mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_64.result
diff --git a/mysql-test/r/join_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result
similarity index 100%
rename from mysql-test/r/join_buffer_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result
diff --git a/mysql-test/r/join_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_64.result
similarity index 100%
rename from mysql-test/r/join_buffer_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/join_buffer_size_basic_64.result
diff --git a/mysql-test/r/key_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result
similarity index 100%
rename from mysql-test/r/key_buffer_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result
diff --git a/mysql-test/r/key_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result
similarity index 100%
rename from mysql-test/r/key_buffer_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result
diff --git a/mysql-test/r/key_cache_age_threshold_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result
similarity index 100%
rename from mysql-test/r/key_cache_age_threshold_basic_32.result
rename to mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result
diff --git a/mysql-test/r/key_cache_age_threshold_basic_64.result b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_64.result
similarity index 100%
rename from mysql-test/r/key_cache_age_threshold_basic_64.result
rename to mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_64.result
diff --git a/mysql-test/r/key_cache_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result
similarity index 100%
rename from mysql-test/r/key_cache_block_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result
diff --git a/mysql-test/r/key_cache_block_size_basic_64.result b/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_64.result
similarity index 100%
rename from mysql-test/r/key_cache_block_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/key_cache_block_size_basic_64.result
diff --git a/mysql-test/r/key_cache_division_limit_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result
similarity index 100%
rename from mysql-test/r/key_cache_division_limit_basic_32.result
rename to mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result
diff --git a/mysql-test/r/key_cache_division_limit_basic_64.result b/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_64.result
similarity index 100%
rename from mysql-test/r/key_cache_division_limit_basic_64.result
rename to mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_64.result
diff --git a/mysql-test/r/log_warnings_basic_32.result b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result
similarity index 100%
rename from mysql-test/r/log_warnings_basic_32.result
rename to mysql-test/suite/sys_vars/r/log_warnings_basic_32.result
diff --git a/mysql-test/r/log_warnings_basic_64.result b/mysql-test/suite/sys_vars/r/log_warnings_basic_64.result
similarity index 100%
rename from mysql-test/r/log_warnings_basic_64.result
rename to mysql-test/suite/sys_vars/r/log_warnings_basic_64.result
diff --git a/mysql-test/r/max_binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result
similarity index 100%
rename from mysql-test/r/max_binlog_cache_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result
diff --git a/mysql-test/r/max_binlog_cache_size_basic_64.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_64.result
similarity index 100%
rename from mysql-test/r/max_binlog_cache_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_64.result
diff --git a/mysql-test/r/max_connect_errors_basic_32.result b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result
similarity index 100%
rename from mysql-test/r/max_connect_errors_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result
diff --git a/mysql-test/r/max_connect_errors_basic_64.result b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_64.result
similarity index 100%
rename from mysql-test/r/max_connect_errors_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_connect_errors_basic_64.result
diff --git a/mysql-test/r/max_heap_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result
similarity index 100%
rename from mysql-test/r/max_heap_table_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result
diff --git a/mysql-test/r/max_heap_table_size_basic_64.result b/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_64.result
similarity index 100%
rename from mysql-test/r/max_heap_table_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_heap_table_size_basic_64.result
diff --git a/mysql-test/r/max_seeks_for_key_basic_32.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result
similarity index 100%
rename from mysql-test/r/max_seeks_for_key_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result
diff --git a/mysql-test/r/max_seeks_for_key_basic_64.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_64.result
similarity index 100%
rename from mysql-test/r/max_seeks_for_key_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_64.result
diff --git a/mysql-test/r/max_tmp_tables_basic_32.result b/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result
similarity index 100%
rename from mysql-test/r/max_tmp_tables_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result
diff --git a/mysql-test/r/max_tmp_tables_basic_64.result b/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_64.result
similarity index 100%
rename from mysql-test/r/max_tmp_tables_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_tmp_tables_basic_64.result
diff --git a/mysql-test/r/max_write_lock_count_basic_32.result b/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result
similarity index 100%
rename from mysql-test/r/max_write_lock_count_basic_32.result
rename to mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result
diff --git a/mysql-test/r/max_write_lock_count_basic_64.result b/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_64.result
similarity index 100%
rename from mysql-test/r/max_write_lock_count_basic_64.result
rename to mysql-test/suite/sys_vars/r/max_write_lock_count_basic_64.result
diff --git a/mysql-test/r/min_examined_row_limit_basic_32.result b/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result
similarity index 100%
rename from mysql-test/r/min_examined_row_limit_basic_32.result
rename to mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result
diff --git a/mysql-test/r/min_examined_row_limit_basic_64.result b/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_64.result
similarity index 100%
rename from mysql-test/r/min_examined_row_limit_basic_64.result
rename to mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_64.result
diff --git a/mysql-test/r/multi_range_count_basic_32.result b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
similarity index 100%
rename from mysql-test/r/multi_range_count_basic_32.result
rename to mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
diff --git a/mysql-test/r/multi_range_count_basic_64.result b/mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result
similarity index 100%
rename from mysql-test/r/multi_range_count_basic_64.result
rename to mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result
diff --git a/mysql-test/r/myisam_max_sort_file_size_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result
similarity index 100%
rename from mysql-test/r/myisam_max_sort_file_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result
diff --git a/mysql-test/r/myisam_max_sort_file_size_basic_64.result b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_64.result
similarity index 100%
rename from mysql-test/r/myisam_max_sort_file_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_64.result
diff --git a/mysql-test/r/myisam_repair_threads_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result
similarity index 100%
rename from mysql-test/r/myisam_repair_threads_basic_32.result
rename to mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result
diff --git a/mysql-test/r/myisam_repair_threads_basic_64.result b/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_64.result
similarity index 100%
rename from mysql-test/r/myisam_repair_threads_basic_64.result
rename to mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_64.result
diff --git a/mysql-test/r/myisam_sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result
similarity index 100%
rename from mysql-test/r/myisam_sort_buffer_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result
diff --git a/mysql-test/r/myisam_sort_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_64.result
similarity index 100%
rename from mysql-test/r/myisam_sort_buffer_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_64.result
diff --git a/mysql-test/r/net_retry_count_basic_32.result b/mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result
similarity index 100%
rename from mysql-test/r/net_retry_count_basic_32.result
rename to mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result
diff --git a/mysql-test/r/net_retry_count_basic_64.result b/mysql-test/suite/sys_vars/r/net_retry_count_basic_64.result
similarity index 100%
rename from mysql-test/r/net_retry_count_basic_64.result
rename to mysql-test/suite/sys_vars/r/net_retry_count_basic_64.result
diff --git a/mysql-test/r/query_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result
similarity index 100%
rename from mysql-test/r/query_alloc_block_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result
diff --git a/mysql-test/r/query_alloc_block_size_basic_64.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_64.result
similarity index 100%
rename from mysql-test/r/query_alloc_block_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_64.result
diff --git a/mysql-test/r/query_cache_limit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result
similarity index 100%
rename from mysql-test/r/query_cache_limit_basic_32.result
rename to mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result
diff --git a/mysql-test/r/query_cache_limit_basic_64.result b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_64.result
similarity index 100%
rename from mysql-test/r/query_cache_limit_basic_64.result
rename to mysql-test/suite/sys_vars/r/query_cache_limit_basic_64.result
diff --git a/mysql-test/r/query_cache_min_res_unit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result
similarity index 100%
rename from mysql-test/r/query_cache_min_res_unit_basic_32.result
rename to mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result
diff --git a/mysql-test/r/query_cache_min_res_unit_basic_64.result b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_64.result
similarity index 100%
rename from mysql-test/r/query_cache_min_res_unit_basic_64.result
rename to mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_64.result
diff --git a/mysql-test/r/query_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
similarity index 100%
rename from mysql-test/r/query_cache_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result
diff --git a/mysql-test/r/query_cache_size_basic_64.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result
similarity index 100%
rename from mysql-test/r/query_cache_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/query_cache_size_basic_64.result
diff --git a/mysql-test/r/query_prealloc_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result
similarity index 92%
rename from mysql-test/r/query_prealloc_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result
index fe8aba990a770230524468d4917ea73234d5525f..cd5f1727d414c9cbadbb6dd1e0fbd4c6b325957d 100644
--- a/mysql-test/r/query_prealloc_size_basic_32.result
+++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_32.result
@@ -35,6 +35,10 @@ SET @@global.query_prealloc_size   = 8192;
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
 8192
+SET @@global.query_prealloc_size   = 4294967295;
+SELECT @@global.query_prealloc_size  ;
+@@global.query_prealloc_size
+4294966272
 SET @@global.query_prealloc_size   = 655354;
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
@@ -44,6 +48,10 @@ SET @@session.query_prealloc_size   = 8192;
 SELECT @@session.query_prealloc_size  ;
 @@session.query_prealloc_size
 8192
+SET @@session.query_prealloc_size   = 4294967295;
+SELECT @@session.query_prealloc_size  ;
+@@session.query_prealloc_size
+4294966272
 SET @@session.query_prealloc_size   = 655345;
 SELECT @@session.query_prealloc_size  ;
 @@session.query_prealloc_size
@@ -61,31 +69,37 @@ Warning	1292	Truncated incorrect query_prealloc_size value: '0'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
 8192
+SET @@global.query_prealloc_size   = 429496729533;
+Warnings:
+Warning	1292	Truncated incorrect query_prealloc_size value: '429496729533'
+SELECT @@global.query_prealloc_size  ;
+@@global.query_prealloc_size
+4294966272
 SET @@global.query_prealloc_size   = 65530.34.;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+4294966272
 SET @@global.query_prealloc_size   = test;
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+4294966272
 SET @@global.query_prealloc_size   = "test";
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+4294966272
 SET @@global.query_prealloc_size   = 'test';
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+4294966272
 SET @@global.query_prealloc_size   = ON;
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+4294966272
 SET @@session.query_prealloc_size   = 0;
 Warnings:
 Warning	1292	Truncated incorrect query_prealloc_size value: '0'
diff --git a/mysql-test/r/query_prealloc_size_basic_64.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_64.result
similarity index 93%
rename from mysql-test/r/query_prealloc_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/query_prealloc_size_basic_64.result
index fe8aba990a770230524468d4917ea73234d5525f..0e61fbcd4b51cfab641a244a2c107c4ea2a14988 100644
--- a/mysql-test/r/query_prealloc_size_basic_64.result
+++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic_64.result
@@ -35,6 +35,10 @@ SET @@global.query_prealloc_size   = 8192;
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
 8192
+SET @@global.query_prealloc_size   = 4294967295;
+SELECT @@global.query_prealloc_size  ;
+@@global.query_prealloc_size
+4294966272
 SET @@global.query_prealloc_size   = 655354;
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
@@ -44,6 +48,10 @@ SET @@session.query_prealloc_size   = 8192;
 SELECT @@session.query_prealloc_size  ;
 @@session.query_prealloc_size
 8192
+SET @@session.query_prealloc_size   = 4294967295;
+SELECT @@session.query_prealloc_size  ;
+@@session.query_prealloc_size
+4294966272
 SET @@session.query_prealloc_size   = 655345;
 SELECT @@session.query_prealloc_size  ;
 @@session.query_prealloc_size
@@ -61,31 +69,35 @@ Warning	1292	Truncated incorrect query_prealloc_size value: '0'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
 8192
+SET @@global.query_prealloc_size   = 429496729533;
+SELECT @@global.query_prealloc_size  ;
+@@global.query_prealloc_size
+429496728576
 SET @@global.query_prealloc_size   = 65530.34.;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+429496728576
 SET @@global.query_prealloc_size   = test;
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+429496728576
 SET @@global.query_prealloc_size   = "test";
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+429496728576
 SET @@global.query_prealloc_size   = 'test';
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+429496728576
 SET @@global.query_prealloc_size   = ON;
 ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
 SELECT @@global.query_prealloc_size  ;
 @@global.query_prealloc_size
-8192
+429496728576
 SET @@session.query_prealloc_size   = 0;
 Warnings:
 Warning	1292	Truncated incorrect query_prealloc_size value: '0'
diff --git a/mysql-test/r/range_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result
similarity index 100%
rename from mysql-test/r/range_alloc_block_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result
diff --git a/mysql-test/r/range_alloc_block_size_basic_64.result b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_64.result
similarity index 100%
rename from mysql-test/r/range_alloc_block_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_64.result
diff --git a/mysql-test/r/rpl_recovery_rank_basic_32.result b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result
similarity index 100%
rename from mysql-test/r/rpl_recovery_rank_basic_32.result
rename to mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result
diff --git a/mysql-test/r/rpl_recovery_rank_basic_64.result b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_64.result
similarity index 92%
rename from mysql-test/r/rpl_recovery_rank_basic_64.result
rename to mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_64.result
index d4dd46eba719352a18c0a7efb5366fb94b22391f..74a47fa0f08c746ec2d0c01b91a2947971c30691 100644
--- a/mysql-test/r/rpl_recovery_rank_basic_64.result
+++ b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_64.result
@@ -22,26 +22,20 @@ SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
 123456789
 SET @@global.rpl_recovery_rank = 2147483648*2;
-Warnings:
-Warning	1292	Truncated incorrect rpl-recovery-rank value: '4294967296'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
-4294967295
+4294967296
 SET @@global.rpl_recovery_rank = 2147483648*1024;
-Warnings:
-Warning	1292	Truncated incorrect rpl-recovery-rank value: '2199023255552'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
-4294967295
+2199023255552
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
-4294967295
+2199023255552
 SET @@global.rpl_recovery_rank = 2147483648*2147483648;
-Warnings:
-Warning	1292	Truncated incorrect rpl-recovery-rank value: '4611686018427387904'
 SELECT @@global.rpl_recovery_rank;
 @@global.rpl_recovery_rank
-4294967295
+4611686018427387904
 '#--------------------FN_DYNVARS_142_03-------------------------#'
 SET @@rpl_recovery_rank = 2;
 ERROR HY000: Variable 'rpl_recovery_rank' is a GLOBAL variable and should be set with SET GLOBAL
diff --git a/mysql-test/r/server_id_basic_32.result b/mysql-test/suite/sys_vars/r/server_id_basic_32.result
similarity index 100%
rename from mysql-test/r/server_id_basic_32.result
rename to mysql-test/suite/sys_vars/r/server_id_basic_32.result
diff --git a/mysql-test/r/server_id_basic_64.result b/mysql-test/suite/sys_vars/r/server_id_basic_64.result
similarity index 100%
rename from mysql-test/r/server_id_basic_64.result
rename to mysql-test/suite/sys_vars/r/server_id_basic_64.result
diff --git a/mysql-test/r/slave_transaction_retries_basic_32.result b/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result
similarity index 100%
rename from mysql-test/r/slave_transaction_retries_basic_32.result
rename to mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result
diff --git a/mysql-test/r/slave_transaction_retries_basic_64.result b/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_64.result
similarity index 100%
rename from mysql-test/r/slave_transaction_retries_basic_64.result
rename to mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_64.result
diff --git a/mysql-test/r/sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
similarity index 100%
rename from mysql-test/r/sort_buffer_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result
diff --git a/mysql-test/r/sort_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result
similarity index 100%
rename from mysql-test/r/sort_buffer_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result
diff --git a/mysql-test/r/sync_binlog_basic_32.result b/mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result
similarity index 100%
rename from mysql-test/r/sync_binlog_basic_32.result
rename to mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result
diff --git a/mysql-test/r/sync_binlog_basic_64.result b/mysql-test/suite/sys_vars/r/sync_binlog_basic_64.result
similarity index 100%
rename from mysql-test/r/sync_binlog_basic_64.result
rename to mysql-test/suite/sys_vars/r/sync_binlog_basic_64.result
diff --git a/mysql-test/r/timestamp_basic_32.result b/mysql-test/suite/sys_vars/r/timestamp_basic_32.result
similarity index 100%
rename from mysql-test/r/timestamp_basic_32.result
rename to mysql-test/suite/sys_vars/r/timestamp_basic_32.result
diff --git a/mysql-test/r/timestamp_basic_64.result b/mysql-test/suite/sys_vars/r/timestamp_basic_64.result
similarity index 100%
rename from mysql-test/r/timestamp_basic_64.result
rename to mysql-test/suite/sys_vars/r/timestamp_basic_64.result
diff --git a/mysql-test/r/tmp_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result
similarity index 100%
rename from mysql-test/r/tmp_table_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result
diff --git a/mysql-test/r/tmp_table_size_basic_64.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result
similarity index 100%
rename from mysql-test/r/tmp_table_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result
diff --git a/mysql-test/r/transaction_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result
similarity index 100%
rename from mysql-test/r/transaction_alloc_block_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result
diff --git a/mysql-test/r/transaction_alloc_block_size_basic_64.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_64.result
similarity index 100%
rename from mysql-test/r/transaction_alloc_block_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_64.result
diff --git a/mysql-test/r/transaction_prealloc_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result
similarity index 100%
rename from mysql-test/r/transaction_prealloc_size_basic_32.result
rename to mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result
diff --git a/mysql-test/r/transaction_prealloc_size_basic_64.result b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_64.result
similarity index 100%
rename from mysql-test/r/transaction_prealloc_size_basic_64.result
rename to mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_64.result
diff --git a/mysql-test/r/wait_timeout_basic_32.result b/mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result
similarity index 100%
rename from mysql-test/r/wait_timeout_basic_32.result
rename to mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result
diff --git a/mysql-test/r/wait_timeout_basic_64.result b/mysql-test/suite/sys_vars/r/wait_timeout_basic_64.result
similarity index 100%
rename from mysql-test/r/wait_timeout_basic_64.result
rename to mysql-test/suite/sys_vars/r/wait_timeout_basic_64.result
diff --git a/mysql-test/t/binlog_cache_size_basic_32.test b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic_32.test
similarity index 88%
rename from mysql-test/t/binlog_cache_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/binlog_cache_size_basic_32.test
index a809c00f9874ca42ea7bdf5b56b96e88473bf11b..1c6d805683fe37a38590afac789c3b69bca5354d 100644
--- a/mysql-test/t/binlog_cache_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/binlog_cache_size_basic.inc
+--source suite/sys_vars/inc/binlog_cache_size_basic.inc
 
diff --git a/mysql-test/t/binlog_cache_size_basic_64.test b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic_64.test
similarity index 88%
rename from mysql-test/t/binlog_cache_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/binlog_cache_size_basic_64.test
index f4fdf8c2129af536a8532c5e12b88cc007eeb8ef..1074bb4606998810130ac98b56eeaf22bb09548a 100644
--- a/mysql-test/t/binlog_cache_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/binlog_cache_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/binlog_cache_size_basic.inc
+--source suite/sys_vars/inc/binlog_cache_size_basic.inc
 
diff --git a/mysql-test/t/bulk_insert_buffer_size_basic_32.test b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_32.test
similarity index 87%
rename from mysql-test/t/bulk_insert_buffer_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_32.test
index 76a418323bcaf39d6a61df3a8d01584d13989a3a..84a90d42bec7b462a6ffea108b01a4e281fed1d7 100644
--- a/mysql-test/t/bulk_insert_buffer_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/bulk_insert_buffer_size_basic.inc
+--source suite/sys_vars/inc/bulk_insert_buffer_size_basic.inc
 
diff --git a/mysql-test/t/bulk_insert_buffer_size_basic_64.test b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_64.test
similarity index 87%
rename from mysql-test/t/bulk_insert_buffer_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_64.test
index 6363cfc12d194027a10c8a81739b2007d32bb2f6..4727daf0b4ba7ca3a5a9414b3e6a9cff1a2752f1 100644
--- a/mysql-test/t/bulk_insert_buffer_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/bulk_insert_buffer_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/bulk_insert_buffer_size_basic.inc
+--source suite/sys_vars/inc/bulk_insert_buffer_size_basic.inc
 
diff --git a/mysql-test/t/delayed_insert_limit_basic_32.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_32.test
similarity index 88%
rename from mysql-test/t/delayed_insert_limit_basic_32.test
rename to mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_32.test
index d7a4a81542f24aba84ae065fa55df1bc8a6e93a3..7cbce057bec87ebc65f94afb3ca3a4a324cf45eb 100644
--- a/mysql-test/t/delayed_insert_limit_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/delayed_insert_limit_basic.inc
+--source suite/sys_vars/inc/delayed_insert_limit_basic.inc
 
diff --git a/mysql-test/t/delayed_insert_limit_basic_64.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_64.test
similarity index 88%
rename from mysql-test/t/delayed_insert_limit_basic_64.test
rename to mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_64.test
index c1d628bbb347dd5a4c4a3cc8528fddeb7561d0e1..fbc31e937fe4ad358f7dbada5e98eb369154263f 100644
--- a/mysql-test/t/delayed_insert_limit_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/delayed_insert_limit_basic.inc
+--source suite/sys_vars/inc/delayed_insert_limit_basic.inc
 
diff --git a/mysql-test/t/delayed_queue_size_basic_32.test b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic_32.test
similarity index 88%
rename from mysql-test/t/delayed_queue_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/delayed_queue_size_basic_32.test
index 06e0cf48dac35e4b09e5aa278c384feaa477d739..1e67d426f10eecebc736d604f1a9570ed0ba80bc 100644
--- a/mysql-test/t/delayed_queue_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/delayed_queue_size_basic.inc
+--source suite/sys_vars/inc/delayed_queue_size_basic.inc
 
diff --git a/mysql-test/t/delayed_queue_size_basic_64.test b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic_64.test
similarity index 88%
rename from mysql-test/t/delayed_queue_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/delayed_queue_size_basic_64.test
index a9a929ae07b02c4cac59175f7e0ecf0973e0c853..44d5839759c94413c03bbe08795040f76a308fcf 100644
--- a/mysql-test/t/delayed_queue_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/delayed_queue_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/delayed_queue_size_basic.inc
+--source suite/sys_vars/inc/delayed_queue_size_basic.inc
 
diff --git a/mysql-test/t/innodb_concurrency_tickets_basic_32.test b/mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_32.test
similarity index 87%
rename from mysql-test/t/innodb_concurrency_tickets_basic_32.test
rename to mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_32.test
index e587d1870bf7a9c9ee97144751195181ba9eb67c..13e1b205a4d328f3a925cf762019439fa98b2d3f 100644
--- a/mysql-test/t/innodb_concurrency_tickets_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/innodb_concurrency_tickets_basic.inc
+--source suite/sys_vars/inc/innodb_concurrency_tickets_basic.inc
 
diff --git a/mysql-test/t/innodb_concurrency_tickets_basic_64.test b/mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_64.test
similarity index 87%
rename from mysql-test/t/innodb_concurrency_tickets_basic_64.test
rename to mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_64.test
index bec46df3d9a8b135496aa60a2a0b07dc8ada6a67..fc26c903de5d476e05e05c0bb7c303020f4d5edd 100644
--- a/mysql-test/t/innodb_concurrency_tickets_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/innodb_concurrency_tickets_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/innodb_concurrency_tickets_basic.inc
+--source suite/sys_vars/inc/innodb_concurrency_tickets_basic.inc
 
diff --git a/mysql-test/t/innodb_max_purge_lag_basic_32.test b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_32.test
similarity index 88%
rename from mysql-test/t/innodb_max_purge_lag_basic_32.test
rename to mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_32.test
index 4e5b019b1519a85e6244f20f2e3fd719216e6190..8396755844e17c2c12218c9b3089c1f5115f4548 100644
--- a/mysql-test/t/innodb_max_purge_lag_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/innodb_max_purge_lag_basic.inc
+--source suite/sys_vars/inc/innodb_max_purge_lag_basic.inc
 
diff --git a/mysql-test/t/innodb_max_purge_lag_basic_64.test b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_64.test
similarity index 88%
rename from mysql-test/t/innodb_max_purge_lag_basic_64.test
rename to mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_64.test
index 5980e8ed12e1e3f5920ec00324e4d452df6883e6..4744cee20d971f558123cc2e390f9915abd09842 100644
--- a/mysql-test/t/innodb_max_purge_lag_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/innodb_max_purge_lag_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/innodb_max_purge_lag_basic.inc
+--source suite/sys_vars/inc/innodb_max_purge_lag_basic.inc
 
diff --git a/mysql-test/t/innodb_sync_spin_loops_basic_32.test b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_32.test
similarity index 87%
rename from mysql-test/t/innodb_sync_spin_loops_basic_32.test
rename to mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_32.test
index ffb766b3ec88b4789d8a79148548c82f03e7c7a5..981b6c4e992e69e92ecabc5f4649efd91f11601c 100644
--- a/mysql-test/t/innodb_sync_spin_loops_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/innodb_sync_spin_loops_basic.inc
+--source suite/sys_vars/inc/innodb_sync_spin_loops_basic.inc
 
diff --git a/mysql-test/t/innodb_sync_spin_loops_basic_64.test b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_64.test
similarity index 87%
rename from mysql-test/t/innodb_sync_spin_loops_basic_64.test
rename to mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_64.test
index f854bf475d67e4fcdd1a53c434eeb234459ade3a..ab7c01c5b6d55ccf3374a07faa886889a972ed1a 100644
--- a/mysql-test/t/innodb_sync_spin_loops_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/innodb_sync_spin_loops_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/innodb_sync_spin_loops_basic.inc
+--source suite/sys_vars/inc/innodb_sync_spin_loops_basic.inc
 
diff --git a/mysql-test/t/join_buffer_size_basic_32.test b/mysql-test/suite/sys_vars/t/join_buffer_size_basic_32.test
similarity index 88%
rename from mysql-test/t/join_buffer_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/join_buffer_size_basic_32.test
index e904f2de42614169eba826517a54e90c7c0e4d81..f6b35b8964459777273af7c2bcde1ac313cdab0a 100644
--- a/mysql-test/t/join_buffer_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/join_buffer_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/join_buffer_size_basic.inc
+--source suite/sys_vars/inc/join_buffer_size_basic.inc
 
diff --git a/mysql-test/t/join_buffer_size_basic_64.test b/mysql-test/suite/sys_vars/t/join_buffer_size_basic_64.test
similarity index 88%
rename from mysql-test/t/join_buffer_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/join_buffer_size_basic_64.test
index 6de911be04c4ef773d873b39a99890e9b226820b..5632471235f2b7497e59bd0f258b9c661cbc09fd 100644
--- a/mysql-test/t/join_buffer_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/join_buffer_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/join_buffer_size_basic.inc
+--source suite/sys_vars/inc/join_buffer_size_basic.inc
 
diff --git a/mysql-test/t/key_buffer_size_basic_32.test b/mysql-test/suite/sys_vars/t/key_buffer_size_basic_32.test
similarity index 89%
rename from mysql-test/t/key_buffer_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/key_buffer_size_basic_32.test
index 78051382f73190158a956ab793c3e5ab0e06b02e..086e51e185c8210fd5d0392d6108ea96186e0958 100644
--- a/mysql-test/t/key_buffer_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/key_buffer_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/key_buffer_size_basic.inc
+--source suite/sys_vars/inc/key_buffer_size_basic.inc
 
diff --git a/mysql-test/t/key_buffer_size_basic_64.test b/mysql-test/suite/sys_vars/t/key_buffer_size_basic_64.test
similarity index 89%
rename from mysql-test/t/key_buffer_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/key_buffer_size_basic_64.test
index ed8409fa70c4db6775df7d09c595c7963aa56872..5604c56480ba905685c75e51a611059358ef7bbd 100644
--- a/mysql-test/t/key_buffer_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/key_buffer_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/key_buffer_size_basic.inc
+--source suite/sys_vars/inc/key_buffer_size_basic.inc
 
diff --git a/mysql-test/t/key_cache_age_threshold_basic_32.test b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_32.test
similarity index 87%
rename from mysql-test/t/key_cache_age_threshold_basic_32.test
rename to mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_32.test
index 13e7367f2edd296137d05010ed813f96a8aabf20..8a234d9d3002eaafb27b8f44935bda1542de7e62 100644
--- a/mysql-test/t/key_cache_age_threshold_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/key_cache_age_threshold_basic.inc
+--source suite/sys_vars/inc/key_cache_age_threshold_basic.inc
 
diff --git a/mysql-test/t/key_cache_age_threshold_basic_64.test b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_64.test
similarity index 87%
rename from mysql-test/t/key_cache_age_threshold_basic_64.test
rename to mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_64.test
index 6524ec89127915fc6477c8624197dd52abc204bc..32f98cba941bc538f987794b64c13a8f5bef20dc 100644
--- a/mysql-test/t/key_cache_age_threshold_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_age_threshold_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/key_cache_age_threshold_basic.inc
+--source suite/sys_vars/inc/key_cache_age_threshold_basic.inc
 
diff --git a/mysql-test/t/key_cache_block_size_basic_32.test b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic_32.test
similarity index 88%
rename from mysql-test/t/key_cache_block_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/key_cache_block_size_basic_32.test
index 63d71016657d384b05bc6dcd2124071b4d19e674..db0c0bd67a2a490cb72ef71984a0126c6eb92f69 100644
--- a/mysql-test/t/key_cache_block_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/key_cache_block_size_basic.inc
+--source suite/sys_vars/inc/key_cache_block_size_basic.inc
 
diff --git a/mysql-test/t/key_cache_block_size_basic_64.test b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic_64.test
similarity index 88%
rename from mysql-test/t/key_cache_block_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/key_cache_block_size_basic_64.test
index 0b6fb16238e2c01ce29e21a8adf59a1836ecdd6e..7403d762dc46baa3a84f774f41ac8207269f45d7 100644
--- a/mysql-test/t/key_cache_block_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_block_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/key_cache_block_size_basic.inc
+--source suite/sys_vars/inc/key_cache_block_size_basic.inc
 
diff --git a/mysql-test/t/key_cache_division_limit_basic_32.test b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_32.test
similarity index 87%
rename from mysql-test/t/key_cache_division_limit_basic_32.test
rename to mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_32.test
index c8ec6cca3a3d185e9bf6248d9e3c9685db8edf3c..fcc2843886673fb003f61a2aad7d5d0c0c98401c 100644
--- a/mysql-test/t/key_cache_division_limit_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/key_cache_division_limit_basic.inc
+--source suite/sys_vars/inc/key_cache_division_limit_basic.inc
 
diff --git a/mysql-test/t/key_cache_division_limit_basic_64.test b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_64.test
similarity index 87%
rename from mysql-test/t/key_cache_division_limit_basic_64.test
rename to mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_64.test
index 3b4e3ccaa990a2f25c52dffd9d121d0459be9e5d..ac4dd1c96d3e770074bfcacf95463021a556b06f 100644
--- a/mysql-test/t/key_cache_division_limit_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/key_cache_division_limit_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/key_cache_division_limit_basic.inc
+--source suite/sys_vars/inc/key_cache_division_limit_basic.inc
 
diff --git a/mysql-test/t/log_warnings_basic_32.test b/mysql-test/suite/sys_vars/t/log_warnings_basic_32.test
similarity index 89%
rename from mysql-test/t/log_warnings_basic_32.test
rename to mysql-test/suite/sys_vars/t/log_warnings_basic_32.test
index b6d1d0d6382e13896ae1cc35fb3b8fe32225c5c9..a63cbed2aa369d816abca3ab24c8f074cf6fcabb 100644
--- a/mysql-test/t/log_warnings_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/log_warnings_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/log_warnings_basic.inc
+--source suite/sys_vars/inc/log_warnings_basic.inc
 
diff --git a/mysql-test/t/log_warnings_basic_64.test b/mysql-test/suite/sys_vars/t/log_warnings_basic_64.test
similarity index 89%
rename from mysql-test/t/log_warnings_basic_64.test
rename to mysql-test/suite/sys_vars/t/log_warnings_basic_64.test
index c11381735be6f8f3c8783d6cf5cda90452435e9f..5a8ad5482a5f68a90860f59c139b462209262a83 100644
--- a/mysql-test/t/log_warnings_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/log_warnings_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/log_warnings_basic.inc
+--source suite/sys_vars/inc/log_warnings_basic.inc
 
diff --git a/mysql-test/t/max_binlog_cache_size_basic_32.test b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_32.test
similarity index 87%
rename from mysql-test/t/max_binlog_cache_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_32.test
index ba9c4d5136ae67621dd4e12c3e40eb69bce77936..51386b1f99472fbb0b12b2663c78ff36de034993 100644
--- a/mysql-test/t/max_binlog_cache_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_binlog_cache_size_basic.inc
+--source suite/sys_vars/inc/max_binlog_cache_size_basic.inc
 
diff --git a/mysql-test/t/max_binlog_cache_size_basic_64.test b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_64.test
similarity index 87%
rename from mysql-test/t/max_binlog_cache_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_64.test
index ba3949ba90c31070c391191c9ec1366f7e587871..c7c757341fa0f48cd8e411f86bc0a3bb27a37827 100644
--- a/mysql-test/t/max_binlog_cache_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_binlog_cache_size_basic.inc
+--source suite/sys_vars/inc/max_binlog_cache_size_basic.inc
 
diff --git a/mysql-test/t/max_connect_errors_basic_32.test b/mysql-test/suite/sys_vars/t/max_connect_errors_basic_32.test
similarity index 88%
rename from mysql-test/t/max_connect_errors_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_connect_errors_basic_32.test
index 9f6e1dad6a8dbabd373c49d6f87d4e785811faae..62c7ec71568e38426f1c93b7c573990561f6a9d8 100644
--- a/mysql-test/t/max_connect_errors_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_connect_errors_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_connect_errors_basic.inc
+--source suite/sys_vars/inc/max_connect_errors_basic.inc
 
diff --git a/mysql-test/t/max_connect_errors_basic_64.test b/mysql-test/suite/sys_vars/t/max_connect_errors_basic_64.test
similarity index 88%
rename from mysql-test/t/max_connect_errors_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_connect_errors_basic_64.test
index 6a3d1be697889dadac111c1949bc949c5024b5db..f27135d53c7c256f036fc7c6b914c5fb548c8c11 100644
--- a/mysql-test/t/max_connect_errors_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_connect_errors_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_connect_errors_basic.inc
+--source suite/sys_vars/inc/max_connect_errors_basic.inc
 
diff --git a/mysql-test/t/max_heap_table_size_basic_32.test b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic_32.test
similarity index 88%
rename from mysql-test/t/max_heap_table_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_heap_table_size_basic_32.test
index 38684f307c25b5f69f0b9b8e82cc5d00b4cbb57f..180c41a5ecf205937d6cb19cc6ca3aa4b3532219 100644
--- a/mysql-test/t/max_heap_table_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_heap_table_size_basic.inc
+--source suite/sys_vars/inc/max_heap_table_size_basic.inc
 
diff --git a/mysql-test/t/max_heap_table_size_basic_64.test b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic_64.test
similarity index 88%
rename from mysql-test/t/max_heap_table_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_heap_table_size_basic_64.test
index 76f1b658da1e2a0bfeea9fd56bc9af4ce8a175c3..89d234f53996cbf78257a84ac67aa4ff8096f871 100644
--- a/mysql-test/t/max_heap_table_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_heap_table_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_heap_table_size_basic.inc
+--source suite/sys_vars/inc/max_heap_table_size_basic.inc
 
diff --git a/mysql-test/t/max_seeks_for_key_basic_32.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_32.test
similarity index 88%
rename from mysql-test/t/max_seeks_for_key_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_32.test
index d7b9ce7f8348d5c0fb3bbf6ed0738596eb0ba5f9..84d76c7cb43729736a01bd45d67066d38142d029 100644
--- a/mysql-test/t/max_seeks_for_key_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_seeks_for_key_basic.inc
+--source suite/sys_vars/inc/max_seeks_for_key_basic.inc
 
diff --git a/mysql-test/t/max_seeks_for_key_basic_64.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_64.test
similarity index 88%
rename from mysql-test/t/max_seeks_for_key_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_64.test
index f700aafa044de3963ee60aa3d324a683fc1d85cf..63c0c1d6a6b4cfc724be95b4dd449cf025f9e3c2 100644
--- a/mysql-test/t/max_seeks_for_key_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_seeks_for_key_basic.inc
+--source suite/sys_vars/inc/max_seeks_for_key_basic.inc
 
diff --git a/mysql-test/t/max_tmp_tables_basic_32.test b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic_32.test
similarity index 89%
rename from mysql-test/t/max_tmp_tables_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_tmp_tables_basic_32.test
index 98da87421b72e46256f91b524724b8ca767719dc..95ce399e68e913c42f73fa445e21be956d60c531 100644
--- a/mysql-test/t/max_tmp_tables_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_tmp_tables_basic.inc
+--source suite/sys_vars/inc/max_tmp_tables_basic.inc
 
diff --git a/mysql-test/t/max_tmp_tables_basic_64.test b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic_64.test
similarity index 89%
rename from mysql-test/t/max_tmp_tables_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_tmp_tables_basic_64.test
index 81aa478b7af2f06cb9560132e0364fd63e8f9d63..573e5a75230c48694f228c2aac6c3758f2d22b74 100644
--- a/mysql-test/t/max_tmp_tables_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_tmp_tables_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_tmp_tables_basic.inc
+--source suite/sys_vars/inc/max_tmp_tables_basic.inc
 
diff --git a/mysql-test/t/max_write_lock_count_basic_32.test b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic_32.test
similarity index 88%
rename from mysql-test/t/max_write_lock_count_basic_32.test
rename to mysql-test/suite/sys_vars/t/max_write_lock_count_basic_32.test
index c33ffc53d6c4103d2210135b358e47f980cd9a7d..b49532089765bd58762e0bbfb801638096a2f552 100644
--- a/mysql-test/t/max_write_lock_count_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/max_write_lock_count_basic.inc
+--source suite/sys_vars/inc/max_write_lock_count_basic.inc
 
diff --git a/mysql-test/t/max_write_lock_count_basic_64.test b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic_64.test
similarity index 88%
rename from mysql-test/t/max_write_lock_count_basic_64.test
rename to mysql-test/suite/sys_vars/t/max_write_lock_count_basic_64.test
index de1d2194c3318906034e37b5e1fd8843816e72e4..b0c5dabac07ff0c6a29aca45453d8de0d5cc72ce 100644
--- a/mysql-test/t/max_write_lock_count_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/max_write_lock_count_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/max_write_lock_count_basic.inc
+--source suite/sys_vars/inc/max_write_lock_count_basic.inc
 
diff --git a/mysql-test/t/min_examined_row_limit_basic_32.test b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_32.test
similarity index 87%
rename from mysql-test/t/min_examined_row_limit_basic_32.test
rename to mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_32.test
index bbc3b6029d89da7929e0820a68e9a0a72cd12dde..de53be3cb7c97a8bcd4477a2e85cfb76badcaec3 100644
--- a/mysql-test/t/min_examined_row_limit_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/min_examined_row_limit_basic.inc
+--source suite/sys_vars/inc/min_examined_row_limit_basic.inc
 
diff --git a/mysql-test/t/min_examined_row_limit_basic_64.test b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_64.test
similarity index 87%
rename from mysql-test/t/min_examined_row_limit_basic_64.test
rename to mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_64.test
index 93cc4eda99de37a1a25158f46095e4758332f30b..449b5d5525ec4dd6690fc8571fece9b8840fdc31 100644
--- a/mysql-test/t/min_examined_row_limit_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/min_examined_row_limit_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/min_examined_row_limit_basic.inc
+--source suite/sys_vars/inc/min_examined_row_limit_basic.inc
 
diff --git a/mysql-test/t/multi_range_count_basic_32.test b/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test
similarity index 88%
rename from mysql-test/t/multi_range_count_basic_32.test
rename to mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test
index a2487ebc154b2885550f54a3954d08024946310c..f9db6632d3310b04d973439d04eda4acf0d86b52 100644
--- a/mysql-test/t/multi_range_count_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/multi_range_count_basic.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
 
diff --git a/mysql-test/t/multi_range_count_basic_64.test b/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test
similarity index 88%
rename from mysql-test/t/multi_range_count_basic_64.test
rename to mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test
index 0dd1ab50e4bd3c2fc20fa675318280ee1a6f5f13..12ad7588bbd1b1565dbdb3bbbda0704bccab7dfb 100644
--- a/mysql-test/t/multi_range_count_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/multi_range_count_basic.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
 
diff --git a/mysql-test/t/myisam_max_sort_file_size_basic_32.test b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_32.test
similarity index 87%
rename from mysql-test/t/myisam_max_sort_file_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_32.test
index 5ff3a35a61f75fc0af9281165c0997a7350e9899..6c0ff16bc6fe34461589041b9c0e7ae2a1d86163 100644
--- a/mysql-test/t/myisam_max_sort_file_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/myisam_max_sort_file_size_basic.inc
+--source suite/sys_vars/inc/myisam_max_sort_file_size_basic.inc
 
diff --git a/mysql-test/t/myisam_max_sort_file_size_basic_64.test b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_64.test
similarity index 87%
rename from mysql-test/t/myisam_max_sort_file_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_64.test
index e3846e2ccdcea886b2379ea3bd640eac7a1e7e41..108cc2e23504c21c3dfdb4165959c0d8fc930932 100644
--- a/mysql-test/t/myisam_max_sort_file_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/myisam_max_sort_file_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/myisam_max_sort_file_size_basic.inc
+--source suite/sys_vars/inc/myisam_max_sort_file_size_basic.inc
 
diff --git a/mysql-test/t/myisam_repair_threads_basic_32.test b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_32.test
similarity index 87%
rename from mysql-test/t/myisam_repair_threads_basic_32.test
rename to mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_32.test
index 7f0f0785f09360de3fa966c71b14fb70e411d2f3..f395ffe8ee0bfd386d5d6fdce44b00dbff285f97 100644
--- a/mysql-test/t/myisam_repair_threads_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/myisam_repair_threads_basic.inc
+--source suite/sys_vars/inc/myisam_repair_threads_basic.inc
 
diff --git a/mysql-test/t/myisam_repair_threads_basic_64.test b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_64.test
similarity index 87%
rename from mysql-test/t/myisam_repair_threads_basic_64.test
rename to mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_64.test
index f1870409c282efe3273ed58312227fd7b43172d8..21ed5fd9c5faaab1335546d7a0d81bfaf18d278e 100644
--- a/mysql-test/t/myisam_repair_threads_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/myisam_repair_threads_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/myisam_repair_threads_basic.inc
+--source suite/sys_vars/inc/myisam_repair_threads_basic.inc
 
diff --git a/mysql-test/t/myisam_sort_buffer_size_basic_32.test b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_32.test
similarity index 87%
rename from mysql-test/t/myisam_sort_buffer_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_32.test
index d87a2015407d74dd844b0f1c6a6027cd83e50f57..9c4116758f7ab41414c3164a3ae722f475c9387d 100644
--- a/mysql-test/t/myisam_sort_buffer_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/myisam_sort_buffer_size_basic.inc
+--source suite/sys_vars/inc/myisam_sort_buffer_size_basic.inc
 
diff --git a/mysql-test/t/myisam_sort_buffer_size_basic_64.test b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_64.test
similarity index 87%
rename from mysql-test/t/myisam_sort_buffer_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_64.test
index fd1c3c30e7d297753dc0b7bd618803df8077158d..70f8a33ed4d15207ae6db6ddab0748261438a80c 100644
--- a/mysql-test/t/myisam_sort_buffer_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/myisam_sort_buffer_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/myisam_sort_buffer_size_basic.inc
+--source suite/sys_vars/inc/myisam_sort_buffer_size_basic.inc
 
diff --git a/mysql-test/t/net_retry_count_basic_32.test b/mysql-test/suite/sys_vars/t/net_retry_count_basic_32.test
similarity index 89%
rename from mysql-test/t/net_retry_count_basic_32.test
rename to mysql-test/suite/sys_vars/t/net_retry_count_basic_32.test
index 1f7a4f1cb8025baee34200e19ac4e875f429feae..56f0e56f100e1eaabb38e6894cc2e78891450761 100644
--- a/mysql-test/t/net_retry_count_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/net_retry_count_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/net_retry_count_basic.inc
+--source suite/sys_vars/inc/net_retry_count_basic.inc
 
diff --git a/mysql-test/t/net_retry_count_basic_64.test b/mysql-test/suite/sys_vars/t/net_retry_count_basic_64.test
similarity index 89%
rename from mysql-test/t/net_retry_count_basic_64.test
rename to mysql-test/suite/sys_vars/t/net_retry_count_basic_64.test
index 08839b673f23db11027aa07a5431185a6e4af7c3..cb1fe8beebbb79fb62a2b45386be5c57541f8010 100644
--- a/mysql-test/t/net_retry_count_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/net_retry_count_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/net_retry_count_basic.inc
+--source suite/sys_vars/inc/net_retry_count_basic.inc
 
diff --git a/mysql-test/t/query_alloc_block_size_basic_32.test b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_32.test
similarity index 87%
rename from mysql-test/t/query_alloc_block_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_32.test
index 281698c417983f6dff7c09a526f5e0ac4b840b93..471b48c30595fc32712600b856c773212d2a63ea 100644
--- a/mysql-test/t/query_alloc_block_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/query_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/query_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/query_alloc_block_size_basic_64.test b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_64.test
similarity index 87%
rename from mysql-test/t/query_alloc_block_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_64.test
index 70f2f37d36bef99b58a1a7a65e14ac92ff9091df..645178991711031dd6f7d0c6dbd8d5555de23d09 100644
--- a/mysql-test/t/query_alloc_block_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/query_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/query_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/query_cache_limit_basic_32.test b/mysql-test/suite/sys_vars/t/query_cache_limit_basic_32.test
similarity index 88%
rename from mysql-test/t/query_cache_limit_basic_32.test
rename to mysql-test/suite/sys_vars/t/query_cache_limit_basic_32.test
index cd5f94112a0ca637bd8413af846138cfb91e1c9f..0416fc463494eb1cfcc0b3b8a69588994ee3db92 100644
--- a/mysql-test/t/query_cache_limit_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/query_cache_limit_basic.inc
+--source suite/sys_vars/inc/query_cache_limit_basic.inc
 
diff --git a/mysql-test/t/query_cache_limit_basic_64.test b/mysql-test/suite/sys_vars/t/query_cache_limit_basic_64.test
similarity index 88%
rename from mysql-test/t/query_cache_limit_basic_64.test
rename to mysql-test/suite/sys_vars/t/query_cache_limit_basic_64.test
index a3ebae0b2447c85a90e628a72ce29d4014291604..0d134449bf98281cc4cca307a4bff697d1d3e057 100644
--- a/mysql-test/t/query_cache_limit_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/query_cache_limit_basic.inc
+--source suite/sys_vars/inc/query_cache_limit_basic.inc
 
diff --git a/mysql-test/t/query_cache_min_res_unit_basic_32.test b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_32.test
similarity index 87%
rename from mysql-test/t/query_cache_min_res_unit_basic_32.test
rename to mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_32.test
index 4f3740ea8725e9244fa8e4de32f6591f6fcf7d81..1288157d10275f1839fa61a26b918f0d4df5750b 100644
--- a/mysql-test/t/query_cache_min_res_unit_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/query_cache_min_res_unit_basic.inc
+--source suite/sys_vars/inc/query_cache_min_res_unit_basic.inc
 
diff --git a/mysql-test/t/query_cache_min_res_unit_basic_64.test b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_64.test
similarity index 87%
rename from mysql-test/t/query_cache_min_res_unit_basic_64.test
rename to mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_64.test
index b35b07d4f1e03a0398245d482f7017d70d554b41..e941b55ab524ea60f2046e12614e271f1d1b5ccf 100644
--- a/mysql-test/t/query_cache_min_res_unit_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_min_res_unit_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/query_cache_min_res_unit_basic.inc
+--source suite/sys_vars/inc/query_cache_min_res_unit_basic.inc
 
diff --git a/mysql-test/t/query_cache_size_basic_32.test b/mysql-test/suite/sys_vars/t/query_cache_size_basic_32.test
similarity index 88%
rename from mysql-test/t/query_cache_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/query_cache_size_basic_32.test
index 500bdbda5ddf15fa528a6d1f82f637d6fb0838be..17fd1bb41abeb9caa13eb4610d42f440a0881ca4 100644
--- a/mysql-test/t/query_cache_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/query_cache_size_basic.inc
+--source suite/sys_vars/inc/query_cache_size_basic.inc
 
diff --git a/mysql-test/t/query_cache_size_basic_64.test b/mysql-test/suite/sys_vars/t/query_cache_size_basic_64.test
similarity index 88%
rename from mysql-test/t/query_cache_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/query_cache_size_basic_64.test
index d53be96a28bb06903d9a8321931b14e06e60d211..ba0cddc5a3a1ac2a6ba5eeb13cfe998b8dcd21db 100644
--- a/mysql-test/t/query_cache_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/query_cache_size_basic.inc
+--source suite/sys_vars/inc/query_cache_size_basic.inc
 
diff --git a/mysql-test/t/query_prealloc_size_basic_32.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic_32.test
similarity index 88%
rename from mysql-test/t/query_prealloc_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/query_prealloc_size_basic_32.test
index ae919cd8d9e46fa9ff405a5ed7662a001f75710b..34dafc71c9cd5e4f4680924eae9319c5eca217a2 100644
--- a/mysql-test/t/query_prealloc_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/query_prealloc_size_basic.inc
+--source suite/sys_vars/inc/query_prealloc_size_basic.inc
 
diff --git a/mysql-test/t/query_prealloc_size_basic_64.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic_64.test
similarity index 88%
rename from mysql-test/t/query_prealloc_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/query_prealloc_size_basic_64.test
index 532336e225e8679d4525ff47dc438e8f4e254e4b..c1f04c0788c191d62f3449e3387843cb31039b17 100644
--- a/mysql-test/t/query_prealloc_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/query_prealloc_size_basic.inc
+--source suite/sys_vars/inc/query_prealloc_size_basic.inc
 
diff --git a/mysql-test/t/range_alloc_block_size_basic_32.test b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_32.test
similarity index 87%
rename from mysql-test/t/range_alloc_block_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_32.test
index 247e92cd362547034b5445bab48e73418459b382..14cdc82f7c47777e2e03fd5e6325b238bae80c3d 100644
--- a/mysql-test/t/range_alloc_block_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/range_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/range_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/range_alloc_block_size_basic_64.test b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_64.test
similarity index 87%
rename from mysql-test/t/range_alloc_block_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_64.test
index a9601d770c03478ea799608554644e4daf10881b..a4125b14fd025d4856458847adca5a39f06d3690 100644
--- a/mysql-test/t/range_alloc_block_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/range_alloc_block_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/range_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/range_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/rpl_recovery_rank_basic_32.test b/mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_32.test
similarity index 88%
rename from mysql-test/t/rpl_recovery_rank_basic_32.test
rename to mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_32.test
index d35878e153c83133d18295b1d2633c929b2a4b31..c28282dd38bb9b3c6b1fa2b66db2c05907bf1bc7 100644
--- a/mysql-test/t/rpl_recovery_rank_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/rpl_recovery_rank_basic.inc
+--source suite/sys_vars/inc/rpl_recovery_rank_basic.inc
 
diff --git a/mysql-test/t/rpl_recovery_rank_basic_64.test b/mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_64.test
similarity index 88%
rename from mysql-test/t/rpl_recovery_rank_basic_64.test
rename to mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_64.test
index 6fe04f26442fa3a3a62a3fc559d7fe02fb87abef..51895efa65e30380504d8ee726687c682d575cbe 100644
--- a/mysql-test/t/rpl_recovery_rank_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/rpl_recovery_rank_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/rpl_recovery_rank_basic.inc
+--source suite/sys_vars/inc/rpl_recovery_rank_basic.inc
 
diff --git a/mysql-test/t/server_id_basic_32.test b/mysql-test/suite/sys_vars/t/server_id_basic_32.test
similarity index 90%
rename from mysql-test/t/server_id_basic_32.test
rename to mysql-test/suite/sys_vars/t/server_id_basic_32.test
index b7c4c603803fe3e11576451df2498cdd952096d2..e01b271e002679397c68e4e6fd0ef155d8ce3215 100644
--- a/mysql-test/t/server_id_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/server_id_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/server_id_basic.inc
+--source suite/sys_vars/inc/server_id_basic.inc
 
diff --git a/mysql-test/t/server_id_basic_64.test b/mysql-test/suite/sys_vars/t/server_id_basic_64.test
similarity index 90%
rename from mysql-test/t/server_id_basic_64.test
rename to mysql-test/suite/sys_vars/t/server_id_basic_64.test
index 67653e0503ea640d13fb04166bda3343351f98bf..4ef870aa977162cd019dab080dabd43eae22de98 100644
--- a/mysql-test/t/server_id_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/server_id_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/server_id_basic.inc
+--source suite/sys_vars/inc/server_id_basic.inc
 
diff --git a/mysql-test/t/slave_transaction_retries_basic_32.test b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_32.test
similarity index 87%
rename from mysql-test/t/slave_transaction_retries_basic_32.test
rename to mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_32.test
index c19297ba72fced5f145231d65c9a29c93e0817da..8f3147ddab49c58fd72184f827cc38a8b17e4a30 100644
--- a/mysql-test/t/slave_transaction_retries_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/slave_transaction_retries_basic.inc
+--source suite/sys_vars/inc/slave_transaction_retries_basic.inc
 
diff --git a/mysql-test/t/slave_transaction_retries_basic_64.test b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_64.test
similarity index 87%
rename from mysql-test/t/slave_transaction_retries_basic_64.test
rename to mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_64.test
index e07f96edf3f33f2ef0b0af33931908a7d2e030b9..dfd52507f618be984fab2cbbae850ac9d045d0b0 100644
--- a/mysql-test/t/slave_transaction_retries_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/slave_transaction_retries_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/slave_transaction_retries_basic.inc
+--source suite/sys_vars/inc/slave_transaction_retries_basic.inc
 
diff --git a/mysql-test/t/sort_buffer_size_basic_32.test b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic_32.test
similarity index 88%
rename from mysql-test/t/sort_buffer_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/sort_buffer_size_basic_32.test
index 8c86fe7786af96e6cc249f0c97a4623d17141cef..d63cc997f5b12d5b40bc5f2574457a24baccad2f 100644
--- a/mysql-test/t/sort_buffer_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/sort_buffer_size_basic.inc
+--source suite/sys_vars/inc/sort_buffer_size_basic.inc
 
diff --git a/mysql-test/t/sort_buffer_size_basic_64.test b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic_64.test
similarity index 88%
rename from mysql-test/t/sort_buffer_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/sort_buffer_size_basic_64.test
index 86081b3820bcd54596788ae91ea804ae112895b7..4c7a16bd01442ad8190c7b932c49e0ef0e635baa 100644
--- a/mysql-test/t/sort_buffer_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/sort_buffer_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/sort_buffer_size_basic.inc
+--source suite/sys_vars/inc/sort_buffer_size_basic.inc
 
diff --git a/mysql-test/t/sync_binlog_basic_32.test b/mysql-test/suite/sys_vars/t/sync_binlog_basic_32.test
similarity index 89%
rename from mysql-test/t/sync_binlog_basic_32.test
rename to mysql-test/suite/sys_vars/t/sync_binlog_basic_32.test
index 3acd76b7e72876a1ebd5a34530743932020adc9b..275b95cf775d74358bc97ecb0647d65143807923 100644
--- a/mysql-test/t/sync_binlog_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/sync_binlog_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/sync_binlog_basic.inc
+--source suite/sys_vars/inc/sync_binlog_basic.inc
 
diff --git a/mysql-test/t/sync_binlog_basic_64.test b/mysql-test/suite/sys_vars/t/sync_binlog_basic_64.test
similarity index 89%
rename from mysql-test/t/sync_binlog_basic_64.test
rename to mysql-test/suite/sys_vars/t/sync_binlog_basic_64.test
index 9f605445ded1b078c449dbde12537addf8a12d19..e6f9bf668a0cbf3695bf50a072754f1ddffa2939 100644
--- a/mysql-test/t/sync_binlog_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/sync_binlog_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/sync_binlog_basic.inc
+--source suite/sys_vars/inc/sync_binlog_basic.inc
 
diff --git a/mysql-test/t/timestamp_basic_32.test b/mysql-test/suite/sys_vars/t/timestamp_basic_32.test
similarity index 90%
rename from mysql-test/t/timestamp_basic_32.test
rename to mysql-test/suite/sys_vars/t/timestamp_basic_32.test
index 72371c154fcd840692277eb02d937114f327458f..a2b6139aef985919dae87176f846be246ffa642b 100644
--- a/mysql-test/t/timestamp_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/timestamp_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/timestamp_basic.inc
+--source suite/sys_vars/inc/timestamp_basic.inc
 
diff --git a/mysql-test/t/timestamp_basic_64.test b/mysql-test/suite/sys_vars/t/timestamp_basic_64.test
similarity index 90%
rename from mysql-test/t/timestamp_basic_64.test
rename to mysql-test/suite/sys_vars/t/timestamp_basic_64.test
index 4614e470a4cd56b65f026a2948c57268a2688133..fbc86316ed970548ad0d3efef58f9ac6a31cb1b6 100644
--- a/mysql-test/t/timestamp_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/timestamp_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/timestamp_basic.inc
+--source suite/sys_vars/inc/timestamp_basic.inc
 
diff --git a/mysql-test/t/tmp_table_size_basic_32.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test
similarity index 89%
rename from mysql-test/t/tmp_table_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test
index 19d54251c5ed06320466d0689c9864d1f3de2f33..c772b5c896c96cfcda33f109c02ee85ccbf6d0f1 100644
--- a/mysql-test/t/tmp_table_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/tmp_table_size_basic.inc
+--source suite/sys_vars/inc/tmp_table_size_basic.inc
 
diff --git a/mysql-test/t/tmp_table_size_basic_64.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test
similarity index 89%
rename from mysql-test/t/tmp_table_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test
index ddd865f638323d52e77e368decd125d9c297a26d..46b3f65be9a0f19c1d91ecca63a05449b9ed0a50 100644
--- a/mysql-test/t/tmp_table_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/tmp_table_size_basic.inc
+--source suite/sys_vars/inc/tmp_table_size_basic.inc
 
diff --git a/mysql-test/t/transaction_alloc_block_size_basic_32.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_32.test
similarity index 86%
rename from mysql-test/t/transaction_alloc_block_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_32.test
index a714a4f5a301f026bb20ec7d545d21b9cc5bd066..b9fbf429220123cb5418c267551f211de66f5f8f 100644
--- a/mysql-test/t/transaction_alloc_block_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/transaction_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/transaction_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/transaction_alloc_block_size_basic_64.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_64.test
similarity index 86%
rename from mysql-test/t/transaction_alloc_block_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_64.test
index b6ebe36c35f3287b79ee43d941190b455f397a80..fb68245ee625005fdd207fd10b64ec31f6006763 100644
--- a/mysql-test/t/transaction_alloc_block_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/transaction_alloc_block_size_basic.inc
+--source suite/sys_vars/inc/transaction_alloc_block_size_basic.inc
 
diff --git a/mysql-test/t/transaction_prealloc_size_basic_32.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_32.test
similarity index 87%
rename from mysql-test/t/transaction_prealloc_size_basic_32.test
rename to mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_32.test
index 868e281d30e1439f31ccc624d0cf99ffdb5a862d..23ea53334ffa85318922661d976d32f6608339e4 100644
--- a/mysql-test/t/transaction_prealloc_size_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/transaction_prealloc_size_basic.inc
+--source suite/sys_vars/inc/transaction_prealloc_size_basic.inc
 
diff --git a/mysql-test/t/transaction_prealloc_size_basic_64.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_64.test
similarity index 87%
rename from mysql-test/t/transaction_prealloc_size_basic_64.test
rename to mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_64.test
index 5487d06f52110334cd2ecf5e170626c47fa66d54..79a18585e80f8eedf0ae48de38b381173350533b 100644
--- a/mysql-test/t/transaction_prealloc_size_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/transaction_prealloc_size_basic.inc
+--source suite/sys_vars/inc/transaction_prealloc_size_basic.inc
 
diff --git a/mysql-test/t/wait_timeout_basic_32.test b/mysql-test/suite/sys_vars/t/wait_timeout_basic_32.test
similarity index 89%
rename from mysql-test/t/wait_timeout_basic_32.test
rename to mysql-test/suite/sys_vars/t/wait_timeout_basic_32.test
index 88d60333138126020a3df2b7027119bfba80810d..613a5543b144d7d92500450df79772bfe8576e2e 100644
--- a/mysql-test/t/wait_timeout_basic_32.test
+++ b/mysql-test/suite/sys_vars/t/wait_timeout_basic_32.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_32bit.inc
---source include/wait_timeout_basic.inc
+--source suite/sys_vars/inc/wait_timeout_basic.inc
 
diff --git a/mysql-test/t/wait_timeout_basic_64.test b/mysql-test/suite/sys_vars/t/wait_timeout_basic_64.test
similarity index 89%
rename from mysql-test/t/wait_timeout_basic_64.test
rename to mysql-test/suite/sys_vars/t/wait_timeout_basic_64.test
index 76dcd6fcc916fec410540c4c999d775614101808..d1138cbc10587daf02f184682c21681743ce519e 100644
--- a/mysql-test/t/wait_timeout_basic_64.test
+++ b/mysql-test/suite/sys_vars/t/wait_timeout_basic_64.test
@@ -5,5 +5,5 @@
 ################################################################################
 
 --source include/have_64bit.inc
---source include/wait_timeout_basic.inc
+--source suite/sys_vars/inc/wait_timeout_basic.inc
 
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index c058992d795bc1a074416faa6e9a1f6dfa413370..ada7cb3aa9763f6993ee8fce6b35fe5b26be881d 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -12,88 +12,6 @@
 federated_transactions   : Bug#29523 Transactions do not work
 csv_alter_table      : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
 thread_cache_size_func : Bug#36733 main.thread_cache_size_func fails randomly
-binlog_cache_size_basic_32            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-bulk_insert_buffer_size_basic_32      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-delayed_insert_limit_basic_32         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-delayed_queue_size_basic_32           : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_concurrency_tickets_basic_32   : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_max_purge_lag_basic_32         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_sync_spin_loops_basic_32       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-join_buffer_size_basic_32             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_buffer_size_basic_32              : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_age_threshold_basic_32      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_block_size_basic_32         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_division_limit_basic_32     : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-log_warnings_basic_32                 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_binlog_cache_size_basic_32        : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_connect_errors_basic_32           : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_heap_table_size_basic_32          : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_seeks_for_key_basic_32            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_tmp_tables_basic_32               : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_write_lock_count_basic_32         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-min_examined_row_limit_basic_32       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-multi_range_count_basic_32            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_max_sort_file_size_basic_32    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_repair_threads_basic_32        : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_sort_buffer_size_basic_32      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-net_retry_count_basic_32              : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_alloc_block_size_basic_32       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_limit_basic_32            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_min_res_unit_basic_32     : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_size_basic_32             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_prealloc_size_basic_32          : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-range_alloc_block_size_basic_32       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-rpl_recovery_rank_basic_32            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-server_id_basic_32                    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-slave_transaction_retries_basic_32    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-sort_buffer_size_basic_32             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-sync_binlog_basic_32                  : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-timestamp_basic_32                    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-tmp_table_size_basic_32               : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-transaction_alloc_block_size_basic_32 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-transaction_prealloc_size_basic_32    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-wait_timeout_basic_32                 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-binlog_cache_size_basic_64            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-bulk_insert_buffer_size_basic_64      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-delayed_insert_limit_basic_64         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-delayed_queue_size_basic_64           : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_concurrency_tickets_basic_64   : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_max_purge_lag_basic_64         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-innodb_sync_spin_loops_basic_64       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-join_buffer_size_basic_64             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_buffer_size_basic_64              : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_age_threshold_basic_64      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_block_size_basic_64         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-key_cache_division_limit_basic_64     : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-log_warnings_basic_64                 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_binlog_cache_size_basic_64        : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_connect_errors_basic_64           : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_heap_table_size_basic_64          : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_seeks_for_key_basic_64            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_tmp_tables_basic_64               : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-max_write_lock_count_basic_64         : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-min_examined_row_limit_basic_64       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-multi_range_count_basic_64            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_max_sort_file_size_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_repair_threads_basic_64        : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-myisam_sort_buffer_size_basic_64      : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-net_retry_count_basic_64              : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_alloc_block_size_basic_64       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_limit_basic_64            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_min_res_unit_basic_64     : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_cache_size_basic_64             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-query_prealloc_size_basic_64          : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-range_alloc_block_size_basic_64       : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-rpl_recovery_rank_basic_64            : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-server_id_basic_64                    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-slave_transaction_retries_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-sort_buffer_size_basic_64             : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-sync_binlog_basic_64                  : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-timestamp_basic_64                    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-tmp_table_size_basic_64               : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-transaction_alloc_block_size_basic_64 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-transaction_prealloc_size_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-wait_timeout_basic_64                 : Bug #36522: Some tests of system variables have diffs on 64bit platorms
 log_tables.test                       : Bug #37798: main.log_tables fails randomly on powermacg5 and windows
 slow_query_log_func.test              : Bug #37962: *_func tests containing sleeps/race conditions
 
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 5373ca3fec6ca66fb7a08f8c4219ecc523f2f42a..8da10f36cbe948a7e433c5428fd107bad2d44c9b 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -108,3 +108,46 @@ drop table t1;
 select if(0, 18446744073709551610, 18446744073709551610);
 
 
+#
+# Bug #37662: nested if() inside sum() is parsed in exponential time
+#
+
+CREATE TABLE t1(a DECIMAL(10,3));
+
+# check : should be fast. more than few secs means failure.
+SELECT t1.a,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,
+ IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
+FROM t1;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/t/innodb-autoinc-optimize.test
new file mode 100644
index 0000000000000000000000000000000000000000..c7e22a8ff40e542e6250191a8348316a2afe7863
--- /dev/null
+++ b/mysql-test/t/innodb-autoinc-optimize.test
@@ -0,0 +1,16 @@
+-- source include/have_innodb.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug 34286
+#
+create table t1(a int not null auto_increment primary key) engine=innodb;
+insert into t1 set a = -1;
+# NOTE: The database needs to be shutdown and restarted (here) for
+# the test to work. It's included for reference only.
+optimize table t1;
diff --git a/mysql-test/t/innodb_bug35220.test b/mysql-test/t/innodb_bug35220.test
new file mode 100644
index 0000000000000000000000000000000000000000..26f7d6b1ddd717e08be58a6dc0e300003c52fc60
--- /dev/null
+++ b/mysql-test/t/innodb_bug35220.test
@@ -0,0 +1,16 @@
+#
+# Bug#35220 ALTER TABLE too picky on reserved word "foreign"
+# http://bugs.mysql.com/35220
+#
+
+-- source include/have_innodb.inc
+
+SET storage_engine=InnoDB;
+
+# we care only that the following SQL commands do not produce errors
+-- disable_query_log
+-- disable_result_log
+
+CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT);
+ALTER TABLE bug35220 DROP foreign_col;
+DROP TABLE bug35220;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index d13f62303397b2bcedbe80529e051c12182dbb86..93b98090420a385c95ef5e15a75d4bbea11e9ad0 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3299,4 +3299,16 @@ SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
 
 DROP TABLE t1,t2;
 
---echo End of 5.0 tests.
+#
+# Bug #38191: Server crash with subquery containing DISTINCT and ORDER BY
+#
+
+CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk int PRIMARY KEY, a int, b int, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+   WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+DROP TABLE t1,t2;
+
+--echo End of 5.1 tests.
diff --git a/sql/field.h b/sql/field.h
index 7d312dbd2b824c2d254206870962a4f9c5da8c92..36f494f6e5063ab67f834210cc84382d34985704 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -13,7 +13,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
-
 /*
   Because of the function new_field() all field classes that have static
   variables must declare the size_of() member function.
@@ -51,7 +50,8 @@ class Field
   Field(const Item &);				/* Prevent use of these */
   void operator=(Field &);
 public:
-  static void *operator new(size_t size) {return sql_alloc(size); }
+  static void *operator new(size_t size) throw ()
+  { return sql_alloc(size); }
   static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
 
   uchar		*ptr;			// Position to field in record
@@ -1669,6 +1669,7 @@ class Field_blob :public Field_longstr {
   }
   int reset(void) { bzero(ptr, packlength+sizeof(uchar*)); return 0; }
   void reset_fields() { bzero((uchar*) &value,sizeof(value)); }
+  uint32 get_field_buffer_size(void) { return value.alloced_length(); }
 #ifndef WORDS_BIGENDIAN
   static
 #endif
diff --git a/sql/item.cc b/sql/item.cc
index 5ee394fcbe06fdb8d0e49ae737c34f459a4ab490..48fcb232bab1944df3bbb1663a0372ac4c217090 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -437,8 +437,11 @@ uint Item::decimal_precision() const
   Item_result restype= result_type();
 
   if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
-    return min(my_decimal_length_to_precision(max_length, decimals, unsigned_flag),
-               DECIMAL_MAX_PRECISION);
+  {
+    uint prec= 
+      my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
+    return min(prec, DECIMAL_MAX_PRECISION);
+  }
   return min(max_length, DECIMAL_MAX_PRECISION);
 }
 
@@ -6995,8 +6998,9 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
   if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
   {
     decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE);
-    int precision= min(max(prev_decimal_int_part, item->decimal_int_part())
-                       + decimals, DECIMAL_MAX_PRECISION);
+    int item_int_part= item->decimal_int_part();
+    int item_prec = max(prev_decimal_int_part, item_int_part) + decimals;
+    int precision= min(item_prec, DECIMAL_MAX_PRECISION);
     unsigned_flag&= item->unsigned_flag;
     max_length= my_decimal_precision_to_length(precision, decimals,
                                                unsigned_flag);
diff --git a/sql/item.h b/sql/item.h
index 465d6f4d54cbaec338ac72e19cf6851ba822ece6..2c9af80195b33aa17c1c2966ed4aa7df886058da 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -467,9 +467,9 @@ class Item {
   Item(const Item &);			/* Prevent use of these */
   void operator=(Item &);
 public:
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   { return sql_alloc(size); }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return alloc_root(mem_root, size); }
   static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
   static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 28e55eef5bdf54f37c3fae50d5d0f2c3d8833777..c76bbececefd8c6b8ca1abedf408ff2d2ffa3916 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2163,8 +2163,11 @@ Item_func_ifnull::fix_length_and_dec()
 
 uint Item_func_ifnull::decimal_precision() const
 {
-  int max_int_part=max(args[0]->decimal_int_part(),args[1]->decimal_int_part());
-  return min(max_int_part + decimals, DECIMAL_MAX_PRECISION);
+  int arg0_int_part= args[0]->decimal_int_part();
+  int arg1_int_part= args[1]->decimal_int_part();
+  int max_int_part= max(arg0_int_part, arg1_int_part);
+  int precision= max_int_part + decimals;
+  return min(precision, DECIMAL_MAX_PRECISION);
 }
 
 
@@ -2345,8 +2348,9 @@ Item_func_if::fix_length_and_dec()
 
 uint Item_func_if::decimal_precision() const
 {
-  int precision=(max(args[1]->decimal_int_part(),args[2]->decimal_int_part())+
-                 decimals);
+  int arg1_prec= args[1]->decimal_int_part();
+  int arg2_prec= args[2]->decimal_int_part();
+  int precision=max(arg1_prec,arg2_prec) + decimals;
   return min(precision, DECIMAL_MAX_PRECISION);
 }
 
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a17c1eff5dde35d74be0ecccdb855f16225dc4f5..8bb6bb301170ca99f31422147e673c7ce5189ae6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1139,9 +1139,10 @@ my_decimal *Item_func_plus::decimal_op(my_decimal *decimal_value)
 void Item_func_additive_op::result_precision()
 {
   decimals= max(args[0]->decimals, args[1]->decimals);
-  int max_int_part= max(args[0]->decimal_precision() - args[0]->decimals,
-                        args[1]->decimal_precision() - args[1]->decimals);
-  int precision= min(max_int_part + 1 + decimals, DECIMAL_MAX_PRECISION);
+  int arg1_int= args[0]->decimal_precision() - args[0]->decimals;
+  int arg2_int= args[1]->decimal_precision() - args[1]->decimals;
+  int est_prec= max(arg1_int, arg2_int) + 1 + decimals;
+  int precision= min(est_prec, DECIMAL_MAX_PRECISION);
 
   /* Integer operations keep unsigned_flag if one of arguments is unsigned */
   if (result_type() == INT_RESULT)
@@ -1252,8 +1253,8 @@ void Item_func_mul::result_precision()
   else
     unsigned_flag= args[0]->unsigned_flag & args[1]->unsigned_flag;
   decimals= min(args[0]->decimals + args[1]->decimals, DECIMAL_MAX_SCALE);
-  int precision= min(args[0]->decimal_precision() + args[1]->decimal_precision(),
-                     DECIMAL_MAX_PRECISION);
+  uint est_prec = args[0]->decimal_precision() + args[1]->decimal_precision();
+  uint precision= min(est_prec, DECIMAL_MAX_PRECISION);
   max_length= my_decimal_precision_to_length(precision, decimals,unsigned_flag);
 }
 
@@ -1300,8 +1301,8 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value)
 
 void Item_func_div::result_precision()
 {
-  uint precision=min(args[0]->decimal_precision() + prec_increment,
-                     DECIMAL_MAX_PRECISION);
+  uint arg_prec= args[0]->decimal_precision() + prec_increment;
+  uint precision=min(arg_prec, DECIMAL_MAX_PRECISION);
   /* Integer operations keep unsigned_flag if one of arguments is unsigned */
   if (result_type() == INT_RESULT)
     unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index e150ffd18f843b373fb55e37e1dffedf35149234..f6ba5fc97393a6297712c221d8a73995b892eddb 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -2130,6 +2130,7 @@ int writefrm(const char* name, const uchar* data, size_t len);
 int closefrm(TABLE *table, bool free_share);
 int read_string(File file, uchar* *to, size_t length);
 void free_blobs(TABLE *table);
+void free_field_buffers_larger_than(TABLE *table, uint32 size);
 int set_zone(int nr,int min_zone,int max_zone);
 ulong convert_period_to_month(ulong period);
 ulong convert_month_to_period(ulong month);
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 426290714eb68c0c990c04d30ba65e4888bb2978..84eb5f5ba6494b545f1f58e79c48545d74a61432 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -4718,7 +4718,7 @@ ER_SLAVE_IGNORED_TABLE
         swe "Slav SQL tråden ignorerade frågan pga en replicate-*-table regel"
 ER_INCORRECT_GLOBAL_LOCAL_VAR  
         eng "Variable '%-.192s' is a %s variable"
-        serbian "Incorrect foreign key definition for '%-.192s': %s"
+        serbian "Promenljiva '%-.192s' je %s promenljiva"
         ger "Variable '%-.192s' ist eine %s-Variable"
         nla "Variabele '%-.192s' is geen %s variabele"
         spa "Variable '%-.192s' es una %s variable"
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 92dcafa7aa80f1d2689951ba6514f5c1e6806d04..d1f920fd3a53a24918a5d055efa468f093f1c451 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -475,7 +475,7 @@ sp_head::operator new(size_t size) throw()
   init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
   sp= (sp_head *) alloc_root(&own_root, size);
   if (sp == NULL)
-    return NULL;
+    DBUG_RETURN(NULL);
   sp->main_mem_root= own_root;
   DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root));
   DBUG_RETURN(sp);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 3704639a80db56e45d1a9fa6fc11faedf085dbb0..226d41e0fb5342430f0920cbd4465b2f623cbf55 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -5701,7 +5701,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
 
   while ((tmp_user_name= user_list++))
   {
-    user_name= get_current_user(thd, tmp_user_name);
     if (!(user_name= get_current_user(thd, tmp_user_name)))
     {
       result= TRUE;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index d25057789ac83c686424d45a867af523ca4bf34b..39dd815e738ee8a785129c2ee8fb12fb4f326318 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1369,6 +1369,8 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
     DBUG_ASSERT(!table->is_children_attached());
 
     /* Free memory and reset for next loop */
+    free_field_buffers_larger_than(table,MAX_TDC_BLOB_SIZE);
+    
     table->file->ha_reset();
     table->in_use=0;
     if (unused_tables)
diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc
index d33680e1e0b27045cd2e72a501d5118373ba3f7c..7c530cb9013be06cc93a2aa3a51e6f08931f1a4e 100644
--- a/sql/sql_cursor.cc
+++ b/sql/sql_cursor.cc
@@ -155,6 +155,7 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
   if (! (sensitive_cursor= new (thd->mem_root) Sensitive_cursor(thd, result)))
   {
     delete result_materialize;
+    result_materialize= NULL;
     return 1;
   }
 
@@ -212,6 +213,7 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result,
     if ((rc= materialized_cursor->open(0)))
     {
       delete materialized_cursor;
+      materialized_cursor= NULL;
       goto err_open;
     }
 
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 5af22a895a73340518b3b1fb9851e6cb2d79cd1f..bb3dc00fc8d411f5dc2aac1f74bc818a47590fe7 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -417,11 +417,11 @@ class st_select_lex_node {
   bool no_table_names_allowed; /* used for global order by */
   bool no_error; /* suppress error message (convert it to warnings) */
 
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   {
     return sql_alloc(size);
   }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return (void*) alloc_root(mem_root, (uint) size); }
   static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
   static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
diff --git a/sql/sql_list.h b/sql/sql_list.h
index 2e068f7f961b32ddeb77a3eecaed0595262002e8..0d267111dad8ac774127cf44d9ca297e511c202e 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -29,7 +29,7 @@ class Sql_alloc
   {
     return sql_alloc(size);
   }
-  static void *operator new[](size_t size)
+  static void *operator new[](size_t size) throw ()
   {
     return sql_alloc(size);
   }
@@ -450,7 +450,7 @@ template <class T> class List_iterator_fast :public base_list_iterator
 struct ilink
 {
   struct ilink **prev,*next;
-  static void *operator new(size_t size)
+  static void *operator new(size_t size) throw ()
   {
     return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE));
   }
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 14b14106925a6b10e888f79f979e799da3159996..d9ec8f6c6100244f6970c90e56b94cfceaecf7f1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6484,15 +6484,24 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
       thd->store_globals();
       lex_start(thd);
     }
+    
     if (thd)
     {
-      if (acl_reload(thd))
-        result= 1;
-      if (grant_reload(thd))
+      bool reload_acl_failed= acl_reload(thd);
+      bool reload_grants_failed= grant_reload(thd);
+      bool reload_servers_failed= servers_reload(thd);
+      
+      if (reload_acl_failed || reload_grants_failed || reload_servers_failed)
+      {
         result= 1;
-      if (servers_reload(thd))
-        result= 1; /* purecov: inspected */
+        /*
+          When an error is returned, my_message may have not been called and
+          the client will hang waiting for a response.
+        */
+        my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
+      }
     }
+
     if (tmp_thd)
     {
       delete tmp_thd;
@@ -6581,8 +6590,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
       tmp_write_to_binlog= 0;
       if (lock_global_read_lock(thd))
 	return 1;                               // Killed
-      result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
-                                  FALSE : TRUE, TRUE);
+      if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+                              FALSE : TRUE, TRUE))
+          result= 1;
+      
       if (make_global_read_lock_block_commit(thd)) // Killed
       {
         /* Don't leave things in a half-locked state */
@@ -6591,8 +6602,11 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
       }
     }
     else
-      result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
-                                  FALSE : TRUE, FALSE);
+    {
+      if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+                              FALSE : TRUE, FALSE))
+        result= 1;
+    }
     my_dbopt_cleanup();
   }
   if (options & REFRESH_HOSTS)
@@ -6615,8 +6629,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
 #ifdef OPENSSL
    if (options & REFRESH_DES_KEY_FILE)
    {
-     if (des_key_file)
-       result=load_des_key_file(des_key_file);
+     if (des_key_file && load_des_key_file(des_key_file))
+         result= 1;
    }
 #endif
 #ifdef HAVE_REPLICATION
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c5e8286409c552aba2e20985acb98db2dd96b7d7..4d8dbfe287b56299b926614fd6703c6e67a1d02b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -6754,6 +6754,12 @@ void JOIN::cleanup(bool full)
     if (tmp_join)
       tmp_table_param.copy_field= 0;
     group_fields.delete_elements();
+    /* 
+      Ensure that the above delete_elements() would not be called
+      twice for the same list.
+    */
+    if (tmp_join && tmp_join != this)
+      tmp_join->group_fields= group_fields;
     /*
       We can't call delete_elements() on copy_funcs as this will cause
       problems in free_elements() as some of the elements are then deleted.
diff --git a/sql/sql_string.h b/sql/sql_string.h
index b4d76a1779acff6e3b11f0ea71c675508486e9a2..be11fea70dc8b3f804c55d1d6f38d65342aba24c 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -79,7 +79,7 @@ class String
     Alloced_length=str.Alloced_length; alloced=0; 
     str_charset=str.str_charset;
   }
-  static void *operator new(size_t size, MEM_ROOT *mem_root)
+  static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
   { return (void*) alloc_root(mem_root, (uint) size); }
   static void operator delete(void *ptr_arg,size_t size)
   { TRASH(ptr_arg, size); }
diff --git a/sql/table.cc b/sql/table.cc
index ebf3dfd748ede49ffb32d0c40a661c3b684d0fae..58cbde748229f9171a18df74fc65b4f7ead44343 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1999,6 +1999,28 @@ void free_blobs(register TABLE *table)
 }
 
 
+/**
+  Reclaim temporary blob storage which is bigger than 
+  a threshold.
+ 
+  @param table A handle to the TABLE object containing blob fields
+  @param size The threshold value.
+ 
+*/
+
+void free_field_buffers_larger_than(TABLE *table, uint32 size)
+{
+  uint *ptr, *end;
+  for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
+       ptr != end ;
+       ptr++)
+  {
+    Field_blob *blob= (Field_blob*) table->field[*ptr];
+    if (blob->get_field_buffer_size() > size)
+        blob->free();
+  }
+}
+
 	/* Find where a form starts */
 	/* if formname is NullS then only formnames is read */
 
diff --git a/sql/table.h b/sql/table.h
index 75ddaf69c101fec15cb0e65312e32500b45eb4ad..da0e089794f39fe46876823fd4759af8f5ab5961 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -935,6 +935,9 @@ typedef struct st_schema_table
 #define VIEW_CHECK_ERROR      1
 #define VIEW_CHECK_SKIP       2
 
+/** The threshold size a blob field buffer before it is freed */
+#define MAX_TDC_BLOB_SIZE 65536
+
 struct st_lex;
 class select_union;
 class TMP_TABLE_PARAM;
diff --git a/support-files/build-tags b/support-files/build-tags
index d5f9fbf5100c1c502c3c39534e7ff93e2104c3ed..6c80d2638e98c31f02f95a92adc005665bf90a12 100755
--- a/support-files/build-tags
+++ b/support-files/build-tags
@@ -2,8 +2,11 @@
 
 rm -f TAGS
 filter='\.cc$\|\.c$\|\.h$\|\.yy$'
-files=`bk -r sfiles -gU | grep $filter `
-for f in $files ;
+
+list="find . -type f"
+bzr root >/dev/null 2>/dev/null && list="bzr ls --kind=file --versioned"
+
+$list |grep $filter |while read f; 
 do
 	 etags -o TAGS --append $f
 done
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index aafa22bdf7fc32867eb98e2d375e36b95315114e..a043b87c294fe633041c8c6487cfed904e4d8b00 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -17594,6 +17594,36 @@ static void test_wl4166_2()
 
 }
 
+/**
+  Bug#38486 Crash when using cursor protocol
+*/
+
+static void test_bug38486(void)
+{
+  MYSQL_STMT *stmt;
+  const char *stmt_text;
+  unsigned long type= CURSOR_TYPE_READ_ONLY;
+
+  DBUG_ENTER("test_bug38486");
+  myheader("test_bug38486");
+
+  stmt= mysql_stmt_init(mysql);
+  mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
+  stmt_text= "CREATE TABLE t1 (a INT)";
+  mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+  mysql_stmt_execute(stmt);
+  mysql_stmt_close(stmt);
+
+  stmt= mysql_stmt_init(mysql);
+  mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
+  stmt_text= "INSERT INTO t1 VALUES (1)";
+  mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+  mysql_stmt_execute(stmt);
+  mysql_stmt_close(stmt);
+
+  DBUG_VOID_RETURN;
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -17902,6 +17932,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug28386", test_bug28386 },
   { "test_wl4166_1", test_wl4166_1 },
   { "test_wl4166_2", test_wl4166_2 },
+  { "test_bug38486", test_bug38486 },
   { 0, 0 }
 };