MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Tomas Ulin Date:March 12 2009 11:08am
Subject:bzr push into mysql-6.0-telco-7.1 branch (tomas.ulin:2851 to 2853)
View as plain text  
 2853 Tomas Ulin	2009-03-12 [merge]
      merge with 6.0-telco-6.3

 2852 Tomas Ulin	2009-03-12 [merge]
      merge from cluster 7.0
      removed:
        mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test
      added:
        mysql-test/include/ndb_backup_id.inc
        mysql-test/suite/ndb/r/ndb_partition_hash.result
        mysql-test/suite/ndb/t/ndb_partition_hash.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_d.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_u.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_i_i.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_init.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_d.inc
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_u.inc
        storage/ndb/include/portlib/my_daemon.h
        storage/ndb/src/common/portlib/my_daemon.cc
        storage/ndb/src/kernel/angel.cpp
        storage/ndb/src/kernel/angel.hpp
        storage/ndb/src/kernel/ndbd.cpp
        storage/ndb/src/kernel/ndbd.hpp
        storage/ndb/src/mgmsrv/Defragger.hpp
        storage/ndb/test/run-test/check-tests.sh
      renamed:
        mysql-test/suite/rpl_ndb_big/r/rpl_ndb_mixed_engines_transactions.result => mysql-test/suite/rpl_ndb_big/r/rpl_ndb_mix_eng_trans.result
        mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions-master.opt => mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans-master.opt
        mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions-slave.opt => mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans-slave.opt
        mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test => mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans.test
      modified:
        .bzr-mysql/default.conf
        CMakeLists.txt
        client/mysqltest.cc
        configure.in
        mysql-test/include/default_ndbd.cnf
        mysql-test/include/ndb_backup.inc
        mysql-test/include/ndb_conflict_info.inc
        mysql-test/include/ndb_conflict_info_init.inc
        mysql-test/include/ndb_not_readonly.inc
        mysql-test/include/ndb_setup_slave.inc
        mysql-test/lib/My/ConfigFactory.pm
        mysql-test/lib/v1/ndb_config_2_node.ini
        mysql-test/mysql-test-run.pl
        mysql-test/suite/funcs_1/t/disabled.def
        mysql-test/suite/ndb/r/ndb_add_partition.result
        mysql-test/suite/ndb/r/ndb_config.result
        mysql-test/suite/ndb/r/ndb_config2.result
        mysql-test/suite/ndb/r/ndb_restore.result
        mysql-test/suite/ndb/r/ndb_restore_compressed.result
        mysql-test/suite/ndb/r/ndbapi.result
        mysql-test/suite/ndb/t/ndb_add_partition.test
        mysql-test/suite/ndb/t/ndb_config.test
        mysql-test/suite/ndb/t/ndb_config2.test
        mysql-test/suite/ndb/t/ndb_restore.test
        mysql-test/suite/ndb/t/ndbapi.test
        mysql-test/suite/ndb_team/my.cnf
        mysql-test/suite/ndb_team/r/ndb_autodiscover3.result
        mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result
        mysql-test/suite/ndb_team/t/ndb_autodiscover3.test
        mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result
        mysql-test/suite/rpl_ndb/r/rpl_ndb_logging.result
        mysql-test/suite/rpl_ndb/t/disabled.def
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test
        mysql-test/suite/rpl_ndb/t/rpl_ndb_logging.test
        mysql-test/suite/rpl_ndb_big/r/rpl_ndb_multi.result
        mysql-test/suite/rpl_ndb_big/r/rpl_ndb_sync.result
        mysql-test/suite/rpl_ndb_big/t/rpl_ndb_multi.test
        mysql-test/suite/rpl_ndb_big/t/rpl_ndbapi_multi.test
        mysql-test/t/warnings.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
        sql/ha_ndbcluster_binlog.cc
        sql/ha_ndbcluster_binlog.h
        sql/log_event.cc
        sql/slave.cc
        storage/ndb/include/kernel/signaldata/AllocNodeId.hpp
        storage/ndb/include/kernel/signaldata/BuildIndx.hpp
        storage/ndb/include/kernel/signaldata/ConfigChange.hpp
        storage/ndb/include/kernel/signaldata/DihContinueB.hpp
        storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
        storage/ndb/include/kernel/signaldata/LCP.hpp
        storage/ndb/include/logger/ConsoleLogHandler.hpp
        storage/ndb/include/logger/FileLogHandler.hpp
        storage/ndb/include/logger/Logger.hpp
        storage/ndb/include/mgmapi/mgmapi_config_parameters.h
        storage/ndb/include/mgmapi/ndb_logevent.h
        storage/ndb/include/mgmcommon/ConfigRetriever.hpp
        storage/ndb/include/ndbapi/Ndb.hpp
        storage/ndb/include/ndbapi/NdbBlob.hpp
        storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp
        storage/ndb/include/ndbapi/NdbOperation.hpp
        storage/ndb/include/ndbapi/NdbScanOperation.hpp
        storage/ndb/include/util/NdbOut.hpp
        storage/ndb/src/common/debugger/EventLogger.cpp
        storage/ndb/src/common/debugger/signaldata/DihContinueB.cpp
        storage/ndb/src/common/logger/ConsoleLogHandler.cpp
        storage/ndb/src/common/logger/FileLogHandler.cpp
        storage/ndb/src/common/logger/Logger.cpp
        storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
        storage/ndb/src/common/portlib/CMakeLists.txt
        storage/ndb/src/common/portlib/Makefile.am
        storage/ndb/src/common/util/NdbOut.cpp
        storage/ndb/src/common/util/OutputStream.cpp
        storage/ndb/src/kernel/CMakeLists.txt
        storage/ndb/src/kernel/Makefile.am
        storage/ndb/src/kernel/blocks/ERROR_codes.txt
        storage/ndb/src/kernel/blocks/LocalProxy.cpp
        storage/ndb/src/kernel/blocks/LocalProxy.hpp
        storage/ndb/src/kernel/blocks/backup/Backup.cpp
        storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
        storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp
        storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
        storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp
        storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp
        storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
        storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
        storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
        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/DbtupPagMan.cpp
        storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
        storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
        storage/ndb/src/kernel/blocks/lgman.cpp
        storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
        storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
        storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
        storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
        storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp
        storage/ndb/src/kernel/blocks/ndbfs/Filename.hpp
        storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
        storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
        storage/ndb/src/kernel/blocks/pgman.cpp
        storage/ndb/src/kernel/blocks/pgman.hpp
        storage/ndb/src/kernel/blocks/print_file.cpp
        storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
        storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
        storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
        storage/ndb/src/kernel/blocks/trix/Trix.cpp
        storage/ndb/src/kernel/blocks/tsman.cpp
        storage/ndb/src/kernel/blocks/tsman.hpp
        storage/ndb/src/kernel/main.cpp
        storage/ndb/src/kernel/vm/Configuration.cpp
        storage/ndb/src/kernel/vm/Configuration.hpp
        storage/ndb/src/kernel/vm/DataBuffer.hpp
        storage/ndb/src/kernel/vm/Mutex.hpp
        storage/ndb/src/mgmclient/CommandInterpreter.cpp
        storage/ndb/src/mgmsrv/ConfigInfo.cpp
        storage/ndb/src/mgmsrv/ConfigManager.cpp
        storage/ndb/src/mgmsrv/ConfigManager.hpp
        storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
        storage/ndb/src/mgmsrv/InitConfigFileParser.hpp
        storage/ndb/src/mgmsrv/MgmtSrvr.cpp
        storage/ndb/src/mgmsrv/MgmtSrvr.hpp
        storage/ndb/src/mgmsrv/Services.cpp
        storage/ndb/src/mgmsrv/main.cpp
        storage/ndb/src/mgmsrv/testConfig.cpp
        storage/ndb/src/ndbapi/Ndb.cpp
        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/NdbOperationDefine.cpp
        storage/ndb/src/ndbapi/NdbOperationSearch.cpp
        storage/ndb/src/ndbapi/NdbScanOperation.cpp
        storage/ndb/src/ndbapi/SignalSender.cpp
        storage/ndb/src/ndbapi/SignalSender.hpp
        storage/ndb/src/ndbapi/TransporterFacade.hpp
        storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
        storage/ndb/src/ndbapi/ndberror.c
        storage/ndb/test/CMakeLists.txt
        storage/ndb/test/include/HugoOperations.hpp
        storage/ndb/test/include/NdbBackup.hpp
        storage/ndb/test/include/NdbMgmd.hpp
        storage/ndb/test/ndbapi/Makefile.am
        storage/ndb/test/ndbapi/bank/Bank.cpp
        storage/ndb/test/ndbapi/testBackup.cpp
        storage/ndb/test/ndbapi/testBlobs.cpp
        storage/ndb/test/ndbapi/testIndex.cpp
        storage/ndb/test/ndbapi/testMgm.cpp
        storage/ndb/test/ndbapi/testPartitioning.cpp
        storage/ndb/test/ndbapi/testSRBank.cpp
        storage/ndb/test/ndbapi/test_event_merge.cpp
        storage/ndb/test/run-test/conf-dl145a.cnf
        storage/ndb/test/run-test/conf-ndbmaster.cnf
        storage/ndb/test/run-test/daily-basic-tests.txt
        storage/ndb/test/run-test/daily-devel-tests.txt
        storage/ndb/test/src/HugoOperations.cpp
        storage/ndb/test/src/HugoTransactions.cpp
        storage/ndb/test/src/NdbBackup.cpp
        storage/ndb/test/src/NdbMixRestarter.cpp
        storage/ndb/test/tools/copy_tab.cpp
        storage/ndb/tools/ndb_config.cpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/restore_main.cpp
        win/configure.js

 2851 Tomas Ulin	2009-03-12 [merge]
      merge

=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2009-03-12 09:54:58 +0000
+++ b/.bzr-mysql/default.conf	2009-03-12 11:06:48 +0000
@@ -2,4 +2,4 @@
 tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-telco-6.4
 post_commit_to = commits@stripped
 post_push_to = commits@stripped
-tree_name = mysql-6.0-telco-6.4
+tree_name = mysql-6.0-telco-7.1

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2009-03-12 09:54:58 +0000
+++ b/CMakeLists.txt	2009-03-12 10:59:57 +0000
@@ -17,6 +17,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FAT
 
 PROJECT(MySql)
 INCLUDE(config.cmake)
+if(COMMAND cmake_policy)
+    cmake_policy(SET CMP0003 NEW)
+endif(COMMAND cmake_policy)
 
 # This reads user configuration, generated by configure.js.
 INCLUDE(${CMAKE_SOURCE_DIR}/win/configure.data OPTIONAL)

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2009-03-03 14:24:27 +0000
+++ b/client/mysqltest.cc	2009-03-12 10:59:57 +0000
@@ -2613,6 +2613,9 @@ static int replace(DYNAMIC_STRING *ds_st
 }
 
 
+/* where to put this declaration in the file? */
+int regex_replace(DYNAMIC_STRING *ds, char *expr);
+
 /*
   Execute given command.
 
@@ -2664,12 +2667,18 @@ void do_exec(struct st_command *command)
 
 #ifdef __WIN__
 #ifndef USE_CYGWIN
-  /* Replace /dev/null with NUL */
-  while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
-    ;
-  /* Replace "closed stdout" with non existing output fd */
-  while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
-    ;
+  {
+    char *replaces[]= {
+      /* Replace /dev/null with NUL */
+      "/\\/dev\\/null/NUL/",
+      /* Replace "closed stdout" with non existing output fd */
+      "/>&-/>&4/",
+      0
+    };
+    int i= 0;
+    for(;replaces[i];i++)
+      regex_replace(&ds_cmd, replaces[i]);
+  }
 #endif
 #endif
 
@@ -8543,15 +8552,31 @@ void do_get_replace_regex(struct st_comm
   command->last_argument= command->end;
 }
 
+/* where to put these functions in the file? */
+void free_regex(struct st_replace_regex* r)
+{
+  delete_dynamic(&r->regex_arr);
+  my_free(r->even_buf,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(r->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(r,MYF(0));
+}
+
+/* where to put these functions in the file? */
+int regex_replace(DYNAMIC_STRING *ds, char *expr)
+{
+  struct st_replace_regex* r= init_replace_regex(expr);
+  int rv= multi_reg_replace(r, ds->str);
+  dynstr_set(ds, r->buf);
+  free_regex(r);
+  return rv;
+}
+
 void free_replace_regex()
 {
   if (glob_replace_regex)
   {
-    delete_dynamic(&glob_replace_regex->regex_arr);
-    my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(glob_replace_regex,MYF(0));
-    glob_replace_regex=0;
+    free_regex(glob_replace_regex);
+    glob_replace_regex= 0;
   }
 }
 

=== modified file 'configure.in'
--- a/configure.in	2009-03-12 09:54:58 +0000
+++ b/configure.in	2009-03-12 11:06:48 +0000
@@ -16,10 +16,10 @@ AC_PROG_LIBTOOL
 
 AC_CONFIG_HEADERS([include/config.h:config.h.in])
 
-NDB_VERSION_MAJOR=6
-NDB_VERSION_MINOR=4
-NDB_VERSION_BUILD=3
-NDB_VERSION_STATUS="-beta"
+NDB_VERSION_MAJOR=7
+NDB_VERSION_MINOR=1
+NDB_VERSION_BUILD=0
+NDB_VERSION_STATUS="-alpha"
 
 PROTOCOL_VERSION=10
 DOT_FRM_VERSION=6

=== removed file 'mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test'
--- a/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test	2007-10-14 17:27:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_conflict_1.test	1970-01-01 00:00:00 +0000
@@ -1,128 +0,0 @@
---connection master
-
---eval create table t1 (a int, b varchar(32), X $col_type, d varchar(9), primary key (a, d)) engine ndb
-create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
-
---echo ************************************************
---echo * some basic positive testing, i.e. no conflicts
---echo ************************************************
---connection master
---echo *** insert some data
-begin;
-insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
-insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
-insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
-insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
-insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
-insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
-commit;
-
---echo *** master - update all
---connection master
-begin;
-update t1 set b="Master t1 X=2", X=X+1;
-update t2 set b="Master t2 c=2", c=c+1;
-commit;
---echo *** slave - check update all
---sync_slave_with_master
---connection slave
-select * from t1 order by a, d;
-select * from t2 order by a, d;
-
---echo *** master - update 2 rows in different tables
---connection master
-update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
-update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
---echo *** slave - check update 2 rows in different tables
---sync_slave_with_master
---connection slave
-select * from t1 order by a, d;
-select * from t2 order by a, d;
-
---echo *** master - delete all
---connection master
-delete from t1;
-delete from t2;
---echo *** slave - check delete all
---sync_slave_with_master
---connection slave
-select * from t1 order by a, d;
-select * from t2 order by a, d;
-
---echo ************************
---echo * start conflict testing
---echo ************************
---echo *** master - insert some data
---connection master
-begin;
-insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
-insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
-insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
-insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
-insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
-insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
-commit;
-
---echo *** slave - check conflict info, no conflicts yet
---sync_slave_with_master
---connection slave
---source include/ndb_conflict_info.inc
-
---echo *** slave - check insert some data
-select * from t1 order by a, d;
-select * from t2 order by a, d;
-
---echo *** slave - update some data to cause conflicts
-begin;
-update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
-update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
-update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
-update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
-update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
-update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
-commit;
-
---echo *** master - update some data to cause conflicts
---connection master
-begin;
-update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
-update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
-update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
-update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
-update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
-update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
-commit;
-
---echo *** slave - check conflict info, there should be some
---sync_slave_with_master
---connection slave
---source include/ndb_conflict_info.inc
-
---echo *** slave - check update some data that causes conflicts
-select * from t1 order by a, d;
-select * from t2 order by a, d;
---echo *** slave - correct some data to correspond to the master
-update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
-
---echo *** master - update some data, use higher timestamp
---connection master
-begin;
-update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
-update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
-update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
-update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
-update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
-update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
-commit;
-
---echo *** slave - check conflict info, change depends on calling test
---sync_slave_with_master
---connection slave
---source include/ndb_conflict_info.inc
-
---echo *** slave - check higer timestamp
-select * from t1 order by a, d;
-select * from t2 order by a, d;
-
---connection master
-drop table t1, t2;

=== modified file 'mysql-test/include/default_ndbd.cnf'
--- a/mysql-test/include/default_ndbd.cnf	2009-02-05 12:22:39 +0000
+++ b/mysql-test/include/default_ndbd.cnf	2009-03-12 11:06:48 +0000
@@ -16,7 +16,7 @@ FragmentLogFileSize=           12M
 DiskPageBufferMemory=          4M
 
 # O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
-ODirect= 1
+#ODirect= 1
 CompressedLCP= 1
 CompressedBackup= 1
 # the following parametes just function as a small regression
@@ -28,3 +28,4 @@ HeartbeatIntervalDbDb=         30000
 HeartbeatIntervalDbApi=        30000
 
 #TransactionDeadlockDetectionTimeout= 7500
+DiskIOThreadPool=1

=== modified file 'mysql-test/include/ndb_backup.inc'
--- a/mysql-test/include/ndb_backup.inc	2009-03-12 09:54:58 +0000
+++ b/mysql-test/include/ndb_backup.inc	2009-03-12 11:06:48 +0000
@@ -11,21 +11,4 @@
 
 --exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
 
-# there is no neat way to find the backupid, this is a hack to find it...
-let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat;
---exec $NDB_SELECT_ALL --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file
-
-CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-
-# needed for embedded
---chmod 0777 $dump_file
---replace_result $dump_file DUMP_FILE
-eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-
-# Load backup id into environment variable
-let the_backup_id=`SELECT  backup_id from test.backup_info`;
-DROP TABLE test.backup_info;
-
-remove_file $dump_file;
-
-
+--source include/ndb_backup_id.inc

=== added file 'mysql-test/include/ndb_backup_id.inc'
--- a/mysql-test/include/ndb_backup_id.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/ndb_backup_id.inc	2009-02-18 21:09:24 +0000
@@ -0,0 +1,16 @@
+# there is no neat way to find the backupid, this is a hack to find it...
+--let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat
+--exec $NDB_SELECT_ALL -d sys --delimiter=, SYSTAB_0 | grep 520093696 > $dump_file
+
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+
+# needed for embedded
+--exec chmod 0777 $dump_file
+--replace_result $dump_file DUMP_FILE
+eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+
+# Load backup id into environment variable
+let the_backup_id=`SELECT  backup_id from test.backup_info`;
+DROP TABLE test.backup_info;
+
+--remove_file $dump_file

=== modified file 'mysql-test/include/ndb_conflict_info.inc'
--- a/mysql-test/include/ndb_conflict_info.inc	2007-10-14 10:32:32 +0000
+++ b/mysql-test/include/ndb_conflict_info.inc	2009-02-16 15:54:40 +0000
@@ -2,7 +2,7 @@ SELECT VARIABLE_VALUE-@init_ndb_conflict
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 --replace_column 3 # 5 # 6 #
 --error 0,1146
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 --replace_column 3 # 4 #
 --error 0,1146
 SELECT * FROM `t1$EX` ORDER BY a, d;

=== modified file 'mysql-test/include/ndb_conflict_info_init.inc'
--- a/mysql-test/include/ndb_conflict_info_init.inc	2007-10-08 20:14:41 +0000
+++ b/mysql-test/include/ndb_conflict_info_init.inc	2009-02-16 15:54:40 +0000
@@ -2,5 +2,7 @@
 --disable_result_log
 SELECT @init_ndb_conflict_fn_max:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 SELECT @init_ndb_conflict_fn_old:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+--error 0,1146
+DELETE FROM `t1$EX`;
 --enable_query_log
 --enable_result_log

=== modified file 'mysql-test/include/ndb_not_readonly.inc'
--- a/mysql-test/include/ndb_not_readonly.inc	2009-02-05 12:22:39 +0000
+++ b/mysql-test/include/ndb_not_readonly.inc	2009-03-12 11:06:48 +0000
@@ -11,7 +11,7 @@ let $counter= 600;
 while ($mysql_errno)
 {
   # Table is readonly until the mysqld has connected properly
-  --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG
+  --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG,ER_TABLE_DEF_CHANGED
   replace into mysql.ndb_schema values("","",0,"",0,0,0,0,0);
   if ($mysql_errno)
   {

=== modified file 'mysql-test/include/ndb_setup_slave.inc'
--- a/mysql-test/include/ndb_setup_slave.inc	2007-06-13 20:28:44 +0000
+++ b/mysql-test/include/ndb_setup_slave.inc	2009-02-09 11:40:31 +0000
@@ -15,8 +15,11 @@ SELECT @the_epoch:=MAX(epoch) FROM mysql
 --connection master
 --replace_result $the_epoch <the_epoch>
 --replace_column 1 <the_pos>
-eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+--disable_query_log
+eval SELECT @the_pos:=Position,
+   @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
    FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
+--enable_query_log
 --let $the_pos= `SELECT @the_pos`
 --let $the_file= `SELECT @the_file`
 

=== modified file 'mysql-test/lib/My/ConfigFactory.pm'
--- a/mysql-test/lib/My/ConfigFactory.pm	2009-01-27 13:21:18 +0000
+++ b/mysql-test/lib/My/ConfigFactory.pm	2009-02-17 13:22:36 +0000
@@ -240,6 +240,20 @@ sub fix_cluster_backup_dir {
 }
 
 
+sub fix_cluster_undo_file_dir {
+  my ($self, $config, $group_name, $group)= @_;
+  my $dir= $group->value('DataDir');
+  return "$dir/uf";
+}
+
+
+sub fix_cluster_data_file_dir {
+  my ($self, $config, $group_name, $group)= @_;
+  my $dir= $group->value('DataDir');
+  return "$dir/df";
+}
+
+
 #
 # Rules to run for each ndb_mgmd in the config
 #  - will be run in order listed here
@@ -260,6 +274,8 @@ my @ndbd_rules=
  { 'HostName' => \&fix_host },
  { 'DataDir' => \&fix_cluster_dir },
  { 'BackupDataDir' => \&fix_cluster_backup_dir },
+ { 'FileSystemPathDD' => \&fix_cluster_undo_file_dir },
+ { 'FileSystemPathDataFiles' => \&fix_cluster_data_file_dir },
 );
 
 

=== modified file 'mysql-test/lib/v1/ndb_config_2_node.ini'
--- a/mysql-test/lib/v1/ndb_config_2_node.ini	2009-02-11 12:11:18 +0000
+++ b/mysql-test/lib/v1/ndb_config_2_node.ini	2009-03-12 11:06:48 +0000
@@ -22,6 +22,9 @@ CompressedBackup= 1
 # test that the parameter exists
 InitialNoOfOpenFiles= 27
 
+FileSystemPathDD= CHOOSE_FILESYSTEM/uf
+FileSystemPathDataFiles= CHOOSE_FILESYSTEM/df
+
 #
 # Increase timeouts to cater for slow test-machines
 #   (possibly running several tests in parallell)

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-03-12 09:54:58 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-03-12 11:06:48 +0000
@@ -229,6 +229,7 @@ our $opt_warnings= 1;
 our $opt_skip_ndbcluster= 0;
 
 my $exe_ndbd;
+my $exe_ndbmtd;
 my $exe_ndb_mgmd;
 my $exe_ndb_waiter;
 
@@ -963,12 +964,12 @@ sub command_line_setup {
   }
 
   # Look for language files and charsetsdir, use same share
-  my $path_share=      mtr_path_exists("$basedir/share/mysql",
-				       "$basedir/sql/share",
-				       "$basedir/share");
+  $path_language=   mtr_path_exists("$basedir/share/mysql/english",
+                                    "$basedir/sql/share/english",
+                                    "$basedir/share/english");
 
-  
-  $path_language=      mtr_path_exists("$path_share/english");
+
+  my $path_share= dirname($path_language);
   $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
 
   if (using_extern())
@@ -1506,11 +1507,20 @@ sub executable_setup () {
 
   if ( ! $opt_skip_ndbcluster )
   {
+    # Look for single threaded NDB
     $exe_ndbd=
       my_find_bin($basedir,
 		  ["storage/ndb/src/kernel", "libexec", "sbin", "bin"],
 		  "ndbd");
 
+    # Look for multi threaded NDB
+    $exe_ndbmtd=
+      my_find_bin($basedir,
+		  ["storage/ndb/src/kernel", "libexec", "sbin", "bin"],
+		  "ndbmtd", NOT_REQUIRED);
+    mtr_report(" - multi threaded ndbd, will be used \"round robin\"")
+      if ($exe_ndbmtd);
+
     $exe_ndb_mgmd=
       my_find_bin($basedir,
 		  ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"],
@@ -1823,55 +1833,55 @@ sub environment_setup {
   if ( ! $opt_skip_ndbcluster )
   {
     $ENV{'NDB_MGM'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/src/mgmclient", "bin"],
-		  "ndb_mgm");
+		  "ndb_mgm"));
 
     $ENV{'NDB_WAITER'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_waiter");
+		  "ndb_waiter"));
 
     $ENV{'NDB_RESTORE'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_restore");
+		  "ndb_restore"));
 
     $ENV{'NDB_CONFIG'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_config");
+		  "ndb_config"));
 
     $ENV{'NDB_SELECT_ALL'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_select_all");
+		  "ndb_select_all"));
 
     $ENV{'NDB_DROP_TABLE'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_drop_table");
+		  "ndb_drop_table"));
 
     $ENV{'NDB_DESC'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_desc");
+		  "ndb_desc"));
 
     $ENV{'NDB_SHOW_TABLES'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/tools", "bin"],
-		  "ndb_show_tables");
+		  "ndb_show_tables"));
 
     $ENV{'NDB_EXAMPLES_DIR'}=
-      my_find_dir($basedir,
-		  ["storage/ndb/ndbapi-examples", "bin"]);
+      native_path(my_find_dir($basedir,
+		  ["storage/ndb/ndbapi-examples", "bin"]));
 
     $ENV{'NDB_EXAMPLES_BINARY'}=
-      my_find_bin($basedir,
+      native_path(my_find_bin($basedir,
 		  ["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"],
-		  "ndbapi_simple", NOT_REQUIRED);
+		  "ndbapi_simple", NOT_REQUIRED));
 
-    my $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
+    my $path_ndb_testrun_log= native_path("$opt_vardir/log/ndb_testrun.log");
     $ENV{'NDB_TOOLS_OUTPUT'}=         $path_ndb_testrun_log;
     $ENV{'NDB_EXAMPLES_OUTPUT'}=      $path_ndb_testrun_log;
   }
@@ -2375,6 +2385,8 @@ sub ndb_mgmd_start ($$) {
 }
 
 
+my $exe_ndbmtd_counter= 0;
+
 sub ndbd_start {
   my ($cluster, $ndbd)= @_;
 
@@ -2391,12 +2403,18 @@ sub ndbd_start {
 
 # > 5.0 { 'character-sets-dir' => \&fix_charset_dir },
 
+  my $exe= $exe_ndbd;
+  if ($exe_ndbmtd and ($exe_ndbmtd_counter++ % 2) == 0)
+  {
+    # Use ndbmtd every other time
+    $exe= $exe_ndbmtd;
+  }
 
   my $path_ndbd_log= "$dir/ndbd.log";
   my $proc= My::SafeProcess->new
     (
      name          => $ndbd->after('cluster_config.'),
-     path          => $exe_ndbd,
+     path          => $exe,
      args          => \$args,
      output        => $path_ndbd_log,
      error         => $path_ndbd_log,
@@ -4204,12 +4222,6 @@ sub server_need_restart {
     return 0;
   }
 
-  if ( $opt_embedded_server )
-  {
-    mtr_verbose_restart($server, "no start or restart for embedded server");
-    return 0;
-  }
-
   if ( $tinfo->{'force_restart'} ) {
     mtr_verbose_restart($server, "forced in .opt file");
     return 1;

=== modified file 'mysql-test/suite/funcs_1/t/disabled.def'
--- a/mysql-test/suite/funcs_1/t/disabled.def	2009-02-19 12:59:02 +0000
+++ b/mysql-test/suite/funcs_1/t/disabled.def	2009-03-12 11:06:48 +0000
@@ -11,3 +11,4 @@
 ##############################################################################
 
 ndb_views:		Bug #40860 funcs_1.ndb_views fail
+charset_collation_1:	wrong result

=== modified file 'mysql-test/suite/ndb/r/ndb_add_partition.result'
--- a/mysql-test/suite/ndb/r/ndb_add_partition.result	2009-01-28 09:55:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_add_partition.result	2009-03-12 10:59:57 +0000
@@ -17,10 +17,11 @@ ENGINE = NDB
 partition by key(a);
 CREATE TABLE t2 (a int unsigned not null,
 b int unsigned not null,
-c int unsigned not null storage DISK,
+c int unsigned not null,
 primary key(a,b),
 unique (b))
 ENGINE = NDB
+STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
 INSERT INTO t1 VALUES

=== modified file 'mysql-test/suite/ndb/r/ndb_config.result'
--- a/mysql-test/suite/ndb/r/ndb_config.result	2009-02-11 12:11:18 +0000
+++ b/mysql-test/suite/ndb/r/ndb_config.result	2009-03-12 10:59:57 +0000
@@ -1,5 +1,5 @@
 == 1 ==
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost mysqld,7,localhost mysqld,8,localhost mysqld,9,localhost mysqld,10,localhost mysqld,11,localhost mysqld,12,localhost mysqld,63,localhost mysqld,127,localhost mysqld,192,localhost mysqld,228,localhost mysqld,255,localhost
+ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost mysqld,7,localhost mysqld,8,localhost mysqld,9,localhost mysqld,10,localhost mysqld,11,localhost mysqld,12,localhost mysqld,63,localhost mysqld,127,localhost mysqld,192,localhost mysqld,228,localhost mysqld,255,localhost ndbd,1,localhost ndbd,2,localhost
 == 2 ==
 1,localhost,20971520,1048576 2,localhost,20971520,1048576
 == 3 ==
@@ -8,20 +8,20 @@ ndbd,1,localhost ndbd,2,localhost ndb_mg
 == 4 ==
 1 2
 == 5 ==
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,63, mysqld,127, mysqld,192, mysqld,228, mysqld,255,
+ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,63, mysqld,127, mysqld,192, mysqld,228, mysqld,255, ndbd,1,localhost ndbd,2,localhost
 == 6 ==
-ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
+ndb_mgmd,5,localhost,, mysqld,6,localhost,, ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800
 == 7 ==
-ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
+ndb_mgmd,5,localhost mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, ndbd,1,localhost ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost
 == 8 ==
-ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
+ndb_mgmd,6,localhost mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10, ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost
 == 9 ==
-ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
+ndb_mgmd,1,localhost ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15, ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost
 == 10 ==
-shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
+tcp,3,4,55,3 tcp,3,5,55,3 tcp,3,6,55,3 tcp,4,5,55,4 tcp,4,6,55,4 tcp,5,6,55,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2 tcp,1,2,55,2
 == 11 ==
-1 2 3
+3 1 2
 == 12 ==
 
 == 13 ==
-1 2 3
+3 1 2

=== modified file 'mysql-test/suite/ndb/r/ndb_config2.result'
--- a/mysql-test/suite/ndb/r/ndb_config2.result	2008-10-21 12:41:59 +0000
+++ b/mysql-test/suite/ndb/r/ndb_config2.result	2008-11-27 01:19:14 +0000
@@ -1 +1 @@
-shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2 tcp,1,2,55,2
+tcp,3,4,55,3 tcp,3,5,55,3 tcp,3,6,55,3 tcp,4,5,55,4 tcp,4,6,55,4 tcp,5,6,55,5 tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4 tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6 tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4 tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1 tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2 tcp,1,2,55,2

=== added file 'mysql-test/suite/ndb/r/ndb_partition_hash.result'
--- a/mysql-test/suite/ndb/r/ndb_partition_hash.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_partition_hash.result	2009-03-06 18:06:17 +0000
@@ -0,0 +1,23 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+ol_o_id int NOT NULL,
+ol_d_id int NOT NULL,
+ol_w_id int NOT NULL,
+ol_number int NOT NULL,
+ol_tmp int,
+PRIMARY KEY (ol_w_id, ol_d_id, ol_o_id, ol_number)
+) ENGINE=NDB
+PARTITION BY HASH (ol_w_id);
+insert into t1 values (1,0,0,0,0),(1,0,0,1,0),(1,0,0,2,0),(1,1,0,0,0),(1,1,0,1,0);
+insert into t1 values (2,0,0,0,0),(4,0,0,0,0),(4,0,0,1,0);
+insert into t1 values (0,1,1,4,0),(0,1,1,5,0);
+UPDATE t1 force index (primary) SET ol_tmp = 1
+WHERE ol_o_id = 0 AND ol_d_id = 1 AND ol_w_id = 1;
+SELECT * FROM t1 WHERE ol_w_id = 1 AND ol_d_id = 1 AND ol_o_id = 0;
+ol_o_id	ol_d_id	ol_w_id	ol_number	ol_tmp
+0	1	1	4	1
+0	1	1	5	1
+SELECT SUM(ol_number) FROM t1 WHERE ol_o_id = 0 AND ol_w_id = 1 AND ol_d_id = 1;
+SUM(ol_number)
+9
+drop table t1;

=== modified file 'mysql-test/suite/ndb/r/ndb_restore.result'
--- a/mysql-test/suite/ndb/r/ndb_restore.result	2009-03-12 09:54:58 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore.result	2009-03-12 11:06:48 +0000
@@ -611,23 +611,53 @@ insert into tab2 values (1, "Donnington"
 (5, "Sciennes", 5, repeat("S", 1000)),
 (6, "Cairns", 6, repeat("T", 1000)),
 (7, "Highlea", 7, repeat("U", 1000));
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
-checksum table tab2;
-Table	Chec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UUUUUUUUUUU
 use db2;
 create table tab1 (a int primary key) engine=ndb;
 create table tab2 (a int primary key, b varchar(20), c int, unique(c), d text) engine=ndb;
 insert into tab1 select * from db1.tab1;
 insert into tab2 select * from db1.tab2;
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
-checksum table tab2;
-Table	Checksum
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 ***********************
 Backing up created data
 ***********************
@@ -644,19 +674,53 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db1.tab2, db2.tab1, db2.tab2;
 ****************
 Include only db2
@@ -669,10 +733,27 @@ show tables;
 Tables_in_db2
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db2.tab1	994088853
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db2.tab1, db2.tab2;
 ****************
 Exclude only db2
@@ -682,10 +763,27 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
@@ -706,16 +804,31 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
 tab2
-checksum table tab2;
-Table	Checksum
-db2.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db2.tab2;
 *****************************
 Exclude db1.tab1 and db2.tab2
@@ -725,16 +838,31 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
 tab1
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 drop table db1.tab2, db2.tab1;
 ********************************* 
 Include db1.tab1, but exclude db1
@@ -744,9 +872,18 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
@@ -759,9 +896,15 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
@@ -774,9 +917,18 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
@@ -793,10 +945,27 @@ show tables;
 Tables_in_db2
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db2.tab1	994088853
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db2.tab1, db2.tab2;
 *********************************
 Include db1, and include db2.tab1
@@ -809,9 +978,18 @@ use db2;
 show tables;
 Tables_in_db2
 tab1
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 drop table db2.tab1;
 ************************
 Include unknown database
@@ -848,19 +1026,53 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db1.tab2;
 drop table db2.tab1, db2.tab2;
 *********************************************
@@ -871,9 +1083,15 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2

=== modified file 'mysql-test/suite/ndb/r/ndb_restore_compressed.result'
--- a/mysql-test/suite/ndb/r/ndb_restore_compressed.result	2009-03-03 14:24:27 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore_compressed.result	2009-03-12 11:06:48 +0000
@@ -611,23 +611,53 @@ insert into tab2 values (1, "Donnington"
 (5, "Sciennes", 5, repeat("S", 1000)),
 (6, "Cairns", 6, repeat("T", 1000)),
 (7, "Highlea", 7, repeat("U", 1000));
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 create table tab1 (a int primary key) engine=ndb;
 create table tab2 (a int primary key, b varchar(20), c int, unique(c), d text) engine=ndb;
 insert into tab1 select * from db1.tab1;
 insert into tab2 select * from db1.tab2;
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
-checksum table tab2;
-Table	Checksum
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 ***********************
 Backing up created data
 ***********************
@@ -644,19 +674,53 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db1.tab2, db2.tab1, db2.tab2;
 ****************
 Include only db2
@@ -669,10 +733,27 @@ show tables;
 Tables_in_db2
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db2.tab1	994088853
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db2.tab1, db2.tab2;
 ****************
 Exclude only db2
@@ -682,10 +763,27 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
@@ -706,16 +804,31 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
 tab2
-checksum table tab2;
-Table	Checksum
-db2.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db2.tab2;
 *****************************
 Exclude db1.tab1 and db2.tab2
@@ -725,16 +838,31 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
 tab1
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 drop table db1.tab2, db2.tab1;
 ********************************* 
 Include db1.tab1, but exclude db1
@@ -744,9 +872,18 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
@@ -759,9 +896,15 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2
@@ -774,9 +917,18 @@ use db1;
 show tables;
 Tables_in_db1
 tab1
-checksum table tab1;
-Table	Checksum
-db1.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 use db2;
 show tables;
 Tables_in_db2
@@ -793,10 +945,27 @@ show tables;
 Tables_in_db2
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db2.tab1	994088853
-db2.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db2.tab1, db2.tab2;
 *********************************
 Include db1, and include db2.tab1
@@ -809,9 +978,18 @@ use db2;
 show tables;
 Tables_in_db2
 tab1
-checksum table tab1;
-Table	Checksum
-db2.tab1	994088853
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
 drop table db2.tab1;
 ************************
 Include unknown database
@@ -848,19 +1026,53 @@ show tables;
 Tables_in_db1
 tab2
 tab1
-checksum table tab1, tab2;
-Table	Checksum
-db1.tab1	994088853
-db1.tab2	1516475923
+select * from tab1 order by a;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 drop table db1.tab1, db1.tab2;
 drop table db2.tab1, db2.tab2;
 *********************************************
@@ -871,9 +1083,15 @@ use db1;
 show tables;
 Tables_in_db1
 tab2
-checksum table tab2;
-Table	Checksum
-db1.tab2	1516475923
+select * from tab2 order by a;
+a	b	c	d
+1	Donnington	1	OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
 UUUUUUUUUUUUUUUUUUUUUUU
 use db2;
 show tables;
 Tables_in_db2

=== modified file 'mysql-test/suite/ndb/r/ndbapi.result'
--- a/mysql-test/suite/ndb/r/ndbapi.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/ndb/r/ndbapi.result	2009-02-25 12:47:05 +0000
@@ -19,4 +19,6 @@ update t0 set c2 = 'G' where c0 = 1;
 update t0 set c0 = 5, c2 = 'H' where c0 = 3;
 delete from t0;
 drop table t0;
+drop database TEST_DB;
+drop database TEST_DB_1;
 Running mgmapi_logevent

=== modified file 'mysql-test/suite/ndb/t/ndb_add_partition.test'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.test	2008-12-22 09:40:33 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.test	2009-02-12 15:21:46 +0000
@@ -25,10 +25,11 @@ partition by key(a);
 
 CREATE TABLE t2 (a int unsigned not null,
                  b int unsigned not null,
-                 c int unsigned not null storage DISK,
+                 c int unsigned not null,
                  primary key(a,b),
                  unique (b))
 ENGINE = NDB
+STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
 

=== modified file 'mysql-test/suite/ndb/t/ndb_config.test'
--- a/mysql-test/suite/ndb/t/ndb_config.test	2009-02-11 12:11:18 +0000
+++ b/mysql-test/suite/ndb/t/ndb_config.test	2009-03-12 10:59:57 +0000
@@ -8,7 +8,7 @@ echo == 2 ==;
 --exec $NDB_CONFIG --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
 
 echo == 3 ==;
---exec $NDB_CONFIG --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
+--exec $NDB_CONFIG --no-defaults -r \\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
 
 echo == 4 ==;
 --exec $NDB_CONFIG --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
@@ -28,9 +28,8 @@ echo == 8 ==;
 
 echo == 9 ==;
 --exec $NDB_CONFIG --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host --mycnf 2> /dev/null
-
 echo == 10 ==;
---exec $NDB_CONFIG --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
+--exec $NDB_CONFIG --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
 
 echo == 11 ==;
 --exec $NDB_CONFIG --no-defaults --query=nodeid --host=localhost --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null

=== modified file 'mysql-test/suite/ndb/t/ndb_config2.test'
--- a/mysql-test/suite/ndb/t/ndb_config2.test	2008-10-13 17:45:03 +0000
+++ b/mysql-test/suite/ndb/t/ndb_config2.test	2008-11-27 01:19:14 +0000
@@ -3,4 +3,4 @@
 
 # Following doesn't work in all configurations (if shm is not defined)
 
---exec $NDB_CONFIG --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
+--exec $NDB_CONFIG --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null

=== added file 'mysql-test/suite/ndb/t/ndb_partition_hash.test'
--- a/mysql-test/suite/ndb/t/ndb_partition_hash.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_partition_hash.test	2009-03-06 18:06:17 +0000
@@ -0,0 +1,49 @@
+--source include/have_ndb.inc
+#
+# Simple test for the partition storage engine
+# Focuses on range partitioning tests
+# 
+#-- source include/have_partition.inc
+
+--disable_query_log
+set new=on;
+--enable_query_log
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Partition by hash, basic
+#
+
+
+#
+# BUG37934:
+# Partition pruning is broken for DBT2 table
+# Testcase from Mikael Ronstrom.
+# Note that the testcase did not fail previously, but accessed
+# partitions unnecessarily
+#
+CREATE TABLE t1 (
+  ol_o_id int NOT NULL,
+  ol_d_id int NOT NULL,
+  ol_w_id int NOT NULL,
+  ol_number int NOT NULL,
+  ol_tmp int,
+  PRIMARY KEY (ol_w_id, ol_d_id, ol_o_id, ol_number)
+) ENGINE=NDB
+PARTITION BY HASH (ol_w_id);
+
+insert into t1 values (1,0,0,0,0),(1,0,0,1,0),(1,0,0,2,0),(1,1,0,0,0),(1,1,0,1,0);
+insert into t1 values (2,0,0,0,0),(4,0,0,0,0),(4,0,0,1,0);
+insert into t1 values (0,1,1,4,0),(0,1,1,5,0); # Only rows affected.
+
+UPDATE t1 force index (primary) SET ol_tmp = 1
+WHERE ol_o_id = 0 AND ol_d_id = 1 AND ol_w_id = 1;
+
+SELECT * FROM t1 WHERE ol_w_id = 1 AND ol_d_id = 1 AND ol_o_id = 0;
+SELECT SUM(ol_number) FROM t1 WHERE ol_o_id = 0 AND ol_w_id = 1 AND ol_d_id = 1;
+
+drop table t1;
+

=== modified file 'mysql-test/suite/ndb/t/ndb_restore.test'
--- a/mysql-test/suite/ndb/t/ndb_restore.test	2009-02-11 12:11:18 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore.test	2009-03-12 11:06:48 +0000
@@ -510,8 +510,10 @@ insert into tab2 values (1, "Donnington"
 (6, "Cairns", 6, repeat("T", 1000)),
 (7, "Highlea", 7, repeat("U", 1000));
 
-checksum table tab1;
-checksum table tab2;
+# checksum table tab1;
+# checksum table tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 use db2;
 
@@ -521,8 +523,10 @@ create table tab2 (a int primary key, b 
 insert into tab1 select * from db1.tab1;
 insert into tab2 select * from db1.tab2;
 
-checksum table tab1;
-checksum table tab2;
+# checksum table tab1;
+# checksum table tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 --echo ***********************
 --echo Backing up created data
@@ -540,11 +544,15 @@ drop table db1.tab1, db1.tab2, db2.tab1,
 
 use db1;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 use db2;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 drop table db1.tab1, db1.tab2, db2.tab1, db2.tab2;
 
@@ -558,8 +566,9 @@ use db1;
 show tables;
 use db2;
 show tables;
-checksum table tab1, tab2;
-
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 drop table db2.tab1, db2.tab2;
 
@@ -572,7 +581,9 @@ drop table db2.tab1, db2.tab2;
 
 use db1;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 use db2;
 show tables;
@@ -601,11 +612,13 @@ show tables;
 
 use db1;
 show tables;
-checksum table tab1;
+# checksum table tab1;
+select * from tab1 order by a;
 
 use db2;
 show tables;
-checksum table tab2;
+# checksum table tab2;
+select * from tab2 order by a;
 
 
 drop table db1.tab1, db2.tab2;
@@ -620,11 +633,13 @@ drop table db1.tab1, db2.tab2;
 
 use db1;
 show tables;
-checksum table tab2;
+# checksum table tab2;
+select * from tab2 order by a;
 
 use db2;
 show tables;
-checksum table tab1;
+# checksum table tab1;
+select * from tab1 order by a;
 
 drop table db1.tab2, db2.tab1;
 
@@ -639,7 +654,8 @@ drop table db1.tab2, db2.tab1;
 
 use db1;
 show tables;
-checksum table tab1;
+# checksum table tab1;
+select * from tab1 order by a;
 
 use db2;
 show tables;
@@ -656,7 +672,8 @@ drop table db1.tab1;
 
 use db1;
 show tables;
-checksum table tab2;
+# checksum table tab2;
+select * from tab2 order by a;
 
 use db2;
 show tables;
@@ -673,7 +690,8 @@ drop table db1.tab2;
 
 use db1;
 show tables;
-checksum table tab1;
+# checksum table tab1;
+select * from tab1 order by a;
 
 use db2;
 show tables;
@@ -692,7 +710,9 @@ use db1;
 show tables;
 use db2;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 drop table db2.tab1, db2.tab2;
 
@@ -708,7 +728,8 @@ use db1;
 show tables;
 use db2;
 show tables;
-checksum table tab1;
+# checksum table tab1;
+select * from tab1 order by a;
 
 drop table db2.tab1;
 
@@ -737,10 +758,14 @@ show databases;
 
 use db1;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 use db2;
 show tables;
-checksum table tab1, tab2;
+# checksum table tab1, tab2;
+select * from tab1 order by a;
+select * from tab2 order by a;
 
 drop table db1.tab1, db1.tab2;
 drop table db2.tab1, db2.tab2;
@@ -754,7 +779,8 @@ drop table db2.tab1, db2.tab2;
 
 use db1;
 show tables;
-checksum table tab2;
+# checksum table tab2;
+select * from tab2 order by a;
 
 use db2;
 show tables;

=== modified file 'mysql-test/suite/ndb/t/ndbapi.test'
--- a/mysql-test/suite/ndb/t/ndbapi.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/ndb/t/ndbapi.test	2009-02-25 12:47:05 +0000
@@ -5,6 +5,7 @@
 DROP TABLE IF EXISTS t0;
 drop database if exists mysqltest;
 --enable_warnings
+--let MASTER_MYSOCK=`select @@socket`;
 
 --exec echo Running ndbapi_simple
 --exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
@@ -31,14 +32,16 @@ create table t0(c0 int, c1 int, c2 char(
 #--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT
 insert into t0 values (1, 2, 'a', 'b', null);
 insert into t0 values (3, 4, 'c', 'd', null);
-update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; -- use pk
-update t0 set c3 = 'f'; -- use scan
-update t0 set c3 = 'F'; -- use scan update to 'same'
-update t0 set c2 = 'g' where c0 = 1; -- update pk part
-update t0 set c2 = 'G' where c0 = 1; -- update pk part to 'same'
-update t0 set c0 = 5, c2 = 'H' where c0 = 3; -- update full PK
+update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; # use pk
+update t0 set c3 = 'f'; # use scan
+update t0 set c3 = 'F'; # use scan update to 'same'
+update t0 set c2 = 'g' where c0 = 1; # update pk part
+update t0 set c2 = 'G' where c0 = 1; # update pk part to 'same'
+update t0 set c0 = 5, c2 = 'H' where c0 = 3; # update full PK
 delete from t0;
 drop table t0;
+drop database TEST_DB;
+drop database TEST_DB_1;
 
 --exec echo Running mgmapi_logevent
 --exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT

=== modified file 'mysql-test/suite/ndb_team/my.cnf'
--- a/mysql-test/suite/ndb_team/my.cnf	2009-02-02 15:58:48 +0000
+++ b/mysql-test/suite/ndb_team/my.cnf	2009-03-12 11:06:48 +0000
@@ -25,16 +25,10 @@ ndbapi=,,,,
 ndbcluster
 ndb-wait-connected=20
 ndb-cluster-connection-pool=3
-slave-allow-batching
-ndb-log-orig
+loose-slave-allow-batching
+loose-ndb-log-orig
 # Turn on bin logging
-log-bin=                       master-bin
-
-# Time to wait for NDB connection before
-# accepting connections client connections
-ndb-wait-connected=            20
-
-ndb-extra-logging
+loose-log-bin=                       master-bin
 
 [mysqld.1.1]
 

=== modified file 'mysql-test/suite/ndb_team/r/ndb_autodiscover3.result'
--- a/mysql-test/suite/ndb_team/r/ndb_autodiscover3.result	2008-10-15 12:24:10 +0000
+++ b/mysql-test/suite/ndb_team/r/ndb_autodiscover3.result	2009-02-18 20:19:11 +0000
@@ -13,6 +13,9 @@ a	b
 1	1
 2	1
 3	1
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+DROP TABLE test.backup_info;
 select * from t2;
 ERROR 42S02: Table 'test.t2' doesn't exist
 show tables like 't2';
@@ -31,6 +34,9 @@ a
 2
 3
 reset master;
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+DROP TABLE test.backup_info;
 select * from t2;
 ERROR 42S02: Table 'test.t2' doesn't exist
 show tables like 't2';

=== modified file 'mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result'
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result	2009-02-11 12:11:18 +0000
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result	2009-03-12 10:59:57 +0000
@@ -279,8 +279,11 @@ COUNT(*)
 ***** Finsh the slave sync process *******
 @the_epoch:=MAX(epoch)
 <the_epoch>
-@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+@the_pos:=Position	@the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1)
 <the_pos>	master-bin.000001
+CHANGE MASTER TO
+master_log_file = 'master-bin.000001',
+master_log_pos = <the_pos> ;
 * 4. *
 * 5. *
 START SLAVE;

=== modified file 'mysql-test/suite/ndb_team/t/ndb_autodiscover3.test'
--- a/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test	2009-01-28 09:55:02 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test	2009-03-12 11:06:48 +0000
@@ -54,8 +54,12 @@ create table t2 (a int, b int, primary k
 insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
 select * from t2 order by a limit 3;
 
+--source include/ndb_backup_id.inc
 --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
 --exec $NDB_WAITER --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
+# now make a backup with explicit id to restore the backup id after initial start
+--inc $the_backup_id
+--exec $NDB_MGM --no-defaults -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT
 # to ensure mysqld has connected again, and recreated system tables
 --disable_query_log
 --connection con1
@@ -78,8 +82,12 @@ select * from t2 order by a limit 3;
 select * from t2 order by a limit 3;
 reset master;
 
+--source include/ndb_backup_id.inc
 --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
 --exec $NDB_WAITER --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
+# now make a backup with explicit id to restore the backup id after initial start
+--inc $the_backup_id
+--exec $NDB_MGM --no-defaults -e "start backup $the_backup_id" >> $NDB_TOOLS_OUTPUT
 # to ensure mysqld has connected again, and recreated system tables
 --disable_query_log
 --connection con1

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result	2007-10-14 17:27:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_max.result	2009-02-16 15:54:40 +0000
@@ -5,7 +5,7 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 *** Test 1 ********************************************************
-* test native NDB() conflict resolution
+* test native NDB$MAX() conflict resolution
 * test with both allowed "conflict column" types, uint32 and uint64
 *******************************************************************
 insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$MAX(X)");
@@ -39,6 +39,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
@@ -53,6 +65,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -61,6 +85,18 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -80,8 +116,10 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check insert some data
@@ -120,8 +158,10 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check update some data that causes conflicts
@@ -153,8 +193,10 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check higer timestamp
@@ -170,7 +212,7 @@ a	b	c	d
 3	Master t2 a=3 at c=13	13	111222333
 drop table t1, t2;
 *** Test 2 ********************************************************
-* test native NDB() conflict resolution
+* test native NDB$MAX() conflict resolution
 * test with both allowed "conflict column" types, uint32 and uint64
 * test that setting binlog update option via table works equally well
 *******************************************************************
@@ -206,6 +248,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
@@ -220,6 +274,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -228,6 +294,18 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -243,12 +321,14 @@ commit;
 *** slave - check conflict info, no conflicts yet
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-3
+0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check insert some data
@@ -283,12 +363,14 @@ commit;
 *** slave - check conflict info, there should be some
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-6
+3
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check update some data that causes conflicts
@@ -316,12 +398,14 @@ commit;
 *** slave - check conflict info, change depends on calling test
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-6
+3
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check higer timestamp
@@ -365,28 +449,66 @@ commit;
 *** slave - check update all
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 X=2	2	1
-2	Master t1 X=2	2	12
-3	Master t1 X=2	2	123
+1	Master t1 a=1 at X=1	1	1
+2	Master t1 a=2 at X=1	1	12
+3	Master t1 a=3 at X=1	1	123
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+3
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	1	#	#
+2	1	#	2	#	#
+2	1	#	3	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
 *** slave - check update 2 rows in different tables
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 X=2	2	1
-2	Master t1 a=2 at X=3	3	12
-3	Master t1 X=2	2	123
+1	Master t1 a=1 at X=1	1	1
+2	Master t1 a=2 at X=1	1	12
+3	Master t1 a=3 at X=1	1	123
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+4
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	1	#	#
+2	1	#	2	#	#
+2	1	#	3	#	#
+2	1	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -395,6 +517,26 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+4
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	1	#	#
+2	1	#	2	#	#
+2	1	#	3	#	#
+2	1	#	4	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -410,12 +552,14 @@ commit;
 *** slave - check conflict info, no conflicts yet
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-6
+0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check insert some data
@@ -450,20 +594,28 @@ commit;
 *** slave - check conflict info, there should be some
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-6
+0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+3
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	1	#	#
+2	1	#	2	#	#
+2	1	#	3	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	111
+2	1	#	#	2	111222
+2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check update some data that causes conflicts
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 a=1 at X=11	11	111
-2	Master t1 a=2 at X=11	11	111222
-3	Master t1 a=3 at X=11	11	111222333
+1	Slave t1 a=1 at X=12	12	111
+2	Slave t1 a=2 at X=12	12	111222
+3	Slave t1 a=3 at X=12	12	111222333
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 a=1 at c=11	11	111
@@ -483,20 +635,34 @@ commit;
 *** slave - check conflict info, change depends on calling test
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
 VARIABLE_VALUE-@init_ndb_conflict_fn_max
-6
+0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+6
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	1	#	#
+2	1	#	2	#	#
+2	1	#	3	#	#
+2	1	#	4	#	#
+2	1	#	5	#	#
+2	1	#	6	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	111
+2	1	#	#	1	111
+2	1	#	#	2	111222
+2	1	#	#	2	111222
+2	1	#	#	3	111222333
+2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check higer timestamp
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 a=1 at X=13	13	111
-2	Master t1 a=2 at X=13	13	111222
-3	Master t1 a=3 at X=13	13	111222333
+1	Slave t1 a=1 at X=11	11	111
+2	Slave t1 a=2 at X=12	12	111222
+3	Slave t1 a=3 at X=12	12	111222333
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 a=1 at c=13	13	111

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result	2007-10-14 17:27:00 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_conflict_old.result	2009-02-16 15:54:40 +0000
@@ -5,7 +5,7 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 *** Test 1 ********************************************************
-* test native NDB() conflict resolution
+* test native NDB$OLD() conflict resolution
 * test with both allowed "conflict column" types, uint32 and uint64
 *******************************************************************
 insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$OLD(X)");
@@ -39,6 +39,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
@@ -53,6 +65,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -61,6 +85,18 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -80,8 +116,8 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 0
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
@@ -122,8 +158,8 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 3
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 2	1	#	1	#	#
 2	1	#	2	#	#
 2	1	#	3	#	#
@@ -163,8 +199,8 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
 5
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 2	1	#	1	#	#
 2	1	#	2	#	#
 2	1	#	3	#	#
@@ -192,7 +228,7 @@ a	b	c	d
 3	Master t2 a=3 at c=13	13	111222333
 drop table t1, t2;
 *** Test 2 ********************************************************
-* test native NDB() conflict resolution
+* test native NDB$OLD() conflict resolution
 * test with both allowed "conflict column" types, uint32 and uint64
 * test that setting binlog update option via table works equally well
 *******************************************************************
@@ -228,6 +264,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
@@ -242,6 +290,18 @@ a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -250,6 +310,18 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -268,21 +340,11 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-5
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
-2	1	#	#	1	111
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check insert some data
@@ -320,26 +382,16 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-8
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
+3
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-4	#	#
+2	1	#	-3	#	#
+2	1	#	-2	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	#	1	111
-2	1	#	#	1	111
 2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
@@ -371,31 +423,21 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-10
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
+5
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-4	#	#
+2	1	#	-3	#	#
+2	1	#	-2	#	#
+2	1	#	-1	#	#
+2	1	#	0	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	#	1	111
-2	1	#	#	1	111
-2	1	#	#	2	111222
-2	1	#	#	2	111222
 2	1	#	#	2	111222
 2	1	#	#	2	111222
 2	1	#	#	3	111222333
 2	1	#	#	3	111222333
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check higer timestamp
@@ -439,28 +481,66 @@ commit;
 *** slave - check update all
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 X=2	2	1
-2	Master t1 X=2	2	12
-3	Master t1 X=2	2	123
+1	Master t1 a=1 at X=1	1	1
+2	Master t1 a=2 at X=1	1	12
+3	Master t1 a=3 at X=1	1	123
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 c=2	2	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+3
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-9	#	#
+2	1	#	-8	#	#
+2	1	#	-7	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - update 2 rows in different tables
 update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
 update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
 *** slave - check update 2 rows in different tables
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 X=2	2	1
-2	Master t1 a=2 at X=3	3	12
-3	Master t1 X=2	2	123
+1	Master t1 a=1 at X=1	1	1
+2	Master t1 a=2 at X=1	1	12
+3	Master t1 a=3 at X=1	1	123
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 c=2	2	1
 2	Master t2 c=2	2	12
 3	Master t2 a=3 at c=3	3	123
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+4
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-9	#	#
+2	1	#	-8	#	#
+2	1	#	-7	#	#
+2	1	#	-6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 *** master - delete all
 delete from t1;
 delete from t2;
@@ -469,6 +549,26 @@ select * from t1 order by a, d;
 a	b	X	d
 select * from t2 order by a, d;
 a	b	c	d
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_max FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_MAX";
+VARIABLE_VALUE-@init_ndb_conflict_fn_max
+0
+SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
+VARIABLE_VALUE-@init_ndb_conflict_fn_old
+4
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-9	#	#
+2	1	#	-8	#	#
+2	1	#	-7	#	#
+2	1	#	-6	#	#
+SELECT * FROM `t1$EX` ORDER BY a, d;
+server_id	master_server_id	master_epoch	count	a	d
+2	1	#	#	1	1
+2	1	#	#	2	12
+2	1	#	#	2	12
+2	1	#	#	3	123
+SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+SELECT * FROM `t2$EX` ORDER BY a, d;
 ************************
 * start conflict testing
 ************************
@@ -487,31 +587,11 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-10
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
+0
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
-2	1	#	#	1	111
-2	1	#	#	1	111
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check insert some data
@@ -549,39 +629,25 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-10
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
+3
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-9	#	#
+2	1	#	-8	#	#
+2	1	#	-7	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	#	1	111
-2	1	#	#	1	111
-2	1	#	#	2	111222
-2	1	#	#	2	111222
 2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
 SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check update some data that causes conflicts
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 a=1 at X=11	11	111
-2	Master t1 a=2 at X=11	11	111222
-3	Master t1 a=3 at X=11	11	111222333
+1	Slave t1 a=1 at X=12	12	111
+2	Slave t1 a=2 at X=12	12	111222
+3	Slave t1 a=3 at X=12	12	111222333
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 a=1 at c=11	11	111
@@ -604,29 +670,21 @@ VARIABLE_VALUE-@init_ndb_conflict_fn_max
 0
 SELECT VARIABLE_VALUE-@init_ndb_conflict_fn_old FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_CONFLICT_FN_OLD";
 VARIABLE_VALUE-@init_ndb_conflict_fn_old
-10
-SELECT * FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
-server_id	master_server_id	master_epoch	count	a	d
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
-2	1	#	1	#	#
-2	1	#	2	#	#
-2	1	#	3	#	#
-2	1	#	4	#	#
-2	1	#	5	#	#
+6
+SELECT server_id, master_server_id, master_epoch, count-@init_ndb_conflict_fn_old, a, d FROM `t1$EX` ORDER BY server_id, master_server_id, master_epoch, count;
+server_id	master_server_id	master_epoch	count-@init_ndb_conflict_fn_old	a	d
+2	1	#	-9	#	#
+2	1	#	-8	#	#
+2	1	#	-7	#	#
+2	1	#	-6	#	#
+2	1	#	-5	#	#
+2	1	#	-4	#	#
 SELECT * FROM `t1$EX` ORDER BY a, d;
 server_id	master_server_id	master_epoch	count	a	d
 2	1	#	#	1	111
 2	1	#	#	1	111
 2	1	#	#	2	111222
 2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	2	111222
-2	1	#	#	3	111222333
-2	1	#	#	3	111222333
 2	1	#	#	3	111222333
 2	1	#	#	3	111222333
 SELECT * FROM `t2$EX` ORDER BY server_id, master_server_id, master_epoch, count;
@@ -634,9 +692,9 @@ SELECT * FROM `t2$EX` ORDER BY a, d;
 *** slave - check higer timestamp
 select * from t1 order by a, d;
 a	b	X	d
-1	Master t1 a=1 at X=13	13	111
-2	Master t1 a=2 at X=13	13	111222
-3	Master t1 a=3 at X=13	13	111222333
+1	Slave t1 a=1 at X=11	11	111
+2	Slave t1 a=2 at X=12	12	111222
+3	Slave t1 a=3 at X=12	12	111222333
 select * from t2 order by a, d;
 a	b	c	d
 1	Master t2 a=1 at c=13	13	111

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2009-02-11 11:06:33 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result	2009-03-12 10:59:57 +0000
@@ -15,10 +15,6 @@ SELECT @the_epoch:=MAX(epoch) FROM mysql
 SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
 row1	will go away	1
-SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
-@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-<the_pos>	master-bin.000001
 INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
 DELETE FROM t1 WHERE c3 = 1;
 UPDATE t1 SET c2="should go away" WHERE c3 = 2;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_logging.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_logging.result	2007-09-05 16:06:44 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_logging.result	2009-02-16 22:16:44 +0000
@@ -70,3 +70,4 @@ a	b	c
 1	updated t2.b from master	t2.c from slave
 drop table t1;
 drop table t2;
+drop table mysql.ndb_replication;

=== modified file 'mysql-test/suite/rpl_ndb/t/disabled.def'
--- a/mysql-test/suite/rpl_ndb/t/disabled.def	2009-03-03 14:24:27 +0000
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def	2009-03-12 11:06:48 +0000
@@ -10,5 +10,3 @@
 #
 ##############################################################################
 
-rpl_ndb_extraCol	 : Bug#41369 2008-12-10 alik
-rpl_ndb_circular_2ch     : Bug#42396 2009-01-28 andrei test fails auto-inc insert

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_1.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_1.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_1.inc	2009-02-16 22:16:44 +0000
@@ -0,0 +1,135 @@
+--connection slave
+--source include/ndb_conflict_info_init.inc
+
+--connection master
+
+--eval create table t1 (a int, b varchar(32), X $col_type, d varchar(9), primary key (a, d)) engine ndb
+create table t2 (a int key, b varchar(32), c int unsigned, d varchar(9)) engine ndb;
+
+--echo ************************************************
+--echo * some basic positive testing, i.e. no conflicts
+--echo ************************************************
+--connection master
+--echo *** insert some data
+begin;
+insert into t1 values (1, "Master t1 a=1 at X=1", 1, '1');
+insert into t1 values (2, "Master t1 a=2 at X=1", 1, '12');
+insert into t1 values (3, "Master t1 a=3 at X=1", 1, '123');
+insert into t2 values (1, "Master t2 a=1 at c=1", 1, '1');
+insert into t2 values (2, "Master t2 a=2 at c=1", 1, '12');
+insert into t2 values (3, "Master t2 a=3 at c=1", 1, '123');
+commit;
+
+--echo *** master - update all
+--connection master
+begin;
+update t1 set b="Master t1 X=2", X=X+1;
+update t2 set b="Master t2 c=2", c=c+1;
+commit;
+--echo *** slave - check update all
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+--source include/ndb_conflict_info.inc
+
+--echo *** master - update 2 rows in different tables
+--connection master
+update t1 set b="Master t1 a=2 at X=3", X=X+1 where a=2;
+update t2 set b="Master t2 a=3 at c=3", c=c+1 where a=3;
+--echo *** slave - check update 2 rows in different tables
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+--source include/ndb_conflict_info.inc
+
+--echo *** master - delete all
+--connection master
+delete from t1;
+delete from t2;
+--echo *** slave - check delete all
+--sync_slave_with_master
+--connection slave
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+--source include/ndb_conflict_info.inc
+--source include/ndb_conflict_info_init.inc
+
+--echo ************************
+--echo * start conflict testing
+--echo ************************
+--echo *** master - insert some data
+--connection master
+begin;
+insert into t1 values (1, "Master t1 a=1 at X=10", 10, '111');
+insert into t1 values (2, "Master t1 a=2 at X=10", 10, '111222');
+insert into t1 values (3, "Master t1 a=3 at X=10", 10, '111222333');
+insert into t2 values (1, "Master t2 a=1 at c=10", 10, '111');
+insert into t2 values (2, "Master t2 a=2 at c=10", 10, '111222');
+insert into t2 values (3, "Master t2 a=3 at c=10", 10, '111222333');
+commit;
+
+--echo *** slave - check conflict info, no conflicts yet
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+
+--echo *** slave - check insert some data
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+
+--echo *** slave - update some data to cause conflicts
+begin;
+update t1 set b="Slave t1 a=1 at X=12", X=12 where a=1 and d='111';
+update t1 set b="Slave t1 a=2 at X=12", X=12 where a=2 and d='111222';
+update t1 set b="Slave t1 a=3 at X=12", X=12 where a=3 and d='111222333';
+update t2 set b="Slave t2 a=1 at c=12", c=12 where a=1;
+update t2 set b="Slave t2 a=2 at c=12", c=12 where a=2;
+update t2 set b="Slave t2 a=3 at c=12", c=12 where a=3;
+commit;
+
+--echo *** master - update some data to cause conflicts
+--connection master
+begin;
+update t1 set b="Master t1 a=1 at X=11", X=11 where a=1 and d='111';
+update t1 set b="Master t1 a=2 at X=11", X=11 where a=2 and d='111222';
+update t1 set b="Master t1 a=3 at X=11", X=11 where a=3 and d='111222333';
+update t2 set b="Master t2 a=1 at c=11", c=11 where a=1;
+update t2 set b="Master t2 a=2 at c=11", c=11 where a=2;
+update t2 set b="Master t2 a=3 at c=11", c=11 where a=3;
+commit;
+
+--echo *** slave - check conflict info, there should be some
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+
+--echo *** slave - check update some data that causes conflicts
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+--echo *** slave - correct some data to correspond to the master
+update t1 set b="Slave t1 a=1 at X=11", X=11 where a=1 and d='111';
+
+--echo *** master - update some data, use higher timestamp
+--connection master
+begin;
+update t1 set b="Master t1 a=1 at X=13", X=13 where a=1 and d='111';
+update t1 set b="Master t1 a=2 at X=13", X=13 where a=2 and d='111222';
+update t1 set b="Master t1 a=3 at X=13", X=13 where a=3 and d='111222333';
+update t2 set b="Master t2 a=1 at c=13", c=13 where a=1;
+update t2 set b="Master t2 a=2 at c=13", c=13 where a=2;
+update t2 set b="Master t2 a=3 at c=13", c=13 where a=3;
+commit;
+
+--echo *** slave - check conflict info, change depends on calling test
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+
+--echo *** slave - check higer timestamp
+select * from t1 order by a, d;
+select * from t2 order by a, d;
+
+--connection master
+drop table t1, t2;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_d.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_d.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_d.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,20 @@
+--echo ***
+--echo *** conflicting timestamps on delete-delete
+--echo ***
+
+--echo *** slave - cause conflict
+--connection slave
+--source include/ndb_conflict_info_init.inc
+update t1 set b="slave  X=3", X=3 where a=1;
+delete from t1 where a=1;
+
+--echo *** master - cause conflict
+--connection master
+delete from t1 where a=1;
+delete from t1 where a=2;
+
+--echo *** slave - check data
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+select * from t1 order by a;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_u.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_u.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_d_u.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,19 @@
+--echo ***
+--echo *** conflicting timestamps on delete-update
+--echo ***
+
+--echo *** slave - cause conflict
+--connection slave
+--source include/ndb_conflict_info_init.inc
+update t1 set b="slave  X=3", X=3 where a=1;
+
+--echo *** master - cause conflict
+--connection master
+delete from t1 where a=1;
+delete from t1 where a=2;
+
+--echo *** slave - check data
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+select * from t1 order by a;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_i_i.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_i_i.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_i_i.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,22 @@
+--echo ***
+--echo *** conflicting timestamps on insert
+--echo ***
+
+--connection master
+delete from t1 where a=1;
+--sync_slave_with_master
+
+--echo *** slave - cause conflict
+--connection slave
+--source include/ndb_conflict_info_init.inc
+insert into t1 values(1, "slave  X=3", 3, "1");
+
+--echo *** master - cause conflict
+--connection master
+insert into t1 values(1, "master X=2", 2, "1");
+
+--echo *** slave - check data
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+select * from t1 order by a;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_init.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_init.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_init.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,28 @@
+--echo *** reset and init
+--disable_query_log
+--disable_result_log
+--connection slave
+stop slave;
+delete from t1;
+--error 0,1146
+delete from `test`.`t1$EX`;
+
+--connection master
+delete from t1;
+reset master;
+
+--connection slave
+reset slave;
+start slave;
+--source include/ndb_conflict_info_init.inc
+--disable_query_log
+--disable_result_log
+
+--connection master
+insert into t1 values (1, "master X=1", 1, "1");
+insert into t1 values (2, "master X=1", 1, "2");
+insert into t1 values (3, "master X=1", 1, "3");
+
+--sync_slave_with_master
+--enable_query_log
+--enable_result_log

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test	2007-10-14 17:27:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_max.test	2009-02-24 13:12:02 +0000
@@ -20,20 +20,28 @@ CREATE TABLE mysql.ndb_replication
   ENGINE=NDB PARTITION BY KEY(db,table_name);
 drop table if exists `test`.`t1$EX`;
 drop table if exists `test`.`t2$EX`;
+create table `test`.`t1$EX`
+  (server_id int unsigned,
+   master_server_id int unsigned,
+   master_epoch bigint unsigned,
+   count int unsigned,
+   a int not null,
+   d varchar(9) not null,
+   primary key(server_id, master_server_id, master_epoch, count)) engine ndb;
 --enable_warnings
 --enable_query_log
 
 --echo *** Test 1 ********************************************************
---echo * test native NDB$MAX() conflict resolution
+--echo * test native NDB\$MAX() conflict resolution
 --echo * test with both allowed "conflict column" types, uint32 and uint64
 --echo *******************************************************************
 --connection master
 insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$MAX(X)");
 --let col_type = int unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** Test 2 ********************************************************
---echo * test native NDB$MAX() conflict resolution
+--echo * test native NDB\$MAX() conflict resolution
 --echo * test with both allowed "conflict column" types, uint32 and uint64
 --echo * test that setting binlog update option via table works equally well
 --echo *******************************************************************
@@ -41,7 +49,7 @@ insert into mysql.ndb_replication values
 set global ndb_log_update_as_write=1;
 update mysql.ndb_replication set binlog_type=4;
 --let col_type = bigint unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** Test 3 ***********************************************************
 --echo * test that setting binlog type really also sets the "USE_UPDATE" flag
@@ -52,13 +60,12 @@ update mysql.ndb_replication set binlog_
 set global ndb_log_update_as_write=0;
 update mysql.ndb_replication set binlog_type=2;
 --let col_type = int unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** test cleanup
 --disable_query_log
---connection slave
-stop slave;
-drop table mysql.ndb_replication;
 --connection master
 drop table mysql.ndb_replication;
+drop table `test`.`t1$EX`;
+--sync_slave_with_master
 --enable_query_log

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test	2007-10-14 17:27:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_old.test	2009-02-24 13:12:02 +0000
@@ -32,16 +32,16 @@ create table `test`.`t1$EX`
 --enable_query_log
 
 --echo *** Test 1 ********************************************************
---echo * test native NDB$OLD() conflict resolution
+--echo * test native NDB\$OLD() conflict resolution
 --echo * test with both allowed "conflict column" types, uint32 and uint64
 --echo *******************************************************************
 --connection master
 insert into mysql.ndb_replication values ("test", "t1", 0, NULL, "NDB$OLD(X)");
 --let col_type = int unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** Test 2 ********************************************************
---echo * test native NDB$OLD() conflict resolution
+--echo * test native NDB\$OLD() conflict resolution
 --echo * test with both allowed "conflict column" types, uint32 and uint64
 --echo * test that setting binlog update option via table works equally well
 --echo *******************************************************************
@@ -49,7 +49,7 @@ insert into mysql.ndb_replication values
 set global ndb_log_update_as_write=1;
 update mysql.ndb_replication set binlog_type=4;
 --let col_type = bigint unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** Test 3 ***********************************************************
 --echo * test that setting binlog type really also sets the "USE_UPDATE" flag
@@ -60,15 +60,12 @@ update mysql.ndb_replication set binlog_
 set global ndb_log_update_as_write=0;
 update mysql.ndb_replication set binlog_type=2;
 --let col_type = int unsigned
---source extra/rpl_tests/rpl_ndb_conflict_1.test
+--source suite/rpl_ndb/t/rpl_ndb_conflict_1.inc
 
 --echo *** test cleanup
 --disable_query_log
---connection slave
-stop slave;
-drop table mysql.ndb_replication;
-drop table `test`.`t1$EX`;
 --connection master
 drop table mysql.ndb_replication;
 drop table `test`.`t1$EX`;
+--sync_slave_with_master
 --enable_query_log

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_d.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_d.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_d.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,19 @@
+--echo ***
+--echo *** conflicting timestamps on update-delete
+--echo ***
+
+--echo *** slave - cause conflict
+--connection slave
+--source include/ndb_conflict_info_init.inc
+delete from t1 where a=1;
+
+--echo *** master - cause conflict
+--connection master
+update t1 set b="master X=2", X=2 where a=1;
+update t1 set b="master X=2", X=2 where a=2;
+
+--echo *** slave - check data
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+select * from t1 order by a;

=== added file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_u.inc'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_u.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_conflict_u_u.inc	2009-02-16 15:54:40 +0000
@@ -0,0 +1,19 @@
+--echo ***
+--echo *** conflicting timestamps on update
+--echo ***
+
+--echo *** slave - cause conflict
+--connection slave
+--source include/ndb_conflict_info_init.inc
+update t1 set b="slave  X=3", X=3 where a=1;
+
+--echo *** master - cause conflict
+--connection master
+update t1 set b="master X=2", X=2 where a=1;
+update t1 set b="master X=2", X=2 where a=2;
+
+--echo *** slave - check data
+--sync_slave_with_master
+--connection slave
+--source include/ndb_conflict_info.inc
+select * from t1 order by a;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2007-07-25 13:40:43 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test	2009-02-09 11:40:31 +0000
@@ -21,12 +21,16 @@ SELECT * FROM t1 ORDER BY c3;
 
 # get the master binlog pos from the epoch
 connection master;
---replace_result $the_epoch <the_epoch>
---replace_column 1 <the_pos>
-eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+--disable_query_log
+--disable_result_log
+eval SELECT @the_pos:=Position,
+   @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
    FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
 let $the_pos= `SELECT @the_pos` ;
 let $the_file= `SELECT @the_file` ;
+let $the_epoch=`SELECT MAX(epoch) FROM mysql.ndb_apply_status`;
+--enable_result_log
+--enable_query_log
 
 # insert some more values
 INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_logging.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_logging.test	2008-08-12 15:04:32 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_logging.test	2009-02-16 22:16:44 +0000
@@ -2,7 +2,7 @@
 # Test engine logging options for ndb
 #
 --source include/have_ndb.inc
---source include/have_binlog_format_row.inc
+--source include/have_binlog_format_mixed_or_row.inc
 --source include/ndb_master-slave.inc
 
 --disable_warnings
@@ -134,3 +134,4 @@ select * from t2;
 --connection master
 drop table t1;
 drop table t2;
+drop table mysql.ndb_replication;

=== renamed file 'mysql-test/suite/rpl_ndb_big/r/rpl_ndb_mixed_engines_transactions.result' => 'mysql-test/suite/rpl_ndb_big/r/rpl_ndb_mix_eng_trans.result'
=== modified file 'mysql-test/suite/rpl_ndb_big/r/rpl_ndb_multi.result'
--- a/mysql-test/suite/rpl_ndb_big/r/rpl_ndb_multi.result	2009-02-05 12:22:39 +0000
+++ b/mysql-test/suite/rpl_ndb_big/r/rpl_ndb_multi.result	2009-03-12 10:59:57 +0000
@@ -23,9 +23,7 @@ SELECT * FROM t1 ORDER BY c3;
 c1	c2	c3
 row1	will go away	1
 stop slave;
-SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
-@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+@the_pos:=Position	@the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1)
 107	master-bin.000001
 CHANGE MASTER TO
 master_port=<MASTER_PORT1>,

=== modified file 'mysql-test/suite/rpl_ndb_big/r/rpl_ndb_sync.result'
--- a/mysql-test/suite/rpl_ndb_big/r/rpl_ndb_sync.result	2009-02-11 12:11:18 +0000
+++ b/mysql-test/suite/rpl_ndb_big/r/rpl_ndb_sync.result	2009-03-12 10:59:57 +0000
@@ -59,9 +59,7 @@ hex(c2)	hex(c3)	c1
 SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
 @the_epoch:=MAX(epoch)
 <the_epoch>
-SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-FROM mysql.ndb_binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
-@the_pos:=Position	@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+@the_pos:=Position	@the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1)
 <the_pos>	master-bin.000001
 CHANGE MASTER TO
 master_log_file = 'master-bin.000001',

=== renamed file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions-master.opt' => 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans-master.opt'
=== renamed file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions-slave.opt' => 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans-slave.opt'
=== renamed file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mixed_engines_transactions.test' => 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_mix_eng_trans.test'
=== modified file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndb_multi.test'
--- a/mysql-test/suite/rpl_ndb_big/t/rpl_ndb_multi.test	2008-11-13 19:40:36 +0000
+++ b/mysql-test/suite/rpl_ndb_big/t/rpl_ndb_multi.test	2009-03-12 10:59:57 +0000
@@ -32,8 +32,11 @@ stop slave;
 # get the master binlog pos from the epoch, from the _other_ "master", server2
 connection server2;
 --replace_result $the_epoch <the_epoch>
-eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
+--disable_query_log
+eval SELECT @the_pos:=Position,
+   @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1)
    FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
+--enable_query_log
 let $the_pos= `SELECT @the_pos` ;
 let $the_file= `SELECT @the_file` ;
 

=== modified file 'mysql-test/suite/rpl_ndb_big/t/rpl_ndbapi_multi.test'
--- a/mysql-test/suite/rpl_ndb_big/t/rpl_ndbapi_multi.test	2008-10-29 08:45:14 +0000
+++ b/mysql-test/suite/rpl_ndb_big/t/rpl_ndbapi_multi.test	2009-03-12 11:06:48 +0000
@@ -2,6 +2,7 @@
 -- source include/have_binlog_format_mixed_or_row.inc
 -- source include/have_ndbapi_examples.inc
 -- source include/ndb_master-slave.inc
+--let MASTER_MYSOCK=`select @@socket`;
 
 --exec echo Running ndbapi_simple_dual
 --exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT

=== modified file 'mysql-test/t/warnings.test'
--- a/mysql-test/t/warnings.test	2009-02-05 10:05:23 +0000
+++ b/mysql-test/t/warnings.test	2009-03-12 11:06:48 +0000
@@ -50,7 +50,8 @@ drop table t1;
 #
 
 create table t1(a tinyint, b int not null, c date, d char(5));
-load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
+--replace_result $MYSQLTEST_VARDIR ../..
+--eval load data infile '$MYSQLTEST_VARDIR/std_data/warnings_loaddata.dat' into table t1 fields terminated by ','
 # PS doesn't work good with @@warning_count
 --disable_ps_protocol
 select @@warning_count;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-03-12 09:54:58 +0000
+++ b/sql/ha_ndbcluster.cc	2009-03-12 11:06:48 +0000
@@ -388,18 +388,33 @@ check_completed_operations_pre_commit(Th
   while (first)
   {
     const NdbError &err= first->getNdbError();
-    if (err.classification != NdbError::NoError &&
-        err.classification != NdbError::ConstraintViolation &&
-        err.classification != NdbError::NoDataFound)
+    if (err.classification != NdbError::NoError
+#ifndef HAVE_NDB_BINLOG
+        && err.classification != NdbError::ConstraintViolation
+        && err.classification != NdbError::NoDataFound
+#endif
+        )
     {
 #ifdef HAVE_NDB_BINLOG
       DBUG_PRINT("info", ("ndb error: %d", err.code));
       if (err.code == (int) error_conflict_fn_max_violation)
       {
+        DBUG_PRINT("info", ("err.code == (int) error_conflict_fn_max_violation"));
         thd_ndb->m_max_violation_count++;
       }
-      else if (err.code == (int) error_conflict_fn_old_violation)
-      {
+      else if (err.code == (int) error_conflict_fn_old_violation ||
+               err.classification == NdbError::ConstraintViolation ||
+               err.classification == NdbError::NoDataFound)
+      {
+        DBUG_PRINT("info",
+                   ("err.code %s (int) error_conflict_fn_old_violation, "
+                    "err.classification %s",
+                    err.code == (int) error_conflict_fn_old_violation ? "==" : "!=",
+                    err.classification
+                    == NdbError::ConstraintViolation
+                    ? "== NdbError::ConstraintViolation"
+                    : (err.classification == NdbError::NoDataFound
+                       ? "== NdbError::NoDataFound" : "!=")));
         thd_ndb->m_old_violation_count++;
         const void* buffer= first->getCustomData();
         if (buffer != NULL)
@@ -459,7 +474,10 @@ check_completed_operations_pre_commit(Th
       }
       else
 #endif
+      {
+        DBUG_PRINT("info", ("err.code == %u", err.code));
         DBUG_RETURN(err.code);
+      }
     }
     if (err.classification != NdbError::NoError)
       ignores++;
@@ -2763,6 +2781,7 @@ ha_ndbcluster::pk_unique_index_read_key(
 
   if (ppartition_id != NULL)
   {
+    assert(m_user_defined_partitioning);
     options.optionsPresent|= NdbOperation::OperationOptions::OO_PARTITION_ID;
     options.partitionId= *ppartition_id;
     poptions= &options;
@@ -2924,9 +2943,11 @@ int ha_ndbcluster::ordered_index_scan(co
   }
 
   /* Partition pruning */
-  if (m_use_partition_pruning && part_spec != NULL &&
+  if (m_use_partition_pruning && 
+      m_user_defined_partitioning && part_spec != NULL &&
       part_spec->start_part == part_spec->end_part)
   {
+    /* Explicitly set partition id when pruning User-defined partitioned scan */
     options.partitionId = part_spec->start_part;
     options.optionsPresent |= NdbScanOperation::ScanOptions::SO_PARTITION_ID;
   }
@@ -2941,6 +2962,8 @@ int ha_ndbcluster::ordered_index_scan(co
                              sizeof(NdbScanOperation::ScanOptions))))
     ERR_RETURN(trans->getNdbError());
 
+  DBUG_PRINT("info", ("Is scan pruned to 1 partition? : %u", op->getPruned()));
+
   if (uses_blob_value(table->read_set) &&
       get_blob_values(op, NULL, table->read_set) != 0)
     ERR_RETURN(op->getNdbError());
@@ -2996,7 +3019,7 @@ int ha_ndbcluster::full_table_scan(const
   DBUG_ENTER("full_table_scan");  
   DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname));
 
-  if (m_use_partition_pruning)
+  if (m_use_partition_pruning && m_user_defined_partitioning)
   {
     part_spec.start_part= 0;
     part_spec.end_part= m_part_info->get_tot_partitions() - 1;
@@ -3018,6 +3041,13 @@ int ha_ndbcluster::full_table_scan(const
        * Only one partition is required to scan, if sorted is required
        * don't need it anymore since output from one ordered partitioned
        * index is always sorted.
+       *
+       * Note : This table scan pruning currently only occurs for 
+       * UserDefined partitioned tables.
+       * It could be extended to occur for natively partitioned tables if
+       * the Partitioning layer can make a key (e.g. start or end key)
+       * available so that we can determine the correct pruning in the 
+       * NDBAPI layer.
        */
       use_set_part_id= TRUE;
       if (!trans)
@@ -3039,6 +3069,7 @@ int ha_ndbcluster::full_table_scan(const
   options.parallel = parallelism;
 
   if (use_set_part_id) {
+    assert(m_user_defined_partitioning);
     options.optionsPresent|= NdbScanOperation::ScanOptions::SO_PARTITION_ID;
     options.partitionId = part_spec.start_part;
   };
@@ -3337,6 +3368,7 @@ int ha_ndbcluster::ndb_write_row(uchar *
   options.optionsPresent=0;
   
   eventSetAnyValue(thd, &options); 
+  bool need_flush= add_row_check_if_batch_full(thd_ndb);
 
   if (m_user_defined_partitioning)
   {
@@ -3368,8 +3400,17 @@ int ha_ndbcluster::ndb_write_row(uchar *
     This means that we now suffer from BUG#22045... :-/
   */
   const MY_BITMAP *user_cols_written_bitmap;
+#ifdef HAVE_NDB_BINLOG
+  uchar* ex_data_buffer= NULL;
+#endif
   
-  if (m_use_write)
+  if (m_use_write
+#ifdef HAVE_NDB_BINLOG
+      && !(thd->slave_thread &&
+           m_share->m_cfn_share &&
+           m_share->m_cfn_share->m_resolve_cft != CFT_NDB_UNDEF)
+#endif
+      )
   {
     uchar *mask;
 
@@ -3387,10 +3428,52 @@ int ha_ndbcluster::ndb_write_row(uchar *
         SQL thread -> use the write_set for writeTuple().
         otherwise (REPLACE INTO) -> do not use write_set.
     */
+
+#if 0 /* NOT YET, interpeted function not supported for write */
+    /*
+      Room for 10 instruction words, two labels (@ 2words/label)
+      + 2 extra words for the case of resolve_size == 8
+    */
+    Uint32 buffer[16];
+    NdbInterpretedCode code(m_table, buffer,
+                            sizeof(buffer)/sizeof(buffer[0]));
+#endif
     if (thd->slave_thread)
     {
       user_cols_written_bitmap= table->write_set;
       mask= (uchar *)(user_cols_written_bitmap->bitmap);
+#if 0 /* NOT YET, interpeted function not supported for write */
+      /* Conflict resolution in slave thread. */
+      enum_conflict_fn_type cft= m_share->m_cfn_share ? m_share->m_cfn_share->m_resolve_cft : CFT_NDB_UNDEF;
+      if (cft != CFT_NDB_UNDEF)
+      {
+        if (!write_row_conflict_fn(cft, record, &code))
+        {
+          options.optionsPresent|=NdbOperation::OperationOptions::OO_INTERPRETED;
+          options.interpretedCode= &code;
+          thd_ndb->m_conflict_fn_usage_count++;
+        }
+
+        Ndb_exceptions_data ex_data;
+        ex_data.share= m_share;
+        /*
+          We need to save the row data for possible conflict resolution after
+          execute().
+        */
+        ex_data.row= copy_row_to_buffer(thd_ndb, record);
+        ex_data_buffer= get_buffer(thd_ndb, sizeof(ex_data));
+        if (ex_data.row == NULL || ex_data_buffer == NULL)
+        {
+          DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+        }
+        memcpy(ex_data_buffer, &ex_data, sizeof(ex_data));
+
+        options.optionsPresent|= NdbOperation::OperationOptions::OO_CUSTOMDATA;
+        options.customData= (void*)ex_data_buffer;
+        if (options.optionsPresent != 0)
+          poptions=&options;
+      }
+#endif
     }
     else
 #endif
@@ -3398,13 +3481,36 @@ int ha_ndbcluster::ndb_write_row(uchar *
       user_cols_written_bitmap= NULL;
       mask= NULL;
     }
-
     op= trans->writeTuple(key_rec, (const char *)key_row, m_ndb_record,
                           (char *)record, mask,
                           poptions, sizeof(NdbOperation::OperationOptions));
   }
   else
   {
+#ifdef HAVE_NDB_BINLOG
+    if (m_use_write)
+    {
+      thd_ndb->m_conflict_fn_usage_count++;
+
+      Ndb_exceptions_data ex_data;
+      ex_data.share= m_share;
+      /*
+        We need to save the row data for possible conflict resolution after
+        execute().
+      */
+      ex_data.row= copy_row_to_buffer(thd_ndb, record);
+      ex_data_buffer= get_buffer(thd_ndb, sizeof(ex_data));
+      if (ex_data.row == NULL || ex_data_buffer == NULL)
+      {
+        DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+      }
+      memcpy(ex_data_buffer, &ex_data, sizeof(ex_data));
+
+      options.optionsPresent|= NdbOperation::OperationOptions::OO_CUSTOMDATA;
+      options.customData= (void*)ex_data_buffer;
+      poptions=&options;
+    }
+#endif
     /* Using insert, we write all user visible columns */
     user_cols_written_bitmap= NULL;
     op= trans->insertTuple(key_rec, (const char *)key_row, m_ndb_record,
@@ -3414,7 +3520,6 @@ int ha_ndbcluster::ndb_write_row(uchar *
   if (!(op))
     ERR_RETURN(trans->getNdbError());
 
-  bool need_flush= add_row_check_if_batch_full(thd_ndb);
   bool do_batch= !need_flush &&
     (batched_update || (thd->options & OPTION_ALLOW_BATCH));
   uint blob_count= 0;
@@ -3496,23 +3601,6 @@ int ha_ndbcluster::primary_key_cmp(const
         return 1;
     }
   }
-
-  /*
-    potentially not needed call to this function
-  */
-#if MYSQL_VERSION_ID > 60010
-  /*
-    int 
-    Update_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
-
-    In 5.1 it used to clear the primary key bits for the slave applier. In 6.0 this changed
-    in order to fix something in Falcon, which results in this assert to trigger as
-    primary_key_cmp did not used to be called in the 5.1 code for the slave applier.
-    Disabling check for now until it has been decided how to proceed.  Assert will trigger
-    again in 6.0.11
-  */
-  DBUG_ASSERT(!table->in_use->slave_thread || (m_ignore_no_key == FALSE));
-#endif
   return 0;
 }
 
@@ -3530,9 +3618,8 @@ int ha_ndbcluster::primary_key_cmp(const
 */
 
 int
-ha_ndbcluster::update_row_conflict_fn_max(const uchar *old_data,
-                                          uchar *new_data,
-                                          NdbInterpretedCode *code)
+ha_ndbcluster::row_conflict_fn_max(const uchar *new_data,
+                                   NdbInterpretedCode *code)
 {
   uint32 resolve_column= m_share->m_cfn_share->m_resolve_column;
   uint32 resolve_size= m_share->m_cfn_share->m_resolve_size;
@@ -3545,7 +3632,7 @@ ha_ndbcluster::update_row_conflict_fn_ma
   if (!bitmap_is_set(table->write_set, resolve_column))
   {
     sql_print_information("NDB Slave: missing data for NDB_MAX");
-    return 0;
+    return 1;
   }
 
   const uint label_0= 0;
@@ -3616,9 +3703,8 @@ ha_ndbcluster::update_row_conflict_fn_ma
 */
 
 int
-ha_ndbcluster::update_row_conflict_fn_old(const uchar *old_data,
-                                          uchar *new_data,
-                                          NdbInterpretedCode *code)
+ha_ndbcluster::row_conflict_fn_old(const uchar *old_data,
+                                   NdbInterpretedCode *code)
 {
   uint32 resolve_column= m_share->m_cfn_share->m_resolve_column;
   uint32 resolve_size= m_share->m_cfn_share->m_resolve_size;
@@ -3631,7 +3717,7 @@ ha_ndbcluster::update_row_conflict_fn_ol
   if (!bitmap_is_set(table->write_set, resolve_column))
   {
     sql_print_information("NDB Slave: missing data for NDB_OLD");
-    return 0;
+    return -1;
   }
 
   const uint label_0= 0;
@@ -3696,13 +3782,58 @@ ha_ndbcluster::update_row_conflict_fn(en
   DBUG_ASSERT(cft == CFT_NDB_MAX || cft == CFT_NDB_OLD);
   switch (cft) {
   case CFT_NDB_MAX:
-    return update_row_conflict_fn_max(old_data, new_data, code);
+    return row_conflict_fn_max(new_data, code);
   case CFT_NDB_OLD:
-    return update_row_conflict_fn_old(old_data, new_data, code);
+    return row_conflict_fn_old(old_data, code);
   case CFT_NDB_UNDEF:
     abort();
   }
-  return 0;
+  return 1;
+}
+
+#if 0 /* NOT YET, interpeted function not supported for write */
+int
+ha_ndbcluster::write_row_conflict_fn(enum_conflict_fn_type cft,
+                                     uchar *data,
+                                     NdbInterpretedCode *code)
+{
+  DBUG_ASSERT(cft == CFT_NDB_MAX || cft == CFT_NDB_OLD);
+  switch (cft) {
+  case CFT_NDB_MAX:
+    return row_conflict_fn_max(data, code);
+  case CFT_NDB_OLD:
+    /*
+      No conflict function here, instead detect if tuple
+      already exists
+     */
+    return 1;
+  case CFT_NDB_UNDEF:
+    abort();
+  }
+  return 1;
+}
+#endif
+
+int
+ha_ndbcluster::delete_row_conflict_fn(enum_conflict_fn_type cft,
+                                      const uchar *old_data,
+                                      NdbInterpretedCode *code)
+{
+  DBUG_ASSERT(cft == CFT_NDB_MAX || cft == CFT_NDB_OLD);
+  switch (cft) {
+  case CFT_NDB_MAX:
+    /*
+      As we do not have a timestamp for the actual delete,
+      the best we can do is to detect a possible conflict
+      on the old data.
+    */
+    return row_conflict_fn_old(old_data, code);
+  case CFT_NDB_OLD:
+    return row_conflict_fn_old(old_data, code);
+  case CFT_NDB_UNDEF:
+    abort();
+  }
+  return 1;
 }
 #endif /* HAVE_NDB_BINLOG */
 
@@ -3966,28 +4097,24 @@ int ha_ndbcluster::ndb_update_row(const 
 
 #ifdef HAVE_NDB_BINLOG
     uchar* ex_data_buffer= NULL;
+    /*
+      Room for 10 instruction words, two labels (@ 2words/label)
+      + 2 extra words for the case of resolve_size == 8
+    */
+    Uint32 buffer[16];
+    NdbInterpretedCode code(m_table, buffer,
+                            sizeof(buffer)/sizeof(buffer[0]));
     if (thd->slave_thread && m_share->m_cfn_share &&
         (m_share->m_cfn_share->m_resolve_cft != CFT_NDB_UNDEF))
     {
       /* Conflict resolution in slave thread. */
-
-      /*
-        Room for 10 instruction words, two labels (@ 2words/label)
-        + 2 extra words for the case of resolve_size == 8
-      */
-      Uint32 buffer[16];
-      NdbInterpretedCode code(m_table, buffer,
-                              sizeof(buffer)/sizeof(buffer[0]));
       enum_conflict_fn_type cft= m_share->m_cfn_share->m_resolve_cft;
-      if (update_row_conflict_fn(cft, old_data, new_data, &code))
+      if (!update_row_conflict_fn(cft, old_data, new_data, &code))
       {
-        /* ToDo error handling */
-        abort();
+        options.optionsPresent|=NdbOperation::OperationOptions::OO_INTERPRETED;
+        options.interpretedCode= &code;
+        thd_ndb->m_conflict_fn_usage_count++;
       }
-      options.optionsPresent|=NdbOperation::OperationOptions::OO_INTERPRETED;
-      options.interpretedCode= &code;
-
-      thd_ndb->m_conflict_fn_usage_count++;
 
       Ndb_exceptions_data ex_data;
       ex_data.share= m_share;
@@ -4151,6 +4278,12 @@ int ha_ndbcluster::ndb_delete_row(const 
 
   eventSetAnyValue(thd, &options);
 
+  /*
+    Poor approx. let delete ~ tabsize / 4
+  */
+  uint delete_size= 12 + (m_bytes_per_write >> 2);
+  bool need_flush= add_row_check_if_batch_full_size(thd_ndb, delete_size);
+
   if (cursor)
   {
     if (options.optionsPresent != 0)
@@ -4193,11 +4326,51 @@ int ha_ndbcluster::ndb_delete_row(const 
       options.partitionId= part_id;
     }
 
+    setup_key_ref_for_ndb_record(&key_rec, &key_row, record,
+				 m_read_before_write_removal_used);
+
+#ifdef HAVE_NDB_BINLOG
+    uchar* ex_data_buffer= NULL;
+    /*
+      Room for 10 instruction words, two labels (@ 2words/label)
+      + 2 extra words for the case of resolve_size == 8
+    */
+    Uint32 buffer[16];
+    NdbInterpretedCode code(m_table, buffer,
+                            sizeof(buffer)/sizeof(buffer[0]));
+    if (thd->slave_thread && m_share->m_cfn_share &&
+        (m_share->m_cfn_share->m_resolve_cft != CFT_NDB_UNDEF))
+    {
+      /* Conflict resolution in slave thread. */
+      enum_conflict_fn_type cft= m_share->m_cfn_share->m_resolve_cft;
+      if (!delete_row_conflict_fn(cft, record, &code))
+      {
+        options.optionsPresent|=NdbOperation::OperationOptions::OO_INTERPRETED;
+        options.interpretedCode= &code;
+        thd_ndb->m_conflict_fn_usage_count++;
+      }
+
+      Ndb_exceptions_data ex_data;
+      ex_data.share= m_share;
+      /*
+        We need to save the row data for possible conflict resolution after
+        execute().
+      */
+      ex_data.row= copy_row_to_buffer(thd_ndb, record);
+      ex_data_buffer= get_buffer(thd_ndb, sizeof(ex_data));
+      if (ex_data.row == NULL || ex_data_buffer == NULL)
+      {
+        DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+      }
+      memcpy(ex_data_buffer, &ex_data, sizeof(ex_data));
+
+      options.optionsPresent|= NdbOperation::OperationOptions::OO_CUSTOMDATA;
+      options.customData= (void*)ex_data_buffer;
+    }
+#endif /* HAVE_NDB_BINLOG */
     if (options.optionsPresent != 0)
       poptions= &options;
 
-    setup_key_ref_for_ndb_record(&key_rec, &key_row, record,
-				 m_read_before_write_removal_used);
     if (!(op=trans->deleteTuple(key_rec, (const char *)key_row,
                                 m_ndb_record,
                                 NULL, // row
@@ -4229,11 +4402,6 @@ int ha_ndbcluster::ndb_delete_row(const 
           been aborted.
     */
 
-    /*
-      Poor approx. let delete ~ tabsize / 4
-    */
-    uint delete_size= 12 + (m_bytes_per_write >> 2);
-    bool need_flush= add_row_check_if_batch_full_size(thd_ndb, delete_size);
     if ( allow_batch &&
 	 table_share->primary_key != MAX_KEY &&
 	 !primary_key_update &&
@@ -6552,7 +6720,6 @@ int ha_ndbcluster::create(const char *na
           strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0))
     {
       DBUG_PRINT("info", ("Schema distribution table not setup"));
-      DBUG_ASSERT(ndb_schema_share);
       DBUG_RETURN(HA_ERR_NO_CONNECTION);
     }
     single_user_mode = NdbDictionary::Table::SingleUserModeReadWrite;
@@ -7490,7 +7657,6 @@ ha_ndbcluster::delete_table(THD *thd, ha
   if (!ndb_schema_share)
   {
     DBUG_PRINT("info", ("Schema distribution table not setup"));
-    DBUG_ASSERT(ndb_schema_share);
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
   /* ndb_share reference temporary */
@@ -11169,6 +11335,25 @@ int ha_ndbcluster::multi_range_start_ret
         m_next_row= 0;
       }
 
+      Ndb::PartitionSpec ndbPartitionSpec;
+      const Ndb::PartitionSpec* ndbPartSpecPtr= NULL;
+
+      /* If this table uses user-defined partitioning, use MySQLD provided
+       * partition info as pruning info
+       * Otherwise, scan range pruning is performed automatically by
+       * NDBAPI based on distribution key values.
+       */
+      if (m_use_partition_pruning && 
+          m_user_defined_partitioning &&
+          (part_spec.start_part == part_spec.end_part))
+      {
+        DBUG_PRINT("info", ("Range on user-def-partitioned table can be pruned to part %u",
+                            part_spec.start_part));
+        ndbPartitionSpec.type= Ndb::PartitionSpec::PS_USER_DEFINED;
+        ndbPartitionSpec.UserDefined.partitionId= part_spec.start_part;
+        ndbPartSpecPtr= &ndbPartitionSpec;
+      }
+
       /* Include this range in the ordered index scan. */
       NdbIndexScanOperation::IndexBound bound;
       compute_index_bounds(bound, key_info,
@@ -11176,7 +11361,9 @@ int ha_ndbcluster::multi_range_start_ret
       bound.range_no= range_no;
 
       if (m_multi_cursor->setBound(m_index[active_index].ndb_record_key,
-                                   bound))
+                                   bound,
+                                   ndbPartSpecPtr, // Only for user-def tables
+                                   sizeof(Ndb::PartitionSpec)))
       {
         ERR_RETURN(trans->getNdbError());
       }

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2009-01-28 09:55:02 +0000
+++ b/sql/ha_ndbcluster.h	2009-03-12 11:06:48 +0000
@@ -235,21 +235,39 @@ struct Ndb_tuple_id_range_guard {
 #define NSF_BINLOG_USE_UPDATE 16u  /* table update should be binlogged using
                                      update log event */
 inline void set_binlog_logging(NDB_SHARE *share)
-{ share->flags&= ~NSF_NO_BINLOG; }
+{
+  DBUG_PRINT("info", ("set_binlog_logging"));
+  share->flags&= ~NSF_NO_BINLOG;
+}
 inline void set_binlog_nologging(NDB_SHARE *share)
-{ share->flags|= NSF_NO_BINLOG; }
+{
+  DBUG_PRINT("info", ("set_binlog_nologging"));
+  share->flags|= NSF_NO_BINLOG;
+}
 inline my_bool get_binlog_nologging(NDB_SHARE *share)
 { return (share->flags & NSF_NO_BINLOG) != 0; }
 inline void set_binlog_updated_only(NDB_SHARE *share)
-{ share->flags&= ~NSF_BINLOG_FULL; }
+{
+  DBUG_PRINT("info", ("set_binlog_updated_only"));
+  share->flags&= ~NSF_BINLOG_FULL;
+}
 inline void set_binlog_full(NDB_SHARE *share)
-{ share->flags|= NSF_BINLOG_FULL; }
+{
+  DBUG_PRINT("info", ("set_binlog_full"));
+  share->flags|= NSF_BINLOG_FULL;
+}
 inline my_bool get_binlog_full(NDB_SHARE *share)
 { return (share->flags & NSF_BINLOG_FULL) != 0; }
 inline void set_binlog_use_write(NDB_SHARE *share)
-{ share->flags&= ~NSF_BINLOG_USE_UPDATE; }
+{
+  DBUG_PRINT("info", ("set_binlog_use_write"));
+  share->flags&= ~NSF_BINLOG_USE_UPDATE;
+}
 inline void set_binlog_use_update(NDB_SHARE *share)
-{ share->flags|= NSF_BINLOG_USE_UPDATE; }
+{
+  DBUG_PRINT("info", ("set_binlog_use_update"));
+  share->flags|= NSF_BINLOG_USE_UPDATE;
+}
 inline my_bool get_binlog_use_update(NDB_SHARE *share)
 { return (share->flags & NSF_BINLOG_USE_UPDATE) != 0; }
 
@@ -563,16 +581,20 @@ static void set_tabname(const char *path
 
 private:
 #ifdef HAVE_NDB_BINLOG
+  int delete_row_conflict_fn(enum_conflict_fn_type cft,
+                             const uchar *old_data,
+                             NdbInterpretedCode *);
+  int write_row_conflict_fn(enum_conflict_fn_type cft,
+                            uchar *data,
+                            NdbInterpretedCode *);
   int update_row_conflict_fn(enum_conflict_fn_type cft,
                              const uchar *old_data,
                              uchar *new_data,
                              NdbInterpretedCode *);
-  int update_row_conflict_fn_max(const uchar *old_data,
-                                 uchar *new_data,
-                                 NdbInterpretedCode *);
-  int update_row_conflict_fn_old(const uchar *old_data,
-                                 uchar *new_data,
-                                 NdbInterpretedCode *);
+  int row_conflict_fn_max(const uchar *new_data,
+                          NdbInterpretedCode *);
+  int row_conflict_fn_old(const uchar *old_data,
+                          NdbInterpretedCode *);
 #endif
   void setup_key_ref_for_ndb_record(const NdbRecord **key_rec,
                                     const uchar **key_row,

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2009-03-12 09:54:58 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2009-03-12 11:06:48 +0000
@@ -72,7 +72,6 @@ int ndb_binlog_thread_running= 0;
 my_bool ndb_binlog_running= FALSE;
 my_bool ndb_binlog_tables_inited= FALSE;
 my_bool ndb_binlog_is_ready= FALSE;
-
 /*
   Global reference to the ndb injector thread THD oject
 
@@ -2126,7 +2125,7 @@ end:
 */
 
 int
-ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
+ndb_handle_schema_change(THD *thd, Ndb *is_ndb, NdbEventOperation *pOp,
                          Ndb_event_data *event_data)
 {
   DBUG_ENTER("ndb_handle_schema_change");
@@ -2144,8 +2143,11 @@ ndb_handle_schema_change(THD *thd, Ndb *
   DBUG_ASSERT(pOp->getEventType() == NDBEVENT::TE_DROP ||
               pOp->getEventType() == NDBEVENT::TE_CLUSTER_FAILURE);
   {
+    Thd_ndb *thd_ndb= get_thd_ndb(thd);
+    Ndb *ndb= thd_ndb->ndb;
+    NDBDICT *dict= ndb->getDictionary();
     ndb->setDatabaseName(dbname);
-    Ndb_table_guard ndbtab_g(ndb->getDictionary(), tabname);
+    Ndb_table_guard ndbtab_g(dict, tabname);
     const NDBTAB *ev_tab= pOp->getTable();
     const NDBTAB *cache_tab= ndbtab_g.get_table();
     if (cache_tab &&
@@ -2206,7 +2208,7 @@ ndb_handle_schema_change(THD *thd, Ndb *
   }
 
   pthread_mutex_lock(&injector_mutex);
-  ndb->dropEventOperation(pOp);
+  is_ndb->dropEventOperation(pOp);
   pOp= 0;
   pthread_mutex_unlock(&injector_mutex);
 
@@ -2251,7 +2253,7 @@ static void ndb_binlog_query(THD *thd, C
 }
 
 static int
-ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
+ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *s_ndb,
                                       NdbEventOperation *pOp,
                                       List<Cluster_schema> 
                                       *post_epoch_log_list,
@@ -2271,6 +2273,8 @@ ndb_binlog_thread_handle_schema_event(TH
         ev_type == NDBEVENT::TE_INSERT)
     {
       Thd_ndb *thd_ndb= get_thd_ndb(thd);
+      Ndb *ndb= thd_ndb->ndb;
+      NDBDICT *dict= ndb->getDictionary();
       Thd_ndb_options_guard thd_ndb_options(thd_ndb);
       Cluster_schema *schema= (Cluster_schema *)
         sql_alloc(sizeof(Cluster_schema));
@@ -2384,9 +2388,8 @@ ndb_binlog_thread_handle_schema_event(TH
           if (!share || !share->op)
           {
             {
-              injector_ndb->setDatabaseName(schema->db);
-              Ndb_table_guard ndbtab_g(injector_ndb->getDictionary(),
-                                       schema->name);
+              ndb->setDatabaseName(schema->db);
+              Ndb_table_guard ndbtab_g(dict, schema->name);
               ndbtab_g.invalidate();
             }
             TABLE_LIST table_list;
@@ -2538,7 +2541,7 @@ ndb_binlog_thread_handle_schema_event(TH
       close_cached_tables(NULL, NULL, FALSE, FALSE);
       // fall through
     case NDBEVENT::TE_ALTER:
-      ndb_handle_schema_change(thd, ndb, pOp, event_data);
+      ndb_handle_schema_change(thd, s_ndb, pOp, event_data);
       break;
     case NDBEVENT::TE_NODE_FAILURE:
     {
@@ -2625,6 +2628,8 @@ ndb_binlog_thread_handle_schema_event_po
   DBUG_ENTER("ndb_binlog_thread_handle_schema_event_post_epoch");
   Cluster_schema *schema;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
+  Ndb *ndb= thd_ndb->ndb;
+  NDBDICT *dict= ndb->getDictionary();
   while ((schema= post_epoch_log_list->pop()))
   {
     Thd_ndb_options_guard thd_ndb_options(thd_ndb);
@@ -2675,9 +2680,8 @@ ndb_binlog_thread_handle_schema_event_po
           sql_print_information("SOT_DROP_TABLE %s.%s", schema->db, schema->name);
         log_query= 1;
         {
-          injector_ndb->setDatabaseName(schema->db);
-          Ndb_table_guard ndbtab_g(injector_ndb->getDictionary(),
-                                   schema->name);
+          ndb->setDatabaseName(schema->db);
+          Ndb_table_guard ndbtab_g(dict, schema->name);
           ndbtab_g.invalidate();
         }
         {
@@ -2692,15 +2696,19 @@ ndb_binlog_thread_handle_schema_event_po
         if (ndb_extra_logging > 9)
           sql_print_information("SOT_RENAME_TABLE %s.%s", schema->db, schema->name);
         log_query= 1;
-        pthread_mutex_lock(&LOCK_open);
-        ndbcluster_rename_share(thd, share);
-        pthread_mutex_unlock(&LOCK_open);
+        if (share)
+        {
+          pthread_mutex_lock(&LOCK_open);
+          ndbcluster_rename_share(thd, share);
+          pthread_mutex_unlock(&LOCK_open);
+        }
         break;
       case SOT_RENAME_TABLE_PREPARE:
         if (ndb_extra_logging > 9)
           sql_print_information("SOT_RENAME_TABLE_PREPARE %s.%s -> %s",
                                 schema->db, schema->name, schema->query);
-        if (schema->node_id != g_ndb_cluster_connection->node_id())
+        if (share &&
+            schema->node_id != g_ndb_cluster_connection->node_id())
           ndbcluster_prepare_rename_share(share, schema->query);
         break;
       case SOT_ALTER_TABLE_COMMIT:
@@ -2710,9 +2718,8 @@ ndb_binlog_thread_handle_schema_event_po
           break;
         log_query= 1;
         {
-          injector_ndb->setDatabaseName(schema->db);
-          Ndb_table_guard ndbtab_g(injector_ndb->getDictionary(),
-                                   schema->name);
+          ndb->setDatabaseName(schema->db);
+          Ndb_table_guard ndbtab_g(dict, schema->name);
           ndbtab_g.invalidate();
         }
         {
@@ -2730,7 +2737,10 @@ ndb_binlog_thread_handle_schema_event_po
             if (event_data)
               delete event_data;
             share->op->setCustomData(NULL);
-            injector_ndb->dropEventOperation(share->op);
+            {
+              Mutex_guard injector_mutex_g(injector_mutex);
+              injector_ndb->dropEventOperation(share->op);
+            }
             share->op= 0;
             free_share(&share);
           }
@@ -2779,9 +2789,8 @@ ndb_binlog_thread_handle_schema_event_po
       {
         if (ndb_extra_logging > 9)
           sql_print_information("SOT_ONLINE_ALTER_TABLE_PREPARE %s.%s", schema->db, schema->name);
-        NDBDICT *dict= injector_ndb->getDictionary();
         int error= 0;
-        injector_ndb->setDatabaseName(schema->db);
+        ndb->setDatabaseName(schema->db);
         {
           Ndb_table_guard ndbtab_g(dict, schema->name);
           ndbtab_g.get_table();
@@ -2903,7 +2912,10 @@ ndb_binlog_thread_handle_schema_event_po
             if (event_data)
               delete event_data;
             share->op->setCustomData(NULL);
-            injector_ndb->dropEventOperation(share->op);
+            {
+              Mutex_guard injector_mutex_g(injector_mutex);
+              injector_ndb->dropEventOperation(share->op);
+            }
             share->op= share->new_op;
             share->new_op= 0;
             free_share(&share);
@@ -3225,40 +3237,57 @@ static void 
 set_binlog_flags(NDB_SHARE *share,
                  Ndb_binlog_type ndb_binlog_type)
 {
+  DBUG_ENTER("set_binlog_flags");
   switch (ndb_binlog_type)
   {
   case NBT_NO_LOGGING:
+    DBUG_PRINT("info", ("NBT_NO_LOGGING"));
     set_binlog_nologging(share);
-    return;
+    DBUG_VOID_RETURN;
   case NBT_DEFAULT:
+    DBUG_PRINT("info", ("NBT_DEFAULT"));
     if (opt_ndb_log_updated_only)
+    {
       set_binlog_updated_only(share);
+    }
     else
+    {
       set_binlog_full(share);
+    }
     if (opt_ndb_log_update_as_write)
+    {
       set_binlog_use_write(share);
+    }
     else
+    {
       set_binlog_use_update(share);
+    }
     break;
   case NBT_UPDATED_ONLY:
+    DBUG_PRINT("info", ("NBT_UPDATED_ONLY"));
     set_binlog_updated_only(share);
     set_binlog_use_write(share);
     break;
   case NBT_USE_UPDATE:
+    DBUG_PRINT("info", ("NBT_USE_UPDATE"));
   case NBT_UPDATED_ONLY_USE_UPDATE:
+    DBUG_PRINT("info", ("NBT_UPDATED_ONLY_USE_UPDATE"));
     set_binlog_updated_only(share);
     set_binlog_use_update(share);
     break;
   case NBT_FULL:
+    DBUG_PRINT("info", ("NBT_FULL"));
     set_binlog_full(share);
     set_binlog_use_write(share);
     break;
   case NBT_FULL_USE_UPDATE:
+    DBUG_PRINT("info", ("NBT_FULL_USE_UPDATE"));
     set_binlog_full(share);
     set_binlog_use_update(share);
     break;
   }
   set_binlog_logging(share);
+  DBUG_VOID_RETURN;
 }
 
 
@@ -3839,7 +3868,8 @@ err:
                         ER(ER_ILLEGAL_HA_CREATE_OPTION),
                         ndbcluster_hton_name, msg);  
   }
-  set_binlog_flags(share, NBT_DEFAULT);
+  if (do_set_binlog_flags)
+    set_binlog_flags(share, NBT_DEFAULT);
   if (ndberror.code && ndb_extra_logging)
   {
     List_iterator_fast<MYSQL_ERROR> it(thd->warning_info->warn_list());
@@ -4320,16 +4350,13 @@ ndbcluster_create_event_ops(THD *thd, ND
   int retry_sleep= 100;
   while (1)
   {
-    pthread_mutex_lock(&injector_mutex);
+    Mutex_guard injector_mutex_g(injector_mutex);
     Ndb *ndb= injector_ndb;
     if (do_ndb_schema_share)
       ndb= schema_ndb;
 
     if (ndb == 0)
-    {
-      pthread_mutex_unlock(&injector_mutex);
       DBUG_RETURN(-1);
-    }
 
     NdbEventOperation* op;
     if (do_ndb_schema_share)
@@ -4352,7 +4379,6 @@ ndbcluster_create_event_ops(THD *thd, ND
                           ndb->getNdbError().code,
                           ndb->getNdbError().message,
                           "NDB");
-      pthread_mutex_unlock(&injector_mutex);
       DBUG_RETURN(-1);
     }
 
@@ -4415,7 +4441,6 @@ ndbcluster_create_event_ops(THD *thd, ND
                                 op->getNdbError().message,
                                 "NDB");
             ndb->dropEventOperation(op);
-            pthread_mutex_unlock(&injector_mutex);
             DBUG_RETURN(-1);
           }
         }
@@ -4461,7 +4486,6 @@ ndbcluster_create_event_ops(THD *thd, ND
       share->event_data= event_data;
       op->setCustomData(NULL);
       ndb->dropEventOperation(op);
-      pthread_mutex_unlock(&injector_mutex);
       if (retries && !thd->killed)
       {
         do_retry_sleep(retry_sleep);
@@ -4469,7 +4493,6 @@ ndbcluster_create_event_ops(THD *thd, ND
       }
       DBUG_RETURN(-1);
     }
-    pthread_mutex_unlock(&injector_mutex);
     break;
   }
 
@@ -4858,7 +4881,7 @@ static int ndb_binlog_thread_handle_erro
 }
 
 static int
-ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb,
+ndb_binlog_thread_handle_non_data_event(THD *thd,
                                         NdbEventOperation *pOp,
                                         ndb_binlog_index_row &row)
 {
@@ -4932,7 +4955,7 @@ ndb_binlog_thread_handle_non_data_event(
     return 0;
   }
 
-  ndb_handle_schema_change(thd, ndb, pOp, event_data);
+  ndb_handle_schema_change(thd, injector_ndb, pOp, event_data);
   return 0;
 }
 
@@ -5124,7 +5147,7 @@ ndb_binlog_thread_handle_data_event(Ndb 
         since we do not have an after image
       */
       int n;
-      if (table->s->primary_key != MAX_KEY)
+      if (!get_binlog_full(share) && table->s->primary_key != MAX_KEY)
         n= 0; /*
                 use the primary key only as it save time and space and
                 it is the only thing needed to log the delete
@@ -5448,8 +5471,19 @@ pthread_handler_t ndb_binlog_thread_func
 
 
 restart_cluster_failure:
+  int have_injector_mutex_lock= 0;
   do_ndbcluster_binlog_close_connection= BCCC_exit;
-  if (!(s_ndb= new Ndb(g_ndb_cluster_connection, "")) ||
+
+  if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
+  {
+    sql_print_error("Could not allocate Thd_ndb object");
+    ndb_binlog_thread_running= -1;
+    pthread_mutex_unlock(&injector_mutex);
+    pthread_cond_signal(&injector_cond);
+    goto err;
+  }
+
+  if (!(s_ndb= new Ndb(g_ndb_cluster_connection, NDB_REP_DB)) ||
       s_ndb->init())
   {
     sql_print_error("NDB Binlog: Getting Schema Ndb object failed");
@@ -5559,6 +5593,18 @@ restart_cluster_failure:
            (ndb_binlog_running && !ndb_apply_status_share) ||
            !ndb_binlog_tables_inited)
     {
+      if (!thd_ndb->valid_ndb())
+      {
+        /*
+          Cluster has gone away before setup was completed.
+          Keep lock on injector_mutex to prevent further
+          usage of the injector_ndb, and restart binlog
+          thread to get rid of any garbage on the ndb objects
+        */
+        have_injector_mutex_lock= 1;
+        do_ndbcluster_binlog_close_connection= BCCC_restart;
+        goto err;
+      }
       /* ndb not connected yet */
       struct timespec abstime;
       set_timespec(abstime, 1);
@@ -5571,18 +5617,10 @@ restart_cluster_failure:
     }
     pthread_mutex_unlock(&injector_mutex);
 
-    if (thd_ndb == NULL)
-    {
-      DBUG_ASSERT(ndbcluster_hton->slot != ~(uint)0);
-      if (!(thd_ndb= ha_ndbcluster::seize_thd_ndb()))
-      {
-        sql_print_error("Could not allocate Thd_ndb object");
-        goto err;
-      }
-      set_thd_ndb(thd, thd_ndb);
-      thd_ndb->options|= TNO_NO_LOG_SCHEMA_OP;
-      thd->query_id= 0; // to keep valgrind quiet
-    }
+    DBUG_ASSERT(ndbcluster_hton->slot != ~(uint)0);
+    set_thd_ndb(thd, thd_ndb);
+    thd_ndb->options|= TNO_NO_LOG_SCHEMA_OP;
+    thd->query_id= 0; // to keep valgrind quiet
   }
 
   {
@@ -5797,7 +5835,7 @@ restart_cluster_failure:
               (unsigned) NDBEVENT::TE_FIRST_NON_DATA_EVENT)
           {
             ndb_binlog_index_row row;
-            ndb_binlog_thread_handle_non_data_event(thd, i_ndb, pOp, row);
+            ndb_binlog_thread_handle_non_data_event(thd, pOp, row);
           }
         }
         if (i_ndb->getEventOperation() == NULL &&
@@ -6035,13 +6073,7 @@ restart_cluster_failure:
             ndb_binlog_thread_handle_data_event(i_ndb, pOp, &rows, trans, trans_row_count);
           else
           {
-            // set injector_ndb database/schema from table internal name
-            IF_DBUG(int ret=)
-              i_ndb->setDatabaseAndSchemaName(pOp->getEvent()->getTable());
-            DBUG_ASSERT(ret == 0);
-            ndb_binlog_thread_handle_non_data_event(thd, i_ndb, pOp, *rows);
-            // reset to catch errors
-            i_ndb->setDatabaseName("");
+            ndb_binlog_thread_handle_non_data_event(thd, pOp, *rows);
             DBUG_PRINT("info", ("s_ndb first: %s", s_ndb->getEventOperation() ?
                                 s_ndb->getEventOperation()->getEvent()->getTable()->getName() :
                                 "<empty>"));
@@ -6159,7 +6191,8 @@ restart_cluster_failure:
     DBUG_PRINT("info",("Restarting cluster binlog thread"));
     THD_SET_PROC_INFO(thd, "Restarting");
   }
-  pthread_mutex_lock(&injector_mutex);
+  if (!have_injector_mutex_lock)
+    pthread_mutex_lock(&injector_mutex);
   /* don't mess with the injector_ndb anymore from other threads */
   injector_thd= 0;
   injector_ndb= 0;

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2009-01-28 09:55:02 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2009-03-12 11:06:48 +0000
@@ -104,6 +104,21 @@ const uint error_conflict_fn_max_violati
 #endif /* HAVE_NDB_BINLOG */
 
 
+class Mutex_guard
+{
+public:
+  Mutex_guard(pthread_mutex_t &mutex) : m_mutex(mutex)
+  {
+    pthread_mutex_lock(&m_mutex);
+  };
+  ~Mutex_guard()
+  {
+    pthread_mutex_unlock(&m_mutex);
+  };
+private:
+  pthread_mutex_t &m_mutex;
+};
+
 class Ndb_table_guard
 {
 public:

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-03-03 14:24:27 +0000
+++ b/sql/log_event.cc	2009-03-12 11:06:48 +0000
@@ -9137,18 +9137,6 @@ Update_rows_log_event::do_before_row_ope
 {
   if (m_table->s->keys > 0)
   {
-    /*
-      primary key columns should not be set in write_set
-    */
-    if (m_table->s->primary_key != MAX_KEY)
-    {
-      KEY *key= m_table->key_info + m_table->s->primary_key;
-      KEY_PART_INFO *key_part= key->key_part;
-      KEY_PART_INFO *end= key_part + key->key_parts;
-      for (; key_part != end; key_part++)
-        bitmap_clear_bit(m_table->write_set, key_part->fieldnr - 1);
-    }
-
     // Allocate buffer for key searches
     m_key= (uchar*)my_malloc(m_table->key_info->key_length, MYF(MY_WME));
     if (!m_key)

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-03-03 14:24:27 +0000
+++ b/sql/slave.cc	2009-03-12 11:06:48 +0000
@@ -2794,7 +2794,6 @@ Slave SQL thread aborted. Can't execute 
     DBUG_ASSERT(rli->sql_thd == thd);
     THD_CHECK_SENTRY(thd);
 
-    sql_print_information("new_mode %u", thd->variables.new_mode);
     if (exec_relay_log_event(thd,rli))
     {
       DBUG_PRINT("info", ("exec_relay_log_event() failed"));

=== modified file 'storage/ndb/include/kernel/signaldata/AllocNodeId.hpp'
--- a/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp	2006-12-27 01:23:51 +0000
+++ b/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp	2009-02-18 14:29:58 +0000
@@ -24,21 +24,28 @@
  */
 class AllocNodeIdReq {
 public:
-  STATIC_CONST( SignalLength = 4 );
+  STATIC_CONST( SignalLength = 5 );
+  STATIC_CONST( SignalLengthQMGR = 7 );
 
   Uint32 senderRef;
   Uint32 senderData;
   Uint32 nodeId;
   Uint32 nodeType;
+  Uint32 timeout;
+
+  Uint32 secret_lo;
+  Uint32 secret_hi;
 };
 
 class AllocNodeIdConf {
 public:
-  STATIC_CONST( SignalLength = 3 );
+  STATIC_CONST( SignalLength = 5 );
 
   Uint32 senderRef;
   Uint32 senderData;
   Uint32 nodeId;
+  Uint32 secret_lo;
+  Uint32 secret_hi;
 };
 
 class AllocNodeIdRef {

=== modified file 'storage/ndb/include/kernel/signaldata/BuildIndx.hpp'
--- a/storage/ndb/include/kernel/signaldata/BuildIndx.hpp	2007-12-25 16:34:29 +0000
+++ b/storage/ndb/include/kernel/signaldata/BuildIndx.hpp	2009-02-27 16:21:03 +0000
@@ -66,7 +66,8 @@ struct BuildIndxRef {
     IndexNotUnique = 4251,
     AllocationFailure = 4252,
     InternalError = 4346,
-    IndexNotFound = 4243
+    IndexNotFound = 4243,
+    DeadlockError = 4351
   };
 
   STATIC_CONST( SignalLength = 10 );

=== modified file 'storage/ndb/include/kernel/signaldata/ConfigChange.hpp'
--- a/storage/ndb/include/kernel/signaldata/ConfigChange.hpp	2008-12-17 16:09:24 +0000
+++ b/storage/ndb/include/kernel/signaldata/ConfigChange.hpp	2009-02-23 09:36:25 +0000
@@ -85,7 +85,8 @@ class ConfigChangeRef {
     IllegalInitialGeneration = 12,
     DifferentInitial        = 13,
     NotAllStarted           = 14,
-    NotPrimaryMgmNode       = 15
+    NotPrimaryMgmNode       = 15,
+    SendFailed              = 16
   };
 
 public:
@@ -123,6 +124,8 @@ public:
       return " Not all mgm nodes are started";
     case NotPrimaryMgmNode:
       return "Not primary mgm node for configuration";
+    case SendFailed:
+      return "Failed to send signal to other node";
 
     default:
       return "ConfigChangeRef, unknown error";

=== modified file 'storage/ndb/include/kernel/signaldata/DihContinueB.hpp'
--- a/storage/ndb/include/kernel/signaldata/DihContinueB.hpp	2008-06-05 20:31:21 +0000
+++ b/storage/ndb/include/kernel/signaldata/DihContinueB.hpp	2009-02-20 10:36:15 +0000
@@ -68,6 +68,8 @@ private:
     ZTO_START_FRAGMENTS = 44
     ,ZCOPY_NODE_WAIT_CREATE_FRAG = 45
     ,ZWAIT_OLD_SCAN = 46
+    ,ZLCP_TRY_LOCK = 47
+    ,ZDELAY_RELEASE_FRAGMENT_INFO_MUTEX = 48
   };
 };
 

=== modified file 'storage/ndb/include/kernel/signaldata/FsOpenReq.hpp'
--- a/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp	2008-12-02 13:10:49 +0000
+++ b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp	2009-02-17 09:26:44 +0000
@@ -105,6 +105,15 @@ private:
     S_LOG = 7,
     S_CTL = 8
   };
+
+  enum BasePathSpec
+  {
+    BP_FS = 0,     // FileSystemPath
+    BP_BACKUP = 1, // BackupDataDir
+    BP_DD_DF = 2,  // FileSystemPathDataFiles
+    BP_DD_UF = 3,  // FileSystemPathUndoFiles
+    BP_MAX = 4
+  };
   
   static Uint32 getVersion(const Uint32 fileNumber[]);
   static Uint32 getSuffix(const Uint32 fileNumber[]);

=== modified file 'storage/ndb/include/kernel/signaldata/LCP.hpp'
--- a/storage/ndb/include/kernel/signaldata/LCP.hpp	2008-11-16 15:27:42 +0000
+++ b/storage/ndb/include/kernel/signaldata/LCP.hpp	2009-03-12 06:52:39 +0000
@@ -19,7 +19,7 @@
 #include "SignalData.hpp"
 #include <NodeBitmask.hpp>
 
-class StartLcpReq {
+struct StartLcpReq {
   /**
    * Sender(s)
    */
@@ -38,7 +38,6 @@ class StartLcpReq {
 public:
 
   STATIC_CONST( SignalLength = 2 + 2 * NdbNodeBitmask::Size );
-private:
   Uint32 senderRef;
   Uint32 lcpId;
   
@@ -109,7 +108,7 @@ private:
 };
 
 
-class LcpFragRep {
+struct LcpFragRep {
   /**
    * Sender(s) and receiver(s)
    */
@@ -122,10 +121,10 @@ class LcpFragRep {
   friend class DblqhProxy;
 
   friend bool printLCP_FRAG_REP(FILE *, const Uint32 *, Uint32, Uint16);  
-public:
+
   STATIC_CONST( SignalLength = 7 );
+  STATIC_CONST( BROADCAST_REQ = 0 );
 
-private:
   Uint32 nodeId;
   Uint32 lcpId;
   Uint32 lcpNo;

=== modified file 'storage/ndb/include/logger/ConsoleLogHandler.hpp'
--- a/storage/ndb/include/logger/ConsoleLogHandler.hpp	2008-12-10 17:55:10 +0000
+++ b/storage/ndb/include/logger/ConsoleLogHandler.hpp	2009-01-29 17:16:09 +0000
@@ -17,6 +17,7 @@
 #define CONSOLELOGHANDLER_H
 
 #include "LogHandler.hpp"
+#include <NdbOut.hpp>
 
 /**
  * Logs messages to the console/stdout.
@@ -30,7 +31,7 @@ public:
   /**
    * Default constructor.
    */
-  ConsoleLogHandler();
+  ConsoleLogHandler(const NdbOut &out= ndbout);
   /**
    * Destructor.
    */
@@ -47,7 +48,8 @@ protected:	
   virtual void writeHeader(const char* pCategory, Logger::LoggerLevel level);
   virtual void writeMessage(const char* pMsg);
   virtual void writeFooter();
-  	
+  const NdbOut& _out;
+
 private:
   /** Prohibit*/
   ConsoleLogHandler(const ConsoleLogHandler&);

=== modified file 'storage/ndb/include/logger/FileLogHandler.hpp'
--- a/storage/ndb/include/logger/FileLogHandler.hpp	2008-12-10 17:55:10 +0000
+++ b/storage/ndb/include/logger/FileLogHandler.hpp	2009-01-29 17:16:09 +0000
@@ -45,11 +45,6 @@ public:
   virtual const char* handler_type() {return "FILE"; };
 
   /**
-   * Default constructor.
-   */
-  FileLogHandler();
-
-  /**
    * Creates a new file handler with the specified filename, 
    * max number of archived log files and max log size for each log.
    *
@@ -58,7 +53,7 @@ public:
    * @param maxFileSize the maximum log file size before archiving.
    * @param maxLogEntries the maximum number of log entries before checking time to archive.
    */
-  FileLogHandler(const char* aFileName, 
+  FileLogHandler(const char* aFileName = "logger.log",
 		 int maxNoFiles = MAX_NO_FILES, 
 		 long maxFileSize = MAX_FILE_SIZE,
 		 unsigned int maxLogEntries = MAX_LOG_ENTRIES);

=== modified file 'storage/ndb/include/logger/Logger.hpp'
--- a/storage/ndb/include/logger/Logger.hpp	2008-11-06 16:52:59 +0000
+++ b/storage/ndb/include/logger/Logger.hpp	2009-01-23 12:50:40 +0000
@@ -18,6 +18,7 @@
 
 #include <ndb_global.h>
 #include <BaseString.hpp>
+#include <NdbOut.hpp>
 
 #define MAX_LOG_MESSAGE_SIZE 1024
 
@@ -132,7 +133,7 @@ public:
    *
    * @return true if successful.
    */
-  bool createConsoleHandler();
+  bool createConsoleHandler(const NdbOut &out= ndbout);
 
   /**
    * Remove the default console handler.
@@ -144,7 +145,7 @@ public:
    *
    * @return true if successful.
    */
-  bool createFileHandler();
+  bool createFileHandler(char* filename= 0);
 
   /**
    * Remove the default file handler.

=== modified file 'storage/ndb/include/mgmapi/mgmapi_config_parameters.h'
--- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2009-01-30 13:42:56 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2009-02-20 10:36:15 +0000
@@ -151,9 +151,17 @@
 
 #define CFG_NDBMT_CLASSIC             191
 
+#define CFG_DB_DD_FILESYSTEM_PATH     193
+#define CFG_DB_DD_DATAFILE_PATH       194
+#define CFG_DB_DD_UNDOFILE_PATH       195
+#define CFG_DB_DD_LOGFILEGROUP_SPEC   196
+#define CFG_DB_DD_TABLEPACE_SPEC      197
+
 #define CFG_DB_SGA                    198 /* super pool mem */
 #define CFG_DB_DATA_MEM_2             199 /* used in special build in 5.1 */
 
+#define CFG_DB_LCP_TRY_LOCK_TIMEOUT   605
+
 #define CFG_NODE_ARBIT_RANK           200
 #define CFG_NODE_ARBIT_DELAY          201
 #define CFG_RESERVED_SEND_BUFFER_MEMORY 202

=== modified file 'storage/ndb/include/mgmapi/ndb_logevent.h'
--- a/storage/ndb/include/mgmapi/ndb_logevent.h	2008-12-18 09:43:26 +0000
+++ b/storage/ndb/include/mgmapi/ndb_logevent.h	2009-03-11 16:24:34 +0000
@@ -200,6 +200,8 @@ extern "C" {
     NDB_LE_LogFileInitStatus = 71,
     /** NDB_MGM_EVENT_CATEGORY_FRAGLOGFILE */
     NDB_LE_LogFileInitCompStatus = 72
+
+    ,NDB_LE_RedoStatus = 73
   };
 
   /**
@@ -759,6 +761,18 @@ extern "C" {
         unsigned report_type;
 	unsigned node_id;
       } SubscriptionStatus;
+      /** Log event data @ref NDB_LE_RedoStatus */
+      struct {
+	unsigned log_part;
+	unsigned head_file_no;
+        unsigned head_mbyte;
+        unsigned tail_file_no;
+        unsigned tail_mbyte;
+        unsigned total_hi;
+        unsigned total_lo;
+        unsigned free_hi;
+        unsigned free_lo;
+      } RedoStatus;
 #ifndef DOXYGEN_FIX
     };
 #else

=== modified file 'storage/ndb/include/mgmcommon/ConfigRetriever.hpp'
--- a/storage/ndb/include/mgmcommon/ConfigRetriever.hpp	2008-10-24 10:06:10 +0000
+++ b/storage/ndb/include/mgmcommon/ConfigRetriever.hpp	2009-03-04 10:07:03 +0000
@@ -47,7 +47,7 @@ public:
    * @return ndb_mgm_configuration object if succeeded, 
    *         NULL if erroneous local config file or configuration error.
    */
-  struct ndb_mgm_configuration * getConfig();
+  struct ndb_mgm_configuration * getConfig(Uint32 nodeid);
   
   void resetError();
   int hasError();
@@ -87,22 +87,14 @@ private:
   BaseString errorString;
   enum ErrorType {
     CR_NO_ERROR = 0,
-    CR_ERROR = 1,
-    CR_RETRY = 2
+    CR_ERROR = 1
   };
   ErrorType latestErrorType;
 
   void setError(ErrorType, const char * errorMsg);
   void setError(ErrorType, BaseString err);
 
-  Uint32      _ownNodeId;
   bool m_end_session;
-
-  /*
-  Uint32      m_mgmd_port;
-  const char *m_mgmd_host;
-  */
-
   Uint32 m_version;
   Uint32 m_node_type;
   NdbMgmHandle m_handle;

=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp	2009-03-12 11:06:48 +0000
@@ -1339,7 +1339,9 @@ public:
 
 
   /**
-   * Structure for passing in pointers to startTransaction
+   * Structure for passing in pointers to distribution key values
+   * When distribution key has multiple parts, they should be
+   * passed as an array, with the last part's ptr == NULL.
    * 
    */
   struct Key_part_ptr
@@ -1349,6 +1351,89 @@ public:
   };
 
   /**
+   * Structure for describing a table partition in terms of either
+   * 
+   * PS_NONE
+   *   No partitioning info provided.
+   *
+   * PS_USER_DEFINED
+   *   A specific partition id for a table with user defined 
+   *   partitioning
+   *
+   * PS_DISTR_KEY_PART_PTR
+   *   An array of a table's distribution key values for a 
+   *   table with native partitioning.
+   *
+   * PS_DISTR_KEY_RECORD
+   *   A row in given NdbRecord format containing a natively 
+   *   partitioned table's distribution key values 
+   *
+   */
+
+  struct PartitionSpec
+  {
+    enum SpecType
+    {
+      PS_NONE                = 0,
+      PS_USER_DEFINED        = 1,
+      PS_DISTR_KEY_PART_PTR  = 2,
+      PS_DISTR_KEY_RECORD    = 3
+    };
+
+    Uint32 type;
+    
+    union
+    {
+      struct {
+        Uint32 partitionId;
+      } UserDefined;
+      
+      struct {
+        const Key_part_ptr* tableKeyParts;
+        void* xfrmbuf;
+        Uint32 xfrmbuflen;
+      } KeyPartPtr;
+
+      struct {
+        const NdbRecord* keyRecord;
+        const char* keyRow;
+        void* xfrmbuf;
+        Uint32 xfrmbuflen;
+      } KeyRecord;
+    };
+  };
+
+#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
+  /* First version of PartitionSpec, defined here for 
+   * backwards compatibility reasons
+   */
+  struct PartitionSpec_v1
+  {
+    enum SpecType
+    {
+      PS_NONE                = 0,
+      PS_USER_DEFINED        = 1,
+      PS_DISTR_KEY_PART_PTR  = 2
+    };
+
+    Uint32 type;
+    
+    union
+    {
+      struct {
+        Uint32 partitionId;
+      } UserDefined;
+      
+      struct {
+        const Key_part_ptr* tableKeyParts;
+        void* xfrmbuf;
+        Uint32 xfrmbuflen;
+      } KeyPartPtr;
+    };
+  };
+#endif
+
+  /**
    * Start a transaction
    *
    * @note When the transaction is completed it must be closed using
@@ -1387,7 +1472,7 @@ public:
                                    Uint32 partitionId);
 
   /**
-   * Compute hash value given table/keys
+   * Compute distribution hash value given table/keys
    *
    * @param  hashvalueptr - OUT, is set to hashvalue if return value is 0
    * @param  table    Pointer to table object
@@ -1401,6 +1486,7 @@ public:
    *
    * @note if xfrmbuf is null (default) malloc/free will be made
    *       if xfrmbuf is not null but length is too short, method will fail
+   *       Only for use with natively partitioned tables.
    *
    * @return 0 - ok - hashvalueptr is set
    *         else - fail, return error code

=== modified file 'storage/ndb/include/ndbapi/NdbBlob.hpp'
--- a/storage/ndb/include/ndbapi/NdbBlob.hpp	2008-11-08 20:40:15 +0000
+++ b/storage/ndb/include/ndbapi/NdbBlob.hpp	2009-03-02 16:08:11 +0000
@@ -386,6 +386,7 @@ private:
   NdbOperation* theHeadInlineReadOp;
   bool theHeadInlineUpdateFlag;
   // partition id for data events
+  bool userDefinedPartitioning;
   Uint32 noPartitionId() { return ~(Uint32)0; }
   Uint32 thePartitionId;
   NdbRecAttr* thePartitionIdRecAttr;
@@ -440,6 +441,8 @@ private:
   int getHeadInlineValue(NdbOperation* anOp);
   void getHeadFromRecAttr();
   int setHeadInlineValue(NdbOperation* anOp);
+  void setHeadPartitionId(NdbOperation* anOp);
+  void setPartPartitionId(NdbOperation* anOp);
   // data operations
   int readDataPrivate(char* buf, Uint32& bytes);
   int writeDataPrivate(const char* buf, Uint32 bytes);

=== modified file 'storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2009-03-12 11:06:48 +0000
@@ -197,24 +197,39 @@ public:
   };
 
   /**
-   * Add a bound to an NdbRecord defined Index scan
+   * Add a range to an NdbRecord defined Index scan
    * 
-   * This method is called to add a bound to an IndexScan operation
+   * This method is called to add a range to an IndexScan operation
    * which has been defined with a call to NdbTransaction::scanIndex().
-   * To add extra bounds, the index scan operation must have been
+   * To add more than one range, the index scan operation must have been
    * defined with the the SF_MultiRange flag set.
    *
    * Where multiple numbered ranges are defined with multiple calls to 
-   * setBound, and the scan is ordered, the range number for each bound 
-   * must be larger than the range number for the previously defined bound.
+   * setBound, and the scan is ordered, the range number for each range 
+   * must be larger than the range number for the previously defined range.
    * 
-   * @param key_record NdbRecord structure for the key the bound is 
-   *        to be added to
+   * When the application knows that rows in-range will only be found in
+   * a particular partition, a PartitionSpecification can be supplied.
+   * This may be used to limit the scan to a single partition, improving
+   * system efficiency
+   * The sizeOfPartInfo parameter should be set to the 
+   * sizeof(PartitionSpec) to enable backwards compatibility.
+   * 
+   * @param key_record NdbRecord structure for the key the index is 
+   *        defined on
    * @param bound The bound to add
+   * @param partInfo Extra information to enable a reduced set of
+   *        partitions to be scanned.
+   * @param sizeOfPartInfo
+   *
    * @return 0 for Success, other for Failure.
    */
   int setBound(const NdbRecord *key_record,
                const IndexBound& bound);
+  int setBound(const NdbRecord *key_record,
+               const IndexBound& bound,
+               const Ndb::PartitionSpec* partInfo,
+               Uint32 sizeOfPartInfo= 0);
 
   /**
    * Return size of data, in 32-bit words, that will be send to data nodes for
@@ -308,10 +323,10 @@ private:
   virtual int equal_impl(const NdbColumnImpl*, const char*);
   virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char*);
 
-  void setDistKeyFromRange(const NdbRecord *key_record,
-                           const NdbRecord *result_record,
-                           const char *row,
-                           Uint32 distkeyMax);
+  int getDistKeyFromRange(const NdbRecord* key_record,
+                          const NdbRecord* result_record,
+                          const char* row,
+                          Uint32* distKey);
   void fix_get_values();
   int next_result_ordered(bool fetchAllowed, bool forceSend = false);
   int next_result_ordered_ndbrecord(const char * & out_row,

=== modified file 'storage/ndb/include/ndbapi/NdbOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-12-09 17:02:23 +0000
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp	2009-03-09 13:04:27 +0000
@@ -1063,7 +1063,6 @@ public:
 
 
 protected:
-
 /******************************************************************************
  * These are the methods used to create and delete the NdbOperation objects.
  *****************************************************************************/

=== modified file 'storage/ndb/include/ndbapi/NdbScanOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbScanOperation.hpp	2009-02-11 12:41:43 +0000
+++ b/storage/ndb/include/ndbapi/NdbScanOperation.hpp	2009-03-12 11:06:48 +0000
@@ -113,7 +113,9 @@ public:
                 SO_GETVALUE     = 0x08,
                 SO_PARTITION_ID = 0x10,
                 SO_INTERPRETED  = 0x20,
-                SO_CUSTOMDATA   = 0x40 };
+                SO_CUSTOMDATA   = 0x40,
+                SO_PART_INFO    = 0x80
+    };
 
     /* Flags controlling scan behaviour
      * See NdbScanOperation::ScanFlag for details
@@ -137,7 +139,11 @@ public:
     NdbOperation::GetValueSpec *extraGetValues;
     Uint32                     numExtraGetValues;
 
-    /* Specific partition to limit this scan to */
+    /* Specific partition to limit this scan to
+     * Alternatively, an Ndb::PartitionSpec can be supplied.
+     * For Index Scans, partitioning information can be supplied for
+     * each range
+     */
     Uint32 partitionId;
 
     /* Interpreted code to execute as part of the scan */
@@ -145,6 +151,10 @@ public:
 
     /* CustomData ptr to associate with the scan operation */
     void * customData;
+
+    /* Partition information for bounding this scan */
+    const Ndb::PartitionSpec* partitionInfo;
+    Uint32 sizeOfPartInfo;
   };
 
 
@@ -184,6 +194,58 @@ public:
   inline int readTuplesExclusive(int parallell = 0){
     return readTuples(LM_Exclusive, 0, parallell);
   }
+
+  /* First version of ScanOptions, defined here for backwards
+   * compatibility reasons
+   */
+  struct ScanOptions_v1
+  {
+    /* Which options are present - see below for possibilities */
+    Uint64 optionsPresent;
+
+    enum Type { SO_SCANFLAGS    = 0x01,
+                SO_PARALLEL     = 0x02,
+                SO_BATCH        = 0x04,
+                SO_GETVALUE     = 0x08,
+                SO_PARTITION_ID = 0x10,
+                SO_INTERPRETED  = 0x20,
+                SO_CUSTOMDATA   = 0x40 };
+
+    /* Flags controlling scan behaviour
+     * See NdbScanOperation::ScanFlag for details
+     */
+    Uint32 scan_flags;
+
+    /* Desired scan parallelism.
+     * Default == 0 == Maximum parallelism
+     */
+    Uint32 parallel;
+
+    /* Desired scan batchsize in rows 
+     * for NDBD -> API transfers
+     * Default == 0 == Automatically chosen size
+     */
+    Uint32 batch;
+    
+    /* Extra values to be read for each row meeting
+     * scan criteria
+     */
+    NdbOperation::GetValueSpec *extraGetValues;
+    Uint32                     numExtraGetValues;
+
+    /* Specific partition to limit this scan to
+     * Only applicable for tables defined with UserDefined partitioning
+     * For Index Scans, partitioning information can be supplied for
+     * each range
+     */
+    Uint32 partitionId;
+
+    /* Interpreted code to execute as part of the scan */
+    const NdbInterpretedCode *interpretedCode;
+
+    /* CustomData ptr to associate with the scan operation */
+    void * customData;
+  };
 #endif
   
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
@@ -387,6 +449,14 @@ public:
    */
   NdbTransaction* getNdbTransaction() const;
 
+
+  /**
+   * Is scan operation pruned to a single table partition?
+   * For NdbRecord defined scans, valid before+after execute.
+   * For Old Api defined scans, valid only after execute.
+   */
+  bool getPruned() const;
+
 protected:
   NdbScanOperation(Ndb* aNdb,
                    NdbOperation::Type aType = NdbOperation::TableScan);
@@ -398,7 +468,16 @@ protected:
 
   int handleScanGetValuesOldApi();
   int addInterpretedCode();
+  int handleScanOptionsVersion(const ScanOptions*& optionsPtr, 
+                               Uint32 sizeOfOptions,
+                               ScanOptions& currOptions);
   int handleScanOptions(const ScanOptions *options);
+  int validatePartInfoPtr(const Ndb::PartitionSpec*& partInfo,
+                          Uint32 sizeOfPartInfo,
+                          Ndb::PartitionSpec& partValue);
+  int getPartValueFromInfo(const Ndb::PartitionSpec* partInfo,
+                           const NdbTableImpl* table,
+                           Uint32* partValue);
   int generatePackedReadAIs(const NdbRecord *reseult_record, bool& haveBlob);
   int scanImpl(const NdbScanOperation::ScanOptions *options);
   int scanTableImpl(const NdbRecord *result_record,
@@ -563,6 +642,16 @@ protected:
    * old NdbScanFilter Api
    */
   NdbInterpretedCode* m_interpretedCodeOldApi;
+
+  enum ScanPruningState {
+    SPS_UNKNOWN,           // Initial state
+    SPS_FIXED,             // Explicit partitionId passed in ScanOptions
+    SPS_ONE_PARTITION,     // Scan pruned to one partition by previous range
+    SPS_MULTI_PARTITION    // Scan cannot be pruned due to previous ranges
+  };
+  
+  ScanPruningState m_pruneState;
+  Uint32 m_pruningKey;  // Can be distr key hash or actual partition id.
 };
 
 inline

=== added file 'storage/ndb/include/portlib/my_daemon.h'
--- a/storage/ndb/include/portlib/my_daemon.h	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/include/portlib/my_daemon.h	2009-02-24 11:28:08 +0000
@@ -0,0 +1,135 @@
+/* Copyright (C) 2008 Sun Microsystems
+
+   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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+#ifndef MY_DAEMON_H
+#define MY_DAEMON_H
+
+#ifndef DAEMONEXPORT
+#define DAEMONEXPORT extern
+#endif
+
+C_MODE_START
+
+/*
+   all functions return 0 for success so the retval can be returned from main()
+
+   to run the daemon, you must provide a struct MY_DAEMON * to my_daemon_run().
+   the two functions in that struct are start() and stop()
+
+   int start(void*)
+      . this function should do the main work of the daemon
+      . on windows, it is run in a new thread.
+     -- the parameter to start will always be 0.
+     -- the return value of start is ignored
+
+   int stop()
+      . when called, this function must terminate the start() function
+      . usually, start() runs an event loop and setting a global variable
+        to 0 breaks the loop.  stop() should set this variable to 0.
+     --  the return value is ignored
+*/
+
+typedef int (*daemon_start_t)(void *);
+typedef int (*daemon_onstop_t)();
+struct MY_DAEMON {
+  daemon_start_t start;
+  daemon_onstop_t stop;
+};
+
+int my_daemon_run(char *name, struct MY_DAEMON*d);
+int my_daemon_files_run(char *name, struct MY_DAEMON*d, char *node_id);
+
+/*
+   if any of the functions in my_daemon return non-zero (failure)
+   then my_daemon_error contains the error message
+*/
+extern char my_daemon_error[];
+
+/*
+   my_daemon_install() adds a service called [name] which will
+   be called using the command line [cmd]
+   to start a service after installing it, you can use the command line
+    > net start [name]
+*/
+int my_daemon_install(const char *name, const char *cmd);
+
+/*
+   my_daemon_remove() deletes any service called [name]
+*/
+int my_daemon_remove(const char *name);
+
+int maybe_install_or_remove_service(int argc_,char**argv_,char*opts_remove,char*opts_install,char*default_name);
+
+/*
+   these macros are provided for convenience.  including these macros
+   in your main source file give you standard options for services
+*/
+#define NONE
+#ifdef _WIN32
+#define MY_DAEMON_VARS_PASTE(prefix) \
+  uchar *prefix##remove,*prefix##install,*prefix##service
+#define MY_DAEMON_VARS(prefix) uchar *prefix remove,* install,*prefix service
+#define MY_DAEMON_VARS0 MY_DAEMON_VARS(NONE)
+#define MY_DAEMON_LONG_OPTS(prefix) \
+  {"install", 'i', "Install this program as a service. (must be first argument)", \
+   &prefix install, &prefix install, 0, GET_STR,  OPT_ARG, 0, 0, 0, 0, 0, 0}, \
+  {"remove",  'r', "Remove this program as a service. (must be first argument)", \
+   &prefix remove,  &prefix remove,  0, GET_STR,  OPT_ARG, 0, 0, 0, 0, 0, 0}, \
+  {"service", 's', "Internal use only (for windows service)", \
+   &prefix service, &prefix service, 0, GET_STR,  REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+#else
+#define MY_DAEMON_VARS_PASTE(prefix)
+#define MY_DAEMON_VARS(prefix)
+#define MY_DAEMON_VARS0
+#define MY_DAEMON_LONG_OPTS(prefix)
+#define MY_DAEMON_LONG_OPTS_PASTE(prefix)
+#endif
+/*
+   my_dlog is the log file created in daemon_files()
+*/
+DAEMONEXPORT FILE *my_dlog;
+/*
+  convenience macros -- mainly for debugging a service
+*/
+#define DLOG(x)    do{fprintf(my_dlog,"%s",x);fflush(my_dlog);}while(0)
+#define DLOG1(x,y) do{fprintf(my_dlog,x,y);fflush(my_dlog);}while(0)
+
+/*
+   my_daemon_prefiles() checks that pidname and logname can be created
+   and that pidname can be locked.
+   a non-zero return usually means that the process abort -- can't create
+   necessary files.
+*/
+int my_daemon_prefiles(const char *pidname, const char *logname);
+/*
+   my_daemon_files() opens the files passed in prefiles() and redirects
+   stdout/stderr to the logfile.
+   my_dlog points is the logfile after daemon_files()
+*/
+int my_daemon_files();
+/*
+   my_daemon_closefiles() closes files opened by my_daemon_files()
+*/
+int my_daemon_closefiles();
+
+/*
+   a helper function to turn a --install command line to a
+   --service command line for internal use with MY_DAEMON_LONG_OPTS
+*/
+char *my_daemon_make_svc_cmd(int n, char **v, char *default_name);
+
+C_MODE_END
+#endif //MY_DAEMON_H

=== modified file 'storage/ndb/include/util/NdbOut.hpp'
--- a/storage/ndb/include/util/NdbOut.hpp	2008-12-16 11:50:38 +0000
+++ b/storage/ndb/include/util/NdbOut.hpp	2009-01-29 17:16:09 +0000
@@ -49,7 +49,7 @@ class OutputStream;
 class NullOutputStream;
 
 /*  Declare a static variable of NdbOut as ndbout */
-extern NdbOut ndbout;
+extern NdbOut ndbout, ndberr;
 
 class NdbOut
 {

=== modified file 'storage/ndb/src/common/debugger/EventLogger.cpp'
--- a/storage/ndb/src/common/debugger/EventLogger.cpp	2008-11-07 11:00:38 +0000
+++ b/storage/ndb/src/common/debugger/EventLogger.cpp	2009-03-11 16:24:34 +0000
@@ -715,6 +715,21 @@ void getTextStartREDOLog(QQQQ) {
 		       theData[3],
 		       theData[4]);
 }
+void getTextRedoStatus(QQQQ) {
+  Uint64 total = (Uint64(theData[6]) << 32) + theData[7];
+  Uint64 free = (Uint64(theData[8]) << 32) + theData[9];
+  
+  BaseString::snprintf(m_text, m_text_len, 
+		       "Logpart: %u head=[ file: %u mbyte: %u ] tail=[ file: %u mbyte: %u ] total mb: %llu free mb: %llu free%%: %u",
+		       theData[1],
+		       theData[2],
+		       theData[3],
+		       theData[4],
+		       theData[5],
+                       total,
+                       free,
+                       Uint32((100 * free) / total));
+}
 void getTextUNDORecordsExecuted(QQQQ) {
   const char* line = "";
   if (theData[1] == DBTUP){
@@ -813,7 +828,7 @@ void getTextMemoryUsage(QQQQ) {
 
 void getTextBackupStarted(QQQQ) {
   BaseString::snprintf(m_text, m_text_len, 
-		       "Backup %d started from node %d", 
+		       "Backup %u started from node %d", 
 		       theData[2], refToNode(theData[1]));
 }
 void getTextBackupFailedToStart(QQQQ) {
@@ -848,7 +863,7 @@ void getTextBackupStatus(QQQQ) {
 }
 void getTextBackupAborted(QQQQ) {
   BaseString::snprintf(m_text, m_text_len, 
-		       "Backup %d started from %d has been aborted. Error: %d",
+		       "Backup %u started from %d has been aborted. Error: %d",
 		       theData[2], 
 		       refToNode(theData[1]), 
 		       theData[3]);
@@ -1082,6 +1097,7 @@ const EventLoggerBase::EventRepLogLevelM
   ROW(LCPStoppedInCalcKeepGci, LogLevel::llCheckpoint,  0, Logger::LL_ALERT ),
   ROW(LCPFragmentCompleted,    LogLevel::llCheckpoint, 11, Logger::LL_INFO ),
   ROW(UndoLogBlocked,          LogLevel::llCheckpoint,  7, Logger::LL_INFO ),
+  ROW(RedoStatus,              LogLevel::llCheckpoint,  7, Logger::LL_INFO ),
 
   // STARTUP
   ROW(NDBStartStarted,         LogLevel::llStartUp,     1, Logger::LL_INFO ),

=== modified file 'storage/ndb/src/common/debugger/signaldata/DihContinueB.cpp'
--- a/storage/ndb/src/common/debugger/signaldata/DihContinueB.cpp	2008-02-07 06:47:34 +0000
+++ b/storage/ndb/src/common/debugger/signaldata/DihContinueB.cpp	2009-02-20 10:36:15 +0000
@@ -188,6 +188,14 @@ printCONTINUEB_DBDIH(FILE * output, cons
   case DihContinueB::WAIT_DROP_TAB_WRITING_TO_FILE:
     fprintf(output, " Wait drop tab writing to file TableId: %d\n", theData[1]);
     return true;
+  case DihContinueB::ZLCP_TRY_LOCK:
+    fprintf(output, " Lcp trylock: attempt %u\n",
+            theData[1]);
+    break;
+  case DihContinueB::ZDELAY_RELEASE_FRAGMENT_INFO_MUTEX:
+    fprintf(output, " Delay release fragment-info mutex (handle: 0x%x)",
+            theData[1]);
+    break;
   default:
     fprintf(output, " Default system error lab...\n");
     break;

=== modified file 'storage/ndb/src/common/logger/ConsoleLogHandler.cpp'
--- a/storage/ndb/src/common/logger/ConsoleLogHandler.cpp	2008-12-10 17:55:10 +0000
+++ b/storage/ndb/src/common/logger/ConsoleLogHandler.cpp	2009-01-29 17:16:09 +0000
@@ -15,9 +15,8 @@
 
 #include "ConsoleLogHandler.hpp"
 
-#include <NdbOut.hpp>
-
-ConsoleLogHandler::ConsoleLogHandler() : LogHandler()
+ConsoleLogHandler::ConsoleLogHandler(const NdbOut& out)
+ : LogHandler(), _out(out)
 {
 }
 

=== modified file 'storage/ndb/src/common/logger/FileLogHandler.cpp'
--- a/storage/ndb/src/common/logger/FileLogHandler.cpp	2008-12-10 17:55:10 +0000
+++ b/storage/ndb/src/common/logger/FileLogHandler.cpp	2009-01-29 17:16:09 +0000
@@ -20,17 +20,6 @@
 //
 // PUBLIC
 //
-
-FileLogHandler::FileLogHandler() : 
-  LogHandler(),
-  m_maxNoFiles(MAX_NO_FILES), 
-  m_maxFileSize(MAX_FILE_SIZE),
-  m_maxLogEntries(MAX_LOG_ENTRIES)
-
-{
-  m_pLogFile = new File_class("logger.log", "a+");
-}
-
 FileLogHandler::FileLogHandler(const char* aFileName, 
 			       int maxNoFiles, 
 			       long maxFileSize,

=== modified file 'storage/ndb/src/common/logger/Logger.cpp'
--- a/storage/ndb/src/common/logger/Logger.cpp	2008-12-10 17:55:10 +0000
+++ b/storage/ndb/src/common/logger/Logger.cpp	2009-01-29 17:16:09 +0000
@@ -68,14 +68,14 @@ Logger::setCategory(const char* pCategor
 }
 
 bool
-Logger::createConsoleHandler()
+Logger::createConsoleHandler(const NdbOut &out)
 {
   Guard g(m_handler_mutex);
   bool rc = true;
 
   if (m_pConsoleHandler == NULL)
   {
-    m_pConsoleHandler = new ConsoleLogHandler(); 
+    m_pConsoleHandler = new ConsoleLogHandler(out);
     if (!addHandler(m_pConsoleHandler)) // TODO: check error code
     {
       rc = false;
@@ -98,13 +98,14 @@ Logger::removeConsoleHandler()
 }
 
 bool
-Logger::createFileHandler()
+Logger::createFileHandler(char*filename)
 {
   Guard g(m_handler_mutex);
   bool rc = true;
   if (m_pFileHandler == NULL)
   {
-    m_pFileHandler = new FileLogHandler(); 
+    m_pFileHandler = filename ? new FileLogHandler(filename)
+                              : new FileLogHandler();
     if (!addHandler(m_pFileHandler)) // TODO: check error code
     {
       rc = false;

=== modified file 'storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp'
--- a/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2009-01-07 09:55:03 +0000
+++ b/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp	2009-03-05 06:42:20 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 MySQL AB
+/* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
 
    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
@@ -14,27 +14,17 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <ndb_global.h>
-#include <ndb_version.h>
 
 #include <ConfigRetriever.hpp>
-#include <SocketServer.hpp>
 
+#include <SocketServer.hpp>
 #include <NdbSleep.h>
-#include <NdbOut.hpp>
-
-#include <NdbTCP.h>
-#include <NdbEnv.h>
-
-#include <uucode.h>
-#include <Properties.hpp>
-
-#include <socket_io.h>
 
 #include <mgmapi.h>
 #include <mgmapi_config_parameters.h>
 #include <mgmapi_configuration.hpp>
 #include <ConfigValues.hpp>
-#include <NdbHost.h>
+
 
 //****************************************************************************
 //****************************************************************************
@@ -42,18 +32,16 @@
 ConfigRetriever::ConfigRetriever(const char * _connect_string,
 				 Uint32 version, Uint32 node_type,
 				 const char * _bindaddress,
-                                 int timeout_ms)
+                                 int timeout_ms) :
+  m_end_session(true),
+  m_version(version),
+  m_node_type(node_type)
 {
   DBUG_ENTER("ConfigRetriever::ConfigRetriever");
   DBUG_PRINT("enter", ("connect_string: '%s'", _connect_string));
   DBUG_PRINT("enter", ("version: %d, node_type: %d, bind: %s, timeout: %d",
                        version, node_type,_bindaddress, timeout_ms));
 
-  m_version = version;
-  m_node_type = node_type;
-  _ownNodeId= 0;
-  m_end_session= true;
-
   m_handle= ndb_mgm_create_handle();
 
   if (m_handle == 0) {
@@ -148,7 +136,7 @@ ConfigRetriever::is_connected(void)
 //****************************************************************************
 //****************************************************************************
 struct ndb_mgm_configuration*
-ConfigRetriever::getConfig() {
+ConfigRetriever::getConfig(Uint32 nodeid) {
 
   struct ndb_mgm_configuration * p = 0;
 
@@ -158,7 +146,7 @@ ConfigRetriever::getConfig() {
   if(p == 0)
     return 0;
   
-  if(!verifyConfig(p, _ownNodeId)){
+  if(!verifyConfig(p, nodeid)){
     free(p);
     p= 0;
   }
@@ -364,7 +352,6 @@ Uint32
 ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds)
 {
   int res;
-  _ownNodeId= 0;
   if(m_handle != 0)
   {
     while (1)
@@ -376,7 +363,7 @@ ConfigRetriever::allocNodeId(int no_retr
       res= ndb_mgm_alloc_nodeid(m_handle, m_version, m_node_type,
                                 no_retries == 0 /* only log last retry */);
       if(res >= 0)
-	return _ownNodeId= (Uint32)res;
+	return (Uint32)res;
 
   next:
       int error = ndb_mgm_get_latest_error(m_handle);

=== modified file 'storage/ndb/src/common/portlib/CMakeLists.txt'
--- a/storage/ndb/src/common/portlib/CMakeLists.txt	2008-08-26 12:29:06 +0000
+++ b/storage/ndb/src/common/portlib/CMakeLists.txt	2009-01-23 12:50:40 +0000
@@ -29,6 +29,7 @@ ADD_LIBRARY(ndbportlib STATIC
             NdbCondition.c NdbMutex.c
             NdbEnv.c NdbThread.c NdbHost.c NdbTCP.cpp
             NdbMem.c NdbConfig.c NdbTick.c
+            my_daemon.cc ${CMAKE_SOURCE_DIR}/sql/nt_servc.cc
             ${EXTRA_SRC}
 )
 TARGET_LINK_LIBRARIES(ndbportlib mysys ${EXTRA_LIB})

=== modified file 'storage/ndb/src/common/portlib/Makefile.am'
--- a/storage/ndb/src/common/portlib/Makefile.am	2009-03-03 14:32:21 +0000
+++ b/storage/ndb/src/common/portlib/Makefile.am	2009-03-12 10:59:57 +0000
@@ -20,7 +20,7 @@ noinst_LTLIBRARIES = libportlib.la
 libportlib_la_SOURCES = \
 	NdbCondition.c NdbMutex.c NdbTick.c \
 	NdbEnv.c NdbThread.c NdbHost.c NdbTCP.cpp	    \
-	NdbDaemon.c NdbMem.c \
+	NdbDaemon.c my_daemon.cc NdbMem.c \
 	NdbConfig.c
 
 include $(top_srcdir)/storage/ndb/config/common.mk.am

=== added file 'storage/ndb/src/common/portlib/my_daemon.cc'
--- a/storage/ndb/src/common/portlib/my_daemon.cc	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/common/portlib/my_daemon.cc	2009-02-26 10:38:16 +0000
@@ -0,0 +1,322 @@
+/* Copyright (C) 2008 Sun Microsystems
+
+   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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifdef _WIN32
+#include <process.h>
+#endif
+#include <my_global.h>
+#include <my_sys.h>
+#include <m_string.h>
+#define DAEMONEXPORT
+#include <my_daemon.h>
+#include <NdbConfig.h>
+
+#ifdef _WIN32
+#include <nt_servc.h>
+NTService g_ntsvc;
+HANDLE    g_shutdown_evt;
+#endif
+
+static char *daemon_name;
+static long daemonpid;
+
+#define errorlen 1023
+char my_daemon_error[errorlen+1];
+int ERR1(const char*fmt,...) {
+  va_list argptr;
+  va_start(argptr, fmt);
+  my_snprintf(my_daemon_error,errorlen,fmt,argptr);
+  va_end(argptr);
+  return 1;
+}
+
+struct MY_DAEMON g_daemon;
+
+#ifdef _WIN32
+static int init();
+static int stopper(void*)
+{
+  WaitForSingleObject(g_shutdown_evt,INFINITE);
+  return g_daemon.stop();
+}
+#endif
+
+int my_daemon_run(char *name,struct MY_DAEMON*d)
+{
+  daemon_name= name;
+  memcpy(&g_daemon,d,sizeof(g_daemon));
+#ifdef _WIN32
+  g_shutdown_evt=CreateEvent(0, 0, 0, 0);
+  g_ntsvc.SetShutdownEvent(g_shutdown_evt);
+  uintptr_t stop_thread= _beginthread((THREAD_FC)stopper,0,0);
+  if(!stop_thread)
+    return ERR1("couldn't start stopper thread\n");
+  if(init())
+    return ERR1("init failed\n");
+#else /* Fork */
+  pid_t n = fork();
+  if(n==-1)
+    return ERR1("fork failed: %s", strerror(errno));
+  /* Exit if we are the parent */
+  if (n != 0)
+    exit(0);
+  g_daemon.start(0);
+#endif
+  return 0;
+}
+
+#ifdef _WIN32
+char *my_daemon_makecmdv(int c, const char **v)
+{
+  char exe[_MAX_PATH + 3], *retval, *strpos;
+  int i= 0, n= 0;
+
+  GetModuleFileName(NULL, exe, sizeof(exe));
+  n= strlen(exe);
+  for (i= 0; i < c; i++)
+    n += strlen(v[i]) + 8;
+  strpos= retval= (char*)my_malloc(n, MY_FAE);
+  strpos += my_snprintf(strpos, n, "\"%s\"", exe);
+  for (i= 0; i < c; i++)
+    strpos += my_snprintf(strpos, n, " \"%s\"", v[i]);
+  return retval;
+}
+
+static int startswith(char*s,char**set)
+{
+  char**item=set;
+  for(;*item;item++)
+    if(!strncmp(*item,s,strlen(*item)))
+      return 1;
+  return 0;
+}
+
+char *my_daemon_make_svc_cmd(int n, char **v, char *name)
+{
+  char*swi[]= {"--install","-i",0},
+      *swirs[]= {"--remove","-r","--install","-i","--service","-s",0};
+  if(!startswith(v[0],swi))
+    return ERR1("The install option (-i) must be the first argument\n"),0;
+  int i= 0;
+  for(i=1;i<n;i++)
+    if(startswith(v[i],swirs))
+       return ERR1("The install option (-i) must be the only -i or -r"
+                  " on command line\n"),0;
+  size_t opt_size= strlen(name)+16;
+  char*svcopt=(char*)my_malloc(opt_size, MY_FAE);
+  my_snprintf(svcopt,opt_size-1,"--service=%s",name);
+
+  size_t size=sizeof(char*)*(n+2);
+  char**v1= (char**)my_malloc(size, MY_FAE);
+  memset(v1,0,size);
+  i=0;
+  v1[i++]= svcopt;
+
+  int j= 1;
+  for(;j<n&&v[j][0]!='-';j++); // skip through to first option
+  for(;j<n;j++)
+    v1[i++]= v[j];
+  return my_daemon_makecmdv(i, (const char**)v1);
+}
+
+//returns -1: no install/remove, 0: success, +ve error
+int maybe_install_or_remove_service(int argc_,char**argv_,char*opts_remove,char*opts_install,char*default_name)
+{
+  if(argc_<2)
+    return -1;
+  char*svc=default_name,
+      *r[]={"-r","--remove",0},
+      *i[]={"-i","--install",0};
+  if(opts_remove||startswith(argv_[1],r)) {
+    if(opts_remove)
+      svc=(char*)opts_remove;
+    printf("Removing service \"%s\"\n",svc);
+    return my_daemon_remove(svc);
+  }
+  if(opts_install||startswith(argv_[1],i)) {
+    char *svc_cmd;
+    if(opts_install)
+      svc=(char*)opts_install;
+    svc_cmd= my_daemon_make_svc_cmd(argc_-1, argv_+1, svc);
+    if(!svc_cmd) {
+      fprintf(stderr, my_daemon_error);
+      return 1;
+    }
+    printf("Installing service \"%s\"\n",svc);
+    printf("as \"%s\"\n",svc_cmd);
+    return my_daemon_install(svc, svc_cmd);
+  }
+  return -1;
+}
+
+int my_daemon_install(const char *name, const char *cmd)
+{
+  SC_HANDLE svc= 0, scm= 0;
+
+  if(!g_ntsvc.SeekStatus(name, 1))
+    return ERR1("SeekStatus on %s failed\n", name);
+  if(!(scm= OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE)))
+    return ERR1("Failed to install the service: "
+               "Could not open Service Control Manager.\n");
+  if(!(svc= CreateService(scm, name, name,
+                          SERVICE_ALL_ACCESS,
+                          SERVICE_WIN32_OWN_PROCESS,
+                          (1 ? SERVICE_AUTO_START :
+                          SERVICE_DEMAND_START), SERVICE_ERROR_NORMAL,
+                          cmd, 0, 0, 0, 0, 0)))
+    return CloseServiceHandle(scm),
+           ERR1("Failed to install the service: "
+               "Couldn't create service)\n");
+  printf("Service successfully installed.\n");
+  CloseServiceHandle(svc);
+  CloseServiceHandle(scm);
+  return 0;
+}
+#endif
+static int pidfd, logfd;
+int daemon_closefiles()
+{
+  close(pidfd);
+  fclose(my_dlog);
+  return 0;
+}
+
+static const char *pidfile, *logfile;
+int my_daemon_prefiles(const char *pidfil, const char *logfil)
+{
+  int n;
+  char buf[64];
+
+  my_dlog= 0;
+  pidfile= pidfil;
+  logfile= logfil;
+  pidfd= logfd= -1;
+  /* open log file before becoming daemon */
+  if (logfile != NULL)
+  {
+    logfd= open(logfile, O_CREAT | O_WRONLY | O_APPEND, 0644);
+    if(logfd == -1)
+      return ERR1("%s: open for write failed\n", logfile);
+    my_dlog= fdopen(logfd, "a");
+  }
+  /* Check that we have write access to lock file */
+  assert(pidfile != NULL);
+  pidfd= open(pidfile, O_CREAT | O_RDWR, 0644);
+  if(pidfd == -1)
+    return ERR1("%s: open for write failed\n", pidfile);
+  /* Read any old pid from lock file */
+  n= read(pidfd, buf, sizeof(buf));
+  if(n < 0)
+    return ERR1("%s: read failed\n", pidfile);
+  buf[n]= 0;
+  daemonpid= atol(buf);
+  if(lseek(pidfd, 0, SEEK_SET) == -1)
+    return ERR1("%s: lseek failed\n", pidfile);
+#ifdef __WIN__                  //TODO: add my_lockf.c with these definitions
+#define lockf _locking
+#define F_TLOCK _LK_NBLCK
+#define F_ULOCK _LK_UNLCK
+#define F_LOCK  _LK_LOCK
+#endif
+#ifdef F_TLOCK
+  /* Test for lock before becoming daemon */
+  if(lockf(pidfd, F_TLOCK, 0) == -1)
+    if(errno == EACCES || errno == EAGAIN)
+      return ERR1("pidfile: already locked by pid=%ld\n", daemonpid);
+  if(lockf(pidfd, F_ULOCK, 0) == -1)
+    return ERR1("%s: fail to unlock\n", pidfile);
+#endif
+  return 0;
+}
+
+int my_daemon_files()
+{
+  int n;
+  char buf[64];
+  /* Running in child process */
+  daemonpid= getpid();
+#ifdef F_TLOCK
+  /* Lock the lock file (likely to succeed due to test above) */
+  if(lockf(pidfd, F_LOCK, 0) == -1)
+    return ERR1("%s: lock failed\n", pidfile);
+#endif
+#ifndef _WIN32
+  /* Become process group leader */
+  if(setsid()==-1)
+    return ERR1("setsid failed\n");
+#endif
+  /* Write pid to lock file */
+  if(IF_WIN(_chsize, ftruncate)(pidfd, 0) == -1)
+    return ERR1("%s: ftruncate failed\n", pidfile);
+  n= my_sprintf(buf, (buf, "%ld\n", daemonpid));
+  if(write(pidfd, buf, n) != n)
+    return ERR1("%s: write failed\n", pidfile);
+  /* Do input/output redirections (assume fd 0,1,2 not in use) */
+  close(0);
+  const char* fname=IF_WIN("nul:", "/dev/null");
+  if(open(fname, O_RDONLY)==-1)
+    return ERR1("couldn't open %s\n", fname);
+#ifdef _WIN32 //no stdout/stderr on windows service
+  *stdout= *stderr= *my_dlog;
+#else
+  if (logfd != 0)
+  {
+    dup2(logfd, 1);
+    dup2(logfd, 2);
+    close(logfd);
+    my_dlog= stdout;
+  }
+#endif
+  return 0;
+}
+
+#ifdef _WIN32
+HANDLE hExitEvent;
+
+static int evtlog(char *s)
+{
+  HANDLE eventsrc;
+  int n= strlen(s);
+  char *msg= (char*)my_malloc(n + 1, MY_FAE);
+  char *ss[]= { msg };
+  my_snprintf(msg, n, "\n\n%s", s);
+  if(!(eventsrc= RegisterEventSource(0, daemon_name)))
+	  return 1;
+  if(!(ReportEvent(eventsrc, EVENTLOG_ERROR_TYPE, 0, 0, 0, 1, 0, (LPCSTR*)ss, 0)))
+	  return 1;
+  if(!(DeregisterEventSource(eventsrc)))
+	  return 1;
+  my_free(msg,MY_FAE);
+  return 0;
+}
+
+static DWORD WINAPI main_function(LPVOID x)
+{
+  g_ntsvc.SetRunning();
+  g_daemon.start(0);
+  return 0;
+}
+
+static int init()
+{
+  return !g_ntsvc.Init(daemon_name,main_function);
+}
+
+int my_daemon_remove(const char *name)
+{
+  return !g_ntsvc.Remove((LPCSTR)name);
+}
+#endif

=== modified file 'storage/ndb/src/common/util/NdbOut.cpp'
--- a/storage/ndb/src/common/util/NdbOut.cpp	2008-12-16 11:50:38 +0000
+++ b/storage/ndb/src/common/util/NdbOut.cpp	2009-01-29 17:16:09 +0000
@@ -20,6 +20,8 @@
 
 static FileOutputStream ndbouts_fileoutputstream(stdout);
 NdbOut ndbout(ndbouts_fileoutputstream);
+static FileOutputStream ndberrs_fileoutputstream(stderr);
+NdbOut ndberr(ndberrs_fileoutputstream);
 
 static const char * fms[] = {
   "%d", "0x%02x",      // Int8

=== modified file 'storage/ndb/src/common/util/OutputStream.cpp'
--- a/storage/ndb/src/common/util/OutputStream.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/common/util/OutputStream.cpp	2009-03-12 10:59:57 +0000
@@ -19,6 +19,23 @@
 #include <OutputStream.hpp>
 #include <socket_io.h>
 
+size_t my_vfprintf(FILE *f, const char* fmt, va_list ap)
+{
+  size_t size= 1024, len;
+  char *buf= (char*)malloc(size);
+  if(!buf)
+    return 0;
+  len= my_vsnprintf(buf, size, fmt, ap);
+  if(len >= size)
+  {
+    buf= (char*)realloc(buf, ++len);
+    len= my_vsnprintf(buf, len, fmt, ap);
+  }
+  len= fprintf(f, "%s", buf);
+  free(buf);
+  return len;
+}
+
 FileOutputStream::FileOutputStream(FILE * file){
   f = file;
 }
@@ -27,7 +44,7 @@ int
 FileOutputStream::print(const char * fmt, ...){
   va_list ap;
   va_start(ap, fmt);
-  const int ret = vfprintf(f, fmt, ap);
+  const int ret = my_vfprintf(f, fmt, ap);
   va_end(ap);
   return ret;
 }
@@ -36,7 +53,7 @@ int
 FileOutputStream::println(const char * fmt, ...){
   va_list ap;
   va_start(ap, fmt);
-  const int ret = vfprintf(f, fmt, ap);
+  const int ret = my_vfprintf(f, fmt, ap);
   va_end(ap);
   return ret + fprintf(f, "\n");
 }

=== modified file 'storage/ndb/src/kernel/CMakeLists.txt'
--- a/storage/ndb/src/kernel/CMakeLists.txt	2008-10-08 08:12:18 +0000
+++ b/storage/ndb/src/kernel/CMakeLists.txt	2009-03-04 14:54:30 +0000
@@ -75,6 +75,8 @@ LINK_LIBRARIES(ndbcmvmi
                ${NDB_SCI_LIBS})
 ADD_EXECUTABLE(ndbd
                main.cpp
+               ndbd.cpp
+               angel.cpp
                SimBlockList.cpp
               ../mgmsrv/ConfigInfo.cpp
               ../mgmsrv/Config.cpp

=== modified file 'storage/ndb/src/kernel/Makefile.am'
--- a/storage/ndb/src/kernel/Makefile.am	2009-03-03 14:32:21 +0000
+++ b/storage/ndb/src/kernel/Makefile.am	2009-03-12 10:59:57 +0000
@@ -25,8 +25,8 @@ if BUILD_NDBMTD
 ndbbin_PROGRAMS += ndbmtd
 endif
 
-ndbd_SOURCES = main.cpp SimBlockList.cpp
-ndbmtd_SOURCES = main.cpp SimBlockList.cpp
+ndbd_SOURCES = main.cpp ndbd.cpp angel.cpp SimBlockList.cpp
+ndbmtd_SOURCES = main.cpp ndbd.cpp angel.cpp SimBlockList.cpp
 
 include $(top_srcdir)/storage/ndb/config/type_kernel.mk.am
 

=== added file 'storage/ndb/src/kernel/angel.cpp'
--- a/storage/ndb/src/kernel/angel.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/angel.cpp	2009-03-05 06:40:53 +0000
@@ -0,0 +1,393 @@
+/* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+
+   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 */
+
+
+#include <ndb_global.h>
+#include <ndb_version.h>
+
+#include "angel.hpp"
+
+#include <NdbConfig.h>
+#include <NdbAutoPtr.hpp>
+#include <NdbDaemon.h>
+
+#include <ConfigRetriever.hpp>
+
+#include <EventLogger.hpp>
+extern EventLogger * g_eventLogger;
+
+#include "vm/SimBlockList.hpp"
+
+
+#define MAX_FAILED_STARTUPS 3
+// Flag set by child through SIGUSR1 to signal a failed startup
+static bool failed_startup_flag=false;
+// Counter for consecutive failed startups
+static Uint32 failed_startups=0;
+
+// child signalling failed restart
+extern "C"
+void
+handler_sigusr1(int signum)
+{
+  if (!failed_startup_flag)
+  {
+    failed_startups++;
+    failed_startup_flag=true;
+  }
+  g_eventLogger->info("Angel received ndbd startup failure count %u.", failed_startups);
+}
+
+
+// These are used already before fork if fetch_configuration() fails
+// (e.g. Unable to alloc node id).  Set them to something reasonable.
+FILE *child_info_file_r=stdin;
+FILE *child_info_file_w=stdout;
+
+#include <Properties.hpp>
+
+static int
+insert(const char * pair, Properties & p)
+{
+  BaseString tmp(pair);
+
+  tmp.trim(" \t\n\r");
+  Vector<BaseString> split;
+  tmp.split(split, ":=", 2);
+  if (split.size() != 2)
+    return -1;
+  p.put(split[0].trim().c_str(), split[1].trim().c_str());
+  return 0;
+}
+
+static int
+readChildInfo(Properties &info)
+{
+  fclose(child_info_file_w);
+  char buf[128];
+  while (fgets(buf, sizeof (buf), child_info_file_r))
+    insert(buf, info);
+  fclose(child_info_file_r);
+  return 0;
+}
+
+static bool
+get_int_property(Properties &info,
+                 const char *token, Uint32 *int_val)
+{
+  const char *str_val=0;
+  if (!info.get(token, &str_val))
+    return false;
+  char *endptr;
+  long int tmp=strtol(str_val, &endptr, 10);
+  if (str_val == endptr)
+    return false;
+  *int_val=tmp;
+  return true;
+}
+
+int reportShutdown(class Configuration *config, int error_exit, int restart, Uint32 sphase=256)
+{
+  Uint32 error=0, signum=0;
+#ifndef NDB_WIN
+  Properties info;
+  readChildInfo(info);
+
+  get_int_property(info, "signal", &signum);
+  get_int_property(info, "error", &error);
+  get_int_property(info, "sphase", &sphase);
+#endif
+  Uint32 length, theData[25];
+  EventReport *rep=(EventReport *) theData;
+
+  rep->setNodeId(globalData.ownId);
+  if (restart)
+    theData[1]=1 |
+          (globalData.theRestartFlag == initial_state ? 2 : 0) |
+    (config->getInitialStart() ? 4 : 0);
+  else
+    theData[1]=0;
+
+  if (error_exit == 0)
+  {
+    rep->setEventType(NDB_LE_NDBStopCompleted);
+    theData[2]=signum;
+    length=3;
+  } else
+  {
+    rep->setEventType(NDB_LE_NDBStopForced);
+    theData[2]=signum;
+    theData[3]=error;
+    theData[4]=sphase;
+    theData[5]=0; // extra
+    length=6;
+  }
+
+  { // Log event
+    const EventReport * const eventReport=(EventReport *) & theData[0];
+    g_eventLogger->log(eventReport->getEventType(), theData, length,
+                       eventReport->getNodeId(), 0);
+  }
+
+  for (unsigned n=0; n < config->m_mgmds.size(); n++)
+  {
+    NdbMgmHandle h=ndb_mgm_create_handle();
+    if (h == 0 ||
+        ndb_mgm_set_connectstring(h, config->m_mgmds[n].c_str()) ||
+        ndb_mgm_connect(h,
+                        1, //no_retries
+                        0, //retry_delay_in_seconds
+                        0 //verbose
+                        ))
+      goto handle_error;
+
+    {
+      if (ndb_mgm_report_event(h, theData, length))
+        goto handle_error;
+    }
+    goto do_next;
+
+handle_error:
+    if (h)
+    {
+      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());
+    } else
+    {
+      g_eventLogger->error("Unable to report shutdown reason to %s",
+                           config->m_mgmds[n].c_str());
+    }
+do_next:
+    if (h)
+    {
+      ndb_mgm_disconnect(h);
+      ndb_mgm_destroy_handle(&h);
+    }
+  }
+  return 0;
+}
+
+
+static void
+ignore_signals(void)
+{
+#ifndef NDB_WIN32
+  static const int ignore_list[] = {
+#ifdef SIGBREAK
+    SIGBREAK,
+#endif
+    SIGHUP,
+    SIGINT,
+#if defined SIGPWR
+    SIGPWR,
+#elif defined SIGINFO
+    SIGINFO,
+#endif
+    SIGQUIT,
+    SIGTERM,
+#ifdef SIGTSTP
+    SIGTSTP,
+#endif
+    SIGTTIN,
+    SIGTTOU,
+    SIGABRT,
+    SIGALRM,
+#ifdef SIGBUS
+    SIGBUS,
+#endif
+    SIGFPE,
+    SIGILL,
+#ifdef SIGIO
+    SIGIO,
+#endif
+#ifdef SIGPOLL
+    SIGPOLL,
+#endif
+    SIGSEGV,
+    SIGPIPE,
+#ifdef SIGTRAP
+    SIGTRAP
+#endif
+  };
+
+  for(size_t i = 0; i < sizeof(ignore_list)/sizeof(ignore_list[0]); i++)
+    signal(ignore_list[i], SIG_IGN);
+#endif
+}
+
+void
+childReportSignal(int signum);
+
+int
+angel_run(const char* connect_str,
+          const char* bind_address,
+          bool initialstart,
+          bool daemon)
+{
+#ifdef NDB_WIN32
+  return 1;
+#else
+  if (daemon)
+  {
+    // Become a daemon
+    char *lockfile=NdbConfig_PidFileName(globalData.ownId);
+    char *logfile=NdbConfig_StdoutFileName(globalData.ownId);
+    NdbAutoPtr<char> tmp_aptr1(lockfile), tmp_aptr2(logfile);
+
+#ifndef NDB_WIN32
+    if (NdbDaemon_Make(lockfile, logfile, 0) == -1)
+    {
+      ndbout << "Cannot become daemon: " << NdbDaemon_ErrorText << endl;
+      return 1;
+    }
+#endif
+  }
+
+  signal(SIGUSR1, handler_sigusr1);
+
+  pid_t child= -1;
+  while (true)
+  {
+    // setup reporting between child and parent
+    int filedes[2];
+    if (pipe(filedes))
+    {
+      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));
+      }
+      if (!(child_info_file_r=fdopen(filedes[0], "r")))
+      {
+        g_eventLogger->error("fdopen() failed with errno=%d (%s)",
+                             errno, strerror(errno));
+      }
+    }
+
+    if ((child=fork()) <= 0)
+      break; // child or error
+
+    /**
+     * Parent
+     */
+
+    ignore_signals();
+
+    /**
+     * We no longer need the mgm connection in this process
+     * (as we are the angel, not ndb)
+     *
+     * We don't want to purge any allocated resources (nodeid), so
+     * we set that option to false
+     */
+    Configuration* theConfig = globalEmulatorData.theConfiguration;
+    theConfig->closeConfiguration(false);
+
+    int status=0, error_exit=0, signum=0;
+    while (waitpid(child, &status, 0) != child);
+    if (WIFEXITED(status))
+    {
+      switch (WEXITSTATUS(status)) {
+      case NRT_Default:
+        g_eventLogger->info("Angel shutting down");
+        reportShutdown(theConfig, 0, 0);
+        exit(0);
+        break;
+      case NRT_NoStart_Restart:
+        theConfig->setInitialStart(false);
+        globalData.theRestartFlag=initial_state;
+        break;
+      case NRT_NoStart_InitialStart:
+        theConfig->setInitialStart(true);
+        globalData.theRestartFlag=initial_state;
+        break;
+      case NRT_DoStart_InitialStart:
+        theConfig->setInitialStart(true);
+        globalData.theRestartFlag=perform_start;
+        break;
+      default:
+        error_exit=1;
+        if (theConfig->stopOnError())
+        {
+          /**
+           * Error shutdown && stopOnError()
+           */
+          reportShutdown(theConfig, error_exit, 0);
+          exit(0);
+        }
+        // Fall-through
+      case NRT_DoStart_Restart:
+        theConfig->setInitialStart(false);
+        globalData.theRestartFlag=perform_start;
+        break;
+      }
+    } else
+    {
+      error_exit=1;
+      if (WIFSIGNALED(status))
+      {
+        signum=WTERMSIG(status);
+        childReportSignal(signum);
+      } else
+      {
+        signum=127;
+        g_eventLogger->info("Unknown exit reason. Stopped.");
+      }
+      if (theConfig->stopOnError())
+      {
+        /**
+         * Error shutdown && stopOnError()
+         */
+        reportShutdown(theConfig, error_exit, 0);
+        exit(0);
+      }
+    }
+
+    if (!failed_startup_flag)
+    {
+      // Reset the counter for consecutive failed startups
+      failed_startups=0;
+    } else if (failed_startups >= MAX_FAILED_STARTUPS && !theConfig->stopOnError())
+    {
+      /**
+       * Error shutdown && stopOnError()
+       */
+      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);
+    theConfig->fetch_configuration(connect_str, bind_address);
+  }
+
+  if (child >= 0)
+    g_eventLogger->info("Angel pid: %d ndb pid: %d", getppid(), getpid());
+  else if (child > 0)
+    g_eventLogger->info("Ndb pid: %d", getpid());
+
+  return 0;
+#endif
+}

=== added file 'storage/ndb/src/kernel/angel.hpp'
--- a/storage/ndb/src/kernel/angel.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/angel.hpp	2009-03-04 14:54:30 +0000
@@ -0,0 +1,23 @@
+/* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+
+   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 */
+
+#ifndef ANGEL_HPP
+#define ANGEL_HPP
+
+int angel_run(const char* connect_str,
+              const char* bind_address,
+              bool initialstart,
+              bool daemon);
+#endif

=== modified file 'storage/ndb/src/kernel/blocks/ERROR_codes.txt'
--- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt	2009-01-29 16:49:19 +0000
+++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt	2009-03-12 10:59:57 +0000
@@ -631,6 +631,13 @@ Dbdict:
 6014 Master failure during commit
 6015 Master failure after commit
 
+6022 Cluster failure before flush prepare
+6021 Cluster failure before prepare first
+6016
+6017 Cluster failure before flush commit
+6018 Cluster failure before commit first
+6019 Cluster failure before flush complete
+6020 Cluster failure before complete first
 
 6200 Set error code after handleTabInfoInit in master
 6201 Set error code after handleTabInfoInit in master (index)

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2009-01-30 13:07:48 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp	2009-03-12 06:52:39 +0000
@@ -17,8 +17,7 @@
 #include "LocalProxy.hpp"
 
 LocalProxy::LocalProxy(BlockNumber blockNumber, Block_context& ctx) :
-  SimulatedBlock(blockNumber, ctx),
-  c_nodeList(c_nodePool)
+  SimulatedBlock(blockNumber, ctx)
 {
   BLOCK_CONSTRUCTOR(LocalProxy);
 
@@ -34,7 +33,6 @@ LocalProxy::LocalProxy(BlockNumber block
 
   c_typeOfStart = NodeState::ST_ILLEGAL_TYPE;
   c_masterNodeId = ZNIL;
-  c_nodePool.setSize(MAX_NDB_NODES);
 
   // GSN_READ_CONFIG_REQ
   addRecSignal(GSN_READ_CONFIG_REQ, &LocalProxy::execREAD_CONFIG_REQ, true);
@@ -486,33 +484,6 @@ LocalProxy::execREAD_NODESCONF(Signal* s
 
   const ReadNodesConf* conf = (const ReadNodesConf*)signal->getDataPtr();
 
-  ndbrequire(c_nodePool.getNoOfFree() == c_nodePool.getSize());
-  Uint32 count = 0;
-  Uint32 i;
-  for (i = 0; i < MAX_NDB_NODES; i++) {
-    if (NdbNodeBitmask::get(conf->allNodes, i)) {
-      jam();
-      count++;
-
-      NodePtr nodePtr;
-      bool ok = c_nodePool.seize(nodePtr);
-      ndbrequire(ok);
-      new (nodePtr.p) Node;
-
-      nodePtr.p->m_nodeId = i;
-      if (NdbNodeBitmask::get(conf->inactiveNodes, i)) {
-        jam();
-        nodePtr.p->m_alive = false;
-      } else {
-        jam();
-        nodePtr.p->m_alive = true;
-      }
-
-      c_nodeList.addLast(nodePtr);
-    }
-  }
-  ndbrequire(count != 0 && count == conf->noOfNodes);
-
   c_masterNodeId = conf->masterNodeId;
 
   switch (ss.m_gsn) {
@@ -551,20 +522,6 @@ LocalProxy::execNODE_FAILREP(Signal* sig
   NdbNodeBitmask mask;
   mask.assign(NdbNodeBitmask::Size, req->theNodes);
 
-  // proxy itself
-  NodePtr nodePtr;
-  c_nodeList.first(nodePtr);
-  ndbrequire(nodePtr.i != RNIL);
-  while (nodePtr.i != RNIL)
-  {
-    if (NdbNodeBitmask::get(req->theNodes, nodePtr.p->m_nodeId))
-    {
-      jam();
-      nodePtr.p->m_alive = false;
-    }
-    c_nodeList.next(nodePtr);
-  }
-
   // from each worker wait for ack for each failed node
   for (Uint32 i = 0; i < c_workers; i++)
   {
@@ -597,6 +554,7 @@ LocalProxy::execNF_COMPLETEREP(Signal* s
 {
   Ss_NODE_FAILREP& ss = ssFind<Ss_NODE_FAILREP>(1);
   ndbrequire(!ss.noReply(number()));
+  ss.m_workerMask.set(ss.m_worker); // Avoid require in recvCONF
   recvCONF(signal, ss);
 }
 
@@ -652,20 +610,6 @@ LocalProxy::execINCL_NODEREQ(Signal* sig
   ndbrequire(sizeof(ss.m_req) >= (ss.m_reqlength << 2));
   memcpy(&ss.m_req, signal->getDataPtr(), ss.m_reqlength << 2);
 
-  // proxy itself
-  NodePtr nodePtr;
-  c_nodeList.first(nodePtr);
-  ndbrequire(nodePtr.i != RNIL);
-  while (nodePtr.i != RNIL) {
-    jam();
-    if (ss.m_req.inclNodeId == nodePtr.p->m_nodeId) {
-      jam();
-      ndbrequire(!nodePtr.p->m_alive);
-      nodePtr.p->m_alive = true;
-    }
-    c_nodeList.next(nodePtr);
-  }
-
   sendREQ(signal, ss);
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.hpp	2009-01-30 13:07:48 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.hpp	2009-03-12 06:52:39 +0000
@@ -304,23 +304,6 @@ protected:
   Uint32 c_typeOfStart;
   Uint32 c_masterNodeId;
 
-  struct Node {
-    Uint32 m_nodeId;
-    bool m_alive;
-    Node() {
-      m_nodeId = 0;
-      m_alive = false;
-    }
-    Uint32 nextList;
-    union {
-    Uint32 prevList;
-    Uint32 nextPool;
-    };
-  };
-  typedef Ptr<Node> NodePtr;
-  ArrayPool<Node> c_nodePool;
-  DLFifoList<Node> c_nodeList;
-
   // GSN_READ_CONFIG_REQ
   struct Ss_READ_CONFIG_REQ : SsSequential {
     ReadConfigReq m_req;

=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2009-01-28 10:11:04 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2009-03-12 10:59:57 +0000
@@ -546,7 +546,7 @@ Backup::execDUMP_STATE_ORD(Signal* signa
      */
     BackupRecordPtr ptr LINT_SET_PTR;
     for(c_backups.first(ptr); ptr.i != RNIL; c_backups.next(ptr)){
-      infoEvent("BackupRecord %d: BackupId: %d MasterRef: %x ClientRef: %x",
+      infoEvent("BackupRecord %d: BackupId: %u MasterRef: %x ClientRef: %x",
 		ptr.i, ptr.p->backupId, ptr.p->masterRef, ptr.p->clientRef);
       infoEvent(" State: %d", ptr.p->slaveState.getState());
       BackupFilePtr filePtr;
@@ -839,7 +839,7 @@ Backup::execBACKUP_CONF(Signal* signal)
   jamEntry();
   BackupConf * conf = (BackupConf*)signal->getDataPtr();
   
-  ndbout_c("Backup %d has started", conf->backupId);
+  ndbout_c("Backup %u has started", conf->backupId);
 }
 
 void
@@ -848,7 +848,7 @@ Backup::execBACKUP_REF(Signal* signal)
   jamEntry();
   BackupRef * ref = (BackupRef*)signal->getDataPtr();
 
-  ndbout_c("Backup (%d) has NOT started %d", ref->senderData, ref->errorCode);
+  ndbout_c("Backup (%u) has NOT started %d", ref->senderData, ref->errorCode);
 }
 
 void
@@ -859,7 +859,7 @@ Backup::execBACKUP_COMPLETE_REP(Signal* 
  
   startTime = NdbTick_CurrentMillisecond() - startTime;
   
-  ndbout_c("Backup %d has completed", rep->backupId);
+  ndbout_c("Backup %u has completed", rep->backupId);
   const Uint64 bytes =
     rep->noOfBytesLow + (((Uint64)rep->noOfBytesHigh) << 32);
   const Uint64 records =
@@ -891,7 +891,7 @@ Backup::execBACKUP_ABORT_REP(Signal* sig
   jamEntry();
   BackupAbortRep* rep = (BackupAbortRep*)signal->getDataPtr();
   
-  ndbout_c("Backup %d has been aborted %d", rep->backupId, rep->reason);
+  ndbout_c("Backup %u has been aborted %d", rep->backupId, rep->reason);
 }
 
 const TriggerEvent::Value triggerEventValues[] = {
@@ -3336,18 +3336,25 @@ Backup::openFilesReply(Signal* signal, 
 
   if (ERROR_INSERTED(10037)) {
     jam();
-    ptr.p->errorCode = DefineBackupRef::FailedForBackupFilesAleadyExist;
+    /**
+     * Dont return FailedForBackupFilesAleadyExist
+     * cause this will make NdbBackup auto-retry with higher number :-)
+     */
+    ptr.p->errorCode = DefineBackupRef::FailedInsertFileHeader;
     defineBackupRef(signal, ptr);
     return;
   }
   /**
    * Did open succeed for all files
    */
-  if(ptr.p->checkError()) {
+  if(ptr.p->checkError()) 
+  {
     jam();
     if(ptr.p->errorCode == FsRef::fsErrFileExists)
+    {
+      jam();
       ptr.p->errorCode = DefineBackupRef::FailedForBackupFilesAleadyExist;
-
+    }
     defineBackupRef(signal, ptr);
     return;
   }//if

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2008-11-08 21:43:03 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2009-02-23 11:29:52 +0000
@@ -43,6 +43,8 @@
 #include <NdbSleep.h>
 #include <SafeCounter.hpp>
 
+#define ZREPORT_MEMORY_USAGE 1000
+
 // Used here only to print event reports on stdout/console.
 extern EventLogger * g_eventLogger;
 extern int simulate_error_during_shutdown;
@@ -99,6 +101,8 @@ Cmvmi::Cmvmi(Block_context& ctx) :
 
   addRecSignal(GSN_TESTSIG, &Cmvmi::execTESTSIG);
   addRecSignal(GSN_NODE_START_REP, &Cmvmi::execNODE_START_REP, true);
+
+  addRecSignal(GSN_CONTINUEB, &Cmvmi::execCONTINUEB);
   
   subscriberPool.setSize(5);
   
@@ -136,6 +140,8 @@ Cmvmi::Cmvmi(Block_context& ctx) :
   setNodeInfo(getOwnNodeId()).m_connected = true;
   setNodeInfo(getOwnNodeId()).m_version = ndbGetOwnVersion();
   setNodeInfo(getOwnNodeId()).m_mysql_version = NDB_MYSQL_VERSION_D;
+
+  c_memusage_report_frequency = 0;
 }
 
 Cmvmi::~Cmvmi()
@@ -377,12 +383,21 @@ Cmvmi::execREAD_CONFIG_REQ(Signal* signa
     void* ptr = m_ctx.m_mm.get_memroot();
     m_shared_page_pool.set((GlobalPage*)ptr, ~0);
   }
-  
+
   ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
   conf->senderData = senderData;
   sendSignal(ref, GSN_READ_CONFIG_CONF, signal, 
 	     ReadConfigConf::SignalLength, JBB);
+
+  c_memusage_report_frequency = 0;
+  ndb_mgm_get_int_parameter(p, CFG_DB_MEMREPORT_FREQUENCY, 
+                            &c_memusage_report_frequency);
+  
+  signal->theData[0] = ZREPORT_MEMORY_USAGE;
+  signal->theData[1] = 0;
+  signal->theData[2] = 3;
+  execCONTINUEB(signal);
 }
 
 void Cmvmi::execSTTOR(Signal* signal)
@@ -395,6 +410,12 @@ void Cmvmi::execSTTOR(Signal* signal)
 
     if(m_ctx.m_config.lockPagesInMainMemory() == 1)
     {
+      jam();
+      /**
+       * Notify watchdog that we're locking memory...
+       *   which can be equally "heavy" as allocating it
+       */
+      refresh_watch_dog(9);
       int res = NdbMem_MemLockAll(0);
       if(res != 0){
         g_eventLogger->warning("Failed to memlock pages");
@@ -402,6 +423,19 @@ void Cmvmi::execSTTOR(Signal* signal)
       }
     }
     
+    /**
+     * Install "normal" watchdog value
+     */
+    {
+      Uint32 db_watchdog_interval = 0;
+      const ndb_mgm_configuration_iterator * p = 
+        m_ctx.m_config.getOwnConfigIterator();
+      ndb_mgm_get_int_parameter(p, CFG_DB_WATCHDOG_INTERVAL, 
+                                &db_watchdog_interval);
+      ndbrequire(db_watchdog_interval);
+      update_watch_dog_timer(db_watchdog_interval);
+    }
+    
     sendSTTORRY(signal);
     return;
   } else if (theStartPhase == 3) {
@@ -1046,6 +1080,8 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal
       signal->theData[1] = 0;
       signal->theData[2] = ~0;
       sendSignal(reference(), GSN_DUMP_STATE_ORD, signal, 3, JBB);
+
+      reportDMUsage(signal, 0);
       return;
     }
     Uint32 id = signal->theData[1];
@@ -1616,3 +1652,70 @@ Cmvmi::sendFragmentedComplete(Signal* si
     }
   }
 }
+
+void
+Cmvmi::execCONTINUEB(Signal* signal)
+{
+  switch(signal->theData[0]){
+  case ZREPORT_MEMORY_USAGE:
+  {
+    jam();
+    Uint32 cnt = signal->theData[1];
+    Uint32 usedLast = signal->theData[2];
+
+    Resource_limit rl;
+    m_ctx.m_mm.get_resource_limit(RG_DATAMEM, rl);
+
+    Uint32 tmp = rl.m_min;
+    Uint32 now = tmp ? (rl.m_curr * 100)/tmp : 0;
+    static const Uint32 thresholds[] = { 100, 90, 80, 0 };
+    
+    Uint32 i = 0;
+    const Uint32 sz = sizeof(thresholds)/sizeof(thresholds[0]);
+    for(i = 0; i<sz; i++)
+    {
+      if(now >= thresholds[i])
+      {
+	now = thresholds[i];
+	break;
+      }
+    }
+    
+    if(now != usedLast || 
+       (c_memusage_report_frequency && cnt + 1 == c_memusage_report_frequency))
+    {
+      jam();
+      reportDMUsage(signal, 
+                    now > usedLast ? 1 : 
+                    now < usedLast ? -1 : 0);
+      cnt = 0;
+      usedLast = 0;
+    } 
+    else
+    {
+      jam();
+      cnt++;
+    }
+    signal->theData[0] = ZREPORT_MEMORY_USAGE;
+    signal->theData[1] = cnt; // seconds since last report
+    signal->theData[2] = usedLast; // last threshold
+    sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 3);
+    return;
+  }
+  }
+}
+
+void
+Cmvmi::reportDMUsage(Signal* signal, int incDec)
+{
+  Resource_limit rl;
+  m_ctx.m_mm.get_resource_limit(RG_DATAMEM, rl);
+  
+  signal->theData[0] = NDB_LE_MemoryUsage;
+  signal->theData[1] = incDec;
+  signal->theData[2] = sizeof(GlobalPage);
+  signal->theData[3] = rl.m_curr;
+  signal->theData[4] = rl.m_min;
+  signal->theData[5] = DBTUP;
+  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 6, JBB);
+}

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp	2008-05-23 09:26:56 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp	2009-02-11 15:07:28 +0000
@@ -66,6 +66,8 @@ private:
 
   void execTESTSIG(Signal* signal);
   void execNODE_START_REP(Signal* signal);
+
+  void execCONTINUEB(Signal* signal);
   
   char theErrorMessage[256];
   void sendSTTORRY(Signal* signal);
@@ -112,6 +114,9 @@ private:
   void operator = (const Cmvmi &);
 
   void sendFragmentedComplete(Signal* signal, Uint32 data, Uint32 returnCode);
+
+  Uint32 c_memusage_report_frequency;
+  void reportDMUsage(Signal* signal, int incDec);
 };
 
 #endif

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-12-19 13:17:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-02-19 12:56:59 +0000
@@ -4271,7 +4271,7 @@ void Dbdict::printTables()
   DLHashTable<DictObject>::Iterator iter;
   bool moreTables = c_obj_hash.first(iter);
   printf("OBJECTS IN DICT:\n");
-  char name[MAX_TAB_NAME_SIZE];
+  char name[PATH_MAX];
   while (moreTables) {
     Ptr<DictObject> tablePtr = iter.curr;
     ConstRope r(c_rope_pool, tablePtr.p->m_name);
@@ -8967,7 +8967,7 @@ void Dbdict::execGET_TABLEDID_REQ(Signal
   Uint32 senderRef = req->senderRef;
   Uint32 len = req->len;
 
-  if(len>MAX_TAB_NAME_SIZE)
+  if(len>PATH_MAX)
   {
     jam();
     sendGET_TABLEID_REF((Signal*)signal, 
@@ -8976,7 +8976,7 @@ void Dbdict::execGET_TABLEDID_REQ(Signal
     return;
   }
 
-  char tableName[MAX_TAB_NAME_SIZE];
+  char tableName[PATH_MAX];
   SectionHandle handle(this, signal);
   SegmentedSectionPtr ssPtr;
   handle.getSection(ssPtr,GetTableIdReq::TABLE_NAME);
@@ -9081,14 +9081,14 @@ void Dbdict::execGET_TABINFOREQ(Signal* 
     ndbrequire(handle.m_cnt == 1);
     const Uint32 len = req->tableNameLen;
     
-    if(len > MAX_TAB_NAME_SIZE){
+    if(len > PATH_MAX){
       jam();
       releaseSections(handle);
       sendGET_TABINFOREF(signal, req, GetTabInfoRef::TableNameTooLong, __LINE__);
       return;
     }
 
-    Uint32 tableName[(MAX_TAB_NAME_SIZE + 3) / 4];
+    Uint32 tableName[(PATH_MAX + 3) / 4];
     SegmentedSectionPtr ssPtr;
     handle.getSection(ssPtr,GetTabInfoReq::TABLE_NAME);
     copy(tableName, ssPtr);
@@ -9458,7 +9458,7 @@ void Dbdict::sendOLD_LIST_TABLES_CONF(Si
       pos = 0;
     }
     Uint32 i = 0;
-    char tmp[MAX_TAB_NAME_SIZE];
+    char tmp[PATH_MAX];
     name.copy(tmp);
     while (i < size) {
       char* p = (char*)&conf->tableData[pos];
@@ -9518,7 +9518,7 @@ void Dbdict::sendLIST_TABLES_CONF(Signal
    */
   ListTablesData ltd;
   const Uint32 listTablesDataSizeInWords = (sizeof(ListTablesData) + 3) / 4;
-  char tname[MAX_TAB_NAME_SIZE];
+  char tname[PATH_MAX];
   SimplePropertiesSectionWriter tableDataWriter(* this);
   SimplePropertiesSectionWriter tableNamesWriter(* this);
 
@@ -18458,6 +18458,31 @@ Dbdict::createFile_parse(Signal* signal,
     return;
   }
 
+  /**
+   * auto-connect
+   */
+  if (f.FilegroupId == RNIL && f.FilegroupVersion == RNIL)
+  {
+    jam();
+    Filegroup_hash::Iterator it;
+    c_filegroup_hash.first(it);
+    while (!it.isNull())
+    {
+      jam();
+      if ((f.FileType == DictTabInfo::Undofile &&
+           it.curr.p->m_type == DictTabInfo::LogfileGroup) ||
+          (f.FileType == DictTabInfo::Datafile &&
+           it.curr.p->m_type == DictTabInfo::Tablespace))
+      {
+        jam();
+        f.FilegroupId = it.curr.p->key;
+        f.FilegroupVersion = it.curr.p->m_version;
+        break;
+      }
+      c_filegroup_hash.next(it);
+    }
+  }
+
   // Get Filegroup
   FilegroupPtr fg_ptr;
   if(!c_filegroup_hash.find(fg_ptr, f.FilegroupId))
@@ -18823,7 +18848,7 @@ Dbdict::createFile_fromWriteObjInfo(Sign
     ndbrequire(false);
   }
 
-  char name[MAX_TAB_NAME_SIZE];
+  char name[PATH_MAX];
   ConstRope tmp(c_rope_pool, f_ptr.p->m_path);
   tmp.copy(name);
   LinearSectionPtr ptr[3];
@@ -19120,6 +19145,21 @@ Dbdict::createFilegroup_parse(Signal* si
       setError(error, CreateFilegroupRef::InvalidExtentSize, __LINE__);
       return;
     }
+
+    /**
+     * auto-connect
+     */
+    if (fg.TS_LogfileGroupId == RNIL && fg.TS_LogfileGroupVersion == RNIL)
+    {
+      jam();
+      Filegroup_hash::Iterator it;
+      if (c_filegroup_hash.first(it))
+      {
+        jam();
+        fg.TS_LogfileGroupId = it.curr.p->key;
+        fg.TS_LogfileGroupVersion = it.curr.p->m_version;
+      }
+    }
   }
   else if(fg.FilegroupType == DictTabInfo::LogfileGroup)
   {
@@ -22871,6 +22911,15 @@ Dbdict::trans_prepare_start(Signal* sign
     CRASH_INSERTION(6013);
   }
 
+  if (ERROR_INSERTED(6022))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   if (ERROR_INSERTED(6142))
   {
     /*
@@ -22903,6 +22952,15 @@ Dbdict::trans_prepare_start(Signal* sign
 void
 Dbdict::trans_prepare_first(Signal* signal, SchemaTransPtr trans_ptr)
 {
+  if (ERROR_INSERTED(6021))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   trans_ptr.p->m_state = SchemaTrans::TS_PREPARING;
 
   SchemaOpPtr op_ptr;
@@ -23560,6 +23618,15 @@ void Dbdict::check_partial_trans_commit_
 void
 Dbdict::trans_commit_start(Signal* signal, SchemaTransPtr trans_ptr)
 {
+  if (ERROR_INSERTED(6016) || ERROR_INSERTED(6017))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   trans_ptr.p->m_state = SchemaTrans::TS_FLUSH_COMMIT;
 
   trans_ptr.p->m_nodes.bitAND(c_aliveNodes);
@@ -23606,6 +23673,16 @@ void
 Dbdict::trans_commit_first(Signal* signal, SchemaTransPtr trans_ptr)
 {
   jam();
+
+  if (ERROR_INSERTED(6018))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
 #ifdef MARTIN
   ndbout_c("trans_commit");
 #endif
@@ -23915,6 +23992,16 @@ void
 Dbdict::trans_complete_start(Signal* signal, SchemaTransPtr trans_ptr)
 {
   jam();
+
+  if (ERROR_INSERTED(6019))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
 #ifdef MARTIN
   ndbout_c("trans_complete_start %u", trans_ptr.p->trans_key);
 #endif
@@ -23964,6 +24051,16 @@ void
 Dbdict::trans_complete_first(Signal * signal, SchemaTransPtr trans_ptr)
 {
   jam();
+
+  if (ERROR_INSERTED(6020))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   trans_ptr.p->m_state = SchemaTrans::TS_COMPLETING;
 
   bool first = false;
@@ -26245,7 +26342,7 @@ Dbdict::DictObject::print(NdbOut& out) c
   out << " (DictObject";
   out << dec << V(m_id);
   out << dec << V(m_type);
-  out << " name:" << dict->copyRope<MAX_TAB_NAME_SIZE>(m_name);
+  out << " name:" << dict->copyRope<PATH_MAX>(m_name);
   out << dec << V(m_ref_count);
   out << dec << V(m_trans_key);
   out << dec << V(m_op_ref_count);
@@ -26353,7 +26450,7 @@ Dbdict::TxHandle::print(NdbOut& out) con
 // check consistency when no schema trans is active
 
 #undef SZ
-#define SZ MAX_TAB_NAME_SIZE
+#define SZ PATH_MAX
 
 void
 Dbdict::check_consistency()

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2008-11-28 13:16:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp	2009-03-11 16:26:58 +0000
@@ -25,6 +25,7 @@
 #include <signaldata/MasterLCP.hpp>
 #include <signaldata/CopyGCIReq.hpp>
 #include <blocks/mutexes.hpp>
+#include <signaldata/LCP.hpp>
 
 #ifdef DBDIH_C
 
@@ -715,7 +716,6 @@ private:
   void updateToReq_fragmentMutex_locked(Signal*, Uint32, Uint32);
 
   MutexHandle2<DIH_FRAGMENT_INFO> c_fragmentInfoMutex_lcp;
-  MutexHandle2<DIH_FRAGMENT_INFO> c_fragmentInfoMutex_copyTab;
 
   void execBLOCK_COMMIT_ORD(Signal *);
   void execUNBLOCK_COMMIT_ORD(Signal *);
@@ -976,6 +976,7 @@ private:
   void ndbsttorry10Lab(Signal *, Uint32 _line);
   void createMutexes(Signal* signal, Uint32 no);
   void createMutex_done(Signal* signal, Uint32 no, Uint32 retVal);
+  void dumpGcpStop();
   void crashSystemAtGcpStop(Signal *, bool);
   void sendFirstDictfragsreq(Signal *, TabRecordPtr regTabPtr);
   void addtabrefuseLab(Signal *, ConnectRecordPtr regConnectPtr, Uint32 errorCode);
@@ -1447,6 +1448,7 @@ private:
     
     Uint64 m_start_time; // When last LCP was started
     Uint64 m_lcp_time;   // How long last LCP took
+    Uint32 m_lcp_trylock_timeout;
 
     struct CurrentFragment {
       Uint32 tableId;
@@ -1791,6 +1793,40 @@ private:
 
   void startme_copygci_conf(Signal*);
 
+  /**
+   * Local LCP state
+   *   This struct is more or less a copy of lcp-state
+   *   Reason for duplicating it is that
+   *   - not to mess with current code
+   *   - this one is "distributed", i.e maintained by *all* nodes,
+   *     not like c_lcpState which mixed master/slave state in a "unnatural"
+   *     way
+   */
+  struct LocalLCPState
+  {
+    enum State {
+      LS_INITIAL = 0,
+      LS_RUNNING = 1,
+      LS_COMPLETE = 2
+    } m_state;
+    
+    StartLcpReq m_start_lcp_req;
+    Uint32 m_keep_gci; // Min GCI is needed to restore LCP
+    Uint32 m_stop_gci; // This GCI needs to be complete before LCP is restorable
+
+    LocalLCPState() { reset();}
+    
+    void reset();
+    void init(const StartLcpReq*);
+    void lcp_frag_rep(const LcpFragRep*);
+    void lcp_complete_rep(Uint32 gci);
+    
+    /**
+     * @param gci - current GCI being made restorable (COPY_GCI)
+     */
+    bool check_cut_log_tail(Uint32 gci) const;
+  } m_local_lcp_state;
+
   // MT LQH
   Uint32 c_fragments_per_node;
   Uint32 dihGetInstanceKey(FragmentstorePtr tFragPtr) {

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp	2008-10-01 06:47:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihInit.cpp	2009-02-20 10:36:15 +0000
@@ -61,6 +61,7 @@ void Dbdih::initData() 
 
   cgcpOrderBlocked = 0;
   c_lcpState.ctcCounter = 0;
+  c_lcpState.m_lcp_trylock_timeout = 0;
   cwaitLcpSr       = false;
   c_blockCommit    = false;
   c_blockCommitNo  = 1;

=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2009-02-11 12:11:18 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp	2009-03-12 11:06:48 +0000
@@ -633,6 +633,24 @@ void Dbdih::execCONTINUEB(Signal* signal
     wait_old_scan(signal);
     return;
   }
+  case DihContinueB::ZLCP_TRY_LOCK:
+  {
+    jam();
+    Mutex mutex(signal, c_mutexMgr, c_fragmentInfoMutex_lcp);
+    Callback c = { safe_cast(&Dbdih::lcpFragmentMutex_locked), 
+                   signal->theData[1] };
+    ndbrequire(mutex.trylock(c, false));
+    return;
+  }
+  case DihContinueB::ZDELAY_RELEASE_FRAGMENT_INFO_MUTEX:
+  {
+    jam();
+    MutexHandle2<DIH_FRAGMENT_INFO> mh;
+    mh.setHandle(signal->theData[1]);
+    Mutex mutex(signal, c_mutexMgr, mh);
+    mutex.unlock();
+    return;
+  }
   }//switch
   
   ndbrequire(false);
@@ -709,6 +727,28 @@ done:  
   CRASH_INSERTION2(7020, reason==CopyGCIReq::LOCAL_CHECKPOINT);
   CRASH_INSERTION2(7008, reason==CopyGCIReq::GLOBAL_CHECKPOINT);
 
+  if (m_local_lcp_state.check_cut_log_tail(c_newest_restorable_gci))
+  {
+    jam();
+
+#if NOT_YET
+    LcpCompleteRep* rep = (LcpCompleteRep*)signal->getDataPtrSend();
+    rep->nodeId = getOwnNodeId();
+    rep->blockNo = 0;
+    rep->lcpId = m_local_lcp_state.m_start_lcp_req.lcpId;
+    rep->keepGci = m_local_lcp_state.m_keep_gci;
+    sendSignal(DBLQH_REF, GSN_LCP_COMPLETE_REP, signal, 
+               LcpCompleteRep::SignalLength, JBB);
+
+    warningEvent("CUT LOG TAIL: reason: %u lcp: %u m_keep_gci: %u stop: %u",
+                 reason,
+                 m_local_lcp_state.m_start_lcp_req.lcpId,
+                 m_local_lcp_state.m_keep_gci,
+                 m_local_lcp_state.m_stop_gci);
+#endif
+    m_local_lcp_state.reset();
+  }
+  
   /* -------------------------------------------------------------------------*/
   /*     WE SET THE REQUESTER OF THE COPY GCI TO THE CURRENT MASTER. IF THE   */
   /*     CURRENT MASTER WE DO NOT WANT THE NEW MASTER TO RECEIVE CONFIRM OF   */
@@ -1234,6 +1274,9 @@ void Dbdih::execREAD_CONFIG_REQ(Signal* 
     }
   }
   ndbout_c("Using %u fragments per node", c_fragments_per_node);
+  
+  ndb_mgm_get_int_parameter(p, CFG_DB_LCP_TRY_LOCK_TIMEOUT, 
+                            &c_lcpState.m_lcp_trylock_timeout);
 
   cfileFileSize = (2 * ctabFileSize) + 2;
   initRecords();
@@ -2581,9 +2624,17 @@ void Dbdih::execINCL_NODECONF(Signal* si
 
   signal->theData[0] = DihContinueB::ZSTART_GCP;
   sendSignal(reference(), GSN_CONTINUEB, signal, 1, JBB);
-
-  Mutex mutex(signal, c_mutexMgr, c_nodeStartMaster.m_fragmentInfoMutex);
-  mutex.unlock();
+  /**
+   * To increase likelyhood that multiple nodes starting simulatanious
+   *   gets to copy fragment-info before a new LCP is started
+   *   we delay the releasing of this mutex. So that node that (might)
+   *   be started when GSN_START_PERMREP arrives will get mutex
+   *   before LCP (which does trylock for 60s)
+   */
+  signal->theData[0] = DihContinueB::ZDELAY_RELEASE_FRAGMENT_INFO_MUTEX;
+  signal->theData[1] = c_nodeStartMaster.m_fragmentInfoMutex.getHandle();
+  c_nodeStartMaster.m_fragmentInfoMutex.clear();
+  sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 500, 2);
 }//Dbdih::execINCL_NODECONF()
 
 void Dbdih::execUNBLO_DICTCONF(Signal* signal) 
@@ -9937,8 +9988,15 @@ void Dbdih::writingCopyGciLab(Signal* si
   return;
 }//Dbdih::writingCopyGciLab()
 
-void Dbdih::execSTART_LCP_REQ(Signal* signal){
+void Dbdih::execSTART_LCP_REQ(Signal* signal)
+{
+  jamEntry();
   StartLcpReq * req = (StartLcpReq*)signal->getDataPtr();
+
+  /**
+   * Init m_local_lcp_state
+   */
+  m_local_lcp_state.init(req);
  
   CRASH_INSERTION2(7021, isMaster());
   CRASH_INSERTION2(7022, !isMaster());
@@ -9967,6 +10025,58 @@ void Dbdih::execSTART_LCP_REQ(Signal* si
   sendSignal(reference(), GSN_CONTINUEB, signal, 3, JBB);
 }
 
+void
+Dbdih::LocalLCPState::reset()
+{
+  m_state = LS_INITIAL;
+  m_keep_gci = RNIL;
+  m_stop_gci = RNIL;
+}
+
+void
+Dbdih::LocalLCPState::init(const StartLcpReq * req)
+{
+  m_state = LS_RUNNING;
+  m_start_lcp_req = *req;
+  m_keep_gci = ~(Uint32)0;
+  m_stop_gci = 0;
+}
+
+void
+Dbdih::LocalLCPState::lcp_frag_rep(const LcpFragRep * rep)
+{
+  assert(m_state == LS_RUNNING);
+  if (rep->maxGciCompleted < m_keep_gci)
+  {
+    m_keep_gci = rep->maxGciCompleted;
+  }
+
+  if (rep->maxGciStarted > m_stop_gci)
+  {
+    m_stop_gci = rep->maxGciStarted;
+  }
+}
+
+void
+Dbdih::LocalLCPState::lcp_complete_rep(Uint32 gci)
+{
+  assert(m_state == LS_RUNNING);
+  m_state = LS_COMPLETE;
+  if (gci > m_stop_gci)
+    m_stop_gci = gci;
+}
+
+bool
+Dbdih::LocalLCPState::check_cut_log_tail(Uint32 gci) const
+{
+  if (m_state == LS_COMPLETE)
+  {
+    if (gci >= m_stop_gci)
+      return true;
+  }
+  return false;
+}
+
 void Dbdih::initLcpLab(Signal* signal, Uint32 senderRef, Uint32 tableId) 
 {
   TabRecordPtr tabPtr;
@@ -11413,10 +11523,13 @@ void Dbdih::execTCGETOPSIZECONF(Signal* 
   /*    WHILE COPYING DICTIONARY AND DISTRIBUTION INFO TO A STARTING NODE   */
   /*    WE WILL ALSO NOT ALLOW THE LOCAL CHECKPOINT TO PROCEED.             */
   /*----------------------------------------------------------------------- */
-  if (c_lcpState.immediateLcpStart == false) {
-    if ((c_lcpState.ctcCounter < 
-	 ((Uint32)1 << c_lcpState.clcpDelay)) ||
-        (c_nodeStartMaster.blockLcp == true)) {
+  if (c_lcpState.immediateLcpStart == false) 
+  {
+    Uint64 cnt = Uint64(c_lcpState.ctcCounter);
+    Uint64 limit = Uint64(1) << c_lcpState.clcpDelay;
+    bool dostart = cnt >= limit; 
+    if (dostart == false || c_nodeStartMaster.blockLcp == true) 
+    {
       jam();
       c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
 
@@ -11444,6 +11557,19 @@ void Dbdih::execTCGETOPSIZECONF(Signal* 
   c_lcpState.keepGci = (Uint32)(m_micro_gcp.m_old_gci >> 32);
   c_lcpState.oldestRestorableGci = SYSFILE->oldestRestorableGCI;
 
+  CRASH_INSERTION(7014);
+  c_lcpState.setLcpStatus(LCP_TC_CLOPSIZE, __LINE__);
+  sendLoopMacro(TC_CLOPSIZEREQ, sendTC_CLOPSIZEREQ, RNIL);
+}
+
+void Dbdih::execTC_CLOPSIZECONF(Signal* signal) 
+{
+  jamEntry();
+  Uint32 senderNodeId = signal->theData[0];
+  receiveLoopMacro(TC_CLOPSIZEREQ, senderNodeId);
+  
+  ndbrequire(c_lcpState.lcpStatus == LCP_TC_CLOPSIZE);
+
   /* ----------------------------------------------------------------------- */
   /*       UPDATE THE NEW LATEST LOCAL CHECKPOINT ID.                        */
   /* ----------------------------------------------------------------------- */
@@ -11458,11 +11584,9 @@ void Dbdih::execTCGETOPSIZECONF(Signal* 
     return;
   }//if
 
-  c_lcpState.m_start_time = c_current_time;
-
   Mutex mutex(signal, c_mutexMgr, c_fragmentInfoMutex_lcp);
   Callback c = { safe_cast(&Dbdih::lcpFragmentMutex_locked), 0 };
-  ndbrequire(mutex.lock(c, false));
+  ndbrequire(mutex.trylock(c, false));
 }
 
 void
@@ -11471,8 +11595,37 @@ Dbdih::lcpFragmentMutex_locked(Signal* s
                                Uint32 retVal)
 {
   jamEntry();
+
+  if (retVal == UtilLockRef::LockAlreadyHeld)
+  {
+    jam();
+    Mutex mutex(signal, c_mutexMgr, c_fragmentInfoMutex_lcp);
+    mutex.release();
+
+    if (senderData == 0)
+    {
+      jam();
+      infoEvent("Local checkpoint blocked waiting for node-restart");
+    }
+    
+    // 2* is as parameter is in seconds, and we sendSignalWithDelay 500ms
+    if (senderData >= 2*c_lcpState.m_lcp_trylock_timeout)
+    {
+      jam();
+      Callback c = { safe_cast(&Dbdih::lcpFragmentMutex_locked), 0 };
+      ndbrequire(mutex.lock(c, false));
+      return;
+    }
+    signal->theData[0] = DihContinueB::ZLCP_TRY_LOCK;
+    signal->theData[1] = senderData + 1;
+    sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 500, 2);
+    return;
+  }
+
   ndbrequire(retVal == 0);
   
+  c_lcpState.m_start_time = c_current_time;
+  
   setLcpActiveStatusStart(signal);
   
   signal->theData[0] = DihContinueB::ZCALCULATE_KEEP_GCI;
@@ -11653,27 +11806,15 @@ Dbdih::startLcpMutex_unlocked(Signal* si
   Mutex mutex(signal, c_mutexMgr, c_startLcpMutexHandle);
   mutex.release();
   
-  CRASH_INSERTION(7014);
-  c_lcpState.setLcpStatus(LCP_TC_CLOPSIZE, __LINE__);
-  sendLoopMacro(TC_CLOPSIZEREQ, sendTC_CLOPSIZEREQ, RNIL);
-}
-
-void Dbdih::execTC_CLOPSIZECONF(Signal* signal) {
-  jamEntry();
-  Uint32 senderNodeId = signal->theData[0];
-  receiveLoopMacro(TC_CLOPSIZEREQ, senderNodeId);
-  
-  ndbrequire(c_lcpState.lcpStatus == LCP_TC_CLOPSIZE);
   /* ----------------------------------------------------------------------- */
-  /*     ALL TC'S HAVE CLEARED THEIR OPERATION SIZE COUNTERS. NOW PROCEED BY */
-  /*     STARTING THE LOCAL CHECKPOINT IN EACH LQH.                          */
+  /*     NOW PROCEED BY STARTING THE LOCAL CHECKPOINT IN EACH LQH.           */
   /* ----------------------------------------------------------------------- */
   c_lcpState.m_LAST_LCP_FRAG_ORD = c_lcpState.m_participatingLQH;
 
   CRASH_INSERTION(7015);
   c_lcpState.setLcpStatus(LCP_START_LCP_ROUND, __LINE__);
   startLcpRoundLoopLab(signal, 0, 0);
-}//Dbdih::execTC_CLOPSIZECONF()
+}
 
 void
 Dbdih::master_lcp_fragmentMutex_locked(Signal* signal, 
@@ -11889,6 +12030,32 @@ void Dbdih::sendLastLCP_FRAG_ORD(Signal*
 void Dbdih::execLCP_FRAG_REP(Signal* signal) 
 {
   jamEntry();
+
+  LcpFragRep * const lcpReport = (LcpFragRep *)&signal->theData[0];
+
+  /**
+   * Proxing LCP_FRAG_REP
+   */
+  const bool broadcast_req = lcpReport->nodeId == LcpFragRep::BROADCAST_REQ;
+  if (broadcast_req)
+  {
+    jam();
+    ndbrequire(refToNode(signal->getSendersBlockRef()) == getOwnNodeId());
+
+    /**
+     * Set correct nodeId
+     */
+    lcpReport->nodeId = getOwnNodeId();
+
+    NodeReceiverGroup rg(DBDIH, c_lcpState.m_participatingDIH);
+    rg.m_nodes.clear(getOwnNodeId());
+    sendSignal(rg, GSN_LCP_FRAG_REP, signal, signal->getLength(), JBB);  
+
+    /**
+     * and continue processing
+     */
+  }
+
   ndbrequire(c_lcpState.lcpStatus != LCP_STATUS_IDLE);
   
 #if 0
@@ -11897,7 +12064,6 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
 		    signal->length(), number());
 #endif  
 
-  LcpFragRep * const lcpReport = (LcpFragRep *)&signal->theData[0];
   Uint32 nodeId = lcpReport->nodeId;
   Uint32 tableId = lcpReport->tableId;
   Uint32 fragId = lcpReport->fragId;
@@ -11938,7 +12104,7 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
   CRASH_INSERTION2(7016, !isMaster());
   CRASH_INSERTION2(7191, (!isMaster() && tableId));
 
-  bool fromTimeQueue = (signal->senderBlockRef() == reference());
+  bool fromTimeQueue = (signal->senderBlockRef()==reference()&&!broadcast_req);
   
   TabRecordPtr tabPtr;
   tabPtr.i = tableId;
@@ -11989,6 +12155,14 @@ void Dbdih::execLCP_FRAG_REP(Signal* sig
     c_lcpState.lcpStopGcp = started;
   }
 
+  /**
+   * Update m_local_lcp_state
+   *
+   * we could only look fragments that we have locally...
+   *   but for now we look at all fragments
+   */
+  m_local_lcp_state.lcp_frag_rep(lcpReport);
+
   if(tableDone){
     jam();
 
@@ -12447,6 +12621,26 @@ void Dbdih::execLCP_COMPLETE_REP(Signal*
 #endif
 
   LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtr();
+
+  if (rep->nodeId == LcpFragRep::BROADCAST_REQ)
+  {
+    jam();
+    ndbrequire(refToNode(signal->getSendersBlockRef()) == getOwnNodeId());
+    
+    /**
+     * Set correct nodeId
+     */
+    rep->nodeId = getOwnNodeId();
+
+    NodeReceiverGroup rg(DBDIH, c_lcpState.m_participatingDIH);
+    rg.m_nodes.clear(getOwnNodeId());
+    sendSignal(rg, GSN_LCP_COMPLETE_REP, signal, signal->getLength(), JBB);  
+    
+    /**
+     * and continue processing
+     */
+  }
+  
   Uint32 lcpId = rep->lcpId;
   Uint32 nodeId = rep->nodeId;
   Uint32 blockNo = rep->blockNo;
@@ -12547,6 +12741,11 @@ void Dbdih::allNodesLcpCompletedLab(Sign
 
   c_lcpState.setLcpStatus(LCP_STATUS_IDLE, __LINE__);
 
+  /**
+   * Update m_local_lcp_state
+   */
+  m_local_lcp_state.lcp_complete_rep(c_newest_restorable_gci);
+  
   if (isMaster())
   {
     /**
@@ -12843,12 +13042,59 @@ void Dbdih::checkGcpStopLab(Signal* sign
   return;
 }//Dbdih::checkGcpStopLab()
 
+void
+Dbdih::dumpGcpStop()
+{
+  ndbout_c("c_nodeStartMaster.blockGcp: %u %u",
+           c_nodeStartMaster.blockGcp,
+           c_nodeStartMaster.startNode);
+  ndbout_c("m_gcp_save.m_counter: %u m_gcp_save.m_max_lag: %u",
+           m_gcp_monitor.m_gcp_save.m_counter, 
+           m_gcp_monitor.m_gcp_save.m_max_lag);
+  ndbout_c("m_micro_gcp.m_counter: %u m_micro_gcp.m_max_lag: %u",
+           m_gcp_monitor.m_micro_gcp.m_counter, 
+           m_gcp_monitor.m_micro_gcp.m_max_lag);
+  
+  ndbout_c("m_gcp_save.m_master.m_state: %u", m_gcp_save.m_master.m_state);
+  ndbout_c("m_micro_gcp.m_master.m_state: %u", m_micro_gcp.m_master.m_state);
+  
+  ndbout_c("c_COPY_GCIREQ_Counter = %s", c_COPY_GCIREQ_Counter.getText());
+  ndbout_c("c_COPY_TABREQ_Counter = %s", c_COPY_TABREQ_Counter.getText());
+  ndbout_c("c_CREATE_FRAGREQ_Counter = %s", c_CREATE_FRAGREQ_Counter.getText());
+  ndbout_c("c_DIH_SWITCH_REPLICA_REQ_Counter = %s", 
+	   c_DIH_SWITCH_REPLICA_REQ_Counter.getText());
+  ndbout_c("c_EMPTY_LCP_REQ_Counter = %s",c_EMPTY_LCP_REQ_Counter.getText());
+  ndbout_c("c_GCP_COMMIT_Counter = %s", c_GCP_COMMIT_Counter.getText());
+  ndbout_c("c_GCP_PREPARE_Counter = %s", c_GCP_PREPARE_Counter.getText());
+  ndbout_c("c_GCP_SAVEREQ_Counter = %s", c_GCP_SAVEREQ_Counter.getText());
+  ndbout_c("c_INCL_NODEREQ_Counter = %s", c_INCL_NODEREQ_Counter.getText());
+  ndbout_c("c_MASTER_GCPREQ_Counter = %s", c_MASTER_GCPREQ_Counter.getText());
+  ndbout_c("c_MASTER_LCPREQ_Counter = %s", c_MASTER_LCPREQ_Counter.getText());
+  ndbout_c("c_START_INFOREQ_Counter = %s", c_START_INFOREQ_Counter.getText());
+  ndbout_c("c_START_RECREQ_Counter = %s", c_START_RECREQ_Counter.getText());
+  ndbout_c("c_STOP_ME_REQ_Counter = %s", c_STOP_ME_REQ_Counter.getText());
+  ndbout_c("c_TC_CLOPSIZEREQ_Counter = %s", c_TC_CLOPSIZEREQ_Counter.getText());
+  ndbout_c("c_TCGETOPSIZEREQ_Counter = %s", c_TCGETOPSIZEREQ_Counter.getText());
+
+  ndbout_c("m_copyReason: %d m_waiting: %u %u",
+           c_copyGCIMaster.m_copyReason,
+           c_copyGCIMaster.m_waiting[0],
+           c_copyGCIMaster.m_waiting[1]);
+  
+  ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d",
+	   c_copyGCISlave.m_senderData,
+	   c_copyGCISlave.m_senderRef,
+	   c_copyGCISlave.m_copyReason,
+	   c_copyGCISlave.m_expectedNextWord);
+}
+
 /**
  * GCP stop detected, 
  * send SYSTEM_ERROR to all other alive nodes
  */
 void Dbdih::crashSystemAtGcpStop(Signal* signal, bool local)
 {
+  dumpGcpStop();
   Uint32 save_counter = m_gcp_monitor.m_gcp_save.m_counter;
   Uint32 micro_counter = m_gcp_monitor.m_micro_gcp.m_counter;
   m_gcp_monitor.m_gcp_save.m_counter = 0;
@@ -13017,16 +13263,6 @@ void Dbdih::crashSystemAtGcpStop(Signal*
   }
 
 dolocal:  
-  ndbout_c("m_copyReason: %d m_waiting: %d",
-           c_copyGCIMaster.m_copyReason,
-           c_copyGCIMaster.m_waiting[0]);
-  
-  ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d",
-	   c_copyGCISlave.m_senderData,
-	   c_copyGCISlave.m_senderRef,
-	   c_copyGCISlave.m_copyReason,
-	   c_copyGCISlave.m_expectedNextWord);
-
   FileRecordPtr file0Ptr;
   file0Ptr.i = crestartInfoFile[0];
   ptrCheckGuard(file0Ptr, cfileFileSize, fileRecord);
@@ -13047,32 +13283,6 @@ dolocal:  
   signal->theData[1] = file1Ptr.p->fileRef;
   EXECUTE_DIRECT(NDBFS, GSN_DUMP_STATE_ORD, signal, 2);
 
-  ndbout_c("c_COPY_GCIREQ_Counter = %s", 
-	   c_COPY_GCIREQ_Counter.getText());
-  ndbout_c("c_COPY_TABREQ_Counter = %s", 
-	   c_COPY_TABREQ_Counter.getText());
-  ndbout_c("c_CREATE_FRAGREQ_Counter = %s", 
-	   c_CREATE_FRAGREQ_Counter.getText());
-  ndbout_c("c_DIH_SWITCH_REPLICA_REQ_Counter = %s", 
-	   c_DIH_SWITCH_REPLICA_REQ_Counter.getText());
-  ndbout_c("c_EMPTY_LCP_REQ_Counter = %s",c_EMPTY_LCP_REQ_Counter.getText());
-  ndbout_c("c_GCP_COMMIT_Counter = %s", c_GCP_COMMIT_Counter.getText());
-  ndbout_c("c_GCP_PREPARE_Counter = %s", c_GCP_PREPARE_Counter.getText());
-  ndbout_c("c_GCP_SAVEREQ_Counter = %s", c_GCP_SAVEREQ_Counter.getText());
-  ndbout_c("c_INCL_NODEREQ_Counter = %s", c_INCL_NODEREQ_Counter.getText());
-  ndbout_c("c_MASTER_GCPREQ_Counter = %s", 
-	   c_MASTER_GCPREQ_Counter.getText());
-  ndbout_c("c_MASTER_LCPREQ_Counter = %s", 
-	   c_MASTER_LCPREQ_Counter.getText());
-  ndbout_c("c_START_INFOREQ_Counter = %s", 
-	   c_START_INFOREQ_Counter.getText());
-  ndbout_c("c_START_RECREQ_Counter = %s", c_START_RECREQ_Counter.getText());
-  ndbout_c("c_STOP_ME_REQ_Counter = %s", c_STOP_ME_REQ_Counter.getText());
-  ndbout_c("c_TC_CLOPSIZEREQ_Counter = %s", 
-	   c_TC_CLOPSIZEREQ_Counter.getText());
-  ndbout_c("c_TCGETOPSIZEREQ_Counter = %s", 
-	   c_TCGETOPSIZEREQ_Counter.getText());
-
   jam();
   SystemError * const sysErr = (SystemError*)&signal->theData[0];
   sysErr->errorCode = SystemError::GCPStopDetected;
@@ -15649,7 +15859,7 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
 	Uint32 nodeOrder[MAX_REPLICAS];
 	const Uint32 noOfReplicas = extractNodeInfo(fragPtr.p, nodeOrder);
 	char buf[100];
-	BaseString::snprintf(buf, sizeof(buf), " Table %d Fragment %d(%u) - ", tabPtr.i, j, dihGetInstanceKey(fragPtr));
+	BaseString::snprintf(buf, sizeof(buf), " Table %d Fragment %d(%u) LP: %u - ", tabPtr.i, j, dihGetInstanceKey(fragPtr), fragPtr.p->m_log_part_id);
 	for(Uint32 k = 0; k < noOfReplicas; k++){
 	  char tmp[100];
 	  BaseString::snprintf(tmp, sizeof(tmp), "%d ", nodeOrder[k]);
@@ -16030,6 +16240,13 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal
     crashSystemAtGcpStop(signal, true);
   }
 
+  if (arg == 7025)
+  {
+    jam();
+    dumpGcpStop();
+    return;
+  }
+
 #ifdef GCP_TIMER_HACK
   if (signal->theData[0] == 7901)
     globalData.gcp_timer_limit = signal->theData[1];

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2009-02-02 21:30:27 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2009-03-12 06:52:39 +0000
@@ -176,6 +176,47 @@ static NdbOut * traceopout = 0;
 #define TRACE_OP(x, y) {}
 #endif
 
+struct LogPosition
+{
+  Uint32 m_file_no;
+  Uint32 m_mbyte;
+};
+
+int
+cmp(const LogPosition& pos1, const LogPosition& pos2)
+{
+  if (pos1.m_file_no > pos2.m_file_no)
+    return 1;
+  if (pos1.m_file_no < pos2.m_file_no)
+    return -1;
+  if (pos1.m_mbyte > pos2.m_mbyte)
+    return 1;
+  if (pos1.m_mbyte < pos2.m_mbyte)
+    return -1;
+
+  return 0;
+}
+
+/**
+ * head - tail
+ */
+static
+Uint64
+free_log(const LogPosition& head, const LogPosition& tail, 
+         Uint32 cnt, Uint32 size)
+{
+  Uint64 headmb = head.m_file_no*Uint64(size) + head.m_mbyte;
+  Uint64 tailmb = tail.m_file_no*Uint64(size) + tail.m_mbyte;
+  if (headmb >= tailmb)
+  {
+    return (cnt * Uint64(size)) - headmb + tailmb;
+  }
+  else
+  {
+    return tailmb - headmb;
+  }
+}
+
 /* ------------------------------------------------------------------------- */
 /* -------               SEND SYSTEM ERROR                           ------- */
 /*                                                                           */
@@ -12361,22 +12402,15 @@ Dblqh::sendLCP_FRAG_REP(Signal * signal,
   lcpReport->maxGciCompleted = fragPtrP->maxGciCompletedInLcp;
   lcpReport->maxGciStarted = fragPtrP->maxGciInLcp;
   
-  if (!isNdbMtLqh()) {
-    for (Uint32 i = 0; i < cnoOfNodes; i++) {
-      jam();
-      Uint32 nodeId = cnodeData[i];
-      if(cnodeStatus[i] == ZNODE_UP){
-        jam();
-        BlockReference Tblockref = calcDihBlockRef(nodeId);
-        sendSignal(Tblockref, GSN_LCP_FRAG_REP, signal, 
-                   LcpFragRep::SignalLength, JBB);
-      }//if
-    }//for
-  } else {
+  Uint32 ref = DBDIH_REF;
+  if (isNdbMtLqh())
+  {
     jam();
-    sendSignal(DBLQH_REF, GSN_LCP_FRAG_REP, signal,
-               LcpFragRep::SignalLength, JBB);
+    ref = DBLQH_REF;
   }
+  lcpReport->nodeId = LcpFragRep::BROADCAST_REQ;
+  sendSignal(ref, GSN_LCP_FRAG_REP, signal,
+             LcpFragRep::SignalLength, JBB);
 }
 
 void Dblqh::contChkpNextFragLab(Signal* signal) 
@@ -12605,29 +12639,22 @@ void Dblqh::sendLCP_COMPLETE_REP(Signal*
   rep->lcpId = lcpId;
   rep->blockNo = DBLQH;
   
-  if (!isNdbMtLqh()) {
-    for (Uint32 i = 0; i < cnoOfNodes; i++) {
-      jam();
-      Uint32 nodeId = cnodeData[i];
-      if(cnodeStatus[i] == ZNODE_UP){
-        jam();
-        
-        BlockReference blockref = calcDihBlockRef(nodeId);
-        sendSignal(blockref, GSN_LCP_COMPLETE_REP, signal, 
-                   LcpCompleteRep::SignalLength, JBB);
-      }//if
-    }//for
-  } else {
+  Uint32 ref = DBDIH_REF;
+  if (isNdbMtLqh())
+  {
     jam();
-    sendSignal(DBLQH_REF, GSN_LCP_COMPLETE_REP, signal,
-               LcpCompleteRep::SignalLength, JBB);
+    ref = DBLQH_REF;
   }
+  rep->nodeId = LcpFragRep::BROADCAST_REQ;
 
+  sendSignal(ref, GSN_LCP_COMPLETE_REP, signal,
+             LcpCompleteRep::SignalLength, JBB);
+  
   if(lcpPtr.p->reportEmpty){
     jam();
     sendEMPTY_LCP_CONF(signal, true);
   }
-
+  
   if (cstartRecReq < SRR_FIRST_LCP_DONE)
   {
     jam();
@@ -12638,6 +12665,18 @@ void Dblqh::sendLCP_COMPLETE_REP(Signal*
   
 }//Dblqh::sendCOMP_LCP_ROUND()
 
+#if NOT_YET
+void
+Dblqh::execLCP_COMPLETE_REP(Signal* signal)
+{
+  /**
+   * This is sent when last LCP is restorable
+   */
+  LcpCompleteRep * rep = (LcpCompleteRep*)signal->getDataPtr();
+  Uint32 keepGci = rep->keepGci;
+  setLogTail(signal, keepGci);
+}
+#endif
 
 /* ------------------------------------------------------------------------- */
 /* -------               SEND ACC_LCPREQ AND TUP_LCPREQ              ------- */
@@ -12663,24 +12702,10 @@ void Dblqh::sendStartLcp(Signal* signal)
 /*FOR SHORT LOGS.                                                            */
 /* ------------------------------------------------------------------------- */
 
-// this function has not been verified yet
-Uint32 Dblqh::remainingLogSize(const LogFileRecordPtr &sltCurrLogFilePtr,
-			       const LogPartRecordPtr &sltLogPartPtr)
-{
-  Uint32 hf = sltCurrLogFilePtr.p->fileNo*clogFileSize+sltCurrLogFilePtr.p->currentMbyte;
-  Uint32 tf = sltLogPartPtr.p->logTailFileNo*clogFileSize+sltLogPartPtr.p->logTailMbyte;
-  Uint32 sz = sltLogPartPtr.p->noLogFiles*clogFileSize;
-  if (tf > hf) hf += sz;
-  return sz-(hf-tf);
-}
-
 void Dblqh::setLogTail(Signal* signal, Uint32 keepGci) 
 {
   LogPartRecordPtr sltLogPartPtr;
   LogFileRecordPtr sltLogFilePtr;
-#if 0
-  LogFileRecordPtr sltCurrLogFilePtr;
-#endif
   UintR tsltMbyte;
   UintR tsltStartMbyte;
   UintR tsltIndex;
@@ -12692,13 +12717,6 @@ void Dblqh::setLogTail(Signal* signal, U
     findLogfile(signal, sltLogPartPtr.p->logTailFileNo,
                 sltLogPartPtr, &sltLogFilePtr);
 
-#if 0
-    sltCurrLogFilePtr.i = sltLogPartPtr.p->currentLogfile;
-    ptrCheckGuard(sltCurrLogFilePtr, clogFileFileSize, logFileRecord);
-    infoEvent("setLogTail: Available log file %d size = %d[mbytes]+%d[words]", sltLogPartPtr.i,
-	      remainingLogSize(sltCurrLogFilePtr, sltLogPartPtr), sltCurrLogFilePtr.p->remainingWordsInMbyte);
-#endif
-
     tsltMbyte = sltLogPartPtr.p->logTailMbyte;
     tsltStartMbyte = tsltMbyte;
     tsltFlag = ZFALSE;
@@ -12806,10 +12824,6 @@ void Dblqh::setLogTail(Signal* signal, U
         }//if
       }//if
     }
-#if 0
-    infoEvent("setLogTail: Available log file %d size = %d[mbytes]+%d[words]", sltLogPartPtr.i,
-	      remainingLogSize(sltCurrLogFilePtr, sltLogPartPtr), sltCurrLogFilePtr.p->remainingWordsInMbyte);
-#endif
   }//for
 
 }//Dblqh::setLogTail()
@@ -12888,6 +12902,9 @@ void Dblqh::execGCP_SAVEREQ(Signal* sign
     return;
   }
 
+  Uint32 saveNewestCompletedGci = cnewestCompletedGci;
+  cnewestCompletedGci = gci;
+
   if (cstartRecReq < SRR_REDO_COMPLETE)
   {
     /**
@@ -12903,9 +12920,10 @@ void Dblqh::execGCP_SAVEREQ(Signal* sign
     return;
   }
   
-  ndbrequire(gci >= cnewestCompletedGci);
+  ndbrequire(gci >= saveNewestCompletedGci);
   
-  if (gci == cnewestCompletedGci) {
+  if (gci == saveNewestCompletedGci) 
+  {
 /*---------------------------------------------------------------------------*/
 /* GLOBAL CHECKPOINT HAVE ALREADY BEEN HANDLED. REQUEST MUST HAVE BEEN SENT  */
 /* FROM NEW MASTER DIH.                                                      */
@@ -15060,7 +15078,8 @@ void Dblqh::execSTART_FRAGREQ(Signal* si
   fragptr.p->logFlag = Fragrecord::STATE_FALSE;
   fragptr.p->srStatus = Fragrecord::SS_IDLE;
 
-  if (noOfLogNodes > 0) {
+  if (noOfLogNodes > 0) 
+  {
     jam();
     for (Uint32 i = 0; i < noOfLogNodes; i++) {
       jam();
@@ -15069,8 +15088,19 @@ void Dblqh::execSTART_FRAGREQ(Signal* si
       fragptr.p->srLqhLognode[i] = startFragReq->lqhLogNode[i];
     }//for
     fragptr.p->newestGci = startFragReq->lastGci[noOfLogNodes - 1];
-  } else {
-    fragptr.p->newestGci = cnewestGci;
+  } 
+  else
+  {
+    jam();
+    /**
+     * This is a really weird piece of code
+     *   it's probably incorrect, but seems to mask problems...
+     */
+    if (cnewestGci > fragptr.p->newestGci) 
+    {
+      jam();
+      fragptr.p->newestGci = cnewestGci;
+    }
   }//if
   
   if (lcpNo == ZNIL)
@@ -19681,20 +19711,13 @@ void Dblqh::writeNextLog(Signal* signal)
     twnlNextMbyte = logFilePtr.p->currentMbyte + 1;
     twnlNextFileNo = logFilePtr.p->fileNo;
   }//if
-  if (twnlNextFileNo == logPartPtr.p->logTailFileNo) {
-    if (logPartPtr.p->logTailMbyte == twnlNextMbyte) {
-      jam();
-/* -------------------------------------------------- */
-/*       THE NEXT MBYTE WILL BE THE TAIL. WE MUST     */
-/*       STOP LOGGING NEW OPERATIONS. THIS OPERATION  */
-/*       ALLOWED TO PASS. ALSO COMMIT, NEXT, COMPLETED*/
-/*       GCI, ABORT AND FRAGMENT SPLIT IS ALLOWED.    */
-/*       OPERATIONS ARE ALLOWED AGAIN WHEN THE TAIL   */
-/*       IS MOVED FORWARD AS A RESULT OF A START_LCP  */
-/*       _ROUND SIGNAL ARRIVING FROM DBDIH.           */
-/* -------------------------------------------------- */
-      logPartPtr.p->logPartState = LogPartRecord::TAIL_PROBLEM;
-    }//if
+
+  LogPosition head = { twnlNextFileNo, twnlNextMbyte };
+  LogPosition tail = { logPartPtr.p->logTailFileNo, logPartPtr.p->logTailMbyte};
+  if (free_log(head, tail, logPartPtr.p->noLogFiles, clogFileSize) <= 4)
+  {
+    jam();
+    logPartPtr.p->logPartState = LogPartRecord::TAIL_PROBLEM;
   }//if
 }//Dblqh::writeNextLog()
 
@@ -20610,6 +20633,44 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal
       EXECUTE_DIRECT(DBLQH, GSN_DUMP_STATE_ORD, signal, 1);
     }
   }
+
+  if(arg == 2399)
+  {
+    jam();
+
+    if (cstartRecReq < SRR_REDO_COMPLETE)
+    {
+      jam();
+      return;
+    }
+
+    for(Uint32 i = 0; i<4; i++)
+    {
+      logPartPtr.i = i;
+      ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord);
+      LogFileRecordPtr logFile;
+      logFile.i = logPartPtr.p->currentLogfile;
+      ptrCheckGuard(logFile, clogFileFileSize, logFileRecord);
+      
+      LogPosition head = { logFile.p->fileNo, logFile.p->currentMbyte };
+      LogPosition tail = { logPartPtr.p->logTailFileNo, 
+                           logPartPtr.p->logTailMbyte};
+      Uint64 mb = free_log(head, tail, logPartPtr.p->noLogFiles, clogFileSize);
+      Uint64 total = logPartPtr.p->noLogFiles * Uint64(clogFileSize);
+      signal->theData[0] = NDB_LE_RedoStatus;
+      signal->theData[1] = i;
+      signal->theData[2] = head.m_file_no;
+      signal->theData[3] = head.m_mbyte;
+      signal->theData[4] = tail.m_file_no;
+      signal->theData[5] = tail.m_mbyte;
+      signal->theData[6] = Uint32(total >> 32);
+      signal->theData[7] = Uint32(total);
+      signal->theData[8] = Uint32(mb >> 32);
+      signal->theData[9] = Uint32(mb);
+      sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 10, JBB);
+    }
+  }
+
 }//Dblqh::execDUMP_STATE_ORD()
 
 /* **************************************************************** */

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2008-12-22 09:40:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp	2009-03-12 06:52:39 +0000
@@ -469,7 +469,7 @@ DblqhProxy::execLCP_FRAG_REP(Signal* sig
 {
   ndbrequire(signal->getLength() == LcpFragRep::SignalLength);
 
-  const LcpFragRep* conf = (const LcpFragRep*)signal->getDataPtr();
+  LcpFragRep* conf = (LcpFragRep*)signal->getDataPtr();
   Uint32 ssId = getSsId(conf);
   Ss_LCP_FRAG_ORD& ss = ssFind<Ss_LCP_FRAG_ORD>(ssId);
 
@@ -479,19 +479,13 @@ DblqhProxy::execLCP_FRAG_REP(Signal* sig
   c_lcpRecord.m_frags++;
   D("LCP: rep" << V(conf->lcpId) << V(c_lcpRecord.m_frags));
 
-  NodePtr nodePtr;
-  c_nodeList.first(nodePtr);
-  ndbrequire(nodePtr.i != RNIL);
-  while (nodePtr.i != RNIL) {
-    if (nodePtr.p->m_alive) {
-      jam();
-      Uint32 nodeId = nodePtr.p->m_nodeId;
-      BlockReference dihRef = calcDihBlockRef(nodeId);
-      sendSignal(dihRef, GSN_LCP_FRAG_REP,
-                 signal, LcpFragRep::SignalLength, JBB);
-    }
-    c_nodeList.next(nodePtr);
-  }
+  /**
+   * But instead of broadcasting to all DIH's
+   *   send to local that will do the broadcast
+   */
+  conf->nodeId = LcpFragRep::BROADCAST_REQ;
+  sendSignal(DBDIH_REF, GSN_LCP_FRAG_REP,
+             signal, LcpFragRep::SignalLength, JBB);
 }
 
 // GSN_LCP_COMPLETE_ORD [ sub-op, fictional gsn ]
@@ -578,24 +572,13 @@ DblqhProxy::sendLCP_COMPLETE_REP(Signal*
     }
   }
 
-  NodePtr nodePtr;
-  c_nodeList.first(nodePtr);
-  ndbrequire(nodePtr.i != RNIL);
-  while (nodePtr.i != RNIL) {
-    if (nodePtr.p->m_alive) {
-      jam();
-      Uint32 nodeId = nodePtr.p->m_nodeId;
-      BlockReference dihRef = calcDihBlockRef(nodeId);
-
-      LcpCompleteRep* conf = (LcpCompleteRep*)signal->getDataPtrSend();
-      conf->nodeId = getOwnNodeId();
-      conf->blockNo = DBLQH;
-      conf->lcpId = ss.m_req.lcpId;
-      sendSignal(dihRef, GSN_LCP_COMPLETE_REP,
-                 signal, LcpCompleteRep::SignalLength, JBB);
-    }
-    c_nodeList.next(nodePtr);
-  }
+  
+  LcpCompleteRep* conf = (LcpCompleteRep*)signal->getDataPtrSend();
+  conf->nodeId = LcpFragRep::BROADCAST_REQ;
+  conf->blockNo = DBLQH;
+  conf->lcpId = ss.m_req.lcpId;
+  sendSignal(DBDIH_REF, GSN_LCP_COMPLETE_REP,
+             signal, LcpCompleteRep::SignalLength, JBB);
 
   for (i = 0; i < ss.BlockCnt; i++) {
     jam();

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2008-12-09 17:15:12 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2009-03-02 09:28:26 +0000
@@ -1002,16 +1002,18 @@ public:
     Uint8 hasVarKeys;
 
     bool checkTable(Uint32 schemaVersion) const {
-      return get_enabled() && !get_dropping() && 
-	(table_version_major(schemaVersion) == table_version_major(currentSchemaVersion));
+      return !get_dropping() &&
+	((/** normal transaction path */
+          get_enabled() && table_version_major(schemaVersion) == table_version_major(currentSchemaVersion)) 
+         ||
+         (/** 
+           * unique index is relaxed for DbUtil and transactions ongoing
+           * while index is created
+           */
+          get_prepared() && schemaVersion == currentSchemaVersion &&
+          DictTabInfo::isUniqueIndex(tableType)));
     }
-
-    bool checkTablePrepared(Uint32 schemaVersion, Uint32 transId1) const {
-      return get_prepared() && !get_dropping() && 
-	(table_version_major(schemaVersion) == table_version_major(currentSchemaVersion)) &&
-        (transId1 >> 20) == DBUTIL; // wl3600_todo use schema trans id instead
-    }
-
+    
     Uint32 getErrorCode(Uint32 schemaVersion) const;
   };
   typedef Ptr<TableRecord> TableRecordPtr;

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2009-02-11 12:11:18 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2009-03-12 10:59:57 +0000
@@ -2543,18 +2543,13 @@ void Dbtc::execTCKEYREQ(Signal* signal) 
   if (localTabptr.p->checkTable(tcKeyReq->tableSchemaVersion)) {
     ;
   } else {
-    if (localTabptr.p->checkTablePrepared(tcKeyReq->tableSchemaVersion,
-                                          tcKeyReq->transId1)) {
-      jam();
-    } else {
     /*-----------------------------------------------------------------------*/
     /* THE API IS WORKING WITH AN OLD SCHEMA VERSION. IT NEEDS REPLACEMENT.  */
     /* COULD ALSO BE THAT THE TABLE IS NOT DEFINED.                          */
     /*-----------------------------------------------------------------------*/
-      releaseSections(handle);
-      TCKEY_abort(signal, 8);
-      return;
-    }
+    releaseSections(handle);
+    TCKEY_abort(signal, 8);
+    return;
   }//if
   
   //-------------------------------------------------------------------------
@@ -3002,14 +2997,9 @@ void Dbtc::tckeyreq050Lab(Signal* signal
   if(localTabptr.p->checkTable(schemaVersion)){
     ;
   } else {
-    if (localTabptr.p->checkTablePrepared(schemaVersion,
-                                          regApiPtr->transid[0])) {
-      jam();
-    } else {
-      terrorCode = localTabptr.p->getErrorCode(schemaVersion);
-      TCKEY_abort(signal, 58);
-      return;
-    }
+    terrorCode = localTabptr.p->getErrorCode(schemaVersion);
+    TCKEY_abort(signal, 58);
+    return;
   }
   
   setApiConTimer(apiConnectptr.i, TtcTimer, __LINE__);
@@ -3213,14 +3203,9 @@ void Dbtc::attrinfoDihReceivedLab(Signal
   if(localTabptr.p->checkTable(regCachePtr->schemaVersion)){
     ;
   } else {
-    if (localTabptr.p->checkTablePrepared(regCachePtr->schemaVersion,
-                                          regApiPtr->transid[0])) {
-      jam();
-    } else {
-      terrorCode = localTabptr.p->getErrorCode(regCachePtr->schemaVersion);
-      TCKEY_abort(signal, 58);
-      return;
-    }
+    terrorCode = localTabptr.p->getErrorCode(regCachePtr->schemaVersion);
+    TCKEY_abort(signal, 58);
+    return;
   }
   if (Tnode != 0)
   {

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2008-11-16 15:32:38 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2009-02-11 15:07:28 +0000
@@ -3001,8 +3001,6 @@ private:
   ArrayPool<Operationrec> c_operation_pool;
 
   ArrayPool<Page> c_page_pool;
-  Uint32 cnoOfAllocatedPages;
-  Uint32 c_no_of_pages;
 
   /* read ahead in pages during disk order scan */
   Uint32 m_max_page_read_ahead;
@@ -3045,7 +3043,6 @@ private:
 
   // Trigger variables
   Uint32 c_maxTriggersPerTable;
-  Uint32 c_memusage_report_frequency;
 
   Uint32 c_errorInsert4000TableId;
   Uint32 c_min_list_size[MAX_FREE_LIST + 1];

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp	2008-10-08 06:23:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp	2009-02-11 15:07:28 +0000
@@ -69,50 +69,19 @@ struct Chunk {
   Uint32 pageCount;
 };
 
-void
-Dbtup::reportMemoryUsage(Signal* signal, int incDec){
-  signal->theData[0] = NDB_LE_MemoryUsage;
-  signal->theData[1] = incDec;
-  signal->theData[2] = sizeof(Page);
-  signal->theData[3] = cnoOfAllocatedPages;
-  signal->theData[4] = c_no_of_pages;
-  signal->theData[5] = DBTUP;
-  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, 6, JBB);
-}
-
 void Dbtup::execDBINFO_SCANREQ(Signal* signal)
 {
   jamEntry();
   DbinfoScanReq req= *(DbinfoScanReq*)signal->theData;
   const Uint32 reqlength= signal->getLength();
 
-  const Uint32 tableId= req.tableId;
-
-  const Uint32 senderRef= req.senderRef;
-  const Uint32 apiTxnId= req.apiTxnId;
-  const Uint32 colBitmapLo= req.colBitmapLo;
-  const Uint32 colBitmapHi= req.colBitmapHi;
-
   char buf[1024];
   struct dbinfo_row r;
   struct dbinfo_ratelimit rl;
 
   dbinfo_ratelimit_init(&rl, &req);
 
-  if(tableId == NDBINFO_MEMUSAGE_TABLEID)
-  {
-    jam();
-    dbinfo_write_row_init(&r, buf, sizeof(buf));
-    dbinfo_write_row_column(&r, "DataMemory", 10);
-    dbinfo_write_row_column_uint32(&r, getOwnNodeId());
-    Uint32 page_size_kb= sizeof(Page);;
-    dbinfo_write_row_column(&r, (char*)&page_size_kb, 4); // 8kb
-    dbinfo_write_row_column_uint32(&r, cnoOfAllocatedPages); // alloced pages
-    dbinfo_write_row_column_uint32(&r, c_no_of_pages); // number of pages
-    dbinfo_write_row_column(&r, "DBTUP", 5);
-    dbinfo_send_row(signal,r,rl,apiTxnId,senderRef);
-  }
-  else if(req.tableId == NDBINFO_POOLS_TABLEID)
+  if(req.tableId == NDBINFO_POOLS_TABLEID)
   {
     struct {
       const char* poolname;
@@ -173,10 +142,6 @@ void
 Dbtup::execDUMP_STATE_ORD(Signal* signal)
 {
   Uint32 type = signal->theData[0];
-  if(type == DumpStateOrd::DumpPageMemory && signal->getLength() == 1){
-    reportMemoryUsage(signal, 0);
-    return;
-  }
   DumpStateOrd * const dumpState = (DumpStateOrd *)&signal->theData[0];
 
 #if 0
@@ -268,7 +233,9 @@ Dbtup::execDUMP_STATE_ORD(Signal* signal
 
       // Case
       Uint32 c = (rand() % 3);
-      const Uint32 free = c_no_of_pages - cnoOfAllocatedPages;
+      Resource_limit rl;
+      m_ctx.m_mm.get_resource_limit(RG_DATAMEM, rl);
+      const Uint32 free = rl.m_max - rl.m_curr;
       
       Uint32 alloc = 0;
       if(free <= 1){

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2008-11-16 15:29:16 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp	2009-02-11 15:07:28 +0000
@@ -121,8 +121,6 @@ Dbtup::Dbtup(Block_context& ctx, Uint32 
   tablerec = 0;
   tableDescriptor = 0;
   totNoOfPagesAllocated = 0;
-  cnoOfAllocatedPages = 0;
-  c_no_of_pages = 0;
   
   initData();
   CLEAR_ERROR_INSERT_VALUE;
@@ -243,41 +241,6 @@ void Dbtup::execCONTINUEB(Signal* signal
     jam();
     releaseFragment(signal, dataPtr, signal->theData[2]);
     break;
-  case ZREPORT_MEMORY_USAGE:{
-    jam();
-    static int c_currentMemUsed = 0;
-    Uint32 cnt = signal->theData[1];
-    Uint32 tmp = c_no_of_pages;
-    int now = tmp ? (cnoOfAllocatedPages * 100)/tmp : 0;
-    const int thresholds[] = { 100, 90, 80, 0 };
-    
-    Uint32 i = 0;
-    const Uint32 sz = sizeof(thresholds)/sizeof(thresholds[0]);
-    for(i = 0; i<sz; i++){
-      if(now >= thresholds[i]){
-	now = thresholds[i];
-	break;
-      }
-    }
-
-    if(now != c_currentMemUsed || 
-       (c_memusage_report_frequency && cnt + 1 == c_memusage_report_frequency))
-    {
-      reportMemoryUsage(signal, 
-			now > c_currentMemUsed ? 1 : 
-			now < c_currentMemUsed ? -1 : 0);
-      cnt = 0;
-      c_currentMemUsed = now;
-    } 
-    else
-    {
-      cnt++;
-    }
-    signal->theData[0] = ZREPORT_MEMORY_USAGE;
-    signal->theData[1] = cnt;
-    sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 2);    
-    return;
-  }
   case ZBUILD_INDEX:
     jam();
     buildIndex(signal, dataPtr);
@@ -476,10 +439,6 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* 
   clastBitMask = 1;
   clastBitMask = clastBitMask << 31;
 
-  c_memusage_report_frequency = 0;
-  ndb_mgm_get_int_parameter(p, CFG_DB_MEMREPORT_FREQUENCY, 
-			    &c_memusage_report_frequency);
-  
   initialiseRecordsLab(signal, 0, ref, senderData);
 }//Dbtup::execSIZEALT_REP()
 
@@ -492,12 +451,9 @@ void Dbtup::initRecords() 
     m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
 
-  ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tmp));
-
   // Records with dynamic sizes
   void* ptr = m_ctx.m_mm.get_memroot();
   c_page_pool.set((Page*)ptr, (Uint32)~0);
-  c_no_of_pages = tmp;
 
   fragoperrec = (Fragoperrec*)allocRecord("Fragoperrec",
 					  sizeof(Fragoperrec),
@@ -635,14 +591,6 @@ void Dbtup::execNDB_STTOR(Signal* signal
     break;
   case ZSTARTPHASE6:
     jam();
-/*****************************************/
-/*       NOW SET THE DISK WRITE SPEED TO */
-/*       PAGES PER TICK AFTER SYSTEM     */
-/*       RESTART.                        */
-/*****************************************/
-    signal->theData[0] = ZREPORT_MEMORY_USAGE;
-    signal->theData[1] = 0;
-    sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 2);
     break;
   default:
     jam();

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp	2007-06-12 07:19:39 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp	2009-02-11 15:07:28 +0000
@@ -114,7 +114,6 @@ Uint32 Dbtup::nextHigherTwoLog(Uint32 in
 
 void Dbtup::initializePage() 
 {
-  cnoOfAllocatedPages = 0;
 }//Dbtup::initializePage()
 
 void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
@@ -129,7 +128,6 @@ void Dbtup::allocConsPages(Uint32 noOfPa
 
   m_ctx.m_mm.alloc_pages(RT_DBTUP_PAGE, &allocPageRef, 
 			 &noOfPagesToAllocate, 1);
-  cnoOfAllocatedPages += noOfPagesToAllocate;
   noOfPagesAllocated = noOfPagesToAllocate;
   return;
 }//allocConsPages()
@@ -137,6 +135,5 @@ void Dbtup::allocConsPages(Uint32 noOfPa
 void Dbtup::returnCommonArea(Uint32 retPageRef, Uint32 retNo) 
 {
   m_ctx.m_mm.release_pages(RT_DBTUP_PAGE, retPageRef, retNo);
-  cnoOfAllocatedPages -= retNo;
 }//Dbtup::returnCommonArea()
 

=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2009-01-28 10:11:04 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2009-03-12 10:59:57 +0000
@@ -1198,7 +1198,6 @@ DbUtil::prepareOperation(Signal* signal,
   Uint32 noOfPKAttribsStored = 0;
   Uint32 noOfNonPKAttribsStored = 0;
   Uint32 attrLength = 0;
-  Uint32 pkAttrLength = 0;
   char attrNameRequested[MAX_ATTR_NAME_SIZE];
   Uint32 attrIdRequested;
 
@@ -1349,8 +1348,6 @@ DbUtil::prepareOperation(Signal* signal,
 	break;
       }
       attrLength += len;
-      if (attrDesc.AttributeKeyFlag)
-	pkAttrLength += len;
 
       if (operationType == UtilPrepareReq::Read) {
 	AttributeHeader::init(rsInfoIt.data, 
@@ -1410,14 +1407,7 @@ DbUtil::prepareOperation(Signal* signal,
   prepOpPtr.p->tckey.tableId = tableDesc.TableId;
   prepOpPtr.p->tckey.tableSchemaVersion = tableDesc.TableVersion;
   prepOpPtr.p->noOfKeyAttr = tableDesc.NoOfKeyAttr;
-  prepOpPtr.p->keyLen = tableDesc.KeyLength; // Total no of words in PK
-  if (prepOpPtr.p->keyLen > TcKeyReq::MaxKeyInfo) {
-    jam();
-    prepOpPtr.p->tckeyLenInBytes = (static_len + TcKeyReq::MaxKeyInfo) * 4;
-  } else {
-    jam();
-    prepOpPtr.p->tckeyLenInBytes = (static_len + prepOpPtr.p->keyLen) * 4;
-  }
+  prepOpPtr.p->tckeyLen = static_len;
   prepOpPtr.p->keyDataPos = static_len;  // Start of keyInfo[] in tckeyreq
   
   TcKeyReq::setAbortOption(requestInfo, TcKeyReq::AbortOnError);
@@ -1526,14 +1516,13 @@ DbUtil::hardcodedPrepare() {
   /**
    * Prepare SequenceCurrVal (READ)
    */
+  Uint32 keyLen = 1;
   {
     PreparedOperationPtr ptr;
     ndbrequire(c_preparedOperationPool.seizeId(ptr, 0));
-    ptr.p->keyLen = 1;
     ptr.p->tckey.attrLen = 1;
     ptr.p->rsLen = 3;
-    ptr.p->tckeyLenInBytes = (TcKeyReq::StaticLength +
-                              ptr.p->keyLen + ptr.p->tckey.attrLen) * 4;
+    ptr.p->tckeyLen = TcKeyReq::StaticLength + keyLen + ptr.p->tckey.attrLen;
     ptr.p->keyDataPos = TcKeyReq::StaticLength; 
     ptr.p->tckey.tableId = SYSTAB_0;
     Uint32 requestInfo = 0;
@@ -1559,9 +1548,8 @@ DbUtil::hardcodedPrepare() {
   {
     PreparedOperationPtr ptr;
     ndbrequire(c_preparedOperationPool.seizeId(ptr, 1));
-    ptr.p->keyLen = 1;
     ptr.p->rsLen = 3;
-    ptr.p->tckeyLenInBytes = (TcKeyReq::StaticLength + ptr.p->keyLen + 5) * 4;
+    ptr.p->tckeyLen = TcKeyReq::StaticLength + keyLen + 5;
     ptr.p->keyDataPos = TcKeyReq::StaticLength; 
     ptr.p->tckey.attrLen = 11;
     ptr.p->tckey.tableId = SYSTAB_0;
@@ -1615,11 +1603,9 @@ DbUtil::hardcodedPrepare() {
   {
     PreparedOperationPtr ptr;
     ndbrequire(c_preparedOperationPool.seizeId(ptr, 2));
-    ptr.p->keyLen = 1;
     ptr.p->tckey.attrLen = 5;
     ptr.p->rsLen = 0;
-    ptr.p->tckeyLenInBytes = (TcKeyReq::StaticLength +
-                              ptr.p->keyLen + ptr.p->tckey.attrLen) * 4;
+    ptr.p->tckeyLen = TcKeyReq::StaticLength + keyLen + ptr.p->tckey.attrLen;
     ptr.p->keyDataPos = TcKeyReq::StaticLength;
     ptr.p->tckey.tableId = SYSTAB_0;
     Uint32 requestInfo = 0;
@@ -1637,9 +1623,8 @@ DbUtil::hardcodedPrepare() {
   {
     PreparedOperationPtr ptr;
     ndbrequire(c_preparedOperationPool.seizeId(ptr, 3));
-    ptr.p->keyLen = 1;
     ptr.p->rsLen = 0;
-    ptr.p->tckeyLenInBytes = (TcKeyReq::StaticLength + ptr.p->keyLen + 5) * 4;
+    ptr.p->tckeyLen = TcKeyReq::StaticLength + keyLen + 5;
     ptr.p->keyDataPos = TcKeyReq::StaticLength;
     ptr.p->tckey.attrLen = 9;
     ptr.p->tckey.tableId = SYSTAB_0;
@@ -1654,9 +1639,9 @@ DbUtil::hardcodedPrepare() {
 
     Uint32 * attrInfo = &ptr.p->tckey.distrGroupHashValue;
     attrInfo[0] = 0; // IntialReadSize
-    attrInfo[1] = 3; // InterpretedSize
+    attrInfo[1] = 4; // InterpretedSize
     attrInfo[2] = 0; // FinalUpdateSize
-    attrInfo[3] = 1; // FinalReadSize
+    attrInfo[3] = 0; // FinalReadSize
     attrInfo[4] = 0; // SubroutineSize
   }
 }
@@ -1698,7 +1683,7 @@ DbUtil::execUTIL_SEQUENCE_REQ(Signal* si
   ndbrequire(transPtr.p->operations.seize(opPtr));
   
   ndbrequire(opPtr.p->rs.seize(prepOp->rsLen));
-  ndbrequire(opPtr.p->keyInfo.seize(prepOp->keyLen));
+  ndbrequire(opPtr.p->keyInfo.seize(1));
 
   transPtr.p->gci_hi = 0;
   transPtr.p->gci_lo = 0;
@@ -1740,14 +1725,13 @@ DbUtil::execUTIL_SEQUENCE_REQ(Signal* si
     ndbrequire(opPtr.p->attrInfo.seize(4));
     AttrInfoBuffer::DataBufferIterator it;
     opPtr.p->attrInfo.first(it);
-    * it.data = Interpreter::LoadConst16(7, req->value);
+    * it.data = Interpreter::LoadConst32(7);
+    ndbrequire(opPtr.p->attrInfo.next(it));
+    * it.data = req->value;
     ndbrequire(opPtr.p->attrInfo.next(it));
     * it.data = Interpreter::Write(1, 7);
     ndbrequire(opPtr.p->attrInfo.next(it))
     * it.data = Interpreter::ExitOK();
-
-    ndbrequire(opPtr.p->attrInfo.next(it));
-    AttributeHeader::init(it.data, 1, 0);
   }
  
   transPtr.p->noOfRetries = 3;
@@ -1830,7 +1814,6 @@ DbUtil::reportSequence(Signal* signal, c
     }
     case UtilSequenceReq::SetVal:
       ok = true;
-      break;
     case UtilSequenceReq::Create:
       ok = true;
       ret->sequenceValue[0] = 0;
@@ -1972,7 +1955,7 @@ DbUtil::execUTIL_EXECUTE_REQ(Signal* sig
   opPtr.p->prepOp   = prepOpPtr.p;
   opPtr.p->prepOp_i = prepOpPtr.i;
   opPtr.p->m_scanTakeOver = scanTakeOver;
-  
+
 #if 0 //def EVENT_DEBUG
   printf("opPtr.p->rs.seize( %u )\n", prepOpPtr.p->rsLen);
 #endif
@@ -2047,13 +2030,6 @@ DbUtil::execUTIL_EXECUTE_REQ(Signal* sig
     return;
   }
 
-  // quick hack for hash index build
-  if (TcKeyReq::getOperationType(prepOpPtr.p->tckey.requestInfo) != ZREAD){
-    prepOpPtr.p->tckey.attrLen =
-      prepOpPtr.p->attrInfo.getSize() + opPtr.p->attrInfo.getSize();
-    TcKeyReq::setKeyLength(prepOpPtr.p->tckey.requestInfo, keyInfo->getSize());
-  }
-
 #if 0
   const Uint32 l1 = prepOpPtr.p->tckey.attrLen;
   const Uint32 l2 = 
@@ -2137,7 +2113,7 @@ DbUtil::runOperation(Signal* signal, Tra
   
   TcKeyReq * tcKey = (TcKeyReq*)signal->getDataPtrSend();
   //ndbout << "*** 6 ***"<< endl; pop->print();
-  memcpy(tcKey, &pop->tckey, pop->tckeyLenInBytes);
+  memcpy(tcKey, &pop->tckey, 4*pop->tckeyLen);
   //ndbout << "*** 6b ***"<< endl; 
   //printTCKEYREQ(stdout, signal->getDataPtrSend(), 
   //              pop->tckeyLenInBytes >> 2, 0);
@@ -2159,7 +2135,12 @@ DbUtil::runOperation(Signal* signal, Tra
   printf("DbUtil::runOperation: ATTRINFO\n");
   op->attrInfo.print(stdout);
 #endif
-
+  
+  Uint32 attrLen = pop->attrInfo.getSize() + op->attrInfo.getSize();
+  Uint32 keyLen = op->keyInfo.getSize();
+  tcKey->attrLen = attrLen + TcKeyReq::getAIInTcKeyReq(tcKey->requestInfo);
+  TcKeyReq::setKeyLength(tcKey->requestInfo, keyLen);
+  
   /**
    * Key Info
    */
@@ -2173,12 +2154,13 @@ DbUtil::runOperation(Signal* signal, Tra
   //ndbout << "*** 7 ***" << endl;
   //printTCKEYREQ(stdout, signal->getDataPtrSend(), 
   //		pop->tckeyLenInBytes >> 2, 0);
-
+  
 #if 0 //def EVENT_DEBUG
-    printf("DbUtil::runOperation: sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, %d , JBB)\n",  pop->tckeyLenInBytes >> 2);
-    printTCKEYREQ(stdout, signal->getDataPtr(), pop->tckeyLenInBytes >> 2,0);
+  printf("DbUtil::runOperation: sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, %d , JBB)\n",  pop->tckeyLenInBytes >> 2);
+  printTCKEYREQ(stdout, signal->getDataPtr(), pop->tckeyLenInBytes >> 2,0);
 #endif
-  sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, pop->tckeyLenInBytes >> 2, JBB);
+  Uint32 sigLen = pop->tckeyLen + (keyLen > 8 ? 8 : keyLen);
+  sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, sigLen, JBB);
   
   /**
    * More the 8 words of key info not implemented

=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp	2008-12-17 19:54:19 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp	2009-02-27 16:21:03 +0000
@@ -218,7 +218,6 @@ public:
     }
 
     /*** Various Operation Info ***/
-    Uint32    keyLen;          // Length of primary key (fixed size is assumed)
     Uint32    rsLen;           // Size of result set
     Uint32    noOfKeyAttr;     // Number of key attributes
     Uint32    noOfAttr;        // Number of attributes
@@ -240,7 +239,7 @@ public:
     AttrMappingBuffer    attrMapping;
 
     /*** First signal in tckeyreq train ***/
-    Uint32    tckeyLenInBytes;    // TcKeyReq total signal length (in bytes)
+    Uint32    tckeyLen;           // TcKeyReq total signal length
     Uint32    keyDataPos;         // Where to store keydata[] in tckey signal
                                   // (in #words from base in tckey signal)
     TcKeyReq  tckey;              // Signaldata for first signal in train
@@ -261,11 +260,10 @@ public:
     
     void print() const {
       ndbout << "[-PreparedOperation-" << endl
-	     << " keyLen: " << keyLen
 	     << ", rsLen: " << rsLen
 	     << ", noOfKeyAttr: " << noOfKeyAttr 
 	     << ", noOfAttr: " << noOfAttr 
-	     << ", tckeyLenInBytes: " << tckeyLenInBytes 
+	     << ", tckeyLen: " << tckeyLen 
 	     << ", keyDataPos: " << keyDataPos << endl
 	     << "-AttrMapping- (AttrId, KeyPos)-pairs "
 	     << "(Pos=3fff if non-key attr):" << endl;

=== modified file 'storage/ndb/src/kernel/blocks/lgman.cpp'
--- a/storage/ndb/src/kernel/blocks/lgman.cpp	2008-12-20 19:52:24 +0000
+++ b/storage/ndb/src/kernel/blocks/lgman.cpp	2009-02-22 10:42:55 +0000
@@ -132,10 +132,14 @@ void
 Lgman::client_lock(BlockNumber block, int line)
 {
   if (isNdbMtLqh()) {
-    D("try lock" << hex << V(block) << dec << V(line));
+#ifdef VM_TRACE
+    Uint32 bno = blockToMain(block);
+    Uint32 ino = blockToInstance(block);
+#endif
+    D("try lock " << bno << "/" << ino << V(line));
     int ret = m_client_mutex.lock();
     ndbrequire(ret == 0);
-    D("got lock" << hex << V(block) << dec << V(line));
+    D("got lock " << bno << "/" << ino << V(line));
   }
 }
 
@@ -143,7 +147,11 @@ void
 Lgman::client_unlock(BlockNumber block, int line)
 {
   if (isNdbMtLqh()) {
-    D("unlock" << hex << V(block) << dec << V(line));
+#ifdef VM_TRACE
+    Uint32 bno = blockToMain(block);
+    Uint32 ino = blockToInstance(block);
+#endif
+    D("unlock " << bno << "/" << ino << V(line));
     int ret = m_client_mutex.unlock();
     ndbrequire(ret == 0);
   }
@@ -170,7 +178,8 @@ Lgman::execREAD_CONFIG_REQ(Signal* signa
   m_log_waiter_pool.wo_pool_init(RT_LGMAN_LOG_WAITER, pc);
   m_file_pool.init(RT_LGMAN_FILE, pc);
   m_logfile_group_pool.init(RT_LGMAN_FILEGROUP, pc);
-  m_data_buffer_pool.setSize(10);
+  // 10 -> 150M
+  m_data_buffer_pool.setSize(40);
 
   ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
@@ -247,11 +256,13 @@ Lgman::execCONTINUEB(Signal* signal){
     Ptr<Logfile_group> ptr;
     if(ptrI != RNIL)
     {
+      jam();
       m_logfile_group_pool.getPtr(ptr, ptrI);
       find_log_head(signal, ptr);
     }
     else
     {
+      jam();
       init_run_undo_log(signal);
     }
     break;
@@ -988,8 +999,18 @@ Lgman::alloc_logbuffer_memory(Ptr<Logfil
 	Buffer_idx range;
 	range.m_ptr_i= ptrI;
 	range.m_idx = cnt;
-	
-	ndbrequire(map.append((Uint32*)&range, 2));
+        
+	if (map.append((Uint32*)&range, 2) == false)
+        {
+          /**
+           * Failed to append page-range...
+           *   jump out of alloc routine
+           */
+          jam();
+          m_ctx.m_mm.release_pages(RG_DISK_OPERATIONS, 
+                                   range.m_ptr_i, range.m_idx);
+          break;
+        }
 	pages -= range.m_idx;
       }
       else
@@ -1133,14 +1154,18 @@ Logfile_client::Logfile_client(Simulated
   m_lgman= lgman;
   m_lock = lock;
   m_logfile_group_id= logfile_group_id;
-  D("client ctor" << hex << V(m_block));
+  D("client ctor " << bno << "/" << ino);
   if (m_lock)
     m_lgman->client_lock(m_block, 0);
 }
 
 Logfile_client::~Logfile_client()
 {
-  D("client dtor" << hex << V(m_block));
+#ifdef VM_TRACE
+  Uint32 bno = blockToMain(m_block);
+  Uint32 ino = blockToInstance(m_block);
+#endif
+  D("client dtor " << bno << "/" << ino);
   if (m_lock)
     m_lgman->client_unlock(m_block, 0);
 }
@@ -2573,6 +2598,8 @@ Lgman::init_run_undo_log(Signal* signal)
   Logfile_group_list& list= m_logfile_group_list;
   Logfile_group_list tmp(m_logfile_group_pool);
 
+  bool found_any = false;
+
   list.first(group);
   while(!group.isNull())
   {
@@ -2580,6 +2607,18 @@ Lgman::init_run_undo_log(Signal* signal)
     list.next(group);
     list.remove(ptr);
 
+    if (ptr.p->m_state & Logfile_group::LG_ONLINE)
+    {
+      /**
+       * No logfiles in group
+       */
+      jam();
+      tmp.addLast(ptr);
+      continue;
+    }
+    
+    found_any = true;
+
     {
       /**
        * Init buffer pointers
@@ -2622,6 +2661,17 @@ Lgman::init_run_undo_log(Signal* signal)
   }
   list = tmp;
 
+  if (found_any == false)
+  {
+    /**
+     * No logfilegroup had any logfiles
+     */
+    jam();
+    signal->theData[0] = reference();
+    sendSignal(DBLQH_REF, GSN_START_RECCONF, signal, 1, JBB);
+    return;
+  }
+  
   execute_undo_record(signal);
 }
 

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2008-09-12 12:55:29 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2009-02-17 09:26:44 +0000
@@ -193,6 +193,10 @@ private:
   void execCREATE_TABLE_CONF(Signal* signal);
   void execCREATE_HASH_MAP_REF(Signal* signal);
   void execCREATE_HASH_MAP_CONF(Signal* signal);
+  void execCREATE_FILEGROUP_REF(Signal* signal);
+  void execCREATE_FILEGROUP_CONF(Signal* signal);
+  void execCREATE_FILE_REF(Signal* signal);
+  void execCREATE_FILE_CONF(Signal* signal);
   void execNDB_STTORRY(Signal* signal);
   void execNDB_STARTCONF(Signal* signal);
   void execREAD_NODESREQ(Signal* signal);
@@ -237,6 +241,7 @@ private:
 
   void createHashMap(Signal*, Uint32 index);
   void createSystableLab(Signal* signal, unsigned index);
+  void createDDObjects(Signal*, unsigned index);
   void crSystab7Lab(Signal* signal);
   void crSystab8Lab(Signal* signal);
   void crSystab9Lab(Signal* signal);

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp	2008-09-12 12:55:29 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp	2009-02-17 09:26:44 +0000
@@ -87,6 +87,10 @@ Ndbcntr::Ndbcntr(Block_context& ctx):
   addRecSignal(GSN_CREATE_TABLE_CONF, &Ndbcntr::execCREATE_TABLE_CONF);
   addRecSignal(GSN_CREATE_HASH_MAP_REF, &Ndbcntr::execCREATE_HASH_MAP_REF);
   addRecSignal(GSN_CREATE_HASH_MAP_CONF, &Ndbcntr::execCREATE_HASH_MAP_CONF);
+  addRecSignal(GSN_CREATE_FILEGROUP_REF, &Ndbcntr::execCREATE_FILEGROUP_REF);
+  addRecSignal(GSN_CREATE_FILEGROUP_CONF, &Ndbcntr::execCREATE_FILEGROUP_CONF);
+  addRecSignal(GSN_CREATE_FILE_REF, &Ndbcntr::execCREATE_FILE_REF);
+  addRecSignal(GSN_CREATE_FILE_CONF, &Ndbcntr::execCREATE_FILE_CONF);
   addRecSignal(GSN_NDB_STTORRY, &Ndbcntr::execNDB_STTORRY);
   addRecSignal(GSN_NDB_STARTCONF, &Ndbcntr::execNDB_STARTCONF);
   addRecSignal(GSN_READ_NODESREQ, &Ndbcntr::execREAD_NODESREQ);

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2008-12-02 13:10:49 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-02-24 13:00:25 +0000
@@ -55,6 +55,7 @@
 #include <signaldata/TakeOver.hpp>
 #include <signaldata/CreateNodegroupImpl.hpp>
 #include <signaldata/DropNodegroupImpl.hpp>
+#include <signaldata/CreateFilegroup.hpp>
 
 // used during shutdown for reporting current startphase
 // accessed from Emulator.cpp, NdbShutdown()
@@ -210,12 +211,16 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* s
   jamEntry();
   switch (sysErr->errorCode){
   case SystemError::GCPStopDetected:
+  {
     BaseString::snprintf(buf, sizeof(buf), 
 	     "Node %d killed this node because "
 	     "GCP stop was detected",     
 	     killingNode);
+    signal->theData[0] = 7025;
+    EXECUTE_DIRECT(DBDIH, GSN_DUMP_STATE_ORD, signal, 1);
+    jamEntry();
     break;
-
+  }
   case SystemError::CopyFragRefError:
     CRASH_INSERTION(1000);
     BaseString::snprintf(buf, sizeof(buf), 
@@ -256,6 +261,131 @@ void Ndbcntr::execSYSTEM_ERROR(Signal* s
   return;
 }//Ndbcntr::execSYSTEM_ERROR()
 
+
+struct ddentry
+{
+  Uint32 type;
+  const char * name;
+  Uint64 size;
+};
+
+/**
+ * f_dd[] = {
+ * { DictTabInfo::LogfileGroup, "DEFAULT-LG", 32*1024*1024 },
+ * { DictTabInfo::Undofile, "undofile.dat", 64*1024*1024 },
+ * { DictTabInfo::Tablespace, "DEFAULT-TS", 1024*1024 },
+ * { DictTabInfo::Datafile, "datafile.dat", 64*1024*1024 },
+ * { ~0, 0, 0 }
+ * };
+ */
+Vector<ddentry> f_dd;
+
+Uint64
+parse_size(const char * src)
+{
+  Uint64 num = 0;
+  char * endptr = 0;
+  num = strtoll(src, &endptr, 10);
+
+  if (endptr)
+  {
+    switch(* endptr){
+    case 'k':
+    case 'K':
+      num *= 1024;
+      break;
+    case 'm':
+    case 'M':
+      num *= 1024;
+      num *= 1024;
+      break;
+    case 'g':
+    case 'G':
+      num *= 1024;
+      num *= 1024;
+      num *= 1024;
+      break;
+    }
+  }
+  return num;
+}
+
+static
+int
+parse_spec(Vector<ddentry> & dst,
+           const char * src,
+           Uint32 type)
+{
+  const char * key;
+  Uint32 filetype;
+
+  struct ddentry group;
+  if (type == DictTabInfo::LogfileGroup)
+  {
+    key = "undo_buffer_size=";
+    group.size = 64*1024*1024;
+    group.name = "DEFAULT-LG";
+    group.type = type;
+    filetype = DictTabInfo::Undofile;
+  }
+  else
+  {
+    key = "extent_size=";
+    group.size = 1024*1024;
+    group.name = "DEFAULT-TS";
+    group.type = type;
+    filetype = DictTabInfo::Datafile;
+  }
+  size_t keylen = strlen(key);
+
+  BaseString arg(src);
+  Vector<BaseString> list;
+  arg.split(list, ";");
+
+  bool first = true;
+  for (Uint32 i = 0; i<list.size(); i++)
+  {
+    list[i].trim();
+    if (strncasecmp(list[i].c_str(), "name=", sizeof("name=")-1) == 0)
+    {
+      group.name= strdup(list[i].c_str() + sizeof("name=")-1);
+    }
+    else if (strncasecmp(list[i].c_str(), key, keylen) == 0)
+    {
+      group.size = parse_size(list[i].c_str() + keylen);
+    }
+    else
+    {
+      /**
+       * interpret as filespec
+       */
+      struct ddentry entry;
+      const char * path = list[i].c_str();
+      char * sizeptr = const_cast<char*>(strchr(path, ':'));
+      if (sizeptr == 0)
+      {
+        return -1;
+      }
+      * sizeptr = 0;
+
+      entry.name = strdup(path);
+      entry.size = parse_size(sizeptr + 1);
+      entry.type = filetype;
+
+      if (first)
+      {
+        /**
+         * push group aswell
+         */
+        first = false;
+        dst.push_back(group);
+      }
+      dst.push_back(entry);
+    }
+  }
+  return 0;
+}
+
 void 
 Ndbcntr::execREAD_CONFIG_REQ(Signal* signal)
 {
@@ -270,6 +400,50 @@ Ndbcntr::execREAD_CONFIG_REQ(Signal* sig
     m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
 
+  Uint32 dl = 0;
+  ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl);
+  if (dl == 0)
+  {
+    const char * lgspec = 0;
+    char buf[1024];
+    if (!ndb_mgm_get_string_parameter(p, CFG_DB_DD_LOGFILEGROUP_SPEC, &lgspec))
+    {
+      jam();
+
+      if (parse_spec(f_dd, lgspec, DictTabInfo::LogfileGroup))
+      {
+        BaseString::snprintf(buf, sizeof(buf),
+                             "Unable to parse InitalLogfileGroup: %s", lgspec);
+        progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+      }
+    }
+
+    const char * tsspec = 0;
+    if (!ndb_mgm_get_string_parameter(p, CFG_DB_DD_TABLEPACE_SPEC, &tsspec))
+    {
+      if (f_dd.size() == 0)
+      {
+        warningEvent("InitalTablespace specified, "
+                     "but InitalLogfileGroup is not!");
+        warningEvent("Ignoring InitalTablespace: %s",
+                     tsspec);
+      }
+      else
+      {
+        if (parse_spec(f_dd, tsspec, DictTabInfo::Tablespace))
+        {
+          BaseString::snprintf(buf, sizeof(buf),
+                               "Unable to parse InitalTablespace: %s", tsspec);
+          progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+        }
+      }
+    }
+  }
+
+  struct ddentry empty;
+  empty.type = ~0;
+  f_dd.push_back(empty);
+
   ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
   conf->senderData = senderData;
@@ -297,14 +471,6 @@ void Ndbcntr::execSTTOR(Signal* signal) 
     break;
   case ZSTART_PHASE_1:
     jam();
-    {
-      Uint32 db_watchdog_interval = 0;
-      const ndb_mgm_configuration_iterator * p = 
-        m_ctx.m_config.getOwnConfigIterator();
-      ndb_mgm_get_int_parameter(p, CFG_DB_WATCHDOG_INTERVAL, &db_watchdog_interval);
-      ndbrequire(db_watchdog_interval);
-      update_watch_dog_timer(db_watchdog_interval);
-    }
     startPhase1Lab(signal);
     break;
   case ZSTART_PHASE_2:
@@ -1821,7 +1987,6 @@ void Ndbcntr::systemErrorLab(Signal* sig
 /*       |  :  |   :             |                   v                       */
 /*       | 2048|   0             |                   v                       */
 /*---------------------------------------------------------------------------*/
-
 void Ndbcntr::beginSchemaTransLab(Signal* signal)
 {
   c_schemaTransId = reference();
@@ -1914,11 +2079,174 @@ void Ndbcntr::execSCHEMA_TRANS_END_REF(S
   ndbrequire(false);
 }
 
+void
+Ndbcntr::createDDObjects(Signal * signal, unsigned index)
+{
+  const ndb_mgm_configuration_iterator * p =
+    m_ctx.m_config.getOwnConfigIterator();
+  ndbrequire(p != 0);
+
+  Uint32 propPage[256];
+  LinearWriter w(propPage, 256);
+
+  const ddentry* entry = &f_dd[index];
+
+  switch(entry->type){
+  case DictTabInfo::LogfileGroup:
+  case DictTabInfo::Tablespace:
+  {
+    jam();
+
+    DictFilegroupInfo::Filegroup fg; fg.init();
+    BaseString::snprintf(fg.FilegroupName, sizeof(fg.FilegroupName),
+                         entry->name);
+    fg.FilegroupType = entry->type;
+    if (entry->type == DictTabInfo::LogfileGroup)
+    {
+      jam();
+      fg.LF_UndoBufferSize = Uint32(entry->size);
+    }
+    else
+    {
+      jam();
+      fg.TS_ExtentSize = Uint32(entry->size);
+      fg.TS_LogfileGroupId = RNIL;
+      fg.TS_LogfileGroupVersion = RNIL;
+    }
+
+    SimpleProperties::UnpackStatus s;
+    s = SimpleProperties::pack(w,
+                               &fg,
+                               DictFilegroupInfo::Mapping,
+                               DictFilegroupInfo::MappingSize, true);
+
+
+    Uint32 length = w.getWordsUsed();
+    LinearSectionPtr ptr[3];
+    ptr[0].p = &propPage[0];
+    ptr[0].sz = length;
+
+    CreateFilegroupReq * req = (CreateFilegroupReq*)signal->getDataPtrSend();
+    req->senderRef = reference();
+    req->senderData = index;
+    req->objType = entry->type;
+    req->transId = c_schemaTransId;
+    req->transKey = c_schemaTransKey;
+    req->requestInfo = 0;
+    sendSignal(DBDICT_REF, GSN_CREATE_FILEGROUP_REQ, signal,
+               CreateFilegroupReq::SignalLength, JBB, ptr, 1);
+    return;
+  }
+  case DictTabInfo::Undofile:
+  case DictTabInfo::Datafile:
+  {
+    jam();
+    Uint32 propPage[256];
+    LinearWriter w(propPage, 256);
+    DictFilegroupInfo::File f; f.init();
+    BaseString::snprintf(f.FileName, sizeof(f.FileName), entry->name);
+    f.FileType = entry->type;
+    f.FilegroupId = RNIL;
+    f.FilegroupVersion = RNIL;
+    f.FileSizeHi = Uint32(entry->size >> 32);
+    f.FileSizeLo = Uint32(entry->size);
+
+    SimpleProperties::UnpackStatus s;
+    s = SimpleProperties::pack(w,
+                               &f,
+                               DictFilegroupInfo::FileMapping,
+                               DictFilegroupInfo::FileMappingSize, true);
+
+    Uint32 length = w.getWordsUsed();
+    LinearSectionPtr ptr[3];
+    ptr[0].p = &propPage[0];
+    ptr[0].sz = length;
+
+    CreateFileReq * req = (CreateFileReq*)signal->getDataPtrSend();
+    req->senderRef = reference();
+    req->senderData = index;
+    req->objType = entry->type;
+    req->transId = c_schemaTransId;
+    req->transKey = c_schemaTransKey;
+    req->requestInfo = CreateFileReq::ForceCreateFile;
+    sendSignal(DBDICT_REF, GSN_CREATE_FILE_REQ, signal,
+               CreateFileReq::SignalLength, JBB, ptr, 1);
+    return;
+  }
+  default:
+    break;
+  }
+
+  endSchemaTransLab(signal);
+}
+
+void
+Ndbcntr::execCREATE_FILEGROUP_REF(Signal* signal)
+{
+  jamEntry();
+  CreateFilegroupRef* ref = (CreateFilegroupRef*)signal->getDataPtr();
+  char buf[1024];
+
+  const ddentry* entry = &f_dd[ref->senderData];
+
+  if (entry->type == DictTabInfo::LogfileGroup)
+  {
+    BaseString::snprintf(buf, sizeof(buf), "create logfilegroup err %u",
+                         ref->errorCode);
+  }
+  else if (entry->type == DictTabInfo::Tablespace)
+  {
+    BaseString::snprintf(buf, sizeof(buf), "create tablespace err %u",
+                         ref->errorCode);
+  }
+  progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+}
+
+void
+Ndbcntr::execCREATE_FILEGROUP_CONF(Signal* signal)
+{
+  jamEntry();
+  CreateFilegroupConf* conf = (CreateFilegroupConf*)signal->getDataPtr();
+  createDDObjects(signal, conf->senderData + 1);
+}
+
+void
+Ndbcntr::execCREATE_FILE_REF(Signal* signal)
+{
+  jamEntry();
+  CreateFileRef* ref = (CreateFileRef*)signal->getDataPtr();
+  char buf[1024];
+
+  const ddentry* entry = &f_dd[ref->senderData];
+
+  if (entry->type == DictTabInfo::Undofile)
+  {
+    BaseString::snprintf(buf, sizeof(buf), "create undofile %s err %u",
+                         entry->name,
+                         ref->errorCode);
+  }
+  else if (entry->type == DictTabInfo::Datafile)
+  {
+    BaseString::snprintf(buf, sizeof(buf), "create datafile %s err %u",
+                         entry->name,
+                         ref->errorCode);
+  }
+  progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, buf);
+}
+
+void
+Ndbcntr::execCREATE_FILE_CONF(Signal* signal)
+{
+  jamEntry();
+  CreateFileConf* conf = (CreateFileConf*)signal->getDataPtr();
+  createDDObjects(signal, conf->senderData + 1);
+}
+
 void Ndbcntr::createSystableLab(Signal* signal, unsigned index)
 {
   if (index >= g_sysTableCount) {
     ndbassert(index == g_sysTableCount);
-    endSchemaTransLab(signal);
+    createDDObjects(signal, 0);
     return;
   }
   const SysTable& table = *g_sysTableList[index];
@@ -3018,25 +3346,30 @@ void Ndbcntr::execSTART_ORD(Signal* sign
 
 #define CLEAR_DX 13
 #define CLEAR_LCP 3
+#define CLEAR_DD 2
+// FileSystemPathDataFiles FileSystemPathUndoFiles
 
 void
 Ndbcntr::clearFilesystem(Signal* signal)
 {
-  const Uint32 lcp = c_fsRemoveCount >= CLEAR_DX;
-  
+  jam();
   FsRemoveReq * req  = (FsRemoveReq *)signal->getDataPtrSend();
   req->userReference = reference();
   req->userPointer   = 0;
   req->directory     = 1;
   req->ownDirectory  = 1;
 
-  if (lcp == 0)
+  const Uint32 DX = CLEAR_DX;
+  const Uint32 LCP = CLEAR_DX + CLEAR_LCP;
+  const Uint32 DD = CLEAR_DX + CLEAR_LCP + CLEAR_DD;
+
+  if (c_fsRemoveCount < DX)
   {
     FsOpenReq::setVersion(req->fileNumber, 3);
     FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_CTL); // Can by any...
     FsOpenReq::v1_setDisk(req->fileNumber, c_fsRemoveCount);
   }
-  else
+  else if (c_fsRemoveCount < LCP)
   {
     FsOpenReq::setVersion(req->fileNumber, 5);
     FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
@@ -3044,6 +3377,19 @@ Ndbcntr::clearFilesystem(Signal* signal)
     FsOpenReq::v5_setTableId(req->fileNumber, 0);
     FsOpenReq::v5_setFragmentId(req->fileNumber, 0);
   }
+  else if (c_fsRemoveCount < DD)
+  {
+    req->ownDirectory  = 0;
+    FsOpenReq::setVersion(req->fileNumber, 6);
+    FsOpenReq::setSuffix(req->fileNumber, FsOpenReq::S_DATA);
+    FsOpenReq::v5_setLcpNo(req->fileNumber,
+                           FsOpenReq::BP_DD_DF + c_fsRemoveCount - LCP);
+  }
+  else
+  {
+    ndbrequire(false);
+  }
+
   sendSignal(NDBFS_REF, GSN_FSREMOVEREQ, signal, 
              FsRemoveReq::SignalLength, JBA);
   c_fsRemoveCount++;
@@ -3052,12 +3398,12 @@ Ndbcntr::clearFilesystem(Signal* signal)
 void
 Ndbcntr::execFSREMOVECONF(Signal* signal){
   jamEntry();
-  if(c_fsRemoveCount == CLEAR_DX + CLEAR_LCP){
+  if(c_fsRemoveCount == CLEAR_DX + CLEAR_LCP + CLEAR_DD){
     jam();
     sendSttorry(signal);
   } else {
     jam();
-    ndbrequire(c_fsRemoveCount < CLEAR_DX + CLEAR_LCP);
+    ndbrequire(c_fsRemoveCount < CLEAR_DX + CLEAR_LCP + CLEAR_DD);
     clearFilesystem(signal);
   }//if
 }
@@ -3289,3 +3635,5 @@ Ndbcntr::execDROP_NODEGROUP_IMPL_REQ(Sig
                DropNodegroupImplConf::SignalLength, JBB);
   }
 }
+
+template class Vector<ddentry>;

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp	2008-12-02 13:10:49 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp	2009-02-17 09:26:44 +0000
@@ -30,9 +30,6 @@ public:
   virtual ~AsyncFile() {};
 
   virtual int init() = 0;
-
-  void reportTo( MemoryChannel<Request> *reportTo );
-
   virtual bool isOpen() = 0;
 
   Filename theFileName;

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp	2008-10-14 07:34:55 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp	2009-02-20 08:53:44 +0000
@@ -46,7 +46,7 @@ Filename::~Filename(){
 }
 
 void 
-Filename::set(Filename::NameSpec& spec,
+Filename::set(const BaseString basepath[],
 	      BlockReference blockReference, 
 	      const Uint32 filenumber[4], bool dir) 
 {
@@ -59,14 +59,14 @@ Filename::set(Filename::NameSpec& spec,
   if (version == 2)
   {
     sz = BaseString::snprintf(theName, sizeof(theName), "%s", 
-         spec.backup_path.c_str());
-    m_base_name = theName + spec.backup_path.length();
+                              basepath[FsOpenReq::BP_BACKUP].c_str());
+    m_base_name = theName + basepath[FsOpenReq::BP_BACKUP].length();
   }
   else
   {
     sz = BaseString::snprintf(theName, sizeof(theName), "%s", 
-         spec.fs_path.c_str());
-    m_base_name = theName + spec.fs_path.length();
+                              basepath[FsOpenReq::BP_FS].c_str());
+    m_base_name = theName + basepath[FsOpenReq::BP_FS].length();
   }
   
   switch(version){
@@ -120,14 +120,14 @@ Filename::set(Filename::NameSpec& spec,
     const Uint32 nodeId = FsOpenReq::v2_getNodeId(filenumber);
     const Uint32 count = FsOpenReq::v2_getCount(filenumber);
     
-    BaseString::snprintf(buf, sizeof(buf), "BACKUP%sBACKUP-%d%s",
+    BaseString::snprintf(buf, sizeof(buf), "BACKUP%sBACKUP-%u%s",
 	     DIR_SEPARATOR, seq, DIR_SEPARATOR); 
     strcat(theName, buf);
     if(count == 0xffffffff) {
-      BaseString::snprintf(buf, sizeof(buf), "BACKUP-%d.%d",
+      BaseString::snprintf(buf, sizeof(buf), "BACKUP-%u.%d",
 	       seq, nodeId); strcat(theName, buf);
     } else {
-      BaseString::snprintf(buf, sizeof(buf), "BACKUP-%d-%d.%d",
+      BaseString::snprintf(buf, sizeof(buf), "BACKUP-%u-%d.%d",
 	       seq, count, nodeId); strcat(theName, buf);
     }
     break;
@@ -153,6 +153,13 @@ Filename::set(Filename::NameSpec& spec,
     strcat(theName, buf);
     break;
   }
+  case 6:
+  {
+    Uint32 bp = FsOpenReq::v5_getLcpNo(filenumber);
+    sz = BaseString::snprintf(theName, sizeof(theName), "%s",
+                              basepath[bp].c_str());
+    break;
+  }
   default:
     ERROR_SET(ecError, NDBD_EXIT_AFS_PARAMETER,"","Wrong version");
   }
@@ -173,7 +180,7 @@ Filename::set(Filename::NameSpec& spec,
 }
 
 void 
-Filename::set(Filename::NameSpec& spec,
+Filename::set(const BaseString & basepath,
 	      SegmentedSectionPtr ptr, class SectionSegmentPool& pool)
 {
   char buf[PATH_MAX];
@@ -193,7 +200,7 @@ Filename::set(Filename::NameSpec& spec,
     }
 #endif
     BaseString::snprintf(theName, sizeof(theName), "%s%s",
-                         spec.fs_path.c_str(), buf);
-    m_base_name = theName + spec.fs_path.length();
+                         basepath.c_str(), buf);
+    m_base_name = theName + basepath.length();
   }
 }

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Filename.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Filename.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Filename.hpp	2009-02-17 07:52:13 +0000
@@ -62,19 +62,12 @@ public:
   Filename();
   ~Filename();
 
-  struct NameSpec {
-    NameSpec(BaseString& f, BaseString&b) :
-      fs_path(f), backup_path(b) {}
-    BaseString& fs_path;
-    BaseString& backup_path;
-  };
-  
-  void set(NameSpec& spec, 
+  void set(const BaseString basepath[],
 	   BlockReference, const Uint32 fileno[4], bool = false);
-  void set(NameSpec& spec, 
+  void set(const BaseString & basepath,
 	   SegmentedSectionPtr ptr, class SectionSegmentPool&);
   
-  const char* c_str() const;     // Complete name including dirname
+  const char* c_str() const;         // Complete name including dirname
   const char* get_base_name() const; // Exclude fs (or backup) path
 private:
   char theName[PATH_MAX];

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2008-12-02 13:10:49 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-02-17 09:26:44 +0000
@@ -124,6 +124,53 @@ Ndbfs::~Ndbfs()
     delete theRequestPool;
 }
 
+static
+bool
+do_mkdir(const char * path)
+{
+#ifdef NDB_WIN32
+  return CreateDirectory(path, 0);
+#else
+  return ::mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP) == 0;
+#endif
+}
+
+static
+void
+add_path(BaseString& dst, const char * add)
+{
+  const char * tmp = dst.c_str();
+  unsigned len = dst.length();
+  unsigned dslen = (unsigned)strlen(DIR_SEPARATOR);
+
+  if (len > dslen && strcmp(tmp+(len - dslen), DIR_SEPARATOR) != 0)
+    dst.append(DIR_SEPARATOR);
+  dst.append(add);
+}
+
+static
+bool
+validate_path(BaseString & dst,
+              const char * path)
+{
+  char buf2[PATH_MAX];
+  memset(buf2, 0,sizeof(buf2));
+#ifdef NDB_WIN32
+  CreateDirectory(path, 0);
+  char* szFilePart;
+  if(!GetFullPathName(path, sizeof(buf2), buf2, &szFilePart) ||
+     (GetFileAttributes(buf2) & FILE_ATTRIBUTE_READONLY))
+    return false;
+#else
+  if (::realpath(path, buf2) == NULL ||
+      ::access(buf2, W_OK) != 0)
+    return false;
+#endif
+  dst.assign(buf2);
+  add_path(dst, "");
+  return true;
+}
+
 void 
 Ndbfs::execREAD_CONFIG_REQ(Signal* signal)
 {
@@ -135,12 +182,67 @@ Ndbfs::execREAD_CONFIG_REQ(Signal* signa
   const ndb_mgm_configuration_iterator * p = 
     m_ctx.m_config.getOwnConfigIterator();
   ndbrequire(p != 0);
-  theFileSystemPath.assfmt("%sndb_%u_fs%s", m_ctx.m_config.fileSystemPath(),
-			   getOwnNodeId(), DIR_SEPARATOR);
-  theBackupFilePath.assign(m_ctx.m_config.backupFilePath());
+  BaseString tmp;
+  tmp.assfmt("ndb_%u_fs%s", getOwnNodeId(), DIR_SEPARATOR);
+  m_base_path[FsOpenReq::BP_FS].assfmt("%s%s",
+                                       m_ctx.m_config.fileSystemPath(),
+                                       tmp.c_str());
+  m_base_path[FsOpenReq::BP_BACKUP].assign(m_ctx.m_config.backupFilePath());
 
   theRequestPool = new Pool<Request>;
 
+  const char * ddpath = 0;
+  ndb_mgm_get_string_parameter(p, CFG_DB_DD_FILESYSTEM_PATH, &ddpath);
+
+  {
+    const char * datapath = 0;
+    ndb_mgm_get_string_parameter(p, CFG_DB_DD_DATAFILE_PATH, &datapath);
+    if (datapath == 0)
+    {
+      if (ddpath)
+        datapath = ddpath;
+      else
+        datapath = m_ctx.m_config.fileSystemPath();
+    }
+
+    BaseString path;
+    add_path(path, datapath);
+    do_mkdir(path.c_str());
+    add_path(path, tmp.c_str());
+    do_mkdir(path.c_str());
+    if (!validate_path(m_base_path[FsOpenReq::BP_DD_DF], path.c_str()))
+    {
+      ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
+                m_base_path[FsOpenReq::BP_DD_DF].c_str(),
+                "FileSystemPathDataFiles");
+    }
+  }
+
+  {
+    const char * undopath = 0;
+    ndb_mgm_get_string_parameter(p, CFG_DB_DD_UNDOFILE_PATH, &undopath);
+    if (undopath == 0)
+    {
+      if (ddpath)
+        undopath = ddpath;
+      else
+        undopath = m_ctx.m_config.fileSystemPath();
+    }
+
+    BaseString path;
+    add_path(path, undopath);
+    do_mkdir(path.c_str());
+    add_path(path, tmp.c_str());
+    do_mkdir(path.c_str());
+
+    if (!validate_path(m_base_path[FsOpenReq::BP_DD_UF], path.c_str()))
+    {
+      ERROR_SET(fatal, NDBD_EXIT_AFS_INVALIDPATH,
+                m_base_path[FsOpenReq::BP_DD_UF].c_str(),
+                "FileSystemPathUndoFiles");
+    }
+  }
+
   m_maxFiles = 0;
   ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
   Uint32 noIdleFiles = 27;
@@ -199,14 +301,7 @@ Ndbfs::execSTTOR(Signal* signal)
   if(signal->theData[1] == 0){ // StartPhase 0
     jam();
     
-    {
-#ifdef NDB_WIN32
-      CreateDirectory(theFileSystemPath.c_str(), 0);
-#else
-      mkdir(theFileSystemPath.c_str(),
-	    S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP);
-#endif
-    }      
+    do_mkdir(m_base_path[FsOpenReq::BP_FS].c_str());
     
     cownref = NDBFS_REF;
     // close all open files
@@ -250,19 +345,33 @@ Ndbfs::execFSOPENREQ(Signal* signal)
   bool bound = (fsOpenReq->fileFlags & FsOpenReq::OM_THREAD_POOL) == 0;
   AsyncFile* file = getIdleFile(bound);
   ndbrequire(file != NULL);
-  Filename::NameSpec spec(theFileSystemPath, theBackupFilePath);
 
   Uint32 userPointer = fsOpenReq->userPointer;
 
   if(signal->getNoOfSections() == 0){
     jam();
-    file->theFileName.set(spec, userRef, fsOpenReq->fileNumber);
+    file->theFileName.set(m_base_path, userRef, fsOpenReq->fileNumber);
   } else {
     jam();
     SectionHandle handle(this, signal);
     SegmentedSectionPtr ptr;
     handle.getSection(ptr, FsOpenReq::FILENAME);
-    file->theFileName.set(spec, ptr, g_sectionSegmentPool);
+    // QOD, should be arg to FSOPEN
+    if (refToMain(userRef) == TSMAN)
+    {
+      file->theFileName.set(m_base_path[FsOpenReq::BP_DD_DF],
+                            ptr, g_sectionSegmentPool);
+    }
+    else if (refToMain(userRef) == LGMAN)
+    {
+      file->theFileName.set(m_base_path[FsOpenReq::BP_DD_UF],
+                            ptr, g_sectionSegmentPool);
+    }
+    else
+    {
+      file->theFileName.set(m_base_path[FsOpenReq::BP_FS],
+                            ptr, g_sectionSegmentPool);
+    }
     releaseSections(handle);
   }
   
@@ -343,9 +452,10 @@ Ndbfs::execFSREMOVEREQ(Signal* signal)
   AsyncFile* file = getIdleFile(true);
   ndbrequire(file != NULL);
 
-  Filename::NameSpec spec(theFileSystemPath, theBackupFilePath);
-  file->theFileName.set(spec, userRef, req->fileNumber, req->directory);
-  
+  Uint32 version = FsOpenReq::getVersion(req->fileNumber);
+  Uint32 bp = FsOpenReq::v5_getLcpNo(req->fileNumber);
+  file->theFileName.set(m_base_path, userRef, req->fileNumber, req->directory);
+
   Request* request = theRequestPool->get();
   request->action = Request::rmrf;
   request->par.rmrf.directory = req->directory;
@@ -355,7 +465,16 @@ Ndbfs::execFSREMOVEREQ(Signal* signal)
   request->file = file;
   request->theTrace = signal->getTrace();
   
+  if (version == 6)
+  {
+    if (m_base_path[FsOpenReq::BP_FS] == m_base_path[bp])
+      goto ignore;
+  }
+
   ndbrequire(forward(file, request));
+  return;
+ignore:
+  report(request, signal);
 }
 
 /*

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp	2008-12-02 13:10:49 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp	2009-02-17 09:26:44 +0000
@@ -21,6 +21,7 @@
 #include "Pool.hpp"
 #include "AsyncFile.hpp"
 #include "OpenFiles.hpp"
+#include <signaldata/FsOpenReq.hpp>
 
 class AsyncIoThread;
 
@@ -86,8 +87,7 @@ private:
   Vector<AsyncFile*> theIdleUnboundFiles; // List of idle AsyncFiles
   OpenFiles theOpenFiles;           // List of open AsyncFiles
 
-  BaseString theFileSystemPath;
-  BaseString theBackupFilePath;
+  BaseString m_base_path[FsOpenReq::BP_MAX];
   
   // Statistics variables
   Uint32 m_maxOpenedFiles;

=== modified file 'storage/ndb/src/kernel/blocks/pgman.cpp'
--- a/storage/ndb/src/kernel/blocks/pgman.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/kernel/blocks/pgman.cpp	2009-03-12 10:59:57 +0000
@@ -200,6 +200,7 @@ Pgman::execSTTOR(Signal* signal)
         c_tup = 0;
       }
       c_lgman = (Lgman*)globalData.getBlock(LGMAN);
+      c_tsman = (Tsman*)globalData.getBlock(TSMAN);
     }
     break;
   case 3:
@@ -1297,11 +1298,15 @@ Pgman::process_lcp_locked(Signal* signal
   ptr.p->m_last_lcp = m_last_lcp;
   if (ptr.p->m_state & Page_entry::DIRTY)
   {
-    Ptr<GlobalPage> org, copy;
-    ndbrequire(m_global_page_pool.seize(copy));
-    m_global_page_pool.getPtr(org, ptr.p->m_real_page_i);
-    memcpy(copy.p, org.p, sizeof(GlobalPage));
-    ptr.p->m_copy_page_i = copy.i;
+    {
+      // protect copy-page
+      Tablespace_client tsman(signal, this, c_tsman, 0, 0, 0);
+      Ptr<GlobalPage> org, copy;
+      ndbrequire(m_global_page_pool.seize(copy));
+      m_global_page_pool.getPtr(org, ptr.p->m_real_page_i);
+      memcpy(copy.p, org.p, sizeof(GlobalPage));
+      ptr.p->m_copy_page_i = copy.i;
+    }
     
     m_lcp_outstanding++;
     ptr.p->m_state |= Page_entry::LCP;
@@ -1320,13 +1325,16 @@ Pgman::process_lcp_locked(Signal* signal
 void
 Pgman::process_lcp_locked_fswriteconf(Signal* signal, Ptr<Page_entry> ptr)
 {
-  Ptr<GlobalPage> org, copy;
-  m_global_page_pool.getPtr(copy, ptr.p->m_copy_page_i);
-  m_global_page_pool.getPtr(org, ptr.p->m_real_page_i);
-  memcpy(org.p, copy.p, sizeof(GlobalPage));
-  m_global_page_pool.release(copy);
-
-  ptr.p->m_copy_page_i = RNIL;
+  {
+    // protect copy-page
+    Tablespace_client tsman(signal, this, c_tsman, 0, 0, 0);
+    Ptr<GlobalPage> org, copy;
+    m_global_page_pool.getPtr(copy, ptr.p->m_copy_page_i);
+    m_global_page_pool.getPtr(org, ptr.p->m_real_page_i);
+    memcpy(org.p, copy.p, sizeof(GlobalPage));
+    m_global_page_pool.release(copy);
+    ptr.p->m_copy_page_i = RNIL;
+  }
 
   Page_sublist& pl = *m_page_sublist[Page_entry::SL_LOCKED];
   pl.next(ptr);

=== modified file 'storage/ndb/src/kernel/blocks/pgman.hpp'
--- a/storage/ndb/src/kernel/blocks/pgman.hpp	2008-11-16 15:31:55 +0000
+++ b/storage/ndb/src/kernel/blocks/pgman.hpp	2009-02-27 10:21:05 +0000
@@ -369,6 +369,7 @@ private:
 
   class Dbtup *c_tup;
   class Lgman *c_lgman;
+  class Tsman *c_tsman;
 
   // loop status
   bool m_stats_loop_on;

=== modified file 'storage/ndb/src/kernel/blocks/print_file.cpp'
--- a/storage/ndb/src/kernel/blocks/print_file.cpp	2008-10-10 07:29:05 +0000
+++ b/storage/ndb/src/kernel/blocks/print_file.cpp	2009-02-18 21:59:10 +0000
@@ -193,7 +193,7 @@ print_extent_page(int count, void* ptr, 
   int no = count * per_page;
   
   const int max = count < g_df_zero.m_extent_pages ? 
-    per_page : g_df_zero.m_extent_count % per_page;
+    per_page : g_df_zero.m_extent_count - (g_df_zero.m_extent_count - 1) * per_page;
 
   File_formats::Datafile::Extent_page * page = 
     (File_formats::Datafile::Extent_page*)ptr;
@@ -201,7 +201,7 @@ print_extent_page(int count, void* ptr, 
   ndbout << "Extent page: " << count
 	 << ", lsn = [ " 
 	 << page->m_page_header.m_page_lsn_hi << " " 
-	 << page->m_page_header.m_page_lsn_lo << "]" 
+	 << page->m_page_header.m_page_lsn_lo << "] " 
 	 << endl;
   for(int i = 0; i<max; i++)
   {

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2008-11-13 13:36:29 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2009-02-18 15:01:04 +0000
@@ -156,6 +156,8 @@ public:
     QmgrState sendPresToStatus;
     FailState failState;
     BlockReference blockRef;
+    Uint64 m_secret;
+    Uint64 m_alloc_timeout;
 
     NodeRec() { }
   }; /* p2c: size = 52 bytes */
@@ -320,7 +322,7 @@ private:
   void electionWon(Signal* signal);
   void cmInfoconf010Lab(Signal* signal);
   
-  void apiHbHandlingLab(Signal* signal);
+  void apiHbHandlingLab(Signal* signal, Uint64 now);
   void timerHandlingLab(Signal* signal);
   void hbReceivedLab(Signal* signal);
   void sendCmRegrefLab(Signal* signal, BlockReference ref, 

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2008-11-13 13:36:29 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2009-02-18 15:01:04 +0000
@@ -27,6 +27,10 @@ void Qmgr::initData() 
 
   // Records with constant sizes
   nodeRec = new NodeRec[MAX_NODES];
+  for (Uint32 i = 0; i<MAX_NODES; i++)
+  {
+    nodeRec[i].m_secret = 0;
+  }
 
   cnoCommitFailedNodes = 0;
   c_maxDynamicId = 0;

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2009-01-29 16:49:19 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2009-03-12 11:06:48 +0000
@@ -437,9 +437,14 @@ void Qmgr::execCONNECT_REP(Signal* signa
     infoEvent("Discarding CONNECT_REP(%d)", nodeId);
     return;
   }
-  
+
   c_connectedNodes.set(nodeId);
+
   NodeRecPtr nodePtr;
+  nodePtr.i = nodeId;
+  ptrCheckGuard(nodePtr, MAX_NODES, nodeRec);
+  nodePtr.p->m_secret = 0;
+
   nodePtr.i = getOwnNodeId();
   ptrCheckGuard(nodePtr, MAX_NODES, nodeRec);
   NodeInfo nodeInfo = getNodeInfo(nodeId);
@@ -2456,7 +2461,7 @@ void Qmgr::timerHandlingLab(Signal* sign
   {
     jam();
     hb_api_timer.reset();
-    apiHbHandlingLab(signal);
+    apiHbHandlingLab(signal, TcurrentTime);
   }
 
   if (cactivateApiCheck != 0) {
@@ -2562,7 +2567,7 @@ void Qmgr::checkHeartbeat(Signal* signal
   }//if
 }//Qmgr::checkHeartbeat()
 
-void Qmgr::apiHbHandlingLab(Signal* signal) 
+void Qmgr::apiHbHandlingLab(Signal* signal, Uint64 now)
 {
   NodeRecPtr TnodePtr;
 
@@ -2607,6 +2612,14 @@ void Qmgr::apiHbHandlingLab(Signal* sign
         api_failed(signal, nodeId);
       }//if
     }//if
+    else if (TnodePtr.p->phase == ZAPI_INACTIVE &&
+             TnodePtr.p->m_secret != 0 && now > TnodePtr.p->m_alloc_timeout)
+    {
+      jam();
+      TnodePtr.p->m_secret = 0;
+      warningEvent("Releasing node id allocation for node %u",
+                   TnodePtr.i);
+    }
   }//for
   return;
 }//Qmgr::apiHbHandlingLab()
@@ -2641,6 +2654,7 @@ void Qmgr::checkStartInterface(Signal* s
 	 * IS COMPLETE.
 	 *-------------------------------------------------------------------*/
         nodePtr.p->failState = NORMAL;
+        nodePtr.p->m_secret = 0;
         Uint32 type = getNodeInfo(nodePtr.i).m_type;
         switch(type){
         case NodeInfo::DB:
@@ -2937,6 +2951,7 @@ void Qmgr::node_failed(Signal* signal, U
    *-----------------------------------------------------------------------*/
   failedNodePtr.i = aFailedNode;
   ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
+  failedNodePtr.p->m_secret = 0; // Not yet Uint64(rand()) << 32 + rand();
 
   ndbrequire(getNodeInfo(failedNodePtr.i).getType() == NodeInfo::DB);
   
@@ -3007,7 +3022,8 @@ Qmgr::api_failed(Signal* signal, Uint32 
    *-----------------------------------------------------------------------*/
   failedNodePtr.i = nodeId;
   ptrCheckGuard(failedNodePtr, MAX_NODES, nodeRec);
-  
+  failedNodePtr.p->m_secret = 0; // Not yet Uint64(rand()) << 32 + rand();
+
   if (failedNodePtr.p->phase == ZFAIL_CLOSING)
   {
     /**
@@ -5455,22 +5471,37 @@ void
 Qmgr::execALLOC_NODEID_REQ(Signal * signal)
 {
   jamEntry();
-  const AllocNodeIdReq * req = (AllocNodeIdReq*)signal->getDataPtr();
-  Uint32 senderRef = req->senderRef;
-  Uint32 nodeId = req->nodeId;
-  Uint32 nodeType = req->nodeType;
+  AllocNodeIdReq req = *(AllocNodeIdReq*)signal->getDataPtr();
   Uint32 error = 0;
 
-  if (refToBlock(senderRef) != QMGR) // request from management server
+  NodeRecPtr nodePtr;
+  nodePtr.i = req.nodeId;
+  ptrAss(nodePtr, nodeRec);
+
+  if (refToBlock(req.senderRef) != QMGR) // request from management server
   {
     /* master */
 
     if (getOwnNodeId() != cpresident)
+    {
+      jam();
       error = AllocNodeIdRef::NotMaster;
+    }
     else if (!opAllocNodeIdReq.m_tracker.done())
+    {
+      jam();
       error = AllocNodeIdRef::Busy;
-    else if (c_connectedNodes.get(nodeId))
+    }
+    else if (c_connectedNodes.get(req.nodeId))
+    {
+      jam();
       error = AllocNodeIdRef::NodeConnected;
+    }
+    else if (nodePtr.p->m_secret != 0)
+    {
+      jam();
+      error = AllocNodeIdRef::NodeReserved;
+    }
 
     if (error)
     {
@@ -5479,60 +5510,99 @@ Qmgr::execALLOC_NODEID_REQ(Signal * sign
       ref->senderRef = reference();
       ref->errorCode = error;
       ref->masterRef = numberToRef(QMGR, cpresident);
-      sendSignal(senderRef, GSN_ALLOC_NODEID_REF, signal,
+      ref->senderData = req.senderData;
+      ref->nodeId = req.nodeId;
+      sendSignal(req.senderRef, GSN_ALLOC_NODEID_REF, signal,
                  AllocNodeIdRef::SignalLength, JBB);
       return;
     }
 
-    if (ERROR_INSERTED(934) && nodeId != getOwnNodeId())
+    if (ERROR_INSERTED(934) && req.nodeId != getOwnNodeId())
     {
       CRASH_INSERTION(934);
     }
+
+    /**
+     * generate secret
+     */
+    Uint64 now = NdbTick_CurrentMillisecond();
+    Uint32 secret_hi = now >> 24;
+    Uint32 secret_lo = Uint32(now << 8) + getOwnNodeId();
+    req.secret_hi = secret_hi;
+    req.secret_lo = secret_lo;
+
+    if (req.timeout > 60000)
+      req.timeout = 60000;
+
+    nodePtr.p->m_secret = (Uint64(secret_hi) << 32) + secret_lo;
+    nodePtr.p->m_alloc_timeout = now + req.timeout;
     
-    opAllocNodeIdReq.m_req = *req;
+    opAllocNodeIdReq.m_req = req;
     opAllocNodeIdReq.m_error = 0;
-    opAllocNodeIdReq.m_connectCount = getNodeInfo(refToNode(senderRef)).m_connectCount;
+    opAllocNodeIdReq.m_connectCount =
+      getNodeInfo(refToNode(req.senderRef)).m_connectCount;
 
     jam();
-    AllocNodeIdReq * req = (AllocNodeIdReq*)signal->getDataPtrSend();
-    req->senderRef = reference();
+    AllocNodeIdReq * req2 = (AllocNodeIdReq*)signal->getDataPtrSend();
+    * req2 = req;
+    req2->senderRef = reference();
     NodeReceiverGroup rg(QMGR, c_clusterNodes);
     RequestTracker & p = opAllocNodeIdReq.m_tracker;
     p.init<AllocNodeIdRef>(c_counterMgr, rg, GSN_ALLOC_NODEID_REF, 0);
 
     sendSignal(rg, GSN_ALLOC_NODEID_REQ, signal,
-               AllocNodeIdReq::SignalLength, JBB);
+               AllocNodeIdReq::SignalLengthQMGR, JBB);
     return;
   }
 
   /* participant */
-
-  if (c_connectedNodes.get(nodeId))
+  if (c_connectedNodes.get(req.nodeId))
+  {
+    jam();
     error = AllocNodeIdRef::NodeConnected;
-  else
+  }
+  else if (req.nodeType != getNodeInfo(req.nodeId).m_type)
   {
-    NodeRecPtr nodePtr;
-    nodePtr.i = nodeId;
-    ptrAss(nodePtr, nodeRec);
-    if (nodeType != getNodeInfo(nodeId).m_type)
-      error = AllocNodeIdRef::NodeTypeMismatch;
-    else if (nodePtr.p->failState != NORMAL)
-      error = AllocNodeIdRef::NodeFailureHandlingNotCompleted;
+    jam();
+    error = AllocNodeIdRef::NodeTypeMismatch;
+  }
+  else if (nodePtr.p->failState != NORMAL)
+  {
+    jam();
+    error = AllocNodeIdRef::NodeFailureHandlingNotCompleted;
+  }
+#if 0
+  /**
+   * For now only make "time/secret" based reservation on master
+   *   as we otherwise also need to clear it on failure + handle
+   *   master failure
+   */
+  else if (nodePtr.p->m_secret != 0)
+  {
+    jam();
+    error = AllocNodeIdRef::NodeReserved;
   }
+#endif
 
   if (error)
   {
+    jam();
     AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtrSend();
     ref->senderRef = reference();
     ref->errorCode = error;
-    sendSignal(senderRef, GSN_ALLOC_NODEID_REF, signal,
+    ref->senderData = req.senderData;
+    ref->nodeId = req.nodeId;
+    ref->masterRef = numberToRef(QMGR, cpresident);
+    sendSignal(req.senderRef, GSN_ALLOC_NODEID_REF, signal,
                AllocNodeIdRef::SignalLength, JBB);
     return;
   }
 
   AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
-  sendSignal(senderRef, GSN_ALLOC_NODEID_CONF, signal,
+  conf->secret_hi = req.secret_hi;
+  conf->secret_lo = req.secret_lo;
+  sendSignal(req.senderRef, GSN_ALLOC_NODEID_CONF, signal,
              AllocNodeIdConf::SignalLength, JBB);
 }
 
@@ -5545,6 +5615,22 @@ Qmgr::execALLOC_NODEID_CONF(Signal * sig
   const AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtr();
   opAllocNodeIdReq.m_tracker.reportConf(c_counterMgr,
                                         refToNode(conf->senderRef));
+
+  if (signal->getLength() >= AllocNodeIdConf::SignalLength)
+  {
+    jam();
+    if (opAllocNodeIdReq.m_req.secret_hi != conf->secret_hi ||
+        opAllocNodeIdReq.m_req.secret_lo != conf->secret_lo)
+    {
+      jam();
+      if (opAllocNodeIdReq.m_error == 0)
+      {
+        jam();
+        opAllocNodeIdReq.m_error = AllocNodeIdRef::Undefined;
+      }
+    }
+  }
+
   completeAllocNodeIdReq(signal);
 }
 
@@ -5558,15 +5644,20 @@ Qmgr::execALLOC_NODEID_REF(Signal * sign
   const AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtr();
   if (ref->errorCode == AllocNodeIdRef::NF_FakeErrorREF)
   {
+    jam();
     opAllocNodeIdReq.m_tracker.ignoreRef(c_counterMgr,
                                          refToNode(ref->senderRef));    
   }
   else
   {
+    jam();
     opAllocNodeIdReq.m_tracker.reportRef(c_counterMgr,
                                          refToNode(ref->senderRef));
     if (opAllocNodeIdReq.m_error == 0)
+    {
+      jam();
       opAllocNodeIdReq.m_error = ref->errorCode;
+    }
   }
   completeAllocNodeIdReq(signal);
 }
@@ -5593,6 +5684,17 @@ Qmgr::completeAllocNodeIdReq(Signal *sig
   if (opAllocNodeIdReq.m_tracker.hasRef())
   {
     jam();
+
+    {
+      /**
+       * Clear reservation
+       */
+      NodeRecPtr nodePtr;
+      nodePtr.i = opAllocNodeIdReq.m_req.nodeId;
+      ptrAss(nodePtr, nodeRec);
+      nodePtr.p->m_secret = 0;
+    }
+
     AllocNodeIdRef * ref = (AllocNodeIdRef*)signal->getDataPtrSend();
     ref->senderRef = reference();
     ref->senderData = opAllocNodeIdReq.m_req.senderData;
@@ -5604,12 +5706,15 @@ Qmgr::completeAllocNodeIdReq(Signal *sig
                AllocNodeIdRef::SignalLength, JBB);
     return;
   }
+
   jam();
+
   AllocNodeIdConf * conf = (AllocNodeIdConf*)signal->getDataPtrSend();
   conf->senderRef = reference();
   conf->senderData = opAllocNodeIdReq.m_req.senderData;
   conf->nodeId = opAllocNodeIdReq.m_req.nodeId;
-  ndbassert(AllocNodeIdConf::SignalLength == 3);
+  conf->secret_lo = opAllocNodeIdReq.m_req.secret_lo;
+  conf->secret_hi = opAllocNodeIdReq.m_req.secret_hi;
   sendSignal(opAllocNodeIdReq.m_req.senderRef, GSN_ALLOC_NODEID_CONF, signal,
              AllocNodeIdConf::SignalLength, JBB);
 }

=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.cpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2008-12-19 09:42:22 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2009-02-27 16:21:03 +0000
@@ -43,6 +43,17 @@
 
 #define CONSTRAINT_VIOLATION 893
 
+static
+bool
+check_timeout(Uint32 errCode)
+{
+  switch(errCode){
+  case 266:
+    return true;
+  }
+  return false;
+}
+
 #define DEBUG(x) { ndbout << "TRIX::" << x << endl; }
 
 /**
@@ -701,10 +712,21 @@ void Trix::execUTIL_EXECUTE_REF(Signal* 
   subRecPtr.p = subRec;
   ndbrequire(utilExecuteRef->errorCode == UtilExecuteRef::TCError);
   if(utilExecuteRef->TCErrorCode == CONSTRAINT_VIOLATION)
+  {
+    jam();
     buildFailed(signal, subRecPtr, BuildIndxRef::IndexNotUnique);
+  }
+  else if (check_timeout(utilExecuteRef->TCErrorCode))
+  {
+    jam();
+    buildFailed(signal, subRecPtr, BuildIndxRef::DeadlockError);
+  }
   else
+  {
+    jam();
     buildFailed(signal, subRecPtr,
                 (BuildIndxRef::ErrorCode)utilExecuteRef->TCErrorCode);
+  }
 }
 
 void Trix::execSUB_CREATE_CONF(Signal* signal)

=== modified file 'storage/ndb/src/kernel/blocks/tsman.cpp'
--- a/storage/ndb/src/kernel/blocks/tsman.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/kernel/blocks/tsman.cpp	2009-03-12 11:06:48 +0000
@@ -106,10 +106,14 @@ void
 Tsman::client_lock(BlockNumber block, int line)
 {
   if (isNdbMtLqh()) {
-    D("try lock" << hex << V(block) << dec << V(line));
+#ifdef VM_TRACE
+    Uint32 bno = blockToMain(block);
+    Uint32 ino = blockToInstance(block);
+#endif
+    D("try lock " << bno << "/" << ino << V(line));
     int ret = m_client_mutex.lock();
     ndbrequire(ret == 0);
-    D("got lock" << hex << V(block) << dec << V(line));
+    D("got lock " << bno << "/" << ino << V(line));
   }
 }
 
@@ -117,7 +121,11 @@ void
 Tsman::client_unlock(BlockNumber block, int line)
 {
   if (isNdbMtLqh()) {
-    D("unlock" << hex << V(block) << dec << V(line));
+#ifdef VM_TRACE
+    Uint32 bno = blockToMain(block);
+    Uint32 ino = blockToInstance(block);
+#endif
+    D("unlock " << bno << "/" << ino << V(line));
     int ret = m_client_mutex.unlock();
     ndbrequire(ret == 0);
   }
@@ -182,32 +190,36 @@ Tsman::execCONTINUEB(Signal* signal){
   jamEntry();
   Uint32 type = signal->theData[0];
   Uint32 ptrI = signal->theData[1];
+  client_lock(number(), __LINE__);
   switch(type){
   case TsmanContinueB::SCAN_TABLESPACE_EXTENT_HEADERS:
     scan_tablespace(signal, ptrI);
-    return;
+    break;
   case TsmanContinueB::SCAN_DATAFILE_EXTENT_HEADERS:
     scan_datafile(signal, ptrI, signal->theData[2]);
-    return;
+    break;
   case TsmanContinueB::END_LCP:
     end_lcp(signal, ptrI, signal->theData[2], signal->theData[3]);
-    return;
+    break;
   case TsmanContinueB::RELEASE_EXTENT_PAGES:
   {
     Ptr<Datafile> ptr;
     m_file_pool.getPtr(ptr, ptrI);
     release_extent_pages(signal, ptr);
-    return;
+    break;
   }
   case TsmanContinueB::LOAD_EXTENT_PAGES:
   {
     Ptr<Datafile> ptr;
     m_file_pool.getPtr(ptr, ptrI);
     load_extent_pages(signal, ptr);
-    return;
+    break;
   }
+  default:
+    ndbrequire(false);
+    break;
   }
-  ndbrequire(false);
+  client_unlock(number(), __LINE__);
 }
 
 #ifdef VM_TRACE
@@ -496,6 +508,7 @@ Tsman::find_file_by_id(Ptr<Datafile>& pt
 void
 Tsman::execCREATE_FILE_IMPL_REQ(Signal* signal){
   jamEntry();
+  client_lock(number(), __LINE__);
   CreateFileImplReq* req= (CreateFileImplReq*)signal->getDataPtr();
   
   Uint32 senderRef = req->senderRef;
@@ -539,6 +552,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
       pgman.map_file_no(signal, file_ptr.p->m_file_no, file_ptr.p->m_fd);
       file_ptr.p->m_create.m_loading_extent_page = 1;
       load_extent_pages(signal, file_ptr);
+      client_unlock(number(), __LINE__);
       return;
     }
     case CreateFileImplReq::Abort:
@@ -551,6 +565,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
 	file_ptr.p->m_create.m_senderData = senderData;
 	file_ptr.p->m_create.m_requestInfo = req->requestInfo;
 	create_file_abort(signal, file_ptr);
+        client_unlock(number(), __LINE__);
 	return;
       }
       else
@@ -560,6 +575,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
 	conf->senderRef = reference();
 	sendSignal(senderRef, GSN_CREATE_FILE_IMPL_CONF, signal,
 		   CreateFileImplConf::SignalLength, JBB);
+        client_unlock(number(), __LINE__);
 	return;
       }
     }
@@ -592,6 +608,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
       ref->errorCode = CreateFileImplRef::FileSizeTooLarge;
       sendSignal(senderRef, GSN_CREATE_FILE_IMPL_REF, signal,
                  CreateFileImplRef::SignalLength, JBB);
+      client_unlock(number(), __LINE__);
       return;
     }
  
@@ -607,6 +624,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
                                                   &handle);
     if(err)
       break;
+    client_unlock(number(), __LINE__);
     return;
   } while(0);
   
@@ -617,6 +635,7 @@ Tsman::execCREATE_FILE_IMPL_REQ(Signal* 
   ref->errorCode = err;
   sendSignal(senderRef, GSN_CREATE_FILE_IMPL_REF, signal,
 	     CreateFileImplRef::SignalLength, JBB);
+  client_unlock(number(), __LINE__);
 }
 
 static inline Uint64 DIV(Uint64 a, Uint64 b){ return (a + b - 1) / b;}
@@ -888,7 +907,7 @@ Tsman::execFSWRITEREQ(Signal* signal)
     }
     if (page_no == extent_pages)
     {
-      Uint32 last = extents % per_page; 
+      Uint32 last = extents - ((extent_pages - 1) * per_page);
       page->get_header(last - 1, size)->m_next_free_extent = RNIL;
     }
   }
@@ -1188,6 +1207,8 @@ Tsman::load_extent_page_callback(Signal*
   Ptr<Tablespace> ts_ptr;
   m_tablespace_pool.getPtr(ts_ptr, ptr.p->m_tablespace_ptr_i);
   if (getNodeState().startLevel >= NodeState::SL_STARTED ||
+      (getNodeState().startLevel == NodeState::SL_STARTING &&
+       getNodeState().starting.restartType == NodeState::ST_INITIAL_START) ||
       (getNodeState().getNodeRestartInProgress() &&
        getNodeState().starting.restartType == NodeState::ST_INITIAL_NODE_RESTART))
   {
@@ -1292,7 +1313,8 @@ Tsman::scan_extent_headers(Signal* signa
        * Last extent header page...
        *   set correct no of extent headers
        */
-      extents= (datapages / size) % per_page;
+      Uint32 total_extents = datapages / size;
+      extents= total_extents - (pages - 1)*per_page;
     }
     for(Uint32 j = 0; j<extents; j++)
     {
@@ -1364,6 +1386,7 @@ void
 Tsman::execDROP_FILE_IMPL_REQ(Signal* signal)
 {
   jamEntry();
+  client_lock(number(), __LINE__);
   DropFileImplReq req = *(DropFileImplReq*)signal->getDataPtr();
   Ptr<Datafile> file_ptr;
   Ptr<Tablespace> fg_ptr;
@@ -1429,6 +1452,7 @@ Tsman::execDROP_FILE_IMPL_REQ(Signal* si
       file_ptr.p->m_create.m_senderRef = req.senderRef;
       file_ptr.p->m_create.m_senderData = req.senderData;
       release_extent_pages(signal, file_ptr);
+      client_unlock(number(), __LINE__);
       return;
     case DropFileImplReq::Abort:{
       ndbrequire(find_file_by_id(file_ptr, fg_ptr.p->m_meta_files, req.file_id));
@@ -1467,6 +1491,7 @@ Tsman::execDROP_FILE_IMPL_REQ(Signal* si
     sendSignal(req.senderRef, GSN_DROP_FILE_IMPL_CONF, signal,
 	       DropFileImplConf::SignalLength, JBB);
   }
+  client_unlock(number(), __LINE__);
 }
 
 Tsman::Tablespace::Tablespace(Tsman* ts, const CreateFilegroupImplReq* req)

=== modified file 'storage/ndb/src/kernel/blocks/tsman.hpp'
--- a/storage/ndb/src/kernel/blocks/tsman.hpp	2008-11-16 15:32:38 +0000
+++ b/storage/ndb/src/kernel/blocks/tsman.hpp	2009-02-22 10:42:55 +0000
@@ -299,7 +299,7 @@ public:
     m_tablespace_id= tablespaceId;
     m_lock = lock;
 
-    D("client ctor" << hex << V(m_block) << dec
+    D("client ctor " << bno << "/" << ino
       << V(m_table_id) << V(m_fragment_id) << V(m_tablespace_id));
     if (m_lock)
       m_tsman->client_lock(m_block, 0);
@@ -308,7 +308,11 @@ public:
   Tablespace_client(Signal* signal, Tsman* tsman, Local_key* key);//undef
 
   ~Tablespace_client() {
-    D("client dtor" << hex << V(m_block));
+#ifdef VM_TRACE
+    Uint32 bno = blockToMain(m_block);
+    Uint32 ino = blockToInstance(m_block);
+#endif
+    D("client dtor " << bno << "/" << ino);
     if (m_lock)
       m_tsman->client_unlock(m_block, 0);
   }

=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp	2009-01-30 13:42:56 +0000
+++ b/storage/ndb/src/kernel/main.cpp	2009-03-04 14:54:30 +0000
@@ -1,4 +1,4 @@
- /* Copyright (C) 2003 MySQL AB
+ /* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
 
    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
@@ -14,871 +14,189 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <ndb_global.h>
-#include <my_pthread.h>
+#include <ndb_opts.h>
+#include <kernel/NodeBitmask.hpp>
 
-#include <ndb_version.h>
-#include "Configuration.hpp"
-#include <ConfigRetriever.hpp>
-#include <TransporterRegistry.hpp>
+#include "ndbd.hpp"
+#include "angel.hpp"
 
+#include "Configuration.hpp"
 #include "vm/SimBlockList.hpp"
 #include "ThreadConfig.hpp"
 #include <SignalLoggerManager.hpp>
 #include <NdbOut.hpp>
-#include <NdbMain.h>
 #include <NdbDaemon.h>
 #include <NdbSleep.h>
 #include <NdbConfig.h>
 #include <WatchDog.hpp>
-
-#include <LogLevel.hpp>
-#include <EventLogger.hpp>
-#include <NdbEnv.h>
-
 #include <NdbAutoPtr.hpp>
-
 #include <Properties.hpp>
 
-#include <mgmapi_debug.h>
-
-#if defined NDB_SOLARIS // ok
-#include <sys/processor.h> // For system informatio
-#endif
-
+#include <EventLogger.hpp>
 extern EventLogger * g_eventLogger;
-extern NdbMutex * theShutdownMutex;
 
-void catchsigs(bool ignore); // for process signal handling
-
-#define MAX_FAILED_STARTUPS 3
-// Flag set by child through SIGUSR1 to signal a failed startup
-static bool failed_startup_flag = false;
-// Counter for consecutive failed startups
-static Uint32 failed_startups = 0;
-extern "C" void handler_shutdown(int signum);  // for process signal handling
-extern "C" void handler_error(int signum);  // for process signal handling
-extern "C" void handler_sigusr1(int signum);  // child signalling failed restart
-
-// Shows system information
-void systemInfo(const Configuration & conf,
-		const LogLevel & ll); 
-
-// These are used already before fork if fetch_configuration() fails
-// (e.g. Unable to alloc node id).  Set them to something reasonable.
-static FILE *child_info_file_r= stdin;
-static FILE *child_info_file_w= stdout;
-
-static void writeChildInfo(const char *token, int val)
-{
-  fprintf(child_info_file_w, "%s=%d\n", token, val);
-  fflush(child_info_file_w);
+static int opt_daemon, opt_no_daemon, opt_foreground,
+  opt_initial, opt_no_start, opt_initialstart, opt_verbose;
+static const char* opt_nowait_nodes = 0;
+static const char* opt_bind_address = 0;
+
+extern NdbNodeBitmask g_nowait_nodes;
+
+static struct my_option my_long_options[] =
+{
+  NDB_STD_OPTS("ndbd"),
+  { "initial", 256,
+    "Perform initial start of ndbd, including cleaning the file system. "
+    "Consult documentation before using this",
+    (uchar**) &opt_initial, (uchar**) &opt_initial, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "nostart", 'n',
+    "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
+    (uchar**) &opt_no_start, (uchar**) &opt_no_start, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "daemon", 'd', "Start ndbd as daemon (default)",
+    (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0,
+    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
+  { "nodaemon", 256,
+    "Do not start ndbd as daemon, provided for testing purposes",
+    (uchar**) &opt_no_daemon, (uchar**) &opt_no_daemon, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "foreground", 256,
+    "Run real ndbd in foreground, provided for debugging purposes"
+    " (implies --nodaemon)",
+    (uchar**) &opt_foreground, (uchar**) &opt_foreground, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "nowait-nodes", 256,
+    "Nodes that will not be waited for during start",
+    (uchar**) &opt_nowait_nodes, (uchar**) &opt_nowait_nodes, 0,
+    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+  { "initial-start", 256,
+    "Perform initial start",
+    (uchar**) &opt_initialstart, (uchar**) &opt_initialstart, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "bind-address", 256,
+    "Local bind address",
+    (uchar**) &opt_bind_address, (uchar**) &opt_bind_address, 0,
+    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+  { "verbose", 'v',
+    "Write more log messages",
+    (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
+    GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
+  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+const char *load_default_groups[]= { "mysql_cluster", "ndbd", 0 };
+
+static void short_usage_sub(void)
+{
+  ndb_short_usage_sub(my_progname, NULL);
 }
 
-void childReportSignal(int signum)
+static void usage()
 {
-  writeChildInfo("signal", signum);
+  ndb_usage(short_usage_sub, load_default_groups, my_long_options);
 }
 
-void childReportError(int error)
-{
-  writeChildInfo("error", error);
-}
+extern "C" void ndbSetOwnVersion();
 
-void childExit(int code, Uint32 currentStartPhase)
+int main(int argc, char** argv)
 {
-  writeChildInfo("sphase", currentStartPhase);
-  writeChildInfo("exit", code);
-  fprintf(child_info_file_w, "\n");
-  fclose(child_info_file_r);
-  fclose(child_info_file_w);
-  exit(code);
-}
+  NDB_INIT(argv[0]);
 
-void childAbort(int code, Uint32 currentStartPhase)
-{
-  writeChildInfo("sphase", currentStartPhase);
-  writeChildInfo("exit", code);
-  fprintf(child_info_file_w, "\n");
-  fclose(child_info_file_r);
-  fclose(child_info_file_w);
-#ifndef NDB_WIN32
-  signal(SIGABRT, SIG_DFL);
-#endif
-  abort();
-}
+  ndbSetOwnVersion();
 
-static int insert(const char * pair, Properties & p)
-{
-  BaseString tmp(pair);
-  
-  tmp.trim(" \t\n\r");
-  Vector<BaseString> split;
-  tmp.split(split, ":=", 2);
-  if(split.size() != 2)
-    return -1;
-  p.put(split[0].trim().c_str(), split[1].trim().c_str()); 
-  return 0;
-}
+  // Print to stdout/console
+  g_eventLogger->createConsoleHandler();
+  g_eventLogger->setCategory("ndbd");
 
-static int readChildInfo(Properties &info)
-{
-  fclose(child_info_file_w);
-  char buf[128];
-  while (fgets(buf,sizeof(buf),child_info_file_r))
-    insert(buf,info);
-  fclose(child_info_file_r);
-  return 0;
-}
+  // Turn on max loglevel for startup messages
+  g_eventLogger->m_logLevel.setLogLevel(LogLevel::llStartUp, 15);
 
-static bool get_int_property(Properties &info,
-			     const char *token, Uint32 *int_val)
-{
-  const char *str_val= 0;
-  if (!info.get(token, &str_val))
-    return false;
-  char *endptr;
-  long int tmp= strtol(str_val, &endptr, 10);
-  if (str_val == endptr)
-    return false;
-  *int_val = tmp;
-  return true;
-}
+  ndb_opt_set_usage_funcs("ndbd", short_usage_sub, usage);
+  load_defaults("my",load_default_groups,&argc,&argv);
 
-int reportShutdown(class Configuration *config, int error_exit, int restart)
-{
-  Uint32 error= 0, signum= 0, sphase= 256;
-  Properties info;
-  readChildInfo(info);
-
-  get_int_property(info, "signal", &signum);
-  get_int_property(info, "error", &error);
-  get_int_property(info, "sphase", &sphase);
-
-  Uint32 length, theData[25];
-  EventReport *rep = (EventReport *)theData;
-
-  rep->setNodeId(globalData.ownId);
-  if (restart)
-    theData[1] =                                    1      |
-      (globalData.theRestartFlag == initial_state ? 2 : 0) |
-      (config->getInitialStart()                  ? 4 : 0);
-  else
-    theData[1] = 0;
+#ifndef DBUG_OFF
+  opt_debug= "d:t:O,/tmp/ndbd.trace";
+#endif
 
-  if (error_exit == 0)
-  {
-    rep->setEventType(NDB_LE_NDBStopCompleted);
-    theData[2] = signum;
-    length = 3;
-  }
-  else
-  {
-    rep->setEventType(NDB_LE_NDBStopForced);
-    theData[2] = signum;
-    theData[3] = error;
-    theData[4] = sphase;
-    theData[5] = 0; // extra
-    length = 6;
-  }
+  int ho_error;
+  if ((ho_error=handle_options(&argc, &argv, my_long_options,
+                               ndb_std_get_one_option)))
+    exit(ho_error);
 
-  { // Log event
-    const EventReport * const eventReport = (EventReport *)&theData[0];
-    g_eventLogger->log(eventReport->getEventType(), theData, length,
-                       eventReport->getNodeId(), 0);
+  if (opt_no_daemon || opt_foreground) {
+    // --nodaemon or --forground implies --daemon=0
+    opt_daemon= 0;
   }
 
-  for (unsigned n = 0; n < config->m_mgmds.size(); n++)
-  {
-    NdbMgmHandle h = ndb_mgm_create_handle();
-    if (h == 0 ||
-	ndb_mgm_set_connectstring(h, config->m_mgmds[n].c_str()) ||
-	ndb_mgm_connect(h,
-			1, //no_retries
-			0, //retry_delay_in_seconds
-			0  //verbose
-			))
-      goto handle_error;
+  // Turn on debug printouts if --verbose
+  if (opt_verbose)
+    g_eventLogger->enable(Logger::LL_DEBUG);
 
-    {
-      if (ndb_mgm_report_event(h, theData, length))
-	goto handle_error;
-    }
-    goto do_next;
+  DBUG_PRINT("info", ("no_start=%d", opt_no_start));
+  DBUG_PRINT("info", ("initial=%d", opt_initial));
+  DBUG_PRINT("info", ("daemon=%d", opt_daemon));
+  DBUG_PRINT("info", ("foreground=%d", opt_foreground));
+  DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
 
-handle_error:
-    if (h)
-    {
-      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());
-    }
-    else
+  if (opt_nowait_nodes)
+  {
+    int res = g_nowait_nodes.parseMask(opt_nowait_nodes);
+    if(res == -2 || (res > 0 && g_nowait_nodes.get(0)))
     {
-      g_eventLogger->error("Unable to report shutdown reason to %s",
-                           config->m_mgmds[n].c_str());
+      g_eventLogger->error("Invalid nodeid specified in nowait-nodes: %s",
+                           opt_nowait_nodes);
+      exit(-1);
     }
-do_next:
-    if (h)
+    else if (res < 0)
     {
-      ndb_mgm_disconnect(h);
-      ndb_mgm_destroy_handle(&h);
+      g_eventLogger->error("Unable to parse nowait-nodes argument: %s",
+                           opt_nowait_nodes);
+      exit(-1);
     }
   }
-  return 0;
-}
-
-static int
-init_global_memory_manager(EmulatorData &ed, Uint32 *watchCounter)
-{
-  const ndb_mgm_configuration_iterator * p =
-    ed.theConfiguration->getOwnConfigIterator();
-  if (p == 0)
-  {
-    abort();
-  }
-
-  Uint64 shared_mem = 8*1024*1024;
-  ndb_mgm_get_int64_parameter(p, CFG_DB_SGA, &shared_mem);
-  shared_mem /= GLOBAL_PAGE_SIZE;
-
-  Uint32 tupmem = 0;
-  if (ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tupmem))
-  {
-    g_eventLogger->alert("Failed to get CFG_TUP_PAGE parameter from "
-                        "config, exiting.");
-    return -1;
-  }
-
-  if (tupmem)
-  {
-    Resource_limit rl;
-    rl.m_min = tupmem;
-    rl.m_max = tupmem;
-    rl.m_resource_id = RG_DATAMEM;
-    ed.m_mem_manager->set_resource_limit(rl);
-  }
-
-  Uint32 maxopen = 4 * 4; // 4 redo parts, max 4 files per part
-  Uint32 filebuffer = NDB_FILE_BUFFER_SIZE;
-  Uint32 filepages = (filebuffer / GLOBAL_PAGE_SIZE) * maxopen;
-
-  if (filepages)
-  {
-    Resource_limit rl;
-    rl.m_min = filepages;
-    rl.m_max = filepages;
-    rl.m_resource_id = RG_FILE_BUFFERS;
-    ed.m_mem_manager->set_resource_limit(rl);
-  }
-
-  Uint32 jbpages = compute_jb_pages(&ed);;
-  if (jbpages)
-  {
-    Resource_limit rl;
-    rl.m_min = jbpages;
-    rl.m_max = jbpages;
-    rl.m_resource_id = RG_JOBBUFFER;
-    ed.m_mem_manager->set_resource_limit(rl);
-  }
-
-  Uint32 sbpages = 0;
-  if (globalTransporterRegistry.get_using_default_send_buffer() == false)
-  {
-    Uint64 mem = globalTransporterRegistry.get_total_max_send_buffer();
-    sbpages = (mem + GLOBAL_PAGE_SIZE - 1) / GLOBAL_PAGE_SIZE;
-    Resource_limit rl;
-    rl.m_min = sbpages;
-    rl.m_max = sbpages;
-    rl.m_resource_id = RG_TRANSPORTER_BUFFERS;
-    ed.m_mem_manager->set_resource_limit(rl);
-  }
-
-  if (shared_mem + tupmem + filepages + jbpages + sbpages)
-  {
-    Resource_limit rl;
-    rl.m_min = 0;
-    rl.m_max = shared_mem + tupmem + filepages + jbpages + sbpages;
-    rl.m_resource_id = 0;
-    ed.m_mem_manager->set_resource_limit(rl);
-  }
-
-  if (!ed.m_mem_manager->init(watchCounter))
-  {
-    struct ndb_mgm_param_info dm;
-    struct ndb_mgm_param_info sga;
-    size_t size;
-
-    size = sizeof(ndb_mgm_param_info);
-    ndb_mgm_get_db_parameter_info(CFG_DB_DATA_MEM, &dm, &size);
-    size = sizeof(ndb_mgm_param_info);
-    ndb_mgm_get_db_parameter_info(CFG_DB_SGA, &sga, &size);
-
-    g_eventLogger->alert("Malloc (%lld bytes) for %s and %s failed, exiting",
-                         Uint64(shared_mem + tupmem) * GLOBAL_PAGE_SIZE,
-                         dm.m_name, sga.m_name);
-    return -1;
-  }
-
-  return 0;                     // Success
-}
-
-static int
-get_multithreaded_config(EmulatorData& ed)
-{
-  // multithreaded is compiled in ndbd/ndbmtd for now
-  globalData.isNdbMt = SimulatedBlock::isMultiThreaded();
-  if (!globalData.isNdbMt) {
-    ndbout << "NDBMT: non-mt" << endl;
-    return 0;
-  }
-
-  const ndb_mgm_configuration_iterator * p =
-    ed.theConfiguration->getOwnConfigIterator();
-  if (p == 0)
-  {
-    abort();
-  }
-
-  Uint32 mtthreads = 0;
-  ndb_mgm_get_int_parameter(p, CFG_DB_MT_THREADS, &mtthreads);
-  ndbout << "NDBMT: MaxNoOfExecutionThreads=" << mtthreads << endl;
-
-  globalData.isNdbMtLqh = true;
-
-  /**
-   * TODO add config for mt-classic
-   */
-  {
-    Uint32 classic = 0;
-    ndb_mgm_get_int_parameter(p, CFG_NDBMT_CLASSIC, &classic);
-    if (classic)
-      globalData.isNdbMtLqh = false;
-
-    const char* p = NdbEnv_GetEnv("NDB_MT_LQH", (char*)0, 0);
-    if (p != 0)
-    {
-      if (strstr(p, "NOPLEASE") != 0)
-        globalData.isNdbMtLqh = false;
-      else
-        globalData.isNdbMtLqh = true;
-    }
-  }
-
-  if (!globalData.isNdbMtLqh)
-    return 0;
-
-  Uint32 threads = 0;
-  switch(mtthreads){
-  case 0:
-  case 1:
-  case 2:
-  case 3:
-    threads = 1; // TC + receiver + SUMA + LQH
-    break;
-  case 4:
-  case 5:
-  case 6:
-    threads = 2; // TC + receiver + SUMA + 2 * LQH
-    break;
-  default:
-    threads = 4; // TC + receiver + SUMA + 4 * LQH
-  }
-
-  ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_THREADS, &threads);
-  Uint32 workers = threads;
-  ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_WORKERS, &workers);
-
-#ifdef VM_TRACE
-  // testing
-  {
-    const char* p;
-    p = NdbEnv_GetEnv("NDBMT_LQH_WORKERS", (char*)0, 0);
-    if (p != 0)
-      workers = atoi(p);
-    p = NdbEnv_GetEnv("NDBMT_LQH_THREADS", (char*)0, 0);
-    if (p != 0)
-      threads = atoi(p);
-  }
-#endif
-
-  ndbout << "NDBMT: workers=" << workers
-         << " threads=" << threads << endl;
-  
-  assert(workers != 0 && workers <= MAX_NDBMT_LQH_WORKERS);
-  assert(threads != 0 && threads <= MAX_NDBMT_LQH_THREADS);
-  assert(workers % threads == 0);
-  
-  globalData.ndbMtLqhWorkers = workers;
-  globalData.ndbMtLqhThreads = threads;
-  return 0;
-}
-
-
-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->m_logLevel.setLogLevel(LogLevel::llStartUp, 15);
 
   globalEmulatorData.create();
 
-  // Parse command line options
   Configuration* theConfig = globalEmulatorData.theConfiguration;
-  if(!theConfig->init(argc, argv)){
-    return NRT_Default;
+  if(!theConfig->init(opt_no_start, opt_initial,
+                      opt_initialstart, opt_daemon)){
+    g_eventLogger->error("Failed to init Configuration");
+    exit(-1);
+  }
+  char*cfg= getenv("WIN_NDBD_CFG");
+  if(cfg) {
+    int x,y,z;
+    if(3!=sscanf(cfg,"%d %d %d",&x,&y,&z)) {
+      g_eventLogger->error("internal error: couldn't find 3 parameters");
+      exit(1);
+    }
+    theConfig->setInitialStart(x);
+    globalData.theRestartFlag= (restartStates)y;
+    globalData.ownId= z;
   }
-  
   { // Do configuration
-#ifndef NDB_WIN32
-	signal(SIGPIPE, SIG_IGN);
-#endif
-    theConfig->fetch_configuration();
+    theConfig->fetch_configuration(opt_connect_str, opt_bind_address);
   }
 
   my_setwd(NdbConfig_get_path(0), MYF(0));
 
-  if (theConfig->getDaemonMode()) {
-    // Become a daemon
-    char *lockfile= NdbConfig_PidFileName(globalData.ownId);
-    char *logfile=  NdbConfig_StdoutFileName(globalData.ownId);
-    NdbAutoPtr<char> tmp_aptr1(lockfile), tmp_aptr2(logfile);
-
-#ifndef NDB_WIN32
-    if (NdbDaemon_Make(lockfile, logfile, 0) == -1)
-    {
-      ndbout << "Cannot become daemon: " << NdbDaemon_ErrorText << endl;
-      return 1;
-    }
-#endif
-  }
-
 #ifndef NDB_WIN32
-  signal(SIGUSR1, handler_sigusr1);
-
-  pid_t child = -1;
-  while (! theConfig->getForegroundMode()) // the cond is const
+  if (!opt_foreground)
   {
-    // setup reporting between child and parent
-    int filedes[2];
-    if (pipe(filedes))
-    {
-      g_eventLogger->error("pipe() failed with errno=%d (%s)",
-                           errno, strerror(errno));
+    if (angel_run(opt_connect_str,
+                  opt_bind_address,
+                  opt_initialstart,
+                  opt_daemon))
       return 1;
-    }
-    else
-    {
-      if (!(child_info_file_w= fdopen(filedes[1],"w")))
-      {
-        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));
-      }
-    }
-
-    if ((child = fork()) <= 0)
-      break; // child or error
-
-    /**
-     * Parent
-     */
-
-    catchsigs(true);
-
-    /**
-     * We no longer need the mgm connection in this process
-     * (as we are the angel, not ndb)
-     *
-     * We don't want to purge any allocated resources (nodeid), so
-     * we set that option to false
-     */
-    theConfig->closeConfiguration(false);
-
-    int status = 0, error_exit = 0, signum = 0;
-    while(waitpid(child, &status, 0) != child);
-    if(WIFEXITED(status)){
-      switch(WEXITSTATUS(status)){
-      case NRT_Default:
-        g_eventLogger->info("Angel shutting down");
-	reportShutdown(theConfig, 0, 0);
-	exit(0);
-	break;
-      case NRT_NoStart_Restart:
-	theConfig->setInitialStart(false);
-	globalData.theRestartFlag = initial_state;
-	break;
-      case NRT_NoStart_InitialStart:
-	theConfig->setInitialStart(true);
-	globalData.theRestartFlag = initial_state;
-	break;
-      case NRT_DoStart_InitialStart:
-	theConfig->setInitialStart(true);
-	globalData.theRestartFlag = perform_start;
-	break;
-      default:
-	error_exit = 1;
-	if(theConfig->stopOnError()){
-	  /**
-	   * Error shutdown && stopOnError()
-	   */
-	  reportShutdown(theConfig, error_exit, 0);
-	  exit(0);
-	}
-	// Fall-through
-      case NRT_DoStart_Restart:
-	theConfig->setInitialStart(false);
-	globalData.theRestartFlag = perform_start;
-	break;
-      }
-    } else {
-      error_exit = 1;
-      if (WIFSIGNALED(status))
-      {
-	signum = WTERMSIG(status);
-	childReportSignal(signum);
-      }
-      else
-      {
-	signum = 127;
-        g_eventLogger->info("Unknown exit reason. Stopped.");
-      }
-      if(theConfig->stopOnError()){
-	/**
-	 * Error shutdown && stopOnError()
-	 */
-	reportShutdown(theConfig, error_exit, 0);
-	exit(0);
-      }
-    }
-
-    if (!failed_startup_flag)
-    {
-      // Reset the counter for consecutive failed startups
-      failed_startups = 0;
-    }
-    else if (failed_startups >= MAX_FAILED_STARTUPS && !theConfig->stopOnError())
-    {
-      /**
-       * Error shutdown && stopOnError()
-       */
-      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);
-    theConfig->fetch_configuration();
+    // ndbd continues here
   }
-
-  if (child >= 0)
-    g_eventLogger->info("Angel pid: %d ndb pid: %d", getppid(), getpid());
-  else if (child > 0)
-    g_eventLogger->info("Ndb pid: %d", getpid());
   else
     g_eventLogger->info("Ndb started in foreground");
 #else
   g_eventLogger->info("Ndb started");
 #endif
-  theConfig->setupConfiguration();
-  systemInfo(* theConfig, * theConfig->m_logLevel); 
-  
-  NdbThread* pWatchdog = globalEmulatorData.theWatchDog->doStart();
-
-  if (get_multithreaded_config(globalEmulatorData))
-    return -1;
-
-  {
-    /*
-     * Memory allocation can take a long time for large memory.
-     *
-     * So we want the watchdog to monitor the process of initial allocation.
-     */
-    Uint32 watchCounter;
-    watchCounter = 9;           //  Means "doing allocation"
-    globalEmulatorData.theWatchDog->registerWatchedThread(&watchCounter, 0);
-    if (init_global_memory_manager(globalEmulatorData, &watchCounter))
-      return 1;
-    globalEmulatorData.theWatchDog->unregisterWatchedThread(0);
-  }
-
-  globalEmulatorData.theThreadConfig->init(&globalEmulatorData);
-  
-#ifdef VM_TRACE
-  // Create a signal logger before block constructors
-  char *buf= NdbConfig_SignalLogFileName(globalData.ownId);
-  NdbAutoPtr<char> tmp_aptr(buf);
-  FILE * signalLog = fopen(buf, "a");
-  globalSignalLoggers.setOwnNodeId(globalData.ownId);
-  globalSignalLoggers.setOutputStream(signalLog);
-#if 1 // to log startup
-  { const char* p = NdbEnv_GetEnv("NDB_SIGNAL_LOG", (char*)0, 0);
-    if (p != 0) {
-      char buf[200];
-      BaseString::snprintf(buf, sizeof(buf), "BLOCK=%s", p);
-      for (char* q = buf; *q != 0; q++) *q = toupper(toascii(*q));
-      globalSignalLoggers.log(SignalLoggerManager::LogInOut, buf);
-      globalData.testOn = 1;
-      assert(signalLog != 0);
-      fprintf(signalLog, "START\n");
-      fflush(signalLog);
-    }
-  }
-#endif
-#endif
-
-  // Load blocks (both main and workers)
-  globalEmulatorData.theSimBlockList->load(globalEmulatorData);
-    
-  // Set thread concurrency for Solaris' light weight processes
-  int status;
-  status = NdbThread_SetConcurrencyLevel(30);
-  assert(status == 0);
-  
-  catchsigs(false);
-   
-  /**
-   * Do startup
-   */
-
-  ErrorReporter::setErrorHandlerShutdownType(NST_ErrorHandlerStartup);
-
-  switch(globalData.theRestartFlag){
-  case initial_state:
-    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI);
-    break;
-  case perform_start:
-    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI);
-    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_STARTING);
-    break;
-  default:
-    assert("Illegal state globalData.theRestartFlag" == 0);
-  }
-
-  globalTransporterRegistry.startSending();
-  globalTransporterRegistry.startReceiving();
-  if (!globalTransporterRegistry.start_service(*globalEmulatorData.m_socket_server)){
-    ndbout_c("globalTransporterRegistry.start_service() failed");
-    exit(-1);
-  }
 
-  // Re-use the mgm handle as a transporter
-  if(!globalTransporterRegistry.connect_client(
-		 theConfig->get_config_retriever()->get_mgmHandlePtr()))
-      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
-		"Connection to mgmd terminated before setup was complete", 
-		"StopOnError missing");
-
-  NdbThread* pTrp = globalTransporterRegistry.start_clients();
-  if (pTrp == 0)
-  {
-    ndbout_c("globalTransporterRegistry.start_clients() failed");
-    exit(-1);
-  }
-
-  NdbThread* pSockServ = globalEmulatorData.m_socket_server->startServer();
-
-  globalEmulatorData.theConfiguration->addThread(pTrp, SocketClientThread);
-  globalEmulatorData.theConfiguration->addThread(pWatchdog, WatchDogThread);
-  globalEmulatorData.theConfiguration->addThread(pSockServ, SocketServerThread);
-
-  //  theConfig->closeConfiguration();
-  {
-    NdbThread *pThis = NdbThread_CreateObject(0);
-    Uint32 inx = globalEmulatorData.theConfiguration->addThread(pThis,
-                                                                MainThread);
-    globalEmulatorData.theThreadConfig->ipControlLoop(pThis, inx);
-    globalEmulatorData.theConfiguration->removeThreadId(inx);
-  }
-  NdbShutdown(NST_Normal);
-
-  return NRT_Default;
+  return ndbd_run(opt_foreground);
 }
 
-
-void 
-systemInfo(const Configuration & config, const LogLevel & logLevel){
-#ifdef NDB_WIN32
-  int processors = 0;
-  int speed;
-  SYSTEM_INFO sinfo;
-  GetSystemInfo(&sinfo);
-  processors = sinfo.dwNumberOfProcessors;
-  HKEY hKey;
-  if(ERROR_SUCCESS==RegOpenKeyEx
-     (HKEY_LOCAL_MACHINE, 
-      TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), 
-      0, KEY_READ, &hKey)) {
-    DWORD dwMHz;
-    DWORD cbData = sizeof(dwMHz);
-    if(ERROR_SUCCESS==RegQueryValueEx(hKey, 
-				      "~MHz", 0, 0, (LPBYTE)&dwMHz, &cbData)) {
-      speed = int(dwMHz);
-    }
-    RegCloseKey(hKey);
-  }
-#elif defined NDB_SOLARIS // ok
-  // Search for at max 16 processors among the first 256 processor ids
-  processor_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo));
-  int pid = 0;
-  while(processors < 16 && pid < 256){
-    if(!processor_info(pid++, &pinfo))
-      processors++;
-  }
-  speed = pinfo.pi_clock;
-#endif
-  
-  if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){
-    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());
-#ifdef NDB_SOLARIS // ok
-    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);
-  }
-
-}
-
-#define handler_register(signum, handler, ignore)\
-{\
-  if (ignore) {\
-    if(signum != SIGCHLD)\
-      signal(signum, SIG_IGN);\
-  } else\
-    signal(signum, handler);\
-}
-
-void 
-catchsigs(bool ignore){
-#if !defined NDB_WIN32
-
-  static const int signals_shutdown[] = {
-#ifdef SIGBREAK
-    SIGBREAK,
-#endif
-    SIGHUP,
-    SIGINT,
-#if defined SIGPWR
-    SIGPWR,
-#elif defined SIGINFO
-    SIGINFO,
-#endif
-    SIGQUIT,
-    SIGTERM,
-#ifdef SIGTSTP
-    SIGTSTP,
-#endif
-    SIGTTIN,
-    SIGTTOU
-  };
-
-  static const int signals_error[] = {
-    SIGABRT,
-    SIGALRM,
-#ifdef SIGBUS
-    SIGBUS,
-#endif
-    SIGCHLD,
-    SIGFPE,
-    SIGILL,
-#ifdef SIGIO
-    SIGIO,
-#endif
-#ifdef SIGPOLL
-    SIGPOLL,
-#endif
-    SIGSEGV
-  };
-
-  static const int signals_ignore[] = {
-    SIGPIPE
-  };
-
-  size_t i;
-  for(i = 0; i < sizeof(signals_shutdown)/sizeof(signals_shutdown[0]); i++)
-    handler_register(signals_shutdown[i], handler_shutdown, ignore);
-  for(i = 0; i < sizeof(signals_error)/sizeof(signals_error[0]); i++)
-    handler_register(signals_error[i], handler_error, ignore);
-  for(i = 0; i < sizeof(signals_ignore)/sizeof(signals_ignore[0]); i++)
-    handler_register(signals_ignore[i], SIG_IGN, ignore);
-#ifdef SIGTRAP
-  Configuration* theConfig = globalEmulatorData.theConfiguration;
-  if (! theConfig->getForegroundMode())
-    handler_register(SIGTRAP, handler_error, ignore);
-#endif
-#endif
-}
-
-extern "C"
-void 
-handler_shutdown(int signum){
-  g_eventLogger->info("Received signal %d. Performing stop.", signum);
-  childReportError(0);
-  childReportSignal(signum);
-  globalData.theRestartFlag = perform_stop;
-}
-
-extern "C"
-void 
-handler_error(int signum){
-  // only let one thread run shutdown
-  static long thread_id= 0;
-
-  if (thread_id != 0 && thread_id == my_thread_id())
-  {
-    // Shutdown thread received signal
-#ifndef NDB_WIN32
-	signal(signum, SIG_DFL);
-    kill(getpid(), signum);
-#endif
-    while(true)
-      NdbSleep_MilliSleep(10);
-  }
-  if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0)
-    while(true)
-      NdbSleep_MilliSleep(10);
-  thread_id= my_thread_id();
-  g_eventLogger->info("Received signal %d. Running error handler.", signum);
-  childReportSignal(signum);
-  // restart the system
-  char errorData[64], *info= 0;
-#ifdef HAVE_STRSIGNAL
-  info= strsignal(signum);
-#endif
-  BaseString::snprintf(errorData, sizeof(errorData), "Signal %d received; %s", signum,
-		       info ? info : "No text for signal available");
-  ERROR_SET_SIGNAL(fatal, NDBD_EXIT_OS_SIGNAL_RECEIVED, errorData, __FILE__);
-}
-
-extern "C"
-void 
-handler_sigusr1(int signum)
-{
-  if (!failed_startup_flag)
-  {
-    failed_startups++;
-    failed_startup_flag = true;
-  }
-  g_eventLogger->info("Angel received ndbd startup failure count %u.", failed_startups);
-}

=== added file 'storage/ndb/src/kernel/ndbd.cpp'
--- a/storage/ndb/src/kernel/ndbd.cpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/ndbd.cpp	2009-03-04 14:54:30 +0000
@@ -0,0 +1,629 @@
+/* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+
+   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 */
+
+#include <ndb_global.h>
+
+#include <NdbEnv.h>
+#include <NdbConfig.h>
+#include <NdbSleep.h>
+#include <NdbAutoPtr.hpp>
+
+#include "vm/SimBlockList.hpp"
+#include "vm/WatchDog.hpp"
+#include "vm/ThreadConfig.hpp"
+#include "vm/Configuration.hpp"
+
+#include "ndbd.hpp"
+
+#include <ConfigRetriever.hpp>
+#include <LogLevel.hpp>
+
+#if defined NDB_SOLARIS
+#include <sys/processor.h>
+#endif
+
+#include <EventLogger.hpp>
+extern EventLogger * g_eventLogger;
+
+static void
+systemInfo(const Configuration & config, const LogLevel & logLevel)
+{
+#ifdef NDB_WIN32
+  int processors = 0;
+  int speed;
+  SYSTEM_INFO sinfo;
+  GetSystemInfo(&sinfo);
+  processors = sinfo.dwNumberOfProcessors;
+  HKEY hKey;
+  if(ERROR_SUCCESS==RegOpenKeyEx
+     (HKEY_LOCAL_MACHINE,
+      TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
+      0, KEY_READ, &hKey)) {
+    DWORD dwMHz;
+    DWORD cbData = sizeof(dwMHz);
+    if(ERROR_SUCCESS==RegQueryValueEx(hKey,
+				      "~MHz", 0, 0, (LPBYTE)&dwMHz, &cbData)) {
+      speed = int(dwMHz);
+    }
+    RegCloseKey(hKey);
+  }
+#elif defined NDB_SOLARIS
+  // Search for at max 16 processors among the first 256 processor ids
+  processor_info_t pinfo; memset(&pinfo, 0, sizeof(pinfo));
+  int pid = 0;
+  while(processors < 16 && pid < 256){
+    if(!processor_info(pid++, &pinfo))
+      processors++;
+  }
+  speed = pinfo.pi_clock;
+#endif
+
+  if(logLevel.getLogLevel(LogLevel::llStartUp) > 0){
+    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());
+#ifdef NDB_SOLARIS
+    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);
+  }
+}
+
+
+static int
+init_global_memory_manager(EmulatorData &ed, Uint32 *watchCounter)
+{
+  const ndb_mgm_configuration_iterator * p =
+    ed.theConfiguration->getOwnConfigIterator();
+  if (p == 0)
+  {
+    abort();
+  }
+
+  Uint64 shared_mem = 8*1024*1024;
+  ndb_mgm_get_int64_parameter(p, CFG_DB_SGA, &shared_mem);
+  shared_mem /= GLOBAL_PAGE_SIZE;
+
+  Uint32 tupmem = 0;
+  if (ndb_mgm_get_int_parameter(p, CFG_TUP_PAGE, &tupmem))
+  {
+    g_eventLogger->alert("Failed to get CFG_TUP_PAGE parameter from "
+                        "config, exiting.");
+    return -1;
+  }
+
+  if (tupmem)
+  {
+    Resource_limit rl;
+    rl.m_min = tupmem;
+    rl.m_max = tupmem;
+    rl.m_resource_id = RG_DATAMEM;
+    ed.m_mem_manager->set_resource_limit(rl);
+  }
+
+  Uint32 maxopen = 4 * 4; // 4 redo parts, max 4 files per part
+  Uint32 filebuffer = NDB_FILE_BUFFER_SIZE;
+  Uint32 filepages = (filebuffer / GLOBAL_PAGE_SIZE) * maxopen;
+
+  if (filepages)
+  {
+    Resource_limit rl;
+    rl.m_min = filepages;
+    rl.m_max = filepages;
+    rl.m_resource_id = RG_FILE_BUFFERS;
+    ed.m_mem_manager->set_resource_limit(rl);
+  }
+
+  Uint32 jbpages = compute_jb_pages(&ed);;
+  if (jbpages)
+  {
+    Resource_limit rl;
+    rl.m_min = jbpages;
+    rl.m_max = jbpages;
+    rl.m_resource_id = RG_JOBBUFFER;
+    ed.m_mem_manager->set_resource_limit(rl);
+  }
+
+  Uint32 sbpages = 0;
+  if (globalTransporterRegistry.get_using_default_send_buffer() == false)
+  {
+    Uint64 mem = globalTransporterRegistry.get_total_max_send_buffer();
+    sbpages = (mem + GLOBAL_PAGE_SIZE - 1) / GLOBAL_PAGE_SIZE;
+    Resource_limit rl;
+    rl.m_min = sbpages;
+    rl.m_max = sbpages;
+    rl.m_resource_id = RG_TRANSPORTER_BUFFERS;
+    ed.m_mem_manager->set_resource_limit(rl);
+  }
+
+  if (shared_mem + tupmem + filepages + jbpages + sbpages)
+  {
+    Resource_limit rl;
+    rl.m_min = 0;
+    rl.m_max = shared_mem + tupmem + filepages + jbpages + sbpages;
+    rl.m_resource_id = 0;
+    ed.m_mem_manager->set_resource_limit(rl);
+  }
+
+  if (!ed.m_mem_manager->init(watchCounter))
+  {
+    struct ndb_mgm_param_info dm;
+    struct ndb_mgm_param_info sga;
+    size_t size;
+
+    size = sizeof(ndb_mgm_param_info);
+    ndb_mgm_get_db_parameter_info(CFG_DB_DATA_MEM, &dm, &size);
+    size = sizeof(ndb_mgm_param_info);
+    ndb_mgm_get_db_parameter_info(CFG_DB_SGA, &sga, &size);
+
+    g_eventLogger->alert("Malloc (%lld bytes) for %s and %s failed, exiting",
+                         Uint64(shared_mem + tupmem) * GLOBAL_PAGE_SIZE,
+                         dm.m_name, sga.m_name);
+    return -1;
+  }
+
+  return 0;                     // Success
+}
+
+
+static int
+get_multithreaded_config(EmulatorData& ed)
+{
+  // multithreaded is compiled in ndbd/ndbmtd for now
+  globalData.isNdbMt = SimulatedBlock::isMultiThreaded();
+  if (!globalData.isNdbMt) {
+    ndbout << "NDBMT: non-mt" << endl;
+    return 0;
+  }
+
+  ndb_mgm_configuration * conf = ed.theConfiguration->getClusterConfig();
+  if (conf == 0)
+  {
+    abort();
+  }
+
+  ndb_mgm_configuration_iterator * p =
+    ndb_mgm_create_configuration_iterator(conf, CFG_SECTION_NODE);
+  if (ndb_mgm_find(p, CFG_NODE_ID, globalData.ownId))
+  {
+    abort();
+  }
+
+  Uint32 mtthreads = 0;
+  ndb_mgm_get_int_parameter(p, CFG_DB_MT_THREADS, &mtthreads);
+  ndbout << "NDBMT: MaxNoOfExecutionThreads=" << mtthreads << endl;
+
+  globalData.isNdbMtLqh = true;
+
+  {
+    Uint32 classic = 0;
+    ndb_mgm_get_int_parameter(p, CFG_NDBMT_CLASSIC, &classic);
+    if (classic)
+      globalData.isNdbMtLqh = false;
+
+    const char* p = NdbEnv_GetEnv("NDB_MT_LQH", (char*)0, 0);
+    if (p != 0)
+    {
+      if (strstr(p, "NOPLEASE") != 0)
+        globalData.isNdbMtLqh = false;
+      else
+        globalData.isNdbMtLqh = true;
+    }
+  }
+
+  if (!globalData.isNdbMtLqh)
+    return 0;
+
+  Uint32 threads = 0;
+  switch(mtthreads){
+  case 0:
+  case 1:
+  case 2:
+  case 3:
+    threads = 1; // TC + receiver + SUMA + LQH
+    break;
+  case 4:
+  case 5:
+  case 6:
+    threads = 2; // TC + receiver + SUMA + 2 * LQH
+    break;
+  default:
+    threads = 4; // TC + receiver + SUMA + 4 * LQH
+  }
+
+  ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_THREADS, &threads);
+  Uint32 workers = threads;
+  ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_WORKERS, &workers);
+
+#ifdef VM_TRACE
+  // testing
+  {
+    const char* p;
+    p = NdbEnv_GetEnv("NDBMT_LQH_WORKERS", (char*)0, 0);
+    if (p != 0)
+      workers = atoi(p);
+    p = NdbEnv_GetEnv("NDBMT_LQH_THREADS", (char*)0, 0);
+    if (p != 0)
+      threads = atoi(p);
+  }
+#endif
+
+  ndbout << "NDBMT: workers=" << workers
+         << " threads=" << threads << endl;
+
+  assert(workers != 0 && workers <= MAX_NDBMT_LQH_WORKERS);
+  assert(threads != 0 && threads <= MAX_NDBMT_LQH_THREADS);
+  assert(workers % threads == 0);
+
+  globalData.ndbMtLqhWorkers = workers;
+  globalData.ndbMtLqhThreads = threads;
+  return 0;
+}
+
+
+extern FILE *child_info_file_r;
+extern FILE *child_info_file_w;
+
+static void
+writeChildInfo(const char *token, int val)
+{
+  fprintf(child_info_file_w, "%s=%d\n", token, val);
+  fflush(child_info_file_w);
+}
+
+void
+childReportSignal(int signum)
+{
+  writeChildInfo("signal", signum);
+}
+
+void
+childReportError(int error)
+{
+  writeChildInfo("error", error);
+}
+
+void
+childExit(int code, Uint32 currentStartPhase)
+{
+#ifndef NDB_WIN
+  writeChildInfo("sphase", currentStartPhase);
+  writeChildInfo("exit", code);
+  fprintf(child_info_file_w, "\n");
+  fclose(child_info_file_r);
+  fclose(child_info_file_w);
+  exit(code);
+#else
+  {
+    Configuration* theConfig=globalEmulatorData.theConfiguration;
+    theConfig->closeConfiguration(true);
+    switch (code) {
+    case NRT_Default:
+      g_eventLogger->info("Angel shutting down");
+      reportShutdown(theConfig, 0, 0, currentStartPhase);
+      exit(0);
+      break;
+    case NRT_NoStart_Restart:
+      theConfig->setInitialStart(false);
+      globalData.theRestartFlag=initial_state;
+      break;
+    case NRT_NoStart_InitialStart:
+      theConfig->setInitialStart(true);
+      globalData.theRestartFlag=initial_state;
+      break;
+    case NRT_DoStart_InitialStart:
+      theConfig->setInitialStart(true);
+      globalData.theRestartFlag=perform_start;
+      break;
+    default:
+      if (theConfig->stopOnError())
+      {
+        /**
+         * Error shutdown && stopOnError()
+         */
+        reportShutdown(theConfig, 1, 0, currentStartPhase);
+        exit(0);
+      }
+      // Fall-through
+    case NRT_DoStart_Restart:
+      theConfig->setInitialStart(false);
+      globalData.theRestartFlag=perform_start;
+      break;
+    }
+    char buf[80];
+    BaseString::snprintf(buf, sizeof (buf), "WIN_NDBD_CFG=%d %d %d",
+                         theConfig->getInitialStart(),
+                         globalData.theRestartFlag, globalData.ownId);
+    _putenv(buf);
+
+    char exe[MAX_PATH];
+    GetModuleFileName(0, exe, sizeof (exe));
+
+    STARTUPINFO sinfo;
+    ZeroMemory(&sinfo, sizeof (sinfo));
+    sinfo.cb=sizeof (STARTUPINFO);
+    sinfo.dwFlags=STARTF_USESHOWWINDOW;
+    sinfo.wShowWindow=SW_HIDE;
+
+    PROCESS_INFORMATION pinfo;
+    if (reportShutdown(theConfig, 0, 1, currentStartPhase))
+    {
+      g_eventLogger->error("unable to shutdown");
+      exit(1);
+    }
+    g_eventLogger->info("Ndb has terminated.  code=%d", code);
+    if (code == NRT_NoStart_Restart)
+      globalTransporterRegistry.disconnectAll();
+    g_eventLogger->info("Ndb has terminated.  Restarting");
+    if (CreateProcess(exe, GetCommandLine(), NULL, NULL, TRUE, 0, NULL, NULL,
+                      &sinfo, &pinfo) == 0)
+    {
+      g_eventLogger->error("Angel was unable to create child ndbd process"
+                           " error: %d", GetLastError());
+    }
+  }
+#endif
+}
+
+void
+childAbort(int code, Uint32 currentStartPhase)
+{
+#ifndef NDB_WIN
+  writeChildInfo("sphase", currentStartPhase);
+  writeChildInfo("exit", code);
+  fprintf(child_info_file_w, "\n");
+  fclose(child_info_file_r);
+  fclose(child_info_file_w);
+#ifndef NDB_WIN32
+  signal(SIGABRT, SIG_DFL);
+#endif
+  abort();
+#else
+  childExit(code, currentStartPhase);
+#endif
+}
+
+extern "C"
+void
+handler_shutdown(int signum){
+  g_eventLogger->info("Received signal %d. Performing stop.", signum);
+  childReportError(0);
+  childReportSignal(signum);
+  globalData.theRestartFlag = perform_stop;
+}
+
+extern NdbMutex * theShutdownMutex;
+
+extern "C"
+void
+handler_error(int signum){
+  // only let one thread run shutdown
+  static long thread_id= 0;
+
+  if (thread_id != 0 && thread_id == my_thread_id())
+  {
+    // Shutdown thread received signal
+#ifndef NDB_WIN32
+	signal(signum, SIG_DFL);
+    kill(getpid(), signum);
+#endif
+    while(true)
+      NdbSleep_MilliSleep(10);
+  }
+  if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0)
+    while(true)
+      NdbSleep_MilliSleep(10);
+  thread_id= my_thread_id();
+  g_eventLogger->info("Received signal %d. Running error handler.", signum);
+  childReportSignal(signum);
+  // restart the system
+  char errorData[64], *info= 0;
+#ifdef HAVE_STRSIGNAL
+  info= strsignal(signum);
+#endif
+  BaseString::snprintf(errorData, sizeof(errorData), "Signal %d received; %s", signum,
+		       info ? info : "No text for signal available");
+  ERROR_SET_SIGNAL(fatal, NDBD_EXIT_OS_SIGNAL_RECEIVED, errorData, __FILE__);
+}
+
+
+static void
+catchsigs(bool foreground){
+#if !defined NDB_WIN32
+
+  static const int signals_shutdown[] = {
+#ifdef SIGBREAK
+    SIGBREAK,
+#endif
+    SIGHUP,
+    SIGINT,
+#if defined SIGPWR
+    SIGPWR,
+#elif defined SIGINFO
+    SIGINFO,
+#endif
+    SIGQUIT,
+    SIGTERM,
+#ifdef SIGTSTP
+    SIGTSTP,
+#endif
+    SIGTTIN,
+    SIGTTOU
+  };
+
+  static const int signals_error[] = {
+    SIGABRT,
+    SIGALRM,
+#ifdef SIGBUS
+    SIGBUS,
+#endif
+    SIGCHLD,
+    SIGFPE,
+    SIGILL,
+#ifdef SIGIO
+    SIGIO,
+#endif
+#ifdef SIGPOLL
+    SIGPOLL,
+#endif
+    SIGSEGV
+  };
+
+  static const int signals_ignore[] = {
+    SIGPIPE
+  };
+
+  size_t i;
+  for(i = 0; i < sizeof(signals_shutdown)/sizeof(signals_shutdown[0]); i++)
+    signal(signals_shutdown[i], handler_shutdown);
+  for(i = 0; i < sizeof(signals_error)/sizeof(signals_error[0]); i++)
+    signal(signals_error[i], handler_error);
+  for(i = 0; i < sizeof(signals_ignore)/sizeof(signals_ignore[0]); i++)
+    signal(signals_ignore[i], SIG_IGN);
+
+#ifdef SIGTRAP
+  if (!foreground)
+    signal(SIGTRAP, handler_error);
+#endif
+
+#endif
+}
+
+
+int
+ndbd_run(bool foreground)
+{
+
+  if (get_multithreaded_config(globalEmulatorData))
+    return -1;
+
+  Configuration* theConfig = globalEmulatorData.theConfiguration;
+  theConfig->setupConfiguration();
+  systemInfo(* theConfig, * theConfig->m_logLevel);
+
+  NdbThread* pWatchdog = globalEmulatorData.theWatchDog->doStart();
+
+  {
+    /*
+     * Memory allocation can take a long time for large memory.
+     *
+     * So we want the watchdog to monitor the process of initial allocation.
+     */
+    Uint32 watchCounter;
+    watchCounter = 9;           //  Means "doing allocation"
+    globalEmulatorData.theWatchDog->registerWatchedThread(&watchCounter, 0);
+    if (init_global_memory_manager(globalEmulatorData, &watchCounter))
+      return 1;
+    globalEmulatorData.theWatchDog->unregisterWatchedThread(0);
+  }
+
+  globalEmulatorData.theThreadConfig->init(&globalEmulatorData);
+
+#ifdef VM_TRACE
+  // Create a signal logger before block constructors
+  char *buf= NdbConfig_SignalLogFileName(globalData.ownId);
+  NdbAutoPtr<char> tmp_aptr(buf);
+  FILE * signalLog = fopen(buf, "a");
+  globalSignalLoggers.setOwnNodeId(globalData.ownId);
+  globalSignalLoggers.setOutputStream(signalLog);
+#if 1 // to log startup
+  { const char* p = NdbEnv_GetEnv("NDB_SIGNAL_LOG", (char*)0, 0);
+    if (p != 0) {
+      char buf[200];
+      BaseString::snprintf(buf, sizeof(buf), "BLOCK=%s", p);
+      for (char* q = buf; *q != 0; q++) *q = toupper(toascii(*q));
+      globalSignalLoggers.log(SignalLoggerManager::LogInOut, buf);
+      globalData.testOn = 1;
+      assert(signalLog != 0);
+      fprintf(signalLog, "START\n");
+      fflush(signalLog);
+    }
+  }
+#endif
+#endif
+
+  // Load blocks (both main and workers)
+  globalEmulatorData.theSimBlockList->load(globalEmulatorData);
+
+  // Set thread concurrency for Solaris' light weight processes
+  int status;
+  status = NdbThread_SetConcurrencyLevel(30);
+  assert(status == 0);
+
+  catchsigs(foreground);
+
+  /**
+   * Do startup
+   */
+
+  ErrorReporter::setErrorHandlerShutdownType(NST_ErrorHandlerStartup);
+
+  switch(globalData.theRestartFlag){
+  case initial_state:
+    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI);
+    break;
+  case perform_start:
+    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_CMVMI);
+    globalEmulatorData.theThreadConfig->doStart(NodeState::SL_STARTING);
+    break;
+  default:
+    assert("Illegal state globalData.theRestartFlag" == 0);
+  }
+
+  globalTransporterRegistry.startSending();
+  globalTransporterRegistry.startReceiving();
+  if (!globalTransporterRegistry.start_service(*globalEmulatorData.m_socket_server)){
+    ndbout_c("globalTransporterRegistry.start_service() failed");
+    exit(-1);
+  }
+
+  // Re-use the mgm handle as a transporter
+  if(!globalTransporterRegistry.connect_client(
+		 theConfig->get_config_retriever()->get_mgmHandlePtr()))
+      ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG,
+		"Connection to mgmd terminated before setup was complete",
+		"StopOnError missing");
+
+  NdbThread* pTrp = globalTransporterRegistry.start_clients();
+  if (pTrp == 0)
+  {
+    ndbout_c("globalTransporterRegistry.start_clients() failed");
+    exit(-1);
+  }
+
+  NdbThread* pSockServ = globalEmulatorData.m_socket_server->startServer();
+
+  globalEmulatorData.theConfiguration->addThread(pTrp, SocketClientThread);
+  globalEmulatorData.theConfiguration->addThread(pWatchdog, WatchDogThread);
+  globalEmulatorData.theConfiguration->addThread(pSockServ, SocketServerThread);
+
+  //  theConfig->closeConfiguration();
+  {
+    NdbThread *pThis = NdbThread_CreateObject(0);
+    Uint32 inx = globalEmulatorData.theConfiguration->addThread(pThis,
+                                                                MainThread);
+    globalEmulatorData.theThreadConfig->ipControlLoop(pThis, inx);
+    globalEmulatorData.theConfiguration->removeThreadId(inx);
+  }
+  NdbShutdown(NST_Normal);
+
+  return NRT_Default;
+}

=== added file 'storage/ndb/src/kernel/ndbd.hpp'
--- a/storage/ndb/src/kernel/ndbd.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/kernel/ndbd.hpp	2009-03-04 14:54:30 +0000
@@ -0,0 +1,21 @@
+/* Copyright (C) 2003-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+
+   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 */
+
+#ifndef NDBD_HPP
+#define NDBD_HPP
+
+int ndbd_run(bool foreground);
+
+#endif

=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp	2008-12-18 08:51:37 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp	2009-03-04 10:40:00 +0000
@@ -14,7 +14,6 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <ndb_global.h>
-#include <ndb_opts.h>
 
 #include "Configuration.hpp"
 #include <ErrorHandlingMacros.hpp>
@@ -29,121 +28,19 @@
 #include <NdbConfig.h>
 
 #include <mgmapi_configuration.hpp>
-#include <mgmapi_config_parameters_debug.h>
 #include <kernel_config_parameters.h>
 
-#include <kernel_types.h>
-#include <ndb_limits.h>
 #include <ndbapi_limits.h>
-#include "pc.hpp"
-#include <LogLevel.hpp>
-#include <NdbSleep.h>
-#include <NdbThread.h>
-
-extern "C" {
-  void ndbSetOwnVersion();
-}
 
 #include <EventLogger.hpp>
 extern EventLogger * g_eventLogger;
 
-enum ndbd_options {
-  OPT_INITIAL = NDB_STD_OPTIONS_LAST,
-  OPT_NODAEMON,
-  OPT_FOREGROUND,
-  OPT_NOWAIT_NODES,
-  OPT_INITIAL_START
-};
-
-// XXX should be my_bool ???
-static int _daemon, _no_daemon, _foreground,  _initial, _no_start;
-static int _initialstart;
-static const char* _nowait_nodes = 0;
-static const char* _bind_address = 0;
-
 extern Uint32 g_start_type;
-extern NdbNodeBitmask g_nowait_nodes;
-
-const char *load_default_groups[]= { "mysql_cluster","ndbd",0 };
-
-/**
- * Arguments to NDB process
- */
-static struct my_option my_long_options[] =
-{
-  NDB_STD_OPTS("ndbd"),
-  { "initial", OPT_INITIAL,
-    "Perform initial start of ndbd, including cleaning the file system. "
-    "Consult documentation before using this",
-    (uchar**) &_initial, (uchar**) &_initial, 0,
-    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
-  { "nostart", 'n',
-    "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
-    (uchar**) &_no_start, (uchar**) &_no_start, 0,
-    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
-  { "daemon", 'd', "Start ndbd as daemon (default)",
-    (uchar**) &_daemon, (uchar**) &_daemon, 0,
-    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
-  { "nodaemon", OPT_NODAEMON,
-    "Do not start ndbd as daemon, provided for testing purposes",
-    (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0,
-    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
-  { "foreground", OPT_FOREGROUND,
-    "Run real ndbd in foreground, provided for debugging purposes"
-    " (implies --nodaemon)",
-    (uchar**) &_foreground, (uchar**) &_foreground, 0,
-    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
-  { "nowait-nodes", OPT_NOWAIT_NODES, 
-    "Nodes that will not be waited for during start",
-    (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
-    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
-  { "initial-start", OPT_INITIAL_START, 
-    "Perform initial start",
-    (uchar**) &_initialstart, (uchar**) &_initialstart, 0,
-    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
-  { "bind-address", OPT_NOWAIT_NODES, 
-    "Local bind address",
-    (uchar**) &_bind_address, (uchar**) &_bind_address, 0,
-    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
-};
-
-static void short_usage_sub(void)
-{
-  ndb_short_usage_sub(my_progname, NULL);
-}
-
-static void usage()
-{
-  ndb_usage(short_usage_sub, load_default_groups, my_long_options);
-}
 
 bool
-Configuration::init(int argc, char** argv)
+Configuration::init(int _no_start, int _initial,
+                    int _initialstart, int _daemon)
 {
-  ndb_opt_set_usage_funcs(NULL, short_usage_sub, usage);
-  load_defaults("my",load_default_groups,&argc,&argv);
-
-  int ho_error;
-#ifndef DBUG_OFF
-  opt_debug= "d:t:O,/tmp/ndbd.trace";
-#endif
-  if ((ho_error=handle_options(&argc, &argv, my_long_options,
-			       ndb_std_get_one_option)))
-    exit(ho_error);
-
-  if (_no_daemon || _foreground) {
-    _daemon= 0;
-  }
-
-  DBUG_PRINT("info", ("no_start=%d", _no_start));
-  DBUG_PRINT("info", ("initial=%d", _initial));
-  DBUG_PRINT("info", ("daemon=%d", _daemon));
-  DBUG_PRINT("info", ("foreground=%d", _foreground));
-  DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
-
-  ndbSetOwnVersion();
-
   // Check the start flag
   if (_no_start)
     globalData.theRestartFlag = initial_state;
@@ -153,42 +50,13 @@ Configuration::init(int argc, char** arg
   // Check the initial flag
   if (_initial)
     _initialStart = true;
-  
-  // Check connectstring
-  if (opt_connect_str)
-    _connectString = strdup(opt_connect_str);
-  
+
   // Check daemon flag
   if (_daemon)
     _daemonMode = true;
-  if (_foreground)
-    _foregroundMode = true;
 
-  // Save programname
-  if(argc > 0 && argv[0] != 0)
-    _programName = strdup(argv[0]);
-  else
-    _programName = strdup("");
-  
   globalData.ownId= 0;
 
-  if (_nowait_nodes)
-  {
-    int res = g_nowait_nodes.parseMask(_nowait_nodes);
-    if(res == -2 || (res > 0 && g_nowait_nodes.get(0)))
-    {
-      ndbout_c("Invalid nodeid specified in nowait-nodes: %s", 
-               _nowait_nodes);
-      exit(-1);
-    }
-    else if (res < 0)
-    {
-      ndbout_c("Unable to parse nowait-nodes argument: %s",
-               _nowait_nodes);
-      exit(-1);
-    }
-  }
-  
   if (_initialstart)
   {
     _initialStart = true;
@@ -198,8 +66,8 @@ Configuration::init(int argc, char** arg
   threadIdMutex = NdbMutex_Create();
   if (!threadIdMutex)
   {
-    ndbout_c("Failed to create threadIdMutex");
-    exit(-1);
+    g_eventLogger->error("Failed to create threadIdMutex");
+    return false;
   }
   initThreadArray();
   return true;
@@ -207,13 +75,10 @@ Configuration::init(int argc, char** arg
 
 Configuration::Configuration()
 {
-  _programName = 0;
-  _connectString = 0;
   _fsPath = 0;
   _backupPath = 0;
   _initialStart = false;
   _daemonMode = false;
-  _foregroundMode = false;
   m_config_retriever= 0;
   m_clusterConfig= 0;
   m_clusterConfigIter= 0;
@@ -221,11 +86,6 @@ Configuration::Configuration()
 }
 
 Configuration::~Configuration(){
-  if (opt_connect_str)
-    free(_connectString);
-
-  if(_programName != NULL)
-    free(_programName);
 
   if(_fsPath != NULL)
     free(_fsPath);
@@ -252,7 +112,8 @@ Configuration::closeConfiguration(bool e
 }
 
 void
-Configuration::fetch_configuration(){
+Configuration::fetch_configuration(const char* _connect_string,
+                                   const char* _bind_address){
   /**
    * Fetch configuration from management server
    */
@@ -261,7 +122,7 @@ Configuration::fetch_configuration(){
   }
 
   m_mgmd_port= 0;
-  m_config_retriever= new ConfigRetriever(getConnectString(),
+  m_config_retriever= new ConfigRetriever(_connect_string,
 					  NDB_VERSION, 
 					  NODE_TYPE_DB,
 					  _bind_address);
@@ -303,7 +164,7 @@ Configuration::fetch_configuration(){
 	      "Unable to alloc node id", m_config_retriever->getErrorString());
   }
   
-  ndb_mgm_configuration * p = cr.getConfig();
+  ndb_mgm_configuration * p = cr.getConfig(globalData.ownId);
   if(p == 0){
     const char * s = cr.getErrorString();
     if(s == 0)
@@ -659,18 +520,6 @@ Configuration::setRestartOnErrorInsert(i
   m_restartOnErrorInsert = i;
 }
 
-const char *
-Configuration::getConnectString() const {
-  return _connectString;
-}
-
-char *
-Configuration::getConnectStringCopy() const {
-  if(_connectString != 0)
-    return strdup(_connectString);
-  return 0;
-}
-
 const ndb_mgm_configuration_iterator * 
 Configuration::getOwnConfigIterator() const {
   return m_ownConfigIterator;
@@ -736,6 +585,12 @@ Configuration::calcSizeAlt(ConfigValues 
     }
   }
 
+  Uint32 lqhInstances = 1;
+  if (globalData.isNdbMtLqh)
+  {
+    lqhInstances = globalData.ndbMtLqhWorkers;
+  }
+
   Uint64 indexMem = 0, dataMem = 0;
   ndb_mgm_get_int64_parameter(&db, CFG_DB_DATA_MEM, &dataMem);
   ndb_mgm_get_int64_parameter(&db, CFG_DB_INDEX_MEM, &indexMem);
@@ -749,8 +604,11 @@ Configuration::calcSizeAlt(ConfigValues 
     ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, msg, buf);
   }
 
+#define DO_DIV(x,y) (((x) + (y - 1)) / (y))
+
   noOfDataPages = (dataMem / 32768);
   noOfIndexPages = (indexMem / 8192);
+  noOfIndexPages = DO_DIV(noOfIndexPages, lqhInstances);
 
   for(unsigned j = 0; j<LogLevel::LOGLEVEL_CATEGORIES; j++){
     Uint32 tmp;
@@ -861,7 +719,12 @@ Configuration::calcSizeAlt(ConfigValues 
   if (noOfLocalOperations == 0) {
     noOfLocalOperations= (11 * noOfOperations) / 10;
   }
+
   Uint32 noOfTCScanRecords = noOfScanRecords;
+  Uint32 noOfTCLocalScanRecords = noOfLocalScanRecords;
+
+  noOfLocalOperations = DO_DIV(noOfLocalOperations, lqhInstances);
+  noOfLocalScanRecords = DO_DIV(noOfLocalScanRecords, lqhInstances);
 
   {
     Uint32 noOfAccTables= noOfMetaTables/*noOfTables+noOfUniqueHashIndexes*/;
@@ -969,7 +832,7 @@ Configuration::calcSizeAlt(ConfigValues 
 	    noOfMetaTables);
     
     cfg.put(CFG_TC_LOCAL_SCAN, 
-	    noOfLocalScanRecords);
+	    noOfTCLocalScanRecords);
     
     cfg.put(CFG_TC_SCAN, 
 	    noOfTCScanRecords);

=== modified file 'storage/ndb/src/kernel/vm/Configuration.hpp'
--- a/storage/ndb/src/kernel/vm/Configuration.hpp	2008-11-07 13:23:15 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp	2009-03-04 10:40:00 +0000
@@ -16,6 +16,8 @@
 #ifndef Configuration_H
 #define Configuration_H
 
+#include <ndb_global.h>
+
 #include <util/BaseString.hpp>
 #include <mgmapi.h>
 #include <ndb_types.h>
@@ -52,12 +54,11 @@ public:
   Configuration();
   ~Configuration();
 
-  /**
-   * Returns false if arguments are invalid
-   */
-  bool init(int argc, char** argv);
+  bool init(int _no_start, int _initial,
+            int _initialstart, int _daemon);
 
-  void fetch_configuration();
+  void fetch_configuration(const char* _connect_string,
+                           const char* _bind_adress);
   void setupConfiguration();
   void closeConfiguration(bool end_session= true);
   
@@ -109,11 +110,8 @@ public:
   void setRestartOnErrorInsert(int);
   
   // Cluster configuration
-  const char * programName() const;
   const char * fileSystemPath() const;
   const char * backupFilePath() const;
-  const char * getConnectString() const;
-  char * getConnectStringCopy() const;
 
   /**
    * 
@@ -121,7 +119,6 @@ public:
   bool getInitialStart() const;
   void setInitialStart(bool val);
   bool getDaemonMode() const;
-  bool getForegroundMode() const;
 
   const ndb_mgm_configuration_iterator * getOwnConfigIterator() const;
 
@@ -132,10 +129,12 @@ public:
   class LogLevel * m_logLevel;
   ndb_mgm_configuration_iterator * getClusterConfigIterator() const;
 
+  ndb_mgm_configuration* getClusterConfig() const { return m_clusterConfig; }
+
 private:
   friend class Cmvmi;
   friend class Qmgr;
-  friend int reportShutdown(class Configuration *config, int error, int restart);
+  friend int reportShutdown(class Configuration *config, int error, int restart, Uint32 sphase);
 
   Uint32 _stopOnError;
   Uint32 m_restartOnErrorInsert;
@@ -165,27 +164,18 @@ private:
   /**
    * arguments to NDB process
    */
-  char * _programName;
   char * _fsPath;
   char * _backupPath;
   bool _initialStart;
-  char * _connectString;
   Uint32 m_mgmd_port;
   BaseString m_mgmd_host;
   bool _daemonMode; // if not, angel in foreground
-  bool _foregroundMode; // no angel, raw ndbd in foreground
 
   void calcSizeAlt(class ConfigValues * );
 };
 
 inline
 const char *
-Configuration::programName() const {
-  return _programName;
-}
-
-inline
-const char *
 Configuration::fileSystemPath() const {
   return _fsPath;
 }
@@ -208,10 +198,4 @@ Configuration::getDaemonMode() const {
   return _daemonMode;
 }
 
-inline
-bool
-Configuration::getForegroundMode() const {
-  return _foregroundMode;
-}
-
 #endif

=== modified file 'storage/ndb/src/kernel/vm/DataBuffer.hpp'
--- a/storage/ndb/src/kernel/vm/DataBuffer.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/vm/DataBuffer.hpp	2009-02-19 10:01:01 +0000
@@ -325,7 +325,6 @@ DataBuffer<sz>::seize(Uint32 n){
    */
   Uint32 free = thePool.getNoOfFree() * sz + rest;
   if(n > free){
-    release();
     return false;
   }
     

=== modified file 'storage/ndb/src/kernel/vm/Mutex.hpp'
--- a/storage/ndb/src/kernel/vm/Mutex.hpp	2007-11-12 16:13:49 +0000
+++ b/storage/ndb/src/kernel/vm/Mutex.hpp	2009-02-20 10:20:59 +0000
@@ -51,6 +51,10 @@ public:
   bool isNull() const;
   void release(SimulatedBlock::MutexManager & mgr);
 
+  Uint32 getHandle() const;
+  void setHandle(Uint32 handle);
+  void clear(); // disassociate handle from activemutexptr
+
 private:
   Uint32 m_activeMutexPtrI;
 };
@@ -134,6 +138,35 @@ MutexHandle2<MutexId>::release(Simulated
   }
 }
 
+template<Uint32 MutexId>
+inline
+Uint32
+MutexHandle2<MutexId>::getHandle() const
+{
+  return m_activeMutexPtrI;
+}
+
+template<Uint32 MutexId>
+inline
+void
+MutexHandle2<MutexId>::clear()
+{
+  m_activeMutexPtrI = RNIL;
+}
+
+template<Uint32 MutexId>
+inline
+void
+MutexHandle2<MutexId>::setHandle(Uint32 val)
+{
+  if (m_activeMutexPtrI == RNIL)
+  {
+    m_activeMutexPtrI = val;
+    return;
+  }
+  ErrorReporter::handleAssert("Mutex::setHandle mutex alreay inuse", 
+			      __FILE__, __LINE__);
+}
 
 inline
 Mutex::Mutex(Signal* signal, SimulatedBlock::MutexManager & mgr, 

=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2008-12-17 08:44:56 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2009-02-20 08:53:44 +0000
@@ -762,7 +762,7 @@ printLogEvent(struct ndb_logevent* event
 #undef  EVENT
 #define EVENT BackupStarted
   case NDB_LE_BackupStarted:
-      ndbout_c("Node %u: Backup %d started from node %d",
+      ndbout_c("Node %u: Backup %u started from node %d",
                R, Q(backup_id), Q(starting_node));
       break;
 #undef EVENT
@@ -802,7 +802,7 @@ printLogEvent(struct ndb_logevent* event
 #undef  EVENT
 #define EVENT BackupAborted
     case NDB_LE_BackupAborted:
-      ndbout_c("Node %u: Backup %d started from %d has been aborted. Error: %d",
+      ndbout_c("Node %u: Backup %u started from %d has been aborted. Error: %d",
                R, Q(backup_id), Q(starting_node), Q(error));
       break;
     /** 

=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2009-02-04 07:56:25 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2009-03-12 11:06:48 +0000
@@ -878,7 +878,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "8M",
+    "32M",
     "1M",
     STR_VALUE(MAX_INT_RNIL)},
 
@@ -1075,7 +1075,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
 
   {
     CFG_DB_THREAD_POOL,
-    "ThreadPool",
+    "DiskIOThreadPool",
     DB_TOKEN,
     "No of unbound threads for file access (currently only for DD)",
     ConfigInfo::CI_USED,
@@ -1439,7 +1439,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "4M", // sum of BackupDataBufferSize and BackupLogBufferSize
+    "32M", // sum of BackupDataBufferSize and BackupLogBufferSize
     "0",
     STR_VALUE(MAX_INT_RNIL) },
   
@@ -1451,7 +1451,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "2M", // remember to change BackupMemory
+    "16M", // remember to change BackupMemory
     "0",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -1463,7 +1463,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "2M", // remember to change BackupMemory
+    "16M", // remember to change BackupMemory
     "0",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -1475,7 +1475,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "32K",
+    "256K",
     "2K",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -1487,7 +1487,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "256K",
+    "1M",
     "2K",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -1634,7 +1634,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    UNDEFINED,
+    "2",
     "2",
     "8"
   },
@@ -1678,6 +1678,73 @@ const ConfigInfo::ParamInfo ConfigInfo::
     "true"
   },
 
+  {
+    CFG_DB_DD_FILESYSTEM_PATH,
+    "FileSystemPathDD",
+    DB_TOKEN,
+    "Path to directory where the "DB_TOKEN_PRINT" node stores its disk-data/undo-files",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    UNDEFINED,
+    0, 0 },
+
+  {
+    CFG_DB_DD_DATAFILE_PATH,
+    "FileSystemPathDataFiles",
+    DB_TOKEN,
+    "Path to directory where the "DB_TOKEN_PRINT" node stores its disk-data-files",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    UNDEFINED,
+    0, 0 },
+
+  {
+    CFG_DB_DD_UNDOFILE_PATH,
+    "FileSystemPathUndoFiles",
+    DB_TOKEN,
+    "Path to directory where the "DB_TOKEN_PRINT" node stores its disk-undo-files",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    UNDEFINED,
+    0, 0 },
+
+  {
+    CFG_DB_DD_LOGFILEGROUP_SPEC,
+    "InitialLogfileGroup",
+    DB_TOKEN,
+    "Logfile group that will be created during initial start",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    UNDEFINED,
+    0, 0 },
+
+  {
+    CFG_DB_DD_TABLEPACE_SPEC,
+    "InitialTablespace",
+    DB_TOKEN,
+    "Tablespace that will be created during initial start",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_STRING,
+    UNDEFINED,
+    0, 0 },
+
+  {
+    CFG_DB_LCP_TRY_LOCK_TIMEOUT,
+    "MaxLCPStartDelay",
+    DB_TOKEN,
+    "Time in seconds that LCP will poll for checkpoint mutex, before putting it self in lock-queue",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    "600" },
+
   /***************************************************************************
    * API
    ***************************************************************************/
@@ -2156,7 +2223,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "256K",
+    "2M",
     "64K",
     STR_VALUE(MAX_INT_RNIL) },
 
@@ -2168,7 +2235,7 @@ const ConfigInfo::ParamInfo ConfigInfo::
     ConfigInfo::CI_USED,
     false,
     ConfigInfo::CI_INT,
-    "64K",
+    "2M",
     "16K",
     STR_VALUE(MAX_INT_RNIL) },
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2009-01-02 09:35:46 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2009-02-23 09:59:06 +0000
@@ -28,16 +28,18 @@
 #include <ndb_version.h>
 
 
-#ifdef VM_TRACE
-#define require(v)  assert(v)
-#else
 static void
-require(bool v)
+_require(bool v, const char* expr, const char* file, int line)
 {
-  if (!v)
+  if (unlikely(!v))
+  {
+    fprintf(stderr, "%s:%d: require('%s') failed\n",
+            file, line, expr);
+    fflush(stderr);
     abort();
+  }
 }
-#endif
+#define require(v)  _require((v), #v, __FILE__, __LINE__)
 
 extern "C" const char* opt_connect_str;
 
@@ -683,6 +685,9 @@ ConfigManager::execCONFIG_CHANGE_IMPL_RE
                        "requestType: %d",
                        nodeId, req->requestType);
 
+  if (!m_defragger.defragment(sig))
+    return; // More fragments to come
+
   Guard g(m_config_mutex);
 
   switch(req->requestType){
@@ -1044,7 +1049,10 @@ ConfigManager::execCONFIG_CHANGE_IMPL_CO
     require(m_config_change_error);
     if (m_client_ref == ss.getOwnRef())
     {
-      g_eventLogger->error("Config change failed!");
+      g_eventLogger->
+        error("Configuration change failed! error: %d '%s'",
+              m_config_change_error,
+              ConfigChangeRef::errorMessage(m_config_change_error));
       exit(1);
     }
     else
@@ -1104,7 +1112,11 @@ ConfigManager::startInitConfigChange(Sig
   require(m_config_state == CS_INITIAL);
   g_eventLogger->info("Starting initial configuration change");
   m_client_ref = ss.getOwnRef();
-  sendConfigChangeImplReq(ss, m_new_config);
+  if (!sendConfigChangeImplReq(ss, m_new_config))
+  {
+    g_eventLogger->error("Failed to start initial configuration change!");
+    exit(1);
+  }
 }
 
 
@@ -1115,7 +1127,11 @@ ConfigManager::startNewConfigChange(Sign
   g_eventLogger->info("Starting configuration change, generation: %d",
                       m_new_config->getGeneration());
   m_client_ref = ss.getOwnRef();
-  sendConfigChangeImplReq(ss, m_new_config);
+  if (!sendConfigChangeImplReq(ss, m_new_config))
+  {
+    g_eventLogger->error("Failed to start configuration change!");
+    exit(1);
+  }
 
   /* The new config has been sent and can now be discarded */
   delete m_new_config;
@@ -1123,7 +1139,7 @@ ConfigManager::startNewConfigChange(Sign
 }
 
 
-void
+bool
 ConfigManager::sendConfigChangeImplReq(SignalSender& ss, const Config* conf)
 {
   require(m_client_ref != RNIL);
@@ -1143,18 +1159,52 @@ ConfigManager::sendConfigChangeImplReq(S
   req->initial = (m_config_state == CS_INITIAL);
   req->length = buf.length();
 
+  require(m_waiting_for.isclear());
+  require(m_config_change_state == CCS_IDLE);
+
   g_eventLogger->debug("Sending CONFIG_CHANGE_IMPL_REQ(prepare)");
+  unsigned i = 0;
+  while((i = m_all_mgm.find(i+1)) != NodeBitmask::NotFound)
+  {
+    g_eventLogger->debug(" - to node %d", i);
+    int result =
+      ss.sendFragmentedSignal(i, ssig, MGM_CONFIG_MAN,
+                              GSN_CONFIG_CHANGE_IMPL_REQ,
+                              ConfigChangeImplReq::SignalLength);
+    if (result != 0)
+    {
+      g_eventLogger->warning("Failed to send configuration change "
+                             "prepare to node: %d, result: %d",
+                             i, result);
+      break;
+    }
+    ssig.header.m_noOfSections = 1; // reset by sendFragmentedSignal
 
-  require(m_waiting_for.isclear());
-  m_waiting_for = ss.broadcastSignal(m_all_mgm, ssig,
-                                MGM_CONFIG_MAN,
-                                GSN_CONFIG_CHANGE_IMPL_REQ,
-                                ConfigChangeImplReq::SignalLength);
-  if (!m_waiting_for.isclear())
-    m_config_change_state = CCS_ABORT;
-  else
-    require(m_config_change_state == CCS_IDLE);
+    m_waiting_for.set(i);
+  }
+
+  if (!m_all_mgm.equal(m_waiting_for))
+  {
+    // Could not send prepare to all nodes
+    m_config_change_error = ConfigChangeRef::SendFailed;
+    if (!m_waiting_for.isclear())
+    {
+      // Some nodes got prepare, set state to
+      // abort and continue abort when result
+      // of prepare arrives
+      m_config_change_state = CCS_ABORT;
+      return false;
+    }
+
+    // No node has got prepare
+    return false;
+  }
+
+  // Prepare has been sent to all mgm nodes
+  // continue and wait for prepare conf(s)
   m_config_change_state = CCS_PREPARING;
+  return true;
+
 }
 
 
@@ -1165,6 +1215,9 @@ ConfigManager::execCONFIG_CHANGE_REQ(Sig
   const ConfigChangeReq * const req =
     CAST_CONSTPTR(ConfigChangeReq, sig->getDataPtr());
 
+  if (!m_defragger.defragment(sig))
+    return; // More fragments to come
+
   if (!m_started.equal(m_all_mgm)) // Not all started
   {
     sendConfigChangeRef(ss, from, ConfigChangeRef::NotAllStarted);
@@ -1207,7 +1260,14 @@ ConfigManager::execCONFIG_CHANGE_REQ(Sig
   }
 
   m_client_ref = from;
-  sendConfigChangeImplReq(ss, &new_config);
+  if (!sendConfigChangeImplReq(ss, &new_config))
+  {
+    assert(m_config_change_error);
+    sendConfigChangeRef(ss, from,
+                        m_config_change_error);
+    return;
+  }
+
   return;
 }
 
@@ -1229,8 +1289,8 @@ ConfigManager::execCONFIG_CHECK_REQ(Sign
   g_eventLogger->debug("Got CONFIG_CHECK_REQ from node: %d. "   \
                        "generation: %d, other_generation: %d, " \
                        "our state: %d, other state: %d",
-                       generation, other_generation,
-                       m_config_state, other_state, nodeId);
+                       nodeId, generation, other_generation,
+                       m_config_state, other_state);
 
   switch (m_config_state)
   {
@@ -1519,11 +1579,17 @@ ConfigManager::run()
       ndbout_c("Node %d failed", nodeId);
       m_started.clear(nodeId);
       m_checked.clear(nodeId);
+      m_defragger.node_failed(nodeId);
 
       if (m_config_change_state != CCS_IDLE)
       {
         g_eventLogger->info("Node %d failed during config change!!",
                             nodeId);
+        g_eventLogger->warning("Node failure handling of config "
+                               "change protocol not yet implemented!! "
+                               "No more configuration changes can occur, "
+                               "but the node will continue to serve the "
+                               "last good configuration");
         // TODO start take over of config change protocol
       }
       break;

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp	2008-12-17 16:09:24 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp	2009-02-23 09:59:06 +0000
@@ -20,6 +20,7 @@
 #include "Config.hpp"
 #include "ConfigSubscriber.hpp"
 #include "MgmtSrvr.hpp"
+#include "Defragger.hpp"
 
 #include <ConfigRetriever.hpp>
 
@@ -74,6 +75,8 @@ class ConfigManager : public MgmtThread 
 
   const char* m_configdir;
 
+  Defragger m_defragger;
+
   /* Functions used from 'init' */
   static Config* load_init_config(const char*);
   static Config* load_init_mycnf(void);
@@ -121,7 +124,7 @@ class ConfigManager : public MgmtThread 
   void execCONFIG_CHANGE_IMPL_CONF(SignalSender& ss, SimpleSignal* sig);
   void sendConfigChangeImplRef(SignalSender& ss, NodeId nodeId,
                                ConfigChangeRef::ErrorCode) const;
-  void sendConfigChangeImplReq(SignalSender& ss, const Config* conf);
+  bool sendConfigChangeImplReq(SignalSender& ss, const Config* conf);
 
   /*
     CONFIG_CHECK - protocol for exchanging and checking config state

=== added file 'storage/ndb/src/mgmsrv/Defragger.hpp'
--- a/storage/ndb/src/mgmsrv/Defragger.hpp	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/mgmsrv/Defragger.hpp	2009-02-23 09:59:06 +0000
@@ -0,0 +1,130 @@
+/* Copyright (C) 2009 Sun Microsystems, Inc.
+
+   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 */
+
+#ifndef Defragger_H
+#define Defragger_H
+
+
+/*
+  reception of fragmented signals
+  - defragments signal based on nodeid and fragmentid
+*/
+
+class Defragger {
+  struct DefragBuffer {
+    // Key
+    Uint32 m_fragment_id;
+    NodeId m_node_id;
+    // Data
+    UtilBuffer m_buffer;
+    DefragBuffer(NodeId nodeId, Uint32 fragId) :
+      m_fragment_id(fragId), m_node_id(nodeId) {}
+  };
+  Vector<DefragBuffer*> m_buffers;
+
+  DefragBuffer* find_buffer(NodeId nodeId, Uint32 fragId){
+    for (size_t i = 0; i < m_buffers.size(); i++)
+    {
+      DefragBuffer* dbuf = m_buffers[i];
+      if (dbuf->m_node_id == nodeId &&
+          dbuf->m_fragment_id == fragId)
+        return dbuf;
+    }
+    return NULL;
+  }
+
+  void erase_buffer(const DefragBuffer* dbuf){
+    for (size_t i = 0; i < m_buffers.size(); i++)
+    {
+      if (m_buffers[i] == dbuf)
+      {
+        delete dbuf;
+        m_buffers.erase(i);
+        return;
+      }
+    }
+    assert(false); // Should never be reached
+  }
+
+public:
+  Defragger() {};
+  ~Defragger() {};
+
+  /*
+    return true when complete signal received
+  */
+
+  bool defragment(SimpleSignal* sig) {
+
+    if (!sig->isFragmented())
+      return true;
+
+    Uint32 fragId = sig->getFragmentId();
+    NodeId nodeId = refToNode(sig->header.theSendersBlockRef);
+
+    DefragBuffer* dbuf;
+    if(sig->isFirstFragment()){
+
+      // Make sure buffer does not exist
+      if (find_buffer(nodeId, fragId))
+        abort();
+
+      dbuf = new DefragBuffer(nodeId, fragId);
+      m_buffers.push_back(dbuf);
+
+    } else {
+      dbuf = find_buffer(nodeId, fragId);
+      if (dbuf == NULL)
+        abort();
+    }
+    if (dbuf->m_buffer.append(sig->ptr[0].p, sig->ptr[0].sz * sizeof(Uint32)))
+      abort(); // OOM
+
+    if (!sig->isLastFragment())
+      return false;
+
+    // Copy defragmented data into signal...
+    int length = dbuf->m_buffer.length();
+    delete[] sig->ptr[0].p;
+    sig->ptr[0].sz = (length+3)/4;
+    sig->ptr[0].p = new Uint32[sig->ptr[0].sz];
+    memcpy(sig->ptr[0].p, dbuf->m_buffer.get_data(), length);
+
+    // erase the buffer data
+    erase_buffer(dbuf);
+    return true;
+  }
+
+
+  /*
+    clear any unassembled signal buffers from node
+  */
+  void node_failed(NodeId nodeId) {
+    for (size_t i = 0; i < m_buffers.size(); i++)
+    {
+      DefragBuffer* dbuf = m_buffers[i];
+      if (dbuf->m_node_id == nodeId)
+      {
+        delete dbuf; // MASV ?
+        m_buffers.erase(i);
+      }
+    }
+  }
+
+};
+
+template class Vector<Defragger::DefragBuffer*>;
+
+#endif

=== modified file 'storage/ndb/src/mgmsrv/InitConfigFileParser.cpp'
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp	2008-10-21 12:41:59 +0000
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp	2009-03-06 11:00:10 +0000
@@ -19,8 +19,11 @@
 #include "Config.hpp"
 #include <NdbOut.hpp>
 #include "ConfigInfo.hpp"
+#include "EventLogger.hpp"
 #include <m_string.h>
 
+extern EventLogger *g_eventLogger;
+
 const int MAX_LINE_LENGTH = 1024;  // Max length of line of text in config file
 static void trim(char *);
 
@@ -29,10 +32,9 @@ static void require(bool v) { if(!v) abo
 //****************************************************************************
 //  Ctor / Dtor
 //****************************************************************************
-InitConfigFileParser::InitConfigFileParser(FILE * out)
+InitConfigFileParser::InitConfigFileParser()
 {
   m_info = new ConfigInfo();
-  m_errstream = out ? out : stderr;
 }
 
 InitConfigFileParser::~InitConfigFileParser() {
@@ -42,12 +44,11 @@ InitConfigFileParser::~InitConfigFilePar
 //****************************************************************************
 //  Read Config File
 //****************************************************************************
-InitConfigFileParser::Context::Context(const ConfigInfo * info, FILE * out)
+InitConfigFileParser::Context::Context(const ConfigInfo * info)
   :  m_userProperties(true), m_configValues(1000, 20) {
 
   m_config = new Properties(true);
   m_defaults = new Properties(true);
-  m_errstream = out;
 }
 
 InitConfigFileParser::Context::~Context(){
@@ -62,7 +63,7 @@ Config *
 InitConfigFileParser::parseConfig(const char * filename) {
   FILE * file = fopen(filename, "r");
   if(file == 0){
-    fprintf(m_errstream, "Error opening file: %s\n", filename);
+    g_eventLogger->error("Error opening '%s', error: %d, %s", filename, errno, strerror(errno));
     return 0;
   }
   
@@ -76,7 +77,7 @@ InitConfigFileParser::parseConfig(FILE *
 
   char line[MAX_LINE_LENGTH];
 
-  Context ctx(m_info, m_errstream); 
+  Context ctx(m_info);
   ctx.m_lineno = 0;
   ctx.m_currentSection = 0;
 
@@ -582,8 +583,8 @@ InitConfigFileParser::Context::reportErr
   if (fmt != 0)
     BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
   va_end(ap);
-  fprintf(m_errstream, "Error line %d: %s\n",
-	  m_lineno, buf);
+  g_eventLogger->error("at line %d: %s\n",
+                       m_lineno, buf);
 
   //m_currentSection->print();
 }
@@ -597,8 +598,8 @@ InitConfigFileParser::Context::reportWar
   if (fmt != 0)
     BaseString::vsnprintf(buf, sizeof(buf)-1, fmt, ap);
   va_end(ap);
-  fprintf(m_errstream, "Warning line %d: %s\n",
-	  m_lineno, buf);
+  g_eventLogger->warning("at line %d: %s\n",
+                         m_lineno, buf);
 }
 
 #include <my_sys.h>
@@ -851,7 +852,7 @@ InitConfigFileParser::parse_mycnf() 
     api = &options[idx+3];
   }
   
-  Context ctx(m_info, m_errstream); 
+  Context ctx(m_info);
   const char *groups[]= { "cluster_config", 0 };
   if (load_defaults(options, groups))
     goto end;

=== modified file 'storage/ndb/src/mgmsrv/InitConfigFileParser.hpp'
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.hpp	2008-06-10 09:21:15 +0000
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.hpp	2009-03-06 11:00:10 +0000
@@ -33,12 +33,11 @@ class ConfigInfo;
  * object if the config file has correct syntax and semantic. 
  */
 class InitConfigFileParser {
-  FILE * m_errstream;
 public:
   /**
    *   Constructor
    */
-  InitConfigFileParser(FILE * errstream = stdout);
+  InitConfigFileParser();
   ~InitConfigFileParser();
 
   /**
@@ -61,7 +60,7 @@ public:
    *   Context = Which section in init config file we are currently parsing
    */
   struct Context {
-    Context(const ConfigInfo *, FILE * out);
+    Context(const ConfigInfo *);
     ~Context();
 
     ContextSectionType  type; ///< Section type (e.g. default section,section)
@@ -83,7 +82,6 @@ public:
     ConfigValuesFactory m_configValues;  //
 
   public:
-    FILE * m_errstream;
     void reportError(const char * msg, ...)
       ATTRIBUTE_FORMAT(printf, 2, 3);
     void reportWarning(const char * msg, ...)

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2009-01-15 13:01:37 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2009-02-23 11:28:13 +0000
@@ -422,7 +422,7 @@ MgmtSrvr::init()
   int error_code;
   BaseString error_string;
   if (!alloc_node_id(&nodeId, NDB_MGM_NODE_TYPE_MGM,
-                     0, /* client_addr */
+                     0, 0, /* client_addr, len */
                      error_code, error_string,
                      0 /* log_event */ ))
   {
@@ -2716,7 +2716,9 @@ MgmtSrvr::get_connected_nodes(NodeBitmas
 }
 
 int
-MgmtSrvr::alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type)
+MgmtSrvr::alloc_node_id_req(NodeId free_node_id,
+                            enum ndb_mgm_node_type type,
+                            Uint32 timeout_ms)
 {
   SignalSender ss(theFacade);
   ss.lock(); // lock will be released on exit
@@ -2730,6 +2732,7 @@ MgmtSrvr::alloc_node_id_req(NodeId free_
   req->senderData = 19;
   req->nodeId = free_node_id;
   req->nodeType = type;
+  req->timeout = timeout_ms;
 
   int do_send = 1;
   NodeId nodeId = 0;
@@ -2814,141 +2817,164 @@ MgmtSrvr::alloc_node_id_req(NodeId free_
   return 0;
 }
 
-bool
-MgmtSrvr::alloc_node_id(NodeId * nodeId,
-			enum ndb_mgm_node_type type,
-			struct sockaddr *client_addr, 
-			int &error_code, BaseString &error_string,
-                        int log_event)
+int
+MgmtSrvr::match_hostname(const struct sockaddr *clnt_addr,
+                         const char *config_hostname) const
 {
-  DBUG_ENTER("MgmtSrvr::alloc_node_id");
-  DBUG_PRINT("enter", ("nodeid: %d  type: %d  client_addr: 0x%ld",
-		       *nodeId, type, (long) client_addr));
-  if (m_opts.no_nodeid_checks) {
-    if (*nodeId == 0) {
-      error_string.appfmt("no-nodeid-checks set in management server.\n"
-			  "node id must be set explicitly in connectstring");
-      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-      DBUG_RETURN(false);
+  struct in_addr config_addr= {0};
+  if (clnt_addr)
+  {
+    const struct in_addr *clnt_in_addr = &((sockaddr_in*)clnt_addr)->sin_addr;
+
+    if (Ndb_getInAddr(&config_addr, config_hostname) != 0
+        || memcmp(&config_addr, clnt_in_addr, sizeof(config_addr)) != 0)
+    {
+      struct in_addr tmp_addr;
+      if (Ndb_getInAddr(&tmp_addr, "localhost") != 0
+          || memcmp(&tmp_addr, clnt_in_addr, sizeof(config_addr)) != 0)
+      {
+        // not localhost
+#if 0
+        ndbout << "MgmtSrvr::getFreeNodeId compare failed for \""
+               << config_hostname
+               << "\" id=" << tmp << endl;
+#endif
+        return -1;
+      }
+
+      // connecting through localhost
+      // check if config_hostname is local
+      if (!SocketServer::tryBind(0, config_hostname))
+        return -1;
     }
-    DBUG_RETURN(true);
   }
-
-  Guard g(m_node_id_mutex);
-  int no_mgm= 0;
-  NodeBitmask connected_nodes(m_reserved_nodes);
-  get_connected_nodes(connected_nodes);
+  else
   {
-    for(Uint32 i = 0; i < MAX_NODES; i++)
-      if (getNodeType(i) == NDB_MGM_NODE_TYPE_MGM)
-	no_mgm++;
+    if (!SocketServer::tryBind(0, config_hostname))
+      return -1;
   }
-  bool found_matching_id= false;
-  bool found_matching_type= false;
-  bool found_free_node= false;
-  unsigned id_found= 0;
-  const char *config_hostname= 0;
-  struct in_addr config_addr= {0};
-  int r_config_addr= -1;
-  unsigned type_c= 0;
+  return 0;
+}
 
-  {
-    Guard guard_config(m_local_config_mutex);
-    ConfigIter iter(m_local_config, CFG_SECTION_NODE);
-    for(iter.first(); iter.valid(); iter.next())
-    {
-      unsigned curr_nodeid = 0;
-      require(!iter.get(CFG_NODE_ID, &curr_nodeid));
-      if (*nodeId && *nodeId != curr_nodeid)
-        continue;
-      found_matching_id = true;
+int
+MgmtSrvr::find_node_type(unsigned node_id, enum ndb_mgm_node_type type,
+                         const struct sockaddr *client_addr,
+                         NodeBitmask &nodes,
+                         NodeBitmask &exact_nodes,
+                         Vector<struct nodeid_and_host> &nodes_info,
+                         int &error_code, BaseString &error_string)
+{
+  const char *found_config_hostname= 0;
+  unsigned type_c= (unsigned)type;
 
-      require(!iter.get(CFG_TYPE_OF_SECTION, &type_c));
-      if(type_c != (unsigned)type)
-        continue;
-      found_matching_type = true;
+  Guard g(m_local_config_mutex);
 
-      if (connected_nodes.get(curr_nodeid))
+  ConfigIter iter(m_local_config, CFG_SECTION_NODE);
+  for(iter.first(); iter.valid(); iter.next())
+  {
+    unsigned id;
+    if (iter.get(CFG_NODE_ID, &id))
+      require(false);
+    if (node_id && node_id != id)
+      continue;
+    if (iter.get(CFG_TYPE_OF_SECTION, &type_c))
+      require(false);
+    if (type_c != (unsigned)type)
+    {
+      if (!node_id)
         continue;
-      found_free_node = true;
-
-      require(!iter.get(CFG_NODE_HOST, &config_hostname));
-      if (config_hostname && config_hostname[0] == 0)
-        config_hostname = 0;
-      else if (client_addr)
-      {
-        // check hostname compatibility
-        const void *tmp_in = &(((sockaddr_in*)client_addr)->sin_addr);
-        if((r_config_addr= Ndb_getInAddr(&config_addr, config_hostname)) != 0 ||
-           memcmp(&config_addr, tmp_in, sizeof(config_addr)) != 0)
-        {
-          struct in_addr tmp_addr;
-          if(Ndb_getInAddr(&tmp_addr, "localhost") != 0 ||
-             memcmp(&tmp_addr, tmp_in, sizeof(config_addr)) != 0)
-          {
-            // not localhost
-            continue;
-          }
-
-          // connecting through localhost
-          // check if config_hostname is local
-          if (!SocketServer::tryBind(0,config_hostname))
-            continue;
-        }
-      }
-      else
+      goto error;
+    }
+    const char *config_hostname= 0;
+    if (iter.get(CFG_NODE_HOST, &config_hostname))
+      require(false);
+    if (config_hostname == 0 || config_hostname[0] == 0)
+    {
+      config_hostname= "";
+    }
+    else
+    {
+      found_config_hostname= config_hostname;
+      if (match_hostname(client_addr, config_hostname))
       {
-        // client_addr == 0
-        if (!SocketServer::tryBind(0,config_hostname))
+        if (!node_id)
           continue;
+        goto error;
       }
+      exact_nodes.set(id);
+    }
+    nodes.set(id);
+    struct nodeid_and_host a= {id, config_hostname};
+    nodes_info.push_back(a);
+    if (node_id)
+      break;
+  }
+  if (nodes_info.size() != 0)
+  {
+    return 0;
+  }
 
-      if (*nodeId != 0 ||
-          type != NDB_MGM_NODE_TYPE_MGM ||
-          no_mgm == 1)  // any match is ok
-      {
-        if (config_hostname == 0 &&
-            *nodeId == 0 &&
-            type != NDB_MGM_NODE_TYPE_MGM)
-        {
-          if (!id_found) // only set if not set earlier
-            id_found = curr_nodeid;
-          continue; /* continue looking for a nodeid with specified hostname */
-        }
-        assert(id_found == 0);
-        id_found = curr_nodeid;
-        break;
-      }
-
-      if (id_found) // mgmt server may only have one match
-      {
-        error_string.appfmt("Ambiguous node id's %d and %d. "
-                            "Suggest specifying node id in connectstring, "
-                            "or specifying unique host names in config file.",
-                            id_found, curr_nodeid);
-        error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-        DBUG_RETURN(false);
-      }
-
-      if (config_hostname == 0)
-      {
-        error_string.appfmt("Ambiguity for node id %d. "
-                            "Suggest specifying node id in connectstring, "
-                            "or specifying unique host names in config file, "
-                            "or specifying just one mgmt server in "
-                            "config file.",
-                            curr_nodeid);
-        error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-        DBUG_RETURN(false);
-      }
-      id_found = curr_nodeid; // mgmt server matched, check for more matches
+ error:
+  /*
+    lock on m_configMutex held because found_config_hostname may have
+    reference inot config structure
+  */
+  error_code= NDB_MGM_ALLOCID_CONFIG_MISMATCH;
+  if (node_id)
+  {
+    if (type_c != (unsigned) type)
+    {
+      BaseString type_string, type_c_string;
+      const char *alias, *str;
+      alias= ndb_mgm_get_node_type_alias_string(type, &str);
+      type_string.assfmt("%s(%s)", alias, str);
+      alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)type_c,
+                                                &str);
+      type_c_string.assfmt("%s(%s)", alias, str);
+      error_string.appfmt("Id %d configured as %s, connect attempted as %s.",
+                          node_id, type_c_string.c_str(),
+                          type_string.c_str());
+      return -1;
+    }
+    if (found_config_hostname)
+    {
+      struct in_addr config_addr= {0};
+      int r_config_addr= Ndb_getInAddr(&config_addr, found_config_hostname);
+      error_string.appfmt("Connection with id %d done from wrong host ip %s,",
+                          node_id, inet_ntoa(((struct sockaddr_in *)
+                                              (client_addr))->sin_addr));
+      error_string.appfmt(" expected %s(%s).", found_config_hostname,
+                          r_config_addr ?
+                          "lookup failed" : inet_ntoa(config_addr));
+      return -1;
     }
+    error_string.appfmt("No node defined with id=%d in config file.", node_id);
+    return -1;
   }
 
-  if (id_found && client_addr != 0)
+  // node_id == 0 and nodes_info.size() == 0
+  if (found_config_hostname)
+  {
+    error_string.appfmt("Connection done from wrong host ip %s.",
+                        (client_addr)?
+                        inet_ntoa(((struct sockaddr_in *)
+                                   (client_addr))->sin_addr):"");
+    return -1;
+  }
+
+  error_string.append("No nodes defined in config file.");
+  return -1;
+}
+
+int
+MgmtSrvr::try_alloc(unsigned id, const char *config_hostname,
+                    enum ndb_mgm_node_type type,
+                    const struct sockaddr *client_addr,
+                    Uint32 timeout_ms)
+{
+  if (client_addr != 0)
   {
-    int res = alloc_node_id_req(id_found, type);
-    unsigned save_id_found = id_found;
+    int res = alloc_node_id_req(id, type, timeout_ms);
     switch (res)
     {
     case 0:
@@ -2959,155 +2985,175 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
       break;
     default:
       // something wrong
-      id_found = 0;
-      break;
-
-    }
-    if (id_found == 0)
-    {
-      char buf[128];
-      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());
-      DBUG_RETURN(false);
+      return -1;
     }
   }
 
-  if (id_found)
+  DBUG_PRINT("info", ("allocating node id %d",id));
   {
-    *nodeId= id_found;
-    DBUG_PRINT("info", ("allocating node id %d",*nodeId));
+    int r= 0;
+    if (client_addr)
     {
-      int r= 0;
-      if (client_addr)
-	m_connect_address[id_found]=
-	  ((struct sockaddr_in *)client_addr)->sin_addr;
-      else if (config_hostname)
-	r= Ndb_getInAddr(&(m_connect_address[id_found]), config_hostname);
-      else {
-	char name[256];
-	r= gethostname(name, sizeof(name));
-	if (r == 0) {
-	  name[sizeof(name)-1]= 0;
-	  r= Ndb_getInAddr(&(m_connect_address[id_found]), name);
-	}
-      }
-      if (r)
-	m_connect_address[id_found].s_addr= 0;
-    }
-    m_reserved_nodes.set(id_found);
-    if (theFacade && id_found != theFacade->ownId())
-    {
-      /**
-       * Make sure we're ready to accept connections from this node
-       */
-      theFacade->lock_mutex();
-      theFacade->doConnect(id_found);
-      theFacade->unlock_mutex();
+      m_connect_address[id]= ((struct sockaddr_in *)client_addr)->sin_addr;
     }
+    else if (config_hostname)
+    {
+      r= Ndb_getInAddr(&(m_connect_address[id]), config_hostname);
+    }
+    else
+    {
+      char name[256];
+      r= gethostname(name, sizeof(name));
+      if (r == 0)
+      {
+        name[sizeof(name)-1]= 0;
+        r= Ndb_getInAddr(&(m_connect_address[id]), name);
+      }
+    }
+    if (r)
+    {
+      m_connect_address[id].s_addr= 0;
+    }
+  }
+  m_reserved_nodes.set(id);
+  if (theFacade && id != theFacade->ownId())
+  {
+    /**
+     * Make sure we're ready to accept connections from this node
+     */
+    theFacade->lock_mutex();
+    theFacade->doConnect(id);
+    theFacade->unlock_mutex();
+  }
     
-    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);
+  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, get_connect_address(id), tmp_str);
+
+  return 0;
+}
+
+bool
+MgmtSrvr::alloc_node_id(NodeId * nodeId,
+			enum ndb_mgm_node_type type,
+			const struct sockaddr *client_addr,
+			SOCKET_SIZE_TYPE *client_addr_len,
+			int &error_code, BaseString &error_string,
+                        int log_event,
+                        int timeout_s)
+{
+  DBUG_ENTER("MgmtSrvr::alloc_node_id");
+  DBUG_PRINT("enter", ("nodeid: %d  type: %d  client_addr: 0x%ld",
+		       *nodeId, type, (long) client_addr));
+  if (m_opts.no_nodeid_checks) {
+    if (*nodeId == 0) {
+      error_string.appfmt("no-nodeid-checks set in management server. "
+			  "node id must be set explicitly in connectstring");
+      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
+      DBUG_RETURN(false);
+    }
     DBUG_RETURN(true);
   }
 
-  if (found_matching_type && !found_free_node) {
-    // we have a temporary error which might be due to that 
-    // we have got the latest connect status from db-nodes.  Force update.
-    updateStatus();
-  }
+  Uint32 timeout_ms = Uint32(1000 * timeout_s);
 
-  BaseString type_string, type_c_string;
+  Guard g(m_node_id_mutex);
+
+  NodeBitmask connected_nodes;
+  get_connected_nodes(connected_nodes);
+
+  NodeBitmask nodes, exact_nodes;
+  Vector<struct nodeid_and_host> nodes_info;
+
+  /* find all nodes with correct type */
+  if (find_node_type(*nodeId, type, client_addr, nodes, exact_nodes, nodes_info,
+                     error_code, error_string))
+    goto error;
+
+  // nodes_info.size() == 0 handled inside find_node_type
+  DBUG_ASSERT(nodes_info.size() != 0);
+
+  if (type == NDB_MGM_NODE_TYPE_MGM && nodes_info.size() > 1)
   {
-    const char *alias, *str;
-    alias= ndb_mgm_get_node_type_alias_string(type, &str);
-    type_string.assfmt("%s(%s)", alias, str);
-    alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)type_c,
-					      &str);
-    type_c_string.assfmt("%s(%s)", alias, str);
+    // mgmt server may only have one match
+    error_string.appfmt("Ambiguous node id's %d and %d. "
+                        "Suggest specifying node id in connectstring, "
+                        "or specifying unique host names in config file.",
+                        nodes_info[0].id, nodes_info[1].id);
+    error_code= NDB_MGM_ALLOCID_CONFIG_MISMATCH;
+    goto error;
   }
 
-  if (*nodeId == 0)
+  /* remove connected and reserved nodes from possible nodes to allocate */
+  nodes.bitANDC(connected_nodes);
+  nodes.bitANDC(m_reserved_nodes);
+
+  /* first try all nodes with exact match of hostname */
+  for (Uint32 i = 0; i < nodes_info.size(); i++)
   {
-    if (found_matching_id)
+    unsigned id= nodes_info[i].id;
+    if (!nodes.get(id))
+      continue;
+
+    if (!exact_nodes.get(id))
+      continue;
+
+    const char *config_hostname= nodes_info[i].host.c_str();
+    if (!try_alloc(id, config_hostname, type, client_addr, timeout_ms))
     {
-      if (found_matching_type)
-      {
-	if (found_free_node)
-        {
-	  error_string.appfmt("Connection done from wrong host ip %s.",
-			      (client_addr)?
-                              inet_ntoa(((struct sockaddr_in *)
-					 (client_addr))->sin_addr):"");
-          error_code = NDB_MGM_ALLOCID_ERROR;
-        }
-	else
-        {
-	  error_string.appfmt("No free node id found for %s.",
-			      type_string.c_str());
-          error_code = NDB_MGM_ALLOCID_ERROR;
-        }
-      }
-      else
-      {
-	error_string.appfmt("No %s node defined in config file.",
-			    type_string.c_str());
-        error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-      }
+      // success
+      *nodeId= id;
+      DBUG_RETURN(true);
     }
-    else
+  }
+
+  /* now try the open nodes */
+  for (Uint32 i = 0; i < nodes_info.size(); i++)
+  {
+    unsigned id= nodes_info[i].id;
+    if (!nodes.get(id))
+      continue;
+
+    /**
+     * exact node tried in loop above
+     */
+    if (exact_nodes.get(id))
+      continue;
+
+    if (!try_alloc(id, NULL, type, client_addr, timeout_ms))
     {
-      error_string.append("No nodes defined in config file.");
-      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
+      // success
+      *nodeId= id;
+      DBUG_RETURN(true);
     }
   }
+
+  /*
+    there are nodes with correct type available but
+    allocation failed for some reason
+  */
+  if (*nodeId)
+  {
+    error_string.appfmt("Id %d already allocated by another node.",
+                        *nodeId);
+  }
   else
   {
-    if (found_matching_id)
-    {
-      if (found_matching_type)
-      {
-	if (found_free_node)
-        {
-	  // have to split these into two since inet_ntoa overwrites itself
-	  error_string.appfmt("Connection with id %d done from wrong host ip %s,",
-			      *nodeId, inet_ntoa(((struct sockaddr_in *)
-						  (client_addr))->sin_addr));
-	  error_string.appfmt(" expected %s(%s).", config_hostname,
-			      r_config_addr ?
-			      "lookup failed" : inet_ntoa(config_addr));
-          error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-	}
-        else
-        {
-	  error_string.appfmt("Id %d already allocated by another node.",
-			      *nodeId);
-          error_code = NDB_MGM_ALLOCID_ERROR;
-        }
-      }
-      else
-      {
-	error_string.appfmt("Id %d configured as %s, connect attempted as %s.",
-			    *nodeId, type_c_string.c_str(),
-			    type_string.c_str());
-        error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-      }
-    }
-    else
-    {
-      error_string.appfmt("No node defined with id=%d in config file.",
-			  *nodeId);
-      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-    }
+    const char *alias, *str;
+    alias= ndb_mgm_get_node_type_alias_string(type, &str);
+    error_string.appfmt("No free node id found for %s(%s).",
+                        alias, str);
+  }
+  error_code = NDB_MGM_ALLOCID_ERROR;
+
+ error:
+  if (error_code != NDB_MGM_ALLOCID_CONFIG_MISMATCH)
+  {
+    // we have a temporary error which might be due to that
+    // we have got the latest connect status from db-nodes.  Force update.
+    updateStatus();
   }
 
   if (log_event || error_code == NDB_MGM_ALLOCID_CONFIG_MISMATCH)
@@ -3121,27 +3167,35 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
 			   : "<none>",
 			   error_string.c_str());
 
-    NodeBitmask connected_nodes2;
-    get_connected_nodes(connected_nodes2);
     BaseString tmp_connected, tmp_not_connected;
     for(Uint32 i = 0; i < MAX_NODES; i++)
     {
-      if (connected_nodes2.get(i))
+      if (connected_nodes.get(i))
       {
-	if (!m_reserved_nodes.get(i))
-	  tmp_connected.appfmt(" %d", i);
+        if (!m_reserved_nodes.get(i))
+        {
+          tmp_connected.appfmt("%d ", i);
+        }
       }
       else if (m_reserved_nodes.get(i))
       {
-	tmp_not_connected.appfmt(" %d", i);
+        tmp_not_connected.appfmt("%d ", i);
       }
     }
+
     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 %sconnected 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 %snot connected but reserved",
+         tmp_not_connected.c_str());
+    }
   }
   DBUG_RETURN(false);
 }
@@ -3945,9 +3999,9 @@ MgmtSrvr::change_config(Config& new_conf
     return false;
   }
 
-  if (ss.sendSignal(nodeId, ssig,
-                    MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
-                    ConfigChangeReq::SignalLength) != SEND_OK)
+  if (ss.sendFragmentedSignal(nodeId, ssig,
+                              MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
+                              ConfigChangeReq::SignalLength) != 0)
   {
     msg.assfmt("Could not start configuration change, send to "
                "node %d failed", nodeId);
@@ -3980,9 +4034,9 @@ MgmtSrvr::change_config(Config& new_conf
           return false;
         }
 
-        if (ss.sendSignal(nodeId, ssig,
-                          MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
-                          ConfigChangeReq::SignalLength) != SEND_OK)
+        if (ss.sendFragmentedSignal(nodeId, ssig,
+                                    MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
+                                    ConfigChangeReq::SignalLength) != 0)
         {
           msg.assfmt("Could not start configuration change, send to "
                      "node %d failed", nodeId);
@@ -4005,6 +4059,19 @@ MgmtSrvr::change_config(Config& new_conf
       // Ignore;
       break;
 
+
+    case GSN_NODE_FAILREP:
+      // ignore, NF_COMPLETEREP will come
+      break;
+
+    case GSN_NF_COMPLETEREP:
+    {
+      NodeId nodeId = refToNode(signal->header.theSendersBlockRef);
+      msg.assign("Node %d failed uring configuration change", nodeId);
+      return false;
+      break;
+    }
+
     default:
       report_unknown_signal(signal);
       return false;
@@ -4104,7 +4171,6 @@ MgmtSrvr::reload_config(const char* conf
   return true;
 }
 
-
 void
 MgmtSrvr::show_variables(NdbOut& out)
 {
@@ -4130,11 +4196,9 @@ MgmtSrvr::show_variables(NdbOut& out)
   out << "master_node: " << m_master_node << endl;
 }
 
-
 template class MutexVector<NodeId>;
 template class MutexVector<Ndb_mgmd_event_service::Event_listener>;
 template class Vector<EventSubscribeReq>;
 template class MutexVector<EventSubscribeReq>;
-
 template class Vector< Vector<BaseString> >;
-
+template class Vector<MgmtSrvr::nodeid_and_host>;

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2009-01-08 15:41:27 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2009-02-26 14:52:41 +0000
@@ -26,6 +26,7 @@
 #include <EventLogger.hpp>
 
 #include <SignalSender.hpp>
+#include <my_daemon.h>
 
 #define MGM_ERROR_MAX_INJECT_SESSION_ONLY 10000
 
@@ -131,6 +132,7 @@ public:
     int print_full_config;
     const char* configdir;
     int verbose;
+    MY_DAEMON_VARS0;
     MgmtOpts() : configdir(MYSQLCLUSTERDIR) {};
     int reload;
     int initial;
@@ -359,9 +361,11 @@ public:
    */
   bool getNextNodeId(NodeId * _nodeId, enum ndb_mgm_node_type type) const ;
   bool alloc_node_id(NodeId * _nodeId, enum ndb_mgm_node_type type,
-		     struct sockaddr *client_addr,
+		     const struct sockaddr *client_addr,
+                     SOCKET_SIZE_TYPE *client_addr_len,
 		     int &error_code, BaseString &error_string,
-                     int log_event = 1);
+                     int log_event = 1,
+		     int timeout_s = 20);
 
   bool change_config(Config& new_config, BaseString& msg);
 
@@ -452,7 +456,9 @@ private:
    */
   int getBlockNumber(const BaseString &blockName);
 
-  int alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type);
+  int alloc_node_id_req(NodeId free_node_id,
+                        enum ndb_mgm_node_type type,
+                        Uint32 timeout_ms);
 
   int check_nodes_starting();
   int check_nodes_stopping();
@@ -547,7 +553,6 @@ private:
   struct NdbThread* _logLevelThread;
   static void *logLevelThread_C(void *);
   void logLevelThreadRun();
-
   void report_unknown_signal(SimpleSignal *signal);
 
 
@@ -567,7 +572,20 @@ public:
 
   void show_variables(NdbOut& out = ndbout);
 
+  struct nodeid_and_host
+  {
+    unsigned id;
+    BaseString host;
+  };
+  int find_node_type(unsigned node_id, enum ndb_mgm_node_type type,
+                     const struct sockaddr *client_addr,
+                     NodeBitmask &nodes,
+                     NodeBitmask &exact_nodes,
+                     Vector<nodeid_and_host> &nodes_info,
+                     int &error_code, BaseString &error_string);
+  int match_hostname(const struct sockaddr *, const char *) const;
+  int try_alloc(unsigned id,  const char *, enum ndb_mgm_node_type type,
+                const struct sockaddr *client_addr, Uint32 timeout_ms);
 };
 
-
 #endif // MgmtSrvr_H

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2009-03-12 11:06:48 +0000
@@ -524,9 +524,10 @@ MgmApiSession::get_nodeid(Parser_t::Cont
     NDB_TICKS tick= 0;
     /* only report error on second attempt as not to clog the cluster log */
     while (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, 
-                                   (struct sockaddr*)&addr,
+                                   (struct sockaddr*)&addr, &addrlen,
                                    error_code, error_string,
-                                   tick == 0 ? 0 : log_event))
+                                   tick == 0 ? 0 : log_event,
+                                   timeout))
     {
       /* NDB_MGM_ALLOCID_CONFIG_MISMATCH is a non retriable error */
       if (tick == 0 && error_code != NDB_MGM_ALLOCID_CONFIG_MISMATCH)

=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp	2009-01-07 09:55:03 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp	2009-02-24 11:28:08 +0000
@@ -1,3 +1,4 @@
+
 /* Copyright (C) 2003-2008 MySQL AB, 2008 Sun Microsystems, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -22,7 +23,7 @@
 
 #include <version.h>
 #include <kernel_types.h>
-#include <NdbDaemon.h>
+#include <my_daemon.h>
 #include <NdbConfig.h>
 #include <NdbSleep.h>
 #include <ndb_version.h>
@@ -85,6 +86,7 @@ static MgmtSrvr::MgmtOpts opts;
 static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_mgmd"),
+  MY_DAEMON_LONG_OPTS(opts.)
   { "config-file", 'f', "Specify cluster configuration file",
     (uchar**) &opts.config_filename, (uchar**) &opts.config_filename, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -145,8 +147,16 @@ static void usage()
 
 static char **defaults_argv;
 
-static void
-mgmd_exit(int result)
+/*
+   mgmd_exit()
+   do_exit=true:
+     if in a windows service, don't want process to exit()
+     until cleanup of other threads is done
+*/
+#ifdef _WIN32
+extern HANDLE  g_shutdown_evt;
+#endif
+static void mgmd_exit(int result)
 {
   g_eventLogger->close();
 
@@ -155,13 +165,30 @@ mgmd_exit(int result)
 
   ndb_end(opt_ndb_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
 
+#ifdef _WIN32
+  if(opts.service)
+    SetEvent(g_shutdown_evt); // release stopper thread
+  else
+    exit(result);
+#else
   exit(result);
+#endif
 }
 
+int null_printf(const char*s,...)
+{
+  return 0;
+}
+#define DBG IF_WIN(g_eventLogger->debug,null_printf)
 
+int event_loop(void*);
+int start();
+int argc_;char**argv_;
 int main(int argc, char** argv)
 {
   NDB_INIT(argv[0]);
+  argc_= argc;
+  argv_= argv;
 
   g_eventLogger->setCategory("MgmSrvr");
 
@@ -172,18 +199,41 @@ int main(int argc, char** argv)
 
   int ho_error;
 #ifndef DBUG_OFF
-  opt_debug= "d:t:i:F:o,/tmp/ndb_mgmd.trace";
+  opt_debug= IF_WIN("d:t:i:F:o,c:\\ndb_mgmd.trace",
+                    "d:t:i:F:o,/tmp/ndb_mgmd.trace");
 #endif
-  if ((ho_error=handle_options(&argc, &argv, my_long_options, 
-			       ndb_std_get_one_option)))
+  if ((ho_error=handle_options(&argc, &argv, my_long_options,
+                               ndb_std_get_one_option)))
     mgmd_exit(ho_error);
 
   if (opts.interactive ||
       opts.non_interactive ||
-      opts.print_full_config) {
+      opts.print_full_config ||
+      IF_WIN(1,0)) {
     opts.daemon= 0;
   }
 
+#ifdef _WIN32
+  int r=maybe_install_or_remove_service(argc_,argv_,
+                                 (char*)opts.remove,(char*)opts.install,
+                                       "MySQL Cluster Management Server");
+  if(r!=-1)
+    return r;
+#ifdef _DEBUG
+  /* it is impossible to attach a debugger to a starting service
+  ** so it is necessary to log to a known place to diagnose
+  ** problems.  services don't have a stdout/stderr so the only
+  ** way to write debug info is to a file.
+  ** change this path if you don't have a c:\
+  */
+  if(opts.service) {
+    char *fn= "c:\\ndb_mgmd_debug.log";
+    g_eventLogger->createFileHandler(fn);
+    DBG(NdbConfig_StdoutFileName(0));
+    DBG(NdbConfig_get_path(0));
+  } else
+#endif
+#endif
   /* Output to console initially */
   g_eventLogger->createConsoleHandler();
 
@@ -203,13 +253,22 @@ int main(int argc, char** argv)
 #if !defined NDB_WIN32
   signal(SIGPIPE, SIG_IGN);
 #endif
+  return start();
+}
 
-start:
+int daemon_stop()
+{
+  g_StopServer= true;
+  return 0;
+}
 
+int start()
+{
   g_eventLogger->info("NDB Cluster Management Server. %s", NDB_VERSION_STRING);
 
   mgm= new MgmtSrvr(opts, opt_connect_str);
   if (mgm == NULL) {
+    DBG("mgm is NULL");
     g_eventLogger->critical("Out of memory, couldn't create MgmtSrvr");
     mgmd_exit(1);
   }
@@ -221,30 +280,43 @@ start:
   }
 
   my_setwd(NdbConfig_get_path(0), MYF(0));
-
-  if (opts.daemon) {
-
+#ifdef _WIN32
+  DBG("cl %s",GetCommandLine());
+#endif
+  if (IF_WIN(opts.service,opts.daemon)) {
+    DBG("service name %s",IF_WIN(opts.service,""));
     NodeId localNodeId= mgm->getOwnNodeId();
     if (localNodeId == 0) {
       g_eventLogger->error("Couldn't get own node id");
       delete mgm;
       mgmd_exit(1);
     }
-
-    // Become a daemon
+    struct MY_DAEMON thedaemon= {event_loop,daemon_stop};
     char *lockfile= NdbConfig_PidFileName(localNodeId);
     char *logfile=  NdbConfig_StdoutFileName(localNodeId);
-    NdbAutoPtr<char> tmp_aptr1(lockfile), tmp_aptr2(logfile);
-
-    if (NdbDaemon_Make(lockfile, logfile, 0) == -1) {
-      g_eventLogger->error("Cannot become daemon: %s", NdbDaemon_ErrorText);
-      delete mgm;
+    DBG("to open %s,%s", lockfile, logfile);
+    if (my_daemon_prefiles(lockfile, logfile)) {
+      g_eventLogger->error("daemon_prefiles %s", my_daemon_error);
+      mgmd_exit(1);
+    }
+    if(my_daemon_files()) {
+      g_eventLogger->error("daemon_files %s", my_daemon_error);
       mgmd_exit(1);
     }
+    return my_daemon_run((char*)IF_WIN(opts.service,0),&thedaemon);
   }
+#ifdef _WIN32
+  if(opts.daemon) {
+    g_eventLogger->error("no daemon mode on windows, use -i to set up a service.");
+    mgmd_exit(1);
+  }
+#endif
+  return event_loop(0);
+}
 
-  /* Start mgm services */
-  if (!mgm->start()) {
+int event_loop(void*)
+{
+  if (!mgm->start()) { /* Start mgm services */
     delete mgm;
     mgmd_exit(1);
   }
@@ -260,8 +332,9 @@ start:
     while(g_StopServer != true && read_and_execute(&com, "ndb_mgm> ", 1));
   }
   else {
-    while(g_StopServer != true)
+    while(g_StopServer != true) {
       NdbSleep_MilliSleep(500);
+    }
   }
 
   g_eventLogger->info("Shutting down server...");
@@ -271,9 +344,12 @@ start:
   if(g_RestartServer){
     g_eventLogger->info("Restarting server...");
     g_RestartServer= g_StopServer= false;
-    goto start;
+    int ex= start();
+    if(ex)
+      mgmd_exit(ex);
   }
 
   mgmd_exit(0);
+  return 0;
 }
 

=== modified file 'storage/ndb/src/mgmsrv/testConfig.cpp'
--- a/storage/ndb/src/mgmsrv/testConfig.cpp	2008-09-16 09:37:22 +0000
+++ b/storage/ndb/src/mgmsrv/testConfig.cpp	2009-01-23 12:50:40 +0000
@@ -67,11 +67,10 @@ check_param(const ConfigInfo::ParamInfo 
 
   // Run the config file through InitConfigFileParser
   // throw away the error messages for now.
-  FILE* err_file= tmpfile();
-  InitConfigFileParser parser(err_file);
+
+  InitConfigFileParser parser;
   Config* conf = parser.parseConfig(config_file);
   fclose(config_file);
-  fclose(err_file);
 
   if (conf == NULL)
     return false;

=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp	2009-03-12 09:54:58 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp	2009-03-12 11:06:48 +0000
@@ -300,11 +300,12 @@ Ndb::waitUntilReady(int timeout)
 }
 
 /*****************************************************************************
-NdbTransaction* startTransaction();
+NdbTransaction* computeHash()
 
-Return Value:   Returns a pointer to a connection object.
-                Return NULL otherwise.
-Remark:         Start transaction. Synchronous.
+Return Value:   Returns 0 for success, NDBAPI error code otherwise
+Remark:         Computes the distribution hash value for a row with the
+                supplied distribtion key values.
+                Only relevant for natively partitioned tables.
 *****************************************************************************/ 
 int
 Ndb::computeHash(Uint32 *retval,
@@ -321,6 +322,15 @@ Ndb::computeHash(Uint32 *retval,
 
   Uint32 colcnt = impl->m_columns.size();
   Uint32 parts = impl->m_noOfDistributionKeys;
+
+  if (unlikely(impl->m_fragmentType == NdbDictionary::Object::UserDefined))
+  {
+    /* Calculating native hash on keys in user defined 
+     * partitioned table is probably part of a bug
+     */
+    goto euserdeftable;
+  }
+
   if (parts == 0)
   {
     parts = impl->m_noOfKeys;
@@ -378,6 +388,8 @@ Ndb::computeHash(Uint32 *retval,
   
   if (buf)
   {
+    /* Get 64-bit aligned ptr required for hashing */
+    assert(bufLen != 0);
     UintPtr org = UintPtr(buf);
     UintPtr use = (org + 7) & ~(UintPtr)7;
 
@@ -456,6 +468,9 @@ Ndb::computeHash(Uint32 *retval,
   
   return 0;
   
+euserdeftable:
+  return 4544;
+  
 enullptr:
   return 4316;
   
@@ -488,17 +503,42 @@ Ndb::computeHash(Uint32 *retval,
                  void* buf, Uint32 bufLen)
 {
   Uint32 len;
-  char* pos = (char*)buf;
+  char* pos = NULL;
 
   Uint32 parts = keyRec->distkey_index_length;
 
+  if (unlikely(keyRec->flags & NdbRecord::RecHasUserDefinedPartitioning))
   {
+    /* Calculating native hash on keys in user defined 
+     * partitioned table is probably part of a bug
+     */
+    goto euserdeftable;
+  }
+
+  if (buf)
+  {
+    /* Get 64-bit aligned address as required for hashing */
+    assert(bufLen != 0);
     UintPtr org = UintPtr(buf);
     UintPtr use = (org + 7) & ~(UintPtr)7;
 
     buf = (void*)use;
     bufLen -= Uint32(use - org);
   }
+  else
+  {
+    /* We malloc buf here.  Don't have a handy 'Max distr key size'
+     * variable, so let's use the key length, which must include
+     * the Distr key.
+     */
+    buf= malloc(keyRec->m_keyLenInWords << 2);
+    if (unlikely(buf == 0))
+      goto enomem;
+    bufLen= 0; /* So we remember to deallocate */
+    assert((UintPtr(buf) & 7) == 0);
+  }
+  
+  pos= (char*) buf;
 
   for (Uint32 i = 0; i < parts; i++)
   {
@@ -590,8 +630,17 @@ Ndb::computeHash(Uint32 *retval,
     free(buf);
 
   return 0;
+
+euserdeftable:
+  return 4544;
+
+enomem:
+  return 4000;
   
-emalformedstring:  
+emalformedstring:
+  if (bufLen == 0)
+    free(buf);
+
   return 4279;
 }
 
@@ -1537,10 +1586,20 @@ Ndb::opTupleIdOnNdb(const NdbTableImpl* 
   if (initAutoIncrement() == -1)
     goto error_handler;
 
+/*
+  Fix for
+  Bug #39268 No transaction hints used to update SYSTAB_0 for autoincrement and PK-less table
+  causes crash in 6.4
+ */
+#if 0
   // Start transaction with table id as hint
   tConnection = this->startTransaction(table,
                                        (const char *) &aTableId,
                                        sizeof(Uint32));
+#else
+  tConnection = this->startTransaction();
+#endif
+
   if (tConnection == NULL)
     goto error_handler;
 
@@ -1737,6 +1796,20 @@ int Ndb::setDatabaseAndSchemaName(const 
         setDatabaseName(buf);
         sprintf(buf, "%.*s", (int) (s2 - (s1 + 1)), s1 + 1);
         setDatabaseSchemaName(buf);
+#ifdef VM_TRACE
+        // verify that m_prefix looks like abc/def/
+        const char* s0 = theImpl->m_prefix.c_str();
+        const char* s1 = s0 ? strchr(s0, table_name_separator) : 0;
+        const char* s2 = s1 ? strchr(s1 + 1, table_name_separator) : 0;
+        if (!(s1 && s1 != s0 && s2 && s2 != s1 + 1 && *(s2 + 1) == 0))
+        {
+          ndbout_c("t->m_impl.m_internalName.c_str(): %s", t->m_impl.m_internalName.c_str());
+          ndbout_c("s0: %s", s0);
+          ndbout_c("s1: %s", s1);
+          ndbout_c("s2: %s", s2);
+          assert(s1 && s1 != s0 && s2 && s2 != s1 + 1 && *(s2 + 1) == 0);
+        }
+#endif
         return 0;
       }
     }
@@ -1813,7 +1886,13 @@ Ndb::internalize_table_name(const char *
     const char* s0 = theImpl->m_prefix.c_str();
     const char* s1 = s0 ? strchr(s0, table_name_separator) : 0;
     const char* s2 = s1 ? strchr(s1 + 1, table_name_separator) : 0;
-    assert(s1 && s1 != s0 && s2 && s2 != s1 + 1 && *(s2 + 1) == 0);
+    if (!(s1 && s1 != s0 && s2 && s2 != s1 + 1 && *(s2 + 1) == 0))
+    {
+      ndbout_c("s0: %s", s0);
+      ndbout_c("s1: %s", s1);
+      ndbout_c("s2: %s", s2);
+      assert(s1 && s1 != s0 && s2 && s2 != s1 + 1 && *(s2 + 1) == 0);
+    }
 #endif
     ret.assfmt("%s%s",
                theImpl->m_prefix.c_str(),

=== modified file 'storage/ndb/src/ndbapi/NdbBlob.cpp'
--- a/storage/ndb/src/ndbapi/NdbBlob.cpp	2009-02-11 11:06:33 +0000
+++ b/storage/ndb/src/ndbapi/NdbBlob.cpp	2009-03-12 11:06:48 +0000
@@ -97,8 +97,6 @@ NdbBlob::getBlobTable(NdbTableImpl& bt, 
   bt.setLogging(t->getLogging());
   /*
     BLOB tables use the same fragmentation as the original table
-    but may change the fragment type if it is UserDefined since it
-    must be hash based so that the kernel can handle it on its own.
     It also uses the same tablespaces and it never uses any range or
     list arrays.
   */
@@ -108,27 +106,8 @@ NdbBlob::getBlobTable(NdbTableImpl& bt, 
   bt.setFragmentCount(t->getFragmentCount());
   bt.m_tablespace_id = t->m_tablespace_id;
   bt.m_tablespace_version = t->m_tablespace_version;
-  switch (t->getFragmentType())
-  {
-    case NdbDictionary::Object::FragAllSmall:
-    case NdbDictionary::Object::FragAllMedium:
-    case NdbDictionary::Object::FragAllLarge:
-    case NdbDictionary::Object::FragSingle:
-      bt.setFragmentType(t->getFragmentType());
-      break;
-    case NdbDictionary::Object::DistrKeyLin:
-    case NdbDictionary::Object::DistrKeyHash:
-    case NdbDictionary::Object::HashMapPartition:
-      bt.setFragmentType(t->getFragmentType());
-      break;
-    case NdbDictionary::Object::UserDefined:
-      bt.setFragmentType(NdbDictionary::Object::DistrKeyHash);
-      break;
-    default:
-      DBUG_ASSERT(0);
-      DBUG_RETURN(-1);
-      break;
-  }
+  bt.setFragmentType(t->getFragmentType());
+
   DBUG_PRINT("info", ("Define BLOB table V%d with"
                       " primary table = %u and Fragment Type = %u",
                       blobVersion,
@@ -363,6 +342,7 @@ NdbBlob::init()
   theHeadInlineRecAttr = NULL;
   theHeadInlineReadOp = NULL;
   theHeadInlineUpdateFlag = false;
+  userDefinedPartitioning = false;
   thePartitionId = noPartitionId();
   thePartitionIdRecAttr = NULL;
   theNullFlag = -1;
@@ -547,6 +527,37 @@ NdbBlob::getDistKey(Uint32 part)
   return dist;
 }
 
+inline void
+NdbBlob::setHeadPartitionId(NdbOperation* anOp)
+{
+  /* For UserDefined partitioned tables,
+   * we must set the head row's partition id
+   * manually when reading/modifying it with
+   * primary key or unique key.
+   * For scans we do not have to.
+   */
+  if (userDefinedPartitioning &&
+      (thePartitionId != noPartitionId())) {
+    anOp->setPartitionId(thePartitionId);
+  }
+}
+
+inline void
+NdbBlob::setPartPartitionId(NdbOperation* anOp)
+{
+  /* For UserDefined partitioned tables
+   * we must set the part row's partition 
+   * id manually when performing operations.
+   * This means that stripe size is ignored
+   * for UserDefined partitioned tables.
+   * All part row operations use primary keys
+   */
+  if (userDefinedPartitioning) {
+    assert(thePartitionId != noPartitionId());
+    anOp->setPartitionId(thePartitionId);
+  }
+}
+
 // pack/unpack table/index key  XXX support routines, shortcuts
 
 int
@@ -938,6 +949,7 @@ NdbBlob::setPartKeyValue(NdbOperation* a
       DBUG_RETURN(-1);
     }
   }
+  setPartPartitionId(anOp);
   DBUG_RETURN(0);
 }
 
@@ -1013,14 +1025,26 @@ NdbBlob::getHeadInlineValue(NdbOperation
    * specific checks
    */
   theHeadInlineRecAttr = anOp->getValue_impl(theColumn, theHeadInlineBuf.data);
-  thePartitionIdRecAttr = 
-    anOp->getValue_impl(&NdbColumnImpl::getImpl(*NdbDictionary::Column::FRAGMENT));
-  
-  if (theHeadInlineRecAttr == NULL ||
-      thePartitionIdRecAttr == NULL) {
+  if (theHeadInlineRecAttr == NULL) {
     setErrorCode(anOp);
     DBUG_RETURN(-1);
   }
+  if (userDefinedPartitioning)
+  {
+    /* For UserDefined partitioned tables, we ask for the partition
+     * id of the main table row to use for the parts
+     * Not technically needed for main table access via PK, which must
+     * have partition id set for access, but we do it anyway and check
+     * it's as expected.
+     */
+    thePartitionIdRecAttr = 
+      anOp->getValue_impl(&NdbColumnImpl::getImpl(*NdbDictionary::Column::FRAGMENT));
+    
+    if (thePartitionIdRecAttr == NULL) {
+      setErrorCode(anOp);
+      DBUG_RETURN(-1);
+    }
+  }
   /*
    * If we get no data from this op then the operation is aborted
    * one way or other.  Following hack in 5.0 makes sure we don't read
@@ -1042,20 +1066,30 @@ NdbBlob::getHeadFromRecAttr()
   if (theNullFlag == 0) {
     unpackBlobHead();
     theLength = theHead.length;
-    if (theEventBlobVersion == -1) {
+  } else {
+    theLength = 0;
+  }
+  if (theEventBlobVersion == -1) {
+    if (userDefinedPartitioning)
+    {
+      /* Use main table fragment id as partition id
+       * for blob parts table
+       */
       Uint32 id = thePartitionIdRecAttr->u_32_value();
       DBUG_PRINT("info", ("table partition id: %u", id));
       if (thePartitionId == noPartitionId()) {
         DBUG_PRINT("info", ("discovered here"));
-        // setting even in non-partitioned case
         thePartitionId = id;
       } else {
         assert(thePartitionId == id);
       }
     }
-  } else {
-    theLength = 0;
+    else
+    {
+      assert(thePartitionIdRecAttr == NULL);
+    }
   }
+
   DBUG_PRINT("info", ("theNullFlag=%d theLength=%llu",
                       theNullFlag, theLength));
   DBUG_VOID_RETURN;
@@ -1680,10 +1714,7 @@ NdbBlob::readTablePart(char* buf, Uint32
     setErrorCode(tOp);
     DBUG_RETURN(-1);
   }
-  if (thePartitionId != noPartitionId() &&
-      theStripeSize == 0) {
-    tOp->setPartitionId(thePartitionId);
-  }
+
   tOp->m_abortOption = NdbOperation::AbortOnError;
   thePendingBlobOps |= (1 << NdbOperation::ReadRequest);
   theNdbCon->thePendingBlobOps |= (1 << NdbOperation::ReadRequest);
@@ -1743,10 +1774,7 @@ NdbBlob::insertPart(const char* buf, Uin
     setErrorCode(tOp);
     DBUG_RETURN(-1);
   }
-  if (thePartitionId != noPartitionId() &&
-      theStripeSize == 0) {
-    tOp->setPartitionId(thePartitionId);
-  }
+
   tOp->m_abortOption = NdbOperation::AbortOnError;
   thePendingBlobOps |= (1 << NdbOperation::InsertRequest);
   theNdbCon->thePendingBlobOps |= (1 << NdbOperation::InsertRequest);
@@ -1783,10 +1811,7 @@ NdbBlob::updatePart(const char* buf, Uin
     setErrorCode(tOp);
     DBUG_RETURN(-1);
   }
-  if (thePartitionId != noPartitionId() &&
-      theStripeSize == 0) {
-    tOp->setPartitionId(thePartitionId);
-  }
+
   tOp->m_abortOption = NdbOperation::AbortOnError;
   thePendingBlobOps |= (1 << NdbOperation::UpdateRequest);
   theNdbCon->thePendingBlobOps |= (1 << NdbOperation::UpdateRequest);
@@ -1807,10 +1832,7 @@ NdbBlob::deleteParts(Uint32 part, Uint32
       setErrorCode(tOp);
       DBUG_RETURN(-1);
     }
-    if (thePartitionId != noPartitionId() &&
-        theStripeSize == 0) {
-      tOp->setPartitionId(thePartitionId);
-    }
+
     tOp->m_abortOption = NdbOperation::AbortOnError;
     n++;
     thePendingBlobOps |= (1 << NdbOperation::DeleteRequest);
@@ -1847,10 +1869,6 @@ NdbBlob::deletePartsUnknown(Uint32 part)
         setErrorCode(tOp);
         DBUG_RETURN(-1);
       }
-      if (thePartitionId != noPartitionId() &&
-          theStripeSize == 0) {
-        tOp->setPartitionId(thePartitionId);
-      }
       tOp->m_abortOption= NdbOperation::AO_IgnoreError;
       tOp->m_noErrorPropagation = true;
       n++;
@@ -2010,8 +2028,14 @@ NdbBlob::atPrepareCommon(NdbTransaction*
   // prepare blob column and table
   if (prepareColumn() == -1)
     return -1;
-  // check if mysql or user has set partition id
-  if (theNdbOp->theDistrKeyIndicator_) {
+  userDefinedPartitioning= (theTable->getFragmentType() == 
+                            NdbDictionary::Object::UserDefined);
+  /* UserDefined Partitioning
+   * If user has set partitionId specifically, take it for
+   * Blob head and part operations
+   */
+  if (userDefinedPartitioning && 
+      theNdbOp->theDistrKeyIndicator_) {
     thePartitionId = theNdbOp->getPartitionId();
     DBUG_PRINT("info", ("op partition id: %u", thePartitionId));
   }
@@ -2461,9 +2485,8 @@ NdbBlob::preExecute(NdbTransaction::Exec
           setErrorCode(NdbBlobImpl::ErrAbort);
           DBUG_RETURN(-1);
         }
-        if (thePartitionId != noPartitionId()) {
-          tOp->setPartitionId(thePartitionId);
-        }
+        setHeadPartitionId(tOp);
+
         DBUG_PRINT("info", ("Insert : added op to update head+inline in preExecute"));
       }
     }
@@ -2504,9 +2527,8 @@ NdbBlob::preExecute(NdbTransaction::Exec
         setErrorCode(tOp);
         DBUG_RETURN(-1);
       }
-      if (thePartitionId != noPartitionId()) {
-        tOp->setPartitionId(thePartitionId);
-      }
+      setHeadPartitionId(tOp);
+
       if (isWriteOp()) {
         /* There may be no data currently, so ignore tuple not found etc. */
         tOp->m_abortOption = NdbOperation::AO_IgnoreError;
@@ -2536,6 +2558,11 @@ NdbBlob::preExecute(NdbTransaction::Exec
     if (this == tFirstBlob) {
       // first blob does it for all
       if (g_ndb_blob_ok_to_read_index_table) {
+        /* Cannot work for userDefinedPartitioning + write() op as
+         * we need to read the 'main' partition Id
+         * Maybe this branch should be removed?
+         */
+        assert(!userDefinedPartitioning);
         Uint32 pkAttrId = theAccessTable->getNoOfColumns() - 1;
         NdbOperation* tOp = theNdbCon->getNdbOperation(theAccessTable, theNdbOp);
         if (tOp == NULL ||
@@ -2554,6 +2581,20 @@ NdbBlob::preExecute(NdbTransaction::Exec
           setErrorCode(tOp);
           DBUG_RETURN(-1);
         }
+        if (userDefinedPartitioning && isWriteOp())
+        {
+          /* Index Write op does not perform head read before deleting parts
+           * as it cannot safely IgnoreErrors.
+           * To get partitioning right we read partition id for main row
+           * here.
+           */
+          thePartitionIdRecAttr = tOp->getValue_impl(&NdbColumnImpl::getImpl(*NdbDictionary::Column::FRAGMENT));
+          
+          if (thePartitionIdRecAttr == NULL) {
+            setErrorCode(tOp);
+            DBUG_RETURN(-1);
+          }
+        } 
       }
       DBUG_PRINT("info", ("Index op : added op before to read table key"));
     }
@@ -2622,9 +2663,8 @@ NdbBlob::preExecute(NdbTransaction::Exec
             setErrorCode(NdbBlobImpl::ErrAbort);
             DBUG_RETURN(-1);
           }
-          if (thePartitionId != noPartitionId()) {
-            tOp->setPartitionId(thePartitionId);
-          }
+          setHeadPartitionId(tOp);
+
           DBUG_PRINT("info", ("NdbRecord table write : added op to update head+inline"));
         }
       }
@@ -2756,9 +2796,8 @@ NdbBlob::postExecute(NdbTransaction::Exe
             setErrorCode(NdbBlobImpl::ErrAbort);
             DBUG_RETURN(-1);
           }
-          if (thePartitionId != noPartitionId()) {
-            tOp->setPartitionId(thePartitionId);
-          }
+          setHeadPartitionId(tOp);
+
           DBUG_PRINT("info", ("Insert : added op to update head+inline"));
         }
       }
@@ -2823,6 +2862,33 @@ NdbBlob::postExecute(NdbTransaction::Exe
   }
   if (isWriteOp() && isIndexOp()) {
     // XXX until IgnoreError fixed for index op
+    if (userDefinedPartitioning)
+    {
+      /* For Index Write with UserDefined partitioning, we get the
+       * partition id from the main table key read created in 
+       * preExecute().
+       * Extra complexity as only the first Blob does the read, other
+       * Blobs grab result from first.
+       */
+      if (thePartitionIdRecAttr != NULL)
+      {
+        assert( this == theNdbOp->theBlobList );
+        Uint32 id= thePartitionIdRecAttr->u_32_value();
+        assert( id != noPartitionId() );
+        DBUG_PRINT("info", ("Index write, setting partition id to %d", id));
+        thePartitionId= id;
+      }
+      else
+      {
+        /* First Blob (not us) in this op got the partition Id */
+        assert( theNdbOp->theBlobList );
+        assert( this != theNdbOp->theBlobList );
+
+        thePartitionId= theNdbOp->theBlobList->thePartitionId;
+
+        assert(thePartitionId != noPartitionId());
+      }
+    }
     if (deletePartsUnknown(0) == -1)
       DBUG_RETURN(-1);
     if (theSetFlag && theGetSetBytes > theInlineSize) {
@@ -2856,9 +2922,8 @@ NdbBlob::postExecute(NdbTransaction::Exe
       setErrorCode(NdbBlobImpl::ErrAbort);
       DBUG_RETURN(-1);
     }
-    if (thePartitionId != noPartitionId()) {
-      tOp->setPartitionId(thePartitionId);
-    }
+    setHeadPartitionId(tOp);
+
     tOp->m_abortOption = NdbOperation::AbortOnError;
     DBUG_PRINT("info", ("added op to update head+inline"));
   }
@@ -2890,9 +2955,8 @@ NdbBlob::preCommit()
           setErrorCode(NdbBlobImpl::ErrAbort);
           DBUG_RETURN(-1);
         }
-        if (thePartitionId != noPartitionId()) {
-          tOp->setPartitionId(thePartitionId);
-        }
+        setHeadPartitionId(tOp);
+        
         tOp->m_abortOption = NdbOperation::AbortOnError;
         DBUG_PRINT("info", ("added op to update head+inline"));
     }

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2009-03-12 11:06:48 +0000
@@ -506,7 +506,7 @@ NdbTableImpl::init(){
   m_min_rows = 0;
   m_max_rows = 0;
   m_tablespace_name.clear();
-  m_tablespace_id = ~0;
+  m_tablespace_id = RNIL;
   m_tablespace_version = ~0;
   m_single_user_mode = 0;
   m_hash_map_id = RNIL;
@@ -645,11 +645,9 @@ NdbTableImpl::equal(const NdbTableImpl& 
 
   if(m_tablespace_id != obj.m_tablespace_id)
   {
-#if wl3600_todo // diff for no ts, check later
     DBUG_PRINT("info",("m_tablespace_id %d != %d",m_tablespace_id,
                         obj.m_tablespace_id));
     DBUG_RETURN(false);
-#endif
   }
 
   if(m_tablespace_version != obj.m_tablespace_version)
@@ -1709,7 +1707,7 @@ NdbDictionaryImpl::fetchGlobalTableImplR
                                  m_ndb.usingFullyQualifiedNames());
     else
       m_error.code = 4000;
-    if (impl != 0 && (obj.init(*impl)))
+    if (impl != 0 && (obj.init(this, *impl)))
     {
       delete impl;
       impl = 0;
@@ -3189,7 +3187,7 @@ NdbDictInterface::serializeTableDesc(Ndb
 
   const char *tablespace_name= impl.m_tablespace_name.c_str();
 loop:
-  if(impl.m_tablespace_id != ~(Uint32)0)
+  if(impl.m_tablespace_version != ~(Uint32)0)
   {
     tmpTab->TablespaceId = impl.m_tablespace_id;
     tmpTab->TablespaceVersion = impl.m_tablespace_version;
@@ -4358,7 +4356,7 @@ NdbDictionaryImpl::getEvent(const char *
   DBUG_PRINT("info",("table %s", ev->getTableName()));
   if (tab == NULL)
   {
-    tab= fetchGlobalTableImplRef(InitTable(this, ev->getTableName()));
+    tab= fetchGlobalTableImplRef(InitTable(ev->getTableName()));
     if (tab == 0)
     {
       DBUG_PRINT("error",("unable to find table %s", ev->getTableName()));
@@ -4372,7 +4370,7 @@ NdbDictionaryImpl::getEvent(const char *
     {
       DBUG_PRINT("info", ("mismatch on verison in cache"));
       releaseTableGlobal(*tab, 1);
-      tab= fetchGlobalTableImplRef(InitTable(this, ev->getTableName()));
+      tab= fetchGlobalTableImplRef(InitTable(ev->getTableName()));
       if (tab == 0)
       {
         DBUG_PRINT("error",("unable to find table %s", ev->getTableName()));
@@ -5478,7 +5476,7 @@ NdbFilegroupImpl::NdbFilegroupImpl(NdbDi
 {
   m_extent_size = 0;
   m_undo_buffer_size = 0;
-  m_logfile_group_id = ~0;
+  m_logfile_group_id = RNIL;
   m_logfile_group_version = ~0;
 }
 
@@ -5559,7 +5557,7 @@ NdbFileImpl::NdbFileImpl(NdbDictionary::
 {
   m_size = 0;
   m_free = 0;
-  m_filegroup_id = ~0;
+  m_filegroup_id = RNIL;
   m_filegroup_version = ~0;
 }
 
@@ -6949,7 +6947,7 @@ NdbDictInterface::get_filegroup(NdbFileg
 		     DICT_WAITFOR_TIMEOUT, 100);
   if (r)
   {
-    dst.m_id = -1;
+    dst.m_id = RNIL;
     dst.m_version = ~0;
     
     DBUG_PRINT("info", ("get_filegroup failed dictSignal"));

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2009-01-20 11:08:14 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2009-02-25 16:02:30 +0000
@@ -759,15 +759,12 @@ class NdbDictionaryImpl;
 class GlobalCacheInitObject
 {
 public:
-  NdbDictionaryImpl *m_dict;
   const BaseString &m_name;
-  GlobalCacheInitObject(NdbDictionaryImpl *dict,
-                        const BaseString &name) :
-    m_dict(dict),
+  GlobalCacheInitObject(const BaseString &name) :
     m_name(name)
   {}
   virtual ~GlobalCacheInitObject() {}
-  virtual int init(NdbTableImpl &tab) const = 0;
+  virtual int init(NdbDictionaryImpl *dict, NdbTableImpl &tab) const = 0;
 };
 
 class NdbDictionaryImpl : public NdbDictionary::Dictionary {
@@ -1187,15 +1184,14 @@ NdbDictionaryImpl::getImpl(const NdbDict
 class InitTable : public GlobalCacheInitObject
 {
 public:
-  InitTable(NdbDictionaryImpl *dict,
-            const BaseString &name) :
-    GlobalCacheInitObject(dict, name)
+  InitTable(const BaseString &name) :
+    GlobalCacheInitObject(name)
   {}
-  int init(NdbTableImpl &tab) const
+  int init(NdbDictionaryImpl *dict, NdbTableImpl &tab) const
   {
-    int res= m_dict->getBlobTables(tab);
+    int res= dict->getBlobTables(tab);
     if (res == 0)
-      res= m_dict->createDefaultNdbRecord(&tab, NULL);
+      res= dict->createDefaultNdbRecord(&tab, NULL);
     
     return res;
   }
@@ -1206,7 +1202,7 @@ NdbTableImpl *
 NdbDictionaryImpl::getTableGlobal(const char * table_name)
 {
   const BaseString internal_tabname(m_ndb.internalize_table_name(table_name));
-  return fetchGlobalTableImplRef(InitTable(this, internal_tabname));
+  return fetchGlobalTableImplRef(InitTable(internal_tabname));
 }
 
 inline
@@ -1245,7 +1241,7 @@ NdbDictionaryImpl::get_local_table_info(
   if (info == 0)
   {
     NdbTableImpl *tab=
-      fetchGlobalTableImplRef(InitTable(this, internalTableName));
+      fetchGlobalTableImplRef(InitTable(internalTableName));
     if (tab)
     {
       info= Ndb_local_table_info::create(tab, m_local_table_data_size);
@@ -1267,12 +1263,12 @@ public:
   InitIndex(const BaseString &internal_indexname,
 	    const char *index_name,
 	    const NdbTableImpl &prim) :
-    GlobalCacheInitObject(0, internal_indexname),
+    GlobalCacheInitObject(internal_indexname),
     m_index_name(index_name),
     m_prim(prim)
     {}
   
-  int init(NdbTableImpl &tab) const {
+  int init(NdbDictionaryImpl *dict, NdbTableImpl &tab) const {
     DBUG_ENTER("InitIndex::init");
     DBUG_ASSERT(tab.m_indexType != NdbDictionary::Object::TypeUndefined);
     /**
@@ -1288,7 +1284,7 @@ public:
       tab.m_index = idx;
 
       /* Finally, create default NdbRecord for this index */
-      DBUG_RETURN(m_dict->createDefaultNdbRecord(&tab, &m_prim));
+      DBUG_RETURN(dict->createDefaultNdbRecord(&tab, &m_prim));
     }
     DBUG_RETURN(1);
   }

=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2009-01-28 09:55:02 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2009-03-12 11:06:48 +0000
@@ -866,7 +866,7 @@ NdbEventOperationImpl::receive_event()
   DBUG_PRINT_EVENT("info",("sdata->operation %u  this: %p", operation, this));
   // now move the data into the RecAttrs
     
-  int is_update= operation == NdbDictionary::Event::_TE_UPDATE;
+  int is_insert= operation == NdbDictionary::Event::_TE_INSERT;
 
   Uint32 *aAttrPtr = m_data_item->ptr[0].p;
   Uint32 *aAttrEndPtr = aAttrPtr + m_data_item->ptr[0].sz;
@@ -889,7 +889,7 @@ NdbEventOperationImpl::receive_event()
       assert(tAttr->attrId() ==
 	     AttributeHeader(*aAttrPtr).getAttributeId());
       receive_data(tAttr, aDataPtr, tDataSz);
-      if (is_update)
+      if (!is_insert)
 	receive_data(tAttr1, aDataPtr, tDataSz);
       else
         tAttr1->setUNDEFINED(); // do not leave unspecified
@@ -906,7 +906,7 @@ NdbEventOperationImpl::receive_event()
   Uint32 tRecAttrId;
   Uint32 tAttrId;
   Uint32 tDataSz;
-  int hasSomeData=0;
+  int hasSomeData= (operation != NdbDictionary::Event::_TE_UPDATE);
   while ((aAttrPtr < aAttrEndPtr) && (tWorkingRecAttr != NULL)) {
     tRecAttrId = tWorkingRecAttr->attrId();
     tAttrId = AttributeHeader(*aAttrPtr).getAttributeId();
@@ -925,7 +925,7 @@ NdbEventOperationImpl::receive_event()
       break;
     
     if (tAttrId == tRecAttrId) {
-      hasSomeData++;
+      hasSomeData=1;
       
       DBUG_PRINT_EVENT("info",("set [%u] %u 0x%x [%u] 0x%x",
                                tAttrId, tDataSz, *aDataPtr, tRecAttrId, aDataPtr));
@@ -964,7 +964,7 @@ NdbEventOperationImpl::receive_event()
       break;
     if (tAttrId == tRecAttrId) {
       assert(!m_eventImpl->m_tableImpl->getColumn(tRecAttrId)->getPrimaryKey());
-      hasSomeData++;
+      hasSomeData=1;
       
       receive_data(tWorkingRecAttr, aDataPtr, tDataSz);
       tWorkingRecAttr = tWorkingRecAttr->next();
@@ -976,7 +976,7 @@ NdbEventOperationImpl::receive_event()
     tWorkingRecAttr = tWorkingRecAttr->next();
   }
   
-  if (hasSomeData || !is_update)
+  if (hasSomeData)
   {
     DBUG_RETURN_EVENT(1);
   }

=== modified file 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2009-02-11 11:06:33 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2009-03-12 10:59:57 +0000
@@ -1242,6 +1242,14 @@ NdbOperation::handleOperationOptions (co
        * takeover operation 
        */
     }
+    /* Only allowed for pk ops on user defined partitioned tables */
+    if (unlikely( ! ((op->m_attribute_record->flags & 
+                      NdbRecord::RecHasUserDefinedPartitioning) &&
+                     (op->m_key_record->table->m_index == NULL))))
+    {
+      /* Explicit partitioning info not allowed for table and operation*/
+      return 4546;
+    }
     op->theDistributionKey=opts->partitionId;
     op->theDistrKeyIndicator_= 1;       
   }

=== modified file 'storage/ndb/src/ndbapi/NdbOperationSearch.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2009-02-11 11:06:33 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationSearch.cpp	2009-03-12 11:06:48 +0000
@@ -534,6 +534,21 @@ NdbOperation::setPartitionId(Uint32 valu
     return; // TODO : Consider adding int rc for error
   }
 
+  /* We only allow setPartitionId() for :
+   *   PrimaryKey ops on a UserDefined partitioned table
+   *   Ordered index scans
+   *   Table scans
+   *
+   * It is not allowed on :
+   *   Primary key access to Natively partitioned tables
+   *   Any unique key access
+   */
+  assert(((m_type == PrimaryKeyAccess) && 
+          (m_currentTable->getFragmentType() ==
+           NdbDictionary::Object::UserDefined)) ||
+         (m_type == OrderedIndexScan) ||
+         (m_type == TableScan));
+  
   theDistributionKey = value;
   theDistrKeyIndicator_ = 1;
   DBUG_PRINT("info", ("NdbOperation::setPartitionId: %u",

=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2009-02-11 12:41:43 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2009-03-12 11:06:48 +0000
@@ -123,6 +123,7 @@ NdbScanOperation::init(const NdbTableImp
   m_scanUsingOldApi= true;
   m_readTuplesCalled= false;
   m_interpretedCodeOldApi= NULL;
+  m_pruneState= SPS_UNKNOWN;
 
   m_api_receivers_count = 0;
   m_current_api_receiver = 0;
@@ -271,6 +272,23 @@ NdbScanOperation::handleScanOptions(cons
   {
     /* Should not have any blobs defined at this stage */
     assert(theBlobList == NULL);
+    assert(m_pruneState == SPS_UNKNOWN);
+    
+    /* Only allowed to set partition id for PK ops on UserDefined
+     * partitioned tables
+     */
+    if(unlikely(! (m_attribute_record->flags & 
+                   NdbRecord::RecHasUserDefinedPartitioning)))
+    {
+      /* Explicit partitioning info not allowed for table and operation*/
+      setErrorCodeAbort(4546);
+      return -1;
+    }
+
+    m_pruneState= SPS_FIXED;
+    m_pruningKey= options->partitionId;
+    
+    /* And set the vars in the operation now too */
     theDistributionKey = options->partitionId;
     theDistrKeyIndicator_ = 1;
     assert((m_attribute_record->flags & NdbRecord::RecHasUserDefinedPartitioning) != 0);
@@ -311,6 +329,30 @@ NdbScanOperation::handleScanOptions(cons
     m_customData = options->customData;
   }
 
+  /* Preferred form of partitioning information */
+  if (options->optionsPresent & ScanOptions::SO_PART_INFO)
+  {
+    Uint32 partValue;
+    Ndb::PartitionSpec tmpSpec;
+    const Ndb::PartitionSpec* pSpec= options->partitionInfo;
+    if (unlikely(validatePartInfoPtr(pSpec,
+                                     options->sizeOfPartInfo,
+                                     tmpSpec) ||
+                 getPartValueFromInfo(pSpec,
+                                      m_currentTable,
+                                      &partValue)))
+      return -1;
+    
+    assert(m_pruneState == SPS_UNKNOWN);
+    m_pruneState= SPS_FIXED;
+    m_pruningKey= partValue;
+    
+    theDistributionKey= partValue;
+    theDistrKeyIndicator_= 1;
+    DBUG_PRINT("info", ("Set distribution key from partition spec to %u",
+                        partValue));
+  }
+
   return 0;
 }
 
@@ -453,6 +495,50 @@ NdbScanOperation::scanImpl(const NdbScan
   return 0;
 }
 
+int
+NdbScanOperation::handleScanOptionsVersion(const ScanOptions*& optionsPtr, 
+                                           Uint32 sizeOfOptions,
+                                           ScanOptions& currOptions)
+{
+  /* Handle different sized ScanOptions */
+  if (unlikely((sizeOfOptions !=0) &&
+               (sizeOfOptions != sizeof(ScanOptions))))
+  {
+    /* Different size passed, perhaps it's an old client */
+    if (sizeOfOptions == sizeof(ScanOptions_v1))
+    {
+      const ScanOptions_v1* oldOptions= 
+        (const ScanOptions_v1*) optionsPtr;
+
+      /* v1 of ScanOptions, copy into current version
+       * structure and update options ptr
+       */
+      currOptions.optionsPresent= oldOptions->optionsPresent;
+      currOptions.scan_flags= oldOptions->scan_flags;
+      currOptions.parallel= oldOptions->parallel;
+      currOptions.batch= oldOptions->batch;
+      currOptions.extraGetValues= oldOptions->extraGetValues;
+      currOptions.numExtraGetValues= oldOptions->numExtraGetValues;
+      currOptions.partitionId= oldOptions->partitionId;
+      currOptions.interpretedCode= oldOptions->interpretedCode;
+      currOptions.customData= oldOptions->customData;
+      
+      /* New fields */
+      currOptions.partitionInfo= NULL;
+      currOptions.sizeOfPartInfo= 0;
+      
+      optionsPtr= &currOptions;
+    }
+    else
+    {
+      /* No other versions supported currently */
+      setErrorCodeAbort(4298);
+      /* Invalid or unsupported ScanOptions structure */
+      return -1;
+    }
+  }
+  return 0;
+}
 
 int
 NdbScanOperation::scanTableImpl(const NdbRecord *result_record,
@@ -466,21 +552,12 @@ NdbScanOperation::scanTableImpl(const Nd
   Uint32 parallel = 0;
   Uint32 batch = 0;
 
+  ScanOptions currentOptions;
+
   if (options != NULL)
   {
-    /* Check options size for versioning... */
-    if (unlikely((sizeOfOptions !=0) &&
-                 (sizeOfOptions != sizeof(ScanOptions))))
-    {
-      /* Handle different sized ScanOptions
-       * Probably smaller is old version, larger is new version
-       */
-      
-      /* No other versions supported currently */
-      setErrorCodeAbort(4298);
-      /* Invalid or unsupported ScanOptions structure */
+    if (handleScanOptionsVersion(options, sizeOfOptions, currentOptions))
       return -1;
-    }
     
     /* Process some initial ScanOptions - most are 
      * handled later
@@ -514,6 +591,84 @@ NdbScanOperation::scanTableImpl(const Nd
 }
 
 
+int
+NdbScanOperation::getPartValueFromInfo(const Ndb::PartitionSpec* partInfo,
+                                       const NdbTableImpl* table,
+                                       Uint32* partValue)
+{
+  switch(partInfo->type)
+  {
+  case Ndb::PartitionSpec::PS_USER_DEFINED:
+  {
+    assert(table->m_fragmentType == NdbDictionary::Object::UserDefined);
+    *partValue= partInfo->UserDefined.partitionId;
+    return 0;
+  }
+
+  case Ndb::PartitionSpec::PS_DISTR_KEY_PART_PTR:
+  {
+    assert(table->m_fragmentType != NdbDictionary::Object::UserDefined);
+    Uint32 hashVal;
+    int ret= Ndb::computeHash(&hashVal, table, 
+                              partInfo->KeyPartPtr.tableKeyParts,
+                              partInfo->KeyPartPtr.xfrmbuf, 
+                              partInfo->KeyPartPtr.xfrmbuflen);
+    if (ret == 0)
+    {
+      /* We send the hash result here (rather than the partitionId
+       * generated by doing some function on the hash)
+       * Note that KEY and LINEAR KEY native partitioning hash->partitionId
+       * mapping functions are idempotent so that they can be
+       * applied multiple times to their result without changing it.  
+       * DIH will apply them, so there's no need to also do it here in API, 
+       * unless we want to see which physical partition we *think* will 
+       * hold the values.
+       * Only possible advantage is that we could identify some locality
+       * not shown in the hash result.  This is only *safe* for schemes
+       * which cannot change the hash->partitionId mapping function
+       * online.
+       * Can add as an optimisation if necessary.
+       */
+      *partValue= hashVal;
+      return 0;
+    }
+    else
+    {
+      setErrorCodeAbort(ret);
+      return -1;
+    }
+  }
+  
+  case Ndb::PartitionSpec::PS_DISTR_KEY_RECORD:
+  {
+    assert(table->m_fragmentType != NdbDictionary::Object::UserDefined);
+    Uint32 hashVal;
+    int ret= Ndb::computeHash(&hashVal,
+                              partInfo->KeyRecord.keyRecord,
+                              partInfo->KeyRecord.keyRow,
+                              partInfo->KeyRecord.xfrmbuf, 
+                              partInfo->KeyRecord.xfrmbuflen);
+    if (ret == 0)
+    {
+      /* See comments above about sending hashResult rather than
+       * partitionId
+       */
+      *partValue= hashVal;
+      return 0;
+    }
+    else
+    {
+      setErrorCodeAbort(ret);
+      return -1;
+    }
+  }
+  }
+  
+  /* 4542 : Unknown partition information type */
+  setErrorCodeAbort(4542);
+  return -1;
+}
+
 /*
   Compare two rows on some prefix of the index.
   This is used to see if we can determine that all rows in an index range scan
@@ -528,6 +683,9 @@ compare_index_row_prefix(const NdbRecord
 {
   Uint32 i;
 
+  if (row1 == row2) // Easy case with same ptrs
+    return 0;
+
   for (i= 0; i<prefix_length; i++)
   {
     const NdbRecord::Attr *col= &rec->columns[rec->key_indexes[i]];
@@ -563,17 +721,21 @@ compare_index_row_prefix(const NdbRecord
   return 0;
 }
 
-void
-NdbIndexScanOperation::setDistKeyFromRange(const NdbRecord *key_record,
+int
+NdbIndexScanOperation::getDistKeyFromRange(const NdbRecord *key_record,
                                            const NdbRecord *result_record,
                                            const char *row,
-                                           Uint32 distkeyMax)
+                                           Uint32* distKey)
 {
   const Uint32 MaxKeySizeInLongWords= (NDB_MAX_KEY_SIZE + 7) / 8; 
   Uint64 tmp[ MaxKeySizeInLongWords ];
   char* tmpshrink = (char*)tmp;
   Uint32 tmplen = (Uint32)sizeof(tmp);
   
+  /* This can't work for User Defined partitioning */
+  assert(key_record->table->m_fragmentType != 
+         NdbDictionary::Object::UserDefined);
+
   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++)
@@ -588,8 +750,9 @@ NdbIndexScanOperation::setDistKeyFromRan
         bool len_ok = col->shrink_varchar(row, len, tmpshrink);
         if (!len_ok)
         {
-          assert(false);
-          return;
+          /* 4209 : Length parameter in equal/setValue is incorrect */
+          setErrorCodeAbort(4209);
+          return -1;
         }
         ptrs[i].ptr = tmpshrink;
         tmpshrink += len;
@@ -597,8 +760,9 @@ NdbIndexScanOperation::setDistKeyFromRan
       }
       else
       {
-        // no buffer...
-        return;
+        /* 4207 : Key size is limited to 4092 bytes */
+        setErrorCodeAbort(4207);
+        return -1;
       }
     }
     else
@@ -614,48 +778,104 @@ NdbIndexScanOperation::setDistKeyFromRan
                              ptrs, tmpshrink, tmplen);
   if (ret == 0)
   {
-    if (result_record->flags & NdbRecord::RecHasUserDefinedPartitioning)
+    *distKey = hashValue;
+    return 0;
+  }
+  else
+  {
+#ifdef VM_TRACE
+    ndbout << "err: " << ret << endl;
+#endif
+    setErrorCodeAbort(ret);
+    return -1;
+  }
+}
+
+int
+NdbScanOperation::validatePartInfoPtr(const Ndb::PartitionSpec*& partInfo,
+                                      Uint32 sizeOfPartInfo,
+                                      Ndb::PartitionSpec& tmpSpec)
+{  
+  if (unlikely(sizeOfPartInfo != sizeof(Ndb::PartitionSpec)))
+  {
+    if (sizeOfPartInfo == sizeof(Ndb::PartitionSpec_v1))
     {
-      theDistributionKey= result_record->table->getPartitionId(hashValue);
+      const Ndb::PartitionSpec_v1* oldPSpec= 
+        (const Ndb::PartitionSpec_v1*) partInfo;
+      
+      /* Let's upgrade to the latest variant */
+      tmpSpec.type= oldPSpec->type;
+      if (tmpSpec.type == Ndb::PartitionSpec_v1::PS_USER_DEFINED)
+      {
+        tmpSpec.UserDefined.partitionId= oldPSpec->UserDefined.partitionId;
+      }
+      else
+      {
+        tmpSpec.KeyPartPtr.tableKeyParts= oldPSpec->KeyPartPtr.tableKeyParts;
+        tmpSpec.KeyPartPtr.xfrmbuf= oldPSpec->KeyPartPtr.xfrmbuf;
+        tmpSpec.KeyPartPtr.xfrmbuflen= oldPSpec->KeyPartPtr.xfrmbuflen;
+      }
+      
+      partInfo= &tmpSpec;
     }
     else
     {
-      theDistributionKey = hashValue;
+      /* 4545 : Invalid or Unsupported PartitionInfo structure */
+      setErrorCodeAbort(4545);
+      return -1;
+    }
+  }
+  
+  if (partInfo->type != Ndb::PartitionSpec::PS_NONE)
+  {
+    if (m_pruneState == SPS_FIXED)
+    {
+      /* 4543 : Duplicate partitioning information supplied */
+      setErrorCodeAbort(4543);
+      return -1;
+    }
+    
+    if ((partInfo->type == Ndb::PartitionSpec::PS_USER_DEFINED) !=
+        ((m_currentTable->m_fragmentType == NdbDictionary::Object::UserDefined)))
+    {
+      /* Mismatch between type of partitioning info supplied, and table's
+       * partitioning type
+       */
+      /* 4544 : Wrong partitionInfo type for table */
+      setErrorCodeAbort(4544);
+      return -1;
     }
-    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
   {
-    ndbout << "err: " << ret << endl;
-    assert(false);
+    /* PartInfo supplied, but set to NONE */
+    partInfo= NULL;
   }
-#endif
+
+  return 0;
 }
 
 
+int
+NdbIndexScanOperation::setBound(const NdbRecord* key_record,
+                                const IndexBound& bound)
+{
+  return setBound(key_record, bound, NULL, 0);
+}
+
 /** 
  * setBound()
  *
  * This method is called from scanIndex() and setBound().  
  * It adds a bound to an Index Scan.
+ * It can be passed extra partitioning information.
  */
 int 
 NdbIndexScanOperation::setBound(const NdbRecord *key_record,
-                                const IndexBound& bound)
+                                const IndexBound& bound,
+                                const Ndb::PartitionSpec* partInfo,
+                                Uint32 sizeOfPartInfo)
 {
-  /*
-    Set up index range bounds, write into keyinfo.
-    
-    ToDo: We only set scan distribution key if there's only one
-    scan bound. (see BUG#25821).  MRR/BKA does not use it.
-  */
-
   if (unlikely((theStatus != NdbOperation::UseNdbRecord)))
   {
     setErrorCodeAbort(4284);
@@ -678,6 +898,23 @@ NdbIndexScanOperation::setBound(const Nd
     return -1;
   }
 
+  /* Check the base table's partitioning scheme 
+   * (Ordered index itself has 'undefined' fragmentation)
+   */
+  bool tabHasUserDefPartitioning= (m_currentTable->m_fragmentType == 
+                                   NdbDictionary::Object::UserDefined);
+
+  /* Validate explicit partitioning info if it's supplied */
+  Ndb::PartitionSpec tmpSpec;
+  if (partInfo)
+  {
+    /* May update the PartInfo ptr */
+    if (validatePartInfoPtr(partInfo,
+                            sizeOfPartInfo,
+                            tmpSpec))
+      return -1;
+  }
+
   m_num_bounds++;
 
   if (unlikely((m_num_bounds > 1) &&
@@ -771,35 +1008,125 @@ NdbIndexScanOperation::setBound(const Nd
     (theTupKeyLen - keyLenBeforeRange) << 16 | (range_no << 4);
   *firstRangeWord= bound_head;
 
-  /*
-    Now check if the range bounds a single distribution key. If so, we need
-    scan only a single fragment.
-    
-    ToDo: we do not attempt to identify the case where we have multiple
-    ranges, but they all bound the same single distribution key. It seems
-    not really worth the effort to optimise this case, better to fix the
-    multi-range protocol so that the distribution key could be specified
-    individually for each of the multiple ranges.
-  */
 
-  if (m_num_bounds == 1 &&  
-      ! theDistrKeyIndicator_ && // Partitioning not already specified.
-      ! m_multi_range)           // Only single range optimisation currently
-  {
-    Uint32 index_distkeys = key_record->m_no_of_distribution_keys;
-    Uint32 table_distkeys = m_attribute_record->m_no_of_distribution_keys;
-    Uint32 distkey_min= key_record->m_min_distkey_prefix_length;
-    if (index_distkeys == table_distkeys &&
-        common_key_count >= distkey_min &&
-        bound.low_key &&
-        bound.high_key &&
-        0==compare_index_row_prefix(key_record,
-                                    bound.low_key,
-                                    bound.high_key,
-                                    distkey_min))
-      setDistKeyFromRange(key_record, m_attribute_record,
-                          bound.low_key, distkey_min);
-  }
+  /* Now determine if the scan can (continue to) be pruned to one
+   * partition
+   * 
+   * This can only be the case if 
+   *   - There's no overriding partition id/info specified in 
+   *     ScanOptions 
+   *     AND
+   *   - This range scan can be pruned to 1 partition 'value'
+   *     AND
+   *   - All previous ranges (MRR) were partition pruned 
+   *     to the same partition 'value'
+   *
+   * Where partition 'value' is either a partition id or a hash
+   * that maps to one in the kernel.
+   */
+  if ((m_pruneState == SPS_UNKNOWN) ||      // First range
+      (m_pruneState == SPS_ONE_PARTITION))  // Previous ranges are commonly pruned
+  {
+    bool currRangeHasOnePartVal= false;
+    Uint32 currRangePartValue= 0;
+
+    /* Determine whether this range scan can be pruned */
+    if (partInfo)
+    {
+      /* Explicit partitioning info supplied, use it to get a value */
+      currRangeHasOnePartVal= true;
+
+      if (getPartValueFromInfo(partInfo,
+                               m_attribute_record->table,
+                               &currRangePartValue))
+      {
+        return -1;
+      }
+    }
+    else
+    {
+      if (likely(!tabHasUserDefPartitioning))
+      {
+        /* Attempt to get implicit partitioning info from range bounds - 
+         * only possible if they are present and bound a single value 
+         * of the table's distribution keys
+         */
+        Uint32 index_distkeys = key_record->m_no_of_distribution_keys;
+        Uint32 table_distkeys = m_attribute_record->m_no_of_distribution_keys;
+        Uint32 distkey_min= key_record->m_min_distkey_prefix_length;
+        if (index_distkeys == table_distkeys &&   // Index has all base table d-keys
+            common_key_count >= distkey_min &&    // Bounds have all d-keys
+            bound.low_key &&                      // Have both bounds
+            bound.high_key &&
+            0==compare_index_row_prefix(key_record,     // Both bounds are same
+                                        bound.low_key,
+                                        bound.high_key,
+                                        distkey_min))
+        {
+          currRangeHasOnePartVal= true;
+          if (getDistKeyFromRange(key_record, m_attribute_record,
+                                  bound.low_key,
+                                  &currRangePartValue))
+            return -1;
+        }
+      }
+    }
+     
+
+    /* Determine whether this pruned range fits with any existing
+     * range pruning
+     * As we can currently only prune a single scan to one partition
+     * (Not a set of partitions, or a set of partitions per range)
+     * we can only prune if all ranges happen to be prune-able to the
+     * same partition.
+     * In future perhaps Ndb can be enhanced to support partition sets
+     * and/or per-range partition pruning.
+     */
+    const ScanPruningState prevPruneState= m_pruneState;
+    if (currRangeHasOnePartVal)
+    {
+      if (m_pruneState == SPS_UNKNOWN)
+      {
+        /* Prune the scan to use this range's partition value */
+        m_pruneState= SPS_ONE_PARTITION;
+        m_pruningKey= currRangePartValue;
+      }
+      else
+      {
+        /* If this range's partition value is the same as the previous
+         * ranges then we can stay pruned, otherwise we cannot
+         */
+        assert(m_pruneState == SPS_ONE_PARTITION);
+        if (currRangePartValue != m_pruningKey)
+        {
+          /* This range is found in a different partition to previous
+           * range(s).  We cannot prune this scan.
+           */
+          m_pruneState= SPS_MULTI_PARTITION;
+        }
+      }
+    }
+    else
+    {
+      /* This range cannot be scanned by scanning a single partition
+       * Therefore the scan must scan all partitions
+       */
+      m_pruneState= SPS_MULTI_PARTITION;
+    }
+
+    /* Now modify the SCANTABREQ */
+    if (m_pruneState != prevPruneState)
+    {
+      theDistrKeyIndicator_= (m_pruneState == SPS_ONE_PARTITION);
+      theDistributionKey= m_pruningKey;
+
+      ScanTabReq *req= CAST_PTR(ScanTabReq, theSCAN_TABREQ->getDataPtrSend());
+      ScanTabReq::setDistributionKeyFlag(req->requestInfo, theDistrKeyIndicator_);
+      req->distributionKey= theDistributionKey;
+      theSCAN_TABREQ->setLength(ScanTabReq::StaticLength + theDistrKeyIndicator_);
+    }
+  } // if (m_pruneState == UNKNOWN / SPS_ONE_PARTITION)
+
   return 0;
 } // ::setBound();
 
@@ -819,21 +1146,12 @@ NdbIndexScanOperation::scanIndexImpl(con
   Uint32 parallel = 0;
   Uint32 batch = 0;
 
+  ScanOptions currentOptions;
+
   if (options != NULL)
   {
-    /* Check options size for versioning... */
-    if (unlikely((sizeOfOptions !=0) &&
-                 (sizeOfOptions != sizeof(ScanOptions))))
-    {
-      /* Handle different sized ScanOptions
-       * Probably smaller is old version, larger is new version
-       */
-      
-      /* No other versions supported currently */
-      setErrorCodeAbort(4298);
-      /* Invalid or unsupported ScanOptions structure */
+    if (handleScanOptionsVersion(options, sizeOfOptions, currentOptions))
       return -1;
-    }
     
     /* Process some initial ScanOptions here
      * The rest will be handled later
@@ -980,6 +1298,7 @@ NdbScanOperation::processTableScanDefs(N
                                        Uint32 batch)
 {
   m_ordered = m_descending = false;
+  m_pruneState= SPS_UNKNOWN;
   Uint32 fragCount = m_currentTable->m_fragmentCount;
 
   assert(fragCount > 0);
@@ -1778,7 +2097,14 @@ int NdbScanOperation::finaliseScanOldApi
   options.parallel= m_savedParallelOldApi;
   options.batch= m_savedBatchOldApi;
 
-  /* customData, interpretedCode or partitionId should 
+  if (theDistrKeyIndicator_ == 1)
+  {
+    /* User has defined a partition id specifically */
+    options.optionsPresent |= ScanOptions::SO_PARTITION_ID;
+    options.partitionId= theDistributionKey;
+  }
+
+  /* customData or interpretedCode should 
    * already be set in the operation members - no need 
    * to pass in as ScanOptions
    */
@@ -2849,8 +3175,6 @@ NdbIndexScanOperation::getIndexBoundFrom
 {
   return &((OldApiScanRangeDefinition*)recAttr->aRef())->ib;
 }
-
-
 /* Method called to release any resources allocated by the old 
  * Index Scan bound API
  */
@@ -3548,3 +3872,14 @@ NdbScanOperation::lockCurrentTuple(NdbTr
                                  result_rec, result_row, 
                                  result_mask, opts, sizeOfOptions);
 }
+
+bool
+NdbScanOperation::getPruned() const
+{
+  /* Note that for old Api scans, the bounds are not added until 
+   * execute() time, so this will return false until after execute
+   */
+  return ((m_pruneState == SPS_ONE_PARTITION) ||
+          (m_pruneState == SPS_FIXED));
+}
+

=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp	2008-11-06 10:56:21 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp	2009-02-23 09:59:06 +0000
@@ -186,6 +186,26 @@ SignalSender::sendSignal(Uint16 nodeId,
 }
 
 
+int
+SignalSender::sendFragmentedSignal(Uint16 nodeId,
+                                   SimpleSignal& sig,
+                                   Uint16 recBlock, Uint16 gsn,
+                                   Uint32 len)
+{
+  sig.set(*this, TestOrd::TraceAPI, recBlock, gsn, len);
+  if (nodeId == theFacade->ownId())
+  {
+    // No need to fragment when sending to own node
+    return sendSignal(nodeId, &sig);
+  }
+
+  return theFacade->sendFragmentedSignal((NdbApiSignal*)&sig.header,
+                                         nodeId,
+                                         &sig.ptr[0],
+                                         sig.header.m_noOfSections);
+}
+
+
 template<class T>
 SimpleSignal *
 SignalSender::waitFor(Uint32 timeOutMillis, T & t)

=== modified file 'storage/ndb/src/ndbapi/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/SignalSender.hpp	2008-11-06 10:56:21 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.hpp	2009-02-23 09:59:06 +0000
@@ -36,6 +36,20 @@ public:
   Uint32 *getDataPtrSend() { return theData; }
   const Uint32 *getDataPtr() const { return theData; }
 
+  /**
+   * Fragmentation
+   */
+  bool isFragmented() const { return header.m_fragmentInfo != 0;}
+  bool isFirstFragment() const { return header.m_fragmentInfo <= 1;}
+  bool isLastFragment() const { 
+    return header.m_fragmentInfo == 0 || header.m_fragmentInfo == 3; 
+  }
+
+
+  Uint32 getFragmentId() const {
+    return (header.m_fragmentInfo == 0 ? 0 : getDataPtr()[header.theLength - 1]);
+  }
+
   void print(FILE * out = stdout);
 private:
   bool deallocSections;
@@ -68,6 +82,8 @@ public:
   SendStatus sendSignal(Uint16 nodeId, const SimpleSignal *);
   SendStatus sendSignal(Uint16 nodeId, SimpleSignal& sig,
                         Uint16 recBlock, Uint16 gsn, Uint32 len);
+  int sendFragmentedSignal(Uint16 nodeId, SimpleSignal& sig,
+                           Uint16 recBlock, Uint16 gsn, Uint32 len);
   NodeBitmask broadcastSignal(NodeBitmask mask, SimpleSignal& sig,
                               Uint16 recBlock, Uint16 gsn, Uint32 len);
 

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp	2009-01-29 16:49:19 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp	2009-03-12 10:59:57 +0000
@@ -418,11 +418,14 @@ bool
 TransporterFacade::getIsNodeSendable(NodeId n) const {
   const ClusterMgr::Node & node = theClusterMgr->getNodeInfo(n);
   const Uint32 startLevel = node.m_state.startLevel;
-  assert(node.m_info.getType() == NodeInfo::DB);
+  const NodeInfo::NodeType node_type = node.m_info.getType();
+  assert(node_type == NodeInfo::DB ||
+         node_type == NodeInfo::MGM);
 
   return node.compatible && (startLevel == NodeState::SL_STARTED ||
                              startLevel == NodeState::SL_STOPPING_1 ||
-                             node.m_state.getSingleUserMode());
+                             node.m_state.getSingleUserMode() ||
+                             node_type == NodeInfo::MGM);
 }
 
 inline

=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2009-01-09 15:05:44 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2009-03-04 10:07:03 +0000
@@ -739,7 +739,7 @@ int Ndb_cluster_connection_impl::connect
                                                     3/*delay*/);
     if(nodeId == 0)
       break;
-    ndb_mgm_configuration * props = m_config_retriever->getConfig();
+    ndb_mgm_configuration * props = m_config_retriever->getConfig(nodeId);
     if(props == 0)
       break;
 

=== modified file 'storage/ndb/src/ndbapi/ndberror.c'
--- a/storage/ndb/src/ndbapi/ndberror.c	2009-02-11 12:41:43 +0000
+++ b/storage/ndb/src/ndbapi/ndberror.c	2009-03-12 11:06:48 +0000
@@ -298,6 +298,7 @@ ErrorBundle ErrorCodes[] = {
   { 4348, DMEC, IE, "Inconsistency detected at alter index" },
   { 4349, DMEC, IE, "Inconsistency detected at index usage" },
   { 4350, DMEC, IE, "Transaction already aborted" },
+  { 4351, DMEC, TO, "Timeout/deadlock during index build" },
 
   /**
    * Application error
@@ -606,6 +607,12 @@ ErrorBundle ErrorCodes[] = {
   { 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" },
+  { 4542, DMEC, AE, "Unknown partition information type" },
+  { 4543, DMEC, AE, "Duplicate partitioning information supplied" },
+  { 4544, DMEC, AE, "Wrong partitionInfo type for table" },
+  { 4545, DMEC, AE, "Invalid or Unsupported PartitionInfo structure" },
+  { 4546, DMEC, AE, "Explicit partitioning info not allowed for table and operation" },
+
 
   { 4200, DMEC, AE, "Status Error when defining an operation" },
   { 4201, DMEC, AE, "Variable Arrays not yet supported" },

=== modified file 'storage/ndb/test/CMakeLists.txt'
--- a/storage/ndb/test/CMakeLists.txt	2008-08-20 13:22:09 +0000
+++ b/storage/ndb/test/CMakeLists.txt	2009-01-23 12:50:40 +0000
@@ -14,6 +14,8 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 ADD_SUBDIRECTORY(src)
+IF(WITH_NDB_TEST)
 ADD_SUBDIRECTORY(tools)
 ADD_SUBDIRECTORY(ndbapi)
 ADD_SUBDIRECTORY(run-test)
+ENDIF(WITH_NDB_TEST)

=== modified file 'storage/ndb/test/include/HugoOperations.hpp'
--- a/storage/ndb/test/include/HugoOperations.hpp	2008-11-17 09:26:25 +0000
+++ b/storage/ndb/test/include/HugoOperations.hpp	2009-03-06 18:06:17 +0000
@@ -91,6 +91,8 @@ public:  
 		   int rowId);
 
   int equalForRow(NdbOperation*, int rowid);
+
+  bool getPartIdForRow(const NdbOperation* pOp, int rowid, Uint32& partId);
   
   int setValues(NdbOperation*, int rowId, int updateId);
   

=== modified file 'storage/ndb/test/include/NdbBackup.hpp'
--- a/storage/ndb/test/include/NdbBackup.hpp	2008-12-15 12:34:21 +0000
+++ b/storage/ndb/test/include/NdbBackup.hpp	2009-03-11 16:24:34 +0000
@@ -44,6 +44,8 @@ public:
   int startLogEvent();
   int checkBackupStatus();
 
+  int clearOldBackups();
+
 private:
 
   int execRestore(bool _restore_data,

=== modified file 'storage/ndb/test/include/NdbMgmd.hpp'
--- a/storage/ndb/test/include/NdbMgmd.hpp	2009-01-15 12:59:04 +0000
+++ b/storage/ndb/test/include/NdbMgmd.hpp	2009-03-06 13:48:22 +0000
@@ -32,6 +32,7 @@ class NdbMgmd {
   NdbMgmHandle m_handle;
   Uint32 m_nodeid;
   bool m_verbose;
+  unsigned int m_timeout;
   void error(const char* msg, ...) ATTRIBUTE_FORMAT(printf, 2, 3)
   {
     if (!m_verbose)
@@ -53,7 +54,7 @@ class NdbMgmd {
   }
 public:
   NdbMgmd() :
-    m_handle(NULL), m_nodeid(0), m_verbose(true)
+    m_handle(NULL), m_nodeid(0), m_verbose(true), m_timeout(0)
     {
       const char* connect_string= getenv("NDB_CONNECTSTRING");
       if (connect_string)
@@ -82,6 +83,21 @@ public:
     return m_connect_str.c_str();
   }
 
+  void setConnectString(const char* connect_str) {
+    m_connect_str.assign(connect_str);
+  }
+
+  bool set_timeout(unsigned int timeout) {
+    m_timeout = timeout;
+    if (m_handle &&
+        ndb_mgm_set_timeout(m_handle, timeout) != 0)
+    {
+      error("set_timeout: failed to set timeout on handle");
+      return false;
+    }
+    return true;
+  }
+
   void verbose(bool yes = true){
     m_verbose= yes;
   }
@@ -95,6 +111,7 @@ public:
   }
 
   bool connect(const char* connect_string = NULL) {
+    assert(m_handle == NULL);
     m_handle= ndb_mgm_create_handle();
     if (!m_handle){
       error("connect: ndb_mgm_create_handle failed");
@@ -108,6 +125,12 @@ public:
       return false;
     }
 
+    if (m_timeout > 0 &&
+        ndb_mgm_set_timeout(m_handle, m_timeout) != 0){
+      error("connect: ndb_mgm_set_timeout failed");
+      return false;
+    }
+
     if (ndb_mgm_connect(m_handle,0,0,0) != 0){
       error("connect: ndb_mgm_connect failed");
       return false;

=== modified file 'storage/ndb/test/ndbapi/Makefile.am'
--- a/storage/ndb/test/ndbapi/Makefile.am	2009-03-03 14:32:21 +0000
+++ b/storage/ndb/test/ndbapi/Makefile.am	2009-03-12 10:59:57 +0000
@@ -93,7 +93,7 @@ testMgm_SOURCES = testMgm.cpp \
 	$(top_srcdir)/storage/ndb/src/mgmsrv/Config.cpp \
 	$(top_srcdir)/storage/ndb/src/mgmsrv/ConfigInfo.cpp \
 	$(top_srcdir)/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
-testMgm_CXXFLAGS = -I$(top_srcdir)/storage/ndb/src/mgmapi
+testMgm_CXXFLAGS = -I$(top_srcdir)/storage/ndb/src/mgmapi -I$(top_srcdir)/storage/ndb/include/debugger  
 testSingleUserMode_SOURCES = testSingleUserMode.cpp
 testNdbApi_SOURCES = testNdbApi.cpp
 testNodeRestart_SOURCES = testNodeRestart.cpp

=== modified file 'storage/ndb/test/ndbapi/bank/Bank.cpp'
--- a/storage/ndb/test/ndbapi/bank/Bank.cpp	2008-10-08 02:29:09 +0000
+++ b/storage/ndb/test/ndbapi/bank/Bank.cpp	2009-03-11 16:24:34 +0000
@@ -522,7 +522,7 @@ int Bank::performMakeGLs(int yield){
 	g_err << "performValidateGLs verification failed" << endl;
 	return NDBT_FAILED;
       }
-      g_info << "performValidateGLs failed" << endl;
+      g_info << "performValidateGLs failed: " << result << endl;
       return NDBT_FAILED;
       continue;
     }
@@ -619,7 +619,7 @@ int Bank::performValidateAllGLs(){
 	g_err << "performValidateGLs verification failed" << endl;
 	return NDBT_FAILED;
       }
-      g_err << "performValidateGLs failed" << endl;
+      g_err << "performValidateGLs failed: " << result << endl;
       return NDBT_FAILED;
     }
 
@@ -1090,7 +1090,7 @@ int Bank::sumTransactionsForGL(const Uin
     
     int result = performValidateGL(glTime);
     if (result != NDBT_OK){
-      g_err << "performValidateGL failed" << endl;
+      g_err << "performValidateGL failed: " << result << endl;
       return result;
     }
     

=== modified file 'storage/ndb/test/ndbapi/testBackup.cpp'
--- a/storage/ndb/test/ndbapi/testBackup.cpp	2008-12-15 12:34:21 +0000
+++ b/storage/ndb/test/ndbapi/testBackup.cpp	2009-03-11 16:24:34 +0000
@@ -26,6 +26,13 @@
   result = NDBT_FAILED; \
   continue; } 
 
+int
+clearOldBackups(NDBT_Context* ctx, NDBT_Step* step)
+{
+  NdbBackup backup(GETNDB(step)->getNodeId());
+  backup.clearOldBackups();
+  return NDBT_OK;
+}
 
 int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){
 
@@ -630,6 +637,7 @@ TESTCASE("BackupOne", 
 	 "3. Drop tables and restart \n"
 	 "4. Restore\n"
 	 "5. Verify count and content of table\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(runLoadTable);
   INITIALIZER(runBackupOne);
   INITIALIZER(runDropTablesRestart);
@@ -644,6 +652,7 @@ TESTCASE("BackupRandom", 
 	 "3. Drop tables and restart \n"
 	 "4. Restore\n"
 	 "5. Verify count and content of table\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(runLoadTable);
   INITIALIZER(runBackupRandom);
   INITIALIZER(runDropTablesRestart);
@@ -654,6 +663,7 @@ TESTCASE("BackupRandom", 
 TESTCASE("BackupDDL", 
 	 "Test that backup and restore works on with DDL ongoing\n"
 	 "1. Backups and DDL (create,drop,table.index)"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(runLoadTable);
   STEP(runBackupLoop);
   STEP(runDDL);
@@ -670,6 +680,7 @@ TESTCASE("BackupBank", 
 	 "3.  Restart ndb -i and reload each backup\n"
 	 "    let bank verify that the backup is consistent\n"
 	 "4.  Drop bank\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(runCreateBank);
   STEP(runBankTimer);
   STEP(runBankTransactions);
@@ -707,36 +718,42 @@ TESTCASE("BackupUndoLog", 
 }
 TESTCASE("NFMaster", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setMaster);
   STEP(runAbort);
 
 }
 TESTCASE("NFMasterAsSlave", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setMasterAsSlave);
   STEP(runAbort);
 
 }
 TESTCASE("NFSlave", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setSlave);
   STEP(runAbort);
 
 }
 TESTCASE("FailMaster", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setMaster);
   STEP(runFail);
 
 }
 TESTCASE("FailMasterAsSlave", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setMasterAsSlave);
   STEP(runFail);
 
 }
 TESTCASE("FailSlave", 
 	 "Test that backup behaves during node failiure\n"){
+  INITIALIZER(clearOldBackups);
   INITIALIZER(setSlave);
   STEP(runFail);
 

=== modified file 'storage/ndb/test/ndbapi/testBlobs.cpp'
--- a/storage/ndb/test/ndbapi/testBlobs.cpp	2008-10-07 05:47:44 +0000
+++ b/storage/ndb/test/ndbapi/testBlobs.cpp	2009-03-02 17:23:44 +0000
@@ -212,6 +212,9 @@ static Uint32 g_batchSize= 0;
 static Uint32 g_scanFlags= 0;
 static Uint32 g_parallel= 0;
 static Uint32 g_usingDisk= false;
+static const Uint32 MAX_FRAGS=48 * 8 * 4; // e.g. 48 nodes, 8 frags/node, 4 replicas
+static Uint32 frag_ng_mappings[MAX_FRAGS];
+
 
 static const char* stylename[3] = {
   "style=getValue/setValue",
@@ -482,6 +485,12 @@ dropTable()
   return 0;
 }
 
+static unsigned
+urandom(unsigned n)
+{
+  return n == 0 ? 0 : ndb_rand() % n;
+}
+
 static int
 createTable(int storageType)
 {
@@ -496,7 +505,43 @@ createTable(int storageType)
   if (storageType == STORAGE_DISK)
     tab.setTablespaceName(g_tsName);
   tab.setLogging(loggingRequired);
-  tab.setFragmentType(NdbDictionary::Object::FragAllLarge);
+  
+  /* Choose from the interesting fragmentation types :
+   * DistrKeyHash, DistrKeyLin, UserDefined, HashMapPartitioned
+   * Others are obsolete fragment-count setting variants 
+   * of DistrKeyLin
+   * For UserDefined partitioning, we need to set the partition
+   * id for all PK operations.
+   */
+  Uint32 fragTypeRange= 1 + (NdbDictionary::Object::HashMapPartition - 
+                             NdbDictionary::Object::DistrKeyHash);
+  Uint32 fragType= NdbDictionary::Object::DistrKeyHash + urandom(fragTypeRange);
+
+  /* Value 8 is unused currently, map it to something else */
+  if (fragType == 8)
+    fragType= NdbDictionary::Object::UserDefined;
+
+  tab.setFragmentType((NdbDictionary::Object::FragmentType)fragType);
+
+  if (fragType == NdbDictionary::Object::UserDefined)
+  {
+    /* Need to set the FragmentCount and fragment to NG mapping
+     * for this partitioning type 
+     */
+    const Uint32 numNodes= g_ncc->no_db_nodes();
+    const Uint32 numReplicas= 2; // Assumption
+    const Uint32 guessNumNgs= numNodes/2;
+    const Uint32 numNgs= guessNumNgs?guessNumNgs : 1;
+    const Uint32 numFragsPerNode= 2 + (rand() % 3);
+    const Uint32 numPartitions= numReplicas * numNgs * numFragsPerNode;
+    
+    tab.setFragmentCount(numPartitions);
+    for (Uint32 i=0; i<numPartitions; i++)
+    {
+      frag_ng_mappings[i]= i % numNgs;
+    }
+    tab.setFragmentData(frag_ng_mappings, numPartitions);
+  }
   const Chr& pk2chr = g_opt.m_pk2chr;
   // col PK1 - Uint32
   { NdbDictionary::Column col("PK1");
@@ -617,12 +662,6 @@ createTable(int storageType)
 
 // tuples
 
-static unsigned
-urandom(unsigned n)
-{
-  return n == 0 ? 0 : ndb_rand() % n;
-}
-
 struct Bval {
   const Bcol& m_bcol;
   char* m_val;
@@ -732,6 +771,11 @@ struct Tup {
       return m_pk2;
     return urandom(2) == 0 ? m_pk2 : m_pk2eq;
   }
+  Uint32 getPartitionId(Uint32 numParts) const {
+    /* Only for UserDefined tables really */
+    return m_pk1 % numParts; // MySQLD hash(PK1) style partitioning
+  }
+
 private:
   Tup(const Tup&);
   Tup& operator=(const Tup&);
@@ -740,6 +784,32 @@ private:
 static Tup* g_tups;
 
 static void
+setUDpartId(const Tup& tup, NdbOperation* op)
+{
+  const NdbDictionary::Table* tab= op->getTable();
+  if (tab->getFragmentType() == NdbDictionary::Object::UserDefined)
+  {
+    Uint32 partId= tup.getPartitionId(tab->getFragmentCount());
+    DBG("Setting partition id to " << partId << " out of " << 
+        tab->getFragmentCount());
+    op->setPartitionId(partId);
+  }
+}
+
+static void
+setUDpartIdNdbRecord(const Tup& tup, 
+                     const NdbDictionary::Table* tab, 
+                     NdbOperation::OperationOptions& opts)
+{
+  opts.optionsPresent= 0;
+  if (tab->getFragmentType() == NdbDictionary::Object::UserDefined)
+  {
+    opts.optionsPresent= NdbOperation::OperationOptions::OO_PARTITION_ID;
+    opts.partitionId= tup.getPartitionId(tab->getFragmentCount());
+  } 
+}
+
+static void
 calcBval(const Bcol& b, Bval& v, bool keepsize)
 {
   if (b.m_nullable && urandom(10) == 0) {
@@ -1165,6 +1235,7 @@ verifyHeadInline(Tup& tup)
     CHK(g_opr->equal("PK2", tup.pk2()) == 0);
     CHK(g_opr->equal("PK3", (char*)&tup.m_pk3) == 0);
   }
+  setUDpartId(tup, g_opr);
   NdbRecAttr* ra1;
   NdbRecAttr* ra2;
   NdbRecAttr* ra_frag;
@@ -1231,6 +1302,10 @@ verifyBlobTable(const Bval& v, Uint32 pk
     CHK((ra_data = g_ops->getValue("NDB$DATA")) != 0);
   }
 
+  /* No partition id set on Blob part table scan so that we
+   * find any misplaced parts in other partitions
+   */
+
   CHK((ra_frag = g_ops->getValue(NdbDictionary::Column::FRAGMENT)) != 0);
   CHK(g_con->execute(NoCommit) == 0);
   unsigned partcount;
@@ -1253,7 +1328,8 @@ verifyBlobTable(const Bval& v, Uint32 pk
         continue;
     }
     Uint32 part = ra_part->u_32_value();
-    DBG("part " << part << " of " << partcount);
+    Uint32 frag2 = ra_frag->u_32_value();
+    DBG("part " << part << " of " << partcount << " from fragment " << frag2);
     CHK(part < partcount && ! seen[part]);
     seen[part] = 1;
     unsigned n = b.m_inline + part * b.m_partsize;
@@ -1295,7 +1371,6 @@ verifyBlobTable(const Bval& v, Uint32 pk
         i++;
       }
     }
-    Uint32 frag2 = ra_frag->u_32_value();
     DBG("frags main=" << frag << " blob=" << frag2 << " stripe=" << b.m_stripe);
     if (b.m_stripe == 0)
       CHK(frag == frag2);
@@ -1354,6 +1429,7 @@ insertPk(int style, int api)
         CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
         CHK(g_opr->equal("PK3", tup.m_pk3) == 0);
       }
+      setUDpartId(tup, g_opr);
       CHK(getBlobHandles(g_opr) == 0);
     }
     else
@@ -1363,7 +1439,15 @@ insertPk(int style, int api)
         memcpy(&tup.m_row[g_pk2_offset], tup.m_pk2, g_opt.m_pk2chr.m_totlen);
         memcpy(&tup.m_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
       }
-      CHK((g_const_opr = g_con->insertTuple(g_full_record, tup.m_row)) != 0);
+      NdbOperation::OperationOptions opts;
+      setUDpartIdNdbRecord(tup,
+                           g_ndb->getDictionary()->getTable(g_opt.m_tname),
+                           opts);
+      CHK((g_const_opr = g_con->insertTuple(g_full_record, 
+                                            tup.m_row,
+                                            NULL,
+                                            &opts,
+                                            sizeof(opts))) != 0);
       CHK(getBlobHandles(g_const_opr) == 0);
     }
     if (style == 0) {
@@ -1416,6 +1500,7 @@ readPk(int style, int api)
         CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
         CHK(g_opr->equal("PK3", tup.m_pk3) == 0);
       }
+      setUDpartId(tup, g_opr);
       CHK(getBlobHandles(g_opr) == 0);
     }
     else
@@ -1425,13 +1510,24 @@ readPk(int style, int api)
         memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
         memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
       }
+      NdbOperation::OperationOptions opts;
+      setUDpartIdNdbRecord(tup,
+                           g_ndb->getDictionary()->getTable(g_opt.m_tname),
+                           opts);
       if (urandom(2) == 0)
         CHK((g_const_opr = g_con->readTuple(g_key_record, tup.m_key_row,
-                                            g_blob_record, tup.m_row)) != 0);
+                                            g_blob_record, tup.m_row,
+                                            NdbOperation::LM_Read,
+                                            NULL,
+                                            &opts,
+                                            sizeof(opts))) != 0);
       else
         CHK((g_const_opr = g_con->readTuple(g_key_record, tup.m_key_row,
                                             g_blob_record, tup.m_row,
-                                            NdbOperation::LM_CommittedRead)) != 0);
+                                            NdbOperation::LM_CommittedRead,
+                                            NULL,
+                                            &opts,
+                                            sizeof(opts))) != 0);
       CHK(getBlobHandles(g_const_opr) == 0);
     }
     if (style == 0) {
@@ -1487,6 +1583,7 @@ updatePk(int style, int api)
           CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
           CHK(g_opr->equal("PK3", tup.m_pk3) == 0);
         }
+        setUDpartId(tup, g_opr);
         CHK(getBlobHandles(g_opr) == 0);
       }
       else
@@ -1496,19 +1593,27 @@ updatePk(int style, int api)
           memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
           memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
         }
+        NdbOperation::OperationOptions opts;
+        setUDpartIdNdbRecord(tup,
+                             g_ndb->getDictionary()->getTable(g_opt.m_tname),
+                             opts);
         if (mode == 0) {
           DBG("using updateTuple");
           CHK((g_const_opr= g_con->updateTuple(g_key_record, tup.m_key_row,
-                                               g_blob_record, tup.m_row)) != 0);
+                                               g_blob_record, tup.m_row,
+                                               NULL, &opts, sizeof(opts))) != 0);
         } else if (mode == 1) {
           DBG("using readTuple exclusive");
           CHK((g_const_opr= g_con->readTuple(g_key_record, tup.m_key_row,
                                              g_blob_record, tup.m_row,
-                                             NdbOperation::LM_Exclusive)) != 0);
+                                             NdbOperation::LM_Exclusive,
+                                             NULL, &opts, sizeof(opts))) != 0);
         } else {
           DBG("using readTuple - will fail and retry");
           CHK((g_const_opr= g_con->readTuple(g_key_record, tup.m_key_row,
-                                             g_blob_record, tup.m_row)) != 0);
+                                             g_blob_record, tup.m_row,
+                                             NdbOperation::LM_Read,
+                                             NULL, &opts, sizeof(opts))) != 0);
         }
         CHK(getBlobHandles(g_const_opr) == 0);
       }
@@ -1554,6 +1659,7 @@ writePk(int style, int api)
         CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
         CHK(g_opr->equal("PK3", tup.m_pk3) == 0);
       }
+      setUDpartId(tup, g_opr);
       CHK(getBlobHandles(g_opr) == 0);
     }
     else
@@ -1566,8 +1672,13 @@ writePk(int style, int api)
         memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
         memcpy(&tup.m_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
       }
+      NdbOperation::OperationOptions opts;
+      setUDpartIdNdbRecord(tup,
+                           g_ndb->getDictionary()->getTable(g_opt.m_tname),
+                           opts);
       CHK((g_const_opr= g_con->writeTuple(g_key_record, tup.m_key_row,
-                                          g_full_record, tup.m_row)) != 0);
+                                          g_full_record, tup.m_row,
+                                          NULL, &opts, sizeof(opts))) != 0);
       CHK(getBlobHandles(g_const_opr) == 0);
     }
     if (style == 0) {
@@ -1603,6 +1714,11 @@ deletePk(int api)
     {
       CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
       CHK(g_opr->deleteTuple() == 0);
+      /* Must set explicit partitionId before equal() calls as that's
+       * where implicit Blob handles are created which need the 
+       * partitioning info
+       */
+      setUDpartId(tup, g_opr);
       CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
       if (g_opt.m_pk2chr.m_len != 0)
       {
@@ -1617,8 +1733,13 @@ deletePk(int api)
         memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
         memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
       }
+      NdbOperation::OperationOptions opts;
+      setUDpartIdNdbRecord(tup,
+                           g_ndb->getDictionary()->getTable(g_opt.m_tname),
+                           opts);
       CHK((g_const_opr= g_con->deleteTuple(g_key_record, tup.m_key_row,
-                                           g_full_record)) != 0);
+                                           g_full_record, NULL,
+                                           NULL, &opts, sizeof(opts))) != 0);
     }
     if (++n == g_opt.m_batch) {
       CHK(g_con->execute(Commit) == 0);
@@ -1667,6 +1788,7 @@ deleteNoPk()
   DBG("deletePk pk1=" << hex << tup.m_pk1);
   CHK((g_opr = g_con->getNdbOperation(g_opt.m_tname)) != 0);
   CHK(g_opr->deleteTuple() == 0);
+  setUDpartId(tup, g_opr);
   CHK(g_opr->equal("PK1", tup.m_pk1) == 0);
   if (pk2chr.m_len != 0) {
     CHK(g_opr->equal("PK2", tup.m_pk2) == 0);
@@ -1702,12 +1824,14 @@ readIdx(int style, int api)
         CHK(g_opx->readTuple(NdbOperation::LM_CommittedRead) == 0);
       CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
       CHK(g_opx->equal("PK3", tup.m_pk3) == 0);
+      /* No need to set partition Id for unique indexes */
       CHK(getBlobHandles(g_opx) == 0);
     }
     else
     {
       memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
       memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
+      /* No need to set partition Id for unique indexes */
       if (urandom(2) == 0)
         CHK((g_const_opr= g_con->readTuple(g_idx_record, tup.m_key_row,
                                            g_blob_record, tup.m_row)) != 0);
@@ -1755,12 +1879,14 @@ updateIdx(int style, int api)
       CHK(g_opx->updateTuple() == 0);
       CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
       CHK(g_opx->equal("PK3", tup.m_pk3) == 0);
+      /* No need to set partition Id for unique indexes */
       CHK(getBlobHandles(g_opx) == 0);
     }
     else
     {
       memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
       memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
+      /* No need to set partition Id for unique indexes */
       CHK((g_const_opr= g_con->updateTuple(g_idx_record, tup.m_key_row,
                                            g_blob_record, tup.m_row)) != 0);
       CHK(getBlobHandles(g_const_opr) == 0);
@@ -1797,6 +1923,7 @@ writeIdx(int style, int api)
       CHK(g_opx->writeTuple() == 0);
       CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
       CHK(g_opx->equal("PK3", tup.m_pk3) == 0);
+      /* No need to set partition Id for unique indexes */
       CHK(getBlobHandles(g_opx) == 0);
     }
     else
@@ -1806,6 +1933,7 @@ writeIdx(int style, int api)
       memcpy(&tup.m_row[g_pk1_offset], &tup.m_pk1, sizeof(tup.m_pk1));
       memcpy(&tup.m_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
       memcpy(&tup.m_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
+      /* No need to set partition Id for unique indexes */
       CHK((g_const_opr= g_con->writeTuple(g_idx_record, tup.m_key_row,
                                           g_full_record, tup.m_row)) != 0);
       CHK(getBlobHandles(g_const_opr) == 0);
@@ -1847,11 +1975,13 @@ deleteIdx(int api)
       CHK(g_opx->deleteTuple() == 0);
       CHK(g_opx->equal("PK2", tup.m_pk2) == 0);
       CHK(g_opx->equal("PK3", tup.m_pk3) == 0);
+      /* No need to set partition Id for unique indexes */
     }
     else
     {
       memcpy(&tup.m_key_row[g_pk2_offset], tup.pk2(), g_opt.m_pk2chr.m_totlen);
       memcpy(&tup.m_key_row[g_pk3_offset], &tup.m_pk3, sizeof(tup.m_pk3));
+      /* No need to set partition Id for unique indexes */
       CHK((g_const_opr= g_con->deleteTuple(g_idx_record, tup.m_key_row,
                                            g_full_record)) != 0);
     }
@@ -1908,10 +2038,12 @@ readScan(int style, int api, bool idx)
       CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
       CHK(g_ops->getValue("PK3", (char *) &tup.m_pk3) != 0);
     }
+    /* Don't bother setting UserDefined partitions for scan tests */
     CHK(getBlobHandles(g_ops) == 0);   
   }
   else
   {
+    /* Don't bother setting UserDefined partitions for scan tests */
     if (urandom(2) == 0)
       if (! idx)
         CHK((g_ops= g_con->scanTable(g_full_record,
@@ -2010,9 +2142,11 @@ updateScan(int style, int api, bool idx)
       CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
       CHK(g_ops->getValue("PK3", (char *) &tup.m_pk3) != 0);
     }
+    /* Don't bother setting UserDefined partitions for scan tests */
   }
   else
   {
+    /* Don't bother setting UserDefined partitions for scan tests */
     if (! idx)
       CHK((g_ops= g_con->scanTable(g_key_record,
                                    NdbOperation::LM_Exclusive)) != 0);
@@ -2110,9 +2244,11 @@ deleteScan(int api, bool idx)
       CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
       CHK(g_ops->getValue("PK3", (char *) &tup.m_pk3) != 0);
     }
+    /* Don't bother setting UserDefined partitions for scan tests */
   }
   else
   {
+    /* Don't bother setting UserDefined partitions for scan tests */
     if (! idx)
       CHK((g_ops= g_con->scanTable(g_key_record,
                                    NdbOperation::LM_Exclusive)) != 0);
@@ -2293,6 +2429,7 @@ setupOperation(NdbOperation*& op, OpType
   
   if (pkop)
   {
+    setUDpartId(tup, op);
     CHK(op->equal("PK1", tup.m_pk1) == 0);
     if (g_opt.m_pk2chr.m_len != 0)
     {
@@ -2433,6 +2570,7 @@ bugtest_36756()
       CHK(g_opr->equal("PK2", tupExists.m_pk2) == 0);
       CHK(g_opr->equal("PK3", tupExists.m_pk3) == 0);
     }
+    setUDpartId(tupExists, g_opr);
     CHK(getBlobHandles(g_opr) == 0);
     
     CHK(setBlobValue(tupExists) == 0);
@@ -2499,6 +2637,7 @@ bugtest_36756()
     CHK((g_con= g_ndb->startTransaction()) != 0);
     CHK((g_opr= g_con->getNdbOperation(g_opt.m_tname)) != 0);
     CHK(g_opr->deleteTuple() == 0);
+    setUDpartId(tupExists, g_opr);
     CHK(g_opr->equal("PK1", tupExists.m_pk1) == 0);
     if (g_opt.m_pk2chr.m_len != 0)
     {
@@ -2548,7 +2687,7 @@ testmain()
     ndb_srand(g_opt.m_seed);
   }
   for (g_loop = 0; g_opt.m_loop == 0 || g_loop < g_opt.m_loop; g_loop++) {
-        for (int storage= 0; storage < 2; storage++) {
+    for (int storage= 0; storage < 2; storage++) {
       if (!testcase(storageSymbol[storage]))
         continue;
       
@@ -2557,6 +2696,7 @@ testmain()
       CHK(createTable(storage) == 0);
       { /* Dump created table information */
         Bcol& b1 = g_blob1;
+        DBG("FragType: " << g_dic->getTable(g_opt.m_tname)->getFragmentType()); 
         CHK(NdbBlob::getBlobTableName(b1.m_btname, g_ndb, g_opt.m_tname, "BL1") == 0);
         DBG("BL1: inline=" << b1.m_inline << " part=" << b1.m_partsize << " table=" << b1.m_btname);
         if (! g_opt.m_oneblob) {

=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp	2008-10-07 05:52:02 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp	2009-02-27 16:21:03 +0000
@@ -199,7 +199,10 @@ int create_index(NDBT_Context* ctx, int 
     ndbout << "FAILED!" << endl;
     const NdbError err = pNdb->getDictionary()->getNdbError();
     ERR(err);
-    if(err.classification == NdbError::ApplicationError)
+    if (err.classification == NdbError::ApplicationError)
+      return SKIP_INDEX;
+
+    if (err.status == NdbError::TemporaryError)
       return SKIP_INDEX;
     
     return NDBT_FAILED;

=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp	2009-01-15 13:01:37 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp	2009-03-06 15:48:25 +0000
@@ -73,67 +73,45 @@ int runTestApiSession(NDBT_Context* ctx,
 int runTestApiConnectTimeout(NDBT_Context* ctx, NDBT_Step* step)
 {
   NdbMgmd mgmd;
-  int result= NDBT_FAILED;
-
-  NdbMgmHandle h;
-  h= ndb_mgm_create_handle();
-  ndb_mgm_set_connectstring(h, mgmd.getConnectString());
-
-  ndbout << "TEST connect timeout" << endl;
-
-  ndb_mgm_set_timeout(h, 3000);
-
-  NDB_TICKS  tstart, tend;
-  NDB_TICKS secs;
-
-  tstart= NdbTick_CurrentMillisecond();
-
-  ndb_mgm_connect(h,0,0,0);
-
-  tend= NdbTick_CurrentMillisecond();
-
-  secs= tend - tstart;
-  ndbout << "Took about: " << secs <<" milliseconds"<<endl;
-
-  if(secs < 4)
-    result= NDBT_OK;
-  else
-    goto done;
 
-  ndb_mgm_set_connectstring(h, mgmd.getConnectString());
-
-  ndbout << "TEST connect timeout" << endl;
-
-  ndb_mgm_destroy_handle(&h);
-
-  h= ndb_mgm_create_handle();
-  ndb_mgm_set_connectstring(h, "1.1.1.1");
-
-  ndbout << "TEST connect timeout (invalid host)" << endl;
-
-  ndb_mgm_set_timeout(h, 3000);
-
-  tstart= NdbTick_CurrentMillisecond();
+  g_info << "Check connect works with timeout 3000" << endl;
+  if (!mgmd.set_timeout(3000))
+    return NDBT_FAILED;
 
-  ndb_mgm_connect(h,0,0,0);
+  if (!mgmd.connect())
+  {
+    g_err << "Connect failed with timeout 3000" << endl;
+    return NDBT_FAILED;
+  }
 
-  tend= NdbTick_CurrentMillisecond();
+  if (!mgmd.disconnect())
+    return NDBT_FAILED;
 
-  secs= tend - tstart;
-  ndbout << "Took about: " << secs <<" milliseconds"<<endl;
+  g_info << "Check connect to illegal host will timeout after 3000" << endl;
+  if (!mgmd.set_timeout(3000))
+    return NDBT_FAILED;
+  mgmd.setConnectString("1.1.1.1");
 
-  if(secs < 4)
-    result= NDBT_OK;
-  else
-    result= NDBT_FAILED;
+  NDB_TICKS tstart= NdbTick_CurrentMillisecond();
+  if (mgmd.connect())
+  {
+    g_err << "Connect to illegal host suceeded" << endl;
+    return NDBT_FAILED;
+  }
 
-done:
-  ndb_mgm_disconnect(h);
-  ndb_mgm_destroy_handle(&h);
+  NDB_TICKS msecs= NdbTick_CurrentMillisecond() - tstart;
+  ndbout << "Took about " << msecs <<" milliseconds"<<endl;
 
-  return result;
+  if(msecs > 6000)
+  {
+    g_err << "The connect to illegal host timedout after much longer "
+          << "time than was expected, expected <= 6000, got " << msecs << endl;
+    return NDBT_FAILED;
+  }
+  return NDBT_OK;
 }
 
+
 int runTestApiTimeoutBasic(NDBT_Context* ctx, NDBT_Step* step)
 {
   NdbMgmd mgmd;
@@ -1571,15 +1549,36 @@ check_reload_config_both_config_and_mycn
                                        "ERROR: Both mycnf and config_filename");
 }
 
+
+static bool
+show_variables(NdbMgmd& mgmd, Properties& reply)
+{
+  if (!mgmd.call("show variables", "",
+                 "show variables reply", reply))
+  {
+    g_err << "show_variables: mgmd.call failed" << endl;
+    return false;
+  }
+  return true;
+}
+
+
 static bool
-check_reload_config_invalid_config_filename(NdbMgmd& mgmd)
+check_reload_config_invalid_config_filename(NdbMgmd& mgmd, bool mycnf)
 {
+
+  BaseString expected("Could not load configuration from 'nonexisting_file");
+  if (mycnf)
+  {
+    // Differing error message if started from my.cnf
+    expected.assign("Can't switch to use config.ini 'nonexisting_file' "
+                    "when node was started from my.cnf");
+  }
+
   Properties args;
   // Send reload command with an invalid config_filename
   args.put("config_filename", "nonexisting_file");
-  return reload_config_result_contains(mgmd, args,
-                                       "Could not load configuration "
-                                       "from 'nonexisting_file");
+  return reload_config_result_contains(mgmd, args, expected.c_str());
 }
 
 
@@ -1590,10 +1589,19 @@ int runTestReloadConfig(NDBT_Context* ct
   if (!mgmd.connect())
     return NDBT_FAILED;
 
+  Properties variables;
+  if (!show_variables(mgmd, variables))
+    return NDBT_FAILED;
+
+  const char* mycnf_str;
+  if (!variables.get("mycnf", &mycnf_str))
+    abort();
+  bool uses_mycnf = strcmp(mycnf_str, "1");
+
   int result= NDBT_FAILED;
   if (
       check_reload_config_both_config_and_mycnf(mgmd) &&
-      check_reload_config_invalid_config_filename(mgmd) &&
+      check_reload_config_invalid_config_filename(mgmd, uses_mycnf) &&
       true)
     result= NDBT_OK;
 

=== modified file 'storage/ndb/test/ndbapi/testPartitioning.cpp'
--- a/storage/ndb/test/ndbapi/testPartitioning.cpp	2008-08-04 13:40:17 +0000
+++ b/storage/ndb/test/ndbapi/testPartitioning.cpp	2009-03-09 13:22:09 +0000
@@ -20,6 +20,13 @@
 #include <NdbRestarter.hpp>
 
 static Uint32 max_dks = 0;
+static const Uint32 MAX_FRAGS=48 * 8 * 4; // e.g. 48 nodes, 8 frags/node, 4 replicas
+static Uint32 frag_ng_mappings[MAX_FRAGS];
+static const char* DistTabName= "DistTest";
+static const char* DistTabDKeyCol= "DKey";
+static const char* DistTabPKey2Col= "PKey2";
+static const char* DistTabResultCol= "Result";
+static const char* DistIdxName= "ResultIndex";
 
 static
 int
@@ -32,7 +39,7 @@ run_drop_table(NDBT_Context* ctx, NDBT_S
 
 static
 int
-add_distribution_key(Ndb*, NdbDictionary::Table& tab, int when, void* arg)