List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:August 18 2008 6:48pm
Subject:bzr commit into mysql-6.0 branch (sven:2703) Bug#18817 Bug#21226 Bug#29738
Bug#31605 Bug#33362 Bug#34159 Bug#34286 Bug#35220 Bug#35352 Bug#35808
Bug...
View as plain text  
#At file:///home/sven/bzr/merge/6.0-rpl_from_5.1-rpl/

 2703 Sven Sandberg	2008-08-18 [merge]
      please ignore - temporary commit
removed:
  mysql-test/include/multi_range_count_basic.inc
  mysql-test/include/wait_timeout_basic.inc
  mysql-test/r/multi_range_count_basic_32.result
  mysql-test/r/multi_range_count_basic_64.result
  mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt
  mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt
  mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt
  mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc
  mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc
  mysql-test/suite/sys_vars/r/rpl_sync_binlog_basic_64.result.OTHER
  mysql-test/suite/sys_vars/t/rpl_sync_binlog_basic_64.test
  mysql-test/t/multi_range_count_basic_32.test
  mysql-test/t/multi_range_count_basic_64.test
added:
  mysql-test/include/analyze-timeout.test
  mysql-test/r/innodb-autoinc-optimize.result
  mysql-test/r/innodb_bug35220.result
  mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc
  mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc
  mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc
  mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result
  mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result
  mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test
  mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test
  mysql-test/t/innodb-autoinc-optimize.test
  mysql-test/t/innodb_bug35220.test
renamed:
  mysql-test/include/have_federated_db.inc => mysql-test/suite/federated/have_federated_db.inc
  mysql-test/lib/mtr_unique.pl => mysql-test/lib/mtr_unique.pm
  mysql-test/r/innodb_bug35220.result => mysql-test/r/innodb_bug35220.result.moved
  mysql-test/t/innodb_bug35220.test => mysql-test/t/innodb_bug35220.test.moved
modified:
  client/Makefile.am
  client/mysql_upgrade.c
  client/mysqltest.cc
  config/ac-macros/character_sets.m4
  libmysqld/examples/CMakeLists.txt
  mysql-test/Makefile.am
  mysql-test/extra/binlog_tests/binlog_insert_delayed.test
  mysql-test/include/check-warnings.test
  mysql-test/include/mtr_warnings.sql
  mysql-test/include/restart_mysqld.inc
  mysql-test/include/show_binlog_events.inc
  mysql-test/lib/My/Platform.pm
  mysql-test/lib/My/SafeProcess.pm
  mysql-test/lib/mtr_io.pl
  mysql-test/mysql-test-run.pl
  mysql-test/r/func_if.result
  mysql-test/r/subselect.result
  mysql-test/suite/binlog/r/binlog_killed_simulate.result
  mysql-test/suite/binlog/r/binlog_row_binlog.result
  mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
  mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
  mysql-test/suite/binlog/r/binlog_stm_binlog.result
  mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
  mysql-test/suite/funcs_1/triggers/triggers_03.inc
  mysql-test/suite/funcs_1/triggers/triggers_08.inc
  mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc
  mysql-test/suite/rpl/r/rpl_loaddata_map.result
  mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
  mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
  mysql-test/suite/rpl/r/rpl_stm_log.result
  mysql-test/suite/rpl/r/rpl_variables.result
  mysql-test/suite/rpl/t/disabled.def
  mysql-test/suite/rpl/t/rpl_incident.test
  mysql-test/suite/rpl/t/rpl_loaddata_map.test
  mysql-test/suite/rpl/t/rpl_trunc_temp.test
  mysql-test/suite/rpl/t/rpl_variables.test
  mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test
  mysql-test/suite/rpl_ndb_big/r/rpl_row_basic_7ndb.result
  mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test
  mysql-test/t/disabled.def
  mysql-test/t/func_if.test
  mysql-test/t/partition_federated.test
  mysql-test/t/subselect.test
  sql/field.h
  sql/item.cc
  sql/item.h
  sql/item_cmpfunc.cc
  sql/item_func.cc
  sql/mysql_priv.h
  sql/share/errmsg.txt
  sql/sp_head.cc
  sql/sql_acl.cc
  sql/sql_base.cc
  sql/sql_lex.h
  sql/sql_list.h
  sql/sql_parse.cc
  sql/sql_select.cc
  sql/sql_string.h
  sql/table.cc
  sql/table.h
  support-files/build-tags*
  tests/mysql_client_test.c
  mysql-test/lib/mtr_unique.pm

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2008-08-08 17:55:07 +0000
+++ b/client/Makefile.am	2008-08-18 16:47:28 +0000
@@ -92,7 +92,8 @@ mysqltest_LDADD =		$(CXXLDFLAGS) $(CLIEN
 				@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

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2008-05-02 17:42:34 +0000
+++ b/client/mysql_upgrade.c	2008-08-11 22:44:13 +0000
@@ -269,6 +269,10 @@ get_one_option(int optid, const struct m
 }
 
 
+/**
+  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, DYN
 }
 
 
-/*
-  Try to get the full path to this exceutable
-
-  Return 0 if path found
-
+/**
+  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 my_bool get_full_path_to_executable(char* path)
+static void find_tool(char *tool_executable_name, const char *tool_name, 
+                      const char *self_name)
 {
-  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.
-*/
-
-static void find_tool(char *tool_path, const char *tool_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, c
   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

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2008-08-08 17:55:07 +0000
+++ b/client/mysqltest.cc	2008-08-18 16:47:28 +0000
@@ -480,7 +480,7 @@ void free_all_replace(){
 class LogFile {
   FILE* m_file;
   char m_file_name[FN_REFLEN];
-  uint m_bytes_written;
+  size_t m_bytes_written;
 public:
   LogFile() : m_file(NULL), m_bytes_written(0) {
     bzero(m_file_name, sizeof(m_file_name));
@@ -491,7 +491,7 @@ public:
   }
 
   const char* file_name() const { return m_file_name; }
-  uint bytes_written() const { return m_bytes_written; }
+  size_t bytes_written() const { return m_bytes_written; }
 
   void open(const char* dir, const char* name, const char* ext)
   {
@@ -510,7 +510,7 @@ public:
 
     DBUG_PRINT("info", ("file_name: %s", m_file_name));
 
-    if ((m_file= fopen(m_file_name, "w+")) == NULL)
+    if ((m_file= fopen(m_file_name, "wb+")) == NULL)
       die("Failed to open log file %s, errno: %d", m_file_name, errno);
 
     DBUG_VOID_RETURN;
@@ -539,8 +539,8 @@ public:
     DBUG_ASSERT(ds->str);
 
     if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)
-      die("Failed to write %d bytes to '%s', errno: %d",
-          ds->length, m_file_name, errno);
+      die("Failed to write %lu bytes to '%s', errno: %d",
+          (unsigned long)ds->length, m_file_name, errno);
     m_bytes_written+= ds->length;
     DBUG_VOID_RETURN;
   }
@@ -578,7 +578,8 @@ public:
         DBUG_VOID_RETURN;
       }
 
-      DBUG_PRINT("info", ("Read %d bytes from file, buf: %s", bytes, buf));
+      DBUG_PRINT("info", ("Read %lu bytes from file, buf: %s",
+                          (unsigned long)bytes, buf));
 
       char* show_from= buf + bytes;
       while(show_from > buf && lines > 0 )
@@ -2284,7 +2285,7 @@ void eval_expr(VAR *v, const char *p, co
     const char* end= *p_end + 1;
     if (end < expected_end)
       die("Found junk '%.*s' after $variable in expression",
-          expected_end - end - 1, end);
+          (int)(expected_end - end - 1), end);
 
     DBUG_VOID_RETURN;
   }
@@ -4136,7 +4137,7 @@ void do_shutdown_server(struct st_comman
   /* Check that server dies */
   while(timeout--){
     if (my_kill(0, pid) < 0){
-      DBUG_PRINT("info", ("Sleeping, timeout: %d", timeout));
+      DBUG_PRINT("info", ("Process %d does not exist anymore", pid));
       break;
     }
     DBUG_PRINT("info", ("Sleeping, timeout: %d", timeout));
@@ -5934,7 +5935,7 @@ void fix_win_paths(const char *val, int 
     DBUG_PRINT("info", ("pattern: %s", *pattern));
 
     /* Search for the path in string */
-    while ((p= strstr(val, *pattern)))
+    while ((p= strstr((char*)val, *pattern)))
     {
       DBUG_PRINT("info", ("Found %s in val p: %s", *pattern, p));
 

=== modified file 'config/ac-macros/character_sets.m4'
--- a/config/ac-macros/character_sets.m4	2008-02-26 19:54:19 +0000
+++ b/config/ac-macros/character_sets.m4	2008-08-18 16:47:28 +0000
@@ -358,8 +358,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_sinhala_ci ucs2_slovak_ci ucs2_slovenian_ci)
       define(UCSC7, ucs2_spanish2_ci ucs2_spanish_ci)
@@ -394,6 +394,7 @@ case $default_charset in 
         UTFC="utf8mb3_general_cs"
         AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer])
       else
+|<<<<<<< TREE
         define(UTFC1, utf8mb3_general_ci utf8mb3_bin)
         define(UTFC2, utf8mb3_czech_ci utf8mb3_danish_ci)
         define(UTFC3, utf8mb3_esperanto_ci utf8mb3_estonian_ci utf8mb3_icelandic_ci)
@@ -403,6 +404,17 @@ case $default_charset in 
         define(UTFC7, utf8mb3_spanish2_ci utf8mb3_spanish_ci)
         define(UTFC8, utf8mb3_swedish_ci utf8mb3_turkish_ci)
         define(UTFC9, utf8mb3_unicode_ci)
+|=======
+        define(UTFC1, utf8_general_ci utf8_bin)
+        define(UTFC2, utf8_czech_ci utf8_danish_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)
+        define(UTFC8, utf8_swedish_ci utf8_turkish_ci)
+        define(UTFC9, utf8_unicode_ci)
+|>>>>>>> MERGE-SOURCE
         UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
       fi
       default_charset_collations="$UTFC"

=== modified file 'libmysqld/examples/CMakeLists.txt'
--- a/libmysqld/examples/CMakeLists.txt	2008-08-08 17:55:07 +0000
+++ b/libmysqld/examples/CMakeLists.txt	2008-08-18 16:47:28 +0000
@@ -32,7 +32,12 @@ ADD_EXECUTABLE(mysql_embedded ../../clie
 TARGET_LINK_LIBRARIES(mysql_embedded mysys yassl taocrypt zlib debug dbug regex strings ws2_32)
 ADD_DEPENDENCIES(mysql_embedded libmysqld)
 
+|<<<<<<< TREE
 TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib debug dbug regex strings ws2_32)
+|=======
+ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc)
+TARGET_LINK_LIBRARIES(mysqltest_embedded mysys yassl taocrypt zlib debug dbug regex strings wsock32)
+|>>>>>>> MERGE-SOURCE
 ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
 
 ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c)

=== modified file 'mysql-test/Makefile.am'
--- a/mysql-test/Makefile.am	2008-08-04 14:30:50 +0000
+++ b/mysql-test/Makefile.am	2008-08-18 16:47:28 +0000
@@ -33,7 +33,7 @@ nobase_test_DATA = lib/mtr_cases.pm \
 	lib/mtr_process.pl \
 	lib/mtr_report.pm \
 	lib/mtr_stress.pl \
-	lib/mtr_unique.pl \
+	lib/mtr_unique.pm \
 	lib/My/ConfigFactory.pm \
 	lib/My/Config.pm \
 	lib/My/Find.pm \

=== modified file 'mysql-test/extra/binlog_tests/binlog_insert_delayed.test'
--- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test	2007-03-29 19:38:03 +0000
+++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test	2008-07-23 16:56:39 +0000
@@ -1,17 +1,43 @@
-# Test of binlogging of INSERT_ID with INSERT DELAYED
+# ==== Purpose ====
+#
+# Verify that INSERT DELAYED in mixed or row mode writes events to the
+# binlog, and that AUTO_INCREMENT works correctly.
+#
+# ==== Method ====
+#
+# Insert both single and multiple rows into an autoincrement column,
+# both with specified value and with NULL.
+#
+# With INSERT DELAYED, the rows do not show up in the table
+# immediately, so we must do source include/wait_until_rows_count.inc
+# between any two INSERT DELAYED statements.  Moreover, if mixed or
+# row-based logging is used, there is also a delay between when rows
+# show up in the table and when they show up in the binlog.  To ensure
+# that the rows show up in the binlog, we call FLUSH TABLES, which
+# waits until the delayed_insert thread has finished.
+#
+# We cannot read the binlog after executing INSERT DELAYED statements
+# that insert multiple rows, because that is nondeterministic. More
+# precisely, rows may be written in batches to the binlog, where each
+# batch has one Table_map_log_event and one or more
+# Write_rows_log_event. The number of rows included in each batch is
+# nondeterministic.
+#
+# ==== Related bugs ====
+#
+# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
+# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
+
+
 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-# First, avoid BUG#20627:
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
-# Verify that only one INSERT_ID event is binlogged.
-# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
-let $table=t1;
-let $rows_inserted=11; # total number of inserted rows in this test
-insert delayed into t1 values (207);
-let $count=1;
 
-# use this macro instead of sleeps.
+let $table=t1;
+let $count=0;
 
+insert delayed into t1 values (207);
+inc $count;
 --source include/wait_until_rows_count.inc
+
 insert delayed into t1 values (null);
 inc $count;
 --source include/wait_until_rows_count.inc
@@ -20,9 +46,10 @@ insert delayed into t1 values (300);
 inc $count;
 --source include/wait_until_rows_count.inc
 
-# moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps)
-# todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in
-# the way
+# It is not enough to wait until all rows have been inserted into the
+# table. FLUSH TABLES ensures that they are in the binlog too.  See
+# comment above.
+FLUSH TABLES;
 source include/show_binlog_events.inc;
 
 insert delayed into t1 values (null),(null),(null),(null);
@@ -33,8 +60,5 @@ insert delayed into t1 values (null),(nu
 inc $count; inc $count; inc $count; inc $count;
 --source include/wait_until_rows_count.inc
 
-#check this assertion about $count calculation
---echo $count == $rows_inserted
-
 select * from t1;
 drop table t1;

=== added file 'mysql-test/include/analyze-timeout.test'
--- a/mysql-test/include/analyze-timeout.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/analyze-timeout.test	2008-08-09 09:33:59 +0000
@@ -0,0 +1 @@
+SHOW PROCESSLIST;

=== modified file 'mysql-test/include/check-warnings.test'
--- a/mysql-test/include/check-warnings.test	2008-04-09 12:38:42 +0000
+++ b/mysql-test/include/check-warnings.test	2008-08-09 09:29:35 +0000
@@ -8,5 +8,6 @@ call mtr.check_warnings(@result);
 if (`select @result = 0`){
   skip OK;
 }
-echo Found warnings;
 --enable_query_log
+echo ^ Found warnings!!;
+exit;

=== modified file 'mysql-test/include/mtr_warnings.sql'
--- a/mysql-test/include/mtr_warnings.sql	2008-06-16 10:53:57 +0000
+++ b/mysql-test/include/mtr_warnings.sql	2008-08-18 16:47:28 +0000
@@ -277,7 +277,7 @@ BEGIN
     SELECT @log_error;
     SELECT line as log_error
         FROM suspect_lines WHERE supressed=0;
-    SELECT * FROM test_supressions;
+    --SELECT * FROM test_supressions;
     -- Return 2 -> check failed
     SELECT 2 INTO result;
   ELSE

=== removed file 'mysql-test/include/multi_range_count_basic.inc'
--- a/mysql-test/include/multi_range_count_basic.inc	2008-05-08 18:13:39 +0000
+++ b/mysql-test/include/multi_range_count_basic.inc	1970-01-01 00:00:00 +0000
@@ -1,219 +0,0 @@
-############## mysql-test\t\multi_range_count_basic.test ###############
-#                                                                             #
-# Variable Name: multi_range_count                                            #
-# Scope: GLOBAL | SESSION                                                     #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value:  256                                                         #
-# Range:1-4294967295                                                          #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Salman                                                             #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable multi_range_count        #
-#              that checks the behavior of this variable in the following ways#
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
-#                                                                             #
-###############################################################################
-
---source include/load_sysvars.inc
-
-#################################################################
-#           START OF multi_range_count TESTS                    #
-#################################################################
-
-
-#############################################################
-#                 Save initial value                        #
-#############################################################
-
-SET @start_global_value = @@global.multi_range_count;
-SELECT @start_global_value;
-SET @start_session_value = @@session.multi_range_count;
-SELECT @start_session_value;
-
-
---echo '#--------------------FN_DYNVARS_090_01-------------------------#'
-#################################################################
-#     Display the DEFAULT value of multi_range_count            #
-#################################################################
-
-SET @@global.multi_range_count = 100;
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count;
-
-SET @@session.multi_range_count = 200;
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count;
-
-
---echo '#--------------------FN_DYNVARS_090_02-------------------------#'
-#################################################################
-#     Check the DEFAULT value of multi_range_count              #
-#################################################################
-
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count = 256;
-
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count = 256;
-
-
---echo '#--------------------FN_DYNVARS_090_03-------------------------#'
-###########################################################################
-# Change the value of multi_range_count to a valid value for GLOBAL Scope #
-###########################################################################
-
-SET @@global.multi_range_count = 1;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 60020;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 65535;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 4294967295;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 4294967294;
-SELECT @@global.multi_range_count;
-
-
-
---echo '#--------------------FN_DYNVARS_090_04-------------------------#'
-############################################################################
-# Change the value of multi_range_count to a valid value for SESSION Scope #
-############################################################################
- 
-SET @@session.multi_range_count = 1;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = 50050;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = 65535;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = 4294967295;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = 4294967294;
-SELECT @@session.multi_range_count;
-
-
---echo '#------------------FN_DYNVARS_090_05-----------------------#'
-#############################################################
-# Change the value of multi_range_count to an invalid value #
-#############################################################
-
-SET @@global.multi_range_count = 0;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 4294967296;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = -1024;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = 429496729500;
-SELECT @@global.multi_range_count;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.multi_range_count = 65530.34;
-SELECT @@global.multi_range_count;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.multi_range_count = test;
-SELECT @@global.multi_range_count;
-
-SET @@session.multi_range_count = 0;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = 4294967296;
-SELECT @@session.multi_range_count;
-SET @@session.multi_range_count = -1;
-SELECT @@session.multi_range_count;
---Error ER_PARSE_ERROR
-SET @@session.multi_range_count = 65530.34.;
-SET @@session.multi_range_count = 4294967295021;
-SELECT @@session.multi_range_count;
---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.multi_range_count = test;
-SELECT @@session.multi_range_count;
-
-
---echo '#------------------FN_DYNVARS_090_06-----------------------#'
-####################################################################
-#   Check if the value in GLOBAL Table matches value in variable   #
-####################################################################
-
-
-SELECT @@global.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-
---echo '#------------------FN_DYNVARS_090_07-----------------------#'
-####################################################################
-#  Check if the value in SESSION Table matches value in variable   #
-####################################################################
-
-SELECT @@session.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-
-
---echo '#------------------FN_DYNVARS_090_08-----------------------#'
-####################################################################
-#     Check if TRUE and FALSE values can be used on variable       #
-####################################################################
-
-SET @@global.multi_range_count = TRUE;
-SELECT @@global.multi_range_count;
-SET @@global.multi_range_count = FALSE;
-SELECT @@global.multi_range_count;
-
-
---echo '#---------------------FN_DYNVARS_090_09----------------------#'
-################################################################################# 
-#  Check if accessing variable with and without GLOBAL point to same variable   #
-################################################################################# 
-
-SET @@global.multi_range_count = 10;
-SELECT @@multi_range_count = @@global.multi_range_count;
-
-
---echo '#---------------------FN_DYNVARS_090_10----------------------#'
-########################################################################################################
-#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
-########################################################################################################
-
-SET @@multi_range_count = 100;
-SELECT @@multi_range_count = @@local.multi_range_count;
-SELECT @@local.multi_range_count = @@session.multi_range_count;
-
-
---echo '#---------------------FN_DYNVARS_090_11----------------------#'
-############################################################################  
-#   Check if multi_range_count can be accessed with and without @@ sign    #
-############################################################################
-
-SET multi_range_count = 1;
-SELECT @@multi_range_count;
---Error ER_UNKNOWN_TABLE
-SELECT local.multi_range_count;
---Error ER_UNKNOWN_TABLE
-SELECT session.multi_range_count;
---Error ER_BAD_FIELD_ERROR
-SELECT multi_range_count = @@session.multi_range_count;
-
-
-####################################
-#     Restore initial value        #
-####################################
-
-SET @@global.multi_range_count = @start_global_value;
-SELECT @@global.multi_range_count;
-SET @@session.multi_range_count = @start_session_value;
-SELECT @@session.multi_range_count;
-
-
-######################################################
-#                 END OF multi_range_count TESTS     #
-######################################################
-

=== modified file 'mysql-test/include/restart_mysqld.inc'
--- a/mysql-test/include/restart_mysqld.inc	2008-04-21 15:39:13 +0000
+++ b/mysql-test/include/restart_mysqld.inc	2008-08-09 09:16:12 +0000
@@ -1,13 +1,21 @@
 
-# Write file to make mysql-test-run.pl expect crash and restart
+# Write file to make mysql-test-run.pl expect the "crash", but don't start
+# it until it's told to
 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart
+wait
 EOF
 
 # Send shutdown to the connected server and give
 # it 10 seconds to die before zapping it
 shutdown_server 10;
 
+# Check server is gone
+--source include/wait_until_disconnected.inc
+
+# Write file to make mysql-test-run.pl start up the server again
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
 
 # Turn on reconnect
 --enable_reconnect

=== modified file 'mysql-test/include/show_binlog_events.inc'
--- a/mysql-test/include/show_binlog_events.inc	2008-06-10 22:27:52 +0000
+++ b/mysql-test/include/show_binlog_events.inc	2008-08-18 16:47:28 +0000
@@ -4,7 +4,7 @@ if (!$binlog_start)
 {
   let $binlog_start=107;
 }
---replace_result $binlog_start <binlog_start>
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
 --replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/
+--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
 --eval show binlog events from $binlog_start

=== removed file 'mysql-test/include/wait_timeout_basic.inc'
--- a/mysql-test/include/wait_timeout_basic.inc	2008-05-08 18:13:39 +0000
+++ b/mysql-test/include/wait_timeout_basic.inc	1970-01-01 00:00:00 +0000
@@ -1,218 +0,0 @@
-############## mysql-test\t\wait_timeout_basic.test ###########################
-#                                                                             #
-# Variable Name: wait_timeout                                                 #
-# Scope: GLOBAL | SESSION                                                     #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value:                                                              #
-# Range:                                                                      #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Sharique Abdullah                                                      #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable wait_timeout             #
-#              that checks the behavior of this variable in the following ways#
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html#option_mysqld_wait_timeouts                   #
-#                                                                             #
-###############################################################################
-# Due to differnces between linux and windows in the results
-
---source include/not_windows.inc
---source include/load_sysvars.inc
-
-############################################################
-#           START OF wait_timeout TESTS                    #
-############################################################
-
-#############################################################
-#                 Save initial value                        #
-#############################################################
-
-SET @start_global_value = @@global.wait_timeout;
-SET @start_session_value = @@session.wait_timeout;
-
---echo '#--------------------FN_DYNVARS_005_01-------------------------#'
-############################################################
-#     Display the DEFAULT value of wait_timeout            #
-############################################################
-
-SET @@global.wait_timeout = 100;
-SET @@global.wait_timeout = DEFAULT;
-SELECT @@global.wait_timeout;
-
-SET @@session.wait_timeout = 200;
-SET @@session.wait_timeout = DEFAULT;
-SELECT @@session.wait_timeout;
-
-
---echo '#--------------------FN_DYNVARS_005_02-------------------------#'
-############################################################
-#     Check the DEFAULT value of wait_timeout              #
-############################################################
-
-SET @@global.wait_timeout = DEFAULT;
-SELECT @@global.wait_timeout = @default_wait_timeout;
-
-SET @@session.wait_timeout = DEFAULT;
-SELECT @@session.wait_timeout = @default_wait_timeout;
-
-
-
---echo '#--------------------FN_DYNVARS_005_03-------------------------#'
-######################################################################
-# Change the value of wait_timeout to a valid value for GLOBAL Scope #
-######################################################################
-
-#SET @@global.wait_timeout= @min_wait_timeout;
-SET @@global.wait_timeout= 1;
-SELECT @@global.wait_timeout;
-
-SET @@global.wait_timeout = 60020;
-SELECT @@global.wait_timeout;
-
-#SET @@global.wait_timeout = @max_wait_timeout;
-SET @@global.wait_timeout = 31536000;
-SELECT @@global.wait_timeout = @max_wait_timeout;
-
-
---echo '#--------------------FN_DYNVARS_005_04-------------------------#'
-#######################################################################
-# Change the value of wait_timeout to a valid value for SESSION Scope #
-#######################################################################
-#SET @@session.wait_timeout = @min_wait_timeout;
-#SELECT @@session.wait_timeout;
-
-SET @@session.wait_timeout =6000;
-SELECT @@session.wait_timeout;
-
-#SET @@session.wait_timeout = @max_wait_timeout;
-#SELECT @@session.wait_timeout = @max_wait_timeout;
-
-
---echo '#------------------FN_DYNVARS_005_05-----------------------#'
-########################################################
-# Change the value of wait_timeout to an invalid value #
-########################################################
-
-SET @@global.wait_timeout = 0;
-SET @@global.wait_timeout = -1024;
-
---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = ON;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = OFF;
-
-SET @@global.wait_timeout = True;
-SELECT @@global.wait_timeout;
-
-SET @@global.wait_timeout = False;
-SELECT @@global.wait_timeout;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout = 65530.34;
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.wait_timeout ="Test";
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = ON;
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = OFF;
-
-SET @@session.wait_timeout = True;
-SELECT @@session.wait_timeout;
-
-SET @@session.wait_timeout = False;
-SELECT @@session.wait_timeout;
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = "Test";
-
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@session.wait_timeout = 'test';
-
-SET @@session.wait_timeout = 123456789031;
-SELECT @@session.wait_timeout = @max_wait_timeout;
-
-
---echo '#------------------FN_DYNVARS_005_06-----------------------#'
-####################################################################
-#   Check if the value in GLOBAL Table matches value in variable   #
-####################################################################
-
-SELECT @@global.wait_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='wait_timeout';
-
---echo '#------------------FN_DYNVARS_005_07-----------------------#'
-####################################################################
-#  Check if the value in SESSION Table matches value in variable   #
-####################################################################
-
-SELECT @@session.wait_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
-WHERE VARIABLE_NAME='wait_timeout';
-
---echo '#---------------------FN_DYNVARS_001_09----------------------#'
-###########################################################################
-#  Check if global and session variable are independent of each other     #
-###########################################################################
-
-SET @@global.wait_timeout = 30000;
-SET @@global.wait_timeout = 40000;
-SELECT @@wait_timeout = @@global.wait_timeout;
-
---echo '#---------------------FN_DYNVARS_001_10----------------------#'
-########################################################################
-#    Check if accessing variable with SESSION,LOCAL and without SCOPE  #
-#    points to same session variable                                   #
-########################################################################
-
-SET @@wait_timeout = 100;
-SELECT @@wait_timeout = @@local.wait_timeout;
-SELECT @@local.wait_timeout = @@session.wait_timeout;
-
---echo '#---------------------FN_DYNVARS_001_11----------------------#'
-#######################################################################
-#   Check if wait_timeout can be accessed with and without @@ sign    #
-#######################################################################
-
-SET wait_timeout = 1027;
-SELECT @@wait_timeout;
-
-
---Error ER_UNKNOWN_TABLE
-SELECT local.wait_timeout;
-
---Error ER_UNKNOWN_TABLE
-SELECT session.wait_timeout;
-
---Error ER_BAD_FIELD_ERROR
-SELECT wait_timeout = @@session.wait_timeout;
-
-
-####################################
-#     Restore initial value        #
-####################################
-
-SET @@global.wait_timeout = @start_global_value;
-SET @@session.wait_timeout = @start_session_value;
-
-#################################################
-#                 END OF wait_timeout TESTS     #
-#################################################

=== modified file 'mysql-test/lib/My/Platform.pm'
--- a/mysql-test/lib/My/Platform.pm	2008-04-22 19:55:09 +0000
+++ b/mysql-test/lib/My/Platform.pm	2008-08-11 08:41:23 +0000
@@ -21,7 +21,7 @@ use strict;
 use base qw(Exporter);
 our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
 		native_path posix_path mixed_path
-                check_socket_path_length);
+                check_socket_path_length process_alive);
 
 BEGIN {
   if ($^O eq "cygwin") {
@@ -66,7 +66,9 @@ sub mixed_path {
   my ($path)= @_;
   if (IS_CYGWIN){
     return unless defined $path;
-    $path= `cygpath -m $path`;
+    my $cmd= "cygpath -m $path";
+    print "$cmd\n";
+    $path= `$cmd`;
     chomp $path;
   }
   return $path;
@@ -123,4 +125,16 @@ sub check_socket_path_length {
 }
 
 
+sub process_alive {
+  my ($pid)= @_;
+  die "usage: process_alive(pid)" unless $pid;
+
+  return kill(0, $pid) unless IS_WINDOWS;
+
+  my @list= split(/,/, `tasklist /FI "PID eq $pid" /NH /FO CSV`);
+  my $ret_pid= eval($list[1]);
+  return ($ret_pid == $pid);
+}
+
+
 1;

=== modified file 'mysql-test/lib/My/SafeProcess.pm'
--- a/mysql-test/lib/My/SafeProcess.pm	2008-04-27 19:31:32 +0000
+++ b/mysql-test/lib/My/SafeProcess.pm	2008-08-10 17:46:43 +0000
@@ -100,17 +100,6 @@ else
 }
 
 
-sub _process_alive {
-  my ($pid)= @_;
-
-  return kill(0, $pid) unless IS_WINDOWS;
-
-  my @list= split(/,/, `tasklist /FI "PID eq $pid" /NH /FO CSV`);
-  my $ret_pid= eval($list[1]);
-  return ($ret_pid == $pid);
-}
-
-
 sub new {
   my $class= shift;
 

=== modified file 'mysql-test/lib/mtr_io.pl'
--- a/mysql-test/lib/mtr_io.pl	2008-07-24 18:26:12 +0000
+++ b/mysql-test/lib/mtr_io.pl	2008-08-18 16:47:28 +0000
@@ -26,8 +26,12 @@ sub mtr_tonewfile($@);
 sub mtr_appendfile_to_file ($$);
 sub mtr_grab_file($);
 sub mtr_printfile($);
+|<<<<<<< TREE
 sub mtr_lastlinefromfile($);
 
+|=======
+sub mtr_lastlinefromfile ($);
+|>>>>>>> MERGE-SOURCE
 
 # Read a whole file, stripping leading and trailing whitespace.
 sub mtr_fromfile ($) {

=== renamed file 'mysql-test/lib/mtr_unique.pl' => 'mysql-test/lib/mtr_unique.pm'
--- a/mysql-test/lib/mtr_unique.pl	2007-04-05 12:05:10 +0000
+++ b/mysql-test/lib/mtr_unique.pm	2008-08-18 16:47:28 +0000
@@ -14,165 +14,172 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#
-# This file is used from mysql-test-run.pl when choosing
-# port numbers and directories to use for running mysqld.
-#
+package mtr_unique;
 
 use strict;
 use Fcntl ':flock';
 
-#
-# Requested IDs are stored in a hash and released upon END.
-#
-my %mtr_unique_assigned_ids = ();
-my $mtr_unique_pid;
-BEGIN {
-	$mtr_unique_pid = $$ unless defined $mtr_unique_pid;
+use base qw(Exporter);
+our @EXPORT= qw(mtr_get_unique_id mtr_release_unique_id);
+
+use My::Platform;
+
+sub msg {
+ # print "### unique($$) - ", join(" ", @_), "\n";
 }
-END { 
-	if($mtr_unique_pid == $$) {
-		while(my ($id,$file) = each(%mtr_unique_assigned_ids)) {
-			print "Autoreleasing $file:$id\n";
-			mtr_release_unique_id($file, $id);
-		}
-	}
+
+my $file= "/tmp/mysql-test-ports";
+
+my %mtr_unique_ids;
+
+END {
+  my $allocated_id= $mtr_unique_ids{$$};
+  if (defined $allocated_id)
+  {
+    mtr_release_unique_id($allocated_id);
+  }
+  delete $mtr_unique_ids{$$};
 }
 
 #
-# Require a unique, numerical ID, given a file name (where all
+# Get a unique, numerical ID, given a file name (where all
 # requested IDs are stored), a minimum and a maximum value.
 #
-# We use flock to implement locking for the ID file and ignore
-# possible problems arising from lack of support for it on 
-# some platforms (it should work on most, and the possible
-# race condition would occur rarely). The proper solution for
-# this is a daemon that manages IDs, of course.
-#
-# If no unique ID within the specified parameters can be 
+# If no unique ID within the specified parameters can be
 # obtained, return undef.
 #
-sub mtr_require_unique_id($$$) {
-	my $file = shift;
-	my $min = shift;
-	my $max = shift;
-	my $ret = undef;
-	my $changed = 0;
-
-	my $can_use_ps = `ps -e | grep '^[ ]*$$ '`;
-
-	if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-		die 'lock file is a symbolic link';
-	}
-
-	chmod 0777, "$file.sem";
-	open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-	flock SEM, LOCK_EX or die "can't lock $file.sem";
-	if(! -e $file) {
-		open FILE, ">", $file or die "can't create $file";
-		close FILE;
-	}
-
-	if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-		die 'lock file is a symbolic link';
-	}
-
-	chmod 0777, $file;
-	open FILE, "+<", $file or die "can't open $file";
-	select undef,undef,undef,0.2;
-	seek FILE, 0, 0;
-	my %taken = ();
-	while(<FILE>) {
-		chomp;
-		my ($id, $pid) = split / /;
-		$taken{$id} = $pid;
-		if($can_use_ps) {
-			my $res = `ps -e | grep '^[ ]*$pid '`;
-			if(!$res) {
-				print "Ignoring slot $id used by missing process $pid.\n";
-				delete $taken{$id};
-				++$changed;
-			}
-		}
-	}
-	for(my $i=$min; $i<=$max; ++$i) {
-		if(! exists $taken{$i}) {
-			$ret = $i;
-			$taken{$i} = $$;
-			++$changed;
-			last;
-		}
-	}
-	if($changed) {
-		seek FILE, 0, 0;
-		truncate FILE, 0 or die "can't truncate $file";
-		for my $k (keys %taken) {
-			print FILE $k . ' ' . $taken{$k} . "\n";
-		}
-	}
-	close FILE;
-	flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-	close SEM;
-	$mtr_unique_assigned_ids{$ret} = $file if defined $ret;
-	return $ret;
-}
+sub mtr_get_unique_id($$) {
+  my ($min, $max)= @_;;
 
-#
-# Require a unique ID like above, but sleep if no ID can be
-# obtained immediately.
-#
-sub mtr_require_unique_id_and_wait($$$) {
-	my $ret = mtr_require_unique_id($_[0],$_[1],$_[2]);
-	while(! defined $ret) {
-		sleep 30;
-		$ret = mtr_require_unique_id($_[0],$_[1],$_[2]);
-		print "Waiting for unique id to become available...\n" unless $ret;
-	}
-	return $ret;
+  msg("get, '$file', $min-$max");
+
+  die "Can only get one unique id per process!" if $mtr_unique_ids{$$};
+
+  my $ret = undef;
+  my $changed = 0;
+
+  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+    die 'lock file is a symbolic link';
+  }
+
+  chmod 0777, "$file.sem";
+  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
+  flock SEM, LOCK_EX or die "can't lock $file.sem";
+  if(! -e $file) {
+    open FILE, ">", $file or die "can't create $file";
+    close FILE;
+  }
+
+  msg("HAVE THE LOCK");
+
+  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+    die 'lock file is a symbolic link';
+  }
+
+  chmod 0777, $file;
+  open FILE, "+<", $file or die "can't open $file";
+  #select undef,undef,undef,0.2;
+  seek FILE, 0, 0;
+  my %taken = ();
+  while(<FILE>) {
+    chomp;
+    my ($id, $pid) = split / /;
+    $taken{$id} = $pid;
+    msg("taken: $id, $pid");
+    # Check if process with given pid is alive
+    if(!process_alive($pid)) {
+      print "Removing slot $id used by missing process $pid\n";
+      msg("Removing slot $id used by missing process $pid");
+      delete $taken{$id};
+      $changed++;
+    }
+  }
+  for(my $i=$min; $i<=$max; ++$i) {
+    if(! exists $taken{$i}) {
+      $ret = $i;
+      $taken{$i} = $$;
+      $changed++;
+      # Remember the id this process got
+      $mtr_unique_ids{$$}= $i;
+      msg(" got $i"); 
+      last;
+    }
+  }
+  if($changed) {
+    seek FILE, 0, 0;
+    truncate FILE, 0 or die "can't truncate $file";
+    for my $k (keys %taken) {
+      print FILE $k . ' ' . $taken{$k} . "\n";
+    }
+  }
+  close FILE;
+
+  msg("RELEASING THE LOCK");
+  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
+  close SEM;
+
+  return $ret;
 }
 
+
 #
 # Release a unique ID.
 #
-sub mtr_release_unique_id($$) {
-	my $file = shift;
-	my $myid = shift;
-
-	if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-		die 'lock file is a symbolic link';
-	}
-
-	open SEM, ">", "$file.sem" or die "can't write to $file.sem";
-	flock SEM, LOCK_EX or die "can't lock $file.sem";
-
-	if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
-		die 'lock file is a symbolic link';
-	}
-
-	if(! -e $file) {
-		open FILE, ">", $file or die "can't create $file";
-		close FILE;
-	}
-	open FILE, "+<", $file or die "can't open $file";
-	select undef,undef,undef,0.2;
-	seek FILE, 0, 0;
-	my %taken = ();
-	while(<FILE>) {
-		chomp;
-		my ($id, $pid) = split / /;
-		$taken{$id} = $pid;
-	}
-	delete $taken{$myid};
-	seek FILE, 0, 0;
-	truncate FILE, 0 or die "can't truncate $file";
-	for my $k (keys %taken) {
-		print FILE $k . ' ' . $taken{$k} . "\n";
-	}
-	close FILE;
-	flock SEM, LOCK_UN or warn "can't unlock $file.sem";
-	close SEM;
-	delete $mtr_unique_assigned_ids{$myid};
+sub mtr_release_unique_id($) {
+  my ($myid)= @_;
+
+  msg("release, $myid");
+
+
+  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+    die 'lock file is a symbolic link';
+  }
+
+  open SEM, ">", "$file.sem" or die "can't write to $file.sem";
+  flock SEM, LOCK_EX or die "can't lock $file.sem";
+
+  msg("HAVE THE LOCK");
+
+  if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+    die 'lock file is a symbolic link';
+  }
+
+  if(! -e $file) {
+    open FILE, ">", $file or die "can't create $file";
+    close FILE;
+  }
+  open FILE, "+<", $file or die "can't open $file";
+  #select undef,undef,undef,0.2;
+  seek FILE, 0, 0;
+  my %taken = ();
+  while(<FILE>) {
+    chomp;
+    my ($id, $pid) = split / /;
+    msg(" taken, $id $pid");
+    $taken{$id} = $pid;
+  }
+
+  if ($taken{$myid} != $$)
+  {
+    msg(" The unique id for this process does not match pid");
+  }
+
+
+  msg(" removing $myid");
+  delete $taken{$myid};
+  seek FILE, 0, 0;
+  truncate FILE, 0 or die "can't truncate $file";
+  for my $k (keys %taken) {
+    print FILE $k . ' ' . $taken{$k} . "\n";
+  }
+  close FILE;
+
+  msg("RELEASE THE LOCK");
+
+  flock SEM, LOCK_UN or warn "can't unlock $file.sem";
+  close SEM;
 }
 
+
 1;
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-08-08 17:55:07 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-08-18 16:47:28 +0000
@@ -53,6 +53,7 @@ use My::SysInfo;
 use mtr_cases;
 use mtr_report;
 use mtr_match;
+use mtr_unique;
 use IO::Socket::INET;
 use IO::Select;
 
@@ -60,7 +61,6 @@ require "lib/mtr_process.pl";
 require "lib/mtr_io.pl";
 require "lib/mtr_gcov.pl";
 require "lib/mtr_misc.pl";
-require "lib/mtr_unique.pl";
 
 $SIG{INT}= sub { mtr_error("Got ^C signal"); };
 
@@ -144,7 +144,7 @@ our $opt_client_debugger;
 my $config; # The currently running config
 my $current_config_name; # The currently running config file template
 
-my $opt_baseport;
+my $baseport;
 my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
 
 my $opt_record;
@@ -1192,24 +1192,26 @@ sub set_build_thread_ports($) {
 
   if ( lc($build_thread) eq 'auto' ) {
     mtr_report("Requesting build thread... ");
-    $build_thread=
-      mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
+    $build_thread= mtr_get_unique_id(250, 299);
+    if ( !defined $build_thread ) {
+      mtr_error("Could not get a unique build thread id");
+    }
     mtr_report(" - got $build_thread");
   }
   $ENV{MTR_BUILD_THREAD}= $build_thread;
   $opt_build_thread= $build_thread;
 
   # Calculate baseport
-  $opt_baseport= $build_thread * 10 + 10000;
-  if ( $opt_baseport < 5001 or $opt_baseport + 9 >= 32767 )
+  $baseport= $build_thread * 10 + 10000;
+  if ( $baseport < 5001 or $baseport + 9 >= 32767 )
   {
     mtr_error("MTR_BUILD_THREAD number results in a port",
               "outside 5001 - 32767",
-              "($opt_baseport - $opt_baseport + 9)");
+              "($baseport - $baseport + 9)");
   }
 
   mtr_report("Using MTR_BUILD_THREAD $build_thread,",
-	     "with reserved ports $opt_baseport..".($opt_baseport+9));
+	     "with reserved ports $baseport..".($baseport+9));
 
 }
 
@@ -2328,7 +2330,7 @@ sub kill_leftovers ($) {
 sub check_ports_free
 {
   my @ports_to_check;
-  for ($opt_baseport..$opt_baseport+9){
+  for ($baseport..$baseport+9){
     push(@ports_to_check, $_);
   }
   mtr_report("Checking ports...");
@@ -2979,7 +2981,7 @@ sub run_testcase ($) {
 	   extra_template_path => $tinfo->{extra_template_path},
 	   vardir          => $opt_vardir,
 	   tmpdir          => $opt_tmpdir,
-	   baseport        => $opt_baseport,
+	   baseport        => $baseport,
 	   #hosts          => [ 'host1', 'host2' ],
 	   user            => $opt_user,
 	   password        => '',

=== modified file 'mysql-test/r/func_if.result'
--- a/mysql-test/r/func_if.result	2008-02-12 19:09:16 +0000
+++ b/mysql-test/r/func_if.result	2008-07-31 09:50:24 +0000
@@ -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

=== added file 'mysql-test/r/innodb-autoinc-optimize.result'
--- a/mysql-test/r/innodb-autoinc-optimize.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb-autoinc-optimize.result	2008-07-31 21:47:57 +0000
@@ -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

=== added file 'mysql-test/r/innodb_bug35220.result'
--- a/mysql-test/r/innodb_bug35220.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug35220.result	2008-08-08 00:25:24 +0000
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;

=== renamed file 'mysql-test/r/innodb_bug35220.result' => 'mysql-test/r/innodb_bug35220.result.moved'
=== removed file 'mysql-test/r/multi_range_count_basic_32.result'
--- a/mysql-test/r/multi_range_count_basic_32.result	2008-05-08 18:13:39 +0000
+++ b/mysql-test/r/multi_range_count_basic_32.result	1970-01-01 00:00:00 +0000
@@ -1,192 +0,0 @@
-SET @start_global_value = @@global.multi_range_count;
-SELECT @start_global_value;
-@start_global_value
-256
-SET @start_session_value = @@session.multi_range_count;
-SELECT @start_session_value;
-@start_session_value
-256
-'#--------------------FN_DYNVARS_090_01-------------------------#'
-SET @@global.multi_range_count = 100;
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-256
-SET @@session.multi_range_count = 200;
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-256
-'#--------------------FN_DYNVARS_090_02-------------------------#'
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count = 256;
-@@global.multi_range_count = 256
-1
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count = 256;
-@@session.multi_range_count = 256
-1
-'#--------------------FN_DYNVARS_090_03-------------------------#'
-SET @@global.multi_range_count = 1;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 60020;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-60020
-SET @@global.multi_range_count = 65535;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-65535
-SET @@global.multi_range_count = 4294967295;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@global.multi_range_count = 4294967294;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967294
-'#--------------------FN_DYNVARS_090_04-------------------------#'
-SET @@session.multi_range_count = 1;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 50050;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-50050
-SET @@session.multi_range_count = 65535;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-65535
-SET @@session.multi_range_count = 4294967295;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295
-SET @@session.multi_range_count = 4294967294;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967294
-'#------------------FN_DYNVARS_090_05-----------------------#'
-SET @@global.multi_range_count = 0;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 4294967296;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@global.multi_range_count = -1024;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 429496729500;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '429496729500'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@global.multi_range_count = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@global.multi_range_count = test;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@session.multi_range_count = 0;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 4294967296;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295
-SET @@session.multi_range_count = -1;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 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
-SET @@session.multi_range_count = 4294967295021;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '4294967295021'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295
-'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-SET @@session.multi_range_count = test;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295
-'#------------------FN_DYNVARS_090_06-----------------------#'
-SELECT @@global.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-@@global.multi_range_count = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_090_07-----------------------#'
-SELECT @@session.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-@@session.multi_range_count = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_090_08-----------------------#'
-SET @@global.multi_range_count = TRUE;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = FALSE;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-'#---------------------FN_DYNVARS_090_09----------------------#'
-SET @@global.multi_range_count = 10;
-SELECT @@multi_range_count = @@global.multi_range_count;
-@@multi_range_count = @@global.multi_range_count
-0
-'#---------------------FN_DYNVARS_090_10----------------------#'
-SET @@multi_range_count = 100;
-SELECT @@multi_range_count = @@local.multi_range_count;
-@@multi_range_count = @@local.multi_range_count
-1
-SELECT @@local.multi_range_count = @@session.multi_range_count;
-@@local.multi_range_count = @@session.multi_range_count
-1
-'#---------------------FN_DYNVARS_090_11----------------------#'
-SET multi_range_count = 1;
-SELECT @@multi_range_count;
-@@multi_range_count
-1
-SELECT local.multi_range_count;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT session.multi_range_count;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT multi_range_count = @@session.multi_range_count;
-ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
-SET @@global.multi_range_count = @start_global_value;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-256
-SET @@session.multi_range_count = @start_session_value;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-256

=== removed file 'mysql-test/r/multi_range_count_basic_64.result'
--- a/mysql-test/r/multi_range_count_basic_64.result	2008-05-08 18:13:39 +0000
+++ b/mysql-test/r/multi_range_count_basic_64.result	1970-01-01 00:00:00 +0000
@@ -1,184 +0,0 @@
-SET @start_global_value = @@global.multi_range_count;
-SELECT @start_global_value;
-@start_global_value
-256
-SET @start_session_value = @@session.multi_range_count;
-SELECT @start_session_value;
-@start_session_value
-256
-'#--------------------FN_DYNVARS_090_01-------------------------#'
-SET @@global.multi_range_count = 100;
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-256
-SET @@session.multi_range_count = 200;
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-256
-'#--------------------FN_DYNVARS_090_02-------------------------#'
-SET @@global.multi_range_count = DEFAULT;
-SELECT @@global.multi_range_count = 256;
-@@global.multi_range_count = 256
-1
-SET @@session.multi_range_count = DEFAULT;
-SELECT @@session.multi_range_count = 256;
-@@session.multi_range_count = 256
-1
-'#--------------------FN_DYNVARS_090_03-------------------------#'
-SET @@global.multi_range_count = 1;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 60020;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-60020
-SET @@global.multi_range_count = 65535;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-65535
-SET @@global.multi_range_count = 4294967295;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967295
-SET @@global.multi_range_count = 4294967294;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967294
-'#--------------------FN_DYNVARS_090_04-------------------------#'
-SET @@session.multi_range_count = 1;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 50050;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-50050
-SET @@session.multi_range_count = 65535;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-65535
-SET @@session.multi_range_count = 4294967295;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295
-SET @@session.multi_range_count = 4294967294;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967294
-'#------------------FN_DYNVARS_090_05-----------------------#'
-SET @@global.multi_range_count = 0;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 4294967296;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-4294967296
-SET @@global.multi_range_count = -1024;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = 429496729500;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-429496729500
-SET @@global.multi_range_count = 65530.34;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-429496729500
-SET @@global.multi_range_count = test;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-429496729500
-SET @@session.multi_range_count = 0;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 4294967296;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967296
-SET @@session.multi_range_count = -1;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-1
-SET @@session.multi_range_count = 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
-SET @@session.multi_range_count = 4294967295021;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295021
-'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-SET @@session.multi_range_count = test;
-ERROR 42000: Incorrect argument type to variable 'multi_range_count'
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-4294967295021
-'#------------------FN_DYNVARS_090_06-----------------------#'
-SELECT @@global.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-@@global.multi_range_count = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_090_07-----------------------#'
-SELECT @@session.multi_range_count = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='multi_range_count';
-@@session.multi_range_count = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_090_08-----------------------#'
-SET @@global.multi_range_count = TRUE;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-SET @@global.multi_range_count = FALSE;
-Warnings:
-Warning	1292	Truncated incorrect multi_range_count value: '0'
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-1
-'#---------------------FN_DYNVARS_090_09----------------------#'
-SET @@global.multi_range_count = 10;
-SELECT @@multi_range_count = @@global.multi_range_count;
-@@multi_range_count = @@global.multi_range_count
-0
-'#---------------------FN_DYNVARS_090_10----------------------#'
-SET @@multi_range_count = 100;
-SELECT @@multi_range_count = @@local.multi_range_count;
-@@multi_range_count = @@local.multi_range_count
-1
-SELECT @@local.multi_range_count = @@session.multi_range_count;
-@@local.multi_range_count = @@session.multi_range_count
-1
-'#---------------------FN_DYNVARS_090_11----------------------#'
-SET multi_range_count = 1;
-SELECT @@multi_range_count;
-@@multi_range_count
-1
-SELECT local.multi_range_count;
-ERROR 42S02: Unknown table 'local' in field list
-SELECT session.multi_range_count;
-ERROR 42S02: Unknown table 'session' in field list
-SELECT multi_range_count = @@session.multi_range_count;
-ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
-SET @@global.multi_range_count = @start_global_value;
-SELECT @@global.multi_range_count;
-@@global.multi_range_count
-256
-SET @@session.multi_range_count = @start_session_value;
-SELECT @@session.multi_range_count;
-@@session.multi_range_count
-256

=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result	2008-08-07 20:51:09 +0000
+++ b/mysql-test/r/subselect.result	2008-08-18 16:47:28 +0000
@@ -4609,6 +4609,7 @@ 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;
+|<<<<<<< TREE
 End of 5.0 tests.
 CREATE TABLE t1( a INT );
 INSERT INTO t1 VALUES (1),(2);
@@ -4871,3 +4872,17 @@ ERROR 42000: You have an error in your S
 SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
 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 'INTO @v )' at line 1
 DROP TABLE t1, t2;
+|=======
+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.
+|>>>>>>> MERGE-SOURCE

=== modified file 'mysql-test/suite/binlog/r/binlog_killed_simulate.result'
--- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result	2008-02-28 11:21:44 +0000
+++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result	2008-08-15 02:31:04 +0000
@@ -18,7 +18,7 @@ load data infile '../../std_data/rpl_loa
 ERROR 70100: Query execution was interrupted
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=12
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=#
 select
 (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))

=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result	2008-06-10 22:27:52 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result	2008-08-18 16:47:28 +0000
@@ -1141,10 +1141,10 @@ master-bin.000001	#	Delete_rows	#	#	tabl
 master-bin.000001	#	Query	#	#	use `mysql`; COMMIT
 drop table t1,t2,t3,tt1;
 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
 insert delayed into t1 values (207);
 insert delayed into t1 values (null);
 insert delayed into t1 values (300);
+FLUSH TABLES;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (id tinyint auto_increment primary key)
@@ -1188,9 +1188,9 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
 insert delayed into t1 values (null),(null),(400),(null);
-11 == 11
 select * from t1;
 a
 207

=== modified file 'mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2008-07-22 14:16:22 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2008-08-18 16:47:28 +0000
@@ -927,7 +927,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
 master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=12
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
 master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
 master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#

=== modified file 'mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result'
--- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result	2008-07-29 15:36:13 +0000
@@ -1,8 +1,8 @@
 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
 insert delayed into t1 values (207);
 insert delayed into t1 values (null);
 insert delayed into t1 values (300);
+FLUSH TABLES;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
@@ -10,9 +10,9 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Intvar	#	#	INSERT_ID=208
 master-bin.000001	#	Query	#	#	use `test`; insert delayed into t1 values (null)
 master-bin.000001	#	Query	#	#	use `test`; insert delayed into t1 values (300)
+master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
 insert delayed into t1 values (null),(null),(400),(null);
-11 == 11
 select * from t1;
 a
 207

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2008-06-10 22:27:52 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2008-08-18 16:47:28 +0000
@@ -629,10 +629,10 @@ master-bin.000001	#	Query	#	#	use `mysql
 master-bin.000001	#	Query	#	#	use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
 drop table t1,t2,t3,tt1;
 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
-set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
 insert delayed into t1 values (207);
 insert delayed into t1 values (null);
 insert delayed into t1 values (300);
+FLUSH TABLES;
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (id tinyint auto_increment primary key)
@@ -660,9 +660,9 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
 insert delayed into t1 values (null),(null),(400),(null);
-11 == 11
 select * from t1;
 a
 207

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2008-07-22 14:16:22 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2008-08-18 16:47:28 +0000
@@ -624,7 +624,7 @@ show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=12
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
 master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
 master-bin.000001	#	Query	#	#	use `test`; ROLLBACK
@@ -859,7 +859,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	use `test`; BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
 master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=12
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Intvar	#	#	INSERT_ID=10
 master-bin.000001	#	User var	#	#	@`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
 master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#

=== renamed file 'mysql-test/include/have_federated_db.inc' => 'mysql-test/suite/federated/have_federated_db.inc'
=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_03.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc	2008-07-25 17:14:52 +0000
@@ -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
 

=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_08.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc	2008-07-25 17:14:52 +0000
@@ -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:;

=== modified file 'mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc'
--- a/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc	2008-07-19 08:31:33 +0000
+++ b/mysql-test/suite/funcs_1/triggers/triggers_1011ext.inc	2008-07-25 17:14:52 +0000
@@ -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
 

=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata_map.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result	2008-02-07 06:33:07 +0000
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result	2008-08-18 16:47:28 +0000
@@ -4,6 +4,8 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+==== Create a big file ====
+==== Load our big file into a table ====
 create table t2 (id int not null primary key auto_increment);
 select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ;
 @@session.read_buffer_size - @@session.max_allowed_packet > 0
@@ -12,15 +14,18 @@ load data infile 'MYSQLTEST_VARDIR/tmp/b
 select count(*) from t2 /* 5 000 */;
 count(*)
 5000
-show binlog events in 'master-bin.000002' from <binlog_start>;
+show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Query	#	#	use `test`; create table t2 (id int not null primary key auto_increment)
-master-bin.000002	#	Begin_load_query	#	#	;file_id=#;block_len=#
-master-bin.000002	#	Append_block	#	#	;file_id=#;block_len=#
-master-bin.000002	#	Append_block	#	#	;file_id=#;block_len=#
-master-bin.000002	#	Execute_load_query	#	#	use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=#
+master-bin.000001	#	Query	#	#	use `test`; create table t2 (id int not null primary key auto_increment)
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Append_block	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Append_block	#	#	;file_id=#;block_len=#
+master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=#
+==== Verify results on slave ====
+[on slave]
 select count(*) from t2 /* 5 000 */;
 count(*)
 5000
-drop table t1, t2;
-end of the tests
+==== Clean up ====
+[on master]
+drop table t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result	2008-08-14 09:13:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result	2008-08-18 16:47:28 +0000
@@ -488,7 +488,11 @@ Comparing tables master:test.t2 and slav
 INSERT INTO t3 VALUES (1, "", 1);
 INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 512, test.t3 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -501,7 +505,11 @@ Comparing tables master:test.t4 and slav
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t5 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -510,7 +518,11 @@ START SLAVE;
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t6 on slave has size 513. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result	2008-08-14 09:13:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result	2008-08-18 16:47:28 +0000
@@ -488,7 +488,11 @@ Comparing tables master:test.t2 and slav
 INSERT INTO t3 VALUES (1, "", 1);
 INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 512, test.t3 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -501,7 +505,11 @@ Comparing tables master:test.t4 and slav
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t5 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -510,7 +518,11 @@ START SLAVE;
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t6 on slave has size 513. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2008-08-04 14:30:50 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2008-08-18 16:47:28 +0000
@@ -193,7 +193,7 @@ master-bin.000001	#	Intvar	#	#	INSERT_ID
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 master-bin.000001	#	Query	#	#	use `test`; drop table t1
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
-master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=581
+master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
 master-bin.000001	#	Execute_load_query	#	#	use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=#
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002';

=== modified file 'mysql-test/suite/rpl/r/rpl_variables.result'
--- a/mysql-test/suite/rpl/r/rpl_variables.result	2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl/r/rpl_variables.result	2008-08-14 09:38:22 +0000
@@ -45,7 +45,7 @@ RESET SLAVE;
 RESET MASTER;
 include/start_slave.inc
 [on slave]
-SET @@global.init_slave = 'ant';
+SET @@global.init_slave = 'SELECT 1';
 [on master]
 CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,
 truth BOOLEAN,
@@ -66,9 +66,9 @@ SET @@global.sync_binlog = 2000000;
 INSERT INTO tstmt(num) VALUES (@@global.sync_binlog);
 SET @@global.sync_binlog = 3000000;
 INSERT INTO tstmt(num) VALUES (@@global.sync_binlog);
-SET @@global.init_slave = 'bison';
+SET @@global.init_slave = 'SELECT 2';
 INSERT INTO tstmt(text) VALUES (@@global.init_slave);
-SET @@global.init_slave = 'cat';
+SET @@global.init_slave = 'SELECT 3';
 INSERT INTO tstmt(text) VALUES (@@global.init_slave);
 SET @@global.slave_exec_mode = 'IDEMPOTENT';
 INSERT INTO tstmt(text) VALUES (@@global.slave_exec_mode);
@@ -140,9 +140,9 @@ INSERT INTO tproc(num) VALUES (@@global.
 SET @@global.sync_binlog = 3000000;
 INSERT INTO tproc(num) VALUES (@@global.sync_binlog);
 # string
-SET @@global.init_slave = 'bison';
+SET @@global.init_slave = 'SELECT 2';
 INSERT INTO tproc(text) VALUES (@@global.init_slave);
-SET @@global.init_slave = 'cat';
+SET @@global.init_slave = 'SELECT 3';
 INSERT INTO tproc(text) VALUES (@@global.init_slave);
 # enumeration
 SET @@global.slave_exec_mode = 'IDEMPOTENT';
@@ -226,9 +226,9 @@ INSERT INTO tfunc(num) VALUES (@@global.
 SET @@global.sync_binlog = 3000000;
 INSERT INTO tfunc(num) VALUES (@@global.sync_binlog);
 # string
-SET @@global.init_slave = 'bison';
+SET @@global.init_slave = 'SELECT 2';
 INSERT INTO tfunc(text) VALUES (@@global.init_slave);
-SET @@global.init_slave = 'cat';
+SET @@global.init_slave = 'SELECT 3';
 INSERT INTO tfunc(text) VALUES (@@global.init_slave);
 # enumeration
 SET @@global.slave_exec_mode = 'IDEMPOTENT';
@@ -316,9 +316,9 @@ INSERT INTO ttrig(num) VALUES (@@global.
 SET @@global.sync_binlog = 3000000;
 INSERT INTO ttrig(num) VALUES (@@global.sync_binlog);
 # string
-SET @@global.init_slave = 'bison';
+SET @@global.init_slave = 'SELECT 2';
 INSERT INTO ttrig(text) VALUES (@@global.init_slave);
-SET @@global.init_slave = 'cat';
+SET @@global.init_slave = 'SELECT 3';
 INSERT INTO ttrig(text) VALUES (@@global.init_slave);
 # enumeration
 SET @@global.slave_exec_mode = 'IDEMPOTENT';
@@ -395,9 +395,9 @@ PREPARE p5 FROM 'SET @@global.sync_binlo
 PREPARE p6 FROM 'INSERT INTO tprep(num) VALUES (@@global.sync_binlog)';
 PREPARE p7 FROM 'SET @@global.sync_binlog = 3000000';
 PREPARE p8 FROM 'INSERT INTO tprep(num) VALUES (@@global.sync_binlog)';
-PREPARE p9 FROM 'SET @@global.init_slave = \'bison\'';
+PREPARE p9 FROM 'SET @@global.init_slave = \'SELECT 2\'';
 PREPARE p10 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
-PREPARE p11 FROM 'SET @@global.init_slave = \'cat\'';
+PREPARE p11 FROM 'SET @@global.init_slave = \'SELECT 3\'';
 PREPARE p12 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
 PREPARE p13 FROM 'SET @@global.slave_exec_mode = \'IDEMPOTENT\'';
 PREPARE p14 FROM 'INSERT INTO tprep(text) VALUES (@@global.slave_exec_mode)';
@@ -522,8 +522,8 @@ id	truth	num	text
 2	0	NULL	NULL
 3	NULL	2000000	NULL
 4	NULL	3000000	NULL
-5	NULL	NULL	bison
-6	NULL	NULL	cat
+5	NULL	NULL	SELECT 2
+6	NULL	NULL	SELECT 3
 7	NULL	NULL	IDEMPOTENT
 8	NULL	NULL	STRICT
 9	1	NULL	NULL

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2008-08-14 13:50:56 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2008-08-18 16:47:28 +0000
@@ -34,6 +34,10 @@ rpl_flushlog_loop          : Bug#37733 2
 rpl_locktrans_innodb       : Bug#37712 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_temporary_errors       : Bug#36968 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_temporary              : BUG#38269 2008-07-21 Sven valgrind error in pushbuild
+|<<<<<<< TREE
 
 rpl000017                  : Magnus To be or not to be
 
+|=======
+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
+|>>>>>>> MERGE-SOURCE

=== modified file 'mysql-test/suite/rpl/t/rpl_incident.test'
--- a/mysql-test/suite/rpl/t/rpl_incident.test	2008-08-04 14:30:50 +0000
+++ b/mysql-test/suite/rpl/t/rpl_incident.test	2008-08-18 16:47:28 +0000
@@ -19,6 +19,37 @@ source include/wait_for_slave_sql_to_sto
 # The 4 should not be inserted into the table, since the incident log
 # event should have stop the slave.
 --echo **** On Slave ****
+#### BEGIN DEBUG INFO ADDED BY SVEN 2008-07-18 -- SEE BUG#38077 ####
+let $tables= query_get_value(SHOW TABLES, Tables_in_test, 1);
+if (`SELECT '$tables' != 't1'`)
+{
+  --echo **** TEST CASE BUG! PRINTING DEBUG INFO! ****
+  --echo **** Dear developer, if you see this in the output of a test
+  --echo **** case run, please add all the information below as a
+  --echo **** comment to BUG#38077. If it's a pushbuild failure, please
+  --echo **** include a link to the push page.
+  --echo **** Thank you! /Sven
+  SHOW BINLOG EVENTS;
+  --echo **** master binlog ****
+  --error 0,1
+  --exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001
+  --echo **** slave binlog ****
+  --error 0,1
+  --exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/slave-bin.000001
+  --echo **** slave status ****
+  query_vertical SHOW SLAVE STATUS;
+  --echo **** slave's master status ****
+  SHOW MASTER STATUS;
+  --echo **** slave binlog events ****
+  --echo [on master]
+  connection master;
+  --echo **** master status ****
+  SHOW MASTER STATUS;
+  --echo **** master binlog events ****
+  SHOW BINLOG EVENTS;
+  exit;
+}
+#### END DEBUG INFO ####
 SELECT * FROM t1;
 
 --replace_result $MASTER_MYPORT MASTER_PORT

=== modified file 'mysql-test/suite/rpl/t/rpl_loaddata_map.test'
--- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test	2008-02-05 14:30:44 +0000
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test	2008-08-18 16:47:28 +0000
@@ -1,7 +1,16 @@
+# ==== Purpose ====
 #
 #  check replication of load data with the server parameters subjected to
 #  read_buffer_size > max_allowed_packet
 #
+# ==== Implementation ====
+#
+# Insert many rows into t1, write t1 to file.
+# Load the file into t2.
+# See that t2 came out as expected on slave.
+#
+# ==== Related Bugs ====
+#
 #  BUG#30435 loading large LOAD DATA INFILE breaks slave with 
 #            read_buffer_size set on master
 #  BUG#33413 show binlog events fails if binlog has event size of close
@@ -9,10 +18,17 @@
 
 source include/have_binlog_format_mixed_or_statement.inc;
 source include/master-slave.inc;
-source include/have_innodb.inc;
-source include/have_binlog_format_mixed_or_statement.inc;
+
+
+--echo ==== Create a big file ====
+
+# We turn off binlogging to avoid too much noise in the binlog. t1 is
+# just an auxiliary construction anyways, it is not needed on the
+# slave.
 
 --disable_query_log
+SET @@sql_log_bin= 0;
+
 let $rows= 5000;
 create table t1 (id int not null primary key auto_increment);
 
@@ -22,10 +38,13 @@ while($rows)
   dec $rows;
 }
 eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1;
-flush logs;
+
+DROP TABLE t1;
+SET @@sql_log_bin= 1;
 --enable_query_log
 
-connection master;
+
+--echo ==== Load our big file into a table ====
 create table t2 (id int not null primary key auto_increment);
 
 select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ;
@@ -34,6 +53,7 @@ select @@session.read_buffer_size - @@se
 eval load data infile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2;
 select count(*) from t2 /* 5 000 */;
 
+|<<<<<<< TREE
 # the binglog will show fragmented Append_block events
 --let $binlog_start=107
 --replace_column 2 # 4 # 5 #
@@ -42,13 +62,23 @@ select count(*) from t2 /* 5 000 */;
 --eval show binlog events in 'master-bin.000002' from $binlog_start
 
 
+|=======
+# the binlog will show fragmented Append_block events
+source include/show_binlog_events.inc;
+
+
+--echo ==== Verify results on slave ====
+
+--echo [on slave]
+|>>>>>>> MERGE-SOURCE
 sync_slave_with_master;
-#connection slave;
 select count(*) from t2 /* 5 000 */;
 
+
+--echo ==== Clean up ====
+
+--echo [on master]
 connection master;
-drop table t1, t2;
+drop table t2;
 sync_slave_with_master;
 remove_file $MYSQLTEST_VARDIR/tmp/bug30435_5k.txt;
-
---echo end of the tests

=== removed file 'mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---binlog-format=row

=== removed file 'mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_err_daisychain-slave.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---binlog-format=statement --log-slave-updates

=== modified file 'mysql-test/suite/rpl/t/rpl_trunc_temp.test'
--- a/mysql-test/suite/rpl/t/rpl_trunc_temp.test	2008-02-28 11:36:14 +0000
+++ b/mysql-test/suite/rpl/t/rpl_trunc_temp.test	2008-07-23 10:13:55 +0000
@@ -1,13 +1,30 @@
-# Requires statement logging
+# ==== Purpose ====
+#
+# Verify that Slave_open_temp_tables is increased when a temporary
+# table is opened on the slave, and decreased when a temporary table
+# is closed on the slave, and that it is preserved during 'DELETE FROM
+# table' and 'TRUNCATE table'.
+#
+# ==== Method ====
+#
+# Create a temporary table on master, insert rows, and try:
+#  - delete rows from the table
+#  - truncate the table
+#  - drop the table
+#
+# ==== Related bugs ====
+#
+# BUG#17137 Running "truncate table" on temporary table leaves the table open on a slave
+#
+# Bug in this test: BUG#37493: rpl_trunc_temp.test nondeterministic
+
+
+# Requires statement-based logging since temporary tables are not
+# logged in row-based logging
 -- source include/have_binlog_format_mixed_or_statement.inc
 
 source include/master-slave.inc;
 
-#
-# Bug#17137 Running "truncate table" on temporary table
-# leaves the table open on a slave
-#
-
 create temporary table t1 (n int);
 insert into t1 values(1);
 sync_slave_with_master;
@@ -28,13 +45,10 @@ show status like 'Slave_open_temp_tables
 # Disconnect the master, temp table on slave should dissapear
 disconnect master;
 
-connection master1;
-# Wait until drop of temp tables appers in binlog
+connection slave;
+
+# Wait until drop of temp tables appers in slave's binlog
 let $wait_binlog_event= DROP;
 source include/wait_for_binlog_event.inc;
 
-connection slave;
 show status like 'Slave_open_temp_tables';
-
-
-# End of 4.1 tests

=== modified file 'mysql-test/suite/rpl/t/rpl_variables.test'
--- a/mysql-test/suite/rpl/t/rpl_variables.test	2008-03-07 12:59:36 +0000
+++ b/mysql-test/suite/rpl/t/rpl_variables.test	2008-07-17 16:26:59 +0000
@@ -117,7 +117,7 @@ source include/reset_master_and_slave.in
 # above, but can't because it affects how the slave works.
 --echo [on slave]
 connection slave;
-SET @@global.init_slave = 'ant';
+SET @@global.init_slave = 'SELECT 1';
 
 
 --echo [on master]
@@ -154,9 +154,9 @@ SET @@global.sync_binlog = 3000000;
 INSERT INTO tstmt(num) VALUES (@@global.sync_binlog);
 
 # string
-SET @@global.init_slave = 'bison';
+SET @@global.init_slave = 'SELECT 2';
 INSERT INTO tstmt(text) VALUES (@@global.init_slave);
-SET @@global.init_slave = 'cat';
+SET @@global.init_slave = 'SELECT 3';
 INSERT INTO tstmt(text) VALUES (@@global.init_slave);
 
 # enumeration
@@ -258,9 +258,9 @@ BEGIN
   INSERT INTO tproc(num) VALUES (@@global.sync_binlog);
 
   # string
-  SET @@global.init_slave = 'bison';
+  SET @@global.init_slave = 'SELECT 2';
   INSERT INTO tproc(text) VALUES (@@global.init_slave);
-  SET @@global.init_slave = 'cat';
+  SET @@global.init_slave = 'SELECT 3';
   INSERT INTO tproc(text) VALUES (@@global.init_slave);
 
   # enumeration
@@ -367,9 +367,9 @@ BEGIN
   INSERT INTO tfunc(num) VALUES (@@global.sync_binlog);
 
   # string
-  SET @@global.init_slave = 'bison';
+  SET @@global.init_slave = 'SELECT 2';
   INSERT INTO tfunc(text) VALUES (@@global.init_slave);
-  SET @@global.init_slave = 'cat';
+  SET @@global.init_slave = 'SELECT 3';
   INSERT INTO tfunc(text) VALUES (@@global.init_slave);
 
   # enumeration
@@ -478,9 +478,9 @@ BEGIN
   INSERT INTO ttrig(num) VALUES (@@global.sync_binlog);
 
   # string
-  SET @@global.init_slave = 'bison';
+  SET @@global.init_slave = 'SELECT 2';
   INSERT INTO ttrig(text) VALUES (@@global.init_slave);
-  SET @@global.init_slave = 'cat';
+  SET @@global.init_slave = 'SELECT 3';
   INSERT INTO ttrig(text) VALUES (@@global.init_slave);
 
   # enumeration
@@ -581,9 +581,9 @@ PREPARE p7 FROM 'SET @@global.sync_binlo
 PREPARE p8 FROM 'INSERT INTO tprep(num) VALUES (@@global.sync_binlog)';
 
 # string
-PREPARE p9 FROM 'SET @@global.init_slave = \'bison\'';
+PREPARE p9 FROM 'SET @@global.init_slave = \'SELECT 2\'';
 PREPARE p10 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
-PREPARE p11 FROM 'SET @@global.init_slave = \'cat\'';
+PREPARE p11 FROM 'SET @@global.init_slave = \'SELECT 3\'';
 PREPARE p12 FROM 'INSERT INTO tprep(text) VALUES (@@global.init_slave)';
 
 # enumeration

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test	2008-04-25 22:17:34 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test	2008-08-15 02:31:04 +0000
@@ -172,7 +172,7 @@ SELECT COUNT(*), SUM(a), b FROM t1 WHERE
 --connection master
 DROP TABLE t1;
 --connection slave
---disable_warings
+--disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 --echo

=== removed file 'mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt'
--- a/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt	2008-06-26 05:18:28 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---binlog-format=mixed

=== modified file 'mysql-test/suite/rpl_ndb_big/r/rpl_row_basic_7ndb.result'
--- a/mysql-test/suite/rpl_ndb_big/r/rpl_row_basic_7ndb.result	2008-08-14 13:50:56 +0000
+++ b/mysql-test/suite/rpl_ndb_big/r/rpl_row_basic_7ndb.result	2008-08-18 16:47:28 +0000
@@ -488,7 +488,11 @@ Comparing tables master:test.t2 and slav
 INSERT INTO t3 VALUES (1, "", 1);
 INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 512, test.t3 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 384, test.t3 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -501,7 +505,11 @@ Comparing tables master:test.t4 and slav
 INSERT INTO t5 VALUES (1, "", 1);
 INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t5 on slave has size 65. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t5 on slave has size 49. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;
@@ -510,7 +518,11 @@ START SLAVE;
 INSERT INTO t6 VALUES (1, "", 1);
 INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
 Last_SQL_Error
+|<<<<<<< TREE
 Table definition on master and slave does not match: Column 1 size mismatch - master has size 1020, test.t6 on slave has size 513. Master's column size should be <= the slave's column size.
+|=======
+Table definition on master and slave does not match: Column 1 size mismatch - master has size 765, test.t6 on slave has size 385. Master's column size should be <= the slave's column size.
+|>>>>>>> MERGE-SOURCE
 RESET MASTER;
 STOP SLAVE;
 RESET SLAVE;

=== modified file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test'
--- a/mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test	2008-08-04 14:30:50 +0000
+++ b/mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test	2008-08-18 16:47:28 +0000
@@ -22,9 +22,13 @@
 # BUG#26395: if crash during autocommit update to transactional table on master, slave fails
 
 
+source include/have_ndb.inc;
 source include/ndb_master-slave.inc;
+|<<<<<<< TREE
 source include/have_innodb.inc;
 source include/have_ndb.inc;
+|=======
+|>>>>>>> MERGE-SOURCE
 source include/have_innodb.inc;
 
 CREATE TABLE tmyisam (a int) ENGINE = MYISAM;

=== added file 'mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/inc/multi_range_count_basic.inc	2008-07-23 14:06:44 +0000
@@ -0,0 +1,219 @@
+############## mysql-test\t\multi_range_count_basic.test ###############
+#                                                                             #
+# Variable Name: multi_range_count                                            #
+# Scope: GLOBAL | SESSION                                                     #
+# Access Type: Dynamic                                                        #
+# Data Type: numeric                                                          #
+# Default Value:  256                                                         #
+# Range:1-4294967295                                                          #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2008-02-07                                                   #
+# Author:  Salman                                                             #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable multi_range_count        #
+#              that checks the behavior of this variable in the following ways#
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
+#  server-system-variables.html                                               #
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+#################################################################
+#           START OF multi_range_count TESTS                    #
+#################################################################
+
+
+#############################################################
+#                 Save initial value                        #
+#############################################################
+
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+
+
+--echo '#--------------------FN_DYNVARS_090_01-------------------------#'
+#################################################################
+#     Display the DEFAULT value of multi_range_count            #
+#################################################################
+
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+
+
+--echo '#--------------------FN_DYNVARS_090_02-------------------------#'
+#################################################################
+#     Check the DEFAULT value of multi_range_count              #
+#################################################################
+
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+
+
+--echo '#--------------------FN_DYNVARS_090_03-------------------------#'
+###########################################################################
+# Change the value of multi_range_count to a valid value for GLOBAL Scope #
+###########################################################################
+
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+
+
+
+--echo '#--------------------FN_DYNVARS_090_04-------------------------#'
+############################################################################
+# Change the value of multi_range_count to a valid value for SESSION Scope #
+############################################################################
+ 
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+
+
+--echo '#------------------FN_DYNVARS_090_05-----------------------#'
+#############################################################
+# Change the value of multi_range_count to an invalid value #
+#############################################################
+
+SET @@global.multi_range_count = 0;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 4294967296;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = -1024;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = 429496729500;
+SELECT @@global.multi_range_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.multi_range_count = 65530.34;
+SELECT @@global.multi_range_count;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.multi_range_count = test;
+SELECT @@global.multi_range_count;
+
+SET @@session.multi_range_count = 0;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = 4294967296;
+SELECT @@session.multi_range_count;
+SET @@session.multi_range_count = -1;
+SELECT @@session.multi_range_count;
+--Error ER_PARSE_ERROR
+SET @@session.multi_range_count = 65530.34.;
+SET @@session.multi_range_count = 4294967295021;
+SELECT @@session.multi_range_count;
+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@session.multi_range_count = test;
+SELECT @@session.multi_range_count;
+
+
+--echo '#------------------FN_DYNVARS_090_06-----------------------#'
+####################################################################
+#   Check if the value in GLOBAL Table matches value in variable   #
+####################################################################
+
+
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+
+--echo '#------------------FN_DYNVARS_090_07-----------------------#'
+####################################################################
+#  Check if the value in SESSION Table matches value in variable   #
+####################################################################
+
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+
+
+--echo '#------------------FN_DYNVARS_090_08-----------------------#'
+####################################################################
+#     Check if TRUE and FALSE values can be used on variable       #
+####################################################################
+
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+SET @@global.multi_range_count = FALSE;
+SELECT @@global.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_09----------------------#'
+################################################################################# 
+#  Check if accessing variable with and without GLOBAL point to same variable   #
+################################################################################# 
+
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_10----------------------#'
+########################################################################################################
+#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
+########################################################################################################
+
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+
+
+--echo '#---------------------FN_DYNVARS_090_11----------------------#'
+############################################################################  
+#   Check if multi_range_count can be accessed with and without @@ sign    #
+############################################################################
+
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+--Error ER_UNKNOWN_TABLE
+SELECT local.multi_range_count;
+--Error ER_UNKNOWN_TABLE
+SELECT session.multi_range_count;
+--Error ER_BAD_FIELD_ERROR
+SELECT multi_range_count = @@session.multi_range_count;
+
+
+####################################
+#     Restore initial value        #
+####################################
+
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+
+
+######################################################
+#                 END OF multi_range_count TESTS     #
+######################################################
+

=== added file 'mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc	2008-07-23 14:06:44 +0000
@@ -0,0 +1,188 @@
+############# mysql-test\t\slave_transaction_retries_basic.test ###############
+#                                                                             #
+# Variable Name: slave_transaction_retries                                    #
+# Scope: GLOBAL                                                               #
+# Access Type: Dynamic                                                        #
+# Data Type: numeric                                                          #
+# Default Value: 10                                                           #
+# Range:                                                                      #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2008-02-07                                                   #
+# Author:  Rizwan                                                             #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable slave_transaction_retries#
+#              that checks the behavior of this variable in the following ways#
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
+#  server-system-variables.html                                               #
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+###################################################################
+#           START OF slave_transaction_retries TESTS              #
+###################################################################
+
+
+#############################################################
+#                 Save initial value                        #
+#############################################################
+
+SET @start_global_value = @@global.slave_transaction_retries;
+SELECT @start_global_value;
+
+--echo '#--------------------FN_DYNVARS_149_01-------------------------#'
+###################################################################
+#     Display the DEFAULT value of slave_transaction_retries      #
+###################################################################
+
+SET @@global.slave_transaction_retries = 50;
+SET @@global.slave_transaction_retries = DEFAULT;
+SELECT @@global.slave_transaction_retries;
+
+--echo '#--------------------FN_DYNVARS_149_02-------------------------#'
+###################################################################
+#     Check the DEFAULT value of slave_transaction_retries         #
+###################################################################
+
+SET @@global.slave_transaction_retries = DEFAULT;
+SELECT @@global.slave_transaction_retries = 10;
+
+--echo '#--------------------FN_DYNVARS_149_03-------------------------#'
+################################################################################
+# Change the value of slave_transaction_retries to a valid value for
+# GLOBAL Scope 
+################################################################################
+
+SET @@global.slave_transaction_retries = 0;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 1;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 15;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 1024;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483648;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483648*2-1;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 2147483649*2;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = 4294967295;
+SELECT @@global.slave_transaction_retries;
+
+--echo '#--------------------FN_DYNVARS_149_04-------------------------#'
+###############################################################################
+#           Check if variable can be access with session scope                #
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_transaction_retries = 2;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_transaction_retries = 3;
+
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_transaction_retries = 4;
+
+
+
+--echo '#------------------FN_DYNVARS_149_05-----------------------#'
+####################################################################
+# Change the value of slave_transaction_retries to an invalid value#
+####################################################################
+
+SET @@global.slave_transaction_retries = -1;
+SELECT @@global.slave_transaction_retries;
+
+SET @@global.slave_transaction_retries = 2147483649*2147483649;
+SELECT @@global.slave_transaction_retries;
+
+--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
+
+--Error ER_PARSE_ERROR
+SET @@global.slave_transaction_retries = 65530.34.;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = '100';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = 7483649.56;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.slave_transaction_retries = OFF;
+
+--echo '#------------------FN_DYNVARS_149_06-----------------------#'
+####################################################################
+#   Check if the value in GLOBAL Table matches value in variable   #
+####################################################################
+
+SET @@global.slave_transaction_retries = 3000;
+SELECT @@global.slave_transaction_retries = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='slave_transaction_retries';
+
+
+--echo '#------------------FN_DYNVARS_149_07-----------------------#'
+###########################################################################
+#  Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES  #
+###########################################################################
+
+SELECT count(VARIABLE_VALUE) 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='slave_transaction_retries';
+
+
+--echo '#------------------FN_DYNVARS_149_08-----------------------#'
+####################################################################
+#     Check if TRUE and FALSE values can be used on variable       #
+####################################################################
+
+SET @@global.slave_transaction_retries = TRUE;
+SELECT @@global.slave_transaction_retries;
+SET @@global.slave_transaction_retries = FALSE;
+SELECT @@global.slave_transaction_retries;
+
+
+--echo '#---------------------FN_DYNVARS_149_09----------------------#'
+###############################################################################
+#  Check if accessing variable with and without GLOBAL point to same variable #
+###############################################################################
+
+
+SET @@global.slave_transaction_retries = 60*60;
+SELECT @@slave_transaction_retries = @@global.slave_transaction_retries;
+
+
+--echo '#---------------------FN_DYNVARS_149_10----------------------#'
+###############################################################################
+#   Check if slave_transaction_retries can be accessed without @@ sign
+#   and scope 
+###############################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_transaction_retries = 2048;
+--Error ER_BAD_FIELD_ERROR
+SELECT slave_transaction_retries;
+
+SELECT @@slave_transaction_retries;
+
+#verifying another another syntax for setting value
+SET global slave_transaction_retries = 99;
+
+####################################
+#     Restore initial value        #
+####################################
+
+SET @@global.slave_transaction_retries = @start_global_value;
+SELECT @@global.slave_transaction_retries;
+
+########################################################
+#              END OF slave_transaction_retries TESTS  #
+########################################################
+

=== removed file 'mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc	2008-08-05 11:20:20 +0000
+++ b/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc	1970-01-01 00:00:00 +0000
@@ -1,189 +0,0 @@
-############# mysql-test\t\slave_transaction_retries_basic.test ###############
-#                                                                             #
-# Variable Name: slave_transaction_retries                                    #
-# Scope: GLOBAL                                                               #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value: 10                                                           #
-# Range:                                                                      #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Rizwan                                                             #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable slave_transaction_retries#
-#              that checks the behavior of this variable in the following ways#
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
-#                                                                             #
-###############################################################################
-
---source include/not_embedded.inc
---source include/load_sysvars.inc
-
-###################################################################
-#           START OF slave_transaction_retries TESTS              #
-###################################################################
-
-
-#############################################################
-#                 Save initial value                        #
-#############################################################
-
-SET @start_global_value = @@global.slave_transaction_retries;
-SELECT @start_global_value;
-
---echo '#--------------------FN_DYNVARS_149_01-------------------------#'
-###################################################################
-#     Display the DEFAULT value of slave_transaction_retries      #
-###################################################################
-
-SET @@global.slave_transaction_retries = 50;
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries;
-
---echo '#--------------------FN_DYNVARS_149_02-------------------------#'
-###################################################################
-#     Check the DEFAULT value of slave_transaction_retries         #
-###################################################################
-
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries = 10;
-
---echo '#--------------------FN_DYNVARS_149_03-------------------------#'
-################################################################################
-# Change the value of slave_transaction_retries to a valid value for
-# GLOBAL Scope 
-################################################################################
-
-SET @@global.slave_transaction_retries = 0;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 1;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 15;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 1024;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 2147483648;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 2147483648*2-1;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 2147483649*2;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = 4294967295;
-SELECT @@global.slave_transaction_retries;
-
---echo '#--------------------FN_DYNVARS_149_04-------------------------#'
-###############################################################################
-#           Check if variable can be access with session scope                #
-###############################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET @@slave_transaction_retries = 2;
-
---Error ER_GLOBAL_VARIABLE
-SET @@session.slave_transaction_retries = 3;
-
---Error ER_GLOBAL_VARIABLE
-SET @@local.slave_transaction_retries = 4;
-
-
-
---echo '#------------------FN_DYNVARS_149_05-----------------------#'
-####################################################################
-# Change the value of slave_transaction_retries to an invalid value#
-####################################################################
-
-SET @@global.slave_transaction_retries = -1;
-SELECT @@global.slave_transaction_retries;
-
-SET @@global.slave_transaction_retries = 2147483649*2147483649;
-SELECT @@global.slave_transaction_retries;
-
---echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
-
---Error ER_PARSE_ERROR
-SET @@global.slave_transaction_retries = 65530.34.;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_transaction_retries = '100';
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_transaction_retries = 7483649.56;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_transaction_retries = ON;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_transaction_retries = OFF;
-
---echo '#------------------FN_DYNVARS_149_06-----------------------#'
-####################################################################
-#   Check if the value in GLOBAL Table matches value in variable   #
-####################################################################
-
-SET @@global.slave_transaction_retries = 3000;
-SELECT @@global.slave_transaction_retries = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-
-
---echo '#------------------FN_DYNVARS_149_07-----------------------#'
-###########################################################################
-#  Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES  #
-###########################################################################
-
-SELECT count(VARIABLE_VALUE) 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-
-
---echo '#------------------FN_DYNVARS_149_08-----------------------#'
-####################################################################
-#     Check if TRUE and FALSE values can be used on variable       #
-####################################################################
-
-SET @@global.slave_transaction_retries = TRUE;
-SELECT @@global.slave_transaction_retries;
-SET @@global.slave_transaction_retries = FALSE;
-SELECT @@global.slave_transaction_retries;
-
-
---echo '#---------------------FN_DYNVARS_149_09----------------------#'
-###############################################################################
-#  Check if accessing variable with and without GLOBAL point to same variable #
-###############################################################################
-
-
-SET @@global.slave_transaction_retries = 60*60;
-SELECT @@slave_transaction_retries = @@global.slave_transaction_retries;
-
-
---echo '#---------------------FN_DYNVARS_149_10----------------------#'
-###############################################################################
-#   Check if slave_transaction_retries can be accessed without @@ sign
-#   and scope 
-###############################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET slave_transaction_retries = 2048;
---Error ER_BAD_FIELD_ERROR
-SELECT slave_transaction_retries;
-
-SELECT @@slave_transaction_retries;
-
-#verifying another another syntax for setting value
-SET global slave_transaction_retries = 99;
-
-####################################
-#     Restore initial value        #
-####################################
-
-SET @@global.slave_transaction_retries = @start_global_value;
-SELECT @@global.slave_transaction_retries;
-
-########################################################
-#              END OF slave_transaction_retries TESTS  #
-########################################################
-

=== added file 'mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc	2008-07-23 14:06:44 +0000
@@ -0,0 +1,156 @@
+#################### mysql-test\t\sync_binlog_basic.test ######################
+#                                                                             #
+# Variable Name: sync_binlog                                                  #
+# Scope: GLOBAL                                                               #
+# Access Type: Dynamic                                                        #
+# Data Type: numeric                                                          #
+# Default Value: 0                                                            #
+# Range: 0 - 4294967295                                                       #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2008-02-07                                                   #
+# Author:  Salman Rawala                                                      #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable sync_binlog              #
+#              that checks the behavior of this variable in the following ways#
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
+#  server-system-variables.html                                               #
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+##################################################################
+#                    START OF sync_binlog TESTS                  #
+##################################################################
+
+
+##################################################################
+# Saving initial value of sync_binlog in a temporary variable    #
+##################################################################
+
+SET @start_value = @@global.sync_binlog;
+SELECT @start_value;
+
+
+--echo '#--------------------FN_DYNVARS_168_01------------------------#'
+##################################################################
+#              Display the DEFAULT value of sync_binlog          #
+################################################################## 
+
+SET @@global.sync_binlog = 99;
+SET @@global.sync_binlog = DEFAULT;
+SELECT @@global.sync_binlog;
+
+
+--echo '#---------------------FN_DYNVARS_168_02-------------------------#'
+############################################### 
+#     Verify default value of variable        #
+############################################### 
+
+SET @@global.sync_binlog = @start_value;
+SELECT @@global.sync_binlog = 0;
+
+
+--echo '#--------------------FN_DYNVARS_168_03------------------------#'
+###################################################################
+#        Change the value of sync_binlog to a valid value         #
+###################################################################
+
+SET @@global.sync_binlog = 0;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 1;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967295;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967294;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 65536;
+SELECT @@global.sync_binlog;
+
+
+--echo '#--------------------FN_DYNVARS_168_04-------------------------#'
+######################################################################
+#         Change the value of sync_binlog to invalid value           #
+######################################################################
+
+SET @@global.sync_binlog = -1;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 4294967296;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 10240022115;
+SELECT @@global.sync_binlog;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = 10000.01;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = -1024;
+SELECT @@global.sync_binlog;
+SET @@global.sync_binlog = 42949672950;
+SELECT @@global.sync_binlog;
+--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = ON;
+SELECT @@global.sync_binlog;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.sync_binlog = 'test';
+SELECT @@global.sync_binlog;
+
+
+--echo '#-------------------FN_DYNVARS_168_05----------------------------#'
+########################################################################### 
+#       Test if accessing session sync_binlog gives error            #
+########################################################################### 
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.sync_binlog = 0;
+SELECT @@sync_binlog;
+
+
+--echo '#----------------------FN_DYNVARS_168_06------------------------#'
+############################################################################## 
+# Check if the value in GLOBAL & SESSION Tables matches values in variable   #
+##############################################################################
+
+SELECT @@global.sync_binlog = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='sync_binlog';
+
+
+
+--echo '#---------------------FN_DYNVARS_168_07----------------------#'
+##########################################################################  
+#   Check if sync_binlog can be accessed with and without @@ sign   #
+##########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET sync_binlog = 1;
+SELECT @@sync_binlog;
+--Error ER_PARSE_ERROR
+SET local.sync_binlog = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT local.sync_binlog;
+--Error ER_PARSE_ERROR
+SET global.sync_binlog = 1;
+--Error ER_UNKNOWN_TABLE
+SELECT global.sync_binlog;
+--Error ER_BAD_FIELD_ERROR
+SELECT sync_binlog = @@session.sync_binlog;
+
+
+##############################  
+#   Restore initial value    #
+##############################
+
+SET @@global.sync_binlog = @start_value;
+SELECT @@global.sync_binlog;
+
+
+######################################################################## 
+#              END OF sync_binlog TESTS                           #
+######################################################################## 

=== removed file 'mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc'
--- a/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc	2008-08-05 11:20:20 +0000
+++ b/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc	1970-01-01 00:00:00 +0000
@@ -1,157 +0,0 @@
-#################### mysql-test\t\sync_binlog_basic.test ######################
-#                                                                             #
-# Variable Name: sync_binlog                                                  #
-# Scope: GLOBAL                                                               #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value: 0                                                            #
-# Range: 0 - 4294967295                                                       #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Salman Rawala                                                      #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable sync_binlog              #
-#              that checks the behavior of this variable in the following ways#
-#              * Default Value                                                #
-#              * Valid & Invalid values                                       #
-#              * Scope & Access method                                        #
-#              * Data Integrity                                               #
-#                                                                             #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
-#  server-system-variables.html                                               #
-#                                                                             #
-###############################################################################
-
---source include/not_embedded.inc
---source include/load_sysvars.inc
-
-##################################################################
-#                    START OF sync_binlog TESTS                  #
-##################################################################
-
-
-##################################################################
-# Saving initial value of sync_binlog in a temporary variable    #
-##################################################################
-
-SET @start_value = @@global.sync_binlog;
-SELECT @start_value;
-
-
---echo '#--------------------FN_DYNVARS_168_01------------------------#'
-##################################################################
-#              Display the DEFAULT value of sync_binlog          #
-################################################################## 
-
-SET @@global.sync_binlog = 99;
-SET @@global.sync_binlog = DEFAULT;
-SELECT @@global.sync_binlog;
-
-
---echo '#---------------------FN_DYNVARS_168_02-------------------------#'
-############################################### 
-#     Verify default value of variable        #
-############################################### 
-
-SET @@global.sync_binlog = @start_value;
-SELECT @@global.sync_binlog = 0;
-
-
---echo '#--------------------FN_DYNVARS_168_03------------------------#'
-###################################################################
-#        Change the value of sync_binlog to a valid value         #
-###################################################################
-
-SET @@global.sync_binlog = 0;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 1;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 4294967295;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 4294967294;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 65536;
-SELECT @@global.sync_binlog;
-
-
---echo '#--------------------FN_DYNVARS_168_04-------------------------#'
-######################################################################
-#         Change the value of sync_binlog to invalid value           #
-######################################################################
-
-SET @@global.sync_binlog = -1;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 4294967296;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 10240022115;
-SELECT @@global.sync_binlog;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.sync_binlog = 10000.01;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = -1024;
-SELECT @@global.sync_binlog;
-SET @@global.sync_binlog = 42949672950;
-SELECT @@global.sync_binlog;
---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.sync_binlog = ON;
-SELECT @@global.sync_binlog;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.sync_binlog = 'test';
-SELECT @@global.sync_binlog;
-
-
---echo '#-------------------FN_DYNVARS_168_05----------------------------#'
-########################################################################### 
-#       Test if accessing session sync_binlog gives error            #
-########################################################################### 
-
---Error ER_GLOBAL_VARIABLE
-SET @@session.sync_binlog = 0;
-SELECT @@sync_binlog;
-
-
---echo '#----------------------FN_DYNVARS_168_06------------------------#'
-############################################################################## 
-# Check if the value in GLOBAL & SESSION Tables matches values in variable   #
-##############################################################################
-
-SELECT @@global.sync_binlog = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='sync_binlog';
-
-
-
---echo '#---------------------FN_DYNVARS_168_07----------------------#'
-##########################################################################  
-#   Check if sync_binlog can be accessed with and without @@ sign   #
-##########################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET sync_binlog = 1;
-SELECT @@sync_binlog;
---Error ER_PARSE_ERROR
-SET local.sync_binlog = 1;
---Error ER_UNKNOWN_TABLE
-SELECT local.sync_binlog;
---Error ER_PARSE_ERROR
-SET global.sync_binlog = 1;
---Error ER_UNKNOWN_TABLE
-SELECT global.sync_binlog;
---Error ER_BAD_FIELD_ERROR
-SELECT sync_binlog = @@session.sync_binlog;
-
-
-##############################  
-#   Restore initial value    #
-##############################
-
-SET @@global.sync_binlog = @start_value;
-SELECT @@global.sync_binlog;
-
-
-######################################################################## 
-#              END OF sync_binlog TESTS                           #
-######################################################################## 

=== added file 'mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result'
--- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result	2008-07-23 14:06:44 +0000
@@ -0,0 +1,192 @@
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+@start_global_value
+256
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+@start_session_value
+256
+'#--------------------FN_DYNVARS_090_01-------------------------#'
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256
+'#--------------------FN_DYNVARS_090_02-------------------------#'
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+@@global.multi_range_count = 256
+1
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+@@session.multi_range_count = 256
+1
+'#--------------------FN_DYNVARS_090_03-------------------------#'
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+60020
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+65535
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967294
+'#--------------------FN_DYNVARS_090_04-------------------------#'
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+50050
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+65535
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967294
+'#------------------FN_DYNVARS_090_05-----------------------#'
+SET @@global.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 4294967296;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 429496729500;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '429496729500'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@session.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 4294967296;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967296'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 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
+SET @@session.multi_range_count = 4294967295021;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '4294967295021'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+SET @@session.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+'#------------------FN_DYNVARS_090_06-----------------------#'
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@global.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_07-----------------------#'
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@session.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_08-----------------------#'
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = FALSE;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_09----------------------#'
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+@@multi_range_count = @@global.multi_range_count
+0
+'#---------------------FN_DYNVARS_090_10----------------------#'
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+@@multi_range_count = @@local.multi_range_count
+1
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+@@local.multi_range_count = @@session.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_11----------------------#'
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+@@multi_range_count
+1
+SELECT local.multi_range_count;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT session.multi_range_count;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT multi_range_count = @@session.multi_range_count;
+ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256

=== added file 'mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result'
--- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_64.result	2008-07-23 14:06:44 +0000
@@ -0,0 +1,184 @@
+SET @start_global_value = @@global.multi_range_count;
+SELECT @start_global_value;
+@start_global_value
+256
+SET @start_session_value = @@session.multi_range_count;
+SELECT @start_session_value;
+@start_session_value
+256
+'#--------------------FN_DYNVARS_090_01-------------------------#'
+SET @@global.multi_range_count = 100;
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = 200;
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256
+'#--------------------FN_DYNVARS_090_02-------------------------#'
+SET @@global.multi_range_count = DEFAULT;
+SELECT @@global.multi_range_count = 256;
+@@global.multi_range_count = 256
+1
+SET @@session.multi_range_count = DEFAULT;
+SELECT @@session.multi_range_count = 256;
+@@session.multi_range_count = 256
+1
+'#--------------------FN_DYNVARS_090_03-------------------------#'
+SET @@global.multi_range_count = 1;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 60020;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+60020
+SET @@global.multi_range_count = 65535;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+65535
+SET @@global.multi_range_count = 4294967295;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967295
+SET @@global.multi_range_count = 4294967294;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967294
+'#--------------------FN_DYNVARS_090_04-------------------------#'
+SET @@session.multi_range_count = 1;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 50050;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+50050
+SET @@session.multi_range_count = 65535;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+65535
+SET @@session.multi_range_count = 4294967295;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295
+SET @@session.multi_range_count = 4294967294;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967294
+'#------------------FN_DYNVARS_090_05-----------------------#'
+SET @@global.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 4294967296;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+4294967296
+SET @@global.multi_range_count = -1024;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = 429496729500;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@global.multi_range_count = 65530.34;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@global.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+429496729500
+SET @@session.multi_range_count = 0;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 4294967296;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967296
+SET @@session.multi_range_count = -1;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+1
+SET @@session.multi_range_count = 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
+SET @@session.multi_range_count = 4294967295021;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295021
+'Bug # 34837: Errors are not coming on assigning invalid values to variable';
+SET @@session.multi_range_count = test;
+ERROR 42000: Incorrect argument type to variable 'multi_range_count'
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+4294967295021
+'#------------------FN_DYNVARS_090_06-----------------------#'
+SELECT @@global.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@global.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_07-----------------------#'
+SELECT @@session.multi_range_count = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
+WHERE VARIABLE_NAME='multi_range_count';
+@@session.multi_range_count = VARIABLE_VALUE
+1
+'#------------------FN_DYNVARS_090_08-----------------------#'
+SET @@global.multi_range_count = TRUE;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+SET @@global.multi_range_count = FALSE;
+Warnings:
+Warning	1292	Truncated incorrect multi_range_count value: '0'
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_09----------------------#'
+SET @@global.multi_range_count = 10;
+SELECT @@multi_range_count = @@global.multi_range_count;
+@@multi_range_count = @@global.multi_range_count
+0
+'#---------------------FN_DYNVARS_090_10----------------------#'
+SET @@multi_range_count = 100;
+SELECT @@multi_range_count = @@local.multi_range_count;
+@@multi_range_count = @@local.multi_range_count
+1
+SELECT @@local.multi_range_count = @@session.multi_range_count;
+@@local.multi_range_count = @@session.multi_range_count
+1
+'#---------------------FN_DYNVARS_090_11----------------------#'
+SET multi_range_count = 1;
+SELECT @@multi_range_count;
+@@multi_range_count
+1
+SELECT local.multi_range_count;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT session.multi_range_count;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT multi_range_count = @@session.multi_range_count;
+ERROR 42S22: Unknown column 'multi_range_count' in 'field list'
+SET @@global.multi_range_count = @start_global_value;
+SELECT @@global.multi_range_count;
+@@global.multi_range_count
+256
+SET @@session.multi_range_count = @start_session_value;
+SELECT @@session.multi_range_count;
+@@session.multi_range_count
+256

=== removed file 'mysql-test/suite/sys_vars/r/rpl_sync_binlog_basic_64.result.OTHER'
--- a/mysql-test/suite/sys_vars/r/rpl_sync_binlog_basic_64.result.OTHER	2008-08-05 11:30:54 +0000
+++ b/mysql-test/suite/sys_vars/r/rpl_sync_binlog_basic_64.result.OTHER	1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
-SET @start_value = @@global.sync_binlog;
-SELECT @start_value;
-@start_value
-0
-'#--------------------FN_DYNVARS_168_01------------------------#'
-SET @@global.sync_binlog = 99;
-SET @@global.sync_binlog = DEFAULT;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0
-'#---------------------FN_DYNVARS_168_02-------------------------#'
-SET @@global.sync_binlog = @start_value;
-SELECT @@global.sync_binlog = 0;
-@@global.sync_binlog = 0
-1
-'#--------------------FN_DYNVARS_168_03------------------------#'
-SET @@global.sync_binlog = 0;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0
-SET @@global.sync_binlog = 1;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-1
-SET @@global.sync_binlog = 4294967295;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-4294967295
-SET @@global.sync_binlog = 4294967294;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-4294967294
-SET @@global.sync_binlog = 65536;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-65536
-'#--------------------FN_DYNVARS_168_04-------------------------#'
-SET @@global.sync_binlog = -1;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0
-SET @@global.sync_binlog = 4294967296;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0
-SET @@global.sync_binlog = 10240022115;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-1650087523
-SET @@global.sync_binlog = 10000.01;
-ERROR 42000: Incorrect argument type to variable 'sync_binlog'
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-1650087523
-SET @@global.sync_binlog = -1024;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0
-SET @@global.sync_binlog = 42949672950;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-4294967286
-'Bug # 34837: Errors are not coming on assigning invalid values to variable';
-SET @@global.sync_binlog = ON;
-ERROR 42000: Incorrect argument type to variable 'sync_binlog'
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-4294967286
-SET @@global.sync_binlog = 'test';
-ERROR 42000: Incorrect argument type to variable 'sync_binlog'
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-4294967286
-'#-------------------FN_DYNVARS_168_05----------------------------#'
-SET @@session.sync_binlog = 0;
-ERROR HY000: Variable 'sync_binlog' is a GLOBAL variable and should be set with SET GLOBAL
-SELECT @@sync_binlog;
-@@sync_binlog
-4294967286
-'#----------------------FN_DYNVARS_168_06------------------------#'
-SELECT @@global.sync_binlog = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='sync_binlog';
-@@global.sync_binlog = VARIABLE_VALUE
-1
-'#---------------------FN_DYNVARS_168_07----------------------#'
-SET sync_binlog = 1;
-ERROR HY000: Variable 'sync_binlog' is a GLOBAL variable and should be set with SET GLOBAL
-SELECT @@sync_binlog;
-@@sync_binlog
-4294967286
-SET local.sync_binlog = 1;
-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 'sync_binlog = 1' at line 1
-SELECT local.sync_binlog;
-ERROR 42S02: Unknown table 'local' in field list
-SET global.sync_binlog = 1;
-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 'sync_binlog = 1' at line 1
-SELECT global.sync_binlog;
-ERROR 42S02: Unknown table 'global' in field list
-SELECT sync_binlog = @@session.sync_binlog;
-ERROR 42S22: Unknown column 'sync_binlog' in 'field list'
-SET @@global.sync_binlog = @start_value;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-0

=== added file 'mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test'
--- a/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_32.test	2008-07-23 14:06:44 +0000
@@ -0,0 +1,9 @@
+################################################################################
+# Created by Horst Hunger      2008-05-07                                      #
+#                                                                              #
+# Wrapper for 32 bit machines                                                  #
+################################################################################
+
+--source include/have_32bit.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
+

=== added file 'mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test'
--- a/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/multi_range_count_basic_64.test	2008-07-23 14:06:44 +0000
@@ -0,0 +1,9 @@
+################################################################################
+# Created by Horst Hunger      2008-05-07                                      #
+#                                                                              #
+# Wrapper for 64 bit machines                                                  #
+################################################################################
+
+--source include/have_64bit.inc
+--source suite/sys_vars/inc/multi_range_count_basic.inc
+

=== removed file 'mysql-test/suite/sys_vars/t/rpl_sync_binlog_basic_64.test'
--- a/mysql-test/suite/sys_vars/t/rpl_sync_binlog_basic_64.test	2008-08-05 11:20:20 +0000
+++ b/mysql-test/suite/sys_vars/t/rpl_sync_binlog_basic_64.test	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-################################################################################
-# Created by Horst Hunger      2008-05-07                                      #
-#                                                                              #
-# Wrapper for 64 bit machines                                                  #
-################################################################################
-
---source include/have_64bit.inc
---source include/sync_binlog_basic.inc

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2008-08-07 20:51:09 +0000
+++ b/mysql-test/t/disabled.def	2008-08-18 16:47:28 +0000
@@ -44,6 +44,7 @@ backup_tablespace           : Bug#36973 
 backup_no_be                : Bug#38023 2008-07-16 rafal Test triggers valgrind warnings described in the bug
 user_limits                 : Bug#23921 2008-07-25 joro random failure of user_limits.test
 thread_cache_size_func : Bug#36733 main.thread_cache_size_func fails randomly
+|<<<<<<< TREE
 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
@@ -126,6 +127,9 @@ tmp_table_size_basic_64               : 
 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
+|>>>>>>> MERGE-SOURCE
 wait_timeout_func                     : BUG#36873 2008-07-06 sven wait_timeout_func.test fails randomly
 delayed_insert_limit_func             : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
 event_scheduler_func                  : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions

=== modified file 'mysql-test/t/func_if.test'
--- a/mysql-test/t/func_if.test	2007-02-12 20:59:29 +0000
+++ b/mysql-test/t/func_if.test	2008-07-30 11:07:37 +0000
@@ -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

=== added file 'mysql-test/t/innodb-autoinc-optimize.test'
--- a/mysql-test/t/innodb-autoinc-optimize.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb-autoinc-optimize.test	2008-07-31 21:47:57 +0000
@@ -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;

=== added file 'mysql-test/t/innodb_bug35220.test'
--- a/mysql-test/t/innodb_bug35220.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug35220.test	2008-08-08 00:25:24 +0000
@@ -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;

=== renamed file 'mysql-test/t/innodb_bug35220.test' => 'mysql-test/t/innodb_bug35220.test.moved'
=== removed file 'mysql-test/t/multi_range_count_basic_32.test'
--- a/mysql-test/t/multi_range_count_basic_32.test	2008-05-08 18:13:39 +0000
+++ b/mysql-test/t/multi_range_count_basic_32.test	1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-################################################################################
-# Created by Horst Hunger      2008-05-07                                      #
-#                                                                              #
-# Wrapper for 32 bit machines                                                  #
-################################################################################
-
---source include/have_32bit.inc
---source include/multi_range_count_basic.inc
-

=== removed file 'mysql-test/t/multi_range_count_basic_64.test'
--- a/mysql-test/t/multi_range_count_basic_64.test	2008-05-08 18:13:39 +0000
+++ b/mysql-test/t/multi_range_count_basic_64.test	1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-################################################################################
-# Created by Horst Hunger      2008-05-07                                      #
-#                                                                              #
-# Wrapper for 64 bit machines                                                  #
-################################################################################
-
---source include/have_64bit.inc
---source include/multi_range_count_basic.inc
-

=== modified file 'mysql-test/t/partition_federated.test'
--- a/mysql-test/t/partition_federated.test	2008-07-23 12:03:59 +0000
+++ b/mysql-test/t/partition_federated.test	2008-08-18 16:47:28 +0000
@@ -3,7 +3,7 @@
 #
 -- source include/have_partition.inc
 -- source include/not_embedded.inc
--- source include/have_federated_db.inc
+-- source suite/federated/have_federated_db.inc
 
 --disable_warnings
 drop table if exists t1;

=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test	2008-08-07 20:51:09 +0000
+++ b/mysql-test/t/subselect.test	2008-08-18 16:47:28 +0000
@@ -3507,6 +3507,7 @@ SELECT * FROM t2 WHERE b NOT IN (SELECT 
 
 DROP TABLE t1,t2;
 
+|<<<<<<< TREE
 --echo End of 5.0 tests.
 
 #
@@ -3735,3 +3736,18 @@ SELECT * FROM t1 WHERE EXISTS ( SELECT 1
 SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
 
 DROP TABLE t1, t2;
+|=======
+#
+# 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.
+|>>>>>>> MERGE-SOURCE

=== modified file 'sql/field.h'
--- a/sql/field.h	2008-07-21 03:55:09 +0000
+++ b/sql/field.h	2008-08-18 16:47:28 +0000
@@ -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.
@@ -50,7 +49,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
@@ -1720,6 +1720,7 @@ public:
   }
   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

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2008-08-05 11:20:20 +0000
+++ b/sql/item.cc	2008-08-18 16:47:28 +0000
@@ -436,8 +436,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);
 }
 
@@ -7028,8 +7031,9 @@ bool Item_type_holder::join_types(THD *t
   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);

=== modified file 'sql/item.h'
--- a/sql/item.h	2008-06-17 20:04:19 +0000
+++ b/sql/item.h	2008-08-18 16:47:28 +0000
@@ -472,9 +472,9 @@ class Item
   virtual bool is_expensive_processor(uchar *arg) { return 0; }
 
 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) {}

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2008-08-05 11:20:20 +0000
+++ b/sql/item_cmpfunc.cc	2008-08-18 16:47:28 +0000
@@ -2227,8 +2227,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);
 }
 
 
@@ -2409,8 +2412,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);
 }
 

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-08-05 11:20:20 +0000
+++ b/sql/item_func.cc	2008-08-18 16:47:28 +0000
@@ -1156,9 +1156,10 @@ my_decimal *Item_func_plus::decimal_op(m
 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)
@@ -1269,8 +1270,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);
 }
 
@@ -1317,8 +1318,8 @@ my_decimal *Item_func_div::decimal_op(my
 
 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;

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-08-05 11:20:20 +0000
+++ b/sql/mysql_priv.h	2008-08-18 16:47:28 +0000
@@ -2234,6 +2234,7 @@ int writefrm(const char* name, const uch
 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);

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-08-05 11:20:20 +0000
+++ b/sql/share/errmsg.txt	2008-08-18 16:47:28 +0000
@@ -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"

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2008-07-25 17:21:55 +0000
+++ b/sql/sp_head.cc	2008-08-18 16:47:28 +0000
@@ -468,7 +468,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 %p", &sp->mem_root));
   DBUG_RETURN(sp);

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2008-08-05 11:20:20 +0000
+++ b/sql/sql_acl.cc	2008-08-18 16:47:28 +0000
@@ -5811,7 +5811,6 @@ bool mysql_drop_user(THD *thd, List <LEX
 
   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;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-07-22 14:16:22 +0000
+++ b/sql/sql_base.cc	2008-08-18 16:47:28 +0000
@@ -1466,6 +1466,8 @@ bool close_thread_table(THD *thd, TABLE 
     table->file->extra(HA_EXTRA_DETACH_CHILDREN);
 
     /* Free memory and reset for next loop */
+    free_field_buffers_larger_than(table,MAX_TDC_BLOB_SIZE);
+    
     table->file->ha_reset();
     table_def_unuse_table(table);
   }

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2008-08-05 11:20:20 +0000
+++ b/sql/sql_lex.h	2008-08-18 16:47:28 +0000
@@ -423,11 +423,11 @@ public:
   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) {}

=== modified file 'sql/sql_list.h'
--- a/sql/sql_list.h	2008-03-28 17:47:53 +0000
+++ b/sql/sql_list.h	2008-08-18 16:47:28 +0000
@@ -29,7 +29,7 @@ public:
   {
     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 @@ public:
 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 | ME_FATALERROR));
   }

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-08-07 20:51:09 +0000
+++ b/sql/sql_parse.cc	2008-08-18 16:47:28 +0000
@@ -6715,15 +6715,24 @@ bool reload_acl_and_cache(THD *thd, ulon
       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;
@@ -6804,8 +6813,15 @@ bool reload_acl_and_cache(THD *thd, ulon
       tmp_write_to_binlog= 0;
       if (lock_global_read_lock(thd))
 	return 1;                               // Killed
+|<<<<<<< TREE
       result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
                                   FALSE : TRUE);
+|=======
+      if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+                              FALSE : TRUE, TRUE))
+          result= 1;
+      
+|>>>>>>> MERGE-SOURCE
       if (make_global_read_lock_block_commit(thd)) // Killed
       {
         /* Don't leave things in a half-locked state */
@@ -6815,6 +6831,7 @@ bool reload_acl_and_cache(THD *thd, ulon
     }
     else
     {
+|<<<<<<< TREE
       if (thd && thd->locked_tables_mode)
       {
         /*
@@ -6844,6 +6861,11 @@ bool reload_acl_and_cache(THD *thd, ulon
 
       result= close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
                                   FALSE : TRUE);
+|=======
+      if (close_cached_tables(thd, tables, FALSE, (options & REFRESH_FAST) ?
+                              FALSE : TRUE, FALSE))
+        result= 1;
+|>>>>>>> MERGE-SOURCE
     }
     my_dbopt_cleanup();
   }
@@ -6867,8 +6889,8 @@ bool reload_acl_and_cache(THD *thd, ulon
 #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

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-08-05 11:20:20 +0000
+++ b/sql/sql_select.cc	2008-08-18 16:47:28 +0000
@@ -8687,6 +8687,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.

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	2008-04-21 07:30:39 +0000
+++ b/sql/sql_string.h	2008-08-18 16:47:28 +0000
@@ -75,7 +75,7 @@ public:
     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); }

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2008-08-05 11:20:20 +0000
+++ b/sql/table.cc	2008-08-18 16:47:28 +0000
@@ -2123,6 +2123,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 */
 

=== modified file 'sql/table.h'
--- a/sql/table.h	2008-07-22 14:16:22 +0000
+++ b/sql/table.h	2008-08-18 16:47:28 +0000
@@ -952,6 +952,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;

=== modified file 'support-files/build-tags' (properties changed: +x to -x)
--- a/support-files/build-tags	2008-05-23 07:42:40 +0000
+++ b/support-files/build-tags	2008-08-18 16:47:28 +0000
@@ -1,9 +1,18 @@
 #! /bin/sh
 
 rm -f TAGS
+|<<<<<<< TREE
 filter='\.cc$\|\.c$\|\.h$\|\.yy\|\.[ch]pp$'
 files=`find . | grep $filter `
 for f in $files ;
+|=======
+filter='\.cc$\|\.c$\|\.h$\|\.yy$'
+
+list="find . -type f"
+bzr root >/dev/null 2>/dev/null && list="bzr ls --kind=file --versioned"
+
+$list |grep $filter |while read f; 
+|>>>>>>> MERGE-SOURCE
 do
 	 etags -o TAGS --append $f
 done

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2008-08-14 10:17:08 +0000
+++ b/tests/mysql_client_test.c	2008-08-18 16:47:28 +0000
@@ -17623,6 +17623,7 @@ static void test_wl4166_2()
 
 }
 
+|<<<<<<< TREE
 
 /**
   Test how warnings generated during assignment of parameters
@@ -17881,6 +17882,8 @@ static void test_wl4284_1()
   DBUG_VOID_RETURN;
 }
 
+|=======
+|>>>>>>> MERGE-SOURCE
 /**
   Bug#38486 Crash when using cursor protocol
 */
@@ -18219,10 +18222,13 @@ static struct my_tests_st my_tests[]= {
   { "test_bug28386", test_bug28386 },
   { "test_wl4166_1", test_wl4166_1 },
   { "test_wl4166_2", test_wl4166_2 },
+|<<<<<<< TREE
   { "test_wl4166_3", test_wl4166_3 },
   { "test_wl4166_4", test_wl4166_4 },
   { "test_bug36004", test_bug36004 },
   { "test_wl4284_1", test_wl4284_1 },
+|=======
+|>>>>>>> MERGE-SOURCE
   { "test_bug38486", test_bug38486 },
   { 0, 0 }
 };

Thread
bzr commit into mysql-6.0 branch (sven:2703) Bug#18817 Bug#21226 Bug#29738Bug#31605 Bug#33362 Bug#34159 Bug#34286 Bug#35220 Bug#35352 Bug#35808Bug#365...Sven Sandberg18 Aug