List:Commits« Previous MessageNext Message »
From:jonas Date:August 7 2008 3:37pm
Subject:bzr commit into mysql-6.0-ndb branch (jonas:2655) Bug#36547
View as plain text  
#At file:///home/jonas/bzr/mysql-6.0-ndb/

 2655 jonas@stripped	2008-08-07 [merge]
      merge 5.1-telco-6.2-merge to 6.0-ndb
removed:
  .bzr-mysql/
  .bzr-mysql/default.conf
  mysql-test/r/innodb_bug34053.result
  mysql-test/r/rpl_slave_compressed_protocol_basic.result
  mysql-test/r/rpl_slave_exec_mode_basic.result
  mysql-test/r/rpl_slave_net_timeout_basic.result
  mysql-test/r/rpl_slave_transaction_retries_basic_32.result
  mysql-test/r/rpl_slave_transaction_retries_basic_64.result
  mysql-test/r/rpl_sync_binlog_basic_32.result
  mysql-test/r/rpl_sync_binlog_basic_64.result
  mysql-test/suite/ndb_team/t/ndb_dd_restore_compat.test
  mysql-test/t/innodb_bug34053.test
  mysql-test/t/rpl_slave_compressed_protocol_basic.test
  mysql-test/t/rpl_slave_exec_mode_basic.test
  mysql-test/t/rpl_slave_net_timeout_basic.test
  mysql-test/t/rpl_slave_transaction_retries_basic_32.test
  mysql-test/t/rpl_slave_transaction_retries_basic_64.test
  mysql-test/t/rpl_sync_binlog_basic_32.test
  mysql-test/t/rpl_sync_binlog_basic_64.test
added:
  .bzr-mysql/
  .bzr-mysql/default.conf
  mysql-test/include/multi_range_count_basic.inc
  mysql-test/include/show_qc_status.inc
  mysql-test/r/innodb_bug34053.result
  mysql-test/r/log_bin_trust_routine_creators_basic.result
  mysql-test/r/multi_range_count_basic_32.result
  mysql-test/r/multi_range_count_basic_64.result
  mysql-test/std_data/ndb_apply_status.frm
  mysql-test/suite/ndb/r/bug36547.result
  mysql-test/suite/ndb/r/ndb_cache_trans.result
  mysql-test/suite/ndb/t/bug36547.test
  mysql-test/suite/ndb/t/ndb_cache_trans.test
  mysql-test/t/innodb_bug34053.test
  mysql-test/t/log_bin_trust_routine_creators_basic.test
  mysql-test/t/multi_range_count_basic_32.test
  mysql-test/t/multi_range_count_basic_64.test
  mysys/tests/
  mysys/tests/Makefile.am
  storage/ndb/src/common/util/ndb_show_compat.cc
renamed:
  mysql-test/r/rpl_slave_allow_batching_basic.result =>
mysql-test/r/slave_allow_batching_basic.result
  mysql-test/suite/ndb_team/r/ndb_dd_restore_compat.result =>
mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
  mysql-test/t/rpl_slave_allow_batching_basic.test =>
mysql-test/t/slave_allow_batching_basic.test
  mysys/test_charset.c => mysys/tests/test_charset.c
  mysys/test_dir.c => mysys/tests/test_dir.c
  mysys/testhash.c => mysys/tests/testhash.c
  storage/ndb/src/common/util/ndb_init.c => storage/ndb/src/common/util/ndb_init.cpp
modified:
  .bzrignore
  BUILD/autorun.sh
  Makefile.am
  client/Makefile.am
  client/mysqltest.c
  config/ac-macros/ha_ndbcluster.m4
  config/ac-macros/zlib.m4
  configure.in
  dbug/Makefile.am
  extra/CMakeLists.txt
  extra/Makefile.am
  libmysql/Makefile.am
  libmysql/Makefile.shared
  libmysqld/Makefile.am
  libmysqld/examples/Makefile.am
  mysql-test/mysql-test-run.pl
  mysql-test/r/sp-error.result
  mysql-test/r/union.result
  mysql-test/suite/ndb/r/ndb_alter_table_backup.result
  mysql-test/suite/ndb/r/ndb_basic.result
  mysql-test/suite/ndb/r/ndb_blob.result
  mysql-test/suite/ndb/r/ndb_condition_pushdown.result
  mysql-test/suite/ndb/r/ndb_restore_compat.result
  mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result
  mysql-test/suite/ndb/t/ndb_alter_table_backup.test
  mysql-test/suite/ndb/t/ndb_blob.test
  mysql-test/suite/ndb/t/ndb_condition_pushdown.test
  mysql-test/suite/ndb/t/ndb_restore_compat.test
  mysql-test/suite/ndb/t/ndb_restore_different_endian_data.test
  mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test
  mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result
  mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test
  mysql-test/t/sp-error.test
  mysql-test/t/union.test
  mysys/Makefile.am
  mysys/my_bitmap.c
  mysys/queues.c
  netware/Makefile.am
  regex/Makefile.am
  scripts/mysql_config.sh
  sql/Makefile.am
  sql/ha_ndbcluster.cc
  sql/ha_ndbcluster_binlog.cc
  sql/ha_ndbcluster_connection.cc
  sql/ha_ndbcluster_connection.h
  sql/mysqld.cc
  sql/sql_class.h
  sql/stacktrace.c
  sql/table.cc
  storage/archive/Makefile.am
  storage/heap/Makefile.am
  storage/myisam/Makefile.am
  storage/ndb/config/type_ndbapitest.mk.am
  storage/ndb/config/type_ndbapitools.mk.am
  storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp
  storage/ndb/include/kernel/signaldata/KeyInfo.hpp
  storage/ndb/include/kernel/signaldata/ListTables.hpp
  storage/ndb/include/mgmapi/mgmapi_config_parameters.h
  storage/ndb/include/ndb_version.h.in
  storage/ndb/include/ndbapi/NdbOperation.hpp
  storage/ndb/include/ndbapi/NdbReceiver.hpp
  storage/ndb/include/util/SimpleProperties.hpp
  storage/ndb/src/Makefile.am
  storage/ndb/src/common/debugger/EventLogger.cpp
  storage/ndb/src/common/transporter/TCP_Transporter.cpp
  storage/ndb/src/common/transporter/Transporter.cpp
  storage/ndb/src/common/transporter/TransporterRegistry.cpp
  storage/ndb/src/common/util/Makefile.am
  storage/ndb/src/common/util/version.c
  storage/ndb/src/cw/cpcd/Makefile.am
  storage/ndb/src/kernel/Makefile.am
  storage/ndb/src/kernel/blocks/ERROR_codes.txt
  storage/ndb/src/kernel/blocks/Makefile.am
  storage/ndb/src/kernel/blocks/backup/Backup.cpp
  storage/ndb/src/kernel/blocks/backup/Makefile.am
  storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
  storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp
  storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp
  storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
  storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
  storage/ndb/src/kernel/blocks/dbdict/Makefile.am
  storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
  storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
  storage/ndb/src/kernel/blocks/dbdih/Makefile.am
  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
  storage/ndb/src/kernel/blocks/dblqh/Makefile.am
  storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
  storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp
  storage/ndb/src/kernel/blocks/dbtup/Makefile.am
  storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
  storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp
  storage/ndb/src/kernel/blocks/lgman.cpp
  storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
  storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
  storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
  storage/ndb/src/kernel/blocks/suma/Suma.cpp
  storage/ndb/src/kernel/blocks/suma/Suma.hpp
  storage/ndb/src/kernel/error/ErrorReporter.cpp
  storage/ndb/src/kernel/main.cpp
  storage/ndb/src/kernel/vm/Configuration.cpp
  storage/ndb/src/kernel/vm/Emulator.cpp
  storage/ndb/src/kernel/vm/Makefile.am
  storage/ndb/src/kernel/vm/SimplePropertiesSection.cpp
  storage/ndb/src/kernel/vm/SimulatedBlock.cpp
  storage/ndb/src/kernel/vm/SimulatedBlock.hpp
  storage/ndb/src/kernel/vm/WatchDog.cpp
  storage/ndb/src/kernel/vm/bench_pool.cpp
  storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
  storage/ndb/src/mgmclient/Makefile.am
  storage/ndb/src/mgmsrv/Makefile.am
  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
  storage/ndb/src/mgmsrv/Services.cpp
  storage/ndb/src/mgmsrv/main.cpp
  storage/ndb/src/ndbapi/ClusterMgr.cpp
  storage/ndb/src/ndbapi/DictCache.cpp
  storage/ndb/src/ndbapi/Makefile.am
  storage/ndb/src/ndbapi/Ndb.cpp
  storage/ndb/src/ndbapi/NdbApiSignal.hpp
  storage/ndb/src/ndbapi/NdbBlob.cpp
  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
  storage/ndb/src/ndbapi/NdbIndexStat.cpp
  storage/ndb/src/ndbapi/NdbInterpretedCode.cpp
  storage/ndb/src/ndbapi/NdbOperation.cpp
  storage/ndb/src/ndbapi/NdbOperationDefine.cpp
  storage/ndb/src/ndbapi/NdbOperationExec.cpp
  storage/ndb/src/ndbapi/NdbOperationInt.cpp
  storage/ndb/src/ndbapi/NdbOperationSearch.cpp
  storage/ndb/src/ndbapi/NdbRecord.hpp
  storage/ndb/src/ndbapi/NdbScanOperation.cpp
  storage/ndb/src/ndbapi/NdbTransaction.cpp
  storage/ndb/src/ndbapi/Ndbif.cpp
  storage/ndb/src/ndbapi/Ndbinit.cpp
  storage/ndb/src/ndbapi/ObjectMap.cpp
  storage/ndb/src/ndbapi/ObjectMap.hpp
  storage/ndb/src/ndbapi/TransporterFacade.hpp
  storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
  storage/ndb/src/ndbapi/ndberror.c
  storage/ndb/test/ndbapi/testBlobs.cpp
  storage/ndb/test/ndbapi/testDict.cpp
  storage/ndb/test/ndbapi/testInterpreter.cpp
  storage/ndb/test/ndbapi/testNodeRestart.cpp
  storage/ndb/test/ndbapi/testOIBasic.cpp
  storage/ndb/test/ndbapi/testSRBank.cpp
  storage/ndb/test/ndbapi/testScan.cpp
  storage/ndb/test/ndbapi/test_event.cpp
  storage/ndb/test/run-test/Makefile.am
  storage/ndb/test/run-test/daily-basic-tests.txt
  storage/ndb/tools/ndb_size.pl
  strings/Makefile.am
  unittest/mysys/Makefile.am
  mysql-test/r/slave_allow_batching_basic.result
  mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
  mysql-test/t/slave_allow_batching_basic.test
  storage/ndb/src/common/util/ndb_init.cpp

=== added directory '.bzr-mysql'
=== removed directory '.bzr-mysql'
=== added file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	1970-01-01 00:00:00 +0000
+++ b/.bzr-mysql/default.conf	2008-08-07 13:36:47 +0000
@@ -0,0 +1,4 @@
+[MYSQL]
+post_commit_to = "commits@stripped"
+post_push_to = "commits@stripped"
+tree_name = "mysql-6.0-ndb"

=== removed file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2008-05-28 15:13:18 +0000
+++ b/.bzr-mysql/default.conf	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-[MYSQL]
-post_commit_to = "commits@stripped"
-post_push_to = "commits@stripped"
-tree_name = "mysql-6.0"

=== modified file '.bzrignore'
--- a/.bzrignore	2008-06-19 09:43:26 +0000
+++ b/.bzrignore	2008-08-07 13:36:47 +0000
@@ -1566,6 +1566,17 @@ mysys/test_thr_alarm
 mysys/test_thr_lock
 mysys/test_vsnprintf
 mysys/testhash
+mysys/tests/.deps/test_charset.Tpo
+mysys/tests/.deps/test_dir.Tpo
+mysys/tests/test_base64
+mysys/tests/test_bitmap
+mysys/tests/test_gethwaddr
+mysys/tests/test_io_cache
+mysys/tests/test_priority_queue
+mysys/tests/test_thr_alarm
+mysys/tests/test_thr_lock
+mysys/tests/test_vsnprintf
+mysys/tests/testhash
 ndb/bin/DbAsyncGenerator
 ndb/bin/DbCreate
 ndb/bin/acid
@@ -2710,6 +2721,7 @@ storage/ndb/src/common/mgmcommon/printCo
 storage/ndb/src/common/portlib/libportlib.dsp
 storage/ndb/src/common/transporter/libtransporter.dsp
 storage/ndb/src/common/util/libgeneral.dsp
+storage/ndb/src/common/util/ndb_show_compat
 storage/ndb/src/common/util/testBitmask.cpp
 storage/ndb/src/cw/cpcd/ndb_cpcd
 storage/ndb/src/dummy.cpp

=== modified file 'BUILD/autorun.sh'
--- a/BUILD/autorun.sh	2007-10-29 21:48:58 +0000
+++ b/BUILD/autorun.sh	2008-04-25 06:32:23 +0000
@@ -27,5 +27,5 @@ $LIBTOOLIZE --automake --force --copy ||
   
 # --add-missing instructs automake to install missing auxiliary files
 # and --force to overwrite them if they already exist
-automake --add-missing --force  --copy || die "Can't execute automake"
+automake --add-missing --force  --copy --gnu -W no-portability || die "Can't execute
automake"
 autoconf || die "Can't execute autoconf"

=== modified file 'Makefile.am'
--- a/Makefile.am	2008-06-16 19:27:44 +0000
+++ b/Makefile.am	2008-08-07 13:36:47 +0000
@@ -38,7 +38,7 @@ SUBDIRS =		. include @docs_dirs@ @zlib_d
 DIST_SUBDIRS =		. include Docs zlib \
 			cmd-line-utils sql-common scripts \
 			pstack \
-			strings mysys dbug extra regex libmysql libmysql_r client unittest storage plugin \
+			strings mysys dbug mysys/tests extra regex libmysql libmysql_r client unittest storage
plugin \
 			vio sql man tests \
 			netware libmysqld \
 			mysql-test support-files sql-bench \

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2008-02-19 14:09:52 +0000
+++ b/client/Makefile.am	2008-08-07 13:36:47 +0000
@@ -54,6 +54,7 @@ bin_PROGRAMS =			mysql \
 mysql_SOURCES =			mysql.cc readline.cc sql_string.cc \
 				completion_hash.cc
 mysql_LDADD =			@readline_link@ @TERMCAP_LIB@ \
+				@ZLIB_LIBS@ \
 				$(LDADD) $(CXXLDFLAGS)
 mysqladmin_SOURCES =		mysqladmin.cc
 
@@ -75,7 +76,7 @@ mysqlimport_SOURCES=		mysqlimport.c
 mysqlimport_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
 				@CLIENT_EXTRA_LDFLAGS@ \
 				$(LIBMYSQLCLIENT_LA) \
-				$(top_builddir)/mysys/libmysys.a
+				$(top_builddir)/mysys/libmysyslt.la
 
 mysqlshow_SOURCES=		mysqlshow.c
 
@@ -84,7 +85,7 @@ mysqlslap_CFLAGS=		-DTHREAD -UUNDEF_THRE
 mysqlslap_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
 				@CLIENT_EXTRA_LDFLAGS@ \
 				$(LIBMYSQLCLIENT_LA) \
-				$(top_builddir)/mysys/libmysys.a
+				$(top_builddir)/mysys/libmysyslt.la
 
 mysqltest_SOURCES=		mysqltest.c \
 				$(top_srcdir)/mysys/my_getsystime.c \

=== modified file 'client/mysqltest.c'
--- a/client/mysqltest.c	2008-06-19 09:43:26 +0000
+++ b/client/mysqltest.c	2008-08-07 13:36:47 +0000
@@ -67,7 +67,8 @@
 enum {
   OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
   OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
-  OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES
+  OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES,
+  OPT_RESULT_FORMAT_VERSION
 };
 
 static int record= 0, opt_sleep= -1;
@@ -77,6 +78,7 @@ const char *opt_logdir= "";
 const char *opt_include= 0, *opt_charsets_dir;
 static int opt_port= 0;
 static int opt_max_connect_retries;
+static int opt_result_format_version;
 static my_bool opt_compress= 0, silent= 0, verbose= 0;
 static my_bool debug_info_flag= 0, debug_check_flag= 0;
 static my_bool tty_password= 0;
@@ -267,10 +269,12 @@ enum enum_commands {
   Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
   Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
   Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
+  Q_RESULT_FORMAT_VERSION,
 
   Q_UNKNOWN,			       /* Unknown command.   */
   Q_COMMENT,			       /* Comments, ignored. */
-  Q_COMMENT_WITH_COMMAND
+  Q_COMMENT_WITH_COMMAND,
+  Q_EMPTY_LINE
 };
 
 
@@ -355,6 +359,7 @@ const char *command_names[]=
   "change_user",
   "mkdir",
   "rmdir",
+  "result_format",
 
   0
 };
@@ -1990,6 +1995,59 @@ void var_query_set(VAR *var, const char 
 }
 
 
+static void
+set_result_format_version(ulong new_version)
+{
+  switch (new_version){
+  case 1:
+    /* The first format */
+    break;
+  case 2:
+    /* New format that also writes comments and empty lines
+       from test file to result */
+    break;
+  default:
+    die("Version format %lu has not yet been implemented", new_version);
+    break;
+  }
+  opt_result_format_version= new_version;
+}
+
+
+/*
+  Set the result format version to use when generating
+  the .result file
+*/
+
+static void
+do_result_format_version(struct st_command *command)
+{
+  long version;
+  static DYNAMIC_STRING ds_version;
+  const struct command_arg result_format_args[] = {
+    "version", ARG_STRING, TRUE, &ds_version, "Version to use",
+  };
+
+  DBUG_ENTER("do_result_format_version");
+
+  check_command_args(command, command->first_argument,
+                     result_format_args,
+                     sizeof(result_format_args)/sizeof(struct command_arg),
+                     ',');
+
+  /* Convert version  number to int */
+  if (!str2int(ds_version.str, 10, (long) 0, (long) INT_MAX, &version))
+    die("Invalid version number: '%s'", ds_version.str);
+
+  set_result_format_version(version);
+
+  dynstr_append(&ds_res, "result_format: ");
+  dynstr_append_mem(&ds_res, ds_version.str, ds_version.length);
+  dynstr_append(&ds_res, "\n");
+  dynstr_free(&ds_version);
+}
+
+
 /*
   Set variable from the result of a field in a query
 
@@ -4613,7 +4671,7 @@ my_bool end_of_query(int c)
 
 int read_line(char *buf, int size)
 {
-  char c, last_quote;
+  char c, last_quote, last_char= 0;
   char *p= buf, *buf_end= buf + size - 1;
   int skip_char= 0;
   enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
@@ -4712,14 +4770,24 @@ int read_line(char *buf, int size)
       }
       else if (my_isspace(charset_info, c))
       {
-        /* Skip all space at begining of line */
 	if (c == '\n')
         {
+          if (last_char == '\n')
+          {
+            /* Two new lines in a row, return empty line */
+            DBUG_PRINT("info", ("Found two new lines in a row"));
+            *p++= c;
+            *p= 0;
+            DBUG_RETURN(0);
+          }
+
           /* Query hasn't started yet */
 	  start_lineno= cur_file->lineno;
           DBUG_PRINT("info", ("Query hasn't started yet, start_lineno: %d",
                               start_lineno));
         }
+
+        /* Skip all space at begining of line */
 	skip_char= 1;
       }
       else if (end_of_query(c))
@@ -4760,6 +4828,8 @@ int read_line(char *buf, int size)
 
     }
 
+    last_char= c;
+
     if (!skip_char)
     {
       /* Could be a multibyte character */
@@ -5005,9 +5075,10 @@ int read_command(struct st_command** com
     DBUG_RETURN(1);
   }
 
-  convert_to_format_v1(read_command_buf);
+  if (opt_result_format_version == 1)
+    convert_to_format_v1(read_command_buf);
 
-  DBUG_PRINT("info", ("query: %s", read_command_buf));
+  DBUG_PRINT("info", ("query: '%s'", read_command_buf));
   if (*p == '#')
   {
     command->type= Q_COMMENT;
@@ -5017,6 +5088,10 @@ int read_command(struct st_command** com
     command->type= Q_COMMENT_WITH_COMMAND;
     p+= 2; /* Skip past -- */
   }
+  else if (*p == '\n')
+  {
+    command->type= Q_EMPTY_LINE;
+  }
 
   /* Skip leading spaces */
   while (*p && my_isspace(charset_info, *p))
@@ -5109,6 +5184,11 @@ static struct my_option my_long_options[
   {"result-file", 'R', "Read/Store result from/in this file.",
    (uchar**) &result_file_name, (uchar**) &result_file_name, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"result-format-version", OPT_RESULT_FORMAT_VERSION,
+   "Version of the result file format to use",
+   (uchar**) &opt_result_format_version,
+   (uchar**) &opt_result_format_version, 0,
+   GET_INT, REQUIRED_ARG, 1, 1, 2, 0, 0, 0},
   {"server-arg", 'A', "Send option value to embedded server as a parameter.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"server-file", 'F', "Read embedded server arguments from file.",
@@ -5300,6 +5380,9 @@ get_one_option(int optid, const struct m
     sf_malloc_quick=1;
 #endif
     break;
+  case OPT_RESULT_FORMAT_VERSION:
+    set_result_format_version(opt_result_format_version);
+    break;
   case 'V':
     print_version();
     exit(0);
@@ -7003,6 +7086,7 @@ int main(int argc, char **argv)
       case Q_COPY_FILE: do_copy_file(command); break;
       case Q_CHMOD_FILE: do_chmod_file(command); break;
       case Q_PERL: do_perl(command); break;
+      case Q_RESULT_FORMAT_VERSION: do_result_format_version(command); break;
       case Q_DELIMITER:
         do_delimiter(command);
 	break;
@@ -7119,9 +7203,38 @@ int main(int argc, char **argv)
 	do_sync_with_master2(0);
 	break;
       }
-      case Q_COMMENT:				/* Ignore row */
+      case Q_COMMENT:
+      {
+        const char* p= command->query;
         command->last_argument= command->end;
+
+        /* Don't output comments in v1 */
+        if (opt_result_format_version == 1)
+          break;
+
+        /* Don't output comments if query logging is off */
+        if (disable_query_log)
+          break;
+
+        /* Write comment's with two starting #'s to result file */
+        if (p && *p == '#' && *(p+1) == '#')
+        {
+          dynstr_append_mem(&ds_res, command->query, command->query_len);
+          dynstr_append(&ds_res, "\n");
+        }
 	break;
+      }
+      case Q_EMPTY_LINE:
+        /* Don't output newline in v1 */
+        if (opt_result_format_version == 1)
+          break;
+
+        /* Don't output newline if query logging is off */
+        if (disable_query_log)
+          break;
+
+        dynstr_append(&ds_res, "\n");
+        break;
       case Q_PING:
 	(void) mysql_ping(&cur_con->mysql);
 	break;

=== modified file 'config/ac-macros/ha_ndbcluster.m4'
--- a/config/ac-macros/ha_ndbcluster.m4	2008-04-02 12:04:51 +0000
+++ b/config/ac-macros/ha_ndbcluster.m4	2008-08-07 13:36:47 +0000
@@ -2,9 +2,10 @@ dnl ------------------------------------
 dnl Macro: MYSQL_CHECK_NDBCLUSTER
 dnl ---------------------------------------------------------------------------
 
-NDB_MYSQL_VERSION_MAJOR=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f1`
-NDB_MYSQL_VERSION_MINOR=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f2`
-NDB_MYSQL_VERSION_BUILD=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f3`
+NDB_MYSQL_VERSION_MAJOR=`echo $VERSION | cut -d. -f1`
+NDB_MYSQL_VERSION_MINOR=`echo $VERSION | cut -d. -f2`
+NDB_MYSQL_VERSION_BUILD=`echo $VERSION | cut -d. -f3 | cut -d- -f1`
+
 TEST_NDBCLUSTER=""
 
 dnl for build ndb docs
@@ -52,38 +53,38 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
   esac
 
   AC_ARG_WITH([ndb-test],
-              [
-  --with-ndb-test       Include the NDB Cluster ndbapi test programs],
+              [AC_HELP_STRING([--with-ndb-test],
+                              [Include the NDB Cluster ndbapi test programs])],
               [ndb_test="$withval"],
               [ndb_test=no])
   AC_ARG_WITH([ndb-docs],
-              [
-  --with-ndb-docs       Include the NDB Cluster ndbapi and mgmapi documentation],
+              [AC_HELP_STRING([--with-ndb-docs],
+              [Include the NDB Cluster ndbapi and mgmapi documentation])],
               [ndb_docs="$withval"],
               [ndb_docs=no])
   AC_ARG_WITH([ndb-port],
-              [
-  --with-ndb-port       Port for NDB Cluster management server],
+              [AC_HELP_STRING([--with-ndb-port],
+                              [Port for NDB Cluster management server])],
               [ndb_port="$withval"],
               [ndb_port="default"])
   AC_ARG_WITH([ndb-port-base],
-              [
-  --with-ndb-port-base  Base port for NDB Cluster transporters],
+              [AC_HELP_STRING([--with-ndb-port-base],
+                              [Base port for NDB Cluster transporters])],
               [ndb_port_base="$withval"],
               [ndb_port_base="default"])
   AC_ARG_WITH([ndb-debug],
-              [
-  --without-ndb-debug   Disable special ndb debug features],
+              [AC_HELP_STRING([--without-ndb-debug],
+                              [Disable special ndb debug features])],
               [ndb_debug="$withval"],
               [ndb_debug="default"])
   AC_ARG_WITH([ndb-ccflags],
-              AC_HELP_STRING([--with-ndb-ccflags=CFLAGS],
-                           [Extra CFLAGS for ndb compile]),
+              [AC_HELP_STRING([--with-ndb-ccflags=CFLAGS],
+                              [Extra CFLAGS for ndb compile])],
               [ndb_ccflags=${withval}],
               [ndb_ccflags=""])
   AC_ARG_WITH([ndb-binlog],
-              [
-  --without-ndb-binlog       Disable ndb binlog],
+              [AC_HELP_STRING([--without-ndb-binlog],
+                              [Disable ndb binlog])],
               [ndb_binlog="$withval"],
               [ndb_binlog="default"])
 
@@ -139,6 +140,7 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
       ;;
   esac
 
+
   AC_MSG_RESULT([done.])
 ])
 
@@ -202,7 +204,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
     NDB_DEFS="-DNDB_DEBUG -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
   elif test "$have_ndb_debug" = "full"
   then
-    NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
+    NDB_DEFS="-DNDB_DEBUG_FULL -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD -DAPI_TRACE"
   else
     # no extra ndb debug but still do asserts if debug version
     if test "$with_debug" = "yes" -o "$with_debug" = "full"

=== modified file 'config/ac-macros/zlib.m4'
--- a/config/ac-macros/zlib.m4	2007-09-26 16:47:55 +0000
+++ b/config/ac-macros/zlib.m4	2008-04-25 06:32:23 +0000
@@ -19,7 +19,6 @@ AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
 save_CPPFLAGS="$CPPFLAGS"
 save_LIBS="$LIBS"
 CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
-LIBS="$LIBS $ZLIB_LIBS"
 if test X"$with_server" = Xno
 then
   zlibsym=zlibVersion

=== modified file 'configure.in'
--- a/configure.in	2008-06-19 09:43:26 +0000
+++ b/configure.in	2008-08-07 13:36:47 +0000
@@ -9,12 +9,12 @@ AC_CANONICAL_SYSTEM
 # remember to also update version.c in ndb
 # When changing major version number please also check switch statement
 # in mysqlbinlog::check_master_version().
-AM_INIT_AUTOMAKE(mysql, 6.0.6-alpha)
+AM_INIT_AUTOMAKE(mysql, 6.0.6-alpha-ndb-6.2.16)
 AM_CONFIG_HEADER([include/config.h:config.h.in])
 
 NDB_VERSION_MAJOR=6
 NDB_VERSION_MINOR=2
-NDB_VERSION_BUILD=14
+NDB_VERSION_BUILD=16
 NDB_VERSION_STATUS="-RC"
 
 PROTOCOL_VERSION=10
@@ -22,7 +22,7 @@ DOT_FRM_VERSION=6
 # See the libtool docs for information on how to do shared lib versions.
 SHARED_LIB_MAJOR_VERSION=16
 SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
-NDB_SHARED_LIB_MAJOR_VERSION=3
+NDB_SHARED_LIB_MAJOR_VERSION=4
 NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
 
 # Set all version vars based on $VERSION. How do we do this more elegant ?
@@ -858,6 +858,7 @@ AC_CHECK_FUNCS(log2)
 AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
   AC_CHECK_LIB(nsl, gethostbyname_r))
 AC_CHECK_FUNC(gethostbyname_r)
+AC_CHECK_LIB(mtmalloc, malloc)
 
 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
 AC_CHECK_FUNC(yp_get_default_domain, ,
@@ -2760,7 +2761,7 @@ if test -d "$srcdir/cmd-line-utils/readl
   AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
 fi
 
-AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
+AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
  unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
  unittest/mysys/Makefile unittest/examples/Makefile dnl
  strings/Makefile regex/Makefile storage/Makefile dnl

=== modified file 'dbug/Makefile.am'
--- a/dbug/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/dbug/Makefile.am	2008-04-25 06:32:23 +0000
@@ -16,10 +16,18 @@
 # MA 02111-1307, USA
 
 INCLUDES =              -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADD =                 libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
-pkglib_LIBRARIES =      libdbug.a
+LDADD =                 libdbuglt.la $(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/strings/libmystringslt.la ${ZLIB_LIBS}
+pkglib_LTLIBRARIES =	libdbug.la
+libdbug_la_LDFLAGS =   -static
+libdbug_la_SOURCES = 	
+libdbug_la_LIBADD =	libdbuglt.la
+# Force C++ linking - dummy.cxx doesn't have to exist with EXTRA in the name
+nodist_EXTRA_libdbug_la_SOURCES = dummy.cxx
+
+noinst_LTLIBRARIES =	libdbuglt.la
 noinst_HEADERS =        dbug_long.h
-libdbug_a_SOURCES =     dbug.c sanity.c
+libdbuglt_la_SOURCES =     dbug.c sanity.c
 EXTRA_DIST =            CMakeLists.txt example1.c example2.c example3.c \
                         user.r monty.doc dbug_add_tags.pl \
                         my_main.c main.c factorial.c dbug_analyze.c \

=== modified file 'extra/CMakeLists.txt'
--- a/extra/CMakeLists.txt	2008-04-02 17:52:11 +0000
+++ b/extra/CMakeLists.txt	2008-08-07 13:36:47 +0000
@@ -47,6 +47,9 @@ TARGET_LINK_LIBRARIES(perror strings mys
 ADD_EXECUTABLE(resolveip resolveip.c)
 TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug ws2_32)
 
+ADD_EXECUTABLE(resolveip resolveip.c)
+TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
+
 ADD_EXECUTABLE(replace replace.c)
 TARGET_LINK_LIBRARIES(replace strings mysys debug dbug ws2_32)
 

=== modified file 'extra/Makefile.am'
--- a/extra/Makefile.am	2007-11-01 18:37:56 +0000
+++ b/extra/Makefile.am	2008-08-07 13:36:47 +0000
@@ -15,8 +15,10 @@
 
 INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include \
 			-I$(top_srcdir)/sql
-LDADD =			@CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
-			../dbug/libdbug.a ../strings/libmystrings.a \
+LDADD =			@CLIENT_EXTRA_LDFLAGS@ \
+                        $(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+                        $(top_builddir)/strings/libmystringslt.la \
 			$(ZLIB_LIBS)
 BUILT_SOURCES=		$(top_builddir)/include/mysqld_error.h \
                         $(top_builddir)/include/sql_state.h \
@@ -44,6 +46,7 @@ $(top_builddir)/include/sql_state.h: $(t
 
 bin_PROGRAMS =		replace perror resolveip my_print_defaults \
 			resolve_stack_dump mysql_waitpid innochecksum
+			
 noinst_PROGRAMS =	charset2html
 EXTRA_PROGRAMS =	comp_err
 EXTRA_DIST =		CMakeLists.txt

=== modified file 'libmysql/Makefile.am'
--- a/libmysql/Makefile.am	2007-11-22 11:39:07 +0000
+++ b/libmysql/Makefile.am	2008-04-28 00:09:08 +0000
@@ -22,7 +22,7 @@
 
 target =	libmysqlclient.la
 target_defs =	-DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
-LIBS =		@CLIENT_LIBS@ 
+LIBS =		@CLIENT_LIBS@
 INCLUDES =	-I$(top_builddir)/include -I$(top_srcdir)/include \
 		$(openssl_includes) @ZLIB_INCLUDES@
 
@@ -36,15 +36,10 @@ noinst_HEADERS = client_settings.h
 
 link_sources:
 	  set -x; \
-	  ss=`echo $(mystringsobjects) | sed "s;\.lo;.c;g"`; \
 	  ds=`echo $(dbugobjects) | sed "s;\.lo;.c;g"`; \
 	  ms=`echo $(mysysobjects) | sed "s;\.lo;.c;g"`; \
 	  vs=`echo $(vio_objects) | sed "s;\.lo;.c;g"`; \
 	  scs=`echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"`; \
-	  for f in $$ss; do \
-	    rm -f $$f; \
-	    @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
-	  done; \
 	  for f in $$vs $(vioheaders); do \
 	    rm -f $$f; \
 	    @LN_CP_F@ $(top_srcdir)/vio/$$f $$f; \
@@ -53,10 +48,6 @@ link_sources:
 	    rm -f $$f; \
 	    @LN_CP_F@ $(top_srcdir)/sql-common/$$f $$f; \
 	  done; \
-	  for f in $(mystringsextra); do \
-	    rm -f $$f; \
-	    @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
-	  done; \
 	  for f in $$ds; do \
 	    rm -f $$f; \
 	    @LN_CP_F@ $(top_srcdir)/dbug/$$f $$f; \
@@ -87,7 +78,7 @@ nh =		my_global.h config-win32.h dbug.h 
 		mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h \
                 sql_common.h ../libmysql/client_settings.h 
 # Get a list of the needed objects  
-lobjs = $(mysysobjects1) $(dbugobjects) $(mystringsobjects) $(sqlobjects)
+lobjs = $(mysysobjects1) $(dbugobjects) $(sqlobjects)
 
 do-lib-dist:
 	dir=libmysql-$(MYSQL_NO_DASH_VERSION); \

=== modified file 'libmysql/Makefile.shared'
--- a/libmysql/Makefile.shared	2008-04-01 15:13:57 +0000
+++ b/libmysql/Makefile.shared	2008-08-07 13:36:47 +0000
@@ -34,21 +34,6 @@ noinst_PROGRAMS = conf_to_src
 target_sources = 	libmysql.c password.c \
 			get_password.c errmsg.c
 
-mystringsobjects =	strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
-			strmake.lo strend.lo \
-			strnlen.lo strfill.lo is_prefix.lo \
-			int2str.lo str2int.lo strinstr.lo strcont.lo \
-			strcend.lo bcmp.lo ctype-latin1.lo \
-			bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
-			strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
-			ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
-			ctype-big5.lo ctype-czech.lo ctype-cp932.lo ctype-eucjpms.lo ctype-euc_kr.lo \
-			ctype-win1250ch.lo ctype-utf8.lo ctype-extra.lo \
-			ctype-ucs2.lo ctype-gb2312.lo ctype-gbk.lo \
-			ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo \
-			ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
-
-mystringsextra= 	strto.c
 dbugobjects =		dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
 mysysheaders =		mysys_priv.h my_static.h
 vioheaders =		vio_priv.h
@@ -75,8 +60,7 @@ sql_cmn_objects =	pack.lo client.lo my_t
 # Not needed in the minimum library
 mysysobjects2 =		my_lib.lo mf_qsort.lo
 mysysobjects =		$(mysysobjects1) $(mysysobjects2)
-target_libadd =		$(mysysobjects) $(mystringsobjects) $(dbugobjects) \
- $(sql_cmn_objects) $(vio_objects) $(sqlobjects)
+target_libadd =		$(mysysobjects) $(dbugobjects) $(sql_cmn_objects) $(vio_objects)
$(sqlobjects) $(top_builddir)/strings/libmystringslt.la
 target_ldflags = -version-info @SHARED_LIB_VERSION@ @LD_VERSION_SCRIPT@ 
 vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo
 
@@ -100,13 +84,12 @@ endif
 #bmove_upp.lo:		$(LTCHARSET_OBJS)
 
 clean-local:
-	rm -f `echo $(mystringsobjects) | sed "s;\.lo;.c;g"` \
-	      `echo $(dbugobjects) | sed "s;\.lo;.c;g"` \
+	rm -f `echo $(dbugobjects) | sed "s;\.lo;.c;g"` \
 	      `echo $(mysysobjects) | sed "s;\.lo;.c;g"` \
 	      `echo $(vio_objects) | sed "s;\.lo;.c;g"` \
 	      `echo $(sql_cmn_objects) | sed "s;\.lo;.c;g"` \
 	       $(CHARSET_SRCS) $(CHARSET_OBJS) \
-	       $(mystringsextra) $(mysysheaders) $(vioheaders) \
+	       $(mysysheaders) $(vioheaders) \
                net.c
 
 conf_to_src_SOURCES = conf_to_src.c

=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2008-05-09 07:47:28 +0000
+++ b/libmysqld/Makefile.am	2008-08-07 13:36:47 +0000
@@ -97,9 +97,9 @@ sql_yacc.cc sql_yacc.h: $(top_srcdir)/sq
 
 # The following libraries should be included in libmysqld.a
 INC_LIB=	$(top_builddir)/regex/libregex.a \
-		$(top_builddir)/mysys/libmysys.a \
-		$(top_builddir)/strings/libmystrings.a \
-		$(top_builddir)/dbug/libdbug.a \
+		$(top_builddir)/mysys/.libs/libmysys.a \
+		$(top_builddir)/strings/.libs/libmystrings.a \
+		$(top_builddir)/dbug/.libs/libdbug.a \
 		$(top_builddir)/vio/libvio.a \
                 @NDB_SCI_LIBS@ \
 		@mysql_plugin_libs@ \

=== modified file 'libmysqld/examples/Makefile.am'
--- a/libmysqld/examples/Makefile.am	2007-12-07 14:35:28 +0000
+++ b/libmysqld/examples/Makefile.am	2008-08-07 13:36:47 +0000
@@ -37,7 +37,8 @@ INCLUDES =	-I$(top_builddir)/include -I$
 		-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
 		$(openssl_includes)
 LIBS =		@LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
-LDADD =		@CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
+LDADD =		@CLIENT_EXTRA_LDFLAGS@ $(top_srcdir)/libmysqld/libmysqld.a \
+		@LIBDL@ $(CXXLDFLAGS) \
                 @NDB_SCI_LIBS@
 
 mysqltest_embedded_LINK = $(CXXLINK)

=== added file 'mysql-test/include/multi_range_count_basic.inc'
--- a/mysql-test/include/multi_range_count_basic.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/multi_range_count_basic.inc	2008-05-08 18:13:39 +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/include/show_qc_status.inc'
--- a/mysql-test/include/show_qc_status.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/show_qc_status.inc	2008-05-28 14:26:26 +0000
@@ -0,0 +1,10 @@
+#
+# Retrieve the value of  'show status like "Qcache_[inserts, hits, queries]"'
+#  and display it in a minimal fashion on one line
+#
+let $_qcache_inserts= query_get_value(SHOW STATUS LIKE "Qcache_inserts", Value, 1);
+let $_qcache_hits= query_get_value(SHOW STATUS LIKE "Qcache_hits", Value, 1);
+let $_qcache_queries= query_get_value(SHOW STATUS LIKE "Qcache_queries_in_cache", Value,
1);
+echo Qcache_queries          $_qcache_queries;
+echo Qcache_inserts          $_qcache_inserts;
+echo Qcache_hits             $_qcache_hits;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-06-19 09:43:26 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-08-07 13:36:47 +0000
@@ -3997,6 +3997,7 @@ sub stop_all_servers () {
   {
     rm_ndbcluster_tables($mysqld->{'path_myddir'});
   }
+
 }
 
 
@@ -4315,22 +4316,6 @@ sub run_testcase_start_servers($) {
 	 $tinfo->{'master_num'} > 1 )
     {
       # Test needs cluster, start an extra mysqld connected to cluster
-
-      if ( $mysql_version_id >= 50100 )
-      {
-	# First wait for first mysql server to have created ndb system
-	# tables ok FIXME This is a workaround so that only one mysqld
-	# create the tables
-	if ( ! sleep_until_file_created(
-		  "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
-					$master->[0]->{'start_timeout'},
-					$master->[0]->{'pid'}))
-	{
-
-	  $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
-	  return 1;
-	}
-      }
       mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
     }
 

=== added file 'mysql-test/r/innodb_bug34053.result'
--- a/mysql-test/r/innodb_bug34053.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug34053.result	2008-02-19 16:44:09 +0000
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;

=== removed file 'mysql-test/r/innodb_bug34053.result'
--- a/mysql-test/r/innodb_bug34053.result	2008-06-12 00:08:07 +0000
+++ b/mysql-test/r/innodb_bug34053.result	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
-SET storage_engine=InnoDB;

=== added file 'mysql-test/r/log_bin_trust_routine_creators_basic.result'
--- a/mysql-test/r/log_bin_trust_routine_creators_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/log_bin_trust_routine_creators_basic.result	2008-04-10 13:14:28 +0000
@@ -0,0 +1,121 @@
+SET @start_global_value = @@global.log_bin_trust_routine_creators;
+SELECT @start_global_value;
+@start_global_value
+1
+'#--------------------FN_DYNVARS_064_01-------------------------#'
+SET @@global.log_bin_trust_routine_creators = TRUE;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SET @@global.log_bin_trust_routine_creators = DEFAULT;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+0
+'#--------------------FN_DYNVARS_064_02-------------------------#'
+SET @@global.log_bin_trust_routine_creators = DEFAULT;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators = 'FALSE';
+@@global.log_bin_trust_routine_creators = 'FALSE'
+1
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'FALSE'
+'#--------------------FN_DYNVARS_064_03-------------------------#'
+SET @@global.log_bin_trust_routine_creators = ON;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+1
+SET @@global.log_bin_trust_routine_creators = OFF;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+0
+SET @@global.log_bin_trust_routine_creators = 0;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+0
+SET @@global.log_bin_trust_routine_creators = 1;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+1
+SET @@global.log_bin_trust_routine_creators = TRUE;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+1
+SET @@global.log_bin_trust_routine_creators = FALSE;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+0
+'#-------------------FN_DYNVARS_064_04----------------------------#'
+SET @@session.log_bin_trust_routine_creators = 0;
+ERROR HY000: Variable 'log_bin_trust_routine_creators' is a GLOBAL variable and should be
set with SET GLOBAL
+SELECT @@session.log_bin_trust_routine_creators;
+ERROR HY000: Variable 'log_bin_trust_routine_creators' is a GLOBAL variable
+'#------------------FN_DYNVARS_064_05-----------------------#'
+SET @@global.log_bin_trust_routine_creators = 'ONN';
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of 'ONN'
+SET @@global.log_bin_trust_routine_creators = "OFFF";
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'OFFF'
+SET @@global.log_bin_trust_routine_creators = OF;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+0
+'Bug# 34828: OF is also working as OFF and no error is coming';
+SET @@global.log_bin_trust_routine_creators = TTRUE;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'TTRUE'
+SET @@global.log_bin_trust_routine_creators = FELSE;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'FELSE'
+SET @@global.log_bin_trust_routine_creators = -1024;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'-1024'
+SET @@global.log_bin_trust_routine_creators = 65536;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'65536'
+SET @@global.log_bin_trust_routine_creators = 65530.34;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'65530'
+SET @@global.log_bin_trust_routine_creators = test;
+ERROR 42000: Variable 'log_bin_trust_routine_creators' can't be set to the value of
'test'
+'#------------------FN_DYNVARS_064_06-----------------------#'
+SELECT @@global.log_bin_trust_routine_creators = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_routine_creators';
+@@global.log_bin_trust_routine_creators = VARIABLE_VALUE
+1
+SELECT @@session.log_bin_trust_routine_creators = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.SESSION_VARIABLES WHERE
VARIABLE_NAME='log_bin_trust_routine_creators';
+ERROR HY000: Variable 'log_bin_trust_routine_creators' is a GLOBAL variable
+'#---------------------FN_DYNVARS_064_07----------------------#'
+SET @@global.log_bin_trust_routine_creators = TRUE;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators;
+@@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators
+1
+'#---------------------FN_DYNVARS_064_08----------------------#'
+SET @@global.log_bin_trust_routine_creators = TRUE;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@log_bin_trust_routine_creators;
+@@log_bin_trust_routine_creators
+1
+SELECT local.log_bin_trust_routine_creators;
+ERROR 42S02: Unknown table 'local' in field list
+SELECT session.log_bin_trust_routine_creators;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT log_bin_trust_routine_creators = @@session.log_bin_trust_routine_creators;
+ERROR 42S22: Unknown column 'log_bin_trust_routine_creators' in 'field list'
+SET @@global.log_bin_trust_routine_creators = @start_global_value;
+Warnings:
+Warning	1287	The syntax 'log_bin_trust_routine_creators' is deprecated and will be
removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
+SELECT @@global.log_bin_trust_routine_creators;
+@@global.log_bin_trust_routine_creators
+1

=== added file 'mysql-test/r/multi_range_count_basic_32.result'
--- a/mysql-test/r/multi_range_count_basic_32.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/multi_range_count_basic_32.result	2008-05-08 18:13:39 +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/r/multi_range_count_basic_64.result'
--- a/mysql-test/r/multi_range_count_basic_64.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/multi_range_count_basic_64.result	2008-05-08 18:13:39 +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/r/rpl_slave_compressed_protocol_basic.result'
--- a/mysql-test/r/rpl_slave_compressed_protocol_basic.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/rpl_slave_compressed_protocol_basic.result	1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
-SET @global_start_value = @@global.slave_compressed_protocol;
-SELECT @global_start_value;
-@global_start_value
-0
-'#--------------------FN_DYNVARS_147_01------------------------#'
-SET @@global.slave_compressed_protocol = 1;
-SET @@global.slave_compressed_protocol = DEFAULT;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-0
-'#---------------------FN_DYNVARS_147_02-------------------------#'
-SET slave_compressed_protocol = 1;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable and should be set
with SET GLOBAL
-SELECT @@slave_compressed_protocol;
-@@slave_compressed_protocol
-0
-SELECT global.slave_compressed_protocol;
-ERROR 42S02: Unknown table 'global' in field list
-SET global slave_compressed_protocol = 1;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-1
-'#--------------------FN_DYNVARS_147_03------------------------#'
-SET @@global.slave_compressed_protocol = 0;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-0
-SET @@global.slave_compressed_protocol = 1;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-1
-'#--------------------FN_DYNVARS_147_04-------------------------#'
-SET @@global.slave_compressed_protocol = -1;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of '-1'
-SET @@global.slave_compressed_protocol = 2;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of '2'
-SET @@global.slave_compressed_protocol = "1.00";
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of '1.00'
-SET @@global.slave_compressed_protocol = "Y";
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of 'Y'
-SET @@global.slave_compressed_protocol = YES;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of 'YES'
-SET @@global.slave_compressed_protocol = ONN;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of 'ONN'
-SET @@global.slave_compressed_protocol = 0FF;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of '0FF'
-SET @@global.slave_compressed_protocol = ' 1';
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of ' 1'
-SET @@global.slave_compressed_protocol = NO;
-ERROR 42000: Variable 'slave_compressed_protocol' can't be set to the value of 'NO'
-'#-------------------FN_DYNVARS_147_05----------------------------#'
-SET @@session.slave_compressed_protocol = 0;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@slave_compressed_protocol = 0;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@local.slave_compressed_protocol = 0;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable and should be set
with SET GLOBAL
-SELECT @@session.slave_compressed_protocol;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable
-SELECT @@local.slave_compressed_protocol;
-ERROR HY000: Variable 'slave_compressed_protocol' is a GLOBAL variable
-'#----------------------FN_DYNVARS_147_06------------------------#'
-SELECT count(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-count(VARIABLE_VALUE)
-1
-'#----------------------FN_DYNVARS_147_07------------------------#'
-SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-@@global.slave_compressed_protocol = VARIABLE_VALUE
-0
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-1
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-VARIABLE_VALUE
-ON
-'#---------------------FN_DYNVARS_147_08-------------------------#'
-SET @@global.slave_compressed_protocol = OFF;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-0
-SET @@global.slave_compressed_protocol = ON;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-1
-'#---------------------FN_DYNVARS_147_09----------------------#'
-SET @@global.slave_compressed_protocol = TRUE;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-1
-SET @@global.slave_compressed_protocol = FALSE;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-0
-SET @@global.slave_compressed_protocol = @global_start_value;
-SELECT @@global.slave_compressed_protocol;
-@@global.slave_compressed_protocol
-0

=== removed file 'mysql-test/r/rpl_slave_exec_mode_basic.result'
--- a/mysql-test/r/rpl_slave_exec_mode_basic.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/rpl_slave_exec_mode_basic.result	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-SET @start_value = @@global.slave_exec_mode;
-'This variable is not supported in version 5.1.22. It is introduced in 5.1.24'

=== removed file 'mysql-test/r/rpl_slave_net_timeout_basic.result'
--- a/mysql-test/r/rpl_slave_net_timeout_basic.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/rpl_slave_net_timeout_basic.result	1970-01-01 00:00:00 +0000
@@ -1,127 +0,0 @@
-SET @start_global_value = @@global.slave_net_timeout;
-SELECT @start_global_value;
-@start_global_value
-3600
-'#--------------------FN_DYNVARS_146_01-------------------------#'
-SET @@global.slave_net_timeout = 500000;
-SET @@global.slave_net_timeout = DEFAULT;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-3600
-'#--------------------FN_DYNVARS_146_02-------------------------#'
-SET @@global.slave_net_timeout = DEFAULT;
-SELECT @@global.slave_net_timeout = 3600;
-@@global.slave_net_timeout = 3600
-1
-'#--------------------FN_DYNVARS_146_03-------------------------#'
-SET @@global.slave_net_timeout = 0;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-SET @@global.slave_net_timeout = 1;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-SET @@global.slave_net_timeout = 15;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-15
-SET @@global.slave_net_timeout = 1024;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1024
-SET @@global.slave_net_timeout = 3600+1;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-3601
-SET @@global.slave_net_timeout = 2147483648;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '2147483648'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-31536000
-SET @@global.slave_net_timeout = 2147483648*2-1;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '4294967295'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-31536000
-'#--------------------FN_DYNVARS_146_04-------------------------#'
-SET @@slave_net_timeout = 2;
-ERROR HY000: Variable 'slave_net_timeout' is a GLOBAL variable and should be set with SET
GLOBAL
-SET @@session.slave_net_timeout = 3;
-ERROR HY000: Variable 'slave_net_timeout' is a GLOBAL variable and should be set with SET
GLOBAL
-SET @@local.slave_net_timeout = 4;
-ERROR HY000: Variable 'slave_net_timeout' is a GLOBAL variable and should be set with SET
GLOBAL
-'#------------------FN_DYNVARS_146_05-----------------------#'
-SET @@global.slave_net_timeout = -1;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-SET @@global.slave_net_timeout = -2147483648;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-SET @@global.slave_net_timeout = 2147483649*2;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '4294967298'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-31536000
-SET @@global.slave_net_timeout = 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 @@global.slave_net_timeout = 100s;
-ERROR 42000: Incorrect argument type to variable 'slave_net_timeout'
-SET @@global.slave_net_timeout = 7483649.56;
-ERROR 42000: Incorrect argument type to variable 'slave_net_timeout'
-SET @@global.slave_net_timeout = 0.6;
-ERROR 42000: Incorrect argument type to variable 'slave_net_timeout'
-'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
-'#------------------FN_DYNVARS_146_06-----------------------#'
-SET @@global.slave_net_timeout = 3000;
-SELECT @@global.slave_net_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_net_timeout';
-@@global.slave_net_timeout = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_146_07-----------------------#'
-SELECT count(VARIABLE_VALUE) 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_net_timeout';
-count(VARIABLE_VALUE)
-1
-'#------------------FN_DYNVARS_146_08-----------------------#'
-SET @@global.slave_net_timeout = TRUE;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-SET @@global.slave_net_timeout = FALSE;
-Warnings:
-Warning	1292	Truncated incorrect slave_net_timeout value: '0'
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-1
-'#---------------------FN_DYNVARS_001_09----------------------#'
-SET @@global.slave_net_timeout = 60*60;
-SELECT @@slave_net_timeout = @@global.slave_net_timeout;
-@@slave_net_timeout = @@global.slave_net_timeout
-1
-'#---------------------FN_DYNVARS_001_10----------------------#'
-SET slave_net_timeout = 2048;
-ERROR HY000: Variable 'slave_net_timeout' is a GLOBAL variable and should be set with SET
GLOBAL
-SELECT slave_net_timeout;
-ERROR 42S22: Unknown column 'slave_net_timeout' in 'field list'
-SELECT @@slave_net_timeout;
-@@slave_net_timeout
-3600
-SET global slave_net_timeout = 99;
-SET @@global.slave_net_timeout = @start_global_value;
-SELECT @@global.slave_net_timeout;
-@@global.slave_net_timeout
-3600

=== removed file 'mysql-test/r/rpl_slave_transaction_retries_basic_32.result'
--- a/mysql-test/r/rpl_slave_transaction_retries_basic_32.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/rpl_slave_transaction_retries_basic_32.result	1970-01-01 00:00:00 +0000
@@ -1,119 +0,0 @@
-SET @start_global_value = @@global.slave_transaction_retries;
-SELECT @start_global_value;
-@start_global_value
-10
-'#--------------------FN_DYNVARS_149_01-------------------------#'
-SET @@global.slave_transaction_retries = 50;
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-10
-'#--------------------FN_DYNVARS_149_02-------------------------#'
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries = 10;
-@@global.slave_transaction_retries = 10
-1
-'#--------------------FN_DYNVARS_149_03-------------------------#'
-SET @@global.slave_transaction_retries = 0;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-SET @@global.slave_transaction_retries = 1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1
-SET @@global.slave_transaction_retries = 15;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-15
-SET @@global.slave_transaction_retries = 1024;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1024
-SET @@global.slave_transaction_retries = 2147483648;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-2147483648
-SET @@global.slave_transaction_retries = 2147483648*2-1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-SET @@global.slave_transaction_retries = 2147483649*2;
-Warnings:
-Warning	1292	Truncated incorrect slave_transaction_retries value: '4294967298'
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-SET @@global.slave_transaction_retries = 4294967295;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-'#--------------------FN_DYNVARS_149_04-------------------------#'
-SET @@slave_transaction_retries = 2;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@session.slave_transaction_retries = 3;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@local.slave_transaction_retries = 4;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-'#------------------FN_DYNVARS_149_05-----------------------#'
-SET @@global.slave_transaction_retries = -1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-SET @@global.slave_transaction_retries = 2147483649*2147483649;
-Warnings:
-Warning	1292	Truncated incorrect slave_transaction_retries value: '4611686022722355201'
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
-SET @@global.slave_transaction_retries = 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 @@global.slave_transaction_retries = '100';
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = 7483649.56;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = ON;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = OFF;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-'#------------------FN_DYNVARS_149_06-----------------------#'
-SET @@global.slave_transaction_retries = 3000;
-SELECT @@global.slave_transaction_retries = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-@@global.slave_transaction_retries = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_149_07-----------------------#'
-SELECT count(VARIABLE_VALUE) 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-count(VARIABLE_VALUE)
-1
-'#------------------FN_DYNVARS_149_08-----------------------#'
-SET @@global.slave_transaction_retries = TRUE;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1
-SET @@global.slave_transaction_retries = FALSE;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-'#---------------------FN_DYNVARS_149_09----------------------#'
-SET @@global.slave_transaction_retries = 60*60;
-SELECT @@slave_transaction_retries = @@global.slave_transaction_retries;
-@@slave_transaction_retries = @@global.slave_transaction_retries
-1
-'#---------------------FN_DYNVARS_149_10----------------------#'
-SET slave_transaction_retries = 2048;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SELECT slave_transaction_retries;
-ERROR 42S22: Unknown column 'slave_transaction_retries' in 'field list'
-SELECT @@slave_transaction_retries;
-@@slave_transaction_retries
-3600
-SET global slave_transaction_retries = 99;
-SET @@global.slave_transaction_retries = @start_global_value;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-10

=== removed file 'mysql-test/r/rpl_slave_transaction_retries_basic_64.result'
--- a/mysql-test/r/rpl_slave_transaction_retries_basic_64.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/rpl_slave_transaction_retries_basic_64.result	1970-01-01 00:00:00 +0000
@@ -1,115 +0,0 @@
-SET @start_global_value = @@global.slave_transaction_retries;
-SELECT @start_global_value;
-@start_global_value
-10
-'#--------------------FN_DYNVARS_149_01-------------------------#'
-SET @@global.slave_transaction_retries = 50;
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-10
-'#--------------------FN_DYNVARS_149_02-------------------------#'
-SET @@global.slave_transaction_retries = DEFAULT;
-SELECT @@global.slave_transaction_retries = 10;
-@@global.slave_transaction_retries = 10
-1
-'#--------------------FN_DYNVARS_149_03-------------------------#'
-SET @@global.slave_transaction_retries = 0;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-SET @@global.slave_transaction_retries = 1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1
-SET @@global.slave_transaction_retries = 15;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-15
-SET @@global.slave_transaction_retries = 1024;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1024
-SET @@global.slave_transaction_retries = 2147483648;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-2147483648
-SET @@global.slave_transaction_retries = 2147483648*2-1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-SET @@global.slave_transaction_retries = 2147483649*2;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967298
-SET @@global.slave_transaction_retries = 4294967295;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4294967295
-'#--------------------FN_DYNVARS_149_04-------------------------#'
-SET @@slave_transaction_retries = 2;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@session.slave_transaction_retries = 3;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SET @@local.slave_transaction_retries = 4;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-'#------------------FN_DYNVARS_149_05-----------------------#'
-SET @@global.slave_transaction_retries = -1;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-SET @@global.slave_transaction_retries = 2147483649*2147483649;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-4611686022722355201
-'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
-SET @@global.slave_transaction_retries = 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 @@global.slave_transaction_retries = '100';
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = 7483649.56;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = ON;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-SET @@global.slave_transaction_retries = OFF;
-ERROR 42000: Incorrect argument type to variable 'slave_transaction_retries'
-'#------------------FN_DYNVARS_149_06-----------------------#'
-SET @@global.slave_transaction_retries = 3000;
-SELECT @@global.slave_transaction_retries = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-@@global.slave_transaction_retries = VARIABLE_VALUE
-1
-'#------------------FN_DYNVARS_149_07-----------------------#'
-SELECT count(VARIABLE_VALUE) 
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_transaction_retries';
-count(VARIABLE_VALUE)
-1
-'#------------------FN_DYNVARS_149_08-----------------------#'
-SET @@global.slave_transaction_retries = TRUE;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-1
-SET @@global.slave_transaction_retries = FALSE;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-0
-'#---------------------FN_DYNVARS_149_09----------------------#'
-SET @@global.slave_transaction_retries = 60*60;
-SELECT @@slave_transaction_retries = @@global.slave_transaction_retries;
-@@slave_transaction_retries = @@global.slave_transaction_retries
-1
-'#---------------------FN_DYNVARS_149_10----------------------#'
-SET slave_transaction_retries = 2048;
-ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set
with SET GLOBAL
-SELECT slave_transaction_retries;
-ERROR 42S22: Unknown column 'slave_transaction_retries' in 'field list'
-SELECT @@slave_transaction_retries;
-@@slave_transaction_retries
-3600
-SET global slave_transaction_retries = 99;
-SET @@global.slave_transaction_retries = @start_global_value;
-SELECT @@global.slave_transaction_retries;
-@@global.slave_transaction_retries
-10

=== removed file 'mysql-test/r/rpl_sync_binlog_basic_32.result'
--- a/mysql-test/r/rpl_sync_binlog_basic_32.result	2008-05-16 02:44:49 +0000
+++ b/mysql-test/r/rpl_sync_binlog_basic_32.result	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

=== removed file 'mysql-test/r/rpl_sync_binlog_basic_64.result'
--- a/mysql-test/r/rpl_sync_binlog_basic_64.result	2008-05-16 02:44:49 +0000
+++ b/mysql-test/r/rpl_sync_binlog_basic_64.result	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
-4294967296
-SET @@global.sync_binlog = 10240022115;
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-10240022115
-SET @@global.sync_binlog = 10000.01;
-ERROR 42000: Incorrect argument type to variable 'sync_binlog'
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-10240022115
-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
-42949672950
-'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
-42949672950
-SET @@global.sync_binlog = 'test';
-ERROR 42000: Incorrect argument type to variable 'sync_binlog'
-SELECT @@global.sync_binlog;
-@@global.sync_binlog
-42949672950
-'#-------------------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
-42949672950
-'#----------------------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
-42949672950
-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

=== renamed file 'mysql-test/r/rpl_slave_allow_batching_basic.result' =>
'mysql-test/r/slave_allow_batching_basic.result'
--- a/mysql-test/r/rpl_slave_allow_batching_basic.result	2008-05-14 23:24:13 +0000
+++ b/mysql-test/r/slave_allow_batching_basic.result	2008-08-07 13:36:47 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 SET @global_start_value = @@global.slave_allow_batching;
 'Bug: This variable is not supported in mysql version 5.1.22'
 '#--------------------FN_DYNVARS_145_01------------------------#'
@@ -96,3 +97,104 @@ SET @@global.slave_allow_batching = @glo
 SELECT @@global.slave_allow_batching;
 @@global.slave_allow_batching
 0
+=======
+SET @global_start_value = @@global.slave_allow_batching;
+SELECT @global_start_value;
+@global_start_value
+0
+'#--------------------FN_DYNVARS_145_01------------------------#'
+SET @@global.slave_allow_batching = 1;
+SET @@global.slave_allow_batching = DEFAULT;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+'#---------------------FN_DYNVARS_145_02-------------------------#'
+SET slave_allow_batching = 1;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with
SET GLOBAL
+SELECT @@slave_allow_batching;
+@@slave_allow_batching
+0
+SELECT global.slave_allow_batching;
+ERROR 42S02: Unknown table 'global' in field list
+SET global slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+'#--------------------FN_DYNVARS_145_03------------------------#'
+SET @@global.slave_allow_batching = 0;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+'#--------------------FN_DYNVARS_145_04-------------------------#'
+SET @@global.slave_allow_batching = -1;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '-1'
+SET @@global.slave_allow_batching = 2;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '2'
+SET @@global.slave_allow_batching = "T";
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'T'
+SET @@global.slave_allow_batching = "Y";
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'Y'
+SET @@global.slave_allow_batching = YES;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'YES'
+SET @@global.slave_allow_batching = ONN;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'ONN'
+SET @@global.slave_allow_batching = OOF;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'OOF'
+SET @@global.slave_allow_batching = 0FF;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '0FF'
+SET @@global.slave_allow_batching = ' 1';
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of ' 1'
+SET @@global.slave_allow_batching = NO;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'NO'
+'#-------------------FN_DYNVARS_145_05----------------------------#'
+SET @@session.slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with
SET GLOBAL
+SET @@slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with
SET GLOBAL
+SET @@local.slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with
SET GLOBAL
+SELECT @@session.slave_allow_batching;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable
+SELECT @@local.slave_allow_batching;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable
+'#----------------------FN_DYNVARS_145_06------------------------#'
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE
VARIABLE_NAME='slave_allow_batching';
+count(VARIABLE_VALUE)
+1
+'#----------------------FN_DYNVARS_145_07------------------------#'
+SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+@@global.slave_allow_batching = VARIABLE_VALUE
+0
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE
VARIABLE_NAME='slave_allow_batching';
+VARIABLE_VALUE
+ON
+'#---------------------FN_DYNVARS_145_08-------------------------#'
+SET @@global.slave_allow_batching = OFF;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = ON;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+'#---------------------FN_DYNVARS_145_09----------------------#'
+SET @@global.slave_allow_batching = TRUE;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+SET @@global.slave_allow_batching = FALSE;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = @global_start_value;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+>>>>>>> MERGE-SOURCE

=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2008-04-21 07:30:39 +0000
+++ b/mysql-test/r/sp-error.result	2008-08-07 13:36:47 +0000
@@ -1635,3 +1635,15 @@ end|
 call p1(1);
 set @@max_sp_recursion_depth = @old_recursion_depth;
 drop procedure p1;
+drop procedure if exists proc_8759;
+create procedure proc_8759()
+begin
+declare should_be_illegal condition for sqlstate '00000';
+declare continue handler for should_be_illegal set @x=0;
+end$$
+ERROR 42000: Bad SQLSTATE: '00000'
+create procedure proc_8759()
+begin
+declare continue handler for sqlstate '00000' set @x=0;
+end$$
+ERROR 42000: Bad SQLSTATE: '00000'

=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2008-05-13 15:15:40 +0000
+++ b/mysql-test/r/union.result	2008-08-07 13:36:47 +0000
@@ -153,6 +153,48 @@ ERROR 42S22: Unknown column 'a' in 'fiel
 1	3
 1	3
 2	1
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+SELECT a INTO @v FROM (
+SELECT a FROM t1
+UNION
+SELECT a FROM t1
+) alias;
+SELECT a INTO OUTFILE 'union.out.file' FROM (
+SELECT a FROM t1
+UNION
+SELECT a FROM t1 WHERE 0
+) alias;
+SELECT a INTO DUMPFILE 'union.out.file2' FROM (
+SELECT a FROM t1
+UNION
+SELECT a FROM t1 WHERE 0
+) alias;
+SELECT a FROM (
+SELECT a FROM t1
+UNION
+SELECT a INTO @v FROM t1
+) alias;
+SELECT a FROM (
+SELECT a FROM t1
+UNION
+SELECT a INTO OUTFILE 'union.out.file3' FROM t1
+) alias;
+SELECT a FROM (
+SELECT a FROM t1
+UNION
+SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
+) alias;
+SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
+SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+ERROR HY000: Incorrect usage of UNION and INTO
+DROP TABLE t1;
 CREATE TABLE t1 (
 `pseudo` char(35) NOT NULL default '',
 `pseudo1` char(35) NOT NULL default '',

=== added file 'mysql-test/std_data/ndb_apply_status.frm'
Files a/mysql-test/std_data/ndb_apply_status.frm	1970-01-01 00:00:00 +0000 and
b/mysql-test/std_data/ndb_apply_status.frm	2008-05-09 09:42:18 +0000 differ

=== added file 'mysql-test/suite/ndb/r/bug36547.result'
--- a/mysql-test/suite/ndb/r/bug36547.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/bug36547.result	2008-05-07 14:43:32 +0000
@@ -0,0 +1,12 @@
+SET NDB_EXTRA_LOGGING=1;
+ERROR HY000: Variable 'ndb_extra_logging' is a GLOBAL variable and should be set with SET
GLOBAL
+SET @SAVE_NDB_EXTRA_LOGGING= @@NDB_EXTRA_LOGGING;
+SET GLOBAL NDB_EXTRA_LOGGING=1;
+SHOW VARIABLES LIKE 'ndb_extra%';
+Variable_name	Value
+ndb_extra_logging	1
+SET GLOBAL NDB_EXTRA_LOGGING=0;
+SHOW VARIABLES LIKE 'ndb_extra%';
+Variable_name	Value
+ndb_extra_logging	0
+SET @GLOBAL.NDB_EXTRA_LOGGGING= @SAVE_NDB_EXTRA_LOGGING;

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_backup.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_backup.result	2008-01-25 20:23:18 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_backup.result	2008-08-07 13:36:47 +0000
@@ -6,18 +6,6 @@ DROP TABLE IF EXISTS t1;
 SHOW TABLES;
 Tables_in_test
 t1
-SHOW CREATE TABLE t1;
-Table	Create Table
-t1	CREATE TABLE `t1` (
-  `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `b` int(11) /*!50205 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
-  `c` float DEFAULT NULL,
-  `d` double unsigned DEFAULT NULL,
-  `e` decimal(5,2) DEFAULT NULL,
-  `f` datetime DEFAULT NULL,
-  `g` binary(4) DEFAULT NULL,
-  PRIMARY KEY (`a`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 SELECT * FROM t1 WHERE a = 1 or a = 10 or a = 20 or a = 30 ORDER BY a;
 a	b	c	d	e	f	g
 1	5	3.40282e38	1.2686868689898e308	666.66	2007-10-23 23:23:23	1111
@@ -31,18 +19,6 @@ DROP TABLE t1;
 SHOW TABLES;
 Tables_in_test
 t1
-SHOW CREATE TABLE t1;
-Table	Create Table
-t1	CREATE TABLE `t1` (
-  `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `b` int(11) /*!50205 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
-  `c` float DEFAULT NULL,
-  `d` double unsigned DEFAULT NULL,
-  `e` decimal(5,2) DEFAULT NULL,
-  `f` datetime DEFAULT NULL,
-  `g` binary(4) DEFAULT NULL,
-  PRIMARY KEY (`a`)
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 SELECT * FROM t1 WHERE a = 1 or a = 10 or a = 20 or a = 30 ORDER BY a;
 a	b	c	d	e	f	g
 1	5	3.40282e38	1.2686868689898e308	666.66	2007-10-23 23:23:23	1111

=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result	2007-11-12 12:25:34 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result	2008-08-07 13:36:47 +0000
@@ -13,6 +13,7 @@ Ndb_cluster_node_id	#
 Ndb_config_from_host	#
 Ndb_config_from_port	#
 Ndb_number_of_data_nodes	#
+Ndb_cluster_connection_pool	#
 SHOW GLOBAL VARIABLES LIKE 'ndb%';
 Variable_name	Value
 ndb_autoincrement_prefetch_sz	#

=== modified file 'mysql-test/suite/ndb/r/ndb_blob.result'
--- a/mysql-test/suite/ndb/r/ndb_blob.result	2008-04-07 14:27:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_blob.result	2008-08-07 13:36:47 +0000
@@ -601,3 +601,38 @@ a	length(blob_nn)	length(text_nn)	blob_n
 1	0	0	NULL	NULL
 2	0	0	NULL	MySQL Cluster NDB
 drop table t1;
+create table `t1` (
+`f1` int(11) not null default -1,
+`f11` text,
+unique key `i1` (`f1`)
+) engine=ndbcluster default charset=utf8;
+insert into `t1` values (123,null);
+create table `t2` (
+`f1` int(11) not null default -1,
+unique key `i2` (`f1`)
+) engine=ndbcluster default charset=utf8;
+begin;
+delete from t2 where f1=5;
+delete from t1 where f1=123;
+delete from t2 where f1=5;
+commit;
+show warnings;
+Level	Code	Message
+drop table t1;
+drop table t2;
+create table t1 (
+a    int primary key,
+giga longblob) 
+engine=ndb;
+set @stuff = '1234567890';
+insert into t1 values (0, repeat(@stuff, 2000));
+select sha1(repeat(@stuff, 2000));
+sha1(repeat(@stuff, 2000))
+c8d94eb4127361ac22cf1c8a8f1178a37fb25e41
+select sha1(giga) from t1;
+sha1(giga)
+c8d94eb4127361ac22cf1c8a8f1178a37fb25e41
+select (giga = repeat(@stuff, 2000)) from t1 where a=0;
+(giga = repeat(@stuff, 2000))
+1
+drop table t1;

=== added file 'mysql-test/suite/ndb/r/ndb_cache_trans.result'
--- a/mysql-test/suite/ndb/r/ndb_cache_trans.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_cache_trans.result	2008-05-30 15:46:02 +0000
@@ -0,0 +1,317 @@
+result_format: 2
+drop table if exists t1;
+set GLOBAL query_cache_type=on;
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+flush status;
+
+## Turn off autocommit, instead use COMMIT after each statement
+set AUTOCOMMIT=off;
+
+## Create test table in NDB
+CREATE TABLE t1 (
+  pk int not null primary key,
+  a int,
+  b int not null,
+  c varchar(20)
+) ENGINE=ndbcluster;
+
+## Add first row
+insert into t1 value (1, 2, 3, 'First row');
+COMMIT;
+
+## Query should be inserted in qcache
+Qcache_queries          0
+Qcache_inserts          0
+Qcache_hits             0
+select * from t1;
+pk	a	b	c
+1	2	3	First row
+Qcache_queries          1
+Qcache_inserts          1
+Qcache_hits             0
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          1
+Qcache_hits             0
+
+## Perform the same query and make sure the query cache is hit
+Qcache_queries          1
+Qcache_inserts          1
+Qcache_hits             0
+select * from t1;
+pk	a	b	c
+1	2	3	First row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          1
+Qcache_hits             1
+
+## Update the table, should be no queries in cache afterwards
+update t1 set a=3 where pk=1;
+COMMIT;
+Qcache_queries          0
+Qcache_inserts          1
+Qcache_hits             1
+
+## Read row after update, should not hit the cache, but get inserted
+select * from t1;
+pk	a	b	c
+1	3	3	First row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          2
+Qcache_hits             1
+
+## Read row from cache
+select * from t1;
+pk	a	b	c
+1	3	3	First row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          2
+Qcache_hits             2
+
+## Insert two new rows, queries in cache should be zero
+insert into t1 value (2, 7, 8, 'Second row');
+insert into t1 value (4, 5, 6, 'Fourth row');
+COMMIT;
+Qcache_queries          0
+Qcache_inserts          2
+Qcache_hits             2
+
+## Read the three rows, should not hit the cache
+select * from t1 order by pk;
+pk	a	b	c
+1	3	3	First row
+2	7	8	Second row
+4	5	6	Fourth row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          3
+Qcache_hits             2
+
+## Read the three rows, should now hit the cache!
+select * from t1 order by pk;
+pk	a	b	c
+1	3	3	First row
+2	7	8	Second row
+4	5	6	Fourth row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          3
+Qcache_hits             3
+
+## Two selects in the same transaction should hit cache
+select * from t1 order by pk;
+pk	a	b	c
+1	3	3	First row
+2	7	8	Second row
+4	5	6	Fourth row
+select * from t1 order by pk;
+pk	a	b	c
+1	3	3	First row
+2	7	8	Second row
+4	5	6	Fourth row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          3
+Qcache_hits             5
+
+## Perform a "new" query and make sure the query cache is not hit
+select * from t1 where b=3;
+pk	a	b	c
+1	3	3	First row
+COMMIT;
+Qcache_queries          2
+Qcache_inserts          4
+Qcache_hits             5
+
+## Same query again...
+select * from t1 where b=3;
+pk	a	b	c
+1	3	3	First row
+COMMIT;
+Qcache_queries          2
+Qcache_inserts          4
+Qcache_hits             6
+
+## Delete from the table, should clear the cache
+delete from t1 where c='Fourth row';
+COMMIT;
+Qcache_queries          0
+Qcache_inserts          4
+Qcache_hits             6
+select * from t1 where b=3;
+pk	a	b	c
+1	3	3	First row
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          5
+Qcache_hits             6
+
+## Start another connection and check that the query cache is hit
+set AUTOCOMMIT=off;
+use test;
+select * from t1 order by pk;
+pk	a	b	c
+1	3	3	First row
+2	7	8	Second row
+select * from t1 where b=3;
+pk	a	b	c
+1	3	3	First row
+Qcache_queries          2
+Qcache_inserts          6
+Qcache_hits             7
+
+## Update the table and switch to other connection
+update t1 set a=4 where b=3;
+COMMIT;
+
+## Connection 2
+set AUTOCOMMIT=off;
+use test;
+
+## Should not hit cache, table updated
+Qcache_queries          0
+Qcache_inserts          6
+Qcache_hits             7
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	4	3	First row
+Qcache_queries          1
+Qcache_inserts          7
+Qcache_hits             7
+## Should hit cache
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	4	3	First row
+Qcache_queries          1
+Qcache_inserts          7
+Qcache_hits             8
+
+## Connection 1, should hit the cache
+Qcache_queries          1
+Qcache_inserts          7
+Qcache_hits             8
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	4	3	First row
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	4	3	First row
+Qcache_queries          1
+Qcache_inserts          7
+Qcache_hits             10
+
+## Starting transaction and update t1
+begin;
+update t1 set a=5 where pk=1;
+Qcache_queries          0
+Qcache_inserts          7
+Qcache_hits             10
+
+## Connection 2
+## Update has flushed the qc for t1, should not hit qc
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	4	3	First row
+Qcache_queries          1
+Qcache_inserts          8
+Qcache_hits             10
+
+## Connection 1
+commit;
+Qcache_queries          1
+Qcache_inserts          8
+Qcache_hits             10
+
+## Connection 2
+## Update is now committed, should not hit the cache
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	5	3	First row
+Qcache_queries          1
+Qcache_inserts          9
+Qcache_hits             10
+COMMIT;
+Qcache_queries          1
+Qcache_inserts          9
+Qcache_hits             10
+
+## Connection 1
+## Should hit the cache
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	5	3	First row
+Qcache_queries          1
+Qcache_inserts          9
+Qcache_hits             11
+
+update t1 set a=6 where pk=1;
+
+## Following query should not be taken from cache, trans is ongoing
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	6	3	First row
+Qcache_queries          0
+Qcache_inserts          9
+Qcache_hits             11
+
+## Connection 2 should still see old data and not hit cache
+Qcache_queries          0
+Qcache_inserts          9
+Qcache_hits             11
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	5	3	First row
+Qcache_queries          1
+Qcache_inserts          10
+Qcache_hits             11
+
+## Connection 1
+COMMIT;
+
+## Update has just been committed, should not hit cache
+Qcache_queries          1
+Qcache_inserts          10
+Qcache_hits             11
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	6	3	First row
+Qcache_queries          1
+Qcache_inserts          11
+Qcache_hits             11
+
+## Connection 2
+
+## Should hit cache
+Qcache_queries          1
+Qcache_inserts          11
+Qcache_hits             11
+select * from t1 order by pk desc;
+pk	a	b	c
+2	7	8	Second row
+1	6	3	First row
+Qcache_queries          1
+Qcache_inserts          11
+Qcache_hits             12
+
+drop table t1;
+
+## Finally, there should be no queries in cache
+Qcache_queries          0
+Qcache_inserts          11
+Qcache_hits             12
+
+SET GLOBAL query_cache_size=0;

=== modified file 'mysql-test/suite/ndb/r/ndb_condition_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2008-03-26 23:22:46 +0000
+++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2008-08-07 13:36:47 +0000
@@ -1953,5 +1953,14 @@ create table t1 (a int primary key, b va
 insert into t1 values (0, 'I just cant beg you, any-more');
 select * from t1 where b="value";
 a	b
+drop table t1;
+create table t1 (a int primary key, b varchar(5000) character set latin1) engine=ndb;
+insert into t1 values(0, 'Edinburgh'),(1, 'Glasgow'),(2,'Aberdeen');
+select * from t1 where b in ('0', '1', '2','3','4','5','6','7','8','9',
+'10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', 'Aberdeen');
+a	b
+2	Aberdeen
+show warnings;
+Level	Code	Message
 set engine_condition_pushdown = @old_ecpd;
 DROP TABLE t1,t2,t3,t4,t5;

=== renamed file 'mysql-test/suite/ndb_team/r/ndb_dd_restore_compat.result' =>
'mysql-test/suite/ndb/r/ndb_dd_restore_compat.result'
--- a/mysql-test/suite/ndb_team/r/ndb_dd_restore_compat.result	2008-01-04 16:14:42 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_restore_compat.result	2008-08-07 13:36:47 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 select * from information_schema.columns
 where table_name = "t1";
 TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	ORDINAL_POSITION	COLUMN_DEFAULT	IS_NULLABLE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	COLUMN_TYPE	COLUMN_KEY	EXTRA	PRIVILEGES	COLUMN_COMMENT	STORAGE	FORMAT
@@ -51,3 +52,58 @@ drop tablespace ts
 engine ndb;
 drop logfile group lg
 engine ndb;
+=======
+select * from information_schema.columns
+where table_name = "t1";
+TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	ORDINAL_POSITION	COLUMN_DEFAULT	IS_NULLABLE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	COLUMN_TYPE	COLUMN_KEY	EXTRA	PRIVILEGES	COLUMN_COMMENT	STORAGE	FORMAT
+NULL	test	t1	a1	1	NULL	NO	smallint	NULL	NULL	5	0	NULL	NULL	smallint(6)	PRI		select,insert,update,references		Default	Default
+NULL	test	t1	a2	2	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(11)			select,insert,update,references		Default	Default
+NULL	test	t1	a3	3	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references		Default	Default
+NULL	test	t1	a4	4	NULL	YES	char	10	10	NULL	NULL	latin1	latin1_swedish_ci	char(10)			select,insert,update,references		Default	Default
+NULL	test	t1	a5	5	NULL	YES	decimal	NULL	NULL	5	1	NULL	NULL	decimal(5,1)			select,insert,update,references		Default	Default
+NULL	test	t1	a6	6	NULL	YES	time	NULL	NULL	NULL	NULL	NULL	NULL	time			select,insert,update,references		Default	Default
+NULL	test	t1	a7	7	NULL	YES	date	NULL	NULL	NULL	NULL	NULL	NULL	date			select,insert,update,references		Default	Default
+NULL	test	t1	a8	8	NULL	YES	datetime	NULL	NULL	NULL	NULL	NULL	NULL	datetime			select,insert,update,references		Default	Default
+NULL	test	t1	a9	9	NULL	YES	varchar	255	255	NULL	NULL	latin1	latin1_swedish_ci	varchar(255)			select,insert,update,references		Default	Default
+NULL	test	t1	a10	10	NULL	YES	blob	65535	65535	NULL	NULL	NULL	NULL	blob			select,insert,update,references		Default	Default
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a1` smallint(6) NOT NULL,
+  `a2` int(11) NOT NULL,
+  `a3` bigint(20) NOT NULL,
+  `a4` char(10) DEFAULT NULL,
+  `a5` decimal(5,1) DEFAULT NULL,
+  `a6` time DEFAULT NULL,
+  `a7` date DEFAULT NULL,
+  `a8` datetime DEFAULT NULL,
+  `a9` varchar(255) DEFAULT NULL,
+  `a10` blob,
+  PRIMARY KEY (`a1`)
+) /*!50100 TABLESPACE ts */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
+a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
+a2 Int NOT NULL AT=FIXED ST=DISK
+a3 Bigint NOT NULL AT=FIXED ST=DISK
+a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
+a5 Decimal(5,1) NULL AT=FIXED ST=DISK
+a6 Time NULL AT=FIXED ST=DISK
+a7 Date NULL AT=FIXED ST=DISK
+a8 Datetime NULL AT=FIXED ST=DISK
+a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
+a10 Blob(256,2000,16) NULL AT=FIXED ST=DISK BV=1
+select * from t1 order by a1;
+a1	a2	a3	a4	a5	a6	a7	a8	a9	a10
+1	2	2000000001	aaa1	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb1	binary
data
+2	3	2000000002	aaa2	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb2	binary
data
+3	4	2000000003	aaa3	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb3	binary
data
+4	5	2000000004	aaa4	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb4	binary
data
+5	6	2000000005	aaa5	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb5	binary
data
+drop table t1;
+ALTER TABLESPACE ts
+DROP DATAFILE 'datafile.dat'
+ENGINE NDB;
+drop tablespace ts
+engine ndb;
+drop logfile group lg
+engine ndb;
+>>>>>>> MERGE-SOURCE

=== modified file 'mysql-test/suite/ndb/r/ndb_restore_compat.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_compat.result	2008-01-04 15:33:40 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_compat.result	2008-08-07 13:36:47 +0000
@@ -4,10 +4,10 @@ USE BANK;
 SHOW TABLES;
 Tables_in_BANK
 ACCOUNT
-GL
 ACCOUNT_TYPE
-TRANSACTION
+GL
 SYSTEM_VALUES
+TRANSACTION
 SELECT * FROM GL            ORDER BY TIME,ACCOUNT_TYPE;
 TIME	ACCOUNT_TYPE	BALANCE	DEPOSIT_COUNT	DEPOSIT_SUM	WITHDRAWAL_COUNT	WITHDRAWAL_SUM	PURGED
 0	0	10000000	0	0	0	0	1

=== modified file 'mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result	2007-12-08 16:32:40
+0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result	2008-08-07 13:36:47
+0000
@@ -2,10 +2,10 @@ USE test;
 DROP TABLE IF EXISTS t_num,t_datetime,t_string_1,t_string_2,t_gis;
 SHOW TABLES;
 Tables_in_test
-t_gis
-t_string_1
 t_datetime
+t_gis
 t_num
+t_string_1
 t_string_2
 SHOW CREATE TABLE t_num;
 Table	Create Table
@@ -101,10 +101,10 @@ GEOMETRYCOLLECTION(POINT(44 6),LINESTRIN
 DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
 SHOW TABLES;
 Tables_in_test
-t_gis
-t_string_1
 t_datetime
+t_gis
 t_num
+t_string_1
 t_string_2
 SHOW CREATE TABLE t_num;
 Table	Create Table

=== added file 'mysql-test/suite/ndb/t/bug36547.test'
--- a/mysql-test/suite/ndb/t/bug36547.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/bug36547.test	2008-05-07 14:43:32 +0000
@@ -0,0 +1,13 @@
+--source include/have_ndb.inc
+#
+# Bug #36547  	SET GLOBAL ndb_extra_logging crashes mysqld
+#
+--error 1229
+SET NDB_EXTRA_LOGGING=1;
+
+SET @SAVE_NDB_EXTRA_LOGGING= @@NDB_EXTRA_LOGGING;
+SET GLOBAL NDB_EXTRA_LOGGING=1;
+SHOW VARIABLES LIKE 'ndb_extra%';
+SET GLOBAL NDB_EXTRA_LOGGING=0;
+SHOW VARIABLES LIKE 'ndb_extra%';
+SET @GLOBAL.NDB_EXTRA_LOGGGING= @SAVE_NDB_EXTRA_LOGGING;

=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table_backup.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table_backup.test	2007-11-02 23:20:13 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table_backup.test	2008-08-07 13:36:47 +0000
@@ -23,7 +23,6 @@ DROP TABLE IF EXISTS t1;
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_d2_le >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_d2_le >> $NDB_TOOLS_OUTPUT
 SHOW TABLES;
-SHOW CREATE TABLE t1;
 SELECT * FROM t1 WHERE a = 1 or a = 10 or a = 20 or a = 30 ORDER BY a;
 DROP TABLE t1;
 
@@ -36,7 +35,6 @@ DROP TABLE t1;
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_d2_be >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_d2_be >> $NDB_TOOLS_OUTPUT
 SHOW TABLES;
-SHOW CREATE TABLE t1;
 SELECT * FROM t1 WHERE a = 1 or a = 10 or a = 20 or a = 30 ORDER BY a;
 DROP TABLE t1;
 # End of 5.1 Test Case

=== modified file 'mysql-test/suite/ndb/t/ndb_blob.test'
--- a/mysql-test/suite/ndb/t/ndb_blob.test	2008-04-07 14:27:02 +0000
+++ b/mysql-test/suite/ndb/t/ndb_blob.test	2008-08-07 13:36:47 +0000
@@ -538,3 +538,54 @@ insert into t1(a, text_nl) values (2, 'M
 select a, length(blob_nn), length(text_nn), blob_nl, text_nl from t1 order by a;
 
 drop table t1;
+
+# bug # 36756
+#  Behaviour of delete of non existing row should not be affected 
+#  by presence of Blob operations in the same transaction
+#  Specifically, transaction should not be aborted.
+create table `t1` (
+  `f1` int(11) not null default -1,
+  `f11` text,
+  unique key `i1` (`f1`)
+) engine=ndbcluster default charset=utf8;
+
+insert into `t1` values (123,null);
+
+create table `t2` (
+  `f1` int(11) not null default -1,
+  unique key `i2` (`f1`)
+) engine=ndbcluster default charset=utf8;
+
+begin;
+delete from t2 where f1=5;   # No such row, no problem
+delete from t1 where f1=123; # Blob operation
+delete from t2 where f1=5;   # No such row, no problem
+commit;
+show warnings;
+
+drop table t1;
+drop table t2;
+
+# bug # 31284
+#   Long Blob (8000 byte parts) with Blob v2 (+2 bytes length)
+#   exposed buffer overrun for old Api setValue() call used for
+#   writing parts.
+#   Check that data written into long Blob can be retrieved
+#   correctly
+create table t1 (
+  a    int primary key,
+  giga longblob) 
+engine=ndb;
+
+# length 10
+set @stuff = '1234567890';
+
+# 20,000 bytes = 3 parts
+insert into t1 values (0, repeat(@stuff, 2000));
+
+# Check that we get the same data back that we put in
+select sha1(repeat(@stuff, 2000));
+select sha1(giga) from t1;
+select (giga = repeat(@stuff, 2000)) from t1 where a=0;
+
+drop table t1;

=== added file 'mysql-test/suite/ndb/t/ndb_cache_trans.test'
--- a/mysql-test/suite/ndb/t/ndb_cache_trans.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_cache_trans.test	2008-05-28 14:26:26 +0000
@@ -0,0 +1,200 @@
+-- source include/have_query_cache.inc
+-- source include/have_ndb.inc
+-- source include/not_embedded.inc
+
+--result_format 2
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# Turn on and reset query cache
+set GLOBAL query_cache_type=on;
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+flush status;
+
+## Turn off autocommit, instead use COMMIT after each statement
+set AUTOCOMMIT=off;
+
+## Create test table in NDB
+CREATE TABLE t1 (
+  pk int not null primary key,
+  a int,
+  b int not null,
+  c varchar(20)
+) ENGINE=ndbcluster;
+
+## Add first row
+insert into t1 value (1, 2, 3, 'First row');
+COMMIT;
+
+## Query should be inserted in qcache
+--source include/show_qc_status.inc
+select * from t1;
+--source include/show_qc_status.inc
+COMMIT;
+--source include/show_qc_status.inc
+
+## Perform the same query and make sure the query cache is hit
+--source include/show_qc_status.inc
+select * from t1;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Update the table, should be no queries in cache afterwards
+update t1 set a=3 where pk=1;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Read row after update, should not hit the cache, but get inserted
+select * from t1;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Read row from cache
+select * from t1;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Insert two new rows, queries in cache should be zero
+insert into t1 value (2, 7, 8, 'Second row');
+insert into t1 value (4, 5, 6, 'Fourth row');
+COMMIT;
+--source include/show_qc_status.inc
+
+## Read the three rows, should not hit the cache
+select * from t1 order by pk;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Read the three rows, should now hit the cache!
+select * from t1 order by pk;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Two selects in the same transaction should hit cache
+select * from t1 order by pk;
+select * from t1 order by pk;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Perform a "new" query and make sure the query cache is not hit
+select * from t1 where b=3;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Same query again...
+select * from t1 where b=3;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Delete from the table, should clear the cache
+delete from t1 where c='Fourth row';
+COMMIT;
+--source include/show_qc_status.inc
+select * from t1 where b=3;
+COMMIT;
+--source include/show_qc_status.inc
+
+## Start another connection and check that the query cache is hit
+connect (con1,localhost,root,,);
+connection con1;
+set AUTOCOMMIT=off;
+use test;
+select * from t1 order by pk;
+select * from t1 where b=3;
+--source include/show_qc_status.inc
+
+## Update the table and switch to other connection
+update t1 set a=4 where b=3;
+COMMIT;
+
+## Connection 2
+connect (con2,localhost,root,,);
+connection con2;
+set AUTOCOMMIT=off;
+use test;
+
+## Should not hit cache, table updated
+--source include/show_qc_status.inc
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+## Should hit cache
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+## Connection 1, should hit the cache
+connection con1;
+--source include/show_qc_status.inc
+select * from t1 order by pk desc;
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+
+## Starting transaction and update t1
+begin;
+update t1 set a=5 where pk=1;
+--source include/show_qc_status.inc
+
+## Connection 2
+connection con2;
+## Update has flushed the qc for t1, should not hit qc
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+## Connection 1
+connection con1;
+commit;
+--source include/show_qc_status.inc
+
+## Connection 2
+connection con2;
+## Update is now committed, should not hit the cache
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+COMMIT;
+--source include/show_qc_status.inc
+
+## Connection 1
+connection con1;
+## Should hit the cache
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+update t1 set a=6 where pk=1;
+
+## Following query should not be taken from cache, trans is ongoing
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+
+## Connection 2 should still see old data and not hit cache
+connection con2;
+--source include/show_qc_status.inc
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+## Connection 1
+connection con1;
+COMMIT;
+
+## Update has just been committed, should not hit cache
+--source include/show_qc_status.inc
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+## Connection 2
+connection con2;
+
+## Should hit cache
+--source include/show_qc_status.inc
+select * from t1 order by pk desc;
+--source include/show_qc_status.inc
+
+drop table t1;
+
+## Finally, there should be no queries in cache
+--source include/show_qc_status.inc
+
+SET GLOBAL query_cache_size=0;

=== modified file 'mysql-test/suite/ndb/t/ndb_condition_pushdown.test'
--- a/mysql-test/suite/ndb/t/ndb_condition_pushdown.test	2008-03-26 23:22:46 +0000
+++ b/mysql-test/suite/ndb/t/ndb_condition_pushdown.test	2008-08-07 13:36:47 +0000
@@ -2089,5 +2089,15 @@ create table t1 (a int primary key, b va
 insert into t1 values (0, 'I just cant beg you, any-more');
 select * from t1 where b="value";
 
+# Bug 35393, Sending irrelevant data for var length comparison
+drop table t1;
+
+create table t1 (a int primary key, b varchar(5000) character set latin1) engine=ndb;
+insert into t1 values(0, 'Edinburgh'),(1, 'Glasgow'),(2,'Aberdeen');
+select * from t1 where b in ('0', '1', '2','3','4','5','6','7','8','9',
+'10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', 'Aberdeen');
+
+show warnings;
+
 set engine_condition_pushdown = @old_ecpd;
 DROP TABLE t1,t2,t3,t4,t5;

=== modified file 'mysql-test/suite/ndb/t/ndb_restore_compat.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_compat.test	2007-09-12 12:35:51 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_compat.test	2008-08-07 13:36:47 +0000
@@ -16,6 +16,7 @@ CREATE DATABASE BANK default charset=lat
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51 >> $NDB_TOOLS_OUTPUT
 USE BANK;
+--sorted_result
 SHOW TABLES;
 SELECT * FROM GL            ORDER BY TIME,ACCOUNT_TYPE;
 SELECT * FROM ACCOUNT       ORDER BY ACCOUNT_ID;

=== modified file 'mysql-test/suite/ndb/t/ndb_restore_different_endian_data.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_different_endian_data.test	2007-09-05 13:01:30
+0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_different_endian_data.test	2008-05-16 20:13:53
+0000
@@ -147,6 +147,7 @@ DROP TABLE IF EXISTS t_num,t_datetime,t_
 --enable_warnings
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_data_le >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_data_le >> $NDB_TOOLS_OUTPUT
+--sorted_result
 SHOW TABLES;
 SHOW CREATE TABLE t_num;
 SHOW CREATE TABLE t_datetime;
@@ -168,6 +169,7 @@ SELECT AsText(t_geometrycollection), AsT
 DROP TABLE t_num,t_datetime,t_string_1,t_string_2,t_gis;
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_data_be >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_data_be >> $NDB_TOOLS_OUTPUT
+--sorted_result
 SHOW TABLES;
 SHOW CREATE TABLE t_num;
 SHOW CREATE TABLE t_datetime;

=== removed file 'mysql-test/suite/ndb_team/t/ndb_dd_restore_compat.test'
--- a/mysql-test/suite/ndb_team/t/ndb_dd_restore_compat.test	2008-01-04 16:14:42 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_dd_restore_compat.test	1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
--- source include/have_ndb.inc
--- source include/not_embedded.inc
-
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -p 1 -m -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_dd >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -e -b 1 -n 2 -p 1 -r
$MYSQL_TEST_DIR/std_data/ndb_backup51_dd >> $NDB_TOOLS_OUTPUT
-
-select * from information_schema.columns
-where table_name = "t1";
-show create table t1;
---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
-select * from t1 order by a1;
-drop table t1;
-
-ALTER TABLESPACE ts
-DROP DATAFILE 'datafile.dat'
-ENGINE NDB;
-
-drop tablespace ts
-engine ndb;
-
-drop logfile group lg
-engine ndb;

=== modified file 'mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test'
--- a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test	2008-01-04 15:33:40 +0000
+++ b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test	2008-08-07 13:36:47 +0000
@@ -341,7 +341,6 @@ while ($j)
 --echo ***** Finsh the slave sync process *******
 --disable_query_log
 # 1. 2. 3.
---sync_slave_with_master
 --source include/ndb_setup_slave.inc
 --enable_query_log
 

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result	2007-11-02 12:07:14 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result	2008-05-09 09:42:18 +0000
@@ -1,3 +1,4 @@
+select * from mysql.ndb_apply_status;
 stop slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 reset master;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test	2007-11-02 12:07:14 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test	2008-05-20 10:18:38 +0000
@@ -1,3 +1,20 @@
+
+#
+# BUG#36123 Selecting from mysql.ndb_apply_status leads to failure
+#
+# Load the mysql.ndb_apply_status table into table def cache
+#
+
+# The table might already have been created by mysqld -> ignore error
+--error 0,1
+copy_file $MYSQL_TEST_DIR/std_data/ndb_apply_status.frm
$MYSQLTEST_VARDIR/master-data/mysql/ndb_apply_status.frm;
+--disable_result_log
+--disable_abort_on_error
+select * from mysql.ndb_apply_status;
+--enable_abort_on_error
+--enable_result_log
+
+
 -- source include/have_ndb.inc
 -- source include/have_binlog_format_row.inc
 -- source include/ndb_master-slave.inc

=== added file 'mysql-test/t/innodb_bug34053.test'
--- a/mysql-test/t/innodb_bug34053.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug34053.test	2008-02-22 23:56:34 +0000
@@ -0,0 +1,50 @@
+#
+# Make sure http://bugs.mysql.com/34053 remains fixed.
+#
+
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+
+SET storage_engine=InnoDB;
+
+# we do not really care about what gets printed, we are only
+# interested in getting success or failure according to our
+# expectations
+-- disable_query_log
+-- disable_result_log
+
+GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
+FLUSH PRIVILEGES;
+
+-- connect (con1,localhost,shane,12345,)
+
+-- connection con1
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
+DROP TABLE innodb_monitorx;
+CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
+DROP TABLE innodb_monito;
+CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
+DROP TABLE xinnodb_monitor;
+CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
+DROP TABLE nnodb_monitor;
+
+-- connection default
+CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
+
+-- connection con1
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+DROP TABLE innodb_monitor;
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+DROP TABLE innodb_mem_validate;
+
+-- connection default
+DROP TABLE innodb_monitor;
+DROP TABLE innodb_mem_validate;
+DROP USER 'shane'@'localhost';
+
+-- disconnect con1

=== removed file 'mysql-test/t/innodb_bug34053.test'
--- a/mysql-test/t/innodb_bug34053.test	2008-06-12 00:08:07 +0000
+++ b/mysql-test/t/innodb_bug34053.test	1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/34053 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-SET storage_engine=InnoDB;
-
-# we do not really care about what gets printed, we are only
-# interested in getting success or failure according to our
-# expectations
--- disable_query_log
--- disable_result_log
-
-GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
-FLUSH PRIVILEGES;
-
--- connect (con1,localhost,shane,12345,)
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monitorx;
-CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monito;
-CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE xinnodb_monitor;
-CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE nnodb_monitor;
-
--- connection default
-CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
-CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-DROP TABLE innodb_monitor;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-DROP TABLE innodb_mem_validate;
-
--- connection default
-DROP TABLE innodb_monitor;
-DROP TABLE innodb_mem_validate;
-DROP USER 'shane'@'localhost';
-
--- disconnect con1

=== added file 'mysql-test/t/log_bin_trust_routine_creators_basic.test'
--- a/mysql-test/t/log_bin_trust_routine_creators_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/log_bin_trust_routine_creators_basic.test	2008-04-10 13:14:28 +0000
@@ -0,0 +1,164 @@
+############## mysql-test\t\log_bin_trust_routine_creators_basic.test #########
+#                                                                             #
+# Variable Name: log_bin_trust_routine_creators                               #
+# Scope: GLOBAL                                                               #
+# Access Type: Dynamic                                                        #
+# Data Type: boolean                                                          #
+# Default Value: False                                                        #
+# Range:                                                                      #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2008-02-12                                                   #
+# Author:  Salman                                                             #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable                          #
+#              log_bin_trust_routine_creators that checks the                 #
+#              behavior of this variable in the following ways                #
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: (Not given on website)                                           #
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+####################################################################
+#   START OF log_bin_trust_routine_creators TESTS                  #
+####################################################################
+
+
+#############################################################
+#                 Save initial value                        #
+#############################################################
+
+SET @start_global_value = @@global.log_bin_trust_routine_creators;
+SELECT @start_global_value;
+
+
+--echo '#--------------------FN_DYNVARS_064_01-------------------------#'
+########################################################################
+#     Display the DEFAULT value of log_bin_trust_routine_creators     #
+########################################################################
+
+SET @@global.log_bin_trust_routine_creators = TRUE;
+SET @@global.log_bin_trust_routine_creators = DEFAULT;
+SELECT @@global.log_bin_trust_routine_creators;
+
+
+--echo '#--------------------FN_DYNVARS_064_02-------------------------#'
+##############################################################################
+#     Check the DEFAULT value of log_bin_trust_routine_creators              #
+##############################################################################
+
+SET @@global.log_bin_trust_routine_creators = DEFAULT;
+SELECT @@global.log_bin_trust_routine_creators = 'FALSE';
+
+
+--echo '#--------------------FN_DYNVARS_064_03-------------------------#'
+##################################################################
+# Change the value of variable to a valid value for GLOBAL Scope #
+##################################################################
+
+SET @@global.log_bin_trust_routine_creators = ON;
+SELECT @@global.log_bin_trust_routine_creators;
+SET @@global.log_bin_trust_routine_creators = OFF;
+SELECT @@global.log_bin_trust_routine_creators;
+SET @@global.log_bin_trust_routine_creators = 0;
+SELECT @@global.log_bin_trust_routine_creators;
+SET @@global.log_bin_trust_routine_creators = 1;
+SELECT @@global.log_bin_trust_routine_creators;
+SET @@global.log_bin_trust_routine_creators = TRUE;
+SELECT @@global.log_bin_trust_routine_creators;
+SET @@global.log_bin_trust_routine_creators = FALSE;
+SELECT @@global.log_bin_trust_routine_creators;
+
+
+--echo '#-------------------FN_DYNVARS_064_04----------------------------#'
+########################################################################### 
+#   Test if accessing session log_bin_trust_routine_creators gives error  #
+########################################################################### 
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.log_bin_trust_routine_creators = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_trust_routine_creators;
+
+
+--echo '#------------------FN_DYNVARS_064_05-----------------------#'
+##########################################################################
+# Change the value of log_bin_trust_routine_creators to an invalid value #
+##########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = 'ONN';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = "OFFF";
+SET @@global.log_bin_trust_routine_creators = OF;
+SELECT @@global.log_bin_trust_routine_creators;
+--echo 'Bug# 34828: OF is also working as OFF and no error is coming';
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = TTRUE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = FELSE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = -1024;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = 65536;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = 65530.34;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_bin_trust_routine_creators = test;
+
+
+--echo '#------------------FN_DYNVARS_064_06-----------------------#'
+###############################################################################
+#   Check if the value in GLOBAL & SESSION Tables matches value in variable   #
+###############################################################################
+
+
+SELECT @@global.log_bin_trust_routine_creators = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_routine_creators';
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_trust_routine_creators = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.SESSION_VARIABLES WHERE
VARIABLE_NAME='log_bin_trust_routine_creators';
+
+
+--echo '#---------------------FN_DYNVARS_064_07----------------------#'
+#################################################################################
+#  Check if accessing variable with and without GLOBAL point to same variable   #
+#################################################################################
+
+
+SET @@global.log_bin_trust_routine_creators = TRUE;
+SELECT @@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators;
+
+
+--echo '#---------------------FN_DYNVARS_064_08----------------------#'
+###################################################################
+#   Check if variable can be accessed with and without @@ sign    #
+###################################################################
+
+SET @@global.log_bin_trust_routine_creators = TRUE;
+SELECT @@log_bin_trust_routine_creators;
+--Error ER_UNKNOWN_TABLE
+SELECT local.log_bin_trust_routine_creators;
+--Error ER_UNKNOWN_TABLE
+SELECT session.log_bin_trust_routine_creators;
+--Error ER_BAD_FIELD_ERROR
+SELECT log_bin_trust_routine_creators = @@session.log_bin_trust_routine_creators;
+
+
+####################################
+#     Restore initial value        #
+####################################
+
+SET @@global.log_bin_trust_routine_creators = @start_global_value;
+SELECT @@global.log_bin_trust_routine_creators;
+
+
+###################################################################
+#                 END OF log_bin_trust_routine_creators TESTS     #
+###################################################################
+

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

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

=== removed file 'mysql-test/t/rpl_slave_compressed_protocol_basic.test'
--- a/mysql-test/t/rpl_slave_compressed_protocol_basic.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/rpl_slave_compressed_protocol_basic.test	1970-01-01 00:00:00 +0000
@@ -1,167 +0,0 @@
-############# mysql-test\t\slave_compressed_protocol_basic.test ###############
-#                                                                             #
-# Variable Name: slave_compressed_protocol                                    #
-# Scope: GLOBAL                                                               #
-# Access Type: Dynamic                                                        #
-# Data Type: boolean                                                          #
-# Default Value: FALSE                                                        #
-# Range: TRUE, FALSE                                                          #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Rizwan                                                             #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable slave_compressed_protocol#
-#              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_compressed_protocol TESTS          #
-######################################################################## 
-
-
-############################################################################## 
-#  Saving initial value of slave_compressed_protocol in a temporary variable #
-############################################################################## 
-
-SET @global_start_value = @@global.slave_compressed_protocol;
-SELECT @global_start_value;
-
---echo '#--------------------FN_DYNVARS_147_01------------------------#'
-######################################################################## 
-#           Display the DEFAULT value of slave_compressed_protocol     #
-######################################################################## 
-
-SET @@global.slave_compressed_protocol = 1;
-SET @@global.slave_compressed_protocol = DEFAULT;
-SELECT @@global.slave_compressed_protocol;
-
---echo '#---------------------FN_DYNVARS_147_02-------------------------#'
-###############################################################################
-# Check if slave_compressed_protocol can be accessed with and without @@ sign #
-###############################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET slave_compressed_protocol = 1;
-SELECT @@slave_compressed_protocol;
---Error ER_UNKNOWN_TABLE
-SELECT global.slave_compressed_protocol;
-
-SET global slave_compressed_protocol = 1;
-SELECT @@global.slave_compressed_protocol;
-
-
---echo '#--------------------FN_DYNVARS_147_03------------------------#'
-######################################################################## 
-#    Change the value of slave_compressed_protocol to a valid value    #
-######################################################################## 
-
-SET @@global.slave_compressed_protocol = 0;
-SELECT @@global.slave_compressed_protocol;
-SET @@global.slave_compressed_protocol = 1;
-SELECT @@global.slave_compressed_protocol;
-
-
---echo '#--------------------FN_DYNVARS_147_04-------------------------#'
-########################################################################### 
-#   Change the value of slave_compressed_protocol to invalid value        #
-########################################################################### 
-
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = -1;
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = 2;
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = "1.00";
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = "Y";
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = YES;
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = ONN;
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = 0FF;
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = ' 1';
---Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.slave_compressed_protocol = NO;
-
-
---echo '#-------------------FN_DYNVARS_147_05----------------------------#'
-########################################################################### 
-#    Test if accessing session slave_compressed_protocol gives error      #
-########################################################################### 
-
---Error ER_GLOBAL_VARIABLE
-SET @@session.slave_compressed_protocol = 0;
---Error ER_GLOBAL_VARIABLE
-SET @@slave_compressed_protocol = 0;
---Error ER_GLOBAL_VARIABLE
-SET @@local.slave_compressed_protocol = 0;
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.slave_compressed_protocol;
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@local.slave_compressed_protocol;
-
---echo '#----------------------FN_DYNVARS_147_06------------------------#'
-######################################################################### 
-#     Check if the value in SESSION Table contains variable value       #
-#########################################################################
-
-SELECT count(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-
---echo '#----------------------FN_DYNVARS_147_07------------------------#'
-######################################################################### 
-#     Check if the value in GLOBAL Table matches value in variable      #
-#########################################################################
-
-SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-SELECT @@global.slave_compressed_protocol;
-SELECT VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_compressed_protocol';
-
---echo '#---------------------FN_DYNVARS_147_08-------------------------#'
-################################################################### 
-#        Check if ON and OFF values can be used on variable       #
-################################################################### 
-
-SET @@global.slave_compressed_protocol = OFF;
-SELECT @@global.slave_compressed_protocol;
-SET @@global.slave_compressed_protocol = ON;
-SELECT @@global.slave_compressed_protocol;
-
---echo '#---------------------FN_DYNVARS_147_09----------------------#'
-################################################################### 
-#      Check if TRUE and FALSE values can be used on variable     #
-################################################################### 
-
-SET @@global.slave_compressed_protocol = TRUE;
-SELECT @@global.slave_compressed_protocol;
-SET @@global.slave_compressed_protocol = FALSE;
-SELECT @@global.slave_compressed_protocol;
-
-##############################  
-#   Restore initial value    #
-##############################
-
-SET @@global.slave_compressed_protocol = @global_start_value;
-SELECT @@global.slave_compressed_protocol;
-
-###############################################################
-#                    END OF slave_compressed_protocol TESTS   #
-############################################################### 

=== removed file 'mysql-test/t/rpl_slave_exec_mode_basic.test'
--- a/mysql-test/t/rpl_slave_exec_mode_basic.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/rpl_slave_exec_mode_basic.test	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-############## mysql-test\t\slave_exec_mode_basic.test #########################
-#                                                                              #
-# Variable Name: slave_exec_mode                                               #
-# Scope: GLOBAL & SESSION                                                      #
-# Access Type: Dynamic                                                         #
-# Data Type: Numeric                                                           #
-# Default Value: 1                                                             #
-# Range: 1 - 65536                                                             #
-#                                                                              #
-#                                                                              #
-# Creation Date: 2008-02-07                                                    #
-# Author:  Rizwan Maredia                                                      #
-#                                                                              #
-# Description: Test Cases of Dynamic System Variable slave_exec_mode           #
-#              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_exec_mode TESTS                    #
-######################################################################## 
-
-
-######################################################################## 
-#     Saving initial value of slave_exec_mode in a temporary variable  #
-######################################################################## 
-SET @start_value = @@global.slave_exec_mode;
---echo 'This variable is not supported in version 5.1.22. It is introduced in 5.1.24'
-
-######################################################################## 
-#                    END OF slave_exec_mode TESTS                      #
-######################################################################## 

=== removed file 'mysql-test/t/rpl_slave_net_timeout_basic.test'
--- a/mysql-test/t/rpl_slave_net_timeout_basic.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/rpl_slave_net_timeout_basic.test	1970-01-01 00:00:00 +0000
@@ -1,187 +0,0 @@
-################## mysql-test\t\slave_net_timeout_basic.test ##################
-#                                                                             #
-# Variable Name: slave_net_timeout                                            #
-# Scope: GLOBAL                                                               #
-# Access Type: Dynamic                                                        #
-# Data Type: numeric                                                          #
-# Default Value: 3600                                                         #
-# Range:                                                                      #
-#                                                                             #
-#                                                                             #
-# Creation Date: 2008-02-07                                                   #
-# Author:  Rizwan                                                             #
-#                                                                             #
-# Description: Test Cases of Dynamic System Variable slave_net_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                                               #
-#                                                                             #
-###############################################################################
-
---source include/not_embedded.inc
---source include/load_sysvars.inc
-###########################################################
-#           START OF slave_net_timeout TESTS              #
-###########################################################
-
-
-#############################################################
-#                 Save initial value                        #
-#############################################################
-
-SET @start_global_value = @@global.slave_net_timeout;
-SELECT @start_global_value;
-
---echo '#--------------------FN_DYNVARS_146_01-------------------------#'
-###########################################################
-#     Display the DEFAULT value of slave_net_timeout      #
-###########################################################
-
-SET @@global.slave_net_timeout = 500000;
-SET @@global.slave_net_timeout = DEFAULT;
-SELECT @@global.slave_net_timeout;
-
---echo '#--------------------FN_DYNVARS_146_02-------------------------#'
-############################################################
-#     Check the DEFAULT value of slave_net_timeout         #
-############################################################
-
-SET @@global.slave_net_timeout = DEFAULT;
-SELECT @@global.slave_net_timeout = 3600;
-
---echo '#--------------------FN_DYNVARS_146_03-------------------------#'
-###########################################################################
-# Change the value of slave_net_timeout to a valid value for GLOBAL Scope #
-###########################################################################
-
-SET @@global.slave_net_timeout = 0;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 1;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 15;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 1024;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 3600+1;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 2147483648;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = 2147483648*2-1;
-SELECT @@global.slave_net_timeout;
-
-
---echo '#--------------------FN_DYNVARS_146_04-------------------------#'
-###############################################################################
-#           Check if variable can be access with session scope                #
-###############################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET @@slave_net_timeout = 2;
-
---Error ER_GLOBAL_VARIABLE
-SET @@session.slave_net_timeout = 3;
-
---Error ER_GLOBAL_VARIABLE
-SET @@local.slave_net_timeout = 4;
-
-
-
---echo '#------------------FN_DYNVARS_146_05-----------------------#'
-#############################################################
-# Change the value of slave_net_timeout to an invalid value #
-#############################################################
-
-SET @@global.slave_net_timeout = -1;
-SELECT @@global.slave_net_timeout;
-
-SET @@global.slave_net_timeout = -2147483648;
-SELECT @@global.slave_net_timeout;
-
-SET @@global.slave_net_timeout = 2147483649*2;
-SELECT @@global.slave_net_timeout;
-
---Error ER_PARSE_ERROR
-SET @@global.slave_net_timeout = 65530.34.;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_net_timeout = 100s;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_net_timeout = 7483649.56;
---Error ER_WRONG_TYPE_FOR_VAR
-SET @@global.slave_net_timeout = 0.6;
-
---echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
-
-
---echo '#------------------FN_DYNVARS_146_06-----------------------#'
-####################################################################
-#   Check if the value in GLOBAL Table matches value in variable   #
-####################################################################
-
-SET @@global.slave_net_timeout = 3000;
-SELECT @@global.slave_net_timeout = VARIABLE_VALUE 
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
-WHERE VARIABLE_NAME='slave_net_timeout';
-
-
---echo '#------------------FN_DYNVARS_146_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_net_timeout';
-
-
---echo '#------------------FN_DYNVARS_146_08-----------------------#'
-####################################################################
-#     Check if TRUE and FALSE values can be used on variable       #
-####################################################################
-
-SET @@global.slave_net_timeout = TRUE;
-SELECT @@global.slave_net_timeout;
-SET @@global.slave_net_timeout = FALSE;
-SELECT @@global.slave_net_timeout;
-
-
---echo '#---------------------FN_DYNVARS_001_09----------------------#'
-###############################################################################
-#  Check if accessing variable with and without GLOBAL point to same variable #
-###############################################################################
-
-
-SET @@global.slave_net_timeout = 60*60;
-SELECT @@slave_net_timeout = @@global.slave_net_timeout;
-
-
---echo '#---------------------FN_DYNVARS_001_10----------------------#'
-##########################################################################
-#   Check if slave_net_timeout can be accessed without @@ sign and scope #
-##########################################################################
-
---Error ER_GLOBAL_VARIABLE
-SET slave_net_timeout = 2048;
---Error ER_BAD_FIELD_ERROR
-SELECT slave_net_timeout;
-
-SELECT @@slave_net_timeout;
-
-#verifying another another syntax for setting value
-SET global slave_net_timeout = 99;
-
-####################################
-#     Restore initial value        #
-####################################
-
-SET @@global.slave_net_timeout = @start_global_value;
-SELECT @@global.slave_net_timeout;
-
-################################################
-#              END OF slave_net_timeout TESTS  #
-################################################
-

=== removed file 'mysql-test/t/rpl_slave_transaction_retries_basic_32.test'
--- a/mysql-test/t/rpl_slave_transaction_retries_basic_32.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/rpl_slave_transaction_retries_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/slave_transaction_retries_basic.inc
-

=== removed file 'mysql-test/t/rpl_slave_transaction_retries_basic_64.test'
--- a/mysql-test/t/rpl_slave_transaction_retries_basic_64.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/rpl_slave_transaction_retries_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/slave_transaction_retries_basic.inc
-

=== removed file 'mysql-test/t/rpl_sync_binlog_basic_32.test'
--- a/mysql-test/t/rpl_sync_binlog_basic_32.test	2008-05-16 02:44:49 +0000
+++ b/mysql-test/t/rpl_sync_binlog_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/sync_binlog_basic.inc
-

=== removed file 'mysql-test/t/rpl_sync_binlog_basic_64.test'
--- a/mysql-test/t/rpl_sync_binlog_basic_64.test	2008-05-16 02:44:49 +0000
+++ b/mysql-test/t/rpl_sync_binlog_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/sync_binlog_basic.inc
-

=== renamed file 'mysql-test/t/rpl_slave_allow_batching_basic.test' =>
'mysql-test/t/slave_allow_batching_basic.test'
--- a/mysql-test/t/rpl_slave_allow_batching_basic.test	2008-05-14 23:24:13 +0000
+++ b/mysql-test/t/slave_allow_batching_basic.test	2008-08-07 13:36:47 +0000
@@ -1,3 +1,4 @@
+<<<<<<< TREE
 ############## mysql-test\t\slave_allow_batching_basic.test ####################
 #                                                                              #
 # Variable Name: slave_allow_batching                                          #
@@ -164,3 +165,169 @@ SELECT @@global.slave_allow_batching;
 ###############################################################
 #                    END OF slave_allow_batching TESTS        #
 ############################################################### 
+=======
+############## mysql-test\t\slave_allow_batching_basic.test ####################
+#                                                                              #
+# Variable Name: slave_allow_batching                                          #
+# Scope: GLOBAL & SESSION                                                      #
+# Access Type: Dynamic                                                         #
+# Data Type: Numeric                                                           #
+# Default Value: 1                                                             #
+# Range: 1 - 65536                                                             #
+#                                                                              #
+#                                                                              #
+# Creation Date: 2008-02-07                                                    #
+# Author:  Rizwan Maredia                                                      #
+#                                                                              #
+# Description: Test Cases of Dynamic System Variable slave_allow_batching      #
+#              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_allow_batching TESTS               #
+######################################################################## 
+
+
+################################################################################ 
+#      Saving initial value of slave_allow_batching in a temporary variable    #
+################################################################################ 
+
+SET @global_start_value = @@global.slave_allow_batching;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_145_01------------------------#'
+######################################################################## 
+#           Display the DEFAULT value of slave_allow_batching          #
+######################################################################## 
+
+SET @@global.slave_allow_batching = 1;
+SET @@global.slave_allow_batching = DEFAULT;
+SELECT @@global.slave_allow_batching;
+
+--echo '#---------------------FN_DYNVARS_145_02-------------------------#'
+############################################################################# 
+#   Check if slave_allow_batching can be accessed with and without @@ sign  #
+############################################################################# 
+
+--Error ER_GLOBAL_VARIABLE
+SET slave_allow_batching = 1;
+SELECT @@slave_allow_batching;
+--Error ER_UNKNOWN_TABLE
+SELECT global.slave_allow_batching;
+
+SET global slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+
+
+--echo '#--------------------FN_DYNVARS_145_03------------------------#'
+######################################################################## 
+#    Change the value of slave_allow_batching to a valid value         #
+######################################################################## 
+
+SET @@global.slave_allow_batching = 0;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+
+
+--echo '#--------------------FN_DYNVARS_145_04-------------------------#'
+########################################################################### 
+#               Change the value of slave_allow_batching to invalid value          #
+########################################################################### 
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = YES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = OOF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = ' 1';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = NO;
+
+
+--echo '#-------------------FN_DYNVARS_145_05----------------------------#'
+########################################################################### 
+#           Test if accessing session slave_allow_batching gives error             #
+########################################################################### 
+
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_allow_batching = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_allow_batching = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_allow_batching = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_allow_batching;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.slave_allow_batching;
+
+--echo '#----------------------FN_DYNVARS_145_06------------------------#'
+######################################################################### 
+#     Check if the value in SESSION Table contains variable value       #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE
VARIABLE_NAME='slave_allow_batching';
+
+
+--echo '#----------------------FN_DYNVARS_145_07------------------------#'
+######################################################################### 
+#     Check if the value in GLOBAL Table matches value in variable     #
+#########################################################################
+
+SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM
INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+SELECT @@global.slave_allow_batching;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE
VARIABLE_NAME='slave_allow_batching';
+
+--echo '#---------------------FN_DYNVARS_145_08-------------------------#'
+################################################################### 
+#        Check if ON and OFF values can be used on variable       #
+################################################################### 
+
+SET @@global.slave_allow_batching = OFF;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = ON;
+SELECT @@global.slave_allow_batching;
+
+--echo '#---------------------FN_DYNVARS_145_09----------------------#'
+################################################################### 
+#      Check if TRUE and FALSE values can be used on variable     #
+################################################################### 
+
+SET @@global.slave_allow_batching = TRUE;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = FALSE;
+SELECT @@global.slave_allow_batching;
+
+##############################  
+#   Restore initial value    #
+##############################
+
+SET @@global.slave_allow_batching = @global_start_value;
+SELECT @@global.slave_allow_batching;
+
+###############################################################
+#                    END OF slave_allow_batching TESTS        #
+############################################################### 
+>>>>>>> MERGE-SOURCE

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2008-04-14 23:28:17 +0000
+++ b/mysql-test/t/sp-error.test	2008-08-07 13:36:47 +0000
@@ -2420,6 +2420,32 @@ set @@max_sp_recursion_depth = @old_recu
 drop procedure p1;
 
 #
+# Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal)
+#
+
+--disable_warnings
+drop procedure if exists proc_8759;
+--enable_warnings
+
+delimiter $$;
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_8759()
+begin
+  declare should_be_illegal condition for sqlstate '00000';
+  declare continue handler for should_be_illegal set @x=0;
+end$$
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_8759()
+begin
+  declare continue handler for sqlstate '00000' set @x=0;
+end$$
+
+delimiter ;$$
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

=== modified file 'mysql-test/t/union.test'
--- a/mysql-test/t/union.test	2008-05-13 15:15:40 +0000
+++ b/mysql-test/t/union.test	2008-08-07 13:36:47 +0000
@@ -91,6 +91,65 @@ SELECT @a:=1 UNION SELECT @a:=@a+1;
 (SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
 (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
 
+
+#
+# Bug#32858: Erro: "Incorrect usage of UNION and INTO" does not take subselects 
+# into account
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+
+SELECT a INTO @v FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a FROM t1
+) alias;
+
+SELECT a INTO OUTFILE 'union.out.file' FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a FROM t1 WHERE 0
+) alias;
+
+SELECT a INTO DUMPFILE 'union.out.file2' FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a FROM t1 WHERE 0
+) alias;
+
+#
+# INTO will not be allowed in subqueries in version 5.1 and above.
+#
+SELECT a FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a INTO @v FROM t1
+) alias;
+
+SELECT a FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a INTO OUTFILE 'union.out.file3' FROM t1
+) alias;
+
+SELECT a FROM (
+  SELECT a FROM t1
+  UNION
+  SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
+) alias;
+
+SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+--error ER_WRONG_USAGE
+SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+
+DROP TABLE t1;
+
 #
 # Test bug reported by joc@stripped
 #

=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am	2008-04-01 15:13:57 +0000
+++ b/mysys/Makefile.am	2008-08-07 13:36:47 +0000
@@ -18,10 +18,25 @@ MYSQLSHAREdir =		$(pkgdatadir)
 MYSQLBASEdir=		$(prefix)
 INCLUDES =		@ZLIB_INCLUDES@ -I$(top_builddir)/include \
 			-I$(top_srcdir)/include -I$(srcdir)
-pkglib_LIBRARIES =	libmysys.a
-LDADD =			libmysys.a $(top_builddir)/strings/libmystrings.a
$(top_builddir)/dbug/libdbug.a
+LDADD =			$(top_builddir)/strings/libmystringslt.la \
+			$(top_builddir)/dbug/libdbuglt.la @ZLIB_LIBS@
+
+
+pkglib_LTLIBRARIES =	libmysys.la
+libmysys_la_LDFLAGS = 	-static
+libmysys_la_SOURCES =   
+# This can't be listed here as $(top_builddir)/mysys/libmysyslt.la
+# or it breaks make's dependency track for -j builds
+libmysys_la_LIBADD =	libmysyslt.la libmysyswrap.la
+# Force C++ linking - dummy.cxx doesn't have to exist with EXTRA in the name
+nodist_EXTRA_libmysys_la_SOURCES = dummy.cxx
+
+# We split out my_wrap because it's only used by mysqld and otherwise
+# creates an unneccesary linking dependency on -lwrap
+noinst_LTLIBRARIES =	libmysyslt.la libmysyswrap.la
+libmysyswrap_la_SOURCES = my_libwrap.c
 noinst_HEADERS =	mysys_priv.h my_static.h my_handler_errors.h
-libmysys_a_SOURCES =    my_init.c my_getwd.c mf_getdate.c my_mmap.c \
+libmysyslt_la_SOURCES =	my_init.c my_getwd.c mf_getdate.c my_mmap.c \
 			mf_path.c mf_loadpath.c my_file.c \
 			my_open.c my_create.c my_dup.c my_seek.c my_read.c \
 			my_pread.c my_write.c my_getpagesize.c \
@@ -53,16 +68,13 @@ libmysys_a_SOURCES =    my_init.c my_get
 			my_gethostbyname.c rijndael.c my_aes.c sha1.c \
 			my_handler.c my_netware.c my_largepage.c \
 			my_memmem.c \
-			my_windac.c my_access.c base64.c my_libwrap.c
-EXTRA_DIST =		thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
+			my_windac.c my_access.c base64.c \
+			thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
 			thr_mutex.c thr_rwlock.c \
-			CMakeLists.txt mf_soundex.c \
+			mf_soundex.c \
 			my_conio.c my_wincond.c my_winthread.c
-libmysys_a_LIBADD =	@THREAD_LOBJECTS@
-# test_dir_DEPENDENCIES=	$(LIBRARIES)
-# testhash_DEPENDENCIES=	$(LIBRARIES)
-# test_charset_DEPENDENCIES=	$(LIBRARIES)
-# charset2html_DEPENDENCIES=	$(LIBRARIES)
+EXTRA_DIST =  		CMakeLists.txt 
+
 DEFS =			-DDEFAULT_BASEDIR=\"$(prefix)\" \
 			-DDATADIR="\"$(MYSQLDATAdir)\"" \
 			-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
@@ -72,60 +84,5 @@ DEFS =			-DDEFAULT_BASEDIR=\"$(prefix)\"
 			-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
                         @DEFS@
 
-libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
-
-# I hope this always does the right thing. Otherwise this is only test programs
-FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
-
-#
-# The CP .. RM stuff is to avoid problems with some compilers (like alpha ccc)
-# which automaticly removes the object files you use to compile a final program
-#
-
-test_bitmap$(EXEEXT): my_bitmap.c $(LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN  ./my_bitmap.c $(LDADD) $(LIBS)
-
-test_priority_queue$(EXEEXT): queues.c $(LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN  ./queues.c $(LDADD) $(LIBS)
-
-test_thr_alarm$(EXEEXT): thr_alarm.c $(LIBRARIES)
-	$(CP) $(srcdir)/thr_alarm.c ./test_thr_alarm.c
-	$(LINK) $(FLAGS) -DMAIN  ./test_thr_alarm.c $(LDADD) $(LIBS)
-	$(RM) -f ./test_thr_alarm.c
-
-test_thr_lock$(EXEEXT): thr_lock.c $(LIBRARIES)
-	$(CP) $(srcdir)/thr_lock.c test_thr_lock.c
-	$(LINK) $(FLAGS) -DMAIN  ./test_thr_lock.c $(LDADD) $(LIBS)
-	$(RM) -f ./test_thr_lock.c
-
-test_vsnprintf$(EXEEXT): my_vsnprintf.c $(LIBRARIES)
-	$(CP) $(srcdir)/my_vsnprintf.c test_vsnprintf.c
-	$(LINK) $(FLAGS) -DMAIN ./test_vsnprintf.c $(LDADD) $(LIBS)
-	$(RM) -f test_vsnprintf.c
-
-test_io_cache$(EXEEXT): mf_iocache.c $(LIBRARIES)
-	$(CP) $(srcdir)/mf_iocache.c test_io_cache.c
-	$(LINK) $(FLAGS) -DMAIN ./test_io_cache.c $(LDADD) $(LIBS)
-	$(RM) -f test_io_cache.c
-
-test_dir$(EXEEXT): test_dir.c $(LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_dir.c $(LDADD) $(LIBS)
-
-test_charset$(EXEEXT): test_charset.c $(LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN $(srcdir)/test_charset.c $(LDADD) $(LIBS)
-
-testhash$(EXEEXT): testhash.c $(LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN $(srcdir)/testhash.c $(LDADD) $(LIBS)
-
-test_gethwaddr$(EXEEXT): my_gethwaddr.c $(LIBRARIES)
-	$(CP) $(srcdir)/my_gethwaddr.c ./test_gethwaddr.c
-	$(LINK) $(FLAGS) -DMAIN  ./test_gethwaddr.c $(LDADD) $(LIBS)
-	$(RM) -f ./test_gethwaddr.c
-
-test_base64$(EXEEXT): base64.c $(LIBRARIES)
-	$(CP) $(srcdir)/base64.c ./test_base64.c
-	$(LINK) $(FLAGS) -DMAIN  ./test_base64.c $(LDADD) $(LIBS)
-	$(RM) -f ./test_base64.c
-
 # Don't update the files from bitkeeper
 %::SCCS/s.%

=== modified file 'mysys/my_bitmap.c'
--- a/mysys/my_bitmap.c	2008-04-01 15:13:57 +0000
+++ b/mysys/my_bitmap.c	2008-08-07 13:36:47 +0000
@@ -763,7 +763,7 @@ uint get_rand_bit(uint bitsize)
   return (rand() % bitsize);
 }
 
-bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize)
+my_bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize)
 {
   uint i, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -786,7 +786,7 @@ error2:
   return TRUE;
 }
 
-bool test_flip_bit(MY_BITMAP *map, uint bitsize)
+my_bool test_flip_bit(MY_BITMAP *map, uint bitsize)
 {
   uint i, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -809,13 +809,13 @@ error2:
   return TRUE;
 }
 
-bool test_operators(MY_BITMAP *map __attribute__((unused)),
+my_bool test_operators(MY_BITMAP *map __attribute__((unused)),
                     uint bitsize __attribute__((unused)))
 {
   return FALSE;
 }
 
-bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
+my_bool test_get_all_bits(MY_BITMAP *map, uint bitsize)
 {
   uint i;
   bitmap_set_all(map);
@@ -857,7 +857,7 @@ error6:
   return TRUE;
 }
 
-bool test_compare_operators(MY_BITMAP *map, uint bitsize)
+my_bool test_compare_operators(MY_BITMAP *map, uint bitsize)
 {
   uint i, j, test_bit1, test_bit2, test_bit3,test_bit4;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -963,7 +963,7 @@ error5:
   return TRUE;
 }
 
-bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
+my_bool test_count_bits_set(MY_BITMAP *map, uint bitsize)
 {
   uint i, bit_count=0, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -989,7 +989,7 @@ error2:
   return TRUE;
 }
 
-bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
+my_bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
 {
   uint i, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -1014,7 +1014,7 @@ error2:
   return TRUE;
 }
 
-bool test_get_next_bit(MY_BITMAP *map, uint bitsize)
+my_bool test_get_next_bit(MY_BITMAP *map, uint bitsize)
 {
   uint i, j, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -1033,7 +1033,7 @@ error1:
   return TRUE;
 }
 
-bool test_prefix(MY_BITMAP *map, uint bitsize)
+my_bool test_prefix(MY_BITMAP *map, uint bitsize)
 {
   uint i, j, test_bit;
   uint no_loops= bitsize > 128 ? 128 : bitsize;
@@ -1068,7 +1068,7 @@ error3:
 }
 
 
-bool do_test(uint bitsize)
+my_bool do_test(uint bitsize)
 {
   MY_BITMAP map;
   my_bitmap_map buf[1024];

=== modified file 'mysys/queues.c'
--- a/mysys/queues.c	2008-02-19 21:53:33 +0000
+++ b/mysys/queues.c	2008-08-07 13:36:47 +0000
@@ -384,11 +384,11 @@ static uint tot_no_parts= 0;
 static uint tot_no_loops= 0;
 static uint expected_part= 0;
 static uint expected_num= 0;
-static bool max_ind= 0;
-static bool fix_used= 0;
+static my_bool max_ind= 0;
+static my_bool fix_used= 0;
 static ulonglong start_time= 0;
 
-static bool is_divisible_by(uint num, uint divisor)
+static my_bool is_divisible_by(uint num, uint divisor)
 {
   uint quotient= num / divisor;
   if (quotient * divisor == num)
@@ -495,7 +495,7 @@ static int test_compare(void *null_arg, 
   return 0;
 }
 
-bool check_num(uint num_part)
+my_bool check_num(uint num_part)
 {
   uint part= num_part >> 22;
   uint num= num_part & 0x3FFFFF;
@@ -546,7 +546,7 @@ void perform_insert(QUEUE *queue)
   }
 }
 
-bool perform_ins_del(QUEUE *queue, bool max_ind)
+my_bool perform_ins_del(QUEUE *queue, my_bool max_ind)
 {
   uint i= 0, no_loops= tot_no_loops, j= tot_no_parts;
   do
@@ -574,10 +574,10 @@ bool perform_ins_del(QUEUE *queue, bool 
   return FALSE;
 }
 
-bool do_test(uint no_parts, uint l_max_ind, bool l_fix_used)
+my_bool do_test(uint no_parts, uint l_max_ind, my_bool l_fix_used)
 {
   QUEUE queue;
-  bool result;
+  my_bool result;
   max_ind= l_max_ind;
   fix_used= l_fix_used;
   init_queue(&queue, no_parts, 0, max_ind, test_compare, NULL);

=== added directory 'mysys/tests'
=== added file 'mysys/tests/Makefile.am'
--- a/mysys/tests/Makefile.am	1970-01-01 00:00:00 +0000
+++ b/mysys/tests/Makefile.am	2008-04-25 23:09:48 +0000
@@ -0,0 +1,52 @@
+# Copyright (C) 2000-2006 MySQL AB
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+MYSQLDATAdir =		$(localstatedir)
+MYSQLSHAREdir =		$(pkgdatadir)
+MYSQLBASEdir=		$(prefix)
+INCLUDES =		@ZLIB_INCLUDES@ -I$(top_builddir)/include \
+			-I$(top_srcdir)/include -I$(srcdir)  \
+                        -I$(top_srcdir)/mysys
+LDADD =			$(top_builddir)/mysys/libmysyslt.la $(top_builddir)/strings/libmystrings.la
$(top_builddir)/dbug/libdbug.la
+
+DEFS =			-DMAIN \
+			-DDEFAULT_BASEDIR=\"$(prefix)\" \
+			-DDATADIR="\"$(MYSQLDATAdir)\"" \
+			-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
+			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
+			-DDEFAULT_HOME_ENV=MYSQL_HOME \
+			-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
+			-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
+                        @DEFS@
+
+# I hope this always does the right thing. Otherwise this is only test programs
+FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
+
+noinst_PROGRAMS = test_bitmap test_priority_queue test_thr_alarm test_thr_lock
test_vsnprintf test_io_cache testhash test_gethwaddr test_base64 #test_charset
+test_bitmap_SOURCES = $(top_srcdir)/mysys/my_bitmap.c
+test_thr_alarm_SOURCES = $(top_srcdir)/mysys/thr_alarm.c
+test_priority_queue_SOURCES = $(top_srcdir)/mysys/queues.c
+test_thr_lock_SOURCES = $(top_srcdir)/mysys/thr_lock.c
+test_vsnprintf_SOURCES = $(top_srcdir)/strings/my_vsnprintf.c
+test_io_cache_SOURCES = $(top_srcdir)/mysys/mf_iocache.c 
+#test_dir_SOURCES = test_dir.c
+#test_charset_SOURCES = test_charset.c
+testhash_SOURCES = testhash.c
+test_gethwaddr_SOURCES = $(top_srcdir)/mysys/my_gethwaddr.c
+test_base64_SOURCES = $(top_srcdir)/mysys/base64.c
+test_base64_LDADD = $(top_builddir)/mysys/libmysyslt.la
$(top_builddir)/strings/libmystrings.la
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%

=== renamed file 'mysys/test_charset.c' => 'mysys/tests/test_charset.c'
=== renamed file 'mysys/test_dir.c' => 'mysys/tests/test_dir.c'
=== renamed file 'mysys/testhash.c' => 'mysys/tests/testhash.c'
=== modified file 'netware/Makefile.am'
--- a/netware/Makefile.am	2007-10-30 19:08:54 +0000
+++ b/netware/Makefile.am	2008-08-07 13:36:47 +0000
@@ -16,14 +16,16 @@
 
 if HAVE_NETWARE
 INCLUDES =			-I$(top_builddir)/include -I$(top_srcdir)/include -I..
-LDADD =				@CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
-				../dbug/libdbug.a ../strings/libmystrings.a
+LDADD =				@CLIENT_EXTRA_LDFLAGS@ \
+				$(top_builddir)/mysys/libmysyslt.la \
+				$(top_builddir)/dbug/libdbuglt.la \
+				$(top_builddir)/strings/libmystringslt.la
 bin_PROGRAMS =			mysqld_safe mysql_install_db mysql_test_run libmysql
 mysqld_safe_SOURCES=		mysqld_safe.c my_manage.c
 mysql_install_db_SOURCES=	mysql_install_db.c my_manage.c
 mysql_test_run_SOURCES=		mysql_test_run.c my_manage.c
 libmysql_SOURCES=		libmysqlmain.c
-libmysql_LDADD =		../libmysql/.libs/libmysqlclient.a \
+libmysql_LDADD =		$(top_builddir)/libmysql/.libs/libmysqlclient.a \
 				@openssl_libs@ @yassl_libs@
 
 netware_build_files =           client/mysql.def client/mysqladmin.def \

=== modified file 'regex/Makefile.am'
--- a/regex/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/regex/Makefile.am	2008-04-25 06:32:23 +0000
@@ -17,7 +17,7 @@
 
 INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include
 noinst_LIBRARIES =	libregex.a
-LDADD=			libregex.a $(top_builddir)/strings/libmystrings.a
+LDADD=			libregex.a $(top_builddir)/strings/libmystrings.la
 noinst_HEADERS =	cclass.h cname.h regex2.h utils.h engine.c my_regex.h
 libregex_a_SOURCES =	regerror.c regcomp.c regexec.c regfree.c reginit.c
 noinst_PROGRAMS =	re

=== modified file 'scripts/mysql_config.sh'
--- a/scripts/mysql_config.sh	2008-03-27 22:47:31 +0000
+++ b/scripts/mysql_config.sh	2008-08-07 13:36:47 +0000
@@ -107,6 +107,7 @@ fi
 libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
 libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
 libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
+libdir="-L$pkglibdir"
 embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@
@innodb_system_libs@ @openssl_libs@ "
 
 if [ -r "$pkglibdir/libmygcc.a" ]; then
@@ -162,6 +163,7 @@ Options:
         --include        [$include]
         --libs           [$libs]
         --libs_r         [$libs_r]
+        --libdir         [$libdir]
         --plugindir      [$plugindir]
         --socket         [$socket]
         --port           [$port]
@@ -179,6 +181,7 @@ while test $# -gt 0; do
         --include) echo "$include" ;;
         --libs)    echo "$libs" ;;
         --libs_r)  echo "$libs_r" ;;
+        --libdir)  echo "$libdir" ;;
         --plugindir) echo "$plugindir" ;;
         --socket)  echo "$socket" ;;
         --port)    echo "$port" ;;

=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2008-05-09 07:47:28 +0000
+++ b/sql/Makefile.am	2008-08-07 13:36:47 +0000
@@ -42,10 +42,12 @@ noinst_LTLIBRARIES=	libndb.la \
 			udf_example.la
 
 SUPPORTING_LIBS =	$(top_builddir)/vio/libvio.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
+			$(top_builddir)/mysys/libmysyswrap.la \
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
 			$(top_builddir)/regex/libregex.a \
-			$(top_builddir)/strings/libmystrings.a
+			$(top_builddir)/strings/libmystringsextra.la \
+			$(top_builddir)/strings/libmystringslt.la
 mysqld_DEPENDENCIES=	@mysql_plugin_libs@ $(SUPPORTING_LIBS) backup/libbackup.la libndb.la
 LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@
 mysqld_LDADD =		libndb.la \

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-05-16 08:56:03 +0000
+++ b/sql/ha_ndbcluster.cc	2008-08-07 13:36:47 +0000
@@ -202,6 +202,7 @@ SHOW_VAR ndb_status_variables[]= {
   {"config_from_port",    (char*) &g_ndb_status.connected_port,       SHOW_LONG},
 //{"number_of_replicas",  (char*) &g_ndb_status.number_of_replicas,   SHOW_LONG},
   {"number_of_data_nodes",(char*) &g_ndb_status.number_of_data_nodes, SHOW_LONG},
+  {"cluster_connection_pool",(char*) &opt_ndb_cluster_connection_pool, SHOW_LONG},
   {NullS, NullS, SHOW_LONG}
 };
 
@@ -4624,21 +4625,26 @@ int ha_ndbcluster::external_lock(THD *th
   {
     DBUG_PRINT("info", ("lock_type == F_UNLCK"));
 
-    if (ndb_cache_check_time && m_rows_changed)
+    if (m_rows_changed)
     {
-      DBUG_PRINT("info", ("Rows has changed and util thread is running"));
+      DBUG_PRINT("info", ("Rows has changed"));
+
       if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
       {
-        DBUG_PRINT("info", ("Add share to list of tables to be invalidated"));
+        DBUG_PRINT("info", ("Add share to list of changed tables"));
         /* NOTE push_back allocates memory using transactions mem_root! */
-        thd_ndb->changed_tables.push_back(m_share, &thd->transaction.mem_root);
+        thd_ndb->changed_tables.push_back(m_share,
+                                          &thd->transaction.mem_root);
       }
 
-      pthread_mutex_lock(&m_share->mutex);
-      DBUG_PRINT("info", ("Invalidating commit_count"));
-      m_share->commit_count= 0;
-      m_share->commit_count_lock++;
-      pthread_mutex_unlock(&m_share->mutex);
+      if (ndb_cache_check_time)
+      {
+        pthread_mutex_lock(&m_share->mutex);
+        DBUG_PRINT("info", ("Invalidating commit_count"));
+        m_share->commit_count= 0;
+        m_share->commit_count_lock++;
+        pthread_mutex_unlock(&m_share->mutex);
+      }
     }
 
     if (!--thd_ndb->lock_count)
@@ -6334,6 +6340,8 @@ retry_temporary_error1:
 int ha_ndbcluster::delete_table(const char *name)
 {
   THD *thd= current_thd;
+  Ndb *ndb;
+  int error= 0;
   DBUG_ENTER("ha_ndbcluster::delete_table");
   DBUG_PRINT("enter", ("name: %s", name));
   set_dbname(name);
@@ -6348,17 +6356,35 @@ int ha_ndbcluster::delete_table(const ch
   {
     DBUG_PRINT("info", ("Schema distribution table not setup"));
     DBUG_ASSERT(ndb_schema_share);
-    DBUG_RETURN(HA_ERR_NO_CONNECTION);
+    error= HA_ERR_NO_CONNECTION;
+    goto err;
   }
 #endif
 
   if (check_ndb_connection(thd))
-    DBUG_RETURN(HA_ERR_NO_CONNECTION);
+  {
+    error= HA_ERR_NO_CONNECTION;
+    goto err;
+  }
 
-  /* Call ancestor function to delete .ndb file */
-  handler::delete_table(name);
+  ndb= get_ndb(thd);
+  /*
+    Drop table in ndb.
+    If it was already gone it might have been dropped
+    remotely, give a warning and then drop .ndb file.
+   */
+  if (!(error= delete_table(thd, this, ndb, name,
+                            m_dbname, m_tabname)) ||
+      error == HA_ERR_NO_SUCH_TABLE)
+  {
+    /* Call ancestor function to delete .ndb file */
+    int error1= handler::delete_table(name);
+    if (!error)
+      error= error1;
+  }
 
-  DBUG_RETURN(delete_table(thd, this, get_ndb(thd), name, m_dbname, m_tabname));
+err:
+  DBUG_RETURN(error);
 }
 
 
@@ -8070,20 +8096,34 @@ ndbcluster_cache_retrieval_allowed(THD *
                                    ulonglong *engine_data)
 {
   Uint64 commit_count;
-  bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
   char *dbname= full_name;
   char *tabname= dbname+strlen(dbname)+1;
 #ifndef DBUG_OFF
   char buff[22], buff2[22];
 #endif
   DBUG_ENTER("ndbcluster_cache_retrieval_allowed");
-  DBUG_PRINT("enter", ("dbname: %s, tabname: %s, is_autocommit: %d",
-                       dbname, tabname, is_autocommit));
+  DBUG_PRINT("enter", ("dbname: %s, tabname: %s",
+                       dbname, tabname));
 
-  if (!is_autocommit)
+  if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
   {
-    DBUG_PRINT("exit", ("No, don't use cache in transaction"));
-    DBUG_RETURN(FALSE);
+    /* Don't allow qc to be used if table has been previously
+       modified in transaction */
+    Thd_ndb *thd_ndb= get_thd_ndb(thd);
+    if (!thd_ndb->changed_tables.is_empty())
+    {
+      NDB_SHARE* share;
+      List_iterator_fast<NDB_SHARE> it(thd_ndb->changed_tables);
+      while ((share= it++))
+      {
+        if (strcmp(share->table_name, tabname) == 0 &&
+            strcmp(share->db, dbname) == 0)
+        {
+          DBUG_PRINT("exit", ("No, transaction has changed table"));
+          DBUG_RETURN(FALSE);
+        }
+      }
+    }
   }
 
   if (ndb_get_commitcount(thd, dbname, tabname, &commit_count))
@@ -8145,15 +8185,29 @@ ha_ndbcluster::register_query_cache_tabl
 #ifndef DBUG_OFF
   char buff[22];
 #endif
-  bool is_autocommit= !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
   DBUG_ENTER("ha_ndbcluster::register_query_cache_table");
-  DBUG_PRINT("enter",("dbname: %s, tabname: %s, is_autocommit: %d",
-		      m_dbname, m_tabname, is_autocommit));
+  DBUG_PRINT("enter",("dbname: %s, tabname: %s",
+		      m_dbname, m_tabname));
 
-  if (!is_autocommit)
+  if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
   {
-    DBUG_PRINT("exit", ("Can't register table during transaction"));
-    DBUG_RETURN(FALSE);
+    /* Don't allow qc to be used if table has been previously
+       modified in transaction */
+    Thd_ndb *thd_ndb= get_thd_ndb(thd);
+    if (!thd_ndb->changed_tables.is_empty())
+    {
+      DBUG_ASSERT(m_share);
+      NDB_SHARE* share;
+      List_iterator_fast<NDB_SHARE> it(thd_ndb->changed_tables);
+      while ((share= it++))
+      {
+        if (m_share == share)
+        {
+          DBUG_PRINT("exit", ("No, transaction has changed table"));
+          DBUG_RETURN(FALSE);
+        }
+      }
+    }
   }
 
   if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count))

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2008-05-16 08:56:03 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2008-08-07 13:36:47 +0000
@@ -786,7 +786,22 @@ static int ndbcluster_create_ndb_apply_s
   {
     build_table_filename(buf, sizeof(buf),
                          NDB_REP_DB, NDB_APPLY_TABLE, reg_ext, 0);
-    my_delete(buf, MYF(0));
+    if (my_delete(buf, MYF(0)) == 0)
+    {
+      /*
+        The .frm file existed and was deleted from disk.
+        It's possible that someone has tried to use it and thus
+        it might have been inserted in the table definition cache.
+        It must be flushed to avoid that it exist only in the
+        table definition cache.
+      */
+      if (ndb_extra_logging)
+        sql_print_information("NDB: Flushing " NDB_REP_DB "." NDB_APPLY_TABLE);
+
+      end= strmov(buf, "FLUSH TABLE " NDB_REP_DB "." NDB_APPLY_TABLE);
+      const int no_print_error[1]= {0};
+      run_query(thd, buf, end, no_print_error, TRUE);
+    }
   }
 
   /*
@@ -801,9 +816,10 @@ static int ndbcluster_create_ndb_apply_s
                    " end_pos BIGINT UNSIGNED NOT NULL, "
                    " PRIMARY KEY USING HASH (server_id) ) ENGINE=NDB CHARACTER SET
latin1");
 
-  const int no_print_error[5]= {ER_TABLE_EXISTS_ERROR,
+  const int no_print_error[6]= {ER_TABLE_EXISTS_ERROR,
                                 701,
                                 702,
+                                721, // Table already exist
                                 4009,
                                 0}; // do not print error 701 etc
   run_query(thd, buf, end, no_print_error, TRUE);
@@ -843,7 +859,22 @@ static int ndbcluster_create_schema_tabl
   {
     build_table_filename(buf, sizeof(buf),
                          NDB_REP_DB, NDB_SCHEMA_TABLE, reg_ext, 0);
-    my_delete(buf, MYF(0));
+    if (my_delete(buf, MYF(0)) == 0)
+    {
+      /*
+        The .frm file existed and was deleted from disk.
+        It's possible that someone has tried to use it and thus
+        it might have been inserted in the table definition cache.
+        It must be flushed to avoid that it exist only in the
+        table definition cache.
+      */
+      if (ndb_extra_logging)
+        sql_print_information("NDB: Flushing " NDB_REP_DB "." NDB_SCHEMA_TABLE);
+
+      end= strmov(buf, "FLUSH TABLE " NDB_REP_DB "." NDB_SCHEMA_TABLE);
+      const int no_print_error[1]= {0};
+      run_query(thd, buf, end, no_print_error, TRUE);
+    }
   }
 
   /*
@@ -862,9 +893,10 @@ static int ndbcluster_create_schema_tabl
                    " type INT UNSIGNED NOT NULL,"
                    " PRIMARY KEY USING HASH (db,name) ) ENGINE=NDB CHARACTER SET
latin1");
 
-  const int no_print_error[5]= {ER_TABLE_EXISTS_ERROR,
+  const int no_print_error[6]= {ER_TABLE_EXISTS_ERROR,
                                 701,
                                 702,
+                                721, // Table already exist
                                 4009,
                                 0}; // do not print error 701 etc
   run_query(thd, buf, end, no_print_error, TRUE);

=== modified file 'sql/ha_ndbcluster_connection.cc'
--- a/sql/ha_ndbcluster_connection.cc	2008-02-22 12:29:11 +0000
+++ b/sql/ha_ndbcluster_connection.cc	2008-04-09 13:52:09 +0000
@@ -28,7 +28,6 @@
 extern my_bool opt_ndb_optimized_node_selection;
 extern const char *opt_ndbcluster_connectstring;
 extern ulong opt_ndb_wait_connected;
-extern ulong opt_ndb_cluster_connection_pool;
 
 Ndb* g_ndb= NULL;
 Ndb_cluster_connection* g_ndb_cluster_connection= NULL;

=== modified file 'sql/ha_ndbcluster_connection.h'
--- a/sql/ha_ndbcluster_connection.h	2007-11-20 14:22:05 +0000
+++ b/sql/ha_ndbcluster_connection.h	2008-04-09 13:52:09 +0000
@@ -20,3 +20,6 @@ Ndb_cluster_connection *ndb_get_cluster_
 ulonglong ndb_get_latest_trans_gci();
 void ndb_set_latest_trans_gci(ulonglong val);
 int ndb_has_node_id(uint id);
+
+/* options from from mysqld.cc */
+extern ulong opt_ndb_cluster_connection_pool;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-06-19 09:43:26 +0000
+++ b/sql/mysqld.cc	2008-08-07 13:36:47 +0000
@@ -6068,7 +6068,7 @@ thread is in the master's binlogs.",
    "Turn on more logging in the error log.",
    (uchar**) &ndb_extra_logging,
    (uchar**) &ndb_extra_logging,
-   0, GET_INT, OPT_ARG, 0, 0, 0, 0, 0, 0},
+   0, GET_ULONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #ifdef HAVE_NDB_BINLOG
   {"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
    "Threshold on number of epochs to be behind before reporting binlog status. "

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2008-06-19 09:43:26 +0000
+++ b/sql/sql_class.h	2008-08-07 13:36:47 +0000
@@ -2362,6 +2362,7 @@ class select_result :public Sql_alloc {
 protected:
   THD *thd;
   SELECT_LEX_UNIT *unit;
+  uint nest_level;
 public:
   select_result();
   virtual ~select_result() {};
@@ -2398,6 +2399,12 @@ public:
   */
   virtual void cleanup();
   void set_thd(THD *thd_arg) { thd= thd_arg; }
+  /**
+     The nest level, if supported. 
+     @return
+     -1 if nest level is undefined, otherwise a positive integer.
+   */
+  int get_nest_level() { return nest_level; }
 #ifdef EMBEDDED_LIBRARY
   virtual void begin_dataset() {}
 #else
@@ -2491,6 +2498,14 @@ class select_export :public select_to_fi
   bool fixed_row_size;
 public:
   select_export(sql_exchange *ex) :select_to_file(ex) {}
+  /**
+     Creates a select_export to represent INTO OUTFILE <filename> with a
+     defined level of subquery nesting.
+   */
+  select_export(sql_exchange *ex, uint nest_level_arg) :select_to_file(ex) 
+  {
+    nest_level= nest_level_arg;
+  }
   ~select_export();
   int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
   bool send_data(List<Item> &items);
@@ -2500,6 +2515,15 @@ public:
 class select_dump :public select_to_file {
 public:
   select_dump(sql_exchange *ex) :select_to_file(ex) {}
+  /**
+     Creates a select_export to represent INTO DUMPFILE <filename> with a
+     defined level of subquery nesting.
+   */  
+  select_dump(sql_exchange *ex, uint nest_level_arg) : 
+    select_to_file(ex) 
+  {
+    nest_level= nest_level_arg;
+  }
   int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
   bool send_data(List<Item> &items);
 };
@@ -2939,6 +2963,16 @@ class select_dumpvar :public select_resu
 public:
   List<my_var> var_list;
   select_dumpvar()  { var_list.empty(); row_count= 0;}
+  /**
+     Creates a select_dumpvar to represent INTO <variable> with a defined 
+     level of subquery nesting.
+   */
+  select_dumpvar(uint nest_level_arg)
+  {
+    var_list.empty();
+    row_count= 0;
+    nest_level= nest_level_arg;
+  }
   ~select_dumpvar() {}
   int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
   bool send_data(List<Item> &items);

=== modified file 'sql/stacktrace.c'
--- a/sql/stacktrace.c	2008-04-09 01:07:00 +0000
+++ b/sql/stacktrace.c	2008-08-07 13:36:47 +0000
@@ -13,6 +13,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
+/* Workaround for Bug#32082: VOID redefinition on Win results in compile errors*/
+#define DONT_DEFINE_VOID 1
+
 #include <my_global.h>
 #include "stacktrace.h"
 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2008-05-16 08:56:03 +0000
+++ b/sql/table.cc	2008-08-07 13:36:47 +0000
@@ -693,7 +693,8 @@ static int open_binary_frm(THD *thd, TAB
   const char **interval_array;
   enum legacy_db_type legacy_db_type;
   my_bitmap_map *bitmaps;
-  uchar *buff= 0;
+  uchar *buffbuff= 0; // rename to cause compile error if automerged stuff
+                      // as scope of variable has changed
   uchar *field_extra_info= 0;
   DBUG_ENTER("open_binary_frm");
 
@@ -889,14 +890,14 @@ static int open_binary_frm(THD *thd, TAB
     /* Read extra data segment */
     uchar *next_chunk, *buff_end;
     DBUG_PRINT("info", ("extra segment size is %u bytes", n_length));
-    if (!(next_chunk= buff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
+    if (!(next_chunk= buffbuff= (uchar*) my_malloc(n_length, MYF(MY_WME))))
       goto err;
-    if (my_pread(file, buff, n_length, record_offset + share->reclength,
+    if (my_pread(file, buffbuff, n_length, record_offset + share->reclength,
                  MYF(MY_NABP)))
     {
       goto err;
     }
-    share->connect_string.length= uint2korr(buff);
+    share->connect_string.length= uint2korr(buffbuff);
     if (!(share->connect_string.str= strmake_root(&share->mem_root,
                                                   (char*) next_chunk + 2,
                                                   share->connect_string.
@@ -905,7 +906,7 @@ static int open_binary_frm(THD *thd, TAB
       goto err;
     }
     next_chunk+= share->connect_string.length + 2;
-    buff_end= buff + n_length;
+    buff_end= buffbuff + n_length;
     if (next_chunk + 2 < buff_end)
     {
       uint str_db_type_length= uint2korr(next_chunk);
@@ -922,7 +923,6 @@ static int open_binary_frm(THD *thd, TAB
                 plugin_data(tmp_plugin, handlerton *)))
         {
           /* bad file, legacy_db_type did not match the name */
-          my_free(buff, MYF(0));
           goto err;
         }
         /*
@@ -958,7 +958,6 @@ static int open_binary_frm(THD *thd, TAB
         /* purecov: begin inspected */
         error= 8;
         my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
-        my_free(buff, MYF(0));
         goto err;
         /* purecov: end */
       }
@@ -1040,20 +1039,18 @@ static int open_binary_frm(THD *thd, TAB
       {
           DBUG_PRINT("error",
                      ("long table comment is not defined in .frm"));
-          my_free(buff, MYF(0));
           goto err;
       }
       share->comment.length = uint2korr(next_chunk);
       if (! (share->comment.str= strmake_root(&share->mem_root,
                                (char*)next_chunk + 2, share->comment.length)))
       {
-          my_free(buff, MYF(0));
           goto err;
       }
       next_chunk+= 2 + share->comment.length;
     }
     DBUG_ASSERT (next_chunk <= buff_end);
-    if (share->mysql_version >= MYSQL_VERSION_TABLESPACE_IN_FRM_CGE)
+    if (share->mysql_version >= MYSQL_VERSION_TABLESPACE_IN_FRM)
     {
       /*
        New frm format in mysql_version 5.2.5 (originally in
@@ -1095,12 +1092,6 @@ static int open_binary_frm(THD *thd, TAB
         next_chunk+= format_section_len;
       }
     }
-    DBUG_ASSERT (next_chunk <= buff_end);
-    if (next_chunk > buff_end)
-    {
-      DBUG_PRINT("error", ("Buffer overflow in field extra info"));
-      goto err;
-    }
   }
   share->key_block_size= uint2korr(head+62);
 
@@ -1680,13 +1671,13 @@ static int open_binary_frm(THD *thd, TAB
   if (use_hash)
     (void) hash_check(&share->name_hash);
 #endif
-  if (buff)
-    my_free(buff, MYF(0));
+  if (buffbuff)
+    my_free(buffbuff, MYF(0));
   DBUG_RETURN (0);
 
  err:
-  if (buff)
-    my_free(buff, MYF(0));
+  if (buffbuff)
+    my_free(buffbuff, MYF(0));
   share->error= error;
   share->open_errno= my_errno;
   share->errarg= errarg;

=== modified file 'storage/archive/Makefile.am'
--- a/storage/archive/Makefile.am	2008-03-06 14:14:53 +0000
+++ b/storage/archive/Makefile.am	2008-08-07 13:36:47 +0000
@@ -56,36 +56,36 @@ libarchive_a_SOURCES =	ha_archive.cc azi
 
 archive_performance_SOURCES =	archive_performance.c azio.c
 archive_performance_CFLAGS =	$(AM_CFLAGS) 
-archive_performance_LDADD =	$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a \
+archive_performance_LDADD =	$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la \
 			$(LDADD) \
 			@ZLIB_LIBS@
 archive_performance_LDFLAGS = @NOINST_LDFLAGS@
 
 archive_test_SOURCES =	archive_test.c azio.c
-archive_test_CFLAGS =	$(AM_CFLAGS) 
-archive_test_LDADD =	$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a \
+archive_test_CFLAGS =	$(AM_CFLAGS)
+archive_test_LDADD =	$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la \
 			$(LDADD) \
 			@ZLIB_LIBS@
 archive_test_LDFLAGS = @NOINST_LDFLAGS@
 
 archive_reader_SOURCES = archive_reader.c azio.c
-archive_reader_CFLAGS =	$(AM_CFLAGS) 
-archive_reader_LDADD =	$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a \
+archive_reader_CFLAGS =	$(AM_CFLAGS)
+archive_reader_LDADD =	$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la \
 			$(LDADD) \
 			@ZLIB_LIBS@
 archive_reader_LDFLAGS = @NOINST_LDFLAGS@
 
 concurrency_test_SOURCES = concurrency_test.c azio.c
 concurrency_test_CFLAGS =	$(AM_CFLAGS) 
-concurrency_test_LDADD =	$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a \
+concurrency_test_LDADD =	$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la \
 			$(LIBMYSQLCLIENT_LA) \
 			$(LDADD) \
 			@ZLIB_LIBS@

=== modified file 'storage/heap/Makefile.am'
--- a/storage/heap/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/heap/Makefile.am	2008-04-25 06:32:23 +0000
@@ -31,14 +31,14 @@ noinst_PROGRAMS	=	hp_test1 hp_test2
 noinst_LIBRARIES =	libheap.a
 hp_test1_LDFLAGS = @NOINST_LDFLAGS@
 hp_test1_LDADD =	libheap.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la
 hp_test2_LDFLAGS = @NOINST_LDFLAGS@
 hp_test2_LDADD =	libheap.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la
 noinst_HEADERS =	heapdef.h ha_heap.h
 libheap_a_SOURCES =	hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \
 			hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \

=== modified file 'storage/myisam/Makefile.am'
--- a/storage/myisam/Makefile.am	2007-10-12 16:04:59 +0000
+++ b/storage/myisam/Makefile.am	2008-08-07 13:36:47 +0000
@@ -34,55 +34,55 @@ pkglib_LIBRARIES =	libmyisam.a
 bin_PROGRAMS =		myisamchk myisamlog myisampack myisam_ftdump
 myisamchk_DEPENDENCIES=	$(LIBRARIES)
 myisamchk_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@ 
 myisamlog_DEPENDENCIES=	$(LIBRARIES)
 myisamlog_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 myisampack_DEPENDENCIES=$(LIBRARIES)
 myisampack_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 noinst_PROGRAMS =	mi_test1 mi_test2 mi_test3 rt_test sp_test #ft_test1 ft_eval
 noinst_HEADERS =	myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h \
 			fulltext.h ftdefs.h ft_test1.h ft_eval.h \
 			ha_myisam.h mi_extrafunc.h
 mi_test1_DEPENDENCIES=	$(LIBRARIES)
 mi_test1_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 mi_test2_DEPENDENCIES=	$(LIBRARIES)
 mi_test2_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 mi_test3_DEPENDENCIES=	$(LIBRARIES)
 mi_test3_LDADD=		@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 #ft_test1_DEPENDENCIES=	$(LIBRARIES)
 #ft_eval_DEPENDENCIES=	$(LIBRARIES)
 myisam_ftdump_DEPENDENCIES=	$(LIBRARIES)
 myisam_ftdump_LDADD =			@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 rt_test_DEPENDENCIES=	$(LIBRARIES)
 rt_test_LDADD =			@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 sp_test_DEPENDENCIES=	$(LIBRARIES)
 sp_test_LDADD =			@CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
-			$(top_builddir)/mysys/libmysys.a \
-			$(top_builddir)/dbug/libdbug.a \
-			$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
+			$(top_builddir)/mysys/libmysyslt.la \
+			$(top_builddir)/dbug/libdbuglt.la \
+			$(top_builddir)/strings/libmystringslt.la @ZLIB_LIBS@
 libmyisam_a_SOURCES =	mi_open.c mi_extra.c mi_info.c mi_rkey.c \
 			mi_rnext.c mi_rnext_same.c \
 			mi_search.c mi_page.c mi_key.c mi_locking.c \

=== modified file 'storage/ndb/config/type_ndbapitest.mk.am'
--- a/storage/ndb/config/type_ndbapitest.mk.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/config/type_ndbapitest.mk.am	2008-04-25 06:32:23 +0000
@@ -15,9 +15,9 @@
 
 LDADD += $(top_builddir)/storage/ndb/test/src/libNDBT.a \
          $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la @NDB_SCI_LIBS@
 
 INCLUDES += -I$(top_srcdir) \
 	-I$(top_builddir)/include \

=== modified file 'storage/ndb/config/type_ndbapitools.mk.am'
--- a/storage/ndb/config/type_ndbapitools.mk.am	2007-06-11 15:51:40 +0000
+++ b/storage/ndb/config/type_ndbapitools.mk.am	2008-04-25 06:32:23 +0000
@@ -15,9 +15,9 @@
 
 LDADD += \
          $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@ @ZLIB_LIBS@
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la @NDB_SCI_LIBS@ @ZLIB_LIBS@
 
 INCLUDES += -I$(srcdir) \
 	-I$(top_builddir)/include \

=== modified file 'storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp'
--- a/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2007-05-21 09:03:20 +0000
+++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2008-05-29 15:58:58 +0000
@@ -156,7 +156,10 @@ public:
     
     DumpTsman = 9800, 
     DumpLgman = 10000,
-    DumpPgman = 11000
+    DumpPgman = 11000,
+
+    SchemaResourceSnapshot = 4000, // Save resource consumption
+    SchemaResourceCheckLeak = 4001 // check same as snapshot
   };
 public:
   

=== modified file 'storage/ndb/include/kernel/signaldata/KeyInfo.hpp'
--- a/storage/ndb/include/kernel/signaldata/KeyInfo.hpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/include/kernel/signaldata/KeyInfo.hpp	2008-06-03 10:00:31 +0000
@@ -37,6 +37,16 @@ public:
   STATIC_CONST( HeaderLength = 3 );
   STATIC_CONST( DataLength = 20 );
   STATIC_CONST( MaxSignalLength = HeaderLength + DataLength );
+  
+  /* IndexBound constants */
+  STATIC_CONST( PerBoundColumnOverhead = 2 );
+  /* Max number of key columns with max total key size */
+  STATIC_CONST( MaxWordsPerBoundRow =   \
+                (PerBoundColumnOverhead * MAX_ATTRIBUTES_IN_INDEX)    \
+                + MAX_KEY_SIZE_IN_WORDS );
+  /* Single key column with max total key size */
+  STATIC_CONST( MaxWordsPerBoundColumn =     \
+                PerBoundColumnOverhead + MAX_KEY_SIZE_IN_WORDS );
 
 private:
   Uint32 connectPtr;

=== modified file 'storage/ndb/include/kernel/signaldata/ListTables.hpp'
--- a/storage/ndb/include/kernel/signaldata/ListTables.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/include/kernel/signaldata/ListTables.hpp	2008-05-16 13:08:36 +0000
@@ -19,11 +19,63 @@
 #include <Bitmask.hpp>
 #include "SignalData.hpp"
 
+class ListTablesData {
+public:
+  Uint32 getTableId() {
+    return tableId;
+  }
+  void setTableId(Uint32 val) {
+    tableId = val;
+  }
+  Uint32 getTableType() {
+    return tableType;
+  }
+  void setTableType(Uint32 val) {
+    tableType = val;
+  }
+  Uint32 getTableStore() {
+    return BitmaskImpl::getField(1, &requestData, 20, 3);
+  }
+  void setTableStore(Uint32 val) {
+    BitmaskImpl::setField(1, &requestData, 20, 3, val);
+  }
+  Uint32 getTableTemp() {
+    return BitmaskImpl::getField(1, &requestData, 23, 1);
+  }
+  void setTableTemp(Uint32 val) {
+    BitmaskImpl::setField(1, &requestData, 23, 1, val);
+  }
+  Uint32 getTableState() {
+    return BitmaskImpl::getField(1, &requestData, 24, 4);
+  }
+  void setTableState(Uint32 val) {
+    BitmaskImpl::setField(1, &requestData, 24, 4, val);
+  }
+  Uint32 getListNames() {
+    return BitmaskImpl::getField(1, &requestData, 28, 1);
+  }
+  void setListNames(Uint32 val) {
+    BitmaskImpl::setField(1, &requestData, 28, 1, val);
+  }
+  Uint32 getListIndexes() {
+    return BitmaskImpl::getField(1, &requestData, 29, 1);
+  }
+  void setListIndexes(Uint32 val) {
+    BitmaskImpl::setField(1, &requestData, 29, 1, val);
+  }
+public:
+  Uint32 requestData;
+  Uint32 tableId;
+  Uint32 tableType;
+};
+
 /**
+ * DEPRICATED
  * It is convenient to pack request/response data per table in one
  * 32-bit word...
+ *
  */
-class ListTablesData {
+class OldListTablesData {
 public:
   static Uint32 getTableId(Uint32 data) {
     return BitmaskImpl::getField(1, &data, 0, 12);
@@ -83,36 +135,58 @@ class ListTablesReq {
   friend class Dbdict;
 
 public:
-  STATIC_CONST( SignalLength = 3 );
+  STATIC_CONST( oldSignalLength = 3 );
+  STATIC_CONST( SignalLength = 5 );
 
 public:  
   Uint32 senderData;
   Uint32 senderRef;
   Uint32 requestData;
+  Uint32 tableId;
+  Uint32 tableType;
 
   Uint32 getTableId() {
-    return ListTablesData::getTableId(requestData);
+    return tableId;
   }
   void setTableId(Uint32 val) {
-    ListTablesData::setTableId(requestData, val);
+    tableId = val;
   }
   Uint32 getTableType() const {
-    return ListTablesData::getTableType(requestData);
+    return tableType;
   }
   void setTableType(Uint32 val) {
-    ListTablesData::setTableType(requestData, val);
+    tableType = val;
   }
   Uint32 getListNames() const {
-    return ListTablesData::getListNames(requestData);
+    ListTablesData* ltd = (ListTablesData *) &requestData;
+    return ltd->getListNames();
   }
   void setListNames(Uint32 val) {
-    ListTablesData::setListNames(requestData, val);
+    ListTablesData* ltd = (ListTablesData *) &requestData;
+    ltd->setListNames(val);
   }
   Uint32 getListIndexes() const {
-    return ListTablesData::getListIndexes(requestData);
+    ListTablesData* ltd = (ListTablesData *) &requestData;
+    return ltd->getListIndexes();
   }
   void setListIndexes(Uint32 val) {
-    ListTablesData::setListIndexes(requestData, val);
+    ListTablesData* ltd = (ListTablesData *) &requestData;
+    ltd->setListIndexes(val);
+  }
+
+
+  /* For backwards compatility */
+  Uint32 oldGetTableId() {
+    return OldListTablesData::getTableId(requestData);
+  }
+  void oldSetTableId(Uint32 val) {
+    OldListTablesData::setTableId(requestData, val);
+  }
+  Uint32 oldGetTableType() const {
+    return OldListTablesData::getTableType(requestData);
+  }
+  void oldSetTableType(Uint32 val) {
+    OldListTablesData::setTableType(requestData, val);
   }
 };
 
@@ -127,7 +201,29 @@ class ListTablesConf {
    */
   friend class Backup;
   friend class Table;
-  friend class Suma;
+
+public:
+  STATIC_CONST( SignalLength = 2 );
+
+public:
+  Uint32 senderData;
+  Uint32 noOfTables;
+
+  SECTION( TABLE_DATA = 0 );
+  SECTION( TABLE_NAMES = 1 );
+};
+
+class OldListTablesConf {
+  /**
+   * Sender(s)
+   */
+  friend class Dbdict;
+
+  /**
+   * Reciver(s)
+   */
+  friend class Backup;
+  friend class Table;
 
 public:
   /**
@@ -143,34 +239,34 @@ public:  
   Uint32 tableData[DataLength];
 
   static Uint32 getTableId(Uint32 data) {
-    return ListTablesData::getTableId(data);
+    return OldListTablesData::getTableId(data);
   }
   void setTableId(unsigned pos, Uint32 val) {
-    ListTablesData::setTableId(tableData[pos], val);
+    OldListTablesData::setTableId(tableData[pos], val);
   }
   static Uint32 getTableType(Uint32 data) {
-    return ListTablesData::getTableType(data);
+    return OldListTablesData::getTableType(data);
   }
   void setTableType(unsigned pos, Uint32 val) {
-    ListTablesData::setTableType(tableData[pos], val);
+    OldListTablesData::setTableType(tableData[pos], val);
   }
   static Uint32 getTableStore(Uint32 data) {
-    return ListTablesData::getTableStore(data);
+    return OldListTablesData::getTableStore(data);
   }
   void setTableStore(unsigned pos, Uint32 val) {
-    ListTablesData::setTableStore(tableData[pos], val);
+    OldListTablesData::setTableStore(tableData[pos], val);
   }
   static Uint32 getTableState(Uint32 data) {
-    return ListTablesData::getTableState(data);
+    return OldListTablesData::getTableState(data);
   }
   void setTableState(unsigned pos, Uint32 val) {
-    ListTablesData::setTableState(tableData[pos], val);
+    OldListTablesData::setTableState(tableData[pos], val);
   }
   static Uint32 getTableTemp(Uint32 data) {
-    return ListTablesData::getTableTemp(data);
+    return OldListTablesData::getTableTemp(data);
   }
   void setTableTemp(unsigned pos, Uint32 val) {
-    ListTablesData::setTableTemp(tableData[pos], val);
+    OldListTablesData::setTableTemp(tableData[pos], val);
   }
 };
 

=== modified file 'storage/ndb/include/mgmapi/mgmapi_config_parameters.h'
--- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2008-02-20 15:15:31 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2008-05-29 13:09:49 +0000
@@ -26,6 +26,7 @@
 #define CFG_NODE_HOST                 5
 #define CFG_NODE_SYSTEM               6
 #define CFG_NODE_DATADIR              7
+#define CFG_9                         9         /* used in later version */
 
 /**
  * DB config parameters
@@ -129,12 +130,14 @@
 #define CFG_DB_SUBSCRIBERS            180
 #define CFG_DB_SUB_OPERATIONS         181
 #define CFG_DB_MAX_BUFFERED_EPOCHS    182 /* subscriptions */
+#define CFG_DB_SUMA_HANDOVER_TIMEOUT  183
 
 #define CFG_DB_SGA                    198 /* super pool mem */
 #define CFG_DB_DATA_MEM_2             199 /* used in special build in 5.1 */
 
 #define CFG_NODE_ARBIT_RANK           200
 #define CFG_NODE_ARBIT_DELAY          201
+#define CFG_202                       202       /* used in later version */
 
 #define CFG_MIN_LOGLEVEL          250
 #define CFG_LOGLEVEL_STARTUP      250
@@ -164,6 +167,7 @@
 #define CFG_CONNECTION_HOSTNAME_2     408
 #define CFG_CONNECTION_GROUP          409
 #define CFG_CONNECTION_NODE_ID_SERVER 410
+#define CFG_411                       411       /* used in later version */
 
 #define CFG_TCP_SERVER                452
 #define CFG_TCP_SEND_BUFFER_SIZE      454

=== modified file 'storage/ndb/include/ndb_version.h.in'
--- a/storage/ndb/include/ndb_version.h.in	2008-03-14 11:35:36 +0000
+++ b/storage/ndb/include/ndb_version.h.in	2008-08-07 13:36:47 +0000
@@ -183,4 +183,27 @@ ndbd_suma_dictlock(Uint32 x)
   return x >= NDBD_SUMA_DICT_LOCK_63;
 }
 
+#define NDBD_LONG_LIST_TABLES_CONF_62 NDB_MAKE_VERSION(6,2,16)
+#define NDBD_LONG_LIST_TABLES_CONF_63 NDB_MAKE_VERSION(6,3,15)
+
+static
+inline
+int
+ndbd_LIST_TABLES_CONF_long_signal(Uint32 x)
+{
+  if (x >= NDB_VERSION_D)
+    return 1;
+
+  const Uint32 major = (x >> 16) & 0xFF;
+  const Uint32 minor = (x >>  8) & 0xFF;
+
+  if (major >= 6)
+  {
+    if (minor == 2)
+      return x >= NDBD_LONG_LIST_TABLES_CONF_62;
+  }
+
+  return x >= NDBD_LONG_LIST_TABLES_CONF_63;
+}
+
 #endif

=== modified file 'storage/ndb/include/ndbapi/NdbOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-04-28 14:17:28 +0000
@@ -1254,6 +1254,7 @@ protected:
   virtual void setErrorCode(int aErrorCode) const;
   virtual void setErrorCodeAbort(int aErrorCode) const;
 
+  bool        isNdbRecordOperation();
   int	      incCheck(const NdbColumnImpl* anAttrObject);
   int	      initial_interpreterCheck();
   int	      intermediate_interpreterCheck();

=== modified file 'storage/ndb/include/ndbapi/NdbReceiver.hpp'
--- a/storage/ndb/include/ndbapi/NdbReceiver.hpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/include/ndbapi/NdbReceiver.hpp	2008-04-25 09:17:19 +0000
@@ -31,6 +31,7 @@ class NdbReceiver
   friend class NdbIndexOperation;
   friend class NdbIndexScanOperation;
   friend class NdbTransaction;
+
 public:
   enum ReceiverType	{ NDB_UNINITIALIZED,
 			  NDB_OPERATION = 1,
@@ -62,6 +63,7 @@ public:
   inline NdbReceiver* next() { return m_next; }
   
   void setErrorCode(int);
+
 private:
   Uint32 theMagicNumber;
   Ndb* m_ndb;

=== modified file 'storage/ndb/include/util/SimpleProperties.hpp'
--- a/storage/ndb/include/util/SimpleProperties.hpp	2007-01-28 23:47:35 +0000
+++ b/storage/ndb/include/util/SimpleProperties.hpp	2008-05-16 13:08:36 +0000
@@ -277,11 +277,12 @@ Uint32 SimplePropertiesSectionReader::ge
 class SimplePropertiesSectionWriter : public SimpleProperties::Writer {
 public:
   SimplePropertiesSectionWriter(class SectionSegmentPool &);
-  virtual ~SimplePropertiesSectionWriter() {}
+  virtual ~SimplePropertiesSectionWriter();
 
   virtual bool reset();
   virtual bool putWord(Uint32 val);
   virtual bool putWords(const Uint32 * src, Uint32 len);
+  Uint32 getWordsUsed() const;
 
   /**
    * This "unlinks" the writer from the memory
@@ -289,6 +290,8 @@ public:
   void getPtr(struct SegmentedSectionPtr & dst);
   
 private:
+  void release();
+
   Int32 m_pos;
   Uint32 m_sz;
   class SectionSegmentPool & m_pool;

=== modified file 'storage/ndb/src/Makefile.am'
--- a/storage/ndb/src/Makefile.am	2007-01-20 00:58:03 +0000
+++ b/storage/ndb/src/Makefile.am	2008-04-25 06:32:23 +0000
@@ -25,6 +25,9 @@ libndbclient_la_LDFLAGS = -version-info 
 
 libndbclient_la_LIBADD =  \
               ndbapi/libndbapi.la \
+              $(top_builddir)/strings/libmystringslt.la \
+              $(top_builddir)/mysys/libmysyslt.la \
+              $(top_builddir)/dbug/libdbuglt.la \
               common/transporter/libtransporter.la   \
               common/debugger/libtrace.la     \
               common/debugger/signaldata/libsignaldataprint.la \
@@ -32,7 +35,7 @@ libndbclient_la_LIBADD =  \
               common/mgmcommon/libmgmsrvcommon.la \
               common/logger/liblogger.la       \
               common/portlib/libportlib.la      \
-              common/util/libgeneral.la 
+              common/util/libgeneral.la  @ZLIB_LIBS@
 
 windoze-dsp: libndbclient.dsp
 

=== modified file 'storage/ndb/src/common/debugger/EventLogger.cpp'
--- a/storage/ndb/src/common/debugger/EventLogger.cpp	2008-02-20 13:05:20 +0000
+++ b/storage/ndb/src/common/debugger/EventLogger.cpp	2008-04-22 19:36:05 +0000
@@ -1253,3 +1253,18 @@ EventLogger::setFilterLevel(int filterLe
 {
   m_filterLevel = filterLevel;
 }
+
+
+EventLogger*
+create_event_logger()
+{
+  return new EventLogger();
+}
+
+void
+destroy_event_logger(class EventLogger ** g_eventLogger)
+{
+  delete *g_eventLogger;
+  *g_eventLogger = 0;
+}
+

=== modified file 'storage/ndb/src/common/transporter/TCP_Transporter.cpp'
--- a/storage/ndb/src/common/transporter/TCP_Transporter.cpp	2008-03-11 16:15:47 +0000
+++ b/storage/ndb/src/common/transporter/TCP_Transporter.cpp	2008-08-07 13:36:47 +0000
@@ -21,7 +21,7 @@
 #include <NdbSleep.h>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 // End of stuff to be moved
 
 #ifdef NDB_WIN32
@@ -175,8 +175,8 @@ set_get(NDB_SOCKET_TYPE fd, int level, i
 		 (char*)&val, sizeof(val)) < 0)
   {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("setsockopt(%s, %d) errno: %d %s", 
-                        optname, val, errno, strerror(errno));
+    g_eventLogger->error("setsockopt(%s, %d) errno: %d %s",
+                         optname, val, errno, strerror(errno));
 #endif
   }
   
@@ -186,8 +186,8 @@ set_get(NDB_SOCKET_TYPE fd, int level, i
       actual != val)
   {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("setsockopt(%s, %d) - actual %d default: %d", 
-                        optname, val, actual, defval);
+    g_eventLogger->error("setsockopt(%s, %d) - actual %d default: %d",
+                         optname, val, actual, defval);
 #endif
   }
 }
@@ -225,7 +225,7 @@ TCP_Transporter::setSocketNonBlocking(ND
   if(ioctlsocket(socket, FIONBIO, &ul))
   {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("Set non-blocking server error3: %d", InetErrno);
+    g_eventLogger->error("Set non-blocking server error3: %d", InetErrno);
 #endif
   }//if
   return true;
@@ -239,13 +239,13 @@ TCP_Transporter::setSocketNonBlocking(ND
   flags = fcntl(socket, F_GETFL, 0);
   if (flags < 0) {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("Set non-blocking server error1: %s", strerror(InetErrno));
+    g_eventLogger->error("Set non-blocking server error1: %s", strerror(InetErrno));
 #endif
   }//if
   flags |= NDB_NONBLOCK;
   if (fcntl(socket, F_SETFL, flags) == -1) {
 #ifdef DEBUG_TRANSPORTER
-    g_eventLogger.error("Set non-blocking server error2: %s", strerror(InetErrno));
+    g_eventLogger->error("Set non-blocking server error2: %s", strerror(InetErrno));
 #endif
   }//if
   return true;
@@ -378,12 +378,13 @@ TCP_Transporter::doSend() {
 
       // Send failed
 #if defined DEBUG_TRANSPORTER
-      g_eventLogger.error("Send Failure(disconnect==%d) to node = %d nBytesSent = %d "
-	       "errno = %d strerror = %s",
-	       DISCONNECT_ERRNO(InetErrno, nBytesSent),
-	       remoteNodeId, nBytesSent, InetErrno, 
-	       (char*)ndbstrerror(InetErrno));
-#endif   
+      g_eventLogger->error("Send Failure(disconnect==%d) to node = %d "
+                           "nBytesSent = %d "
+                           "errno = %d strerror = %s",
+                           DISCONNECT_ERRNO(InetErrno, nBytesSent),
+                           remoteNodeId, nBytesSent, InetErrno,
+                           (char*)ndbstrerror(InetErrno));
+#endif
       if(DISCONNECT_ERRNO(InetErrno, nBytesSent)){
 	doDisconnect();
 	report_disconnect(InetErrno);
@@ -413,12 +414,12 @@ TCP_Transporter::doReceive() {
       
       if(receiveBuffer.sizeOfData > receiveBuffer.sizeOfBuffer){
 #ifdef DEBUG_TRANSPORTER
-	g_eventLogger.error("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)",
-		 receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer);
-	g_eventLogger.error("nBytesRead = %d", nBytesRead);
+        g_eventLogger->error("receiveBuffer.sizeOfData(%d) >
receiveBuffer.sizeOfBuffer(%d)",
+                             receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer);
+        g_eventLogger->error("nBytesRead = %d", nBytesRead);
 #endif
-	g_eventLogger.error("receiveBuffer.sizeOfData(%d) > receiveBuffer.sizeOfBuffer(%d)",
-		 receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer);
+        g_eventLogger->error("receiveBuffer.sizeOfData(%d) >
receiveBuffer.sizeOfBuffer(%d)",
+                             receiveBuffer.sizeOfData, receiveBuffer.sizeOfBuffer);
 	report_error(TE_INVALID_MESSAGE_LENGTH);
 	return 0;
       }
@@ -434,11 +435,11 @@ TCP_Transporter::doReceive() {
       return nBytesRead;
     } else {
 #if defined DEBUG_TRANSPORTER
-      g_eventLogger.error("Receive Failure(disconnect==%d) to node = %d nBytesSent = %d "
-	       "errno = %d strerror = %s",
-	       DISCONNECT_ERRNO(InetErrno, nBytesRead),
-	       remoteNodeId, nBytesRead, InetErrno, 
-	       (char*)ndbstrerror(InetErrno));
+      g_eventLogger->error("Receive Failure(disconnect==%d) to node = %d nBytesSent =
%d "
+                           "errno = %d strerror = %s",
+                           DISCONNECT_ERRNO(InetErrno, nBytesRead),
+                           remoteNodeId, nBytesRead, InetErrno,
+                           (char*)ndbstrerror(InetErrno));
 #endif   
       if(DISCONNECT_ERRNO(InetErrno, nBytesRead)){
 	// The remote node has closed down

=== modified file 'storage/ndb/src/common/transporter/Transporter.cpp'
--- a/storage/ndb/src/common/transporter/Transporter.cpp	2007-11-14 12:22:57 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.cpp	2008-04-22 19:36:05 +0000
@@ -24,7 +24,7 @@
 #include <OutputStream.hpp>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 Transporter::Transporter(TransporterRegistry &t_reg,
 			 TransporterType _type,
@@ -204,14 +204,14 @@ Transporter::connect_client(NDB_SOCKET_T
       DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d",
 			   m_type, remote_transporter_type));
       NDB_CLOSE_SOCKET(sockfd);
-      g_eventLogger.error("Incompatible configuration: transporter type "
-			  "mismatch with node %d", nodeId);
+      g_eventLogger->error("Incompatible configuration: transporter type "
+                           "mismatch with node %d", nodeId);
       DBUG_RETURN(false);
     }
   }
   else if (m_type == tt_SHM_TRANSPORTER)
   {
-    g_eventLogger.warning("Unable to verify transporter compatability with node %d",
nodeId);
+    g_eventLogger->warning("Unable to verify transporter compatability with node %d",
nodeId);
   }
 
   {

=== modified file 'storage/ndb/src/common/transporter/TransporterRegistry.cpp'
--- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2007-11-14 12:22:57 +0000
+++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp	2008-04-25 09:17:15 +0000
@@ -47,7 +47,7 @@ extern int g_ndb_shm_signum;
 #include <mgmapi/mgmapi_debug.h>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 struct in_addr
 TransporterRegistry::get_connect_address(NodeId node_id) const
@@ -241,8 +241,8 @@ TransporterRegistry::connect_server(NDB_
     {
       DBUG_PRINT("error", ("Transporter types mismatch this=%d remote=%d",
 			   t->m_type, remote_transporter_type));
-      g_eventLogger.error("Incompatible configuration: Transporter type "
-			  "mismatch with node %d", nodeId);
+      g_eventLogger->error("Incompatible configuration: Transporter type "
+                           "mismatch with node %d", nodeId);
 
       // wait for socket close for 1 second to let message arrive at client
       {
@@ -258,13 +258,18 @@ TransporterRegistry::connect_server(NDB_
   }
   else if (t->m_type == tt_SHM_TRANSPORTER)
   {
-    g_eventLogger.warning("Unable to verify transporter compatability with node %d",
nodeId);
+    g_eventLogger->warning("Unable to verify transporter compatability with node %d",
nodeId);
   }
 
   // setup transporter (transporter responsible for closing sockfd)
-  t->connect_server(sockfd);
+  bool res = t->connect_server(sockfd);
 
-  DBUG_RETURN(true);
+  if (res && performStates[nodeId] != TransporterRegistry::CONNECTING)
+  {
+    DBUG_RETURN(false);
+  }
+
+  DBUG_RETURN(res);
 }
 
 bool
@@ -787,7 +792,7 @@ TransporterRegistry::poll_TCP(Uint32 tim
   
   tcpReadSelectReply = select(maxSocketValue, &tcpReadset, 0, 0, &timeout);  
   if(false && tcpReadSelectReply == -1 && errno == EINTR)
-    g_eventLogger.info("woke-up by signal");
+    g_eventLogger->info("woke-up by signal");
 
 #ifdef NDB_WIN32
   if(tcpReadSelectReply == SOCKET_ERROR)
@@ -1129,19 +1134,20 @@ TransporterRegistry::start_clients_threa
 	      }
 	      else if(ndb_mgm_is_connected(m_mgm_handle))
 	      {
-		g_eventLogger.info("Failed to get dynamic port to connect to: %d", res);
+                g_eventLogger->info("Failed to get dynamic port to connect to: %d",
res);
 		ndb_mgm_disconnect(m_mgm_handle);
 	      }
 	      else
 	      {
-		g_eventLogger.info("Management server closed connection early. "
-			 "It is probably being shut down (or has problems). "
-			 "We will retry the connection. %d %s %s line: %d",
-                                   ndb_mgm_get_latest_error(m_mgm_handle),
-                                   ndb_mgm_get_latest_error_desc(m_mgm_handle),
-                                   ndb_mgm_get_latest_error_msg(m_mgm_handle),
-                                   ndb_mgm_get_latest_error_line(m_mgm_handle)
-                                   );
+                g_eventLogger->info
+                  ("Management server closed connection early. "
+                   "It is probably being shut down (or has problems). "
+                   "We will retry the connection. %d %s %s line: %d",
+                   ndb_mgm_get_latest_error(m_mgm_handle),
+                   ndb_mgm_get_latest_error_desc(m_mgm_handle),
+                   ndb_mgm_get_latest_error_msg(m_mgm_handle),
+                   ndb_mgm_get_latest_error_line(m_mgm_handle)
+                   );
 	      }
 	    }
 	    /** else
@@ -1235,7 +1241,7 @@ TransporterRegistry::start_service(Socke
   DBUG_ENTER("TransporterRegistry::start_service");
   if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
   {
-    g_eventLogger.error("TransporterRegistry::startReceiving: localNodeId not
specified");
+    g_eventLogger->error("TransporterRegistry::startReceiving: localNodeId not
specified");
     DBUG_RETURN(false);
   }
 
@@ -1261,10 +1267,10 @@ TransporterRegistry::start_service(Socke
 	 * If it wasn't a dynamically allocated port, or
 	 * our attempts at getting a new dynamic port failed
 	 */
-	g_eventLogger.error("Unable to setup transporter service port: %s:%d!\n"
-		 "Please check if the port is already used,\n"
-		 "(perhaps the node is already running)",
-		 t.m_interface ? t.m_interface : "*", t.m_s_service_port);
+        g_eventLogger->error("Unable to setup transporter service port: %s:%d!\n"
+                             "Please check if the port is already used,\n"
+                             "(perhaps the node is already running)",
+                             t.m_interface ? t.m_interface : "*", t.m_s_service_port);
 	delete transporter_service;
 	DBUG_RETURN(false);
       }
@@ -1306,9 +1312,9 @@ TransporterRegistry::startReceiving()
     if(ret != 0)
     {
       DBUG_PRINT("error",("Install failed"));
-      g_eventLogger.error("Failed to install signal handler for"
-			  " SHM transporter, signum %d, errno: %d (%s)",
-			  g_ndb_shm_signum, errno, strerror(errno));
+      g_eventLogger->error("Failed to install signal handler for"
+                           " SHM transporter, signum %d, errno: %d (%s)",
+                           g_ndb_shm_signum, errno, strerror(errno));
     }
   }
 #endif // NDB_SHM_TRANSPORTER
@@ -1358,13 +1364,13 @@ bool TransporterRegistry::connect_client
 
   if(!mgm_nodeid)
   {
-    g_eventLogger.error("%s: %d", __FILE__, __LINE__);
+    g_eventLogger->error("%s: %d", __FILE__, __LINE__);
     return false;
   }
   Transporter * t = theTransporters[mgm_nodeid];
   if (!t)
   {
-    g_eventLogger.error("%s: %d", __FILE__, __LINE__);
+    g_eventLogger->error("%s: %d", __FILE__, __LINE__);
     return false;
   }
   DBUG_RETURN(t->connect_client(connect_ndb_mgmd(h)));
@@ -1380,7 +1386,7 @@ NDB_SOCKET_TYPE TransporterRegistry::con
 
   if ( h==NULL || *h == NULL )
   {
-    g_eventLogger.error("%s: %d", __FILE__, __LINE__);
+    g_eventLogger->error("%s: %d", __FILE__, __LINE__);
     return NDB_INVALID_SOCKET;
   }
 
@@ -1393,10 +1399,10 @@ NDB_SOCKET_TYPE TransporterRegistry::con
 				   m_transporter_interface[i].m_s_service_port,
 				   &mgm_reply) < 0)
     {
-      g_eventLogger.error("Error: %s: %d",
-	       ndb_mgm_get_latest_error_desc(*h),
-	       ndb_mgm_get_latest_error(*h));
-      g_eventLogger.error("%s: %d", __FILE__, __LINE__);
+      g_eventLogger->error("Error: %s: %d",
+                           ndb_mgm_get_latest_error_desc(*h),
+                           ndb_mgm_get_latest_error(*h));
+      g_eventLogger->error("%s: %d", __FILE__, __LINE__);
       ndb_mgm_destroy_handle(h);
       return NDB_INVALID_SOCKET;
     }
@@ -1408,10 +1414,10 @@ NDB_SOCKET_TYPE TransporterRegistry::con
   NDB_SOCKET_TYPE sockfd= ndb_mgm_convert_to_transporter(h);
   if ( sockfd == NDB_INVALID_SOCKET)
   {
-    g_eventLogger.error("Error: %s: %d",
-	     ndb_mgm_get_latest_error_desc(*h),
-	     ndb_mgm_get_latest_error(*h));
-    g_eventLogger.error("%s: %d", __FILE__, __LINE__);
+    g_eventLogger->error("Error: %s: %d",
+                         ndb_mgm_get_latest_error_desc(*h),
+                         ndb_mgm_get_latest_error(*h));
+    g_eventLogger->error("%s: %d", __FILE__, __LINE__);
     ndb_mgm_destroy_handle(h);
   }
   return sockfd;

=== modified file 'storage/ndb/src/common/util/Makefile.am'
--- a/storage/ndb/src/common/util/Makefile.am	2007-09-25 10:05:32 +0000
+++ b/storage/ndb/src/common/util/Makefile.am	2008-05-09 17:53:25 +0000
@@ -23,7 +23,7 @@ libgeneral_la_SOURCES = \
 	    NdbSqlUtil.cpp new.cpp \
             uucode.c random.c version.c \
             strdup.c \
-            ConfigValues.cpp ndb_init.c basestring_vsnprintf.c \
+            ConfigValues.cpp ndb_init.cpp basestring_vsnprintf.c \
             Bitmask.cpp \
 	    ndb_rand.c
 
@@ -31,9 +31,18 @@ EXTRA_PROGRAMS = testBitmask
 testBitmask_SOURCES =  testBitmask.cpp
 testBitmask_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
+
+#noinst_PROGRAMS = ndb_show_compat
+ndb_show_compat_SOURCES = ndb_show_compat.cc
+ndb_show_compat_LDADD = \
+	$(builddir)libgeneral.la \
+	$(top_builddir)/storage/ndb/src/common/portlib/libportlib.la \
+	$(top_builddir)/dbug/libdbuglt.la \
+	$(top_builddir)/mysys/libmysyslt.la \
+	$(top_builddir)/strings/libmystringslt.la
 
 testBitmask.cpp : Bitmask.cpp
 	rm -f testBitmask.cpp

=== renamed file 'storage/ndb/src/common/util/ndb_init.c' =>
'storage/ndb/src/common/util/ndb_init.cpp'
--- a/storage/ndb/src/common/util/ndb_init.c	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/common/util/ndb_init.cpp	2008-04-22 19:36:05 +0000
@@ -17,37 +17,73 @@
 #include <my_sys.h>
 #include <NdbMutex.h>
 
+class EventLogger *g_eventLogger = NULL;
+
 NdbMutex *g_ndb_connection_mutex = NULL;
 
+extern class EventLogger * create_event_logger();
+extern void destroy_event_logger(class EventLogger ** g_eventLogger);
+
+static int ndb_init_called = 0;
+
+extern "C"
+{
+
 void
 ndb_init_internal()
 {
   if (!g_ndb_connection_mutex)
     g_ndb_connection_mutex = NdbMutex_Create();
+  if (!g_eventLogger)
+    g_eventLogger = create_event_logger();
+  if ((g_ndb_connection_mutex == NULL) || (g_eventLogger == NULL))
+  {
+    {
+      const char* err = "ndb_init() failed - exit\n";
+      write(2, err, strlen(err));
+      exit(1);
+    }
+  }
 }
 
 int
 ndb_init()
 {
-  if (my_init()) {
-    const char* err = "my_init() failed - exit\n";
-    write(2, err, strlen(err));
-    exit(1);
+  if (ndb_init_called == 0)
+  {
+    ndb_init_called = 1;
+    if (my_init())
+    {
+      const char* err = "my_init() failed - exit\n";
+      write(2, err, strlen(err));
+      exit(1);
+    }
+    ndb_init_internal();
   }
-  ndb_init_internal();
   return 0;
 }
 
 void
 ndb_end_internal()
 {
-  if (g_ndb_connection_mutex)
+  if (g_ndb_connection_mutex) 
+  {
     NdbMutex_Destroy(g_ndb_connection_mutex);
+    g_ndb_connection_mutex=NULL;
+  }
+  if (g_eventLogger)
+    destroy_event_logger(&g_eventLogger);
 }
 
 void
 ndb_end(int flags)
 {
-  my_end(flags);
-  ndb_end_internal();
+  if (ndb_init_called == 1)
+  {
+    my_end(flags);
+    ndb_end_internal();
+    ndb_init_called = 0;
+  }
 }
+
+} /* extern "C" */

=== added file 'storage/ndb/src/common/util/ndb_show_compat.cc'
--- a/storage/ndb/src/common/util/ndb_show_compat.cc	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/common/util/ndb_show_compat.cc	2008-05-09 07:37:37 +0000
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 MySQL AB
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+
+extern "C" {
+  void ndbPrintFullyCompatibleTable(void);
+  void ndbPrintUpgradeCompatibleTable(void);
+}
+
+int main(void){
+  ndbPrintFullyCompatibleTable();
+  ndbPrintUpgradeCompatibleTable();
+}
+
+

=== modified file 'storage/ndb/src/common/util/version.c'
--- a/storage/ndb/src/common/util/version.c	2007-10-30 16:58:36 +0000
+++ b/storage/ndb/src/common/util/version.c	2008-08-07 13:36:47 +0000
@@ -275,3 +275,48 @@ ndbCompatible_ndb_ndb(Uint32 ownVersion,
 {
   return ndbCompatible_upgrade(ownVersion, otherVersion);
 }
+
+
+void
+ndbPrintCompatibleTable(struct NdbUpGradeCompatible table[])
+{
+  int i;
+  printf("ownVersion, matchType, otherVersion\n");
+  for (i = 0; table[i].ownVersion != 0 && table[i].otherVersion != 0; i++) {
+
+    printf("%u.%u.%u, ",
+           getMajor(table[i].ownVersion),
+           getMinor(table[i].ownVersion),
+           getBuild(table[i].ownVersion));
+    switch (table[i].matchType) {
+    case UG_Range:
+      printf("Range");
+      break;
+    case UG_Exact:
+      printf("Exact");
+      break;
+    default:
+      break;
+    }
+    printf(", %u.%u.%u\n",
+           getMajor(table[i].otherVersion),
+           getMinor(table[i].otherVersion),
+           getBuild(table[i].otherVersion));
+
+  }
+  printf("\n");
+}
+
+
+void
+ndbPrintFullyCompatibleTable(void){
+  printf("ndbCompatibleTable_full\n");
+  ndbPrintCompatibleTable(ndbCompatibleTable_full);
+}
+
+
+void
+ndbPrintUpgradeCompatibleTable(void){
+  printf("ndbCompatibleTable_upgrade\n");
+  ndbPrintCompatibleTable(ndbCompatibleTable_upgrade);
+}

=== modified file 'storage/ndb/src/cw/cpcd/Makefile.am'
--- a/storage/ndb/src/cw/cpcd/Makefile.am	2007-02-13 01:38:54 +0000
+++ b/storage/ndb/src/cw/cpcd/Makefile.am	2008-04-25 06:32:23 +0000
@@ -19,9 +19,9 @@ ndb_cpcd_SOURCES = main.cpp CPCD.cpp Pro
 
 LDADD_LOC = \
             $(top_builddir)/storage/ndb/src/libndbclient.la      \
-            $(top_builddir)/dbug/libdbug.a \
-            $(top_builddir)/mysys/libmysys.a \
-            $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+            $(top_builddir)/dbug/libdbuglt.la \
+            $(top_builddir)/mysys/libmysyslt.la \
+            $(top_builddir)/strings/libmystringslt.la @NDB_SCI_LIBS@
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_util.mk.am

=== modified file 'storage/ndb/src/kernel/Makefile.am'
--- a/storage/ndb/src/kernel/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/Makefile.am	2008-04-25 23:09:48 +0000
@@ -53,9 +53,10 @@ LDADD +=  \
               $(top_builddir)/storage/ndb/src/mgmapi/libmgmapi.la \
               $(top_builddir)/storage/ndb/src/common/portlib/libportlib.la      \
               $(top_builddir)/storage/ndb/src/common/util/libgeneral.la  \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+              $(top_builddir)/dbug/libdbuglt.la \
+              $(top_builddir)/mysys/libmysyslt.la \
+              $(top_builddir)/strings/libmystringslt.la \
+              $(top_builddir)/zlib/libzlt.la @NDB_SCI_LIBS@ 
 
 windoze-dsp: ndbd.dsp
 

=== modified file 'storage/ndb/src/kernel/blocks/ERROR_codes.txt'
--- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt	2008-03-25 15:46:12 +0000
+++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt	2008-05-30 08:03:55 +0000
@@ -1,12 +1,12 @@
-Next QMGR 1
+Next QMGR 937
 Next NDBCNTR 1002
 Next NDBFS 2000
 Next DBACC 3002
 Next DBTUP 4029
-Next DBLQH 5050
+Next DBLQH 5051
 Next DBDICT 6008
-Next DBDIH 7202
-Next DBTC 8058
+Next DBDIH 7211
+Next DBTC 8064
 Next CMVMI 9000
 Next BACKUP 10041
 Next DBUTIL 11002
@@ -551,6 +551,11 @@ Dbdict:
 6005 Crash in participant @ CreateTabReq::CreateDrop
 6007 Fail on readTableFile for READ_TAB_FILE1 (28770)
 
+6200 Set error code after handleTabInfoInit in master
+6201 Set error code after handleTabInfoInit in master (index)
+6202 Set error code before CREATE_FRAGMENTATION in master
+6203 Set error code before CREATE_FRAGMENTATION in master (index)
+
 Dbtup:
 4014 - handleInsert - Out of undo buffer
 4015 - handleInsert - Out of log space

=== modified file 'storage/ndb/src/kernel/blocks/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/Makefile.am	2008-04-25 06:32:23 +0000
@@ -57,9 +57,9 @@ EXTRA_PROGRAMS = ndb_print_file
 ndb_print_file_SOURCES = print_file.cpp diskpage.cpp dbtup/tuppage.cpp
 ndb_print_file_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am

=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2008-03-25 15:46:12 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2008-05-16 13:08:36 +0000
@@ -2813,6 +2813,8 @@ Backup::backupAllData(Signal* signal, Ba
   req->senderRef = reference();
   req->senderData = ptr.i;
   req->requestData = 0;
+  req->tableId = 0;
+  req->tableType = 0;
   sendSignal(DBDICT_REF, GSN_LIST_TABLES_REQ, signal, 
 	     ListTablesReq::SignalLength, JBB);
 }
@@ -2821,56 +2823,68 @@ void
 Backup::execLIST_TABLES_CONF(Signal* signal)
 {
   jamEntry();
-  
+  Uint32 fragInfo = signal->header.m_fragmentInfo;
   ListTablesConf* conf = (ListTablesConf*)signal->getDataPtr();
+  Uint32 noOfTables = conf->noOfTables;
 
   BackupRecordPtr ptr LINT_SET_PTR;
   c_backupPool.getPtr(ptr, conf->senderData);
-  
-  const Uint32 len = signal->length() - ListTablesConf::HeaderLength;
-  for(unsigned int i = 0; i<len; i++) {
-    jam();
-    Uint32 tableId = ListTablesConf::getTableId(conf->tableData[i]);
-    Uint32 tableType = ListTablesConf::getTableType(conf->tableData[i]);
-    Uint32 state= ListTablesConf::getTableState(conf->tableData[i]);
-
-    if (! (DictTabInfo::isTable(tableType) ||
-	   DictTabInfo::isIndex(tableType) ||
-	   DictTabInfo::isFilegroup(tableType) ||
-	   DictTabInfo::isFile(tableType)))
-    {
-      jam();
-      continue;
-    }
-    
-    if (state != DictTabInfo::StateOnline)
-    {
-      jam();
-      continue;
-    }
-    
-    TablePtr tabPtr;
-    ptr.p->tables.seize(tabPtr);
-    if(tabPtr.i == RNIL) {
-      jam();
-      defineBackupRef(signal, ptr, DefineBackupRef::FailedToAllocateTables);
-      return;
-    }//if
-    tabPtr.p->tableId = tableId;
-    tabPtr.p->tableType = tableType;
-  }//for
-  
-  if(len == ListTablesConf::DataLength) {
-    jam();
-    /**
-     * Not finished...
-     */
-    return;
-  }//if
 
-  /**
-   * All tables fetched
+  if (noOfTables > 0)
+  {
+    ndbassert(signal->getNoOfSections() > 0);
+    ListTablesData ltd;
+    const Uint32 listTablesDataSizeInWords = (sizeof(ListTablesData) + 3) / 4;
+    SegmentedSectionPtr tableDataPtr;
+    signal->getSection(tableDataPtr, ListTablesConf::TABLE_DATA);
+    SimplePropertiesSectionReader
+      tableDataReader(tableDataPtr, getSectionSegmentPool());
+
+    tableDataReader.reset();
+    for(unsigned int i = 0; i<noOfTables; i++) {
+      jam();
+      tableDataReader.getWords((Uint32 *)&ltd, listTablesDataSizeInWords);
+      Uint32 tableId = ltd.getTableId();
+      Uint32 tableType = ltd.getTableType();
+      Uint32 state= ltd.getTableState();
+
+      if (! (DictTabInfo::isTable(tableType) ||
+             DictTabInfo::isIndex(tableType) ||
+             DictTabInfo::isFilegroup(tableType) ||
+             DictTabInfo::isFile(tableType)))
+      {
+        jam();
+        continue;
+      }
+
+      if (state != DictTabInfo::StateOnline)
+      {
+        jam();
+        continue;
+      }
+
+      TablePtr tabPtr;
+      ptr.p->tables.seize(tabPtr);
+      if(tabPtr.i == RNIL) {
+        jam();
+        defineBackupRef(signal, ptr, DefineBackupRef::FailedToAllocateTables);
+        releaseSections(signal);
+        return;
+      }//if
+      tabPtr.p->tableId = tableId;
+      tabPtr.p->tableType = tableType;
+    }//for
+    releaseSections(signal);
+  }
+
+  /*
+    If first or not last signal
+    then keep accumulating table data
    */
+  if ((fragInfo == 1) || (fragInfo == 2))
+  {
+    return;
+  }
   openFiles(signal, ptr);
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/backup/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/backup/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Makefile.am	2008-04-25 06:32:23 +0000
@@ -17,9 +17,9 @@ ndbtools_PROGRAMS = ndb_print_backup_fil
 ndb_print_backup_file_SOURCES = read.cpp
 ndb_print_backup_file_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2007-11-23 10:09:30 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2008-04-25 10:56:03 +0000
@@ -43,7 +43,7 @@
 #include <SafeCounter.hpp>
 
 // Used here only to print event reports on stdout/console.
-EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 extern int simulate_error_during_shutdown;
 
 Cmvmi::Cmvmi(Block_context& ctx) :
@@ -241,8 +241,8 @@ void Cmvmi::execEVENT_REP(Signal* signal
   }
 
   // Print the event info
-  g_eventLogger.log(eventReport->getEventType(), 
-		    signal->theData, signal->getLength(), 0, 0);
+  g_eventLogger->log(eventReport->getEventType(), 
+                     signal->theData, signal->getLength(), 0, 0);
   
   return;
 }//execEVENT_REP()
@@ -421,7 +421,7 @@ void Cmvmi::execSTTOR(Signal* signal)
     {
       int res = NdbMem_MemLockAll(0);
       if(res != 0){
-	g_eventLogger.warning("Failed to memlock pages");
+        g_eventLogger->warning("Failed to memlock pages");
 	warningEvent("Failed to memlock pages");
       }
     }
@@ -433,13 +433,26 @@ void Cmvmi::execSTTOR(Signal* signal)
     globalData.activateSendPacked = 1;
     sendSTTORRY(signal);
   } else if (theStartPhase == 8){
-    /*---------------------------------------------------*/
-    /* Open com to API + REP nodes                       */
-    /*---------------------------------------------------*/
-    signal->theData[0] = 0; // no answer
-    signal->theData[1] = 0; // no id
-    signal->theData[2] = NodeInfo::API;
-    execOPEN_COMREQ(signal);
+#ifdef ERROR_INSERT
+    if (ERROR_INSERTED(9004))
+    {
+      Uint32 len = signal->getLength();
+      Uint32 db = c_dbNodes.find(0);
+      if (db == getOwnNodeId())
+        db = c_dbNodes.find(db);
+      Uint32 i = c_error_9000_nodes_mask.find(0);
+      Uint32 tmp[25];
+      memcpy(tmp, signal->theData, sizeof(tmp));
+      signal->theData[0] = i;
+      sendSignal(calcQmgrBlockRef(db),GSN_API_FAILREQ, signal, 1, JBA);
+      ndbout_c("stopping %u using %u", i, db);
+      CLEAR_ERROR_INSERT_VALUE;
+      memcpy(signal->theData, tmp, sizeof(tmp));
+      sendSignalWithDelay(reference(), GSN_STTOR,
+                          signal, 100, len);
+      return;
+    }
+#endif
     globalData.theStartLevel = NodeState::SL_STARTED;
     sendSTTORRY(signal);
   }
@@ -502,14 +515,6 @@ void Cmvmi::execOPEN_COMREQ(Signal* sign
 	   && c_error_9000_nodes_mask.get(tStartingNode)))
 #endif
     {
-      if (globalData.theStartLevel != NodeState::SL_STARTED &&
-          (getNodeInfo(tStartingNode).m_type != NodeInfo::DB &&
-           getNodeInfo(tStartingNode).m_type != NodeInfo::MGM))
-      {
-        jam();
-        goto done;
-      }
-
       globalTransporterRegistry.do_connect(tStartingNode);
       globalTransporterRegistry.setIOState(tStartingNode, HaltIO);
       
@@ -534,7 +539,6 @@ void Cmvmi::execOPEN_COMREQ(Signal* sign
 	    && c_error_9000_nodes_mask.get(i))
 	  continue;
 #endif
-	
 	globalTransporterRegistry.do_connect(i);
 	globalTransporterRegistry.setIOState(i, HaltIO);
 	
@@ -607,38 +611,17 @@ void Cmvmi::execCONNECT_REP(Signal *sign
   globalData.m_nodeInfo[hostId].m_version = 0;
   globalData.m_nodeInfo[hostId].m_mysql_version = 0;
   
-  if(type == NodeInfo::DB || globalData.theStartLevel >= NodeState::SL_STARTED){
-    jam();
-    
-    /**
-     * Inform QMGR that client has connected
-     */
-
-    signal->theData[0] = hostId;
-    sendSignal(QMGR_REF, GSN_CONNECT_REP, signal, 1, JBA);
-  } else if(globalData.theStartLevel == NodeState::SL_CMVMI ||
-            globalData.theStartLevel == NodeState::SL_STARTING) {
-    jam();
-    /**
-     * Someone connected before start was finished
-     */
-    if(type == NodeInfo::MGM){
-      jam();
-      signal->theData[0] = hostId;
-      sendSignal(QMGR_REF, GSN_CONNECT_REP, signal, 1, JBA);
-    } else {
-      /**
-       * Dont allow api nodes to connect
-       */
-      ndbout_c("%d %d %d", hostId, type, globalData.theStartLevel);
-      abort();
-      globalTransporterRegistry.do_disconnect(hostId);
-    }
-  }
+  /**
+   * Inform QMGR that client has connected
+   */
   
+  signal->theData[0] = hostId;
+  sendSignal(QMGR_REF, GSN_CONNECT_REP, signal, 1, JBA);
+
   /* Automatically subscribe events for MGM nodes.
    */
-  if(type == NodeInfo::MGM){
+  if(type == NodeInfo::MGM)
+  {
     jam();
     globalTransporterRegistry.setIOState(hostId, NoHalt);
   }
@@ -827,26 +810,16 @@ Cmvmi::execSTART_ORD(Signal* signal) {
     return;
   }
   
-  if(globalData.theStartLevel == NodeState::SL_NOTHING){
+  if(globalData.theStartLevel == NodeState::SL_NOTHING)
+  {
     jam();
     globalData.theStartLevel = NodeState::SL_CMVMI;
-    /**
-     * Open connections to management servers
-     */
-    for(unsigned int i = 1; i < MAX_NODES; i++ ){
-      if (getNodeInfo(i).m_type == NodeInfo::MGM){ 
-        if(!globalTransporterRegistry.is_connected(i)){
-          globalTransporterRegistry.do_connect(i);
-          globalTransporterRegistry.setIOState(i, NoHalt);
-        }
-      }
-    }
-
     EXECUTE_DIRECT(QMGR, GSN_START_ORD, signal, 1);
     return ;
   }
   
-  if(globalData.theStartLevel == NodeState::SL_CMVMI){
+  if(globalData.theStartLevel == NodeState::SL_CMVMI)
+  {
     jam();
 
     if(m_ctx.m_config.lockPagesInMainMemory() == 2)
@@ -854,12 +827,12 @@ Cmvmi::execSTART_ORD(Signal* signal) {
       int res = NdbMem_MemLockAll(1);
       if(res != 0)
       {
-	g_eventLogger.warning("Failed to memlock pages");
+        g_eventLogger->warning("Failed to memlock pages");
 	warningEvent("Failed to memlock pages");
       }
       else
       {
-	g_eventLogger.info("Locked future allocations");
+        g_eventLogger->info("Locked future allocations");
       }
     }
     
@@ -874,8 +847,10 @@ Cmvmi::execSTART_ORD(Signal* signal) {
     // Disconnect all nodes as part of the system restart. 
     // We need to ensure that we are starting up
     // without any connected nodes.   
-    for(unsigned int i = 1; i < MAX_NODES; i++ ){
-      if (i != getOwnNodeId() && getNodeInfo(i).m_type != NodeInfo::MGM){
+    for(unsigned int i = 1; i < MAX_NODES; i++ )
+    {
+      if (i != getOwnNodeId() && getNodeInfo(i).m_type != NodeInfo::MGM)
+      {
         globalTransporterRegistry.do_disconnect(i);
         globalTransporterRegistry.setIOState(i, HaltIO);
       }
@@ -1027,15 +1002,15 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal
   {
     SubscriberPtr ptr;
     subscribers.first(ptr);  
-    g_eventLogger.info("List subscriptions:");
+    g_eventLogger->info("List subscriptions:");
     while(ptr.i != RNIL)
     {
-      g_eventLogger.info("Subscription: %u, nodeId: %u, ref: 0x%x",
-                         ptr.i,  refToNode(ptr.p->blockRef), ptr.p->blockRef);
+      g_eventLogger->info("Subscription: %u, nodeId: %u, ref: 0x%x",
+                          ptr.i,  refToNode(ptr.p->blockRef), ptr.p->blockRef);
       for(Uint32 i = 0; i < LogLevel::LOGLEVEL_CATEGORIES; i++)
       {
         Uint32 level = ptr.p->logLevel.getLogLevel((LogLevel::EventCategory)i);
-        g_eventLogger.info("Category %u Level %u", i, level);
+        g_eventLogger->info("Category %u Level %u", i, level);
       }
       subscribers.next(ptr);
     }
@@ -1151,6 +1126,20 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal
     }
     c_error_9000_nodes_mask.clear();
   }
+
+  if (arg == 9004 && signal->getLength() == 2)
+  {
+    SET_ERROR_INSERT_VALUE(9004);
+    c_error_9000_nodes_mask.clear();
+    c_error_9000_nodes_mask.set(signal->theData[1]);
+  }
+
+  if (arg == 9004 && signal->getLength() == 2)
+  {
+    SET_ERROR_INSERT_VALUE(9004);
+    c_error_9000_nodes_mask.clear();
+    c_error_9000_nodes_mask.set(signal->theData[1]);
+  }
 #endif
 
 #ifdef VM_TRACE

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2007-03-16 10:16:48 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp	2008-05-29 15:58:58 +0000
@@ -881,6 +881,10 @@ private:
   FragmentrecPtr fragrecptr;
   Uint32 cfirstfreefrag;
   Uint32 cfragmentsize;
+  RSS_OP_COUNTER(cnoOfFreeFragrec);
+  RSS_OP_SNAPSHOT(cnoOfFreeFragrec);
+
+
 /* --------------------------------------------------------------------------------- */
 /* FS_CONNECTREC                                                                     */
 /* --------------------------------------------------------------------------------- */

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp	2007-02-14 05:37:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp	2008-05-29 15:58:58 +0000
@@ -43,6 +43,9 @@ void Dbacc::initData() 
 
   cnoOfAllocatedPages = cpagesize = 0;
   // Records with constant sizes
+
+  RSS_OP_COUNTER_INIT(cnoOfFreeFragrec);
+
 }//Dbacc::initData()
 
 void Dbacc::initRecords() 

=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2008-02-03 13:16:36 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp	2008-05-29 15:58:58 +0000
@@ -858,6 +858,7 @@ void Dbacc::releaseFragRecord(Signal* si
   regFragPtr.p->nextfreefrag = cfirstfreefrag;
   cfirstfreefrag = regFragPtr.i;
   initFragGeneral(regFragPtr);
+  RSS_OP_FREE(cnoOfFreeFragrec);
 }//Dbacc::releaseFragRecord()
 
 /* -------------------------------------------------------------------------- */
@@ -6175,6 +6176,7 @@ void Dbacc::initFragAdd(Signal* signal,
   regFragPtr.p->mytabptr = req->tableId;
   regFragPtr.p->roothashcheck = req->kValue + req->lhFragBits;
   regFragPtr.p->noOfElements = 0;
+  regFragPtr.p->m_commit_count = 0; // stable results
   for (Uint32 i = 0; i < MAX_PARALLEL_SCANS_PER_FRAG; i++) {
     regFragPtr.p->scan[i] = RNIL;
   }//for
@@ -8073,6 +8075,7 @@ void Dbacc::seizeDirrange(Signal* signal
 /* --------------------------------------------------------------------------------- */
 void Dbacc::seizeFragrec(Signal* signal) 
 {
+  RSS_OP_ALLOC(cnoOfFreeFragrec);
   fragrecptr.i = cfirstfreefrag;
   ptrCheckGuard(fragrecptr, cfragmentsize, fragmentrec);
   cfirstfreefrag = fragrecptr.p->nextfreefrag;
@@ -8519,6 +8522,18 @@ Dbacc::execDUMP_STATE_ORD(Signal* signal
     return;
   }//if
 #endif
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceSnapshot)
+  {
+    RSS_OP_SNAPSHOT_SAVE(cnoOfFreeFragrec);
+    return;
+  }
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceCheckLeak)
+  {
+    RSS_OP_SNAPSHOT_CHECK(cnoOfFreeFragrec);
+    return;
+  }
 }//Dbacc::execDUMP_STATE_ORD()
 
 void

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-04-03 12:46:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-05-30 08:03:55 +0000
@@ -83,15 +83,14 @@
 #include <signaldata/ApiBroadcast.hpp>
 #include <signaldata/DictLock.hpp>
 
-#include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
-
 #include <signaldata/DropObj.hpp>
 #include <signaldata/CreateObj.hpp>
 #include <SLList.hpp>
 
+#include <signaldata/DumpStateOrd.hpp>
+
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 #define ZNOT_FOUND 626
 #define ZALREADYEXIST 630
@@ -312,8 +311,28 @@ Dbdict::execDUMP_STATE_ORD(Signal* signa
               c_counterMgr.getNoOfFree());
     c_counterMgr.printNODE_FAILREP();
   }
-    
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceSnapshot)
+  {
+    RSS_AP_SNAPSHOT_SAVE(c_rope_pool);
+    RSS_AP_SNAPSHOT_SAVE(c_attributeRecordPool);
+    RSS_AP_SNAPSHOT_SAVE(c_tableRecordPool);
+    RSS_AP_SNAPSHOT_SAVE(c_triggerRecordPool);
+    RSS_AP_SNAPSHOT_SAVE(c_obj_pool);
+  }
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceCheckLeak)
+  {
+    RSS_AP_SNAPSHOT_CHECK(c_rope_pool);
+    RSS_AP_SNAPSHOT_CHECK(c_attributeRecordPool);
+    RSS_AP_SNAPSHOT_CHECK(c_tableRecordPool);
+    RSS_AP_SNAPSHOT_CHECK(c_triggerRecordPool);
+    RSS_AP_SNAPSHOT_CHECK(c_obj_pool);
+  }
+
   return;
+
+
 }//Dbdict::execDUMP_STATE_ORD()
 
 /* ---------------------------------------------------------------- */
@@ -2025,6 +2044,10 @@ Uint32 Dbdict::getFreeObjId(Uint32 minId
 Uint32 Dbdict::getFreeTableRecord(Uint32 primaryTableId) 
 {
   Uint32 minId = (primaryTableId == RNIL ? 0 : primaryTableId + 1);
+  if (ERROR_INSERTED(6012) && minId < 4096){
+    minId = 4096;
+    CLEAR_ERROR_INSERT_VALUE;
+  }
   Uint32 i = getFreeObjId(minId);
   if (i == RNIL) {
     jam();
@@ -2038,7 +2061,6 @@ Uint32 Dbdict::getFreeTableRecord(Uint32
   c_tableRecordPool.getPtr(tablePtr, i);
   ndbrequire(tablePtr.p->tabState == TableRecord::NOT_DEFINED);
   initialiseTableRecord(tablePtr);
-  tablePtr.p->tabState = TableRecord::DEFINING;
   return i;
 }
 
@@ -3936,10 +3958,26 @@ Dbdict::execCREATE_TABLE_REQ(Signal* sig
     
     handleTabInfoInit(r, &parseRecord);
     releaseSections(signal);
+
+    if (parseRecord.errorCode == 0)
+    {
+      if (ERROR_INSERTED(6200) ||
+          (ERROR_INSERTED(6201) && 
+           DictTabInfo::isIndex(parseRecord.tablePtr.p->tableType)))
+      {
+        CLEAR_ERROR_INSERT_VALUE;
+        parseRecord.errorCode = 1;
+      }
+    }
     
     if(parseRecord.errorCode != 0){
       jam();
       c_opCreateTable.release(createTabPtr);
+      if (!parseRecord.tablePtr.isNull())
+      {
+        jam();
+        releaseTableObject(parseRecord.tablePtr.i, true);
+      }
       break;
     }
     
@@ -3989,9 +4027,20 @@ Dbdict::execCREATE_TABLE_REQ(Signal* sig
       */
       parseRecord.tablePtr.p->primaryTableId = RNIL;
     }
-    EXECUTE_DIRECT(DBDIH, GSN_CREATE_FRAGMENTATION_REQ, signal,
-		   CreateFragmentationReq::SignalLength);
-    jamEntry();
+    if (ERROR_INSERTED(6202) || 
+        (ERROR_INSERTED(6203) && 
+         DictTabInfo::isIndex(parseRecord.tablePtr.p->tableType)))
+    {
+      CLEAR_ERROR_INSERT_VALUE;
+      signal->theData[0] = 1;
+    }
+    else
+    {
+      EXECUTE_DIRECT(DBDIH, GSN_CREATE_FRAGMENTATION_REQ, signal,
+                     CreateFragmentationReq::SignalLength);
+      jamEntry();
+    }
+    
     if (signal->theData[0] != 0)
     {
       jam();
@@ -6262,7 +6311,7 @@ Dbdict::execTC_SCHVERCONF(Signal* signal
     jam();    \
     parseP->errorCode = error; parseP->errorLine = __LINE__; \
     parseP->errorKey = it.getKey(); \
-    return;   \
+    return;                         \
   }//if
 
 // handleAddTableFailure(signal, __LINE__, allocatedTable);
@@ -6348,10 +6397,11 @@ void Dbdict::handleTabInfoInit(SimplePro
 
   if(checkExist){
     jam();
-    tabRequire(get_object(c_tableDesc.TableName, tableNameLength) == 0, 
-	       CreateTableRef::TableAlreadyExist);
+    
+    tabRequire(get_object(c_tableDesc.TableName, tableNameLength) == 0,
+               CreateTableRef::TableAlreadyExist;);
   }
-  
+
   TableRecordPtr tablePtr;
   switch (parseP->requestType) {
   case DictTabInfo::CreateTableFromAPI: {
@@ -6364,7 +6414,6 @@ void Dbdict::handleTabInfoInit(SimplePro
     // Check if no free tables existed.
     /* ---------------------------------------------------------------- */
     tabRequire(tablePtr.i != RNIL, CreateTableRef::NoMoreTableRecords);
-    
     c_tableRecordPool.getPtr(tablePtr);
     break;
   }
@@ -6399,21 +6448,20 @@ void Dbdict::handleTabInfoInit(SimplePro
 /* ---------------------------------------------------------------- */
     Uint32 tableVersion = c_tableDesc.TableVersion;
     tablePtr.p->tableVersion = tableVersion;
-    
+ 
     break;
   }
   default:
     ndbrequire(false);
     break;
   }//switch
-  parseP->tablePtr = tablePtr;
   
   { 
     Rope name(c_rope_pool, tablePtr.p->tableName);
     tabRequire(name.assign(c_tableDesc.TableName, tableNameLength, name_hash),
-	       CreateTableRef::OutOfStringBuffer);
+               CreateTableRef::OutOfStringBuffer);
   }
-
+  
   Ptr<DictObject> obj_ptr;
   if (parseP->requestType != DictTabInfo::AlterTableFromAPI) {
     jam();
@@ -6430,7 +6478,9 @@ void Dbdict::handleTabInfoInit(SimplePro
 	     c_tableDesc.TableName, tablePtr.i, tablePtr.p->m_obj_ptr_i);
 #endif
   }
-  
+  parseP->tablePtr = tablePtr;
+  tablePtr.p->tabState = TableRecord::DEFINING;
+
   // Disallow logging of a temporary table.
   tabRequire(!(c_tableDesc.TableTemporaryFlag && c_tableDesc.TableLoggedFlag),
              CreateTableRef::NoLoggingTemporaryTable);
@@ -6510,6 +6560,7 @@ void Dbdict::handleTabInfoInit(SimplePro
      * Release table
      */
     releaseTableObject(tablePtr.i, checkExist);
+    parseP->tablePtr.setNull();
     return;
   }
 
@@ -7897,15 +7948,28 @@ Dbdict::execLIST_TABLES_REQ(Signal* sign
 {
   jamEntry();
   ListTablesReq * req = (ListTablesReq*)signal->getDataPtr();
+
+  Uint32 senderRef  = req->senderRef;
+  Uint32 receiverVersion = getNodeInfo(refToNode(senderRef)).m_version;
+
+  if (ndbd_LIST_TABLES_CONF_long_signal(receiverVersion))
+    sendLIST_TABLES_CONF(signal, req);
+  else
+    sendOLD_LIST_TABLES_CONF(signal, req);
+}
+
+void Dbdict::sendOLD_LIST_TABLES_CONF(Signal* signal, ListTablesReq* req)
+{
   Uint32 senderRef  = req->senderRef;
   Uint32 senderData = req->senderData;
   // save req flags
-  const Uint32 reqTableId = req->getTableId();
-  const Uint32 reqTableType = req->getTableType();
+  const Uint32 reqTableId = req->oldGetTableId();
+  const Uint32 reqTableType = req->oldGetTableType();
   const bool reqListNames = req->getListNames();
   const bool reqListIndexes = req->getListIndexes();
+
   // init the confs
-  ListTablesConf * conf = (ListTablesConf *)signal->getDataPtrSend();
+  OldListTablesConf * conf = (OldListTablesConf *)signal->getDataPtrSend();
   conf->senderData = senderData;
   conf->counter = 0;
   Uint32 pos = 0;
@@ -8023,9 +8087,9 @@ Dbdict::execLIST_TABLES_REQ(Signal* sign
       pos++;
     }
     
-    if (pos >= ListTablesConf::DataLength) {
+    if (pos >= OldListTablesConf::DataLength) {
       sendSignal(senderRef, GSN_LIST_TABLES_CONF, signal,
-		 ListTablesConf::SignalLength, JBB);
+		 OldListTablesConf::SignalLength, JBB);
       conf->counter++;
       pos = 0;
     }
@@ -8037,9 +8101,9 @@ Dbdict::execLIST_TABLES_REQ(Signal* sign
     const Uint32 size = name.size();
     conf->tableData[pos] = size;
     pos++;
-    if (pos >= ListTablesConf::DataLength) {
+    if (pos >= OldListTablesConf::DataLength) {
       sendSignal(senderRef, GSN_LIST_TABLES_CONF, signal,
-		 ListTablesConf::SignalLength, JBB);
+		 OldListTablesConf::SignalLength, JBB);
       conf->counter++;
       pos = 0;
     }
@@ -8055,9 +8119,9 @@ Dbdict::execLIST_TABLES_REQ(Signal* sign
 	  *p++ = 0;
       }
       pos++;
-      if (pos >= ListTablesConf::DataLength) {
+      if (pos >= OldListTablesConf::DataLength) {
 	sendSignal(senderRef, GSN_LIST_TABLES_CONF, signal,
-		   ListTablesConf::SignalLength, JBB);
+		   OldListTablesConf::SignalLength, JBB);
 	conf->counter++;
 	pos = 0;
       }
@@ -8065,7 +8129,292 @@ Dbdict::execLIST_TABLES_REQ(Signal* sign
   }
   // last signal must have less than max length
   sendSignal(senderRef, GSN_LIST_TABLES_CONF, signal,
-	     ListTablesConf::HeaderLength + pos, JBB);
+	     OldListTablesConf::HeaderLength + pos, JBB);
+}
+
+void Dbdict::sendLIST_TABLES_CONF(Signal* signal, ListTablesReq* req)
+{
+  Uint32 senderRef  = req->senderRef;
+  Uint32 senderData = req->senderData;
+  // save req flags
+  const Uint32 reqTableId = req->getTableId();
+  const Uint32 reqTableType = req->getTableType();
+  const bool reqListNames = req->getListNames();
+  const bool reqListIndexes = req->getListIndexes();
+
+  NodeReceiverGroup rg(senderRef);
+
+  DLHashTable<DictObject>::Iterator iter;
+  bool done = !c_obj_hash.first(iter);
+
+  if (done)
+  {
+    /*
+     * Empty hashtable, send empty signal
+     */
+    jam();
+    ListTablesConf * const conf = (ListTablesConf*)signal->getDataPtrSend();
+    conf->senderData = senderData;
+    conf->noOfTables = 0;
+    sendSignal(rg, GSN_LIST_TABLES_CONF, signal,
+               ListTablesConf::SignalLength, JBB);
+    return;
+  }
+
+  /*
+    Pack table data and table names (if requested) in
+    two signal segments and send it in one long fragmented
+    signal
+   */
+  ListTablesData ltd;
+  const Uint32 listTablesDataSizeInWords = (sizeof(ListTablesData) + 3) / 4;
+  char tname[MAX_TAB_NAME_SIZE];
+  SimplePropertiesSectionWriter tableDataWriter(getSectionSegmentPool());
+  SimplePropertiesSectionWriter tableNamesWriter(getSectionSegmentPool());
+
+  Uint32 count = 0;
+  Uint32 fragId = rand();
+  Uint32 fragInfo = 0;
+  const Uint32 fragSize = 240;
+
+  tableDataWriter.first();
+  tableNamesWriter.first();
+  while(true)
+  {
+    Uint32 type = iter.curr.p->m_type;
+
+    if ((reqTableType != (Uint32)0) && (reqTableType != type))
+      goto flush;
+
+    if (reqListIndexes && !DictTabInfo::isIndex(type))
+      goto flush;
+
+    TableRecordPtr tablePtr;
+    if (DictTabInfo::isTable(type) || DictTabInfo::isIndex(type)){
+      c_tableRecordPool.getPtr(tablePtr, iter.curr.p->m_id);
+
+      if(reqListIndexes && (reqTableId != tablePtr.p->primaryTableId))
+	goto flush;
+
+      ltd.requestData = 0; // clear
+      ltd.setTableId(tablePtr.i); // id
+      ltd.setTableType(type); // type
+      // state
+
+      if(DictTabInfo::isTable(type)){
+	switch (tablePtr.p->tabState) {
+	case TableRecord::DEFINING:
+	  ltd.setTableState(DictTabInfo::StateBuilding);
+	  break;
+	case TableRecord::PREPARE_DROPPING:
+	case TableRecord::DROPPING:
+	  ltd.setTableState(DictTabInfo::StateDropping);
+	  break;
+	case TableRecord::DEFINED:
+	  ltd.setTableState(DictTabInfo::StateOnline);
+	  break;
+	case TableRecord::BACKUP_ONGOING:
+	  ltd.setTableState(DictTabInfo::StateBackup);
+	  break;
+	default:
+	  ltd.setTableState(DictTabInfo::StateBroken);
+	  break;
+	}
+      }
+      if (tablePtr.p->isIndex()) {
+	switch (tablePtr.p->indexState) {
+	case TableRecord::IS_OFFLINE:
+	  ltd.setTableState(DictTabInfo::StateOffline);
+	  break;
+	case TableRecord::IS_BUILDING:
+	  ltd.setTableState(DictTabInfo::StateBuilding);
+	  break;
+	case TableRecord::IS_DROPPING:
+	  ltd.setTableState(DictTabInfo::StateDropping);
+	  break;
+	case TableRecord::IS_ONLINE:
+	  ltd.setTableState(DictTabInfo::StateOnline);
+	  break;
+	default:
+	  ltd.setTableState(DictTabInfo::StateBroken);
+	  break;
+	}
+      }
+      // Logging status
+      if (! (tablePtr.p->m_bits & TableRecord::TR_Logged)) {
+	ltd.setTableStore(DictTabInfo::StoreNotLogged);
+      } else {
+	ltd.setTableStore(DictTabInfo::StorePermanent);
+      }
+      // Temporary status
+      if (tablePtr.p->m_bits & TableRecord::TR_Temporary) {
+	ltd.setTableTemp(NDB_TEMP_TAB_TEMPORARY);
+      } else {
+	ltd.setTableTemp(NDB_TEMP_TAB_PERMANENT);
+      }
+    }
+    if(DictTabInfo::isTrigger(type)){
+      TriggerRecordPtr triggerPtr;
+      c_triggerRecordPool.getPtr(triggerPtr, iter.curr.p->m_id);
+
+      ltd.requestData = 0;
+      ltd.setTableId(triggerPtr.i);
+      ltd.setTableType(type);
+      switch (triggerPtr.p->triggerState) {
+      case TriggerRecord::TS_OFFLINE:
+	ltd.setTableState(DictTabInfo::StateOffline);
+	break;
+      case TriggerRecord::TS_ONLINE:
+	ltd.setTableState(DictTabInfo::StateOnline);
+	break;
+      default:
+	ltd.setTableState(DictTabInfo::StateBroken);
+	break;
+      }
+      ltd.setTableStore(DictTabInfo::StoreNotLogged);
+    }
+    if (DictTabInfo::isFilegroup(type)){
+      jam();
+      ltd.requestData = 0;
+      ltd.setTableId(iter.curr.p->m_id);
+      ltd.setTableType(type); // type
+      ltd.setTableState(DictTabInfo::StateOnline);  // XXX todo
+    }
+    if (DictTabInfo::isFile(type)){
+      jam();
+      ltd.requestData = 0;
+      ltd.setTableId(iter.curr.p->m_id);
+      ltd.setTableType(type); // type
+      ltd.setTableState(DictTabInfo::StateOnline); // XXX todo
+    }
+    tableDataWriter.putWords((Uint32 *) &ltd, listTablesDataSizeInWords);
+    count++;
+
+    if (reqListNames)
+    {
+      jam();
+      Rope name(c_rope_pool, iter.curr.p->m_name);
+      const Uint32 size = name.size(); // String length including \0
+      const Uint32 wsize = (size + 3) / 4;
+      tableNamesWriter.putWord(size);
+      name.copy(tname);
+      tableNamesWriter.putWords((Uint32 *) tname, wsize);
+    }
+
+flush:
+    Uint32 tableDataWords = tableDataWriter.getWordsUsed();
+    Uint32 tableNameWords = tableNamesWriter.getWordsUsed();
+
+    done = !c_obj_hash.next(iter);
+    if ((tableDataWords + tableNameWords) > fragSize || done)
+    {
+      jam();
+
+      /*
+       * Flush signal fragment to keep memory usage down
+       */
+      Uint32 sigLen = ListTablesConf::SignalLength;
+      Uint32 secs = 0;
+      if (tableDataWords != 0)
+      {
+        jam();
+        secs++;
+      }
+      if (tableNameWords != 0)
+      {
+        jam();
+        secs++;
+      }
+      Uint32 * secNos = &signal->theData[sigLen];
+      signal->theData[sigLen + secs] = fragId;
+      switch (secs) {
+      case(0):
+        jam();
+        sigLen++; // + fragId;
+        break;
+      case(1):
+      {
+        jam();
+        SegmentedSectionPtr segSecPtr;
+        sigLen += 2; // 1 sections + fragid
+        if (tableNameWords == 0)
+        {
+          tableDataWriter.getPtr(segSecPtr);
+          secNos[0] = ListTablesConf::TABLE_DATA;;
+        }
+        else
+        {
+          tableNamesWriter.getPtr(segSecPtr);
+          secNos[0] = ListTablesConf::TABLE_NAMES;
+        }
+        signal->setSection(segSecPtr, 0);
+        break;
+      }
+      case(2):
+      {
+        jam();
+        sigLen += 3; // 2 sections + fragid
+        SegmentedSectionPtr tableDataPtr;
+        tableDataWriter.getPtr(tableDataPtr);
+        signal->setSection(tableDataPtr, ListTablesConf::TABLE_DATA);
+        SegmentedSectionPtr tableNamesPtr;
+        tableNamesWriter.getPtr(tableNamesPtr);
+        signal->setSection(tableNamesPtr, ListTablesConf::TABLE_NAMES);
+        secNos[0] = ListTablesConf::TABLE_DATA;
+        secNos[1] = ListTablesConf::TABLE_NAMES;
+        break;
+      }
+      }
+
+      if (done)
+      {
+        jam();
+        if (fragInfo)
+        {
+          jam();
+          fragInfo = 3;
+        }
+      }
+      else
+      {
+        jam();
+        if (fragInfo == 0)
+        {
+          jam();
+          fragInfo = 1;
+        }
+        else
+        {
+          jam();
+          fragInfo = 2;
+        }
+      }
+      signal->header.m_fragmentInfo = fragInfo;
+
+      ListTablesConf * const conf = (ListTablesConf*)signal->getDataPtrSend();
+      conf->senderData = senderData;
+      conf->noOfTables = count;
+      sendSignal(rg, GSN_LIST_TABLES_CONF, signal,
+                 sigLen, JBB);
+
+      signal->header.m_noOfSections = 0;
+      signal->header.m_fragmentInfo = 0;
+
+      if (done)
+      {
+        jam();
+        return;
+      }
+
+      /**
+       * Reset counter for next signal
+       * Reset buffers
+       */
+      count = 0;
+      tableDataWriter.first();
+      tableNamesWriter.first();
+    }
+  }
 }
 
 /**
@@ -14146,14 +14495,14 @@ Dbdict::execDICT_LOCK_REQ(Signal* signal
     if (c_outstanding_sub_startstop)
     {
       jam();
-      g_eventLogger.info("refing dict lock to %u", refToNode(req.userRef));
+      g_eventLogger->info("refing dict lock to %u", refToNode(req.userRef));
       sendDictLockRef(signal, req, DictLockRef::TooManyRequests);
       return;
     }
 
     c_sub_startstop_lock.set(refToNode(req.userRef));
 
-    g_eventLogger.info("granting dict lock to %u", refToNode(req.userRef));
+    g_eventLogger->info("granting dict lock to %u", refToNode(req.userRef));
     DictLockConf* conf = (DictLockConf*)signal->getDataPtrSend();
     conf->userPtr = req.userPtr;
     conf->lockType = req.lockType;
@@ -14270,7 +14619,7 @@ Dbdict::execDICT_UNLOCK_ORD(Signal* sign
   if (ord->lockType ==  DictLockReq::SumaStartMe)
   {
     ndbassert(signal->getLength() == DictUnlockOrd::SignalLengthSuma);
-    g_eventLogger.info("clearing dict lock for %u", refToNode(ord->senderRef));
+    g_eventLogger->info("clearing dict lock for %u", refToNode(ord->senderRef));
     c_sub_startstop_lock.clear(refToNode(ord->senderRef));
     return;
   }

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2008-02-20 09:04:29 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2008-05-30 08:03:55 +0000
@@ -41,6 +41,7 @@
 #include <signaldata/DropTable.hpp>
 #include <signaldata/AlterTable.hpp>
 #include <signaldata/AlterTab.hpp>
+#include <signaldata/ListTables.hpp>
 #include <signaldata/CreateIndx.hpp>
 #include <signaldata/DropIndx.hpp>
 #include <signaldata/AlterIndx.hpp>
@@ -197,6 +198,7 @@ public:
   typedef Ptr<AttributeRecord> AttributeRecordPtr;
   ArrayPool<AttributeRecord> c_attributeRecordPool;
   DLHashTable<AttributeRecord> c_attributeRecordHash;
+  RSS_AP_SNAPSHOT(c_attributeRecordPool);
 
   /**
    * Shared table / index record.  Most of this is permanent data stored
@@ -383,6 +385,7 @@ public:
 
   typedef Ptr<TableRecord> TableRecordPtr;
   ArrayPool<TableRecord> c_tableRecordPool;
+  RSS_AP_SNAPSHOT(c_tableRecordPool);
 
   /**  Node Group and Tablespace id+version + range or list data.
     *  This is only stored temporarily in DBDICT during an ongoing
@@ -462,6 +465,7 @@ public:
   Uint32 c_maxNoOfTriggers;
   typedef Ptr<TriggerRecord> TriggerRecordPtr;
   ArrayPool<TriggerRecord> c_triggerRecordPool;
+  RSS_AP_SNAPSHOT(c_triggerRecordPool);
 
   /**
    * Information for each FS connection.
@@ -611,6 +615,7 @@ public:
   Filegroup_hash c_filegroup_hash;
   
   RopePool c_rope_pool;
+  RSS_AP_SNAPSHOT(c_rope_pool);
 
   struct DictObject {
     DictObject() {}
@@ -642,6 +647,7 @@ public:
   
   DLHashTable<DictObject> c_obj_hash; // Name
   ArrayPool<DictObject> c_obj_pool;
+  RSS_AP_SNAPSHOT(c_obj_pool);
   
   DictObject * get_object(const char * name){
     return get_object(name, strlen(name) + 1);
@@ -1119,6 +1125,7 @@ private:
    * Temporary structure used when parsing table info
    */
   struct ParseDictTabInfoRecord {
+    ParseDictTabInfoRecord() { tablePtr.setNull();}
     DictTabInfo::RequestType requestType;
     Uint32 errorCode;
     Uint32 errorLine;
@@ -2673,6 +2680,9 @@ public:
   
   int checkSingleUserMode(Uint32 senderRef);
 
+  void sendOLD_LIST_TABLES_CONF(Signal *signal, ListTablesReq*);
+  void sendLIST_TABLES_CONF(Signal *signal, ListTablesReq*);
+
   Uint32 c_outstanding_sub_startstop;
   NdbNodeBitmask c_sub_startstop_lock;
 

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbdict/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Makefile.am	2008-04-25 06:32:23 +0000
@@ -19,17 +19,17 @@ include $(top_srcdir)/storage/ndb/config
 LDADD +=  \
          $(top_builddir)/storage/ndb/src/common/util/libgeneral.la \
          $(top_builddir)/storage/ndb/src/common/portlib/libportlib.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 ndbtools_PROGRAMS = ndb_print_schema_file
 ndb_print_schema_file_SOURCES = printSchemaFile.cpp
 ndb_print_schema_file_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-03-12 09:29:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-04-23 14:29:01 +0000
@@ -1399,6 +1399,9 @@ private:
     Uint32 m_masterLcpDihRef;
     bool   m_MASTER_LCPREQ_Received;
     Uint32 m_MASTER_LCPREQ_FailedNodeId;
+
+    Uint32 m_lastLCP_COMPLETE_REP_id;
+    Uint32 m_lastLCP_COMPLETE_REP_ref;
   } c_lcpState;
   
   /*------------------------------------------------------------------------*/

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-03-12 09:29:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2008-04-23 14:29:01 +0000
@@ -72,7 +72,7 @@
 #include <signaldata/Upgrade.hpp>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 #define SYSFILE ((Sysfile *)&sysfileData[0])
 
@@ -2064,8 +2064,8 @@ ref:
   if (getNodeStatus(nodeId) != NodeRecord::DEAD)
   {
     jam();
-    g_eventLogger.error("nodeStatus in START_PERMREQ = %u",
-                        (Uint32) getNodeStatus(nodeId));
+    g_eventLogger->error("nodeStatus in START_PERMREQ = %u",
+                         (Uint32) getNodeStatus(nodeId));
     goto ref;
   }//if
 
@@ -4597,9 +4597,9 @@ void Dbdih::checkCopyTab(Signal* signal,
     jam();
     break;
   default:
-    g_eventLogger.error("outstanding gsn: %s(%d)", 
-                        getSignalName(c_nodeStartMaster.m_outstandingGsn), 
-                        c_nodeStartMaster.m_outstandingGsn);
+    g_eventLogger->error("outstanding gsn: %s(%d)",
+                         getSignalName(c_nodeStartMaster.m_outstandingGsn),
+                         c_nodeStartMaster.m_outstandingGsn);
     ndbrequire(false);
   }
   
@@ -5067,10 +5067,10 @@ void Dbdih::failedNodeLcpHandling(Signal
       failedNodePtr.p->activeStatus = Sysfile::NS_NotActive_NotTakenOver;
       break;
     default:
-      g_eventLogger.error("activeStatus = %u "
-                          "at failure after NODE_FAILREP of node = %u",
-                          (Uint32) failedNodePtr.p->activeStatus,
-                          failedNodePtr.i);
+      g_eventLogger->error("activeStatus = %u "
+                           "at failure after NODE_FAILREP of node = %u",
+                           (Uint32) failedNodePtr.p->activeStatus,
+                           failedNodePtr.i);
       ndbrequire(false);
       break;
     }//switch
@@ -5079,37 +5079,47 @@ void Dbdih::failedNodeLcpHandling(Signal
   c_lcpState.m_participatingDIH.clear(failedNodePtr.i);
   c_lcpState.m_participatingLQH.clear(failedNodePtr.i);
 
-  if(c_lcpState.m_LCP_COMPLETE_REP_Counter_DIH.isWaitingFor(failedNodePtr.i)){
+  bool wf = c_MASTER_LCPREQ_Counter.isWaitingFor(failedNodePtr.i);
+
+  if(c_lcpState.m_LCP_COMPLETE_REP_Counter_DIH.isWaitingFor(failedNodePtr.i))
+  {
     jam();
     LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtrSend();
     rep->nodeId = failedNodePtr.i;
     rep->lcpId = SYSFILE->latestLCP_ID;
     rep->blockNo = DBDIH;
     sendSignal(reference(), GSN_LCP_COMPLETE_REP, signal, 
-	       LcpCompleteRep::SignalLength, JBB);
+               LcpCompleteRep::SignalLength, JBB);
   }
-
-  /**
-   * Check if we'r waiting for the failed node's LQH to complete
-   *
-   * Note that this is ran "before" LCP master take over
-   */
-  if(c_lcpState.m_LCP_COMPLETE_REP_Counter_LQH.isWaitingFor(nodeId)){
+   
+  bool lcp_complete_rep = false;
+  if (!wf)
+  {
     jam();
-
-    LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtrSend();
-    rep->nodeId  = nodeId;
-    rep->lcpId   = SYSFILE->latestLCP_ID;
-    rep->blockNo = DBLQH;
-    sendSignal(reference(), GSN_LCP_COMPLETE_REP, signal, 
-	       LcpCompleteRep::SignalLength, JBB);
-
-    if(c_lcpState.m_LAST_LCP_FRAG_ORD.isWaitingFor(nodeId)){
+ 
+    /**
+     * Check if we'r waiting for the failed node's LQH to complete
+     *
+     * Note that this is ran "before" LCP master take over
+     */
+    if(c_lcpState.m_LCP_COMPLETE_REP_Counter_LQH.isWaitingFor(nodeId)){
       jam();
-      /**
-       * Make sure we're ready to accept it
-       */
-      c_lcpState.m_LAST_LCP_FRAG_ORD.clearWaitingFor(nodeId);
+      
+      lcp_complete_rep = true;
+      LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtrSend();
+      rep->nodeId  = nodeId;
+      rep->lcpId   = SYSFILE->latestLCP_ID;
+      rep->blockNo = DBLQH;
+      sendSignal(reference(), GSN_LCP_COMPLETE_REP, signal, 
+                 LcpCompleteRep::SignalLength, JBB);
+      
+      if(c_lcpState.m_LAST_LCP_FRAG_ORD.isWaitingFor(nodeId)){
+        jam();
+        /**
+         * Make sure we're ready to accept it
+         */
+        c_lcpState.m_LAST_LCP_FRAG_ORD.clearWaitingFor(nodeId);
+      }
     }
   }
   
@@ -5135,7 +5145,9 @@ void Dbdih::failedNodeLcpHandling(Signal
 	       StartLcpConf::SignalLength, JBB);
   }//if
   
-  if (c_EMPTY_LCP_REQ_Counter.isWaitingFor(failedNodePtr.i)) {
+dosend:
+  if (c_EMPTY_LCP_REQ_Counter.isWaitingFor(failedNodePtr.i))
+  {
     jam();
     EmptyLcpConf * const rep = (EmptyLcpConf *)&signal->theData[0];
     rep->senderNodeId = failedNodePtr.i;
@@ -5146,8 +5158,14 @@ void Dbdih::failedNodeLcpHandling(Signal
     rep->idle = true;
     sendSignal(reference(), GSN_EMPTY_LCP_CONF, signal, 
 	       EmptyLcpConf::SignalLength, JBB);
-  }//if
-
+  }
+  else if (!c_EMPTY_LCP_REQ_Counter.done() && lcp_complete_rep)
+  {
+    jam();
+    c_EMPTY_LCP_REQ_Counter.setWaitingFor(failedNodePtr.i);
+    goto dosend;
+  }
+  
   if (c_MASTER_LCPREQ_Counter.isWaitingFor(failedNodePtr.i)) {
     jam();
     MasterLCPRef * const ref = (MasterLCPRef *)&signal->theData[0];
@@ -5221,19 +5239,35 @@ Dbdih::startLcpMasterTakeOver(Signal* si
   
   c_lcpMasterTakeOverState.set(LMTOS_WAIT_EMPTY_LCP, __LINE__);
   
-  if(c_EMPTY_LCP_REQ_Counter.done()){
-    jam();
-    c_lcpState.m_LAST_LCP_FRAG_ORD.clearWaitingFor();
-
-    EmptyLcpReq* req = (EmptyLcpReq*)signal->getDataPtrSend();
-    req->senderRef = reference();
-    sendLoopMacro(EMPTY_LCP_REQ, sendEMPTY_LCP_REQ);
-    ndbrequire(!c_EMPTY_LCP_REQ_Counter.done());
-  } else {
-    /**
-     * Node failure during master take over...
-     */
-    g_eventLogger.info("Nodefail during master take over (old: %d)", oldNode);
+  EmptyLcpReq* req = (EmptyLcpReq*)signal->getDataPtrSend();
+  req->senderRef = reference();
+  {
+    NodeRecordPtr specNodePtr;
+    specNodePtr.i = cfirstAliveNode;
+    do {
+      jam();
+      ptrCheckGuard(specNodePtr, MAX_NDB_NODES, nodeRecord);
+      if (!c_EMPTY_LCP_REQ_Counter.isWaitingFor(specNodePtr.i))
+      {
+        jam();
+        c_EMPTY_LCP_REQ_Counter.setWaitingFor(specNodePtr.i);
+        if (!(ERROR_INSERTED(7209) && specNodePtr.i == getOwnNodeId()))
+        {
+          sendEMPTY_LCP_REQ(signal, specNodePtr.i);
+        }
+        else
+        {
+          ndbout_c("NOT sending EMPTY_LCP_REQ to %u", specNodePtr.i);
+        }
+        
+        if (c_lcpState.m_LAST_LCP_FRAG_ORD.isWaitingFor(specNodePtr.i))
+        {
+          jam();
+          c_lcpState.m_LAST_LCP_FRAG_ORD.clearWaitingFor();
+        }
+      }
+      specNodePtr.i = specNodePtr.p->nextNode;
+    } while (specNodePtr.i != RNIL);
   }
   
   NodeRecordPtr nodePtr;
@@ -5510,8 +5544,8 @@ void Dbdih::execMASTER_GCPCONF(Signal* s
   if (latestLcpId > SYSFILE->latestLCP_ID) {
     jam();
 #if 0
-    g_eventLogger.info("Dbdih: Setting SYSFILE->latestLCP_ID to %d",
-                       latestLcpId);
+    g_eventLogger->info("Dbdih: Setting SYSFILE->latestLCP_ID to %d",
+                        latestLcpId);
     SYSFILE->latestLCP_ID = latestLcpId;
 #endif
     SYSFILE->keepGCI = oldestKeepGci;
@@ -6114,10 +6148,10 @@ Dbdih::checkLocalNodefailComplete(Signal
 
   if (ERROR_INSERTED(7030))
   {
-    g_eventLogger.info("Reenable GCP_PREPARE");
+    g_eventLogger->info("Reenable GCP_PREPARE");
     CLEAR_ERROR_INSERT_VALUE;
   }
-  
+
   NFCompleteRep * const nf = (NFCompleteRep *)&signal->theData[0];
   nf->blockNo = DBDIH;
   nf->nodeId = cownNodeId;
@@ -6164,6 +6198,9 @@ void Dbdih::execEMPTY_LCP_CONF(Signal* s
   const EmptyLcpConf * const conf = (EmptyLcpConf *)&signal->theData[0];
   Uint32 nodeId = conf->senderNodeId;
 
+  CRASH_INSERTION(7206);
+
+
   if(!conf->idle){
     jam();
     if (conf->tableId < c_lcpMasterTakeOverState.minTableId) {
@@ -6241,6 +6278,25 @@ void Dbdih::execMASTER_LCPREQ(Signal* si
   jamEntry();
   const BlockReference newMasterBlockref = req->masterRef;
 
+  CRASH_INSERTION(7205);
+
+  if (ERROR_INSERTED(7207))
+  {
+    jam();
+    SET_ERROR_INSERT_VALUE(7208);
+    sendSignalWithDelay(reference(), GSN_MASTER_LCPREQ, signal,
+			500, signal->getLength());
+    return;
+  }
+  
+  if (ERROR_INSERTED(7208))
+  {
+    jam();
+    signal->theData[0] = 9999;
+    sendSignal(numberToRef(CMVMI, refToNode(newMasterBlockref)), 
+               GSN_NDB_TAMPER, signal, 1, JBB);
+  }
+  
   if (newMasterBlockref != cmasterdihref)
   {
     jam();
@@ -6263,6 +6319,11 @@ void Dbdih::execMASTER_LCPREQ(Signal* si
     jam();
     ndbrequire(0);
   }
+
+  if (ERROR_INSERTED(7209))
+  {
+    SET_ERROR_INSERT_VALUE(7210);
+  }
   
   sendMASTER_LCPCONF(signal);
 }//Dbdih::execMASTER_LCPREQ()
@@ -6305,7 +6366,7 @@ Dbdih::sendMASTER_LCPCONF(Signal * signa
     c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
 #if 0
     if(c_copyGCISlave.m_copyReason == CopyGCIReq::LOCAL_CHECKPOINT){
-      g_eventLogger.info("Dbdih: Also resetting c_copyGCISlave");
+      g_eventLogger->info("Dbdih: Also resetting c_copyGCISlave");
       c_copyGCISlave.m_copyReason = CopyGCIReq::IDLE;
       c_copyGCISlave.m_expectedNextWord = 0;
     }
@@ -6390,7 +6451,7 @@ Dbdih::sendMASTER_LCPCONF(Signal * signa
 
   if(c_lcpState.lcpStatus == LCP_TAB_SAVED){
 #ifdef VM_TRACE
-    g_eventLogger.info("Sending extra GSN_LCP_COMPLETE_REP to new master");    
+    g_eventLogger->info("Sending extra GSN_LCP_COMPLETE_REP to new master");    
 #endif
     sendLCP_COMPLETE_REP(signal);
   }
@@ -6557,7 +6618,7 @@ void Dbdih::execMASTER_LCPCONF(Signal* s
   CRASH_INSERTION(7180);
   
 #ifdef VM_TRACE
-  g_eventLogger.info("MASTER_LCPCONF");
+  g_eventLogger->info("MASTER_LCPCONF");
   printMASTER_LCP_CONF(stdout, &signal->theData[0], 0, 0);
 #endif  
 
@@ -6602,12 +6663,22 @@ void Dbdih::execMASTER_LCPREF(Signal* si
 {
   const MasterLCPRef * const ref = (MasterLCPRef *)&signal->theData[0];
   jamEntry();
-  receiveLoopMacro(MASTER_LCPREQ, ref->senderNodeId);
+
+  Uint32 senderNodeId = ref->senderNodeId;
+  Uint32 failedNodeId = ref->failedNodeId;
+  
+  if (c_lcpState.m_LCP_COMPLETE_REP_Counter_LQH.isWaitingFor(senderNodeId))
+  {
+    jam();
+    c_lcpState.m_LCP_COMPLETE_REP_Counter_LQH.clearWaitingFor(senderNodeId);
+  }
+
+  receiveLoopMacro(MASTER_LCPREQ, senderNodeId);
   /*-------------------------------------------------------------------------*/
   // We have now received all responses and are ready to take over the LCP
   // protocol as master.
   /*-------------------------------------------------------------------------*/
-  MASTER_LCPhandling(signal, ref->failedNodeId);
+  MASTER_LCPhandling(signal, failedNodeId);
 }//Dbdih::execMASTER_LCPREF()
 
 void Dbdih::MASTER_LCPhandling(Signal* signal, Uint32 failedNodeId) 
@@ -6634,7 +6705,7 @@ void Dbdih::MASTER_LCPhandling(Signal* s
     // protocol.
     /* --------------------------------------------------------------------- */
 #ifdef VM_TRACE
-    g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart");
+    g_eventLogger->info("MASTER_LCPhandling:: LMTOS_ALL_IDLE -> checkLcpStart");
 #endif
     checkLcpStart(signal, __LINE__);
     break;
@@ -6645,7 +6716,7 @@ void Dbdih::MASTER_LCPhandling(Signal* s
     // protocol by calculating the keep gci and storing the new lcp id.
     /* --------------------------------------------------------------------- */
 #ifdef VM_TRACE
-    g_eventLogger.info("MASTER_LCPhandling:: LMTOS_COPY_ONGOING -> storeNewLcpId");
+    g_eventLogger->info("MASTER_LCPhandling:: LMTOS_COPY_ONGOING ->
storeNewLcpId");
 #endif
     if (c_lcpState.lcpStatus == LCP_STATUS_ACTIVE) {
       jam();
@@ -6656,7 +6727,7 @@ void Dbdih::MASTER_LCPhandling(Signal* s
       /*---------------------------------------------------------------------*/
       Uint32 lcpId = SYSFILE->latestLCP_ID;
 #ifdef VM_TRACE
-      g_eventLogger.info("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1);
+      g_eventLogger->info("Decreasing latestLCP_ID from %d to %d", lcpId, lcpId - 1);
 #endif
       SYSFILE->latestLCP_ID--;
     }//if
@@ -6673,10 +6744,10 @@ void Dbdih::MASTER_LCPhandling(Signal* s
        * complete before finalising the LCP process.
        * ------------------------------------------------------------------ */
 #ifdef VM_TRACE
-      g_eventLogger.info("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> "
-                         "startLcpRoundLoopLab(table=%u, fragment=%u)",
-                         c_lcpMasterTakeOverState.minTableId, 
-                         c_lcpMasterTakeOverState.minFragId);
+      g_eventLogger->info("MASTER_LCPhandling:: LMTOS_ALL_ACTIVE -> "
+                          "startLcpRoundLoopLab(table=%u, fragment=%u)",
+                          c_lcpMasterTakeOverState.minTableId,
+                          c_lcpMasterTakeOverState.minFragId);
 #endif
     
       c_lcpState.keepGci = SYSFILE->keepGCI;
@@ -8540,7 +8611,7 @@ void Dbdih::GCP_SAVEhandling(Signal* sig
      getNodeState().startLevel == NodeState::SL_STARTED){
     jam();
 #if 0
-    g_eventLogger.info("Dbdih: Clearing initial start ongoing");
+    g_eventLogger->info("Dbdih: Clearing initial start ongoing");
 #endif
     Sysfile::clearInitialStartOngoing(SYSFILE->systemRestartBits);
   }
@@ -8562,7 +8633,7 @@ void Dbdih::execGCP_PREPARE(Signal* sign
   if (ERROR_INSERTED(7030))
   {
     cgckptflag = true;
-    g_eventLogger.info("Delayed GCP_PREPARE 5s");
+    g_eventLogger->info("Delayed GCP_PREPARE 5s");
     sendSignalWithDelay(reference(), GSN_GCP_PREPARE, signal, 5000,
 			signal->getLength());
     return;
@@ -8620,7 +8691,7 @@ void Dbdih::execGCP_PREPARE(Signal* sign
 
   if (ERROR_INSERTED(7031))
   {
-    g_eventLogger.info("Crashing delayed in GCP_PREPARE 3s");
+    g_eventLogger->info("Crashing delayed in GCP_PREPARE 3s");
     signal->theData[0] = 9999;
     sendSignalWithDelay(CMVMI_REF, GSN_NDB_TAMPER, signal, 3000, 1);
     return;
@@ -9319,7 +9390,7 @@ void Dbdih::initLcpLab(Signal* signal, U
      * This is LCP master takeover
      */
 #ifdef VM_TRACE
-    g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 1");
+    g_eventLogger->info("initLcpLab aborted due to LCP master takeover - 1");
 #endif
     c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
     sendMASTER_LCPCONF(signal);
@@ -9332,7 +9403,7 @@ void Dbdih::initLcpLab(Signal* signal, U
      * Master take over but has not yet received MASTER_LCPREQ
      */
 #ifdef VM_TRACE
-    g_eventLogger.info("initLcpLab aborted due to LCP master takeover - 2");
+    g_eventLogger->info("initLcpLab aborted due to LCP master takeover - 2");
 #endif
     return;
   }
@@ -10641,10 +10712,10 @@ void Dbdih::checkTcCounterLab(Signal* si
 {
   CRASH_INSERTION(7009);
   if (c_lcpState.lcpStatus != LCP_STATUS_IDLE) {
-    g_eventLogger.error("lcpStatus = %u"
-                        "lcpStatusUpdatedPlace = %d",
-                        (Uint32) c_lcpState.lcpStatus,
-                        c_lcpState.lcpStatusUpdatedPlace);
+    g_eventLogger->error("lcpStatus = %u"
+                         "lcpStatusUpdatedPlace = %d",
+                         (Uint32) c_lcpState.lcpStatus,
+                         c_lcpState.lcpStatusUpdatedPlace);
     ndbrequire(false);
     return;
   }//if
@@ -11237,8 +11308,8 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
 
     if(tabPtr.p->tabStatus == TabRecord::TS_DROPPING){
       jam();
-      g_eventLogger.info("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ",
-                         tableId, fragId);
+      g_eventLogger->info("TS_DROPPING - Neglecting to save Table: %d Frag: %d - ",
+                          tableId, fragId);
     } else {
       jam();
       /**
@@ -11251,7 +11322,15 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
       signal->theData[1] = tabPtr.i;
       sendSignal(reference(), GSN_CONTINUEB, signal, 2, JBB);
       
-      checkLcpAllTablesDoneInLqh();
+      bool ret = checkLcpAllTablesDoneInLqh();
+      if (ret && ERROR_INSERTED(7209))
+      {
+        jam();
+        
+        signal->theData[0] = 9999;
+        sendSignal(numberToRef(CMVMI, cmasterNodeId), 
+                   GSN_NDB_TAMPER, signal, 1, JBB);
+      }
     }
   }
 
@@ -11375,7 +11454,7 @@ void Dbdih::findReplica(ReplicaRecordPtr
   };
 
 #ifdef VM_TRACE
-  g_eventLogger.info("Fragment Replica(node=%d) not found", nodeId);
+  g_eventLogger->info("Fragment Replica(node=%d) not found", nodeId);
   replicaPtr.i = fragPtrP->oldStoredReplicas;
   while(replicaPtr.i != RNIL){
     ptrCheckGuard(replicaPtr, creplicaFileSize, replicaRecord);
@@ -11388,9 +11467,9 @@ void Dbdih::findReplica(ReplicaRecordPtr
     }//if
   };
   if(replicaPtr.i != RNIL){
-    g_eventLogger.info("...But was found in oldStoredReplicas");
+    g_eventLogger->info("...But was found in oldStoredReplicas");
   } else {
-    g_eventLogger.info("...And wasn't found in oldStoredReplicas");
+    g_eventLogger->info("...And wasn't found in oldStoredReplicas");
   }
 #endif
   ndbrequire(false);
@@ -11455,8 +11534,8 @@ Dbdih::reportLcpCompletion(const LcpFrag
   if(lcpNo != replicaPtr.p->nextLcp){
     if (handle_invalid_lcp_no(lcpReport, replicaPtr))
     {
-      g_eventLogger.error("lcpNo = %d replicaPtr.p->nextLcp = %d",
-                          lcpNo, replicaPtr.p->nextLcp);
+      g_eventLogger->error("lcpNo = %d replicaPtr.p->nextLcp = %d",
+                           lcpNo, replicaPtr.p->nextLcp);
       ndbrequire(false);
     }
   }
@@ -11492,7 +11571,7 @@ Dbdih::reportLcpCompletion(const LcpFrag
       // Not all fragments in table have been checkpointed.
       /* ----------------------------------------------------------------- */
       if(0)
-	g_eventLogger.info("reportLcpCompletion: fragment %d not ready", fid);
+        g_eventLogger->info("reportLcpCompletion: fragment %d not ready", fid);
       return false;
     }//if
   }//for
@@ -11580,12 +11659,30 @@ void Dbdih::checkLcpCompletedLab(Signal*
   CRASH_INSERTION2(7027, isMaster());
   CRASH_INSERTION2(7018, !isMaster());
 
-  if(c_lcpState.lcpStatus == LCP_TAB_COMPLETED){
+  if(c_lcpState.lcpStatus == LCP_TAB_COMPLETED)
+  {
     /**
      * We'r done
      */
+
+    if (ERROR_INSERTED(7209))
+    {
+      signal->theData[0] = DihContinueB::ZCHECK_LCP_COMPLETED;
+      sendSignal(reference(), GSN_CONTINUEB, signal, 1, JBB);
+      return;
+    }
+    
     c_lcpState.setLcpStatus(LCP_TAB_SAVED, __LINE__);
     sendLCP_COMPLETE_REP(signal);
+
+    if (ERROR_INSERTED(7210))
+    {
+      CLEAR_ERROR_INSERT_VALUE;
+      EmptyLcpReq* req = (EmptyLcpReq*)signal->getDataPtr();
+      req->senderRef = reference();
+      sendEMPTY_LCP_REQ(signal, getOwnNodeId());
+    }
+    
     return;
   }
 
@@ -11597,13 +11694,28 @@ void Dbdih::checkLcpCompletedLab(Signal*
 void
 Dbdih::sendLCP_COMPLETE_REP(Signal* signal){
   jam();
-  LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtrSend();
-  rep->nodeId = getOwnNodeId();
-  rep->lcpId = SYSFILE->latestLCP_ID;
-  rep->blockNo = DBDIH;
-  
-  sendSignal(c_lcpState.m_masterLcpDihRef, GSN_LCP_COMPLETE_REP, signal, 
-	     LcpCompleteRep::SignalLength, JBB);
+
+  /**
+   * Quick and dirty fix for bug#36276 dont save
+   * LCP_COMPLETE_REP to same node same LCP twice
+   */
+  bool alreadysent = 
+    c_lcpState.m_lastLCP_COMPLETE_REP_id == SYSFILE->latestLCP_ID &&
+    c_lcpState.m_lastLCP_COMPLETE_REP_ref == c_lcpState.m_masterLcpDihRef;
+
+  if (!alreadysent)
+  {
+    LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtrSend();
+    rep->nodeId = getOwnNodeId();
+    rep->lcpId = SYSFILE->latestLCP_ID;
+    rep->blockNo = DBDIH;
+    
+    sendSignal(c_lcpState.m_masterLcpDihRef, GSN_LCP_COMPLETE_REP, signal, 
+               LcpCompleteRep::SignalLength, JBB);
+
+    c_lcpState.m_lastLCP_COMPLETE_REP_id = SYSFILE->latestLCP_ID;
+    c_lcpState.m_lastLCP_COMPLETE_REP_ref = c_lcpState.m_masterLcpDihRef;
+  }
 
   /**
    * Say that an initial node restart does not need to be redone
@@ -11627,7 +11739,7 @@ void Dbdih::execLCP_COMPLETE_REP(Signal*
   CRASH_INSERTION(7191);
 
 #if 0
-  g_eventLogger.info("LCP_COMPLETE_REP"); 
+  g_eventLogger->info("LCP_COMPLETE_REP"); 
   printLCP_COMPLETE_REP(stdout, 
 			signal->getDataPtr(),
 			signal->length(), number());
@@ -11713,7 +11825,7 @@ void Dbdih::allNodesLcpCompletedLab(Sign
   if(c_lcpMasterTakeOverState.state != LMTOS_IDLE){
     jam();
 #ifdef VM_TRACE
-    g_eventLogger.info("Exiting from allNodesLcpCompletedLab");
+    g_eventLogger->info("Exiting from allNodesLcpCompletedLab");
 #endif
     return;
   }
@@ -12869,7 +12981,7 @@ void Dbdih::initCommonData()
   c_lcpState.ctimer = 0;
   c_lcpState.immediateLcpStart = false;
   c_lcpState.m_MASTER_LCPREQ_Received = false;
-    
+  c_lcpState.m_lastLCP_COMPLETE_REP_ref = 0;
   cmasterdihref = 0;
   cmasterNodeId = 0;
   cmasterState = MASTER_IDLE;
@@ -14446,9 +14558,9 @@ void Dbdih::setLcpActiveStatusEnd()
       nodePtr.i = getOwnNodeId();
       ptrAss(nodePtr, nodeRecord);
       ndbrequire(nodePtr.p->activeStatus == Sysfile::NS_Active);
-      g_eventLogger.info("NR: setLcpActiveStatusEnd - m_participatingLQH");
+      g_eventLogger->info("NR: setLcpActiveStatusEnd - m_participatingLQH");
     } else {
-      g_eventLogger.info("NR: setLcpActiveStatusEnd - !m_participatingLQH");
+      g_eventLogger->info("NR: setLcpActiveStatusEnd - !m_participatingLQH");
     }
   }
   
@@ -15228,9 +15340,9 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
     warningEvent("gsn: %d block: %s, length: %d theData: %s", 
 		 gsn, getBlockName(block, "UNKNOWN"), length, buf);
 
-    g_eventLogger.warning("-- SENDING CUSTOM SIGNAL --");
-    g_eventLogger.warning("gsn: %d block: %s, length: %d theData: %s", 
-			  gsn, getBlockName(block, "UNKNOWN"), length, buf);
+    g_eventLogger->warning("-- SENDING CUSTOM SIGNAL --");
+    g_eventLogger->warning("gsn: %d block: %s, length: %d theData: %s", 
+                           gsn, getBlockName(block, "UNKNOWN"), length, buf);
   }
   
   if(arg == DumpStateOrd::DihDumpLCPState){
@@ -15291,8 +15403,8 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
   }
 
   if(arg == DumpStateOrd::EnableUndoDelayDataWrite){
-    g_eventLogger.info("Dbdih:: delay write of datapages for table = %d", 
-                       dumpState->args[1]);
+    g_eventLogger->info("Dbdih:: delay write of datapages for table = %d", 
+                        dumpState->args[1]);
     // Send this dump to ACC and TUP
     EXECUTE_DIRECT(DBACC, GSN_DUMP_STATE_ORD, signal, 2);
     EXECUTE_DIRECT(DBTUP, GSN_DUMP_STATE_ORD, signal, 2);
@@ -15309,13 +15421,13 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
   }//if
   if (signal->theData[0] == DumpStateOrd::DihMinTimeBetweenLCP) {
     // Set time between LCP to min value
-    g_eventLogger.info("Set time between LCP to min value");
+    g_eventLogger->info("Set time between LCP to min value");
     c_lcpState.clcpDelay = 0; // TimeBetweenLocalCheckpoints.min
     return;
   }
   if (signal->theData[0] == DumpStateOrd::DihMaxTimeBetweenLCP) {
     // Set time between LCP to max value
-    g_eventLogger.info("Set time between LCP to max value");
+    g_eventLogger->info("Set time between LCP to max value");
     c_lcpState.clcpDelay = 31; // TimeBetweenLocalCheckpoints.max
     return;
   }
@@ -15353,7 +15465,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
       tmp = signal->theData[1];
     }
     m_gcp_save.m_master.m_time_between_gcp = tmp;
-    g_eventLogger.info("Setting time between gcp : %d", tmp);
+    g_eventLogger->info("Setting time between gcp : %d", tmp);
   }
 
   if (arg == 7021 && signal->getLength() == 2)
@@ -15487,7 +15599,7 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* sig
 	while(index < count){
 	  if(nodePtr.p->queuedChkpt[index].tableId == tabPtr.i){
 	    jam();
-	    //	    g_eventLogger.info("Unqueuing %d", index);
+	    //	    g_eventLogger->info("Unqueuing %d", index);
 	    
 	    count--;
 	    for(Uint32 i = index; i<count; i++){
@@ -15527,7 +15639,7 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* sig
       if(checkLcpAllTablesDoneInLqh()){
 	jam();
 	
-	g_eventLogger.info("This is the last table");
+        g_eventLogger->info("This is the last table");
 	
 	/**
 	 * Then check if saving of tab info is done for all tables
@@ -15535,9 +15647,9 @@ Dbdih::execPREP_DROP_TAB_REQ(Signal* sig
 	LcpStatus a = c_lcpState.lcpStatus;
 	checkLcpCompletedLab(signal);
 	
-	if(a != c_lcpState.lcpStatus){
-	  g_eventLogger.info("And all tables are written to already written disk");
-	}
+        if(a != c_lcpState.lcpStatus){
+          g_eventLogger->info("And all tables are written to already written disk");
+        }
       }
       break;
     }

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbdih/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Makefile.am	2008-04-25 06:32:23 +0000
@@ -17,9 +17,9 @@ ndbtools_PROGRAMS = ndb_print_sys_file
 ndb_print_sys_file_SOURCES = printSysfile.cpp
 ndb_print_sys_file_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2007-11-19 10:04:24 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2008-05-30 06:33:46 +0000
@@ -2647,6 +2647,7 @@ private:
 // Configurable
   FragrecordPtr fragptr;
   ArrayPool<Fragrecord> c_fragment_pool;
+  RSS_AP_SNAPSHOT(c_fragment_pool);
 
 #define ZGCPREC_FILE_SIZE 1
   GcpRecord *gcpRecord;

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-02-06 12:15:05 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-05-30 06:33:46 +0000
@@ -7687,6 +7687,22 @@ void Dblqh::lqhTransNextLab(Signal* sign
        *
        * now scan markers
        */
+      if (ERROR_INSERTED(5050))
+      {
+        ndbout_c("send ZSCAN_MARKERS with 5s delay and killing master");
+        CLEAR_ERROR_INSERT_VALUE;
+        signal->theData[0] = ZSCAN_MARKERS;
+        signal->theData[1] = tcNodeFailptr.i;
+        signal->theData[2] = 0;
+        signal->theData[3] = RNIL;
+        sendSignalWithDelay(cownref, GSN_CONTINUEB, signal, 5000, 4);
+        
+        signal->theData[0] = 9999;
+        sendSignal(numberToRef(CMVMI, 
+                               refToNode(tcNodeFailptr.p->newTcBlockref)), 
+                   GSN_NDB_TAMPER, signal, 1, JBB);
+        return;
+      }
       scanMarkers(signal, tcNodeFailptr.i, 0, RNIL);
       return;
     }//if
@@ -7772,6 +7788,20 @@ Dblqh::scanMarkers(Signal* signal, 
   tcNodeFailPtr.i = tcNodeFail;
   ptrCheckGuard(tcNodeFailPtr, ctcNodeFailrecFileSize, tcNodeFailRecord);
   const Uint32 crashedTcNodeId = tcNodeFailPtr.p->oldNodeId;
+
+  if (tcNodeFailPtr.p->tcFailStatus == TcNodeFailRecord::TC_STATE_BREAK)
+  {
+    jam();
+    
+    /* ----------------------------------------------------------------------
+     *  AN INTERRUPTION TO THIS NODE FAIL HANDLING WAS RECEIVED AND A NEW 
+     *  TC HAVE BEEN ASSIGNED TO TAKE OVER THE FAILED TC. PROBABLY THE OLD 
+     *  NEW TC HAVE FAILED.
+     * ---------------------------------------------------------------------- */
+    tcNodeFailptr = tcNodeFailPtr;
+    lqhTransNextLab(signal);
+    return;
+  }
   
   CommitAckMarkerIterator iter;
   if(i == RNIL){
@@ -19695,6 +19725,18 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal
       infoEvent(buf);
     }
   }
+  
+  if (arg == DumpStateOrd::SchemaResourceSnapshot)
+  {
+    RSS_AP_SNAPSHOT_SAVE(c_fragment_pool);
+    return;
+  }
+
+  if (arg == DumpStateOrd::SchemaResourceCheckLeak)
+  {
+    RSS_AP_SNAPSHOT_CHECK(c_fragment_pool);
+    return;
+  }
 }//Dblqh::execDUMP_STATE_ORD()
 
 /* **************************************************************** */

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dblqh/Makefile.am	2007-05-30 18:29:14 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Makefile.am	2008-04-25 06:32:23 +0000
@@ -23,9 +23,9 @@ include $(top_srcdir)/storage/ndb/config
 
 ndbd_redo_log_reader_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-         $(top_builddir)/dbug/libdbug.a \
-         $(top_builddir)/mysys/libmysys.a \
-         $(top_builddir)/strings/libmystrings.a
+         $(top_builddir)/dbug/libdbuglt.la \
+         $(top_builddir)/mysys/libmysyslt.la \
+         $(top_builddir)/strings/libmystringslt.la
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2008-05-27 19:43:02 +0000
@@ -2746,6 +2746,8 @@ void Dbtc::execTCKEYREQ(Signal* signal) 
   if (seizeCacheRecord(signal) != 0) {
     return;
   }//if
+
+  CRASH_INSERTION(8063);
   
   TcConnectRecord * const regTcPtr = tcConnectptr.p;
   CacheRecord * const regCachePtr = cachePtr.p;
@@ -4630,9 +4632,7 @@ void Dbtc::execCOMMITTED(Signal* signal)
     CLEAR_ERROR_INSERT_VALUE;
     return;
   }//if
-  if (ERROR_INSERTED(8030)) {
-    systemErrorLab(signal, __LINE__);
-  }//if
+  CRASH_INSERTION(8030);
   if (ERROR_INSERTED(8025)) {
     SET_ERROR_INSERT_VALUE(8026);
     return;
@@ -7232,21 +7232,10 @@ void Dbtc::execNODE_FAILREP(Signal* sign
       }//if
     }//if
     
-    if (getOwnNodeId() != tnewMasterId)
-    {
-      jam();
-      /**
-       * Only master does takeover currently
-       */
-      hostptr.p->m_nf_bits &= ~HostRecord::NF_TAKEOVER;
-    }
-    else
-    {
-      jam();
-      signal->theData[0] = hostptr.i;
-      sendSignal(cownref, GSN_TAKE_OVERTCREQ, signal, 1, JBB);
-    }
-
+    jam();
+    signal->theData[0] = hostptr.i;
+    sendSignal(cownref, GSN_TAKE_OVERTCREQ, signal, 1, JBB);
+    
     checkScanActiveInFailedLqh(signal, 0, hostptr.i);
     checkWaitDropTabFailedLqh(signal, hostptr.i, 0); // nodeid, tableid
     nodeFailCheckTransactions(signal, 0, hostptr.i);
@@ -7270,6 +7259,14 @@ Dbtc::checkNodeFailComplete(Signal* sign
     sendSignal(cdihblockref, GSN_NF_COMPLETEREP, signal, 
 	       NFCompleteRep::SignalLength, JBB);
   }
+
+  CRASH_INSERTION(8058);
+  if (ERROR_INSERTED(8059))
+  {
+    signal->theData[0] = 9999;
+    sendSignalWithDelay(numberToRef(CMVMI, hostptr.i), 
+                        GSN_NDB_TAMPER, signal, 100, 1);
+  }
 }
 
 void Dbtc::checkScanActiveInFailedLqh(Signal* signal, 
@@ -7338,30 +7335,44 @@ Dbtc::nodeFailCheckTransactions(Signal* 
   Ptr<ApiConnectRecord> transPtr;
   Uint32 TtcTimer = ctcTimer;
   Uint32 TapplTimeout = c_appl_timeout_value;
-  for (transPtr.i = transPtrI; transPtr.i < capiConnectFilesize; transPtr.i++)
+  Uint32 RT_BREAK = 64;
+  Uint32 endPtrI = transPtrI + RT_BREAK;
+  if (endPtrI > capiConnectFilesize)
+  {
+    endPtrI = capiConnectFilesize;
+  }
+
+  for (transPtr.i = transPtrI; transPtr.i < endPtrI; transPtr.i++)
   {
     ptrCheckGuard(transPtr, capiConnectFilesize, apiConnectRecord); 
     if (transPtr.p->m_transaction_nodes.get(failedNodeId))
     {
       jam();
-      
+
       // Force timeout regardless of state      
       c_appl_timeout_value = 1;
       setApiConTimer(transPtr.i, TtcTimer - 2, __LINE__);
       timeOutFoundLab(signal, transPtr.i, ZNODEFAIL_BEFORE_COMMIT);
       c_appl_timeout_value = TapplTimeout;
+      
+      transPtr.i++;
+      break;
     }
-    
-    // Send CONTINUEB to continue later
+  }
+  
+  if (transPtr.i == capiConnectFilesize)
+  {
+    jam();
+    checkNodeFailComplete(signal, failedNodeId, 
+                          HostRecord::NF_CHECK_TRANSACTION);
+  }
+  else
+  {
     signal->theData[0] = TcContinueB::ZNF_CHECK_TRANSACTIONS;
-    signal->theData[1] = transPtr.i + 1; // Check next
+    signal->theData[1] = transPtr.i;
     signal->theData[2] = failedNodeId;
     sendSignal(cownref, GSN_CONTINUEB, signal, 3, JBB);
-    return;
   }
-
-  checkNodeFailComplete(signal, failedNodeId, 
-			HostRecord::NF_CHECK_TRANSACTION);
 }
 
 
@@ -7384,7 +7395,23 @@ void Dbtc::execTAKE_OVERTCCONF(Signal* s
   if (signal->getSendersBlockRef() != reference())
   {
     jam();
-    return;
+    /**
+     * Node should be in queue
+     */
+    Uint32 i = 0;
+    Uint32 end = tcNodeFailptr.p->queueIndex;
+    for (; i<end; i++)
+    {
+      jam();
+      if (tcNodeFailptr.p->queueList[i] == hostptr.i)
+      {
+        jam();
+        break;
+      }
+    }
+    ndbrequire(i != end);
+    tcNodeFailptr.p->queueList[i] = tcNodeFailptr.p->queueList[end-1];
+    tcNodeFailptr.p->queueIndex = end - 1;
   }
   
   checkNodeFailComplete(signal, hostptr.i, HostRecord::NF_TAKEOVER);
@@ -7396,7 +7423,9 @@ void Dbtc::execTAKE_OVERTCREQ(Signal* si
   tfailedNodeId = signal->theData[0];
   tcNodeFailptr.i = 0;
   ptrAss(tcNodeFailptr, tcFailRecord);
-  if (tcNodeFailptr.p->failStatus != FS_IDLE) {
+  if (tcNodeFailptr.p->failStatus != FS_IDLE ||
+      cmasterNodeId != getOwnNodeId())
+  {
     jam();
     /*------------------------------------------------------------*/
     /*       WE CAN CURRENTLY ONLY HANDLE ONE TAKE OVER AT A TIME */
@@ -7450,6 +7479,8 @@ void Dbtc::execLQH_TRANSCONF(Signal* sig
   jamEntry();
   LqhTransConf * const lqhTransConf = (LqhTransConf *)&signal->theData[0];
   
+  CRASH_INSERTION(8060);
+
   tcNodeFailptr.i = lqhTransConf->tcRef;
   ptrCheckGuard(tcNodeFailptr, 1, tcFailRecord);
   tnodeid = lqhTransConf->lqhNodeId;
@@ -7521,6 +7552,8 @@ void Dbtc::nodeTakeOverCompletedLab(Sign
 {
   Uint32 guard0;
 
+  CRASH_INSERTION(8061);
+
   hostptr.i = tnodeid;
   ptrCheckGuard(hostptr, chostFilesize, hostRecord);
   hostptr.p->lqhTransStatus = LTS_IDLE;
@@ -7629,6 +7662,8 @@ void Dbtc::completeTransAtTakeOverDoLast
   tcNodeFailptr.p->takeOverProcState[TtakeOverInd] = ZTAKE_OVER_IDLE;
   tcNodeFailptr.p->completedTakeOver++;
 
+  CRASH_INSERTION(8062);
+
   if (tcNodeFailptr.p->completedTakeOver == cnoParallelTakeOver) {
     jam();
     /*------------------------------------------------------------*/
@@ -9521,7 +9556,7 @@ void Dbtc::execDIGETPRIMCONF(Signal* sig
      * TC - transaction hinting / scan partition pruning has failed
      * Used by testPartitioning.cpp
      */
-    ndbassert(false);
+    CRASH_INSERTION(8050);
   }
 
   ndbrequire(scanFragptr.p->scanFragState == ScanFragRec::WAIT_GET_PRIMCONF);

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2008-04-03 12:46:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2008-05-29 15:58:58 +0000
@@ -2967,10 +2967,14 @@ private:
   Fragoperrec *fragoperrec;
   Uint32 cfirstfreeFragopr;
   Uint32 cnoOfFragoprec;
+  RSS_OP_COUNTER(cnoOfFreeFragoprec);
+  RSS_OP_SNAPSHOT(cnoOfFreeFragoprec);
 
   Fragrecord *fragrecord;
   Uint32 cfirstfreefrag;
   Uint32 cnoOfFragrec;
+  RSS_OP_COUNTER(cnoOfFreeFragrec);
+  RSS_OP_SNAPSHOT(cnoOfFreeFragrec);
 
   AlterTabOperation *alterTabOperRec;
   Uint32 cfirstfreeAlterTabOp;
@@ -2993,6 +2997,8 @@ private:
 
   TableDescriptor *tableDescriptor;
   Uint32 cnoOfTabDescrRec;
+  RSS_OP_COUNTER(cnoOfFreeTabDescrRec);
+  RSS_OP_SNAPSHOT(cnoOfFreeTabDescrRec);
   
   Uint32 cdata[32];
   Uint32 cdataPages[16];

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp	2007-06-12 07:39:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp	2008-05-29 15:58:58 +0000
@@ -259,6 +259,22 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal
              max_loop);
   }
 #endif
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceSnapshot)
+  {
+    RSS_OP_SNAPSHOT_SAVE(cnoOfFreeFragoprec);
+    RSS_OP_SNAPSHOT_SAVE(cnoOfFreeFragrec);
+    RSS_OP_SNAPSHOT_SAVE(cnoOfFreeTabDescrRec);
+    return;
+  }
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceCheckLeak)
+  {
+    RSS_OP_SNAPSHOT_CHECK(cnoOfFreeFragoprec);
+    RSS_OP_SNAPSHOT_CHECK(cnoOfFreeFragrec);
+    RSS_OP_SNAPSHOT_CHECK(cnoOfFreeTabDescrRec);
+    return;
+  }
 }//Dbtup::execDUMP_STATE_ORD()
 
 /* ---------------------------------------------------------------- */

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2007-06-14 17:09:19 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2008-05-29 15:58:58 +0000
@@ -117,6 +117,10 @@ Dbtup::Dbtup(Block_context& ctx, Pgman* 
   
   initData();
   CLEAR_ERROR_INSERT_VALUE;
+
+  RSS_OP_COUNTER_INIT(cnoOfFreeFragoprec);
+  RSS_OP_COUNTER_INIT(cnoOfFreeFragrec);
+  RSS_OP_COUNTER_INIT(cnoOfFreeTabDescrRec);
 }//Dbtup::Dbtup()
 
 Dbtup::~Dbtup() 
@@ -762,6 +766,7 @@ void Dbtup::releaseFragrec(FragrecordPtr
 {
   regFragPtr.p->nextfreefrag = cfirstfreefrag;
   cfirstfreefrag = regFragPtr.i;
+  RSS_OP_FREE(cnoOfFreeFragrec);
 }//Dbtup::releaseFragrec()
 
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2008-03-19 12:57:01 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2008-05-29 15:58:58 +0000
@@ -266,6 +266,7 @@ void Dbtup::seizeFragrecord(FragrecordPt
   ptrCheckGuard(regFragPtr, cnoOfFragrec, fragrecord);
   cfirstfreefrag= regFragPtr.p->nextfreefrag;
   regFragPtr.p->nextfreefrag= RNIL;
+  RSS_OP_ALLOC(cnoOfFreeFragrec);
 }
 
 void Dbtup::seizeFragoperrec(FragoperrecPtr& fragOperPtr) 
@@ -275,6 +276,7 @@ void Dbtup::seizeFragoperrec(Fragoperrec
   cfirstfreeFragopr = fragOperPtr.p->nextFragoprec;
   fragOperPtr.p->nextFragoprec = RNIL;
   fragOperPtr.p->inUse = true;
+  RSS_OP_ALLOC(cnoOfFreeFragoprec);
 }//Dbtup::seizeFragoperrec()
 
 void Dbtup::seizeAlterTabOperation(AlterTabOperationPtr& alterTabOpPtr)
@@ -314,6 +316,17 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
   fragOperPtr.p->attributeCount--;
   const bool lastAttr = (fragOperPtr.p->attributeCount == 0);
 
+  if (ERROR_INSERTED(4009) && regTabPtr.p->fragid[0] == fragId &&
attrId == 0||
+      ERROR_INSERTED(4010) && regTabPtr.p->fragid[0] == fragId &&
lastAttr ||
+      ERROR_INSERTED(4011) && regTabPtr.p->fragid[1] == fragId &&
attrId == 0||
+      ERROR_INSERTED(4012) && regTabPtr.p->fragid[1] == fragId &&
lastAttr) {
+    jam();
+    terrorCode = 1;
+    addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
+    CLEAR_ERROR_INSERT_VALUE;
+    return;
+  }
+
   if (regTabPtr.p->tableStatus != DEFINING)
   {
     ndbrequire(regTabPtr.p->tableStatus == DEFINED);
@@ -455,17 +468,6 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* 
                    fragOperPtr.p->charsetIndex, attrDes2);
   setTabDescrWord(firstTabDesIndex + 1, attrDes2);
 
-  if (ERROR_INSERTED(4009) && regTabPtr.p->fragid[0] == fragId &&
attrId == 0||
-      ERROR_INSERTED(4010) && regTabPtr.p->fragid[0] == fragId &&
lastAttr ||
-      ERROR_INSERTED(4011) && regTabPtr.p->fragid[1] == fragId &&
attrId == 0||
-      ERROR_INSERTED(4012) && regTabPtr.p->fragid[1] == fragId &&
lastAttr) {
-    jam();
-    terrorCode = 1;
-    addattrrefuseLab(signal, regFragPtr, fragOperPtr, regTabPtr.p, fragId);
-    CLEAR_ERROR_INSERT_VALUE;
-    return;
-  }
-
 /* **************************************************************** */
 /* **************          TUP_ADD_ATTCONF       ****************** */
 /* **************************************************************** */
@@ -1359,7 +1361,6 @@ void Dbtup::addattrrefuseLab(Signal* sig
   deleteFragTab(regTabPtr, fragId);
   releaseFragrec(regFragPtr);
   releaseTabDescr(regTabPtr);
-  initTab(regTabPtr);
 
   signal->theData[0]= fragOperPtr.p->lqhPtrFrag;
   signal->theData[1]= terrorCode;
@@ -1372,10 +1373,24 @@ void Dbtup::fragrefuse4Lab(Signal* signa
                            FragoperrecPtr fragOperPtr,
                            FragrecordPtr regFragPtr,
                            Tablerec* const regTabPtr,
-                           Uint32 fragId) 
+                           Uint32 fragId)
 {
+  bool found = false;
+  for (Uint32 i = 0; i < MAX_FRAG_PER_NODE; i++) 
+  {
+    jam();
+    if (regTabPtr->fragid[i] == fragId) 
+    {
+      jam();
+      ndbrequire(regTabPtr->fragrec[i] == regFragPtr.i);
+      regTabPtr->fragid[i] = RNIL;
+      regTabPtr->fragrec[i] = RNIL;
+      found = true;
+      break;
+    }
+  }
+  ndbrequire(found);
   fragrefuse3Lab(signal, fragOperPtr, regFragPtr, regTabPtr, fragId);
-  initTab(regTabPtr);
 }
 
 void Dbtup::fragrefuse3Lab(Signal* signal,
@@ -1413,6 +1428,7 @@ void Dbtup::releaseFragoperrec(Fragoperr
   fragOperPtr.p->inUse = false;
   fragOperPtr.p->nextFragoprec = cfirstfreeFragopr;
   cfirstfreeFragopr = fragOperPtr.i;
+  RSS_OP_FREE(cnoOfFreeFragoprec);
 }//Dbtup::releaseFragoperrec()
 
 void Dbtup::releaseAlterTabOpRec(AlterTabOperationPtr regAlterTabOpPtr)
@@ -1466,6 +1482,19 @@ Dbtup::execDROP_TAB_REQ(Signal* signal)
   
   tabPtr.p->m_dropTable.tabUserRef = req->senderRef;
   tabPtr.p->m_dropTable.tabUserPtr = req->senderData;
+
+  if (tabPtr.p->tableStatus == NOT_DEFINED) 
+  {
+    jam();
+    DropTabConf * const dropConf= (DropTabConf *)signal->getDataPtrSend();
+    dropConf->senderRef= reference();
+    dropConf->senderData= tabPtr.p->m_dropTable.tabUserPtr;
+    dropConf->tableId= tabPtr.i;
+    sendSignal(tabPtr.p->m_dropTable.tabUserRef, GSN_DROP_TAB_CONF,
+               signal, DropTabConf::SignalLength, JBB);
+    return;
+  }
+
   tabPtr.p->tableStatus = DROPPING;
 
   signal->theData[0]= ZREL_FRAG;

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2008-02-03 11:32:08 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp	2008-05-29 15:58:58 +0000
@@ -144,6 +144,7 @@ Dbtup::setTabDescrWord(Uint32 index, Uin
 void Dbtup::insertTdArea(Uint32 tabDesRef, Uint32 list) 
 {
   ndbrequire(list < 16);
+  RSS_OP_FREE_X(cnoOfFreeTabDescrRec, 1 << list);
   setTabDescrWord(tabDesRef + ZTD_FL_HEADER, ZTD_TYPE_FREE);
   setTabDescrWord(tabDesRef + ZTD_FL_NEXT, cfreeTdList[list]);
   if (cfreeTdList[list] != RNIL) {
@@ -217,6 +218,8 @@ void Dbtup::itdaMergeTabDescr(Uint32& re
 void Dbtup::removeTdArea(Uint32 tabDesRef, Uint32 list) 
 {
   ndbrequire(list < 16);
+  RSS_OP_ALLOC_X(cnoOfFreeTabDescrRec, 1 << list);
+
   Uint32 tabDescrNextPtr = getTabDescrWord(tabDesRef + ZTD_FL_NEXT);
   Uint32 tabDescrPrevPtr = getTabDescrWord(tabDesRef + ZTD_FL_PREV);
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Makefile.am'
--- a/storage/ndb/src/kernel/blocks/dbtup/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Makefile.am	2008-04-25 06:32:23 +0000
@@ -20,9 +20,9 @@ EXTRA_PROGRAMS = test_varpage
 test_varpage_SOURCES = test_varpage.cpp tuppage.cpp
 test_varpage_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
-  $(top_builddir)/mysys/libmysys.a \
-  $(top_builddir)/dbug/libdbug.a \
-  $(top_builddir)/strings/libmystrings.a
+  $(top_builddir)/mysys/libmysyslt.la \
+  $(top_builddir)/dbug/libdbuglt.la \
+  $(top_builddir)/strings/libmystringslt.la
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp	2008-05-30 06:33:46 +0000
@@ -451,6 +451,7 @@ private:
   };
   typedef Ptr<Index> IndexPtr;
   ArrayPool<Index> c_indexPool;
+  RSS_AP_SNAPSHOT(c_indexPool);
 
   /*
    * Fragment of an index, as known to DIH/TC.  Represents the two
@@ -481,6 +482,7 @@ private:
   };
   typedef Ptr<Frag> FragPtr;
   ArrayPool<Frag> c_fragPool;
+  RSS_AP_SNAPSHOT(c_fragPool);
 
   /*
    * Fragment metadata operation.
@@ -500,6 +502,7 @@ private:
   };
   typedef Ptr<FragOp> FragOpPtr;
   ArrayPool<FragOp> c_fragOpPool;
+  RSS_AP_SNAPSHOT(c_fragOpPool);
 
   // node handles
 

=== modified file 'storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp	2008-05-30 06:33:46 +0000
@@ -55,6 +55,20 @@ Dbtux::execDUMP_STATE_ORD(Signal* signal
     abort();
   }
 #endif
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceSnapshot)
+  {
+    RSS_AP_SNAPSHOT_SAVE(c_indexPool);
+    RSS_AP_SNAPSHOT_SAVE(c_fragPool);
+    RSS_AP_SNAPSHOT_SAVE(c_fragOpPool);
+  }
+
+  if (signal->theData[0] == DumpStateOrd::SchemaResourceCheckLeak)
+  {
+    RSS_AP_SNAPSHOT_CHECK(c_indexPool);
+    RSS_AP_SNAPSHOT_CHECK(c_fragPool);
+    RSS_AP_SNAPSHOT_CHECK(c_fragOpPool);
+  }
 }
 
 #ifdef VM_TRACE

=== modified file 'storage/ndb/src/kernel/blocks/lgman.cpp'
--- a/storage/ndb/src/kernel/blocks/lgman.cpp	2008-02-08 14:21:07 +0000
+++ b/storage/ndb/src/kernel/blocks/lgman.cpp	2008-04-22 19:36:05 +0000
@@ -30,7 +30,7 @@
 #include "dbtup/Dbtup.hpp"
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 #include <record_types.hpp>
 
@@ -2434,9 +2434,9 @@ Lgman::find_log_head_in_file(Signal* sig
     infoEvent("Undo head - %s page: %d lsn: %lld",
 	      fs->get_filename(file_ptr.p->m_fd), 
 	      tail, file_ptr.p->m_online.m_lsn);
-    g_eventLogger.info("Undo head - %s page: %d lsn: %lld",
-		       fs->get_filename(file_ptr.p->m_fd), 
-		       tail, file_ptr.p->m_online.m_lsn);
+    g_eventLogger->info("Undo head - %s page: %d lsn: %lld",
+                        fs->get_filename(file_ptr.p->m_fd),
+                        tail, file_ptr.p->m_online.m_lsn);
     
     for(files.prev(file_ptr); !file_ptr.isNull(); files.prev(file_ptr))
     {
@@ -2444,9 +2444,9 @@ Lgman::find_log_head_in_file(Signal* sig
 		fs->get_filename(file_ptr.p->m_fd), 
 		file_ptr.p->m_online.m_lsn);
 
-      g_eventLogger.info("   - next - %s(%lld)", 
-			 fs->get_filename(file_ptr.p->m_fd), 
-			 file_ptr.p->m_online.m_lsn);
+      g_eventLogger->info("   - next - %s(%lld)", 
+                          fs->get_filename(file_ptr.p->m_fd),
+                          file_ptr.p->m_online.m_lsn);
     }
   }
   
@@ -3001,17 +3001,17 @@ Lgman::stop_run_undo_log(Signal* signal)
 	m_file_pool.getPtr(tf, tail.m_ptr_i);
 	m_file_pool.getPtr(hf,  ptr.p->m_file_pos[HEAD].m_ptr_i);
 	infoEvent("Logfile group: %d ", ptr.p->m_logfile_group_id);
-	g_eventLogger.info("Logfile group: %d ", ptr.p->m_logfile_group_id);
+        g_eventLogger->info("Logfile group: %d ", ptr.p->m_logfile_group_id);
 	infoEvent("  head: %s page: %d",
-		  fs->get_filename(hf.p->m_fd), 
-		  ptr.p->m_file_pos[HEAD].m_idx);
-	g_eventLogger.info("  head: %s page: %d",
-			   fs->get_filename(hf.p->m_fd), 
-			   ptr.p->m_file_pos[HEAD].m_idx);
+                  fs->get_filename(hf.p->m_fd),
+                  ptr.p->m_file_pos[HEAD].m_idx);
+        g_eventLogger->info("  head: %s page: %d",
+                            fs->get_filename(hf.p->m_fd),
+                            ptr.p->m_file_pos[HEAD].m_idx);
 	infoEvent("  tail: %s page: %d",
 		  fs->get_filename(tf.p->m_fd), tail.m_idx);
-	g_eventLogger.info("  tail: %s page: %d",
-			   fs->get_filename(tf.p->m_fd), tail.m_idx);
+        g_eventLogger->info("  tail: %s page: %d",
+                            fs->get_filename(tf.p->m_fd), tail.m_idx);
       }
     }
     
@@ -3033,7 +3033,7 @@ Lgman::stop_run_undo_log(Signal* signal)
   }
   
   infoEvent("Flushing page cache after undo completion");
-  g_eventLogger.info("Flushing page cache after undo completion");
+  g_eventLogger->info("Flushing page cache after undo completion");
 
   /**
    * Start flushing pages (local, LCP)
@@ -3098,7 +3098,7 @@ Lgman::execEND_LCP_CONF(Signal* signal)
     ptr.p->m_last_synced_lsn = last_lsn;
   
   infoEvent("Flushing complete");
-  g_eventLogger.info("Flushing complete");
+  g_eventLogger->info("Flushing complete");
 
   signal->theData[0] = reference();
   sendSignal(DBLQH_REF, GSN_START_RECCONF, signal, 1, JBB);

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2007-02-26 07:12:02 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2008-04-25 09:17:15 +0000
@@ -47,6 +47,7 @@
 //------- OTHERS ---------------------------------------------
 #define ZSTARTUP  1
 #define ZSHUTDOWN 2
+#define ZBLOCK_STTOR 3
 
 #define ZSIZE_NDB_BLOCKS_REC 16 /* MAX BLOCKS IN NDB                    */
 #define ZSIZE_SYSTAB 2048
@@ -382,6 +383,10 @@ private:
   void execREAD_CONFIG_CONF(Signal*);
 
   frien