List:Commits« Previous MessageNext Message »
From:jonas Date:August 7 2008 3:39pm
Subject:bzr push into mysql-6.0-ndb branch (jonas:2655) Bug#36547
View as plain text  
 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*);
 
   friend struct UpgradeStartup;
+
+#ifdef ERROR_INSERT
+  Uint32 c_error_insert_extra;
+#endif
 };
 
 #endif

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2007-09-13 11:59:48 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2008-04-25 10:59:17 +0000
@@ -159,6 +159,18 @@ void Ndbcntr::execCONTINUEB(Signal* sign
     jam();
     c_stopRec.checkTimeout(signal);
     break;
+  case ZBLOCK_STTOR:
+    if (ERROR_INSERTED(1002))
+    {
+      signal->theData[0] = ZBLOCK_STTOR;
+      sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 1);
+      return;
+    }
+    else
+    {
+      c_missra.sendNextSTTOR(signal);
+    }
+    return;
   default:
     jam();
     systemErrorLab(signal, __LINE__);
@@ -2084,6 +2096,21 @@ Ndbcntr::execDUMP_STATE_ORD(Signal* sign
     return;
   }
 
+  if (arg == 71)
+  {
+#ifdef ERROR_INSERT
+    if (signal->getLength() == 2)
+    {
+      c_error_insert_extra = signal->theData[1];
+      SET_ERROR_INSERT_VALUE(1002);
+    }
+    else if (ERROR_INSERTED(1002))
+    {
+      CLEAR_ERROR_INSERT_VALUE;
+    }
+#endif
+  }
+
 }//Ndbcntr::execDUMP_STATE_ORD()
 
 void Ndbcntr::updateNodeState(Signal* signal, const NodeState& newState) const{
@@ -2880,6 +2907,16 @@ void Ndbcntr::Missra::sendNextSTTOR(Sign
   for(; currentStartPhase < 255 ;
       currentStartPhase++, g_currentStartPhase = currentStartPhase){
     jam();
+
+#ifdef ERROR_INSERT
+    if (cntr.cerrorInsert == 1002 &&
+        cntr.c_error_insert_extra == currentStartPhase)
+    {
+      signal->theData[0] = ZBLOCK_STTOR;
+      cntr.sendSignalWithDelay(cntr.reference(), GSN_CONTINUEB, signal, 100, 1);
+      return;
+    }
+#endif
     
     const Uint32 start = currentBlockIndex;
 

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2008-02-20 09:04:29 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2008-04-25 09:17:15 +0000
@@ -421,6 +421,7 @@ private:
   Uint16 cnoPrepFailedNodes;
   Uint16 cnoCommitFailedNodes;
   Uint16 cactivateApiCheck;
+  Uint16 c_allow_api_connect;
   UintR chbApiDelay;
 
   UintR ccommitFailureNr;

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2008-02-20 09:04:29 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2008-04-25 09:17:15 +0000
@@ -252,15 +252,34 @@ Qmgr::execSTART_ORD(Signal* signal)
   {
     ptrAss(nodePtr, nodeRec);
     nodePtr.p->ndynamicId = 0;	
-    if(getNodeInfo(nodePtr.i).m_type == NodeInfo::DB)
-    {
+    Uint32 cnt = 0;
+    Uint32 type = getNodeInfo(nodePtr.i).m_type;
+    switch(type){
+    case NodeInfo::DB:
+      jam();
       nodePtr.p->phase = ZINIT;
       c_definedNodes.set(nodePtr.i);
-    } else {
+      break;
+    case NodeInfo::API:
+      jam();
+      nodePtr.p->phase = ZAPI_INACTIVE;
+      break;
+    case NodeInfo::MGM:
+      jam();
+      /**
+       * Enable communication to MGM direcly
+       *   by setting ZFAIL_CLOSING (picked up in checkStartInterface)
+       */
+      cnt = 3;
+      nodePtr.p->phase = ZFAIL_CLOSING;
+      nodePtr.p->failState = NORMAL;
+      break;
+    default:
+      jam();
       nodePtr.p->phase = ZAPI_INACTIVE;
     }
     
-    setNodeInfo(nodePtr.i).m_heartbeat_cnt= 0;
+    setNodeInfo(nodePtr.i).m_heartbeat_cnt = cnt;
     nodePtr.p->sendPrepFailReqStatus = Q_NOT_ACTIVE;
     nodePtr.p->sendCommitFailReqStatus = Q_NOT_ACTIVE;
     nodePtr.p->sendPresToStatus = Q_NOT_ACTIVE;
@@ -313,6 +332,30 @@ void Qmgr::execSTTOR(Signal* signal) 
       }
     }
     break;
+  case 8:{
+    /**
+     * Enable communication to all API nodes by setting state
+     *   to ZFAIL_CLOSING (which will make it auto-open in checkStartInterface)
+     */
+    c_allow_api_connect = 1;
+    NodeRecPtr nodePtr;
+    for (nodePtr.i = 1; nodePtr.i < MAX_NODES; nodePtr.i++)
+    {
+      jam();
+      Uint32 type = getNodeInfo(nodePtr.i).m_type;
+      if (type != NodeInfo::API)
+        continue;
+
+      ptrAss(nodePtr, nodeRec);
+      if (nodePtr.p->phase == ZAPI_INACTIVE)
+      {
+        jam();
+        setNodeInfo(nodePtr.i).m_heartbeat_cnt = 3;
+        nodePtr.p->phase = ZFAIL_CLOSING;
+        nodePtr.p->failState = NORMAL;
+      }
+    }
+  }
   }
   
   sendSttorryLab(signal);
@@ -325,8 +368,9 @@ void Qmgr::sendSttorryLab(Signal* signal
 /*< STTORRY                  <*/
 /****************************<*/
   signal->theData[3] = 7;
-  signal->theData[4] = 255;
-  sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 5, JBB);
+  signal->theData[4] = 8;
+  signal->theData[5] = 255;
+  sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 6, JBB);
   return;
 }//Qmgr::sendSttorryLab()
 
@@ -2178,6 +2222,7 @@ void Qmgr::initData(Signal* signal) 
   cneighbourl = ZNIL;
   cdelayRegreq = ZDELAY_REGREQ;
   cactivateApiCheck = 0;
+  c_allow_api_connect = 0;
   ctoStatus = Q_NOT_ACTIVE;
 
   interface_check_timer.setDelay(1000);
@@ -2493,13 +2538,34 @@ void Qmgr::checkStartInterface(Signal* s
 	 * IS COMPLETE.
 	 *-------------------------------------------------------------------*/
         nodePtr.p->failState = NORMAL;
-        if (getNodeInfo(nodePtr.i).m_type != NodeInfo::DB){
+        Uint32 type = getNodeInfo(nodePtr.i).m_type;
+        switch(type){
+        case NodeInfo::DB:
+          jam();
+          nodePtr.p->phase = ZINIT;
+          break;
+        case NodeInfo::MGM:
           jam();
           nodePtr.p->phase = ZAPI_INACTIVE;
-        } else {
+          break;
+        case NodeInfo::API:
           jam();
-          nodePtr.p->phase = ZINIT;
-        }//if
+          if (c_allow_api_connect)
+          {
+            jam();
+            nodePtr.p->phase = ZAPI_INACTIVE;
+            break;
+          }
+          else
+          {
+            /**
+             * Dont allow API node to connect before c_allow_api_connect
+             */
+            jam();
+            setNodeInfo(nodePtr.i).m_heartbeat_cnt = 3;
+            continue;
+          }
+        }
 
         setNodeInfo(nodePtr.i).m_heartbeat_cnt= 0;
         signal->theData[0] = 0;
@@ -2623,28 +2689,37 @@ void Qmgr::execNDB_FAILCONF(Signal* sign
     progError(__LINE__, 0, buf);
     systemErrorLab(signal, __LINE__);
   }//if
-  if (cpresident == getOwnNodeId()) {
+
+  if (cpresident == getOwnNodeId()) 
+  {
     jam();
-    /** 
-     * Prepare a NFCompleteRep and send to all connected API's
-     * They can then abort all transaction waiting for response from 
-     * the failed node
-     */
-    NFCompleteRep * const nfComp = (NFCompleteRep *)&signal->theData[0];
-    nfComp->blockNo = QMGR_REF;
-    nfComp->nodeId = getOwnNodeId();
-    nfComp->failedNodeId = failedNodePtr.i;
+    
+    CRASH_INSERTION(936);
+  }
 
-    for (nodePtr.i = 1; nodePtr.i < MAX_NODES; nodePtr.i++) {
+  /** 
+   * Prepare a NFCompleteRep and send to all connected API's
+   * They can then abort all transaction waiting for response from 
+   * the failed node
+   *
+   * NOTE: This is sent from all nodes, as otherwise we would need
+   *       take-over if cpresident dies befor sending this
+   */
+  NFCompleteRep * const nfComp = (NFCompleteRep *)&signal->theData[0];
+  nfComp->blockNo = QMGR_REF;
+  nfComp->nodeId = getOwnNodeId();
+  nfComp->failedNodeId = failedNodePtr.i;
+  
+  for (nodePtr.i = 1; nodePtr.i < MAX_NODES; nodePtr.i++) 
+  {
+    jam();
+    ptrAss(nodePtr, nodeRec);
+    if (nodePtr.p->phase == ZAPI_ACTIVE){
       jam();
-      ptrAss(nodePtr, nodeRec);
-      if (nodePtr.p->phase == ZAPI_ACTIVE){
-        jam();
-        sendSignal(nodePtr.p->blockRef, GSN_NF_COMPLETEREP, signal, 
-                   NFCompleteRep::SignalLength, JBA);
-      }//if
-    }//for
-  }
+      sendSignal(nodePtr.p->blockRef, GSN_NF_COMPLETEREP, signal, 
+                 NFCompleteRep::SignalLength, JBA);
+    }//if
+  }//for
   return;
 }//Qmgr::execNDB_FAILCONF()
 
@@ -3695,9 +3770,17 @@ void Qmgr::execCOMMIT_FAILREQ(Signal* si
       jam();
       NdbNodeBitmask::set(nodeFail->theNodes, ccommitFailedNodes[i]);
     }//if	
-    sendSignal(NDBCNTR_REF, GSN_NODE_FAILREP, signal, 
-	       NodeFailRep::SignalLength, JBB);
-
+    
+    if (ERROR_INSERTED(936))
+    {
+      sendSignalWithDelay(NDBCNTR_REF, GSN_NODE_FAILREP, signal, 
+                          200, NodeFailRep::SignalLength);
+    }
+    else
+    {
+      sendSignal(NDBCNTR_REF, GSN_NODE_FAILREP, signal, 
+                 NodeFailRep::SignalLength, JBB);
+    }
     guard0 = cnoCommitFailedNodes - 1;
     arrGuard(guard0, MAX_NDB_NODES);
     /**--------------------------------------------------------------------

=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2008-02-20 20:59:22 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp	2008-05-21 07:18:45 +0000
@@ -53,7 +53,7 @@
 #include <../dbdih/Dbdih.hpp>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 //#define HANDOVER_DEBUG
 //#define NODEFAIL_DEBUG
@@ -2383,6 +2383,16 @@ Suma::execSUB_START_REQ(Signal* signal){
                     senderRef, senderData, SubStartRef::OutOfSubOpRecords);
     return;
   }
+
+  if (! check_sub_start(subscriberRef))
+  {
+    jam();
+    c_subscriberPool.release(subbPtr);
+    c_subOpPool.release(subOpPtr);
+    sendSubStartRef(signal,
+                    senderRef, senderData, SubStartRef::NodeDied);
+    return;
+  }
   
   // setup subscriber record
   subbPtr.p->m_senderRef  = subscriberRef;
@@ -2587,6 +2597,19 @@ Suma::execCREATE_TRIG_REF(Signal* signal
   drop_triggers(signal, subPtr);
 }
 
+bool
+Suma::check_sub_start(Uint32 subscriberRef)
+{
+  Uint32 nodeId = refToNode(subscriberRef);
+  bool startme = c_startup.m_restart_server_node_id;
+  bool handover = c_startup.m_wait_handover;
+  bool connected = 
+    c_failedApiNodes.get(nodeId) == false && 
+    c_connected_nodes.get(nodeId);
+  
+  return (startme || handover || connected);
+}
+
 void
 Suma::report_sub_start_conf(Signal* signal, Ptr<Subscription> subPtr)
 {
@@ -2607,9 +2630,8 @@ Suma::report_sub_start_conf(Signal* sign
       c_subscriberPool.getPtr(ptr, subOpPtr.p->m_subscriberRef);
 
       Uint32 nodeId = refToNode(ptr.p->m_senderRef);
-      if (c_startup.m_restart_server_node_id ||
-          (c_failedApiNodes.get(nodeId) == false &&
-           c_connected_nodes.get(nodeId)))
+      
+      if (check_sub_start(ptr.p->m_senderRef))
       {
         SubStartConf* conf = (SubStartConf*)signal->getDataPtrSend();
         conf->senderRef       = reference();
@@ -2636,8 +2658,7 @@ Suma::report_sub_start_conf(Signal* sign
       else
       {
         jam();
-        g_eventLogger.warning("Node %u failed in report_sub_start_conf",
-                              nodeId);
+        
         sendSubStartRef(signal,
                         senderRef, senderData, SubStartRef::NodeDied);
 
@@ -3754,8 +3775,8 @@ Suma::execSUB_GCP_COMPLETE_REP(Signal* s
     {
       char buf[100];
       c_subscriber_nodes.getText(buf);
-      g_eventLogger.error("c_gcp_list.seize() failed: gci: %d nodes: %s",
-                          gci, buf);
+      g_eventLogger->error("c_gcp_list.seize() failed: gci: %d nodes: %s",
+                           gci, buf);
     }
   }
   
@@ -4009,9 +4030,9 @@ Suma::execSUB_GCP_COMPLETE_ACK(Signal* s
   
   if(gcp.isNull())
   {
-    g_eventLogger.warning("ACK wo/ gcp record (gci: %u/%u) ref: %.8x from: %.8x",
-                          Uint32(gci >> 32), Uint32(gci),
-                          senderRef, signal->getSendersBlockRef());
+    g_eventLogger->warning("ACK wo/ gcp record (gci: %u/%u) ref: %.8x from: %.8x",
+                           Uint32(gci >> 32), Uint32(gci),
+                           senderRef, signal->getSendersBlockRef());
   }
   else
   {

=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.hpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2008-02-20 15:15:31 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.hpp	2008-05-21 07:18:45 +0000
@@ -376,7 +376,6 @@ public:
 
   void completeSubRemove(SubscriptionPtr subPtr);
   
-
   void send_sub_start_stop_event(Signal *signal,
                                  Ptr<Subscriber> ptr,
                                  NdbDictionary::Event::_TableEvent event,
@@ -389,6 +388,7 @@ public:
   void drop_triggers(Signal*, Ptr<Subscription>);
   void drop_triggers_complete(Signal*, Ptr<Subscription>);
 
+  bool check_sub_start(Uint32 subscriberRef);
   void report_sub_start_conf(Signal* signal, Ptr<Subscription> subPtr);
   void report_sub_start_ref(Signal* signal, Ptr<Subscription> subPtr, Uint32);
 

=== modified file 'storage/ndb/src/kernel/error/ErrorReporter.cpp'
--- a/storage/ndb/src/kernel/error/ErrorReporter.cpp	2007-02-05 15:44:59 +0000
+++ b/storage/ndb/src/kernel/error/ErrorReporter.cpp	2008-04-22 19:36:05 +0000
@@ -40,7 +40,7 @@ static void dumpJam(FILE* jamStream, 
 		    Uint32 thrdTheEmulatedJamIndex, 
 		    Uint8 thrdTheEmulatedJam[]);
 
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 const char*
 ErrorReporter::formatTimeStampString(){
   TimeModule DateTime;          /* To create "theDateTimeString" */
@@ -197,8 +197,8 @@ ErrorReporter::handleError(int messageID
   WriteMessage(messageID, problemData,
 	       objRef, theEmulatedJamIndex, theEmulatedJam);
 
-  g_eventLogger.info(problemData);
-  g_eventLogger.info(objRef);
+  g_eventLogger->info(problemData);
+  g_eventLogger->info(objRef);
 
   childReportError(messageID);
 

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2007-01-06 00:21:39 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2008-04-22 19:36:05 +0000
@@ -44,7 +44,7 @@
 #include <sys/processor.h> // For system informatio
 #endif
 
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 extern NdbMutex * theShutdownMutex;
 
 void catchsigs(bool ignore); // for process signal handling
@@ -180,8 +180,8 @@ int reportShutdown(class Configuration *
 
   { // Log event
     const EventReport * const eventReport = (EventReport *)&theData[0];
-    g_eventLogger.log(eventReport->getEventType(), theData, length,
-		      eventReport->getNodeId(), 0);
+    g_eventLogger->log(eventReport->getEventType(), theData, length,
+                       eventReport->getNodeId(), 0);
   }
 
   for (unsigned n = 0; n < config->m_mgmds.size(); n++)
@@ -208,13 +208,13 @@ handle_error:
       BaseString tmp(ndb_mgm_get_latest_error_msg(h));
       tmp.append(" : ");
       tmp.append(ndb_mgm_get_latest_error_desc(h));
-      g_eventLogger.warning("Unable to report shutdown reason to %s: %s",
-			    config->m_mgmds[n].c_str(), tmp.c_str());
+      g_eventLogger->warning("Unable to report shutdown reason to %s: %s",
+                             config->m_mgmds[n].c_str(), tmp.c_str());
     }
     else
     {
-      g_eventLogger.error("Unable to report shutdown reason to %s",
-			  config->m_mgmds[n].c_str());
+      g_eventLogger->error("Unable to report shutdown reason to %s",
+                           config->m_mgmds[n].c_str());
     }
 do_next:
     if (h)
@@ -230,14 +230,14 @@ int main(int argc, char** argv)
 {
   NDB_INIT(argv[0]);
   // Print to stdout/console
-  g_eventLogger.createConsoleHandler();
-  g_eventLogger.setCategory("ndbd");
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_INFO);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_CRITICAL);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_WARNING);
+  g_eventLogger->createConsoleHandler();
+  g_eventLogger->setCategory("ndbd");
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_INFO);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_CRITICAL);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_ERROR);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_WARNING);
 
-  g_eventLogger.m_logLevel.setLogLevel(LogLevel::llStartUp, 15);
+  g_eventLogger->m_logLevel.setLogLevel(LogLevel::llStartUp, 15);
 
   globalEmulatorData.create();
 
@@ -278,21 +278,21 @@ int main(int argc, char** argv)
     int filedes[2];
     if (pipe(filedes))
     {
-      g_eventLogger.error("pipe() failed with errno=%d (%s)",
-			  errno, strerror(errno));
+      g_eventLogger->error("pipe() failed with errno=%d (%s)",
+                           errno, strerror(errno));
       return 1;
     }
     else
     {
       if (!(child_info_file_w= fdopen(filedes[1],"w")))
       {
-	g_eventLogger.error("fdopen() failed with errno=%d (%s)",
-			    errno, strerror(errno));
+        g_eventLogger->error("fdopen() failed with errno=%d (%s)",
+                             errno, strerror(errno));
       }
       if (!(child_info_file_r= fdopen(filedes[0],"r")))
       {
-	g_eventLogger.error("fdopen() failed with errno=%d (%s)",
-			    errno, strerror(errno));
+        g_eventLogger->error("fdopen() failed with errno=%d (%s)",
+                             errno, strerror(errno));
       }
     }
 
@@ -319,7 +319,7 @@ int main(int argc, char** argv)
     if(WIFEXITED(status)){
       switch(WEXITSTATUS(status)){
       case NRT_Default:
-	g_eventLogger.info("Angel shutting down");
+        g_eventLogger->info("Angel shutting down");
 	reportShutdown(theConfig, 0, 0);
 	exit(0);
 	break;
@@ -360,7 +360,7 @@ int main(int argc, char** argv)
       else
       {
 	signum = 127;
-	g_eventLogger.info("Unknown exit reason. Stopped.");
+        g_eventLogger->info("Unknown exit reason. Stopped.");
       }
       if(theConfig->stopOnError()){
 	/**
@@ -381,25 +381,25 @@ int main(int argc, char** argv)
       /**
        * Error shutdown && stopOnError()
        */
-      g_eventLogger.alert("Ndbd has failed %u consecutive startups. "
-			  "Not restarting", failed_startups);
+      g_eventLogger->alert("Ndbd has failed %u consecutive startups. "
+                           "Not restarting", failed_startups);
       reportShutdown(theConfig, error_exit, 0);
       exit(0);
     }
     failed_startup_flag = false;
     reportShutdown(theConfig, error_exit, 1);
-    g_eventLogger.info("Ndb has terminated (pid %d) restarting", child);
+    g_eventLogger->info("Ndb has terminated (pid %d) restarting", child);
     theConfig->fetch_configuration();
   }
 
   if (child >= 0)
-    g_eventLogger.info("Angel pid: %d ndb pid: %d", getppid(), getpid());
+    g_eventLogger->info("Angel pid: %d ndb pid: %d", getppid(), getpid());
   else if (child > 0)
-    g_eventLogger.info("Ndb pid: %d", getpid());
+    g_eventLogger->info("Ndb pid: %d", getpid());
   else
-    g_eventLogger.info("Ndb started in foreground");
+    g_eventLogger->info("Ndb started in foreground");
 #else
-  g_eventLogger.info("Ndb started");
+  g_eventLogger->info("Ndb started");
 #endif
   theConfig->setupConfiguration();
   systemInfo(* theConfig, * theConfig->m_logLevel); 
@@ -511,19 +511,19 @@ systemInfo(const Configuration & config,
 #endif
   
   if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){
-    g_eventLogger.info("NDB Cluster -- DB node %d", globalData.ownId);
-    g_eventLogger.info("%s --", NDB_VERSION_STRING);
+    g_eventLogger->info("NDB Cluster -- DB node %d", globalData.ownId);
+    g_eventLogger->info("%s --", NDB_VERSION_STRING);
     if (config.get_mgmd_host())
-      g_eventLogger.info("Configuration fetched at %s port %d",
-			 config.get_mgmd_host(), config.get_mgmd_port());
+      g_eventLogger->info("Configuration fetched at %s port %d",
+                          config.get_mgmd_host(), config.get_mgmd_port());
 #ifdef NDB_SOLARIS // ok
-    g_eventLogger.info("NDB is running on a machine with %d processor(s) at %d MHz",
-		       processor, speed);
+    g_eventLogger->info("NDB is running on a machine with %d processor(s) at %d MHz",
+                        processor, speed);
 #endif
   }
   if(logLevel.getLogLevel(LogLevel::llStartUp) > 3){
     Uint32 t = config.timeBetweenWatchDogCheck();
-    g_eventLogger.info("WatchDog timer is set to %d ms", t);
+    g_eventLogger->info("WatchDog timer is set to %d ms", t);
   }
 
 }
@@ -601,7 +601,7 @@ catchsigs(bool ignore){
 extern "C"
 void 
 handler_shutdown(int signum){
-  g_eventLogger.info("Received signal %d. Performing stop.", signum);
+  g_eventLogger->info("Received signal %d. Performing stop.", signum);
   childReportError(0);
   childReportSignal(signum);
   globalData.theRestartFlag = perform_stop;
@@ -627,7 +627,7 @@ handler_error(int signum){
     while(true)
       NdbSleep_MilliSleep(10);
   thread_id= my_thread_id();
-  g_eventLogger.info("Received signal %d. Running error handler.", signum);
+  g_eventLogger->info("Received signal %d. Running error handler.", signum);
   childReportSignal(signum);
   // restart the system
   char errorData[64], *info= 0;
@@ -648,5 +648,5 @@ handler_sigusr1(int signum)
     failed_startups++;
     failed_startup_flag = true;
   }
-  g_eventLogger.info("Angel received ndbd startup failure count %u.", failed_startups);
+  g_eventLogger->info("Angel received ndbd startup failure count %u.",
failed_startups);
 }

=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp	2007-07-02 17:08:02 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp	2008-04-22 19:36:05 +0000
@@ -43,7 +43,7 @@ extern "C" {
 }
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 enum ndbd_options {
   OPT_INITIAL = NDB_STD_OPTIONS_LAST,

=== modified file 'storage/ndb/src/kernel/vm/Emulator.cpp'
--- a/storage/ndb/src/kernel/vm/Emulator.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/vm/Emulator.cpp	2008-04-22 19:36:05 +0000
@@ -41,7 +41,7 @@ void childAbort(int code, Uint32 current
 extern "C" {
   extern void (* ndb_new_handler)();
 }
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 extern my_bool opt_core;
 // instantiated and updated in NdbcntrMain.cpp
 extern Uint32 g_currentStartPhase;
@@ -155,26 +155,26 @@ NdbShutdown(NdbShutdownType type,
     
     switch(type){
     case NST_Normal:
-      g_eventLogger.info("Shutdown initiated");
+      g_eventLogger->info("Shutdown initiated");
       break;
     case NST_Watchdog:
-      g_eventLogger.info("Watchdog %s system", shutting);
+      g_eventLogger->info("Watchdog %s system", shutting);
       break;
     case NST_ErrorHandler:
-      g_eventLogger.info("Error handler %s system", shutting);
+      g_eventLogger->info("Error handler %s system", shutting);
       break;
     case NST_ErrorHandlerSignal:
-      g_eventLogger.info("Error handler signal %s system", shutting);
+      g_eventLogger->info("Error handler signal %s system", shutting);
       break;
     case NST_ErrorHandlerStartup:
-      g_eventLogger.info("Error handler startup %s system", shutting);
+      g_eventLogger->info("Error handler startup %s system", shutting);
       break;
     case NST_Restart:
-      g_eventLogger.info("Restarting system");
+      g_eventLogger->info("Restarting system");
       break;
     default:
-      g_eventLogger.info("Error handler %s system (unknown type: %u)",
-			 shutting, (unsigned)type);
+      g_eventLogger->info("Error handler %s system (unknown type: %u)",
+                          shutting, (unsigned)type);
       type = NST_ErrorHandler;
       break;
     }
@@ -189,7 +189,7 @@ NdbShutdown(NdbShutdownType type,
       /**
        * Very serious, don't attempt to free, just die!!
        */
-      g_eventLogger.info("Watchdog shutdown completed - %s", exitAbort);
+      g_eventLogger->info("Watchdog shutdown completed - %s", exitAbort);
       if (opt_core)
       {
 	childAbort(-1,g_currentStartPhase);
@@ -248,7 +248,7 @@ NdbShutdown(NdbShutdownType type,
       // Signal parent that error occured during startup
       if (type == NST_ErrorHandlerStartup)
 	kill(getppid(), SIGUSR1);
-      g_eventLogger.info("Error handler shutdown completed - %s", exitAbort);
+      g_eventLogger->info("Error handler shutdown completed - %s", exitAbort);
       if (opt_core)
       {
 	childAbort(-1,g_currentStartPhase);
@@ -266,7 +266,7 @@ NdbShutdown(NdbShutdownType type,
       childExit(restartType,g_currentStartPhase);
     }
     
-    g_eventLogger.info("Shutdown completed - exiting");
+    g_eventLogger->info("Shutdown completed - exiting");
   } else {
     /**
      * Shutdown is already in progress
@@ -276,7 +276,7 @@ NdbShutdown(NdbShutdownType type,
      * If this is the watchdog, kill system the hard way
      */
     if (type== NST_Watchdog){
-      g_eventLogger.info("Watchdog is killing system the hard way");
+      g_eventLogger->info("Watchdog is killing system the hard way");
 #if defined VM_TRACE
       childAbort(-1,g_currentStartPhase);
 #else

=== modified file 'storage/ndb/src/kernel/vm/Makefile.am'
--- a/storage/ndb/src/kernel/vm/Makefile.am	2006-12-31 00:32:21 +0000
+++ b/storage/ndb/src/kernel/vm/Makefile.am	2008-04-25 06:32:23 +0000
@@ -65,24 +65,24 @@ ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_
 ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp
 ndbd_malloc_impl_test_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
 
 bench_pool_SOURCES = bench_pool.cpp
 bench_pool_LDFLAGS = @ndb_bin_am_ldflags@\
   libkernel.a ../error/liberror.a \
   $(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
 
 testDynArr256_CXXFLAGS = -DUNIT_TEST
 testDynArr256_SOURCES = DynArr256.cpp
 testDynArr256_LDFLAGS = @ndb_bin_am_ldflags@ \
   libkernel.a ../error/liberror.a \
   $(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
 

=== modified file 'storage/ndb/src/kernel/vm/SimplePropertiesSection.cpp'
--- a/storage/ndb/src/kernel/vm/SimplePropertiesSection.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/vm/SimplePropertiesSection.cpp	2008-05-16 13:08:36 +0000
@@ -121,6 +121,55 @@ SimplePropertiesSectionReader::getWords(
 SimplePropertiesSectionWriter::SimplePropertiesSectionWriter(class SectionSegmentPool
& pool)
   : m_pool(pool)
 {
+  m_pos = -1;
+  m_head = 0;
+  m_currentSegment = 0;
+  m_prevPtrI = RNIL;
+  reset();
+}
+
+extern void release(SegmentedSectionPtr & ptr);
+
+SimplePropertiesSectionWriter::~SimplePropertiesSectionWriter()
+{
+  release();
+}
+
+void
+SimplePropertiesSectionWriter::release()
+{
+  if (m_head)
+  {
+    if (m_sz)
+    {
+      SegmentedSectionPtr ptr;
+      ptr.p = m_head;
+      ptr.i = m_head->m_lastSegment;
+      ptr.sz = m_sz;
+      m_head->m_sz = m_sz;
+      m_head->m_lastSegment = m_currentSegment->m_lastSegment;
+
+      if((m_pos % SectionSegment::DataLength) == 0){
+        m_pool.release(m_currentSegment->m_lastSegment);
+        m_head->m_lastSegment = m_prevPtrI;
+      }
+      ::release(ptr);
+    }
+    else
+    {
+      m_pool.release(m_head->m_lastSegment);
+    }
+  }
+  m_pos = -1;
+  m_head = 0;
+  m_currentSegment = 0;
+  m_prevPtrI = RNIL;
+}
+
+bool
+SimplePropertiesSectionWriter::reset()
+{
+  release();
   Ptr<SectionSegment> first;
   if(m_pool.seize(first)){
     ;
@@ -129,7 +178,7 @@ SimplePropertiesSectionWriter::SimplePro
     m_head = 0;
     m_currentSegment = 0;
     m_prevPtrI = RNIL;
-    return;
+    return false;
   }
   m_sz = 0;
   m_pos = 0;
@@ -137,14 +186,6 @@ SimplePropertiesSectionWriter::SimplePro
   m_head->m_lastSegment = first.i;
   m_currentSegment = first.p;
   m_prevPtrI = RNIL;
-}
-  
-bool
-SimplePropertiesSectionWriter::reset(){
-  if(m_pos >= 0){
-    m_pos = 0;
-    return true;
-  }
   return false;
 }
 
@@ -188,6 +229,11 @@ SimplePropertiesSectionWriter::putWords(
   return true;
 }
 
+Uint32 SimplePropertiesSectionWriter::getWordsUsed() const
+{
+  return m_sz;
+}
+
 void
 SimplePropertiesSectionWriter::getPtr(struct SegmentedSectionPtr & dst){
   // Set last ptr and size
@@ -213,8 +259,11 @@ SimplePropertiesSectionWriter::getPtr(st
   dst.sz = 0;
   dst.i = RNIL;
 
-  m_pool.release(m_head->m_lastSegment);
-  
+  if (m_head)
+  {
+    m_pool.release(m_head->m_lastSegment);
+  }
+
   m_sz = 0;
   m_pos = -1;
   m_head = m_currentSegment = 0;

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.cpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp	2008-02-20 09:04:29 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp	2008-04-22 19:36:05 +0000
@@ -40,7 +40,7 @@
 #include <NdbSqlUtil.hpp>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 #define ljamEntry() jamEntryLine(30000 + __LINE__)
 #define ljam() jamLine(30000 + __LINE__)
@@ -710,9 +710,9 @@ SimulatedBlock::allocRecordAligned(const
       *unaligned_buffer = p;
       p = (void *)(((UintPtr)p + over_alloc) & ~(UintPtr)(over_alloc));
 #ifdef VM_TRACE
-      g_eventLogger.info("'%s' (%u) %llu %llu, alignment correction %u bytes",
-                         type, align, (Uint64)p, (Uint64)p+n*s,
-                         (Uint32)((UintPtr)p - (UintPtr)*unaligned_buffer));
+      g_eventLogger->info("'%s' (%u) %llu %llu, alignment correction %u bytes",
+                          type, align, (Uint64)p, (Uint64)p+n*s,
+                          (Uint32)((UintPtr)p - (UintPtr)*unaligned_buffer));
 #endif
     }
   }

=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2008-02-20 09:04:29 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp	2008-05-29 15:58:58 +0000
@@ -822,5 +822,38 @@ BLOCK::addRecSignal(GlobalSignalNumber g
 
 #include "Mutex.hpp"
 
+#ifdef ERROR_INSERT
+#define RSS_AP_SNAPSHOT(x) Uint32 rss_##x
+#define RSS_AP_SNAPSHOT_SAVE(x) rss_##x = x.getNoOfFree()
+#define RSS_AP_SNAPSHOT_CHECK(x) ndbrequire(rss_##x == x.getNoOfFree())
+
+#define RSS_OP_COUNTER(x) Uint32 x
+#define RSS_OP_COUNTER_INIT(x) x = 0
+#define RSS_OP_ALLOC(x) x ++
+#define RSS_OP_FREE(x) x --
+#define RSS_OP_ALLOC_X(x,n) x += n
+#define RSS_OP_FREE_X(x,n) x -= n
+
+#define RSS_OP_SNAPSHOT(x) Uint32 rss_##x
+#define RSS_OP_SNAPSHOT_SAVE(x) rss_##x = x
+#define RSS_OP_SNAPSHOT_CHECK(x) ndbrequire(rss_##x == x)
+#else
+#define RSS_AP_SNAPSHOT(x)
+#define RSS_AP_SNAPSHOT_SAVE(x)
+#define RSS_AP_SNAPSHOT_CHECK(x)
+
+#define RSS_OP_COUNTER(x)
+#define RSS_OP_COUNTER_INIT(x)
+#define RSS_OP_ALLOC(x)
+#define RSS_OP_FREE(x)
+#define RSS_OP_ALLOC_X(x,n)
+#define RSS_OP_FREE_X(x,n)
+
+#define RSS_OP_SNAPSHOT(x)
+#define RSS_OP_SNAPSHOT_SAVE(x)
+#define RSS_OP_SNAPSHOT_CHECK(x)
+
+#endif
+
 #endif
 

=== modified file 'storage/ndb/src/kernel/vm/WatchDog.cpp'
--- a/storage/ndb/src/kernel/vm/WatchDog.cpp	2007-06-09 05:25:49 +0000
+++ b/storage/ndb/src/kernel/vm/WatchDog.cpp	2008-04-22 19:36:05 +0000
@@ -27,7 +27,7 @@
 
 #include <NdbTick.h>
 
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 extern "C" 
 void* 
@@ -136,12 +136,12 @@ WatchDog::run()
     {
       struct tms my_tms;
       times(&my_tms);
-      g_eventLogger.info("Watchdog: User time: %llu  System time: %llu",
-                         (Uint64)my_tms.tms_utime,
-                         (Uint64)my_tms.tms_stime);
-      g_eventLogger.warning("Watchdog: Warning overslept %u ms, expected %u ms.",
-                            NdbTick_getMicrosPassed(last_time, now)/1000,
-                            sleep_time);
+      g_eventLogger->info("Watchdog: User time: %llu  System time: %llu",
+                          (Uint64)my_tms.tms_utime,
+                          (Uint64)my_tms.tms_stime);
+      g_eventLogger->warning("Watchdog: Warning overslept %u ms, expected %u ms.",
+                             NdbTick_getMicrosPassed(last_time, now)/1000,
+                             sleep_time);
     }
     last_time = now;
 
@@ -171,13 +171,13 @@ WatchDog::run()
       if (warn)
       {
         const char *last_stuck_action = get_action(oldIPValue);
-        g_eventLogger.warning("Ndb kernel is stuck in: %s", last_stuck_action);
+        g_eventLogger->warning("Ndb kernel is stuck in: %s", last_stuck_action);
         {
           struct tms my_tms;
           times(&my_tms);
-          g_eventLogger.info("Watchdog: User time: %llu  System time: %llu",
-                             (Uint64)my_tms.tms_utime,
-                             (Uint64)my_tms.tms_stime);
+          g_eventLogger->info("Watchdog: User time: %llu  System time: %llu",
+                              (Uint64)my_tms.tms_utime,
+                              (Uint64)my_tms.tms_stime);
         }
         if (elapsed > 3 * theInterval)
         {

=== modified file 'storage/ndb/src/kernel/vm/bench_pool.cpp'
--- a/storage/ndb/src/kernel/vm/bench_pool.cpp	2006-12-27 01:23:51 +0000
+++ b/storage/ndb/src/kernel/vm/bench_pool.cpp	2008-04-22 19:36:05 +0000
@@ -416,7 +416,7 @@ void test_wo(Uint32 cnt, Uint32 loop)
 }
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 int
 main(int argc, char **argv)

=== modified file 'storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp'
--- a/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp	2008-03-11 16:15:47 +0000
+++ b/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp	2008-08-07 13:36:47 +0000
@@ -19,11 +19,7 @@
 #include <ndb_global.h>
 #include <EventLogger.hpp>
 
-#ifndef UNIT_TEST
-extern EventLogger g_eventLogger;
-#else
-extern EventLogger g_eventLogger;
-#endif
+extern EventLogger * g_eventLogger;
 
 static int f_method_idx = 0;
 #ifdef NDBD_MALLOC_METHOD_SBRK
@@ -174,7 +170,7 @@ Ndbd_mem_manager::Ndbd_mem_manager()
   
   if (sizeof(Free_page_data) != (4 * (1 << FPD_2LOG)))
   {
-    g_eventLogger.error("Invalid build, ndbd_malloc_impl.cpp:%d", __LINE__);
+    g_eventLogger->error("Invalid build, ndbd_malloc_impl.cpp:%d", __LINE__);
     abort();
   }
 }
@@ -266,11 +262,11 @@ Ndbd_mem_manager::init(bool alloc_less_m
     m_resource_limit[0].m_min = pages;
   }
   
-  g_eventLogger.info("Ndbd_mem_manager::init(%d) min: %dMb initial: %dMb",
-		     alloc_less_memory,
-		     (sizeof(Alloc_page)*m_resource_limit[0].m_min)>>20,
-		     (sizeof(Alloc_page)*pages)>>20);
-  
+  g_eventLogger->info("Ndbd_mem_manager::init(%d) min: %dMb initial: %dMb",
+                      alloc_less_memory,
+                      (sizeof(Alloc_page)*m_resource_limit[0].m_min)>>20,
+                      (sizeof(Alloc_page)*pages)>>20);
+
   if (pages == 0)
   {
     return 0;
@@ -318,21 +314,21 @@ Ndbd_mem_manager::init(bool alloc_less_m
   
   if (allocated < m_resource_limit[0].m_min)
   {
-    g_eventLogger.
+    g_eventLogger->
       error("Unable to alloc min memory from OS: min: %lldMb "
-	    " allocated: %lldMb", 
-	    (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_min) >> 20,
-	    (Uint64)(sizeof(Alloc_page)*allocated) >> 20);
+            " allocated: %lldMb",
+            (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_min) >> 20,
+            (Uint64)(sizeof(Alloc_page)*allocated) >> 20);
     return false;
   }
   else if (allocated < pages)
   {
-    g_eventLogger.
+    g_eventLogger->
       warning("Unable to alloc requested memory from OS: min: %lldMb"
-	      " requested: %lldMb allocated: %lldMb",
-	      (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_min)>>20,
-	      (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_max)>>20,
-	      (Uint64)(sizeof(Alloc_page)*allocated)>>20);
+              " requested: %lldMb allocated: %lldMb",
+              (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_min)>>20,
+              (Uint64)(sizeof(Alloc_page)*m_resource_limit[0].m_max)>>20,
+              (Uint64)(sizeof(Alloc_page)*allocated)>>20);
     if (!alloc_less_memory)
       return false;
   }
@@ -402,10 +398,10 @@ Ndbd_mem_manager::grow(Uint32 start, Uin
 	     " - Unable to use due to bitmap pages missaligned!!",
 	     __LINE__, start, cnt, start, (start_bmp << BPP_2LOG),
 	     (cnt >> (20 - 15)));
-    g_eventLogger.error("ndbd_malloc_impl.cpp:%d:grow(%d, %d) not using %uMb"
-			" - Unable to use due to bitmap pages missaligned!!",
-			__LINE__, start, cnt,
-			(cnt >> (20 - 15)));
+    g_eventLogger->error("ndbd_malloc_impl.cpp:%d:grow(%d, %d) not using %uMb"
+                         " - Unable to use due to bitmap pages missaligned!!",
+                         __LINE__, start, cnt,
+                         (cnt >> (20 - 15)));
 
     dump();
     return;
@@ -881,12 +877,12 @@ main(int argc, char** argv)
   Timer timer[4];
   printf("Startar modul test av Page Manager %dMb %ds\n", 
 	 (sz >> 5), run_time);
-  g_eventLogger.createConsoleHandler();
-  g_eventLogger.setCategory("keso");
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_INFO);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_CRITICAL);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_WARNING);
+  g_eventLogger->createConsoleHandler();
+  g_eventLogger->setCategory("keso");
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_INFO);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_CRITICAL);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_ERROR);
+  g_eventLogger->enable(Logger::LL_ON, Logger::LL_WARNING);
   
 #define DEBUG 0
 

=== modified file 'storage/ndb/src/mgmclient/Makefile.am'
--- a/storage/ndb/src/mgmclient/Makefile.am	2007-08-01 07:24:01 +0000
+++ b/storage/ndb/src/mgmclient/Makefile.am	2008-04-25 06:32:23 +0000
@@ -37,9 +37,9 @@ LDADD_LOC = $(noinst_LTLIBRARIES) \
 	    ../common/portlib/libportlib.la \
             @readline_link@ \
             $(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 \
             @TERMCAP_LIB@ @NDB_SCI_LIBS@
 
 ndb_mgm_LDFLAGS = @ndb_bin_am_ldflags@

=== modified file 'storage/ndb/src/mgmsrv/Makefile.am'
--- a/storage/ndb/src/mgmsrv/Makefile.am	2007-08-01 03:07:58 +0000
+++ b/storage/ndb/src/mgmsrv/Makefile.am	2008-04-25 06:32:23 +0000
@@ -40,9 +40,9 @@ INCLUDES_LOC = -I$(top_srcdir)/storage/n
 
 LDADD_LOC = $(top_builddir)/storage/ndb/src/mgmclient/CommandInterpreter.lo \
             $(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 \
             @readline_link@ \
             @NDB_SCI_LIBS@ \
 	    @TERMCAP_LIB@

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-03-14 13:32:49 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-04-22 19:36:05 +0000
@@ -102,7 +102,7 @@ MgmtSrvr::logLevelThread_C(void* m)
   return 0;
 }
 
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 #ifdef NOT_USED
 static NdbOut&
@@ -223,7 +223,7 @@ MgmtSrvr::startEventLog() 
 {
   NdbMutex_Lock(m_configMutex);
 
-  g_eventLogger.setCategory("MgmSrvr");
+  g_eventLogger->setCategory("MgmSrvr");
 
   ndb_mgm_configuration_iterator 
     iter(* _config->m_configValues, CFG_SECTION_NODE);
@@ -250,7 +250,7 @@ MgmtSrvr::startEventLog() 
 		   clusterLog);
   }
   errStr[0]='\0';
-  if(!g_eventLogger.addHandler(logdest, &err, sizeof(errStr), errStr)) {
+  if(!g_eventLogger->addHandler(logdest, &err, sizeof(errStr), errStr)) {
     ndbout << "Warning: could not add log destination \""
            << logdest.c_str() << "\". Reason: ";
     if(err)
@@ -266,7 +266,7 @@ MgmtSrvr::startEventLog() 
 void
 MgmtSrvr::stopEventLog()
 {
-  g_eventLogger.close();
+  g_eventLogger->close();
 }
 
 bool
@@ -274,21 +274,21 @@ MgmtSrvr::setEventLogFilter(int severity
 {
   Logger::LoggerLevel level = (Logger::LoggerLevel)severity;
   if (enable > 0) {
-    g_eventLogger.enable(level);
+    g_eventLogger->enable(level);
   } else if (enable == 0) {
-    g_eventLogger.disable(level);
-  } else if (g_eventLogger.isEnable(level)) {
-    g_eventLogger.disable(level);
+    g_eventLogger->disable(level);
+  } else if (g_eventLogger->isEnable(level)) {
+    g_eventLogger->disable(level);
   } else {
-    g_eventLogger.enable(level);
+    g_eventLogger->enable(level);
   }
-  return g_eventLogger.isEnable(level);
+  return g_eventLogger->isEnable(level);
 }
 
 bool 
 MgmtSrvr::isEventLogFilterEnabled(int severity) 
 {
-  return g_eventLogger.isEnable((Logger::LoggerLevel)severity);
+  return g_eventLogger->isEnable((Logger::LoggerLevel)severity);
 }
 
 int MgmtSrvr::translateStopRef(Uint32 errCode)
@@ -693,11 +693,11 @@ int MgmtSrvr::okToSendTo(NodeId nodeId, 
 
 void report_unknown_signal(SimpleSignal *signal)
 {
-  g_eventLogger.error("Unknown signal received. SignalNumber: "
-		      "%i from (%d, %x)",
-		      signal->readSignalNumber(),
-		      refToNode(signal->header.theSendersBlockRef),
-		      refToBlock(signal->header.theSendersBlockRef));
+  g_eventLogger->error("Unknown signal received. SignalNumber: "
+                       "%i from (%d, %x)",
+                       signal->readSignalNumber(),
+                       refToNode(signal->header.theSendersBlockRef),
+                       refToBlock(signal->header.theSendersBlockRef));
 }
 
 /*****************************************************************************
@@ -2012,13 +2012,13 @@ MgmtSrvr::handleReceivedSignal(NdbApiSig
     break;
 
   default:
-    g_eventLogger.error("Unknown signal received. SignalNumber: "
-			"%i from (%d, %x)",
-			gsn,
-			refToNode(signal->theSendersBlockRef),
-			refToBlock(signal->theSendersBlockRef));
+    g_eventLogger->error("Unknown signal received. SignalNumber: "
+                         "%i from (%d, %x)",
+                         gsn,
+                         refToNode(signal->theSendersBlockRef),
+                         refToBlock(signal->theSendersBlockRef));
   }
-  
+
   if (theWaitState == NO_WAIT) {
     NdbCondition_Signal(theMgmtWaitForResponseCondPtr);
   }
@@ -2367,11 +2367,12 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
       ndb_error_string(res, buf, sizeof(buf));
       error_string.appfmt("Cluster refused allocation of id %d. Error: %d (%s).",
 			  save_id_found, res, buf);
-      g_eventLogger.warning("Cluster refused allocation of id %d. "
-                            "Connection from ip %s. "
-                            "Returned error string \"%s\"", save_id_found,
-                            inet_ntoa(((struct sockaddr_in
*)(client_addr))->sin_addr),
-                            error_string.c_str());
+      g_eventLogger->warning("Cluster refused allocation of id %d. "
+                             "Connection from ip %s. "
+                             "Returned error string \"%s\"", save_id_found,
+                             inet_ntoa(((struct sockaddr_in *)
+                                        (client_addr))->sin_addr),
+                             error_string.c_str());
       DBUG_RETURN(false);
     }
   }
@@ -2411,9 +2412,9 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
     
     char tmp_str[128];
     m_reserved_nodes.getText(tmp_str);
-    g_eventLogger.info("Mgmt server state: nodeid %d reserved for ip %s, "
-                       "m_reserved_nodes %s.",
-                       id_found, get_connect_address(id_found), tmp_str);
+    g_eventLogger->info("Mgmt server state: nodeid %d reserved for ip %s, "
+                        "m_reserved_nodes %s.",
+                        id_found, get_connect_address(id_found), tmp_str);
     DBUG_RETURN(true);
   }
 
@@ -2509,14 +2510,14 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
 
   if (log_event || error_code == NDB_MGM_ALLOCID_CONFIG_MISMATCH)
   {
-    g_eventLogger.warning("Allocate nodeid (%d) failed. Connection from ip %s."
-                          " Returned error string \"%s\"",
-                          *nodeId,
-                          client_addr != 0
-                          ? inet_ntoa(((struct sockaddr_in *)
-                                       (client_addr))->sin_addr)
-                          : "<none>",
-                          error_string.c_str());
+    g_eventLogger->warning("Allocate nodeid (%d) failed. Connection from ip %s."
+			   " Returned error string \"%s\"",
+			   *nodeId,
+			   client_addr != 0
+			   ? inet_ntoa(((struct sockaddr_in *)
+					(client_addr))->sin_addr)
+			   : "<none>",
+			   error_string.c_str());
 
     NodeBitmask connected_nodes2;
     get_connected_nodes(connected_nodes2);
@@ -2534,11 +2535,11 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
       }
     }
     if (tmp_connected.length() > 0)
-      g_eventLogger.info("Mgmt server state: node id's %s connected but not reserved", 
-			 tmp_connected.c_str());
+      g_eventLogger->info("Mgmt server state: node id's %s connected but not
reserved", 
+			  tmp_connected.c_str());
     if (tmp_not_connected.length() > 0)
-      g_eventLogger.info("Mgmt server state: node id's %s not connected but reserved",
-			 tmp_not_connected.c_str());
+      g_eventLogger->info("Mgmt server state: node id's %s not connected but
reserved",
+			  tmp_not_connected.c_str());
   }
   DBUG_RETURN(false);
 }
@@ -2570,8 +2571,8 @@ MgmtSrvr::eventReport(const Uint32 * the
   NodeId nodeId = eventReport->getNodeId();
   Ndb_logevent_type type = eventReport->getEventType();
   // Log event
-  g_eventLogger.log(type, theData, len, nodeId, 
-		    &m_event_listner[0].m_logLevel);  
+  g_eventLogger->log(type, theData, len, nodeId, 
+                     &m_event_listner[0].m_logLevel);
   m_event_listner.log(type, theData, len, nodeId);
 }
 
@@ -2769,8 +2770,8 @@ MgmtSrvr::Allocated_resources::~Allocate
 
     char tmp_str[128];
     m_mgmsrv.m_reserved_nodes.getText(tmp_str);
-    g_eventLogger.info("Mgmt server state: nodeid %d freed, m_reserved_nodes %s.",
-		       get_nodeid(), tmp_str);
+    g_eventLogger->info("Mgmt server state: nodeid %d freed, m_reserved_nodes %s.",
+                        get_nodeid(), tmp_str);
   }
 }
 
@@ -2786,8 +2787,8 @@ MgmtSrvr::Allocated_resources::is_timed_
 {
   if (m_alloc_timeout && tick > m_alloc_timeout)
   {
-    g_eventLogger.info("Mgmt server state: nodeid %d timed out.",
-                       get_nodeid());
+    g_eventLogger->info("Mgmt server state: nodeid %d timed out.",
+                        get_nodeid());
     return true;
   }
   return false;

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2008-03-14 12:37:00 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2008-08-07 13:36:47 +0000
@@ -36,7 +36,7 @@
 
 extern bool g_StopServer;
 extern bool g_RestartServer;
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 static const unsigned int MAX_READ_TIMEOUT = 1000 ;
 static const unsigned int MAX_WRITE_TIMEOUT = 100 ;
@@ -548,7 +548,7 @@ MgmApiSession::get_nodeid(Parser_t::Cont
   m_allocated_resources->reserve_node(tmp, timeout*1000);
   
   if (name)
-    g_eventLogger.info("Node %d: %s", tmp, name);
+    g_eventLogger->info("Node %d: %s", tmp, name);
 
   return;
 }

=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp	2007-08-30 09:29:29 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp	2008-04-22 19:36:05 +0000
@@ -128,7 +128,7 @@ static MgmGlobals *glob= 0;
  */
 bool g_StopServer;
 bool g_RestartServer;
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 enum ndb_mgmd_options {
   OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
@@ -317,14 +317,14 @@ start:
   BaseString::snprintf(msg, sizeof(msg),
 	   "NDB Cluster Management Server. %s", NDB_VERSION_STRING);
   ndbout_c(msg);
-  g_eventLogger.info(msg);
+  g_eventLogger->info(msg);
 
   BaseString::snprintf(msg, 256, "Id: %d, Command port: %s:%d",
                        glob->localNodeId, 
                        _bind_address ? _bind_address : "*",
                        glob->port);
   ndbout_c(msg);
-  g_eventLogger.info(msg);
+  g_eventLogger->info(msg);
   
   g_StopServer = false;
   g_RestartServer= false;
@@ -345,13 +345,13 @@ start:
   }
 
   if(g_RestartServer)
-    g_eventLogger.info("Restarting server...");
+    g_eventLogger->info("Restarting server...");
   else
-    g_eventLogger.info("Shutting down server...");
+    g_eventLogger->info("Shutting down server...");
   glob->socketServer->stopServer();
   // We disconnect from the ConfigRetreiver mgmd when we delete glob below
   glob->socketServer->stopSessions(true);
-  g_eventLogger.info("Shutdown complete");
+  g_eventLogger->info("Shutdown complete");
  the_end:
   delete glob;
   if(g_RestartServer)

=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp	2007-12-10 10:10:27 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp	2008-08-07 13:36:47 +0000
@@ -482,8 +482,11 @@ ClusterMgr::execNF_COMPLETEREP(const Uin
   const NodeId nodeId = nfComp->failedNodeId;
   assert(nodeId > 0 && nodeId < MAX_NDB_NODES);
   
-  theFacade.ReportNodeFailureComplete(nodeId);
-  theNodes[nodeId].nfCompleteRep = true;
+  if (theNodes[nodeId].nfCompleteRep == false)
+  {
+    theFacade.ReportNodeFailureComplete(nodeId);
+    theNodes[nodeId].nfCompleteRep = true;
+  }
 }
 
 void

=== modified file 'storage/ndb/src/ndbapi/DictCache.cpp'
--- a/storage/ndb/src/ndbapi/DictCache.cpp	2008-04-08 14:13:10 +0000
+++ b/storage/ndb/src/ndbapi/DictCache.cpp	2008-08-07 13:36:47 +0000
@@ -20,8 +20,10 @@
 #include <NdbCondition.h>
 #include <NdbSleep.h>
 
-static NdbTableImpl f_invalid_table;
-static NdbTableImpl f_altered_table;
+static NdbTableImpl * f_invalid_table = 0;
+static NdbTableImpl * f_altered_table = 0;
+
+static int ndb_dict_cache_count = 0;
 
 Ndb_local_table_info *
 Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
@@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){
   DBUG_ENTER("GlobalDictCache::GlobalDictCache");
   m_tableHash.createHashTable();
   m_waitForTableCondition = NdbCondition_Create();
+  if (f_invalid_table == NULL)
+    f_invalid_table = new NdbTableImpl();
+  if (f_altered_table == NULL)
+    f_altered_table = new NdbTableImpl();
+  ndb_dict_cache_count++;
   DBUG_VOID_RETURN;
 }
 
 GlobalDictCache::~GlobalDictCache(){
   DBUG_ENTER("GlobalDictCache::~GlobalDictCache");
+  if (--ndb_dict_cache_count == 0)
+  {
+    if (f_invalid_table)
+    {
+      delete f_invalid_table;
+      f_invalid_table = 0;
+    }
+    if (f_altered_table)
+    {
+      delete f_altered_table;
+      f_altered_table = 0;
+    }
+  }
   NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
   while(curr != 0){
     Vector<TableVersion> * vers = curr->theData;
@@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, 
   TableVersion & ver = vers->back();
   if(ver.m_status != RETREIVING || 
      !(ver.m_impl == 0 || 
-       ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || 
+       ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) || 
      ver.m_version != 0 || 
      ver.m_refCount == 0){
     abort();
@@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, 
     ver.m_version = tab->m_version;
     ver.m_status = OK;
   } 
-  else if (ver.m_impl == &f_invalid_table) 
+  else if (ver.m_impl == f_invalid_table) 
   {
     DBUG_PRINT("info", ("Table DROPPED invalid"));
     ver.m_impl = tab;
@@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, 
     ver.m_status = DROPPED;
     ver.m_impl->m_status = NdbDictionary::Object::Invalid;    
   }
-  else if(ver.m_impl == &f_altered_table)
+  else if(ver.m_impl == f_altered_table)
   {
     DBUG_PRINT("info", ("Table DROPPED altered"));
     ver.m_impl = tab;
@@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const c
 
     if(i == sz - 1 && ver.m_status == RETREIVING)
     {
-      ver.m_impl = altered ? &f_altered_table : &f_invalid_table;
+      ver.m_impl = altered ? f_altered_table : f_invalid_table;
       DBUG_VOID_RETURN;
     } 
   }

=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am	2007-05-29 11:46:57 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am	2008-04-25 06:32:23 +0000
@@ -68,9 +68,10 @@ include $(top_srcdir)/storage/ndb/config
 include $(top_srcdir)/storage/ndb/config/type_ndbapi.mk.am
 
 ndberror_check_LDFLAGS = \
-         $(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 \
+         $(top_builddir)/zlib/libzlt.la
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp	2008-03-12 13:13:49 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp	2008-08-07 13:36:47 +0000
@@ -550,7 +550,8 @@ Ndb::startTransaction(const NdbDictionar
       Uint32 hashValue;
       {
 	Uint32 buf[4];
-        Uint64 tmp[1000];
+        const Uint32 MaxKeySizeInLongWords= (NDB_MAX_KEY_SIZE + 7) / 8;
+        Uint64 tmp[ MaxKeySizeInLongWords ];
 
         if (keyLen >= sizeof(tmp))
         {

=== modified file 'storage/ndb/src/ndbapi/NdbApiSignal.hpp'
--- a/storage/ndb/src/ndbapi/NdbApiSignal.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/ndbapi/NdbApiSignal.hpp	2008-05-16 13:08:36 +0000
@@ -76,6 +76,7 @@ public:  
   /**
    * Fragmentation
    */
+  bool isFragmented() const { return m_fragmentInfo != 0;}
   bool isFirstFragment() const { return m_fragmentInfo <= 1;}
   bool isLastFragment() const { 
     return m_fragmentInfo == 0 || m_fragmentInfo == 3; 

=== modified file 'storage/ndb/src/ndbapi/NdbBlob.cpp'
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp	2008-04-08 14:13:10 +0000
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp	2008-08-07 13:36:47 +0000
@@ -621,7 +621,7 @@ int
 NdbBlob::copyKeyFromRow(const NdbRecord *record, const char *row,
                         Buf& packedBuf, Buf& unpackedBuf)
 {
-  char buf[256];
+  char buf[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
   DBUG_ENTER("NdbBlob::copyKeyFromRow");
 
   assert(record->flags & NdbRecord::RecHasAllKeys);
@@ -2419,33 +2419,62 @@ NdbBlob::preExecute(NdbTransaction::Exec
     }
   }
   if (isInsertOp() && theSetFlag) {
-    /* Add operations to insert parts and update the
-     * Blob head+inline in the main tables
+    /* If the main operation uses AbortOnError then
+     * we can add operations to insert parts and update
+     * the Blob head+inline here.
+     * If the main operation uses IgnoreError then
+     * we have to wait until we are sure that the main
+     * insert succeeded before performing any other
+     * operations (Otherwise we may perform duplicate insert,
+     * and the transaction can fail on the AbortOnError 
+     * part operations or corrupt the head with the 
+     * post-update operation)
      */
-    if (theGetSetBytes > theInlineSize) {
-      // add ops to write rest of a setValue
-      assert(theSetBuf != NULL);
-      const char* buf = theSetBuf + theInlineSize;
-      Uint32 bytes = theGetSetBytes - theInlineSize;
-      assert(thePos == theInlineSize);
-      if (writeDataPrivate(buf, bytes) == -1)
-        DBUG_RETURN(-1);
-    }
-    
-    if (theHeadInlineUpdateFlag)
+    bool performExtraInsertOpsInPreExec= 
+      (theNdbOp->m_abortOption != NdbOperation::AO_IgnoreError);
+
+    if (performExtraInsertOpsInPreExec)
     {
-      NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
-      if (tOp == NULL ||
-          tOp->updateTuple() == -1 ||
-          setTableKeyValue(tOp) == -1 ||
-          setHeadInlineValue(tOp) == -1) {
-        setErrorCode(NdbBlobImpl::ErrAbort);
-        DBUG_RETURN(-1);
+      DBUG_PRINT("info", 
+                 ("Insert abortError - extra ops added in preExecute"));
+      /* Add operations to insert parts and update the
+       * Blob head+inline in the main tables
+       */
+      if (theGetSetBytes > theInlineSize) {
+        // add ops to write rest of a setValue
+        assert(theSetBuf != NULL);
+        const char* buf = theSetBuf + theInlineSize;
+        Uint32 bytes = theGetSetBytes - theInlineSize;
+        assert(thePos == theInlineSize);
+        if (writeDataPrivate(buf, bytes) == -1)
+          DBUG_RETURN(-1);
       }
-      if (thePartitionId != noPartitionId()) {
-        tOp->setPartitionId(thePartitionId);
+      
+      if (theHeadInlineUpdateFlag)
+      {
+        NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
+        if (tOp == NULL ||
+            tOp->updateTuple() == -1 ||
+            setTableKeyValue(tOp) == -1 ||
+            setHeadInlineValue(tOp) == -1) {
+          setErrorCode(NdbBlobImpl::ErrAbort);
+          DBUG_RETURN(-1);
+        }
+        if (thePartitionId != noPartitionId()) {
+          tOp->setPartitionId(thePartitionId);
+        }
+        DBUG_PRINT("info", ("Insert : added op to update head+inline in preExecute"));
       }
-      DBUG_PRINT("info", ("Insert : added op to update head+inline"));
+    }
+    else
+    {
+      DBUG_PRINT("info", 
+                 ("Insert ignoreError - waiting for Blob head insert"));
+      /* Require that this insert op is completed 
+       * before beginning more user ops - avoid interleave
+       * with delete etc.
+       */
+      batch= true;
     }
   }
 
@@ -2687,6 +2716,55 @@ NdbBlob::postExecute(NdbTransaction::Exe
         DBUG_RETURN(-1);
     }
   }
+  if (isInsertOp() && theSetFlag) {
+    /* For Inserts where the main table operation is IgnoreError, 
+     * we perform extra operations on the head and inline parts
+     * now
+     */
+    bool performDelayedInsertOpsInPostExec= 
+      (theNdbOp->m_abortOption == NdbOperation::AO_IgnoreError);
+
+    if (performDelayedInsertOpsInPostExec)
+    {
+      DBUG_PRINT("info", ("Insert IgnoreError adding extra ops"));
+      /* Check the main table op for an error (don't proceed if 
+       * it failed) 
+       */
+      if (theNdbOp->theError.code == 0)
+      {
+        /* Add operations to insert parts and update the
+         * Blob head+inline in the main table
+         */
+        if (theGetSetBytes > theInlineSize) {
+          // add ops to write rest of a setValue
+          assert(theSetBuf != NULL);
+          const char* buf = theSetBuf + theInlineSize;
+          Uint32 bytes = theGetSetBytes - theInlineSize;
+          assert(thePos == theInlineSize);
+          if (writeDataPrivate(buf, bytes) == -1)
+            DBUG_RETURN(-1);
+        }
+        
+        if (theHeadInlineUpdateFlag)
+        {
+          NdbOperation* tOp = theNdbCon->getNdbOperation(theTable);
+          if (tOp == NULL ||
+              tOp->updateTuple() == -1 ||
+              setTableKeyValue(tOp) == -1 ||
+              setHeadInlineValue(tOp) == -1) {
+            setErrorCode(NdbBlobImpl::ErrAbort);
+            DBUG_RETURN(-1);
+          }
+          if (thePartitionId != noPartitionId()) {
+            tOp->setPartitionId(thePartitionId);
+          }
+          DBUG_PRINT("info", ("Insert : added op to update head+inline"));
+        }
+      }
+      // NOTE : Could map IgnoreError insert error onto Blob here
+    }
+  }
+
   if (isUpdateOp()) {
     assert(anExecType == NdbTransaction::NoCommit);
     getHeadFromRecAttr();

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2008-04-02 14:32:01 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2008-08-07 13:36:47 +0000
@@ -4542,13 +4542,12 @@ NdbDictionaryImpl::listObjects(List& lis
 
   ListTablesReq req;
   req.requestData = 0;
+  req.tableId = 0;
   req.setTableType(getKernelConstant(type, objectTypeMapping, 0));
   req.setListNames(true);
   if (!list2.count)
-    return m_receiver.listObjects(list, req.requestData,
-                                  m_ndb.usingFullyQualifiedNames());
-  ret = m_receiver.listObjects(list1, req.requestData,
-                               m_ndb.usingFullyQualifiedNames());
+    return m_receiver.listObjects(list, req, m_ndb.usingFullyQualifiedNames());
+  ret = m_receiver.listObjects(list1, req, m_ndb.usingFullyQualifiedNames());
   if (ret)
     return ret;
   list.count = list1.count + list2.count;
@@ -4576,25 +4575,168 @@ NdbDictionaryImpl::listIndexes(List& lis
   ListTablesReq req;
   req.requestData = 0;
   req.setTableId(indexId);
+  req.tableType = 0;
   req.setListNames(true);
   req.setListIndexes(true);
-  return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames());
+  return m_receiver.listObjects(list, req, m_ndb.usingFullyQualifiedNames());
 }
 
 int
 NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
-			      Uint32 requestData, bool fullyQualifiedNames)
+                              ListTablesReq& ltreq, bool fullyQualifiedNames)
 {
+  bool listTablesLongSignal = false;
   NdbApiSignal tSignal(m_reference);
   ListTablesReq* const req = CAST_PTR(ListTablesReq, tSignal.getDataPtrSend());
   req->senderRef = m_reference;
   req->senderData = 0;
-  req->requestData = requestData;
+  req->requestData = ltreq.requestData;
+  req->setTableId(ltreq.getTableId());
+  req->setTableType(ltreq.getTableType());
+  if (ltreq.getTableId() > 4096)
+  {
+    /*
+      Enforce new long signal format,
+      if this is not supported by the
+      called node the request will fail
+     */
+    listTablesLongSignal = true;
+  }
+
+  /*
+    Set table id and type according to old format
+    in case sent to old nodes (during upgrade).
+  */
+  req->oldSetTableId(ltreq.getTableId());
+  req->oldSetTableType(ltreq.getTableType());
+
   tSignal.theReceiversBlockNumber = DBDICT;
   tSignal.theVerId_signalNumber = GSN_LIST_TABLES_REQ;
   tSignal.theLength = ListTablesReq::SignalLength;
-  if (listObjects(&tSignal) != 0)
+  if (listObjects(&tSignal, listTablesLongSignal) != 0)
     return -1;
+
+  if (listTablesLongSignal)
+  {
+    return unpackListTables(list, fullyQualifiedNames);
+  }
+  else
+  {
+    return unpackOldListTables(list, fullyQualifiedNames);
+  }
+}
+
+int
+NdbDictInterface::unpackListTables(NdbDictionary::Dictionary::List& list,
+                                   bool fullyQualifiedNames)
+{
+  Uint32 count = 0;
+  Uint32* tableData = (Uint32*)m_tableData.get_data();
+  Uint32* tableNames = (Uint32*)m_tableNames.get_data();
+  const Uint32 listTablesDataSizeInWords = (sizeof(ListTablesData) + 3) / 4;
+  list.count = m_noOfTables;
+  list.elements = new NdbDictionary::Dictionary::List::Element[m_noOfTables];
+
+  while (count < m_noOfTables)
+  {
+    NdbDictionary::Dictionary::List::Element& element = list.elements[count];
+    ListTablesData* ltd = (ListTablesData *) tableData;
+    tableData += listTablesDataSizeInWords;
+    element.id = ltd->getTableId();
+    element.type = (NdbDictionary::Object::Type)
+      getApiConstant(ltd->getTableType(), objectTypeMapping, 0);
+    element.state = (NdbDictionary::Object::State)
+      getApiConstant(ltd->getTableState(), objectStateMapping, 0);
+    element.store = (NdbDictionary::Object::Store)
+      getApiConstant(ltd->getTableStore(), objectStoreMapping, 0);
+    element.temp = ltd->getTableTemp();
+    // table or index name
+    BaseString databaseName;
+    BaseString schemaName;
+    BaseString objectName;
+    if (!databaseName || !schemaName || !objectName)
+    {
+      m_error.code= 4000;
+      return -1;
+    }
+    Uint32 size = tableNames[0];
+    Uint32 wsize = (size + 3) / 4;
+    tableNames++;
+    if ((element.type == NdbDictionary::Object::UniqueHashIndex) ||
+	(element.type == NdbDictionary::Object::OrderedIndex)) {
+      char * indexName = new char[size];
+      if (indexName == NULL)
+      {
+        m_error.code= 4000;
+        return -1;
+      }
+      memcpy(indexName, (char *) tableNames, size);
+      if (!(databaseName = Ndb::getDatabaseFromInternalName(indexName)) ||
+          !(schemaName = Ndb::getSchemaFromInternalName(indexName)))
+      {
+        delete [] indexName;
+        m_error.code= 4000;
+        return -1;
+      }
+      objectName = BaseString(Ndb::externalizeIndexName(indexName,
+                                                        fullyQualifiedNames));
+      delete [] indexName;
+    } else if ((element.type == NdbDictionary::Object::SystemTable) ||
+	       (element.type == NdbDictionary::Object::UserTable)) {
+      char * tableName = new char[size];
+      if (tableName == NULL)
+      {
+        m_error.code= 4000;
+        return -1;
+      }
+      memcpy(tableName, (char *) tableNames, size);
+      if (!(databaseName = Ndb::getDatabaseFromInternalName(tableName)) ||
+          !(schemaName = Ndb::getSchemaFromInternalName(tableName)))
+      {
+        delete [] tableName;
+        m_error.code= 4000;
+        return -1;
+      }
+      objectName = BaseString(Ndb::externalizeTableName(tableName,
+                                                        fullyQualifiedNames));
+      delete [] tableName;
+    }
+    else {
+      char * otherName = new char[size];
+      if (otherName == NULL)
+      {
+        m_error.code= 4000;
+        return -1;
+      }
+      memcpy(otherName, (char *) tableNames, size);
+      if (!(objectName = BaseString(otherName)))
+      {
+        m_error.code= 4000;
+        return -1;
+      }
+      delete [] otherName;
+    }
+    if (!(element.database = new char[databaseName.length() + 1]) ||
+        !(element.schema = new char[schemaName.length() + 1]) ||
+        !(element.name = new char[objectName.length() + 1]))
+    {
+      m_error.code= 4000;
+      return -1;
+    }
+    strcpy(element.database, databaseName.c_str());
+    strcpy(element.schema, schemaName.c_str());
+    strcpy(element.name, objectName.c_str());
+    count++;
+    tableNames += wsize;
+  }
+
+  return 0;
+}
+
+int
+NdbDictInterface::unpackOldListTables(NdbDictionary::Dictionary::List& list,
+                                      bool fullyQualifiedNames)
+{
   // count
   const Uint32* data = (const Uint32*)m_buffer.get_data();
   const unsigned length = m_buffer.length() / 4;
@@ -4628,14 +4770,14 @@ NdbDictInterface::listObjects(NdbDiction
   while (pos < length) {
     NdbDictionary::Dictionary::List::Element& element = list.elements[count];
     Uint32 d = data[pos++];
-    element.id = ListTablesConf::getTableId(d);
+    element.id = OldListTablesConf::getTableId(d);
     element.type = (NdbDictionary::Object::Type)
-      getApiConstant(ListTablesConf::getTableType(d), objectTypeMapping, 0);
+      getApiConstant(OldListTablesConf::getTableType(d), objectTypeMapping, 0);
     element.state = (NdbDictionary::Object::State)
-      getApiConstant(ListTablesConf::getTableState(d), objectStateMapping, 0);
+      getApiConstant(OldListTablesConf::getTableState(d), objectStateMapping, 0);
     element.store = (NdbDictionary::Object::Store)
-      getApiConstant(ListTablesConf::getTableStore(d), objectStoreMapping, 0);
-    element.temp = ListTablesConf::getTableTemp(d);
+      getApiConstant(OldListTablesConf::getTableStore(d), objectStoreMapping, 0);
+    element.temp = OldListTablesConf::getTableTemp(d);
     // table or index name
     Uint32 n = (data[pos++] + 3) >> 2;
     BaseString databaseName;
@@ -4715,7 +4857,8 @@ NdbDictInterface::listObjects(NdbDiction
 }
 
 int
-NdbDictInterface::listObjects(NdbApiSignal* signal)
+NdbDictInterface::listObjects(NdbApiSignal* signal,
+                              bool& listTablesLongSignal)
 {
   const Uint32 RETRIES = 100;
   for (Uint32 i = 0; i < RETRIES; i++) {
@@ -4733,6 +4876,24 @@ NdbDictInterface::listObjects(NdbApiSign
       m_error.code= 4009;
       return -1;
     }
+    NodeInfo info = m_transporter->theClusterMgr->getNodeInfo(aNodeId).m_info;
+    if (ndbd_LIST_TABLES_CONF_long_signal(info.m_version))
+    {
+      /*
+        Called node will return a long signal
+       */
+      listTablesLongSignal = true;
+    }
+    else if (listTablesLongSignal)
+    {
+      /*
+        We are requesting info from a table with table id > 4096
+        and older versions don't support that, bug#36044
+      */
+      m_error.code= 4105;
+      return -1;
+    }
+
     if (m_transporter->sendSignal(signal, aNodeId) != 0) {
       continue;
     }
@@ -4751,15 +4912,94 @@ NdbDictInterface::listObjects(NdbApiSign
 
 void
 NdbDictInterface::execLIST_TABLES_CONF(NdbApiSignal* signal,
-				       LinearSectionPtr ptr[3])
+                                       LinearSectionPtr ptr[3])
+{
+  Uint16 nodeId = refToNode(signal->theSendersBlockRef);
+  NodeInfo info = m_transporter->theClusterMgr->getNodeInfo(nodeId).m_info;
+  if (!ndbd_LIST_TABLES_CONF_long_signal(info.m_version))
+  {
+    /*
+      Sender doesn't support new signal format
+     */
+    NdbDictInterface::execOLD_LIST_TABLES_CONF(signal, ptr);
+    return;
+  }
+
+  if (signal->isFirstFragment())
+  {
+    m_fragmentId = signal->getFragmentId();
+    m_noOfTables = 0;
+    m_tableData.clear();
+    m_tableNames.clear();
+  }
+  else
+  {
+    Uint32 fid = signal->getFragmentId();
+    if (m_fragmentId != signal->getFragmentId())
+    {
+      abort();
+    }
+  }
+
+  /*
+    Save the count
+   */
+  const ListTablesConf* const conf=
+    CAST_CONSTPTR(ListTablesConf, signal->getDataPtr());
+  m_noOfTables+= conf->noOfTables;
+
+  bool fragmented = signal->isFragmented();
+  Uint32 sigLen = signal->getLength() - 1;
+  const Uint32 secs = signal->m_noOfSections;
+  const Uint32 directMap[3] = {0,1,2};
+  const Uint32 * const secNos =
+    (fragmented) ?
+    &signal->getDataPtr()[sigLen - secs]
+    : (const Uint32 *) &directMap;
+
+  for(Uint32 i = 0; i<secs; i++)
+  {
+    Uint32 sectionNo = secNos[i];
+    switch (sectionNo) {
+    case(ListTablesConf::TABLE_DATA):
+      if (m_tableData.append(ptr[i].p, 4 * ptr[i].sz))
+      {
+        m_error.code= 4000;
+        goto end;
+      }
+      break;
+    case(ListTablesConf::TABLE_NAMES):
+      if (m_tableNames.append(ptr[i].p, 4 * ptr[i].sz))
+      {
+        m_error.code= 4000;
+        goto end;
+      }
+      break;
+    default:
+      abort();
+    }
+  }
+
+ end:
+  if(!signal->isLastFragment()){
+    return;
+  }
+
+  m_waiter.signal(NO_WAIT);
+}
+
+
+void
+NdbDictInterface::execOLD_LIST_TABLES_CONF(NdbApiSignal* signal,
+                                           LinearSectionPtr ptr[3])
 {
-  const unsigned off = ListTablesConf::HeaderLength;
+  const unsigned off = OldListTablesConf::HeaderLength;
   const unsigned len = (signal->getLength() - off);
   if (m_buffer.append(signal->getDataPtr() + off, len << 2))
   {
     m_error.code= 4000;
   }
-  if (signal->getLength() < ListTablesConf::SignalLength) {
+  if (signal->getLength() < OldListTablesConf::SignalLength) {
     // last signal has less than full length
     m_waiter.signal(NO_WAIT);
   }
@@ -4816,7 +5056,7 @@ NdbDictInterface::execWAIT_GCP_CONF(NdbA
 
 void
 NdbDictInterface::execWAIT_GCP_REF(NdbApiSignal* signal,
-				    LinearSectionPtr ptr[3])
+                                   LinearSectionPtr ptr[3])
 {
   m_waiter.signal(NO_WAIT);
 }

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2008-04-01 15:37:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2008-05-16 13:08:36 +0000
@@ -31,6 +31,8 @@
 #include "NdbWaiter.hpp"
 #include "DictCache.hpp"
 
+class ListTablesReq;
+
 bool
 is_ndb_blob_table(const char* name, Uint32* ptab_id = 0, Uint32* pcol_no = 0);
 bool
@@ -506,8 +508,14 @@ public:
   int executeSubscribeEvent(class Ndb & ndb, NdbEventOperationImpl &);
   int stopSubscribeEvent(class Ndb & ndb, NdbEventOperationImpl &);
   
-  int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData, bool
fullyQualifiedNames);
-  int listObjects(NdbApiSignal* signal);
+  int listObjects(NdbDictionary::Dictionary::List& list,
+                  ListTablesReq& ltreq, bool fullyQualifiedNames);
+  int listObjects(NdbApiSignal* signal, bool& listTablesLongSignal);
+
+  int unpackListTables(NdbDictionary::Dictionary::List& list,
+                       bool fullyQualifiedNames);
+  int unpackOldListTables(NdbDictionary::Dictionary::List& list,
+                          bool fullyQualifiedNames);
   
   NdbTableImpl * getTable(int tableId, bool fullyQualifiedNames);
   NdbTableImpl * getTable(const BaseString& name, bool fullyQualifiedNames);
@@ -584,6 +592,7 @@ private:
 
   void execDROP_TABLE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
   void execDROP_TABLE_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
+  void execOLD_LIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
   void execLIST_TABLES_CONF(NdbApiSignal *, LinearSectionPtr ptr[3]);
 
   void execCREATE_FILE_REF(NdbApiSignal *, LinearSectionPtr ptr[3]);
@@ -603,6 +612,10 @@ private:
 
   Uint32 m_fragmentId;
   UtilBuffer m_buffer;
+
+  Uint32 m_noOfTables;
+  UtilBuffer m_tableData;
+  UtilBuffer m_tableNames;
 };
 
 class NdbDictionaryImpl;

=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2008-04-02 14:32:01 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2008-08-07 13:36:47 +0000
@@ -44,7 +44,7 @@
 #include "ndb_internal.hpp"
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 static Gci_container_pod g_empty_gci_container;
 
@@ -1220,8 +1220,8 @@ NdbEventBuffer::flushIncompleteEvents(Ui
   Uint32 minpos = m_min_gci_index;
   Uint32 maxpos = m_max_gci_index;
 
-  g_eventLogger.info("Flushing incomplete GCI:s < %u/%u",
-                     Uint32(gci >> 32), Uint32(gci));
+  g_eventLogger->info("Flushing incomplete GCI:s < %u/%u",
+                      Uint32(gci >> 32), Uint32(gci));
   while (minpos != maxpos && array[minpos] < gci)
   {
     Gci_container* tmp = find_bucket(array[minpos]);
@@ -1929,11 +1929,11 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP
         goto do_complete;
       }
       /** out of order something */
-      g_eventLogger.info("out of order bucket: %d gci: %u/%u minGCI: %u/%u m_latestGCI:
%u/%u",
-                         (int)(bucket-(Gci_container*)m_active_gci.getBase()),
-                         Uint32(gci >> 32), Uint32(gci),
-                         Uint32(minGCI >> 32), Uint32(minGCI),
-                         Uint32(m_latestGCI >> 32), Uint32(m_latestGCI));
+      g_eventLogger->info("out of order bucket: %d gci: %u/%u minGCI: %u/%u
m_latestGCI: %u/%u",
+                          (int)(bucket-(Gci_container*)m_active_gci.getBase()),
+                          Uint32(gci >> 32), Uint32(gci),
+                          Uint32(minGCI >> 32), Uint32(minGCI),
+                          Uint32(m_latestGCI >> 32), Uint32(m_latestGCI));
       bucket->m_state = Gci_container::GC_COMPLETE;
       bucket->m_gcp_complete_rep_count = 1; // Prevent from being reused
       m_latest_complete_GCI = gci;
@@ -1957,9 +1957,9 @@ NdbEventBuffer::complete_outof_order_gci
   Uint64 stop_gci = m_latest_complete_GCI;
 
   Uint64 start_gci = array[minpos];
-  g_eventLogger.info("complete_outof_order_gcis from: %u/%u to: %u/%u",
-                     Uint32(start_gci >> 32), Uint32(start_gci),
-                     Uint32(stop_gci >> 32), Uint32(stop_gci));
+  g_eventLogger->info("complete_outof_order_gcis from: %u/%u to: %u/%u",
+                      Uint32(start_gci >> 32), Uint32(start_gci),
+                      Uint32(stop_gci >> 32), Uint32(stop_gci));
 
   assert(start_gci <= stop_gci);
   do

=== modified file 'storage/ndb/src/ndbapi/NdbIndexStat.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp	2008-06-03 10:00:31 +0000
@@ -398,7 +398,7 @@ NdbIndexStat::addKeyPartInfo(const NdbRe
                              Uint32* keyStatData,
                              Uint32& keyLength)
 {
-  char buf[256]; // For shrinking MySQLD varchars
+  char buf[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
 
   Uint32 key_index= record->key_indexes[ keyPartNum ];
   const NdbRecord::Attr *column= &record->columns[ key_index ];

=== modified file 'storage/ndb/src/ndbapi/NdbInterpretedCode.cpp'
--- a/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp	2008-04-07 09:52:25 +0000
+++ b/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp	2008-05-22 16:22:34 +0000
@@ -511,14 +511,25 @@ NdbInterpretedCode::branch_col(Uint32 br
   if (val == NULL)
     len = 0;
   else {
-    if (! col->getStringType()) {
-      // prevent assert in NdbSqlUtil on length error
-      Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize;
-      if (len != 0 && len != sizeInBytes)
+    if (! col->getStringType())
+    {
+      /* Fixed size type */
+      len= col->m_attrSize * col->m_arraySize;
+    }
+    else
+    {
+      /* For Like and Not like we must use the passed in 
+       * length.  Otherwise we use the length encoded
+       * in the passed string
+       */
+      if ((branch_type != Interpreter::LIKE) &&
+          (branch_type != Interpreter::NOT_LIKE))
       {
-        DBUG_RETURN(error(BadLength));
+        if (! col->get_var_length(val, len))
+        {
+          DBUG_RETURN(error(BadLength));
+        }
       }
-      len = sizeInBytes;
     }
   }
 

=== modified file 'storage/ndb/src/ndbapi/NdbOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperation.cpp	2008-02-19 10:41:22 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperation.cpp	2008-04-17 06:59:16 +0000
@@ -313,26 +313,62 @@ NdbOperation::getValue(const NdbDictiona
 int
 NdbOperation::equal(const char* anAttrName, const char* aValuePassed)
 {
-  return equal_impl(m_accessTable->getColumn(anAttrName), aValuePassed);
+  const NdbColumnImpl* col = m_accessTable->getColumn(anAttrName);
+  if (col == NULL)
+  {
+    setErrorCode(4004);
+    return -1;
+  }
+  else
+  {
+    return equal_impl(col, aValuePassed);
+  }
 }
 
 int
 NdbOperation::equal(Uint32 anAttrId, const char* aValuePassed)
 {
-  return equal_impl(m_accessTable->getColumn(anAttrId), aValuePassed);
+    const NdbColumnImpl* col = m_accessTable->getColumn(anAttrId);
+  if (col == NULL)
+  {
+    setErrorCode(4004);
+    return -1;
+  }
+  else
+  {
+    return equal_impl(col, aValuePassed);
+  }
 }
 
 int
 NdbOperation::setValue(const char* anAttrName, const char* aValuePassed)
 {
-  return setValue(m_currentTable->getColumn(anAttrName), aValuePassed);
+  const NdbColumnImpl* col = m_currentTable->getColumn(anAttrName);
+  if (col == NULL)
+  {
+    setErrorCode(4004);
+    return -1;
+  }
+  else
+  {
+    return setValue(col, aValuePassed);
+  }
 }
 
 
 int
 NdbOperation::setValue(Uint32 anAttrId, const char* aValuePassed)
 {
-  return setValue(m_currentTable->getColumn(anAttrId), aValuePassed);
+  const NdbColumnImpl* col = m_currentTable->getColumn(anAttrId);
+  if (col == NULL)
+  {
+    setErrorCode(4004);
+    return -1;
+  }
+  else
+  {
+    return setValue(col, aValuePassed);
+  }
 }
 
 NdbBlob*

=== modified file 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2008-04-08 14:13:10 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2008-08-07 13:36:47 +0000
@@ -481,7 +481,7 @@ NdbOperation::setValue( const NdbColumnI
   int tReturnCode;
   Uint32 tAttrId;
   Uint32 tData;
-  Uint32 tempData[2000];
+  Uint32 tempData[ NDB_MAX_TUPLE_SIZE_IN_WORDS ];
   OperationType tOpType = theOperationType;
   OperationStatus tStatus = theStatus;
 
@@ -884,7 +884,9 @@ NdbOperation::setVarValue(const NdbColum
   DBUG_PRINT("info", ("aLen=%u", (Uint32)aLen));
 
   // wl3717_todo not optimal..
-  Uint64 buf[2048];
+  const Uint32 MaxTupleSizeInLongWords= (NDB_MAX_TUPLE_SIZE + 7)/ 8;
+  Uint64 buf[ MaxTupleSizeInLongWords ];
+  assert( aLen < (NDB_MAX_TUPLE_SIZE - 2) );
   unsigned char* p = (unsigned char*)buf;
   p[0] = (aLen & 0xff);
   p[1] = (aLen >> 8);

=== modified file 'storage/ndb/src/ndbapi/NdbOperationExec.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp	2008-04-01 15:37:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp	2008-06-03 10:00:31 +0000
@@ -606,7 +606,7 @@ int
 NdbOperation::buildSignalsNdbRecord(Uint32 aTC_ConnectPtr, 
                                     Uint64 aTransId)
 {
-  char buf[256];
+  char buf[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
   Uint32 *keyInfoPtr, *attrInfoPtr;
   Uint32 remain;
   int res;

=== modified file 'storage/ndb/src/ndbapi/NdbOperationInt.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp	2008-04-08 14:13:10 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp	2008-08-07 13:36:47 +0000
@@ -58,12 +58,28 @@ NdbOperation::initInterpreter(){
   theTotalCurrAI_Len = AttrInfo::SectionSizeInfoLength;
 }
 
+bool
+NdbOperation::isNdbRecordOperation()
+{
+  /* All scans are 'NdbRecord'.  For PK and UK access
+   * check if we've got an m_attribute_record set 
+   */
+  return !(((m_type == PrimaryKeyAccess) ||
+            (m_type == UniqueIndexAccess)) &&
+           (m_attribute_record == NULL));
+}
+
 int
 NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord)) 
+    if (tNdbColumnImpl == NULL)
       goto inc_check_error1;
     if ((tNdbColumnImpl->getInterpretableType() != true) ||
         (tNdbColumnImpl->m_pk != false) ||
@@ -90,11 +106,6 @@ NdbOperation::incCheck(const NdbColumnIm
   return -1;
   
  inc_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
   
@@ -118,9 +129,14 @@ NdbOperation::incCheck(const NdbColumnIm
 int
 NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord)) 
+    if (tNdbColumnImpl == NULL)
       goto write_attr_check_error1;
     if ((tNdbColumnImpl->getInterpretableType() == false) ||
         (tNdbColumnImpl->m_pk))
@@ -143,11 +159,6 @@ NdbOperation::write_attrCheck(const NdbC
   return -1;
 
 write_attr_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
 
@@ -167,9 +178,14 @@ write_attr_check_error2:
 int
 NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
-    if ((tNdbColumnImpl == NULL) ||
-        (theStatus == UseNdbRecord))
+    if (tNdbColumnImpl == NULL)
       goto read_attr_check_error1;
     if (tNdbColumnImpl->getInterpretableType() == false)
       goto read_attr_check_error2;
@@ -194,11 +210,6 @@ NdbOperation::read_attrCheck(const NdbCo
   return -1;
   
  read_attr_check_error1:
-  if (theStatus == UseNdbRecord) {
-    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-    setErrorCodeAbort(4537);
-    return -1;
-  }
   setErrorCodeAbort(4004);
   return -1;
   
@@ -214,13 +225,15 @@ NdbOperation::read_attrCheck(const NdbCo
 int
 NdbOperation::initial_interpreterCheck()
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == GetValue) {
       theInitialReadSize = theTotalCurrAI_Len - AttrInfo::SectionSizeInfoLength;
       theStatus = ExecInterpretedValue;
@@ -242,13 +255,15 @@ NdbOperation::initial_interpreterCheck()
 int
 NdbOperation::labelCheck()
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == GetValue) {
       theInitialReadSize = theTotalCurrAI_Len - AttrInfo::SectionSizeInfoLength;
       theStatus = ExecInterpretedValue;
@@ -272,13 +287,15 @@ NdbOperation::labelCheck()
 int
 NdbOperation::intermediate_interpreterCheck()
 {
+  if (isNdbRecordOperation()) {
+    /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
+    setErrorCodeAbort(4537);
+    return -1;
+  }
+
   if ((theInterpretIndicator == 1)) {
     if (theStatus == ExecInterpretedValue) {
-       return 0; // Simply continue with interpretation
-    } else if (theStatus == UseNdbRecord) {
-      /* Wrong API.  Use NdbInterpretedCode for NdbRecord operations */
-      setErrorCodeAbort(4537);
-      return -1;
+      return 0; // Simply continue with interpretation
     } else if (theStatus == SubroutineExec) {
        return 0; // Simply continue with interpretation
     } else {
@@ -1073,21 +1090,32 @@ NdbOperation::branch_col(Uint32 type, 
   if (val == NULL)
     len = 0;
   else {
-    if (! col->getStringType()) {
-      // prevent assert in NdbSqlUtil on length error
-      Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize;
-      if (len != 0 && len != sizeInBytes)
+    if (! col->getStringType())
+    {
+      /* Fixed size type */
+      len= col->m_attrSize * col->m_arraySize;
+    }
+    else
+    {
+      /* For Like and Not like we must use the passed in 
+       * length.  Otherwise we use the length encoded
+       * in the passed string
+       */
+      if ((type != Interpreter::LIKE) &&
+          (type != Interpreter::NOT_LIKE))
       {
-        setErrorCodeAbort(4209);
-        DBUG_RETURN(-1);
+        if (! col->get_var_length(val, len))
+        {
+          setErrorCodeAbort(4209);
+          DBUG_RETURN(-1);
+        }
       }
-      len = sizeInBytes;
     }
   }
 
   m_no_disk_flag &= (col->m_storageType == NDB_STORAGETYPE_DISK ? 0:1);
 
-  Uint32 tempData[2000];
+  Uint32 tempData[ NDB_MAX_TUPLE_SIZE_IN_WORDS ];
   if (((UintPtr)val & 3) != 0) {
     memcpy(tempData, val, len);
     val = tempData;

=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2008-04-08 14:13:10 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2008-08-07 13:36:47 +0000
@@ -62,7 +62,8 @@ NdbOperation::equal_impl(const NdbColumn
                        (long) aValuePassed));
   
   const char* aValue = aValuePassed;
-  Uint64 tempData[512];
+  const Uint32 MaxKeyLenInLongWords= (NDB_MAX_KEY_SIZE + 7)/8;
+  Uint64 tempData[ MaxKeyLenInLongWords ];
 
   if ((theStatus == OperationDefined) &&
       (aValue != NULL) &&
@@ -465,8 +466,8 @@ LastWordLabel:
 void
 NdbOperation::reorderKEYINFO()
 {
-  Uint32 data[4000];
-  Uint32 size = 4000;
+  Uint32 data[ NDB_MAX_KEYSIZE_IN_WORDS ];
+  Uint32 size = NDB_MAX_KEYSIZE_IN_WORDS;
   getKeyFromTCREQ(data, size);
   Uint32 pos = 1;
   Uint32 k;
@@ -480,7 +481,8 @@ NdbOperation::reorderKEYINFO()
           if (theTupleKeyDefined[j][0] == i) {
             Uint32 off = theTupleKeyDefined[j][1] - 1;
             Uint32 len = theTupleKeyDefined[j][2];
-            assert(off < 4000 && off + len <= 4000);
+            assert(off < NDB_MAX_KEYSIZE_IN_WORDS && 
+                   off + len <= NDB_MAX_KEYSIZE_IN_WORDS);
             int ret = insertKEYINFO((char*)&data[off], pos, len);
             assert(ret == 0);
             pos += len;
@@ -508,11 +510,12 @@ NdbOperation::getKeyFromTCREQ(Uint32* da
   NdbApiSignal* tSignal = theTCREQ->next();
   unsigned n = 0;
   while (pos < size) {
-    if (n == 20) {
+    if (n == KeyInfo::DataLength) {
       tSignal = tSignal->next();
       n = 0;
     }
-    data[pos++] = tSignal->getDataPtrSend()[3 + n++];
+    data[pos++] = 
+      tSignal->getDataPtrSend()[KeyInfo::HeaderLength + n++];
   }
   return 0;
 }
@@ -538,7 +541,8 @@ NdbOperation::handle_distribution_key(co
     ptrs[0].len = len;
     ptrs[1].ptr = 0;
     
-    Uint64 tmp[1000];
+    const Uint32 MaxKeyLenInLongWords= (NDB_MAX_KEY_SIZE + 7)/ 8; 
+    Uint64 tmp[ MaxKeyLenInLongWords ]; 
     Uint32 hashValue;
     int ret = Ndb::computeHash(&hashValue, 
                                m_currentTable,

=== modified file 'storage/ndb/src/ndbapi/NdbRecord.hpp'
--- a/storage/ndb/src/ndbapi/NdbRecord.hpp	2008-04-01 15:37:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbRecord.hpp	2008-06-03 10:00:31 +0000
@@ -133,6 +133,9 @@ public:
       return (flags & IsNullable) &&
              (row[nullbit_byte_offset] & (1 << nullbit_bit_in_byte));
     }
+
+    /* 255 bytes of data and 1 byte of length */
+    STATIC_CONST( SHRINK_VARCHAR_BUFFSIZE= 256 );
     /*
       Mysqld uses a slightly different format for storing varchar in
       index keys; the length is always two bytes little endian, even
@@ -143,7 +146,7 @@ public:
     {
       const char *p= row + offset;
       Uint32 len= uint2korr(p);
-      if (len >= 256 || len >= maxSize)
+      if (len >= SHRINK_VARCHAR_BUFFSIZE || len >= maxSize)
         return false;
       buf[0]= (unsigned char)len;
       memcpy(buf+1, p+2, len);

=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2008-04-07 14:27:02 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2008-08-07 13:36:47 +0000
@@ -121,6 +121,11 @@ NdbScanOperation::init(const NdbTableImp
   m_executed = false;
   m_scanUsingOldApi= false;
   m_interpretedCodeOldApi= NULL;
+
+  m_api_receivers_count = 0;
+  m_current_api_receiver = 0;
+  m_sent_receivers_count = 0;
+  m_conf_receivers_count = 0;
   return 0;
 }
 
@@ -510,25 +515,58 @@ NdbIndexScanOperation::setDistKeyFromRan
                                            const char *row,
                                            Uint32 distkeyMax)
 {
-  Uint64 tmp[1000];
+  const Uint32 MaxKeySizeInLongWords= (NDB_MAX_KEY_SIZE + 7) / 8; 
+  Uint64 tmp[ MaxKeySizeInLongWords ];
+  char* tmpshrink = (char*)tmp;
+  size_t tmplen = sizeof(tmp);
+  
   Ndb::Key_part_ptr ptrs[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY+1];
   Uint32 i;
   for (i = 0; i<key_record->distkey_index_length; i++)
   {
     const NdbRecord::Attr *col =
       &key_record->columns[key_record->distkey_indexes[i]];
-    ptrs[i].ptr = row + col->offset;
+    if (col->flags & NdbRecord::IsMysqldShrinkVarchar)
+    {
+      if (tmplen >= 256)
+      {
+        Uint32 len;
+        bool len_ok = col->shrink_varchar(row, len, tmpshrink);
+        if (!len_ok)
+        {
+          assert(false);
+          return;
+        }
+        ptrs[i].ptr = tmpshrink;
+        tmpshrink += len;
+        tmplen -= len;
+      }
+      else
+      {
+        // no buffer...
+        return;
+      }
+    }
+    else
+    {
+      ptrs[i].ptr = row + col->offset;
+    }
     ptrs[i].len = col->maxSize;
   }
   ptrs[i].ptr = 0;
   
   Uint32 hashValue;
   int ret = Ndb::computeHash(&hashValue, result_record->table,
-                             ptrs, tmp, sizeof(tmp));
+                             ptrs, tmpshrink, tmplen);
   if (ret == 0)
   {
     theDistributionKey= result_record->table->getPartitionId(hashValue);
     theDistrKeyIndicator_= 1;
+
+    ScanTabReq *req= CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
+    ScanTabReq::setDistributionKeyFlag(req->requestInfo, 1);
+    req->distributionKey= theDistributionKey;
+    theSCAN_TABREQ->setLength(ScanTabReq::StaticLength + 1);
   }
 #ifdef VM_TRACE
   else
@@ -571,6 +609,14 @@ NdbIndexScanOperation::setBound(const Nd
     return -1;
   }
 
+  if (((bound.low_key == NULL) && (bound.high_key == NULL)) ||
+      ((bound.low_key_count == 0) && (bound.high_key_count == 0)))
+  {
+    /* IndexBound passed has no bound information */
+    setErrorCodeAbort(4541);
+    return -1;
+  }
+
   m_num_bounds++;
 
   if (unlikely((m_num_bounds > 1) &&
@@ -1720,12 +1766,24 @@ int NdbScanOperation::finaliseScanOldApi
   {
     assert(theOperationType == OpenRangeScanRequest);
     NdbIndexScanOperation *isop = 
-      reinterpret_cast<NdbIndexScanOperation*>(this);
+      static_cast<NdbIndexScanOperation*>(this);
 
     /* Prepare a single bound if necessary */
     NdbIndexScanOperation::IndexBound ib;
-    if (isop->buildIndexBoundOldApi(ib) != 0)
+    NdbIndexScanOperation::IndexBound* ib_ptr= NULL;
+
+    switch (isop->buildIndexBoundOldApi(ib)) {
+    case 0:
+      /* Bound was specified */
+      ib_ptr= &ib;
+      break;
+    case 1:
+      /* No bound was specified */
+      ib_ptr= NULL; 
+      break;
+    default:
       return -1;
+    }
 
     /* If this is an ordered scan, then we need
      * the pk columns in the mask, otherwise we
@@ -1733,14 +1791,14 @@ int NdbScanOperation::finaliseScanOldApi
      */
     const unsigned char * resultMask= 
       ((m_savedScanFlagsOldApi & SF_OrderBy) !=0) ? 
-      m_currentTable->m_pkMask : 
+      m_accessTable->m_pkMask : 
       emptyMask;
 
     result= isop->scanIndexImpl(m_accessTable->m_ndbrecord,
                                 m_currentTable->m_ndbrecord,
                                 m_savedLockModeOldApi,
                                 resultMask,
-                                &ib,
+                                ib_ptr,
                                 &options,
                                 sizeof(ScanOptions));
 
@@ -2650,10 +2708,16 @@ NdbIndexScanOperation::setBound(const Nd
 /* Method called just prior to scan execution to initialise
  * the passed in IndexBound for the scan using the information
  * stored by the old API's setBound() call.
+ * Return codes 
+ *  0 == bound present and built
+ *  1 == bound not present
+ * -1 == error
  */
 int
 NdbIndexScanOperation::buildIndexBoundOldApi(IndexBound& ib)
 {
+  int result= 1;
+
   if (lowBound.highestKey != 0)
   {
     /* Have a low bound 
@@ -2672,6 +2736,7 @@ NdbIndexScanOperation::buildIndexBoundOl
     ib.low_key= lowBound.keyRecAttr->aRef();
     ib.low_key_count= lowBound.highestKey;
     ib.low_inclusive= !lowBound.highestSoFarIsStrict;
+    result= 0;
   }
   else
   {
@@ -2697,6 +2762,7 @@ NdbIndexScanOperation::buildIndexBoundOl
     ib.high_key= highBound.keyRecAttr->aRef();
     ib.high_key_count= highBound.highestKey;
     ib.high_inclusive= !highBound.highestSoFarIsStrict;
+    result= 0;
   }
   else
   {
@@ -2707,7 +2773,7 @@ NdbIndexScanOperation::buildIndexBoundOl
 
   ib.range_no= 0;
 
-  return 0;
+  return result;
 }
 
 /* Method called to release any resources allocated by the old 
@@ -2789,7 +2855,7 @@ NdbIndexScanOperation::ndbrecord_insert_
                                               const char *row,
                                               Uint32 bound_type)
 {
-  char buf[256];
+  char buf[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
   Uint32 currLen= theTotalNrOfKeyWordInSignal;
   Uint32 remaining= KeyInfo::DataLength - currLen;
   const NdbRecord::Attr *column= &key_record->columns[column_index];
@@ -2839,7 +2905,10 @@ NdbIndexScanOperation::ndbrecord_insert_
     theTotalNrOfKeyWordInSignal= currLen + totalLen;
   } else {
     if(!aligned || !nobytes){
-      Uint32 tempData[2000];
+      /* Space for Bound type, Attr header and (possibly max-sized)
+       * key column
+       */
+      Uint32 tempData[ KeyInfo::MaxWordsPerBoundColumn ];
       if (len > sizeof(tempData))
         len= sizeof(tempData);
       tempData[0] = bound_type;

=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-04-07 14:27:02 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-08-07 13:36:47 +0000
@@ -307,8 +307,30 @@ NdbTransaction::execute(ExecType aTypeOf
    * NdbBlob::postExecute() for more info.
    */
 
-  ExecType tExecType;
   NdbOperation* tPrepOp;
+
+  if (abortOption != NdbOperation::DefaultAbortOption)
+  {
+    DBUG_PRINT("info", ("Forcing operations to take execute() abortOption %d",
+                        abortOption));
+    /* For Blobs, we have to execute with DefaultAbortOption
+     * If the user supplied a non default AbortOption to execute()
+     * then we need to make sure that all of the operations in their
+     * batch are set to use the supplied AbortOption so that the 
+     * expected behaviour is obtained when executing below
+     */
+    tPrepOp= theFirstOpInList;
+    while(tPrepOp != NULL)
+    {
+      DBUG_PRINT("info", ("Changing abortOption from %d", 
+                          tPrepOp->m_abortOption));
+      tPrepOp->m_abortOption= abortOption;
+      tPrepOp= tPrepOp->next();
+    }
+  }
+
+
+  ExecType tExecType;
   NdbOperation* tCompletedFirstOp = NULL;
   NdbOperation* tCompletedLastOp = NULL;
 
@@ -524,14 +546,14 @@ NdbTransaction::executeNoBlobs(NdbTransa
          * We behave rather similarly in both places.
          * Hitting this is certainly a bug though...
          */
-        g_eventLogger.error("WARNING: Timeout in executeNoBlobs() waiting for "
-                            "response from NDB data nodes. This should NEVER "
-                            "occur. You have likely hit a NDB Bug. Please "
-                            "file a bug.");
+        g_eventLogger->error("WARNING: Timeout in executeNoBlobs() waiting for "
+                             "response from NDB data nodes. This should NEVER "
+                             "occur. You have likely hit a NDB Bug. Please "
+                             "file a bug.");
         DBUG_PRINT("error",("This timeout should never occure, execute()"));
-        g_eventLogger.error("Forcibly trying to rollback txn (%p"
-                            ") to try to clean up data node resources.",
-                            this);
+        g_eventLogger->error("Forcibly trying to rollback txn (%p"
+                             ") to try to clean up data node resources.",
+                             this);
         executeNoBlobs(NdbTransaction::Rollback);
         theError.code = 4012;
         theError.status= NdbError::PermanentError;
@@ -935,7 +957,7 @@ NdbTransaction::sendROLLBACK()      // S
     tSignal.setData(tTransId2, 3);
     if(theError.code == 4012)
     {
-      g_eventLogger.error("Sending TCROLLBACKREQ with Bad flag");
+      g_eventLogger->error("Sending TCROLLBACKREQ with Bad flag");
       tSignal.setLength(tSignal.getLength() + 1); // + flags
       tSignal.setData(0x1, 4); // potentially bad data
     }

=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp	2007-09-12 11:30:27 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp	2008-04-22 19:36:05 +0000
@@ -44,7 +44,7 @@
 #include <NdbTick.h>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 /******************************************************************************
  * int init( int aNrOfCon, int aNrOfOp );
@@ -743,8 +743,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* 
 
     if (unlikely(op == 0 || op->m_magic_number != NDB_EVENT_OP_MAGIC_NUMBER))
     {
-      g_eventLogger.error("dropped GSN_SUB_TABLE_DATA due to wrong magic "
-			  "number");
+      g_eventLogger->error("dropped GSN_SUB_TABLE_DATA due to wrong magic "
+                           "number");
       return ;
     }
 

=== modified file 'storage/ndb/src/ndbapi/Ndbinit.cpp'
--- a/storage/ndb/src/ndbapi/Ndbinit.cpp	2008-03-26 23:22:46 +0000
+++ b/storage/ndb/src/ndbapi/Ndbinit.cpp	2008-08-07 13:36:47 +0000
@@ -35,7 +35,7 @@
 #include "NdbEventOperationImpl.hpp"
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 Ndb::Ndb( Ndb_cluster_connection *ndb_cluster_connection,
 	  const char* aDataBase , const char* aSchema)
@@ -142,7 +142,7 @@ Ndb::~Ndb()
   for (NdbEventOperationImpl *op= theImpl->m_ev_op; op; op=op->m_next)
   {
     if (op->m_state == NdbEventOperation::EO_EXECUTING && op->stop())
-      g_eventLogger.error("stopping NdbEventOperation failed in Ndb destructor");
+      g_eventLogger->error("stopping NdbEventOperation failed in Ndb destructor");
     op->m_magic_number= 0;
   }
   doDisconnect();

=== modified file 'storage/ndb/src/ndbapi/ObjectMap.cpp'
--- a/storage/ndb/src/ndbapi/ObjectMap.cpp	2007-04-11 16:10:45 +0000
+++ b/storage/ndb/src/ndbapi/ObjectMap.cpp	2008-04-22 19:36:05 +0000
@@ -53,8 +53,8 @@ int NdbObjectIdMap::expand(Uint32 incSiz
   else
   {
     NdbMutex_Unlock(m_mutex);
-    g_eventLogger.error("NdbObjectIdMap::expand: realloc(%u*%u) failed",
-                        newSize, sizeof(MapEntry));
+    g_eventLogger->error("NdbObjectIdMap::expand: realloc(%u*%u) failed",
+                         newSize, sizeof(MapEntry));
     return -1;
   }
   NdbMutex_Unlock(m_mutex);

=== modified file 'storage/ndb/src/ndbapi/ObjectMap.hpp'
--- a/storage/ndb/src/ndbapi/ObjectMap.hpp	2007-04-11 13:51:09 +0000
+++ b/storage/ndb/src/ndbapi/ObjectMap.hpp	2008-04-22 19:36:05 +0000
@@ -21,7 +21,7 @@
 #include <NdbOut.hpp>
 
 #include <EventLogger.hpp>
-extern EventLogger g_eventLogger;
+extern EventLogger * g_eventLogger;
 
 //#define DEBUG_OBJECTMAP
 
@@ -85,8 +85,8 @@ NdbObjectIdMap::unmap(Uint32 id, void *o
       m_map[i].m_next = m_firstFree;
       m_firstFree = i;
     } else {
-      g_eventLogger.error("NdbObjectIdMap::unmap(%u, 0x%x) obj=0x%x",
-                          id, (long) object, (long) obj);
+      g_eventLogger->error("NdbObjectIdMap::unmap(%u, 0x%x) obj=0x%x",
+                           id, (long) object, (long) obj);
       DBUG_PRINT("error",("NdbObjectIdMap::unmap(%u, 0x%lx) obj=0x%lx",
                           id, (long) object, (long) obj));
       return 0;

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp	2007-04-02 19:37:49 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp	2008-05-16 13:08:36 +0000
@@ -176,7 +176,8 @@ private:
   friend class Ndb;
   friend class Ndb_cluster_connection_impl;
   friend class NdbTransaction;
-  
+  friend class NdbDictInterface;
+
   int sendSignalUnCond(NdbApiSignal *, NodeId nodeId);
 
   bool isConnected(NodeId aNodeId);

=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2007-04-12 14:04:47 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2008-04-22 19:36:05 +0000
@@ -31,14 +31,14 @@
 #include <mgmapi_internal.h>
 #include <md5_hash.hpp>
 
-#include <EventLogger.hpp>
-EventLogger g_eventLogger;
-
 #include <NdbMutex.h>
 #ifdef VM_TRACE
 NdbMutex *ndb_print_state_mutex= NULL;
 #endif
 
+#include <EventLogger.hpp>
+extern EventLogger *g_eventLogger;
+
 static int g_ndb_connection_count = 0;
 
 /*
@@ -285,13 +285,46 @@ Ndb_cluster_connection_impl(const char *
   DBUG_ENTER("Ndb_cluster_connection");
   DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%lx", (long) this));
 
+  NdbMutex_Lock(g_ndb_connection_mutex);
+  if(g_ndb_connection_count++ == 0){
+    NdbDictionary::Column::FRAGMENT= 
+      NdbColumnImpl::create_pseudo("NDB$FRAGMENT");
+    NdbDictionary::Column::FRAGMENT_FIXED_MEMORY= 
+      NdbColumnImpl::create_pseudo("NDB$FRAGMENT_FIXED_MEMORY");
+    NdbDictionary::Column::FRAGMENT_VARSIZED_MEMORY= 
+      NdbColumnImpl::create_pseudo("NDB$FRAGMENT_VARSIZED_MEMORY");
+    NdbDictionary::Column::ROW_COUNT= 
+      NdbColumnImpl::create_pseudo("NDB$ROW_COUNT");
+    NdbDictionary::Column::COMMIT_COUNT= 
+      NdbColumnImpl::create_pseudo("NDB$COMMIT_COUNT");
+    NdbDictionary::Column::ROW_SIZE=
+      NdbColumnImpl::create_pseudo("NDB$ROW_SIZE");
+    NdbDictionary::Column::RANGE_NO= 
+      NdbColumnImpl::create_pseudo("NDB$RANGE_NO");
+    NdbDictionary::Column::DISK_REF= 
+      NdbColumnImpl::create_pseudo("NDB$DISK_REF");
+    NdbDictionary::Column::RECORDS_IN_RANGE= 
+      NdbColumnImpl::create_pseudo("NDB$RECORDS_IN_RANGE");
+    NdbDictionary::Column::ROWID= 
+      NdbColumnImpl::create_pseudo("NDB$ROWID");
+    NdbDictionary::Column::ROW_GCI= 
+      NdbColumnImpl::create_pseudo("NDB$ROW_GCI");
+    NdbDictionary::Column::ANY_VALUE= 
+      NdbColumnImpl::create_pseudo("NDB$ANY_VALUE");
+    NdbDictionary::Column::COPY_ROWID= 
+      NdbColumnImpl::create_pseudo("NDB$COPY_ROWID");
+
+    g_eventLogger->createConsoleHandler();
+    g_eventLogger->setCategory("NdbApi");
+    g_eventLogger->enable(Logger::LL_ON, Logger::LL_ERROR);
+
+  }
+  NdbMutex_Unlock(g_ndb_connection_mutex);
+
   if (!m_event_add_drop_mutex)
     m_event_add_drop_mutex= NdbMutex_Create();
   m_new_delete_ndb_mutex = NdbMutex_Create();
-  
-  g_eventLogger.createConsoleHandler();
-  g_eventLogger.setCategory("NdbApi");
-  g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
+
 
   m_connect_thread= 0;
   m_connect_callback= 0;
@@ -327,36 +360,6 @@ Ndb_cluster_connection_impl(const char *
       new TransporterFacade(m_main_connection->m_impl.m_globalDictCache);
   }
 
-  NdbMutex_Lock(g_ndb_connection_mutex);
-  if(g_ndb_connection_count++ == 0){
-    NdbDictionary::Column::FRAGMENT= 
-      NdbColumnImpl::create_pseudo("NDB$FRAGMENT");
-    NdbDictionary::Column::FRAGMENT_FIXED_MEMORY= 
-      NdbColumnImpl::create_pseudo("NDB$FRAGMENT_FIXED_MEMORY");
-    NdbDictionary::Column::FRAGMENT_VARSIZED_MEMORY= 
-      NdbColumnImpl::create_pseudo("NDB$FRAGMENT_VARSIZED_MEMORY");
-    NdbDictionary::Column::ROW_COUNT= 
-      NdbColumnImpl::create_pseudo("NDB$ROW_COUNT");
-    NdbDictionary::Column::COMMIT_COUNT= 
-      NdbColumnImpl::create_pseudo("NDB$COMMIT_COUNT");
-    NdbDictionary::Column::ROW_SIZE=
-      NdbColumnImpl::create_pseudo("NDB$ROW_SIZE");
-    NdbDictionary::Column::RANGE_NO= 
-      NdbColumnImpl::create_pseudo("NDB$RANGE_NO");
-    NdbDictionary::Column::DISK_REF= 
-      NdbColumnImpl::create_pseudo("NDB$DISK_REF");
-    NdbDictionary::Column::RECORDS_IN_RANGE= 
-      NdbColumnImpl::create_pseudo("NDB$RECORDS_IN_RANGE");
-    NdbDictionary::Column::ROWID= 
-      NdbColumnImpl::create_pseudo("NDB$ROWID");
-    NdbDictionary::Column::ROW_GCI= 
-      NdbColumnImpl::create_pseudo("NDB$ROW_GCI");
-    NdbDictionary::Column::ANY_VALUE= 
-      NdbColumnImpl::create_pseudo("NDB$ANY_VALUE");
-    NdbDictionary::Column::COPY_ROWID= 
-      NdbColumnImpl::create_pseudo("NDB$COPY_ROWID");
-  }
-  NdbMutex_Unlock(g_ndb_connection_mutex);
 
   DBUG_VOID_RETURN;
 }
@@ -429,6 +432,7 @@ Ndb_cluster_connection_impl::~Ndb_cluste
 
     delete NdbDictionary::Column::COPY_ROWID;
     NdbDictionary::Column::COPY_ROWID = 0;
+    
   }
   NdbMutex_Unlock(g_ndb_connection_mutex);
 

=== modified file 'storage/ndb/src/ndbapi/ndberror.c'
--- a/storage/ndb/src/ndbapi/ndberror.c	2008-04-02 14:32:01 +0000
+++ b/storage/ndb/src/ndbapi/ndberror.c	2008-08-07 13:36:47 +0000
@@ -584,6 +584,7 @@ ErrorBundle ErrorCodes[] = {
   { 4538, DMEC, AE, "NdbInterpretedCode instruction requires that table is set" },
   { 4539, DMEC, AE, "NdbInterpretedCode not supported for operation type" },
   { 4540, DMEC, AE, "Attempt to pass an Index column to createRecord.  Use base table
columns only" },
+  { 4541, DMEC, AE, "IndexBound has no bound information" },
 
   { 4200, DMEC, AE, "Status Error when defining an operation" },
   { 4201, DMEC, AE, "Variable Arrays not yet supported" },

=== modified file 'storage/ndb/test/ndbapi/testBlobs.cpp'
--- a/storage/ndb/test/ndbapi/testBlobs.cpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/test/ndbapi/testBlobs.cpp	2008-05-23 10:20:10 +0000
@@ -165,6 +165,7 @@ printusage()
     << "  -bug 4088   ndb api hang with mixed ops on index table" << endl
     << "  -bug 27018  middle partial part write clobbers rest of part" <<
endl
     << "  -bug 27370  Potential inconsistent blob reads for ReadCommitted reads"
<< endl
+    << "  -bug 36756  Handling execute(.., abortOption) and Blobs " << endl
     ;
 }
 
@@ -2198,6 +2199,322 @@ deleteScan(int api, bool idx)
   return 0;
 }
 
+
+enum OpTypes { 
+  PkRead,
+  PkInsert,
+  PkUpdate,
+  PkWrite,
+  PkDelete,
+  UkRead,
+  UkUpdate,
+  UkWrite,
+  UkDelete};
+
+static const char*
+operationName(OpTypes optype)
+{
+  switch(optype){
+  case PkRead:
+    return "Pk Read";
+  case PkInsert:
+    return "Pk Insert";
+  case PkUpdate:
+    return "Pk Update";
+  case PkWrite:
+    return "Pk Write";
+  case PkDelete:
+    return "Pk Delete";
+  case UkRead:
+    return "Uk Read";
+  case UkUpdate:
+    return "Uk Update";
+  case UkWrite:
+    return "Uk Write";
+  case UkDelete:
+    return "Uk Delete";
+  default:
+    return "Bad operation type";
+  }
+}
+
+static const char*
+aoName(int abortOption)
+{
+  if (abortOption == 0)
+    return "AbortOnError";
+  return "IgnoreError";
+}
+
+static int
+setupOperation(NdbOperation*& op, OpTypes optype, Tup& tup)
+{
+  bool pkop;
+  switch(optype){
+  case PkRead: case PkInsert : case PkUpdate: 
+  case PkWrite : case PkDelete :
+    pkop=true;
+    break;
+  default:
+    pkop= false;
+  }
+  
+  if (pkop)
+    CHK((op= g_con->getNdbOperation(g_opt.m_tname)) != 0);
+  else
+    CHK((op = g_con->getNdbIndexOperation(g_opt.m_x1name, g_opt.m_tname)) != 0);
+
+  switch(optype){
+  case PkRead:
+  case UkRead:
+    CHK(op->readTuple() == 0);
+    break;
+  case PkInsert:
+    CHK(op->insertTuple() == 0);
+    break;
+  case PkUpdate:
+  case UkUpdate:
+    CHK(op->updateTuple() == 0);
+    break;
+  case PkWrite:
+  case UkWrite:
+    CHK(op->writeTuple() == 0);
+    break;
+  case PkDelete:
+  case UkDelete:
+    CHK(op->deleteTuple() == 0);
+    break;
+  default:
+    CHK(false);
+    return -1;
+  }
+  
+  if (pkop)
+  {
+    CHK(op->equal("PK1", tup.m_pk1) == 0);
+    if (g_opt.m_pk2chr.m_len != 0)
+    {
+      CHK(op->equal("PK2", tup.m_pk2) == 0);
+      CHK(op->equal("PK3", tup.m_pk3) == 0);
+    }
+  }
+  else
+  {
+    CHK(op->equal("PK2", tup.m_pk2) == 0);
+    CHK(op->equal("PK3", tup.m_pk3) == 0);
+  }
+  
+  CHK(getBlobHandles(op) == 0);
+  
+  switch(optype){
+  case PkRead:
+  case UkRead:
+    CHK(getBlobValue(tup) == 0);
+    break;
+  case PkInsert:
+  case PkUpdate:
+  case UkUpdate:
+    /* Fall through */
+  case PkWrite:
+  case UkWrite:
+    CHK(setBlobValue(tup) == 0);
+    break;
+  case PkDelete:
+  case UkDelete:
+    /* Nothing */
+    break;
+  default:
+    CHK(false);
+    return -1;
+  }
+
+  return 0;
+}
+
+static int
+bugtest_36756()
+{
+  /* Transaction which had accessed a Blob table was ignoring
+   * abortOption passed in the execute() call.
+   * Check that option passed in execute() call overrides 
+   * default / manually set operation abortOption, even in the
+   * presence of Blobs in the transaction
+   */
+
+  /* Operation         AbortOnError             IgnoreError
+   * PkRead            NoDataFound*             NoDataFound
+   * PkInsert          Duplicate key            Duplicate key*
+   * PkUpdate          NoDataFound              NoDataFound*
+   * PkWrite           NoDataFound              NoDataFound*
+   * PkDelete          NoDataFound              NoDataFound*
+   * UkRead            NoDataFound*             NoDataFound
+   * UkUpdate          NoDataFound              NoDataFound*
+   * UkWrite           NoDataFound              NoDataFound*
+   * UkDelete          NoDataFound              NoDataFound*
+   * 
+   * * Are interesting, where non-default behaviour is requested.
+   */
+  
+  struct ExpectedOutcome
+  {
+    int executeRc;
+    int transactionErrorCode;
+    int opr1ErrorCode;
+    int opr2ErrorCode;
+    int commitStatus;
+  };
+
+  /* Generally, AbortOnError sets the transaction error
+   * but not the Operation error codes
+   * IgnoreError sets the transaction error and the
+   * failing operation error code(s)
+   * Odd cases : 
+   *   Pk Write : Can't fail due to key presence, just
+   *              incorrect NULLs etc.
+   *   Uk Write : Key must exist, so not really different
+   *              to Update?
+   */
+  ExpectedOutcome outcomes[9][2]=
+  {
+    // PkRead
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // PkInsert
+    // Note operation order reversed for insert
+    {{-1, 630, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 630, 0, 630, NdbTransaction::Started}}, // IE
+    // PkUpdate
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // PkWrite
+    {{0, 0, 0, 0, NdbTransaction::Started},      // AE
+     {0, 0, 0, 0, NdbTransaction::Started}},     // IE
+    // PkDelete
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // UkRead
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // UkUpdate
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // UkWrite
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}, // IE
+    // UkDelete
+    {{-1, 626, 0, 0, NdbTransaction::Aborted},   // AE
+     {0, 626, 0, 626, NdbTransaction::Started}}  // IE
+  };
+
+  DBG("bugtest_36756 : IgnoreError Delete of nonexisting tuple aborts");
+  DBG("                Also 36851 : Insert IgnoreError of existing tuple aborts");
+
+  for (int iterations=0; iterations < 50; iterations++)
+  {
+    /* Recalculate and insert different tuple every time to 
+     * get different keys(and therefore nodes), and
+     * different length Blobs, including zero length
+     * and NULL
+     */
+    calcTups(true);
+    
+    Tup& tupExists = g_tups[0];
+    Tup& tupDoesNotExist = g_tups[1];
+    
+    /* Setup table with just 1 row present */
+    CHK((g_con= g_ndb->startTransaction()) != 0);
+    CHK((g_opr= g_con->getNdbOperation(g_opt.m_tname)) != 0);
+    CHK(g_opr->insertTuple() == 0);
+    CHK(g_opr->equal("PK1", tupExists.m_pk1) == 0);
+    if (g_opt.m_pk2chr.m_len != 0)
+    {
+      CHK(g_opr->equal("PK2", tupExists.m_pk2) == 0);
+      CHK(g_opr->equal("PK3", tupExists.m_pk3) == 0);
+    }
+    CHK(getBlobHandles(g_opr) == 0);
+    
+    CHK(setBlobValue(tupExists) == 0);
+    
+    CHK(g_con->execute(Commit) == 0);
+    g_con->close();
+    
+    DBG("Iteration : " << iterations);
+    for (int optype=PkRead; optype <= UkDelete; optype++)
+    {
+      DBG("  " << operationName((OpTypes)optype));
+
+      Tup* tup1= &tupExists;
+      Tup* tup2= &tupDoesNotExist;
+
+      if (optype == PkInsert)
+      {
+        /* Inserts - we want the failing operation to be second
+         * rather than first to avoid hitting bugs with IgnoreError
+         * and the first DML in a transaction
+         * So we swap them
+         */
+        tup1= &tupDoesNotExist; // (Insert succeeds)
+        tup2= &tupExists; //(Insert fails)
+      }
+
+      for (int abortOption=0; abortOption < 2; abortOption++)
+      {
+        DBG("    " << aoName(abortOption));
+        NdbOperation *opr1, *opr2;
+        NdbOperation::AbortOption ao= (abortOption==0)?
+          NdbOperation::AbortOnError : 
+          NdbOperation::AO_IgnoreError;
+        
+        CHK((g_con= g_ndb->startTransaction()) != 0);
+        
+        /* Operation 1 */
+        CHK(setupOperation(opr1, (OpTypes)optype, *tup1) == 0);
+        
+        /* Operation2 */
+        CHK(setupOperation(opr2, (OpTypes)optype, *tup2) == 0);
+
+        ExpectedOutcome eo= outcomes[optype][abortOption];
+        
+        int rc = g_con->execute(NdbTransaction::NoCommit, ao);
+
+        DBG("execute returned " << rc <<
+            " Trans err " << g_con->getNdbError().code <<
+            " Opr1 err " << opr1->getNdbError().code <<
+            " Opr2 err " << opr2->getNdbError().code <<
+            " CommitStatus " << g_con->commitStatus());
+
+        CHK(rc == eo.executeRc);        
+        CHK(g_con->getNdbError().code == eo.transactionErrorCode);
+        CHK(opr1->getNdbError().code == eo.opr1ErrorCode);
+        CHK(opr2->getNdbError().code == eo.opr2ErrorCode);
+        CHK(g_con->commitStatus() == eo.commitStatus);
+        
+        g_con->close();
+      }
+    }
+    
+    /* Now delete the 'existing'row */
+    CHK((g_con= g_ndb->startTransaction()) != 0);
+    CHK((g_opr= g_con->getNdbOperation(g_opt.m_tname)) != 0);
+    CHK(g_opr->deleteTuple() == 0);
+    CHK(g_opr->equal("PK1", tupExists.m_pk1) == 0);
+    if (g_opt.m_pk2chr.m_len != 0)
+    {
+      CHK(g_opr->equal("PK2", tupExists.m_pk2) == 0);
+      CHK(g_opr->equal("PK3", tupExists.m_pk3) == 0);
+    }
+
+    CHK(g_con->execute(Commit) == 0);
+    g_con->close();
+  }
+
+  g_opr= 0;
+  g_con= 0;
+  g_bh1= 0;
+
+  return 0;
+}
+
 // main
 
 // from here on print always
@@ -3026,7 +3343,8 @@ static struct {
 } g_bugtest[] = {
   { 4088, bugtest_4088 },
   { 27018, bugtest_27018 },
-  { 27370, bugtest_27370 }
+  { 27370, bugtest_27370 },
+  { 36756, bugtest_36756 }
 };
 
 NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)

=== modified file 'storage/ndb/test/ndbapi/testDict.cpp'
--- a/storage/ndb/test/ndbapi/testDict.cpp	2008-01-24 15:39:38 +0000
+++ b/storage/ndb/test/ndbapi/testDict.cpp	2008-05-30 08:03:55 +0000
@@ -24,6 +24,8 @@
 #include <random.h>
 #include <NdbAutoPtr.hpp>
 #include <NdbMixRestarter.hpp>
+#include <NdbSqlUtil.hpp>
+#include <NdbEnv.h>
 
 char f_tablename[256];
  
@@ -1967,10 +1969,13 @@ runCreateDiskTable(NDBT_Context* ctx, ND
   return NDBT_OK;
 }
 
+#include <NDBT_Tables.hpp>
+
 int runFailAddFragment(NDBT_Context* ctx, NDBT_Step* step){
-  static int acclst[] = { 3001 };
+  static int acclst[] = { 3001, 6200, 6202 };
   static int tuplst[] = { 4007, 4008, 4009, 4010, 4011, 4012 };
-  static int tuxlst[] = { 12001, 12002, 12003, 12004, 12005, 12006 };
+  static int tuxlst[] = { 12001, 12002, 12003, 12004, 12005, 12006, 
+                          6201, 6203 };
   static unsigned acccnt = sizeof(acclst)/sizeof(acclst[0]);
   static unsigned tupcnt = sizeof(tuplst)/sizeof(tuplst[0]);
   static unsigned tuxcnt = sizeof(tuxlst)/sizeof(tuxlst[0]);
@@ -1982,31 +1987,64 @@ int runFailAddFragment(NDBT_Context* ctx
   NdbDictionary::Table tab(*ctx->getTab());
   tab.setFragmentType(NdbDictionary::Object::FragAllLarge);
 
+  int errNo = 0;
+  char buf[100];
+  if (NdbEnv_GetEnv("ERRNO", buf, sizeof(buf)))
+  {
+    errNo = atoi(buf);
+    ndbout_c("Using errno: %u", errNo);
+  }
+  
   // ordered index on first few columns
   NdbDictionary::Index idx("X");
   idx.setTable(tab.getName());
   idx.setType(NdbDictionary::Index::OrderedIndex);
   idx.setLogging(false);
-  for (int i_hate_broken_compilers = 0;
-       i_hate_broken_compilers < 3 &&
+  for (int cnt = 0, i_hate_broken_compilers = 0;
+       cnt < 3 &&
        i_hate_broken_compilers < tab.getNoOfColumns();
        i_hate_broken_compilers++) {
-    idx.addColumn(*tab.getColumn(i_hate_broken_compilers));
+    if (NdbSqlUtil::check_column_for_ordered_index
+        (tab.getColumn(i_hate_broken_compilers)->getType(), 0) == 0 &&
+        tab.getColumn(i_hate_broken_compilers)->getStorageType() != 
+        NdbDictionary::Column::StorageTypeDisk)
+    {
+      idx.addColumn(*tab.getColumn(i_hate_broken_compilers));
+      cnt++;
+    }
+  }
+
+  for (Uint32 i = 0; i<tab.getNoOfColumns(); i++)
+  {
+    if (tab.getColumn(i)->getStorageType() == 
+        NdbDictionary::Column::StorageTypeDisk)
+    {
+      NDBT_Tables::create_default_tablespace(pNdb);
+      break;
+    }
   }
 
   const int loops = ctx->getNumLoops();
   int result = NDBT_OK;
   (void)pDic->dropTable(tab.getName());
 
+  int dump1 = DumpStateOrd::SchemaResourceSnapshot;
+  int dump2 = DumpStateOrd::SchemaResourceCheckLeak;
+
   for (int l = 0; l < loops; l++) {
     for (unsigned i0 = 0; i0 < acccnt; i0++) {
       unsigned j = (l == 0 ? i0 : myRandom48(acccnt));
       int errval = acclst[j];
+      if (errNo != 0 && errNo != errval)
+        continue;
       g_info << "insert error node=" << nodeId << " value=" <<
errval << endl;
       CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
              "failed to set error insert");
+      CHECK(restarter.dumpStateAllNodes(&dump1, 1) == 0);
+
       CHECK2(pDic->createTable(tab) != 0,
              "failed to fail after error insert " << errval);
+      CHECK(restarter.dumpStateAllNodes(&dump2, 1) == 0);
       CHECK2(pDic->createTable(tab) == 0,
              pDic->getNdbError());
       CHECK2(pDic->dropTable(tab.getName()) == 0,
@@ -2015,11 +2053,15 @@ int runFailAddFragment(NDBT_Context* ctx
     for (unsigned i1 = 0; i1 < tupcnt; i1++) {
       unsigned j = (l == 0 ? i1 : myRandom48(tupcnt));
       int errval = tuplst[j];
+      if (errNo != 0 && errNo != errval)
+        continue;
       g_info << "insert error node=" << nodeId << " value=" <<
errval << endl;
       CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
              "failed to set error insert");
+      CHECK(restarter.dumpStateAllNodes(&dump1, 1) == 0);
       CHECK2(pDic->createTable(tab) != 0,
              "failed to fail after error insert " << errval);
+      CHECK(restarter.dumpStateAllNodes(&dump2, 1) == 0);
       CHECK2(pDic->createTable(tab) == 0,
              pDic->getNdbError());
       CHECK2(pDic->dropTable(tab.getName()) == 0,
@@ -2028,13 +2070,17 @@ int runFailAddFragment(NDBT_Context* ctx
     for (unsigned i2 = 0; i2 < tuxcnt; i2++) {
       unsigned j = (l == 0 ? i2 : myRandom48(tuxcnt));
       int errval = tuxlst[j];
+      if (errNo != 0 && errNo != errval)
+        continue;
       g_info << "insert error node=" << nodeId << " value=" <<
errval << endl;
       CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
              "failed to set error insert");
       CHECK2(pDic->createTable(tab) == 0,
              pDic->getNdbError());
+      CHECK(restarter.dumpStateAllNodes(&dump1, 1) == 0);
       CHECK2(pDic->createIndex(idx) != 0,
              "failed to fail after error insert " << errval);
+      CHECK(restarter.dumpStateAllNodes(&dump2, 1) == 0);
       CHECK2(pDic->createIndex(idx) == 0,
              pDic->getNdbError());
       CHECK2(pDic->dropTable(tab.getName()) == 0,

=== modified file 'storage/ndb/test/ndbapi/testInterpreter.cpp'
--- a/storage/ndb/test/ndbapi/testInterpreter.cpp	2008-01-31 22:46:07 +0000
+++ b/storage/ndb/test/ndbapi/testInterpreter.cpp	2008-05-23 09:07:58 +0000
@@ -73,7 +73,6 @@ int runTestIncValue64(NDBT_Context* ctx,
 }
 
 int runTestIncValue32(NDBT_Context* ctx, NDBT_Step* step){
-  int result = NDBT_OK;
   const NdbDictionary::Table * pTab = ctx->getTab();
   Ndb* pNdb = GETNDB(step);
 
@@ -114,8 +113,16 @@ int runTestIncValue32(NDBT_Context* ctx,
   }
   
   // Attributes
+
+  // Perform initial read of column start value
+  NdbRecAttr* initialVal = pOp->getValue("KOL2");
+  if( initialVal == NULL ) {
+    ERR(pTrans->getNdbError());
+    pNdb->closeTransaction(pTrans);
+    return NDBT_FAILED;
+  }
   
-  // Update column
+  // Update the column
   Uint32 valToIncWith = 1;
   check = pOp->incValue("KOL2", valToIncWith);
   if( check == -1 ) {
@@ -124,8 +131,9 @@ int runTestIncValue32(NDBT_Context* ctx,
     return NDBT_FAILED;
   }
 
-  NdbRecAttr* valueRec = pOp->getValue("KOL2");
-  if( valueRec == NULL ) {
+  // Perform final read of column after value
+  NdbRecAttr* afterVal = pOp->getValue("KOL2");
+  if( afterVal == NULL ) {
     ERR(pTrans->getNdbError());
     pNdb->closeTransaction(pTrans);
     return NDBT_FAILED;
@@ -138,8 +146,19 @@ int runTestIncValue32(NDBT_Context* ctx,
     return NDBT_FAILED;
   }
 
-  Uint32 value = valueRec->u_32_value();
+  Uint32 oldValue = initialVal->u_32_value();
+  Uint32 newValue = afterVal->u_32_value();
+  Uint32 expectedValue = oldValue + valToIncWith;
     
+  if (newValue != expectedValue)
+  {
+    g_err << "Failed : Expected " << oldValue << "+" <<
+      valToIncWith << "=" << expectedValue <<
+      " but received " << newValue << endl;
+    pNdb->closeTransaction(pTrans);
+    return NDBT_FAILED;
+  }
+
   pNdb->closeTransaction(pTrans);
 
 
@@ -147,7 +166,6 @@ int runTestIncValue32(NDBT_Context* ctx,
 }
 
 int runTestBug19537(NDBT_Context* ctx, NDBT_Step* step){
-  int result = NDBT_OK;
   const NdbDictionary::Table * pTab = ctx->getTab();
   Ndb* pNdb = GETNDB(step);
 
@@ -264,9 +282,12 @@ int runTestBug19537(NDBT_Context* ctx, N
 
 
 int runTestBug34107(NDBT_Context* ctx, NDBT_Step* step){
-  int result = NDBT_OK;
   const NdbDictionary::Table * pTab = ctx->getTab();
   Ndb* pNdb = GETNDB(step);
+  const Uint32 okSize= 10000;
+  const Uint32 tooBig= 30000;
+
+  Uint32 codeBuff[tooBig];
 
   int i;
   for (i = 0; i <= 1; i++) {
@@ -291,19 +312,43 @@ int runTestBug34107(NDBT_Context* ctx, N
       return NDBT_FAILED;
     }
 
-    int n = i == 0 ? 10000 : 30000;
+    /* Test kernel mechanism for dealing with too large program
+     * We need to provide our own program buffer as default
+     * NdbInterpretedCode buffer will not grow larger than 
+     * NDB_MAX_SCANFILTER_SIZE
+     */
+
+    NdbInterpretedCode code(NULL, // Table is irrelevant
+                            codeBuff,
+                            tooBig); // Size of codeBuff
+    
+    int n = i == 0 ? okSize : tooBig;
     int k;
 
     for (k = 0; k < n; k++) {
 
       // inserts 1 word ATTRINFO
 
-      if (pOp->interpret_exit_ok() == -1) {
-        ERR(pOp->getNdbError());
+      if (code.interpret_exit_ok() == -1) {
+        ERR(code.getNdbError());
         pNdb->closeTransaction(pTrans);
         return NDBT_FAILED;
       }
     }
+
+    if (code.finalise() != 0)
+    {
+      ERR(code.getNdbError());
+      pNdb->closeTransaction(pTrans);
+      return NDBT_FAILED;
+    }
+
+    if (pOp->setInterpretedCode(&code) != 0)
+    {
+      ERR(pOp->getNdbError());
+      pNdb->closeTransaction(pTrans);
+      return NDBT_FAILED;
+    }
       
     if (pTrans->execute(NoCommit) == -1) {
       ERR(pTrans->getNdbError());

=== modified file 'storage/ndb/test/ndbapi/testNodeRestart.cpp'
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp	2008-02-20 20:44:04 +0000
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp	2008-04-25 07:14:29 +0000
@@ -2327,6 +2327,576 @@ runBug34702(NDBT_Context* ctx, NDBT_Step
     if (res.waitClusterStarted())
       return NDBT_FAILED;
   }
+
+  return NDBT_OK;
+}
+
+int
+runMNF(NDBT_Context* ctx, NDBT_Step* step)
+{
+  int result = NDBT_OK;
+  NdbRestarter res;
+  
+  if (res.getNumDbNodes() < 2)
+  {
+    return NDBT_OK;
+  }
+
+  Vector<int> part0;
+  Vector<int> part1;
+  Bitmask<255> part0mask;
+  Bitmask<255> part1mask;
+  Bitmask<255> ngmask;
+  for (int i = 0; i<res.getNumDbNodes(); i++)
+  {
+    int nodeId = res.getDbNodeId(i);
+    int ng = res.getNodeGroup(nodeId);
+    if (ngmask.get(ng))
+    {
+      part1.push_back(nodeId);
+      part1mask.set(nodeId);
+    }
+    else
+    {
+      ngmask.set(ng);
+      part0.push_back(nodeId);
+      part0mask.set(nodeId);
+    }
+  }
+
+  printf("part0: ");
+  for (size_t i = 0; i<part0.size(); i++)
+    printf("%u ", part0[i]);
+  printf("\n");
+
+  printf("part1: ");
+  for (size_t i = 0; i<part1.size(); i++)
+    printf("%u ", part1[i]);
+  printf("\n");
+
+  int loops = ctx->getNumLoops();
+  while (loops-- && !ctx->isTestStopped())
+  {
+    int cnt, *nodes;
+    int master = res.getMasterNodeId();
+    int nextMaster = res.getNextMasterNodeId(master);
+
+    bool cmf = false;
+    if (part0mask.get(master) && part0mask.get(nextMaster))
+    {
+      cmf = true;
+      cnt = part0.size();
+      nodes = part0.getBase();
+      printf("restarting part0");
+    }
+    else if(part1mask.get(master) && part1mask.get(nextMaster))
+    {
+      cmf = true;
+      cnt = part1.size();
+      nodes = part1.getBase();
+      printf("restarting part1");
+    }
+    else
+    {
+      cmf = false;
+      if (loops & 1)
+      {
+        cnt = part0.size();
+        nodes = part0.getBase();
+        printf("restarting part0");
+      } 
+      else 
+      {
+        cnt = part1.size();
+        nodes = part0.getBase();
+        printf("restarting part0");
+      }
+    }
+    
+    int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+    for (int i = 0; i<cnt; i++)
+      if (res.dumpStateOneNode(nodes[i], val2, 2))
+        return NDBT_FAILED;
+    
+    int type = loops;
+    char buf[100];
+    if (NdbEnv_GetEnv("MNF", buf, sizeof(buf)))
+    {
+      type = atoi(buf);
+    }
+    if (cmf)
+    {
+      type = type % 7;
+    }
+    else
+    {
+      type = type % 4;
+    }
+    ndbout_c(" type: %u (cmf: %u)", type, cmf);
+    switch(type){
+    case 0:
+      for (int i = 0; i<cnt; i++)
+      {
+        if (res.restartOneDbNode(nodes[i],
+                                 /** initial */ false, 
+                                 /** nostart */ true,
+                                 /** abort   */ true))
+          return NDBT_FAILED;
+        
+        NdbSleep_MilliSleep(10);
+      }
+      break;
+    case 1:
+      for (int i = 0; i<cnt; i++)
+      {
+        if (res.restartOneDbNode(nodes[i],
+                                 /** initial */ false, 
+                                 /** nostart */ true,
+                                 /** abort   */ true))
+          return NDBT_FAILED;
+        
+      }
+      break;
+    case 2:
+      for (int i = 0; i<cnt; i++)
+      {
+        res.insertErrorInNode(nodes[i], 8058);
+      }
+      res.restartOneDbNode(nodes[0],
+                           /** initial */ false, 
+                           /** nostart */ true,
+                           /** abort   */ true);
+      break;
+    case 3:
+      for (int i = 0; i<cnt; i++)
+      {
+        res.insertErrorInNode(nodes[i], 8059);
+      }
+      res.restartOneDbNode(nodes[0],
+                           /** initial */ false, 
+                           /** nostart */ true,
+                           /** abort   */ true);
+      break;
+    case 4:
+    {
+      for (int i = 0; i<cnt; i++)
+      {
+        res.insertErrorInNode(nodes[i], 7180);
+      }
+
+      int lcp = 7099;
+      res.insertErrorInNode(master, 7193);
+      res.dumpStateOneNode(master, &lcp, 1);
+      break;
+    }
+    case 5:
+    {
+      for (int i = 0; i<cnt; i++)
+      {
+        res.insertErrorInNode(nodes[i], 7206);
+      }
+
+      int lcp = 7099;
+      res.insertErrorInNode(master, 7193);
+      res.dumpStateOneNode(master, &lcp, 1);
+      break;
+    }
+    case 6:
+    {
+      for (int i = 0; i<cnt; i++)
+      {
+        res.insertErrorInNode(nodes[i], 5008);
+      }
+      
+      int lcp = 7099;
+      res.insertErrorInNode(master, 7193);
+      res.dumpStateOneNode(master, &lcp, 1);
+      break;
+    }
+    }
+    
+    if (res.waitNodesNoStart(nodes, cnt))
+      return NDBT_FAILED;
+    
+    if (res.startNodes(nodes, cnt))
+      return NDBT_FAILED;
+    
+    if (res.waitClusterStarted())
+      return NDBT_FAILED; 
+  }
+
+  ctx->stopTest();
+  return NDBT_OK;
+}
+
+int 
+runBug36199(NDBT_Context* ctx, NDBT_Step* step)
+{
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  NdbRestarter res;
+
+  if (res.getNumDbNodes() < 4)
+    return NDBT_OK;
+
+  int master = res.getMasterNodeId();
+  int nextMaster = res.getNextMasterNodeId(master);
+  int victim = res.getRandomNodeSameNodeGroup(nextMaster, rand());
+  if (victim == master)
+  {
+    victim = res.getRandomNodeOtherNodeGroup(nextMaster, rand());
+  }
+
+  ndbout_c("master: %u next master: %u victim: %u",
+           master, nextMaster, victim);
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+  res.dumpStateOneNode(master, val2, 2);
+  res.dumpStateOneNode(victim, val2, 2);
+
+  res.insertErrorInNode(victim, 7205);
+  res.insertErrorInNode(master, 7014);
+  int lcp = 7099;
+  res.dumpStateOneNode(master, &lcp, 1);
+  
+  int nodes[2];
+  nodes[0] = master;
+  nodes[1] = victim;
+  if (res.waitNodesNoStart(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+
+  if (res.startNodes(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  return NDBT_OK;
+}
+
+int 
+runBug36246(NDBT_Context* ctx, NDBT_Step* step)
+{ 
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  NdbRestarter res;
+  Ndb* pNdb = GETNDB(step);
+
+  if (res.getNumDbNodes() < 4)
+    return NDBT_OK;
+
+  HugoOperations hugoOps(*ctx->getTab());
+restartloop:
+  int tryloop = 0;
+  int master = res.getMasterNodeId();
+  int nextMaster = res.getNextMasterNodeId(master);
+
+loop:
+  if(hugoOps.startTransaction(pNdb) != 0)
+    return NDBT_FAILED;
+      
+  if(hugoOps.pkUpdateRecord(pNdb, 1, 1) != 0)
+    return NDBT_FAILED;
+  
+  if(hugoOps.execute_NoCommit(pNdb) != 0)
+    return NDBT_FAILED;
+  
+  int victim = hugoOps.getTransaction()->getConnectedNodeId();
+  printf("master: %u nextMaster: %u victim: %u",
+         master, nextMaster, victim);
+  if (victim == master || victim == nextMaster ||
+      res.getNodeGroup(victim) == res.getNodeGroup(master) ||
+      res.getNodeGroup(victim) == res.getNodeGroup(nextMaster))
+  {
+    hugoOps.execute_Rollback(pNdb);
+    hugoOps.closeTransaction(pNdb);
+    tryloop++;
+    if (tryloop == 10)
+    {
+      ndbout_c(" -> restarting next master: %u", nextMaster);
+      res.restartOneDbNode(nextMaster,
+                           /** initial */ false, 
+                           /** nostart */ true,
+                           /** abort   */ true);
+    
+      res.waitNodesNoStart(&nextMaster, 1);
+      res.startNodes(&nextMaster, 1);
+      if (res.waitClusterStarted())
+        return NDBT_FAILED;
+      goto restartloop;
+    }
+    else
+    {
+      ndbout_c(" -> loop");
+      goto loop;
+    }
+  }
+  ndbout_c(" -> go go gadget skates");
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+  res.dumpStateOneNode(master, val2, 2);
+  res.dumpStateOneNode(victim, val2, 2);
+
+  res.insertErrorInNode(master, 8060);
+  res.insertErrorInNode(victim, 9999);
+  
+  int nodes[2];
+  nodes[0] = master;
+  nodes[1] = victim;
+  if (res.waitNodesNoStart(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.startNodes(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  hugoOps.execute_Rollback(pNdb);
+  hugoOps.closeTransaction(pNdb);
+
+  return NDBT_OK;
+}
+
+int 
+runBug36247(NDBT_Context* ctx, NDBT_Step* step)
+{ 
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  NdbRestarter res;
+  Ndb* pNdb = GETNDB(step);
+
+  if (res.getNumDbNodes() < 4)
+    return NDBT_OK;
+
+  HugoOperations hugoOps(*ctx->getTab());
+
+restartloop:
+  int tryloop = 0;
+  int master = res.getMasterNodeId();
+  int nextMaster = res.getNextMasterNodeId(master);
+
+loop:
+  if(hugoOps.startTransaction(pNdb) != 0)
+    return NDBT_FAILED;
+      
+  if(hugoOps.pkUpdateRecord(pNdb, 1, 100) != 0)
+    return NDBT_FAILED;
+  
+  if(hugoOps.execute_NoCommit(pNdb) != 0)
+    return NDBT_FAILED;
+  
+  int victim = hugoOps.getTransaction()->getConnectedNodeId();
+  printf("master: %u nextMaster: %u victim: %u",
+         master, nextMaster, victim);
+  if (victim == master || victim == nextMaster ||
+      res.getNodeGroup(victim) == res.getNodeGroup(master) ||
+      res.getNodeGroup(victim) == res.getNodeGroup(nextMaster))
+  {
+    hugoOps.execute_Rollback(pNdb);
+    hugoOps.closeTransaction(pNdb);
+    tryloop++;
+    if (tryloop == 10)
+    {
+      ndbout_c(" -> restarting next master: %u", nextMaster);
+      res.restartOneDbNode(nextMaster,
+                           /** initial */ false, 
+                           /** nostart */ true,
+                           /** abort   */ true);
+      
+      res.waitNodesNoStart(&nextMaster, 1);
+      res.startNodes(&nextMaster, 1);
+      if (res.waitClusterStarted())
+        return NDBT_FAILED;
+      goto restartloop;
+    }
+    else
+    {
+      ndbout_c(" -> loop");
+      goto loop;
+    }
+  }
+  ndbout_c(" -> go go gadget skates");
+  
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+  res.dumpStateOneNode(master, val2, 2);
+  res.dumpStateOneNode(victim, val2, 2);
+  
+  for (int i = 0; i<res.getNumDbNodes(); i++)
+  {
+    int nodeId = res.getDbNodeId(i);
+    res.insertErrorInNode(nodeId, 5050);
+  }
+  
+  res.insertErrorInNode(victim, 9999);
+  
+  int nodes[2];
+  nodes[0] = master;
+  nodes[1] = victim;
+  if (res.waitNodesNoStart(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.startNodes(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+  
+  hugoOps.execute_Rollback(pNdb);
+  hugoOps.closeTransaction(pNdb);
+  
+  return NDBT_OK;
+}
+
+int 
+runBug36276(NDBT_Context* ctx, NDBT_Step* step)
+{ 
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  NdbRestarter res;
+  Ndb* pNdb = GETNDB(step);
+  
+  if (res.getNumDbNodes() < 4)
+    return NDBT_OK;
+  
+  int master = res.getMasterNodeId();
+  int nextMaster = res.getNextMasterNodeId(master);
+  int victim = res.getRandomNodeSameNodeGroup(nextMaster, rand());
+  if (victim == master)
+  {
+    victim = res.getRandomNodeOtherNodeGroup(nextMaster, rand());
+  }
+
+  ndbout_c("master: %u nextMaster: %u victim: %u",
+           master, nextMaster, victim);
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+  res.dumpStateOneNode(master, val2, 2);
+  res.insertErrorInNode(victim, 7209);
+
+  int lcp = 7099;
+  res.dumpStateOneNode(master, &lcp, 1);
+  
+  if (res.waitNodesNoStart(&master, 1))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.startNodes(&master, 1))
+  {
+    return NDBT_FAILED;
+  }
+
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
+
+  return NDBT_OK;
+}
+
+int 
+runBug36245(NDBT_Context* ctx, NDBT_Step* step)
+{ 
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  NdbRestarter res;
+  Ndb* pNdb = GETNDB(step);
+
+  if (res.getNumDbNodes() < 4)
+    return NDBT_OK;
+
+  /**
+   * Make sure master and nextMaster is in different node groups
+   */
+loop1:
+  int master = res.getMasterNodeId();
+  int nextMaster = res.getNextMasterNodeId(master);
+  
+  printf("master: %u nextMaster: %u", master, nextMaster);
+  if (res.getNodeGroup(master) == res.getNodeGroup(nextMaster))
+  {
+    ndbout_c(" -> restarting next master: %u", nextMaster);
+    res.restartOneDbNode(nextMaster,
+                         /** initial */ false, 
+                         /** nostart */ true,
+                         /** abort   */ true);
+    
+    res.waitNodesNoStart(&nextMaster, 1);
+    res.startNodes(&nextMaster, 1);
+    if (res.waitClusterStarted())
+    {
+      ndbout_c("cluster didnt restart!!");
+      return NDBT_FAILED;
+    }
+    goto loop1;
+  }
+  ndbout_c(" -> go go gadget skates");
+
+  int val2[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };    
+  res.dumpStateOneNode(master, val2, 2);
+  res.dumpStateOneNode(nextMaster, val2, 2);
+
+  res.insertErrorInNode(master, 8063);
+  res.insertErrorInNode(nextMaster, 936);
+
+
+  int err = 0;
+  HugoOperations hugoOps(*ctx->getTab());
+loop2:
+  if((err = hugoOps.startTransaction(pNdb)) != 0)
+  {
+    ndbout_c("failed to start transaction: %u", err);
+    return NDBT_FAILED;
+  }
+  
+  int victim = hugoOps.getTransaction()->getConnectedNodeId();
+  if (victim != master)
+  {
+    ndbout_c("transnode: %u != master: %u -> loop",
+             victim, master);
+    hugoOps.closeTransaction(pNdb);
+    goto loop2;
+  }
+
+  if((err = hugoOps.pkUpdateRecord(pNdb, 1)) != 0)
+  {
+    ndbout_c("failed to update: %u", err);
+    return NDBT_FAILED;
+  }
+  
+  if((err = hugoOps.execute_Commit(pNdb)) != 4010)
+  {
+    ndbout_c("incorrect error code: %u", err);
+    return NDBT_FAILED;
+  }
+  hugoOps.closeTransaction(pNdb);
+  
+  int nodes[2];
+  nodes[0] = master;
+  nodes[1] = nextMaster;
+  if (res.waitNodesNoStart(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.startNodes(nodes, 2))
+  {
+    return NDBT_FAILED;
+  }
+  
+  if (res.waitClusterStarted())
+    return NDBT_FAILED;
   
   return NDBT_OK;
 }
@@ -2733,6 +3303,34 @@ TESTCASE("mixedmultiop", ""){
 TESTCASE("Bug34702", ""){
   INITIALIZER(runBug34702);  
 }
+TESTCASE("MNF", ""){
+  INITIALIZER(runLoadTable);
+  STEP(runMNF);
+  STEP(runScanUpdateUntilStopped);
+}
+TESTCASE("Bug36199", ""){
+  INITIALIZER(runBug36199);
+}
+TESTCASE("Bug36246", ""){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36246);
+  VERIFIER(runClearTable);
+}
+TESTCASE("Bug36247", ""){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36247);
+  VERIFIER(runClearTable);
+}
+TESTCASE("Bug36276", ""){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36276);
+  VERIFIER(runClearTable);
+}
+TESTCASE("Bug36245", ""){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36245);
+  VERIFIER(runClearTable);
+}
 NDBT_TESTSUITE_END(testNodeRestart);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/ndbapi/testOIBasic.cpp'
--- a/storage/ndb/test/ndbapi/testOIBasic.cpp	2008-02-11 20:36:27 +0000
+++ b/storage/ndb/test/ndbapi/testOIBasic.cpp	2008-08-07 13:36:47 +0000
@@ -3336,12 +3336,6 @@ BSet::setbnd(Par par) const
       const BVal& bval = *m_bval[j2];
       CHK(bval.setbnd(par) == 0);
     }
-    // duplicate
-    if (urandom(5) == 0) {
-      uint j3 = urandom(m_bvals);
-      const BVal& bval = *m_bval[j3];
-      CHK(bval.setbnd(par) == 0);
-    }
   }
   return 0;
 }

=== modified file 'storage/ndb/test/ndbapi/testSRBank.cpp'
--- a/storage/ndb/test/ndbapi/testSRBank.cpp	2007-04-17 07:54:36 +0000
+++ b/storage/ndb/test/ndbapi/testSRBank.cpp	2008-04-28 15:17:02 +0000
@@ -294,4 +294,3 @@ main(int argc, const char** argv){
   return testSRBank.execute(argc, argv);
 }
 
-template class Vector<ndb_mgm_node_state*>;

=== modified file 'storage/ndb/test/ndbapi/testScan.cpp'
--- a/storage/ndb/test/ndbapi/testScan.cpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/test/ndbapi/testScan.cpp	2008-04-28 14:17:28 +0000
@@ -1164,6 +1164,45 @@ runScanVariants(NDBT_Context* ctx, NDBT_
 }
 
 int
+runBug36124(NDBT_Context* ctx, NDBT_Step* step){
+  Ndb * pNdb = GETNDB(step);
+  const NdbDictionary::Table*  pTab = ctx->getTab();
+
+  NdbTransaction* pCon = pNdb->startTransaction();
+  NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
+  if (pOp == NULL) {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  if( pOp->readTuples(NdbOperation::LM_Read) != 0) 
+  {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  if( pOp->getValue(NdbDictionary::Column::ROW_COUNT) == 0)
+  {
+    ERR(pCon->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  /* Old style interpreted code api should fail when 
+   * we try to use it 
+   */
+  if( pOp->interpret_exit_last_row() == 0)
+  {
+    return NDBT_FAILED;
+  }
+
+  pOp->close();
+
+  pCon->close();
+
+  return NDBT_OK;
+}
+
+int
 runBug24447(NDBT_Context* ctx, NDBT_Step* step){
   int loops = 1; //ctx->getNumLoops();
   int records = ctx->getNumRecords();
@@ -1680,6 +1719,12 @@ TESTCASE("Bug24447",
   STEP(runBug24447);
   FINALIZER(runClearTable);
 }
+TESTCASE("Bug36124",
+         "Old interpreted Api usage"){
+  INITIALIZER(runLoadTable);
+  STEP(runBug36124);
+  FINALIZER(runClearTable);
+}
 NDBT_TESTSUITE_END(testScan);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/ndbapi/test_event.cpp'
--- a/storage/ndb/test/ndbapi/test_event.cpp	2008-03-25 13:27:14 +0000
+++ b/storage/ndb/test/ndbapi/test_event.cpp	2008-04-25 09:17:15 +0000
@@ -2075,7 +2075,184 @@ runBug33793(NDBT_Context* ctx, NDBT_Step
   return NDBT_OK;
 }
 
+static
+int
+cc(Ndb_cluster_connection** ctx, Ndb** ndb)
+{
+  Ndb_cluster_connection* xncc = new Ndb_cluster_connection;
+  int ret;
+  if ((ret = xncc->connect(30, 1, 0)) != 0)
+  {
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  if ((ret = xncc->wait_until_ready(30, 10)) != 0)
+  {
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  Ndb* xndb = new Ndb(xncc, "TEST_DB");
+  if (xndb->init() != 0)
+  {
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  if (xndb->waitUntilReady(30) != 0)
+  {
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  * ctx = xncc;
+  * ndb = xndb;
+  return 0;
+}
+
+static
+NdbEventOperation*
+op(Ndb* xndb, const NdbDictionary::Table * table)
+{
+  char buf[1024];
+  sprintf(buf, "%s_EVENT", table->getName());
+  NdbEventOperation *pOp;
+  pOp = xndb->createEventOperation(buf);
+  if ( pOp == NULL )
+  {
+    g_err << "Event operation creation failed on %s" << buf << endl;
+    return 0;
+  }
+
+  int n_columns= table->getNoOfColumns();
+  NdbRecAttr* recAttr[1024];
+  NdbRecAttr* recAttrPre[1024];
+  for (int i = 0; i < n_columns; i++) {
+    recAttr[i]    = pOp->getValue(table->getColumn(i)->getName());
+    recAttrPre[i] = pOp->getPreValue(table->getColumn(i)->getName());
+  }
 
+  return pOp;
+}
+
+int
+runBug34853(NDBT_Context* ctx, NDBT_Step* step)
+{
+  int result = NDBT_OK;
+  int loops = ctx->getNumLoops();
+  int records = ctx->getNumRecords();
+  Ndb* pNdb = GETNDB(step);
+  NdbRestarter res;
+
+  if (res.getNumDbNodes() < 2)
+  {
+    return NDBT_OK;
+  }
+
+  Ndb_cluster_connection* xncc;
+  Ndb* xndb;
+
+  if (cc(&xncc, &xndb))
+  {
+    return NDBT_FAILED;
+  }
+
+  NdbEventOperation* pOp = op(xndb, ctx->getTab());
+  if (pOp == 0)
+  {
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  int api = xncc->node_id();
+  int nodeId = res.getDbNodeId(rand() % res.getNumDbNodes());
+  ndbout_c("stopping %u", nodeId);
+  res.restartOneDbNode(nodeId,
+                       /** initial */ false,
+                       /** nostart */ true,
+                       /** abort   */ true);
+
+  ndbout_c("waiting for %u", nodeId);
+  res.waitNodesNoStart(&nodeId, 1);
+
+  int dump[2];
+  dump[0] = 9004;
+  dump[1] = api;
+  res.dumpStateOneNode(nodeId, dump, 2);
+  res.startNodes(&nodeId, 1);
+  ndbout_c("waiting cluster");
+  res.waitClusterStarted();
+
+  if (pOp->execute())
+  { // This starts changes to "start flowing"
+    g_err << "execute operation execution failed: \n";
+    g_err << pOp->getNdbError().code << " "
+	  << pOp->getNdbError().message << endl;
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  xndb->dropEventOperation(pOp);
+
+  ndbout_c("stopping %u", nodeId);
+  res.restartOneDbNode(nodeId,
+                       /** initial */ false,
+                       /** nostart */ true,
+                       /** abort   */ true);
+
+  ndbout_c("waiting for %u", nodeId);
+  res.waitNodesNoStart(&nodeId, 1);
+
+  dump[0] = 71;
+  dump[1] = 7;
+  res.dumpStateOneNode(nodeId, dump, 2);
+  res.startNodes(&nodeId, 1);
+  ndbout_c("waiting node sp 7");
+  res.waitNodesStartPhase(&nodeId, 1, 6);
+
+  delete xndb;
+  delete xncc;
+
+  NdbSleep_SecSleep(5); // 3 seconds to open connections. i.e 5 > 3
+
+  dump[0] = 71;
+  res.dumpStateOneNode(nodeId, dump, 1);
+
+  res.waitClusterStarted();
+
+  if (cc(&xncc, &xndb))
+  {
+    return NDBT_FAILED;
+  }
+
+  pOp = op(xndb, ctx->getTab());
+  if (pOp == 0)
+  {
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  if (pOp->execute())
+  { // This starts changes to "start flowing"
+    g_err << "execute operation execution failed: \n";
+    g_err << pOp->getNdbError().code << " "
+	  << pOp->getNdbError().message << endl;
+    delete xndb;
+    delete xncc;
+    return NDBT_FAILED;
+  }
+
+  xndb->dropEventOperation(pOp);
+  delete xndb;
+  delete xncc;
+  return NDBT_OK;
+}
 
 /** Telco 6.2 **/
 
@@ -2502,6 +2679,11 @@ TESTCASE("Bug33793", ""){
   STEP(runBug33793);
   FINALIZER(runDropEvent);
 }
+TESTCASE("Bug34853", ""){
+  INITIALIZER(runCreateEvent);
+  INITIALIZER(runBug34853);
+  FINALIZER(runDropEvent);
+}
 TESTCASE("Bug35208", ""){
   INITIALIZER(runBug35208_createTable);
   INITIALIZER(runCreateEvent);

=== modified file 'storage/ndb/test/run-test/Makefile.am'
--- a/storage/ndb/test/run-test/Makefile.am	2008-02-21 13:57:42 +0000
+++ b/storage/ndb/test/run-test/Makefile.am	2008-04-25 06:32:23 +0000
@@ -33,9 +33,9 @@ atrt_SOURCES = main.cpp setup.cpp files.
 INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/test/include
 LDADD_LOC = $(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@ \
             $(top_builddir)/libmysql_r/libmysqlclient_r.la
 
 atrt_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2008-04-07 06:49:01 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2008-08-07 13:36:47 +0000
@@ -485,6 +485,10 @@ max-time: 1000
 cmd: testScan
 args: -n ScanVariants
 
+max-time: 500
+cmd: testScan
+args: -n Bug36124 T1
+
 max-time: 1000
 cmd: testNodeRestart
 args: -n Bug27003 T1
@@ -790,11 +794,15 @@ args:
 
 max-time: 600
 cmd: testBlobs
-args: -bug 27018
+args: -bug 27018 -skip p
+
+max-time: 600
+cmd: testBlobs
+args: -bug 27370 -skip p
 
 max-time: 600
 cmd: testBlobs
-args: -bug 27370
+args: -bug 36756 -skip p
 
 max-time: 5000
 cmd: testOIBasic
@@ -1090,3 +1098,40 @@ max-time: 600
 cmd: test_event
 args: -n Bug35208 T1
 
+# 2008-04-22
+max-time: 1500
+cmd: testNodeRestart
+args: -n MNF -l 15 T1
+
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug36199 T1
+
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug36246 T1
+
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug36247 T1
+
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug36276 T1
+
+# 2008-04-25
+max-time: 300
+cmd: testNodeRestart
+args: -n Bug36245 T1
+
+max-time: 300
+cmd: test_event
+args: -n Bug34853 T1
+
+# EOF 2008-04-25
+# 2008-05-29
+max-time: 1200
+cmd: testDict
+args: -l 1 -n FailAddFragment
+
+# EOF 2008-05-29

=== modified file 'storage/ndb/tools/ndb_size.pl'
--- a/storage/ndb/tools/ndb_size.pl	2007-08-15 02:12:59 +0000
+++ b/storage/ndb/tools/ndb_size.pl	2008-05-23 07:54:06 +0000
@@ -913,14 +913,14 @@ foreach(@{$tables})
 	}
 	foreach my $i(@show_indexes)
 	{
-	    $indexes{${%$i}{Key_name}}= {
-		type=>${%$i}{Index_type},
-		unique=>!${%$i}{Non_unique},
-		comment=>${%$i}{Comment},
-	    } if !defined($indexes{${%$i}{Key_name}});
+	    $indexes{$i->{Key_name}}= {
+		type=>$i->{Index_type},
+		unique=>$i->{Non_unique},
+		comment=>$i->{Comment},
+	    } if !defined($indexes{$i->{Key_name}});
 
-	    $indexes{${%$i}{Key_name}}{columns}[${%$i}{Seq_in_index}-1]=
-		${%$i}{Column_name};
+	    $indexes{$i->{Key_name}}{columns}[$i->{Seq_in_index}-1]=
+		$i->{Column_name};
 	}
     }
     my $t= new MySQL::NDB::Size::Table(name => $table,

=== modified file 'strings/Makefile.am'
--- a/strings/Makefile.am	2007-12-07 16:56:17 +0000
+++ b/strings/Makefile.am	2008-08-07 13:36:47 +0000
@@ -16,7 +16,19 @@
 # This file is public domain and comes with NO WARRANTY of any kind
 
 INCLUDES =		-I$(top_builddir)/include -I$(top_srcdir)/include
-pkglib_LIBRARIES =	libmystrings.a
+pkglib_LTLIBRARIES =	libmystrings.la
+libmystrings_la_LDFLAGS =   -static
+libmystrings_la_SOURCES = 
+# These are the symbols we don't use in mysqlclient
+libmystringsextra_la_SOURCES = bfill.c  r_strinstr.c strtol.c  strtoul.c my_strchr.c
+# Force C++ linking - dummy.cxx doesn't have to exist with EXTRA in the name
+nodist_EXTRA_libmystrings_la_SOURCES = dummy.cxx
+# This can't be listed here as $(top_builddir)/strings/libmystingslt.la
+# or it breaks make's dependency track for -j builds
+libmystrings_la_LIBADD = libmystringslt.la libmystringsextra.la
+
+
+noinst_LTLIBRARIES =	libmystringslt.la libmystringsextra.la
 
 # Exact one of ASSEMBLER_X
 if ASSEMBLER_x86
@@ -37,11 +49,11 @@ CSRCS		= strxmov.c bmove_upp.c strappend
 endif
 endif
 
-libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
+libmystringslt_la_SOURCES = $(ASRCS) $(CSRCS)
 noinst_PROGRAMS = conf_to_src
 CLEANFILES = str_test uctypedump test_decimal
 # Default charset definitions
-EXTRA_DIST =		ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c
ctype-win1250ch.c \
+EXTRA_DIST 	= ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc_kr.c
ctype-win1250ch.c \
 			ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
 			ctype-ucs2.c ctype-uca.c ctype-tis620.c ctype-ujis.c \
 			xml.c decimal.c strto.c strings-x86.s \
@@ -55,9 +67,8 @@ EXTRA_DIST =		ctype-big5.c ctype-cp932.c
 			strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
 			t_ctype.h my_strchr.c CMakeLists.txt
 
-libmystrings_a_LIBADD=
-conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
-conf_to_src_LDADD=
+conf_to_src_SOURCES = conf_to_src.c 
+conf_to_src_LDADD= libmystringslt.la
 #force static linking of conf_to_src - essential when linking against
 #custom installation of libc
 conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
@@ -68,15 +79,15 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
 
 FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
 
-str_test: str_test.c $(pkglib_LIBRARIES)
-	$(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(pkglib_LIBRARIES)
+str_test: str_test.c $(noinst_LTLIBRARIES)
+	$(LINK) $(FLAGS) -DMAIN $(INCLUDES) $(srcdir)/str_test.c $(LDADD) $(noinst_LTLIBRARIES)
 
 uctypedump: uctypedump.c
 	$(LINK) $(INCLUDES) $(srcdir)/uctypedump.c
 
-test_decimal$(EXEEXT): decimal.c $(pkglib_LIBRARIES)
+test_decimal$(EXEEXT): decimal.c $(noinst_LTLIBRARIES)
 	$(CP) $(srcdir)/decimal.c ./test_decimal.c
-	$(LINK) $(FLAGS) -DMAIN  ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES)
+	$(LINK) $(FLAGS) -DMAIN  ./test_decimal.c $(LDADD) $(noinst_LTLIBRARIES)
 	$(RM) -f ./test_decimal.c
 
 # Don't update the files from bitkeeper

=== modified file 'unittest/mysys/Makefile.am'
--- a/unittest/mysys/Makefile.am	2007-10-10 07:14:58 +0000
+++ b/unittest/mysys/Makefile.am	2008-08-07 13:36:47 +0000
@@ -17,9 +17,10 @@ AM_CPPFLAGS      = @ZLIB_INCLUDES@ -I$(t
 AM_CPPFLAGS     += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
 
 LDADD 		= $(top_builddir)/unittest/mytap/libmytap.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 \
+		  @ZLIB_LIBS@
 
 noinst_PROGRAMS  = bitmap-t base64-t my_atomic-t
 

Thread
bzr push into mysql-6.0-ndb branch (jonas:2655) Bug#36547jonas7 Aug