List:Commits« Previous MessageNext Message »
From:Tomas Ulin Date:March 12 2009 10:47am
Subject:bzr commit into mysql-6.0-ndb branch (tomas.ulin:2853)
View as plain text  
#At file:///home/tomas/mysql_src/mysql-6.0-ndb/

 2853 Tomas Ulin	2009-03-12 [merge]
      merge from cluster 6.2
      added:
        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:
        configure.in
        mysql-test/include/ndb_not_readonly.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/ndbapi.result
        mysql-test/suite/ndb/t/ndbapi.test
        mysql-test/suite/rpl_ndb_big/t/rpl_ndbapi_multi.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster_binlog.cc
        sql/slave.cc
        storage/ndb/include/kernel/RefConvert.hpp
        storage/ndb/include/kernel/signaldata/AllocNodeId.hpp
        storage/ndb/include/kernel/signaldata/BuildIndx.hpp
        storage/ndb/include/kernel/signaldata/FsOpenReq.hpp
        storage/ndb/include/mgmapi/mgmapi_config_parameters.h
        storage/ndb/src/common/debugger/EventLogger.cpp
        storage/ndb/src/kernel/blocks/backup/Backup.cpp
        storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
        storage/ndb/src/kernel/blocks/dbdict/Dbdict.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/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/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/vm/DataBuffer.hpp
        storage/ndb/src/mgmclient/CommandInterpreter.cpp
        storage/ndb/src/mgmsrv/ConfigInfo.cpp
        storage/ndb/src/mgmsrv/MgmtSrvr.cpp
        storage/ndb/src/mgmsrv/MgmtSrvr.hpp
        storage/ndb/src/mgmsrv/Services.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/src/ndbapi/ndberror.c
        storage/ndb/test/ndbapi/testIndex.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/NdbBackup.cpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/restore_main.cpp

=== modified file 'configure.in'
--- a/configure.in	2009-02-27 14:17:35 +0000
+++ b/configure.in	2009-03-12 10:45:04 +0000
@@ -18,7 +18,7 @@ AC_CONFIG_HEADERS([include/config.h:conf
 
 NDB_VERSION_MAJOR=6
 NDB_VERSION_MINOR=2
-NDB_VERSION_BUILD=17
+NDB_VERSION_BUILD=18
 NDB_VERSION_STATUS="-alpha"
 
 PROTOCOL_VERSION=10

=== modified file 'mysql-test/include/ndb_not_readonly.inc'
--- a/mysql-test/include/ndb_not_readonly.inc	2009-02-02 15:58:48 +0000
+++ b/mysql-test/include/ndb_not_readonly.inc	2009-03-12 10:45:04 +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_apply_status values(0,0,"",0,0);
   if ($mysql_errno)
   {

=== 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:21:27 +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-01 21:05:19 +0000
+++ b/mysql-test/lib/v1/ndb_config_2_node.ini	2009-02-17 13:20:12 +0000
@@ -20,6 +20,9 @@ DiskPageBufferMemory= CHOOSE_DiskPageBuf
 # 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-02-27 14:17:35 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-03-12 10:45:04 +0000
@@ -962,12 +962,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())
@@ -4172,12 +4172,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 10:45:04 +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/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/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

=== 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'
=== 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_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 10:45:04 +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 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2009-02-27 14:17:35 +0000
+++ b/sql/ha_ndbcluster.cc	2009-03-12 10:45:04 +0000
@@ -5496,7 +5496,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;
@@ -6308,7 +6307,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 */

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2009-02-13 16:30:54 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2009-03-12 10:45:04 +0000
@@ -2686,15 +2686,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:
@@ -4742,7 +4746,7 @@ pthread_handler_t ndb_binlog_thread_func
   pthread_mutex_unlock(&LOCK_thread_count);
   thd->lex->start_transaction_opt= 0;
 
-  if (!(s_ndb= new Ndb(g_ndb_cluster_connection, "")) ||
+  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");

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-02-13 16:30:54 +0000
+++ b/sql/slave.cc	2009-03-12 10:45:04 +0000
@@ -2790,7 +2790,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/RefConvert.hpp'
--- a/storage/ndb/include/kernel/RefConvert.hpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/include/kernel/RefConvert.hpp	2009-02-17 07:52:13 +0000
@@ -27,6 +27,14 @@ BlockNumber refToBlock(BlockReference re
 }
 
 /**
+ * For allowing to write merge safe code
+ */
+inline
+BlockNumber refToMain(BlockReference ref){
+  return (BlockNumber)(ref >> 16);
+}
+
+/**
  * Convert BlockReference to NodeId
  */
 inline

=== 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	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/include/kernel/signaldata/BuildIndx.hpp	2009-02-27 13:18:49 +0000
@@ -239,7 +239,8 @@ public:
     InvalidIndexType = 4250,
     IndexNotUnique = 4251,
     AllocationFailure = 4252,
-    InternalError = 4346
+    InternalError = 4346,
+    DeadlockError = 4351
   };
   STATIC_CONST( SignalLength = BuildIndxConf::SignalLength + 2 );
 

=== modified file 'storage/ndb/include/kernel/signaldata/FsOpenReq.hpp'
--- a/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp	2007-05-14 08:34:21 +0000
+++ b/storage/ndb/include/kernel/signaldata/FsOpenReq.hpp	2009-02-17 07:52:13 +0000
@@ -99,6 +99,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/mgmapi/mgmapi_config_parameters.h'
--- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2008-12-18 09:16:45 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2009-02-17 07:52:13 +0000
@@ -132,6 +132,12 @@
 #define CFG_DB_MAX_BUFFERED_EPOCHS    182 /* subscriptions */
 #define CFG_DB_SUMA_HANDOVER_TIMEOUT  183
 
+#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 */
 

=== modified file 'storage/ndb/src/common/debugger/EventLogger.cpp'
--- a/storage/ndb/src/common/debugger/EventLogger.cpp	2008-10-24 11:00:37 +0000
+++ b/storage/ndb/src/common/debugger/EventLogger.cpp	2009-02-20 08:46:10 +0000
@@ -804,7 +804,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) {
@@ -839,7 +839,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]);

=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2009-01-27 14:32:31 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.cpp	2009-02-20 08:46:10 +0000
@@ -463,7 +463,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;
@@ -639,7 +639,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
@@ -648,7 +648,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
@@ -659,7 +659,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 =
@@ -691,7 +691,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[] = {

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2008-11-08 20:46:53 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2009-02-23 11:26:17 +0000
@@ -428,6 +428,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");
@@ -435,6 +441,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) {

=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2008-11-21 10:51:05 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2009-02-19 12:22:38 +0000
@@ -5001,7 +5001,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);
@@ -7776,14 +7776,14 @@ void Dbdict::execGET_TABINFOREQ(Signal* 
     ndbrequire(signal->getNoOfSections() == 1);  
     const Uint32 len = req->tableNameLen;
     
-    if(len > MAX_TAB_NAME_SIZE){
+    if(len > PATH_MAX){
       jam();
       releaseSections(signal);
       sendGET_TABINFOREF(signal, req, GetTabInfoRef::TableNameTooLong);
       return;
     }
 
-    char tableName[MAX_TAB_NAME_SIZE];
+    char tableName[PATH_MAX];
     SegmentedSectionPtr ssPtr;
     signal->getSection(ssPtr,GetTabInfoReq::TABLE_NAME);
     SimplePropertiesSectionReader r0(ssPtr, getSectionSegmentPool());
@@ -8108,7 +8108,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];
@@ -8168,7 +8168,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(getSectionSegmentPool());
   SimplePropertiesSectionWriter tableNamesWriter(getSectionSegmentPool());
 
@@ -15922,6 +15922,15 @@ Dbdict::createObj_prepare_complete_done(
 void
 Dbdict::createObj_commit(Signal * signal, SchemaOp * op)
 {
+  if (ERROR_INSERTED(6016))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   OpCreateObj * createObj = (OpCreateObj*)op;
 
   createObj->m_callback.m_callbackFunction = 
@@ -16530,9 +16539,22 @@ Dbdict::create_fg_prepare_start(Signal* 
     {
       //fg.TS_DataGrow = group.m_grow_spec;
       fg_ptr.p->m_tablespace.m_extent_size = fg.TS_ExtentSize;
-      fg_ptr.p->m_tablespace.m_default_logfile_group_id = fg.TS_LogfileGroupId;
 
       Ptr<Filegroup> lg_ptr;
+      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;
+        }
+      }
+
+      fg_ptr.p->m_tablespace.m_default_logfile_group_id = fg.TS_LogfileGroupId;
+
       if (!c_filegroup_hash.find(lg_ptr, fg.TS_LogfileGroupId))
       {
         jam();
@@ -16719,6 +16741,28 @@ Dbdict::create_file_prepare_start(Signal
 
     // Get Filegroup
     FilegroupPtr fg_ptr;
+    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);
+      }
+    }
+
     if(!c_filegroup_hash.find(fg_ptr, f.FilegroupId)){
       jam();
       op->m_errorCode = CreateFileRef::NoSuchFilegroup;
@@ -16929,7 +16973,7 @@ Dbdict::create_file_prepare_complete(Sig
     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];
@@ -16965,6 +17009,15 @@ Dbdict::execCREATE_FILE_CONF(Signal* sig
 void
 Dbdict::create_file_commit_start(Signal* signal, SchemaOp* op)
 {
+  if (ERROR_INSERTED(6017))
+  {
+    jam();
+    NodeReceiverGroup rg(CMVMI, c_aliveNodes);
+    signal->theData[0] = 9999;
+    sendSignal(rg, GSN_NDB_TAMPER, signal, 1, JBB);
+    return;
+  }
+
   /**
    * CONTACT TSMAN LGMAN PGMAN 
    */

=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2009-01-27 14:32:31 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2009-02-27 13:18:49 +0000
@@ -1066,7 +1066,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;
 
@@ -1222,8 +1221,6 @@ DbUtil::prepareOperation(Signal* signal,
 	break;
       }
       attrLength += len;
-      if (attrDesc.AttributeKeyFlag)
-	pkAttrLength += len;
 
       if (operationType == UtilPrepareReq::Read) {
 	AttributeHeader::init(rsInfoIt.data, 
@@ -1274,14 +1271,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
   
   Uint32 requestInfo = 0;
@@ -1391,14 +1381,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 = 0;
     Uint32 requestInfo = 0;
@@ -1424,9 +1413,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 = 0;
@@ -1480,11 +1468,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 = 0;
     Uint32 requestInfo = 0;
@@ -1530,7 +1516,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->gsn = GSN_UTIL_SEQUENCE_REQ;
   transPtr.p->clientRef = signal->senderBlockRef();
@@ -1779,7 +1765,7 @@ DbUtil::execUTIL_EXECUTE_REQ(Signal* sig
   ndbrequire(transPtr.p->operations.seize(opPtr));
   opPtr.p->prepOp   = prepOpPtr.p;
   opPtr.p->prepOp_i = prepOpPtr.i;
-  
+
 #if 0 //def EVENT_DEBUG
   printf("opPtr.p->rs.seize( %u )\n", prepOpPtr.p->rsLen);
 #endif
@@ -1854,13 +1840,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 = 
@@ -1944,7 +1923,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);
@@ -1961,7 +1940,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
    */
@@ -1975,12 +1959,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	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp	2009-02-27 13:18:49 +0000
@@ -209,7 +209,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
@@ -231,7 +230,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
@@ -252,11 +251,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:48:44 +0000
+++ b/storage/ndb/src/kernel/blocks/lgman.cpp	2009-02-19 14:24:10 +0000
@@ -120,7 +120,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();
@@ -191,11 +192,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);
     }
     return;
@@ -924,8 +927,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
@@ -2481,6 +2494,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())
   {
@@ -2488,6 +2503,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
@@ -2530,6 +2557,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-08-11 10:41:11 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2009-02-17 07:52:13 +0000
@@ -189,6 +189,10 @@ private:
   void execDIH_RESTARTREF(Signal* signal);
   void execCREATE_TABLE_REF(Signal* signal);
   void execCREATE_TABLE_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);
@@ -230,6 +234,7 @@ private:
   void systemErrorLab(Signal* signal, int line);
 
   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	2007-02-14 05:37:40 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp	2009-02-17 07:52:13 +0000
@@ -77,6 +77,10 @@ Ndbcntr::Ndbcntr(Block_context& ctx):
   addRecSignal(GSN_DIH_RESTARTREF, &Ndbcntr::execDIH_RESTARTREF);
   addRecSignal(GSN_CREATE_TABLE_REF, &Ndbcntr::execCREATE_TABLE_REF);
   addRecSignal(GSN_CREATE_TABLE_CONF, &Ndbcntr::execCREATE_TABLE_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-04-25 10:59:17 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2009-02-23 11:26:17 +0000
@@ -50,6 +50,8 @@
 #include <NdbOut.hpp>
 #include <NdbTick.h>
 
+#include <signaldata/CreateFilegroup.hpp>
+
 // used during shutdown for reporting current startphase
 // accessed from Emulator.cpp, NdbShutdown()
 Uint32 g_currentStartPhase;
@@ -248,6 +250,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)
 {
@@ -262,6 +389,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;
@@ -289,14 +460,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:
@@ -1685,11 +1848,169 @@ void Ndbcntr::systemErrorLab(Signal* sig
 /*       |  :  |   :             |                   v                       */
 /*       | 2048|   0             |                   v                       */
 /*---------------------------------------------------------------------------*/
+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;
+    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->requestInfo = CreateFileReq::ForceCreateFile;
+    sendSignal(DBDICT_REF, GSN_CREATE_FILE_REQ, signal,
+               CreateFileReq::SignalLength, JBB, ptr, 1);
+    return;
+  }
+  default:
+    break;
+  }
+
+  startInsertTransactions(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);
-    startInsertTransactions(signal);
+    createDDObjects(signal, 0);
     return;
   }
   const SysTable& table = *g_sysTableList[index];
@@ -2780,25 +3101,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);
@@ -2806,6 +3132,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++;
@@ -2814,12 +3153,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
 }
@@ -3132,3 +3471,5 @@ UpgradeStartup::execCNTR_MASTER_REPLY(Si
   block.progError(__LINE__,NDBD_EXIT_NDBREQUIRE,
 		  "UpgradeStartup::execCNTR_MASTER_REPLY");
 }
+
+template class Vector<ddentry>;

=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Filename.cpp	2009-02-20 08:46:10 +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];
@@ -185,7 +192,8 @@ Filename::set(Filename::NameSpec& spec,
   }
   else 
   {
-    snprintf(theName, sizeof(theName), "%s%s", spec.fs_path.c_str(), buf);
-    m_base_name = theName + spec.fs_path.length();
+    snprintf(theName, sizeof(theName), "%s%s",
+             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-10-24 11:00:37 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp	2009-02-17 08:14:33 +0000
@@ -88,6 +88,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)
 {
@@ -99,12 +146,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;
@@ -141,14 +243,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
@@ -182,7 +277,6 @@ Ndbfs::execFSOPENREQ(Signal* signal)
   const BlockReference userRef = fsOpenReq->userReference;
   AsyncFile* file = getIdleFile();
   ndbrequire(file != NULL);
-  Filename::NameSpec spec(theFileSystemPath, theBackupFilePath);
 
   Uint32 userPointer = fsOpenReq->userPointer;
   
@@ -208,12 +302,28 @@ Ndbfs::execFSOPENREQ(Signal* signal)
   
   if(signal->getNoOfSections() == 0){
     jam();
-    file->theFileName.set(spec, userRef, fsOpenReq->fileNumber);
+    file->theFileName.set(m_base_path, userRef, fsOpenReq->fileNumber);
   } else {
     jam();
     SegmentedSectionPtr ptr;
     signal->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(signal);
   }
   file->reportTo(&theFromThreads);
@@ -245,10 +355,11 @@ Ndbfs::execFSREMOVEREQ(Signal* signal)
   AsyncFile* file = getIdleFile();
   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);
   file->reportTo(&theFromThreads);
-  
+
   Request* request = theRequestPool->get();
   request->action = Request::rmrf;
   request->par.rmrf.directory = req->directory;
@@ -258,7 +369,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	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp	2009-02-17 07:52:13 +0000
@@ -21,7 +21,7 @@
 #include "Pool.hpp"
 #include "AsyncFile.hpp"
 #include "OpenFiles.hpp"
-
+#include <signaldata/FsOpenReq.hpp>
 
 
 // Because one NDB Signal request can result in multiple requests to
@@ -81,8 +81,7 @@ private:
   Vector<AsyncFile*> theIdleFiles; // 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/print_file.cpp'
--- a/storage/ndb/src/kernel/blocks/print_file.cpp	2006-12-31 00:04:59 +0000
+++ b/storage/ndb/src/kernel/blocks/print_file.cpp	2009-02-18 21:56:20 +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:15:56 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2009-02-18 14:29:58 +0000
@@ -156,6 +156,8 @@ public:
     QmgrState sendPresToStatus;
     FailState failState;
     BlockReference blockRef;
+    Uint64 m_secret;
+    Uint64 m_alloc_timeout;
 
     NodeRec() { }
   }; /* p2c: size = 52 bytes */
@@ -308,7 +310,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:15:56 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2009-02-18 14:29:58 +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 10:56:52 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2009-02-18 14:29:58 +0000
@@ -436,9 +436,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);
@@ -2357,7 +2362,7 @@ void Qmgr::timerHandlingLab(Signal* sign
   {
     jam();
     hb_api_timer.reset();
-    apiHbHandlingLab(signal);
+    apiHbHandlingLab(signal, TcurrentTime);
   }
 
   if (cactivateApiCheck != 0) {
@@ -2463,7 +2468,7 @@ void Qmgr::checkHeartbeat(Signal* signal
   }//if
 }//Qmgr::checkHeartbeat()
 
-void Qmgr::apiHbHandlingLab(Signal* signal) 
+void Qmgr::apiHbHandlingLab(Signal* signal, Uint64 now)
 {
   NodeRecPtr TnodePtr;
 
@@ -2508,6 +2513,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()
@@ -2542,6 +2555,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:
@@ -2838,6 +2852,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);
   
@@ -2908,7 +2923,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)
   {
     /**
@@ -5325,22 +5341,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)
     {
@@ -5349,60 +5380,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);
 }
 
@@ -5415,6 +5485,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);
 }
 
@@ -5428,15 +5514,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);
 }
@@ -5463,6 +5554,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;
@@ -5474,12 +5576,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-09-26 12:55:06 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.cpp	2009-02-27 13:18:49 +0000
@@ -34,6 +34,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; }
 
 /**
@@ -603,9 +614,20 @@ 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::InternalError);
+  }
 }
 
 void Trix::execSUB_CREATE_CONF(Signal* signal)

=== modified file 'storage/ndb/src/kernel/blocks/tsman.cpp'
--- a/storage/ndb/src/kernel/blocks/tsman.cpp	2008-08-18 05:43:50 +0000
+++ b/storage/ndb/src/kernel/blocks/tsman.cpp	2009-03-12 10:45:04 +0000
@@ -835,7 +835,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;
     }
   }
@@ -1133,6 +1133,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))
   {
@@ -1237,7 +1239,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++)
     {

=== 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/mgmclient/CommandInterpreter.cpp'
--- a/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2008-12-03 13:49:39 +0000
+++ b/storage/ndb/src/mgmclient/CommandInterpreter.cpp	2009-02-20 08:46:10 +0000
@@ -744,7 +744,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
@@ -784,7 +784,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	2008-12-09 18:59:54 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2009-03-12 10:45:04 +0000
@@ -1454,6 +1454,61 @@ const ConfigInfo::ParamInfo ConfigInfo::
     "false",
     "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 },
+
   /***************************************************************************
    * API
    ***************************************************************************/

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2009-01-08 14:35:49 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2009-02-23 10:44:03 +0000
@@ -496,7 +496,7 @@ MgmtSrvr::MgmtSrvr(SocketServer *socket_
     int error_code;
 
     if (!alloc_node_id(&tmp, NDB_MGM_NODE_TYPE_MGM,
-		       0, 0, error_code, error_string)){
+		       0, 0, error_code, error_string, 20)){
       ndbout << "Unable to obtain requested nodeid: "
 	     << error_string.c_str() << endl;
       require(false);
@@ -2130,7 +2130,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
@@ -2144,6 +2146,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;
@@ -2227,141 +2230,165 @@ 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, 
-			SOCKET_SIZE_TYPE *client_addr_len,
-			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 (g_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;
+}
+
+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;
+
+  Guard g(m_configMutex);
 
-  if(NdbMutex_Lock(m_configMutex))
-  {
-    // should not happen
-    error_string.appfmt("unable to lock configuration mutex");
-    error_code = NDB_MGM_ALLOCID_ERROR;
-    DBUG_RETURN(false);
-  }
   ndb_mgm_configuration_iterator
     iter(* _config->m_configValues, CFG_SECTION_NODE);
-  for(iter.first(); iter.valid(); iter.next()) {
-    unsigned tmp= 0;
-    if(iter.get(CFG_NODE_ID, &tmp)) require(false);
-    if (*nodeId && *nodeId != tmp)
-      continue;
-    found_matching_id= true;
-    if(iter.get(CFG_TYPE_OF_SECTION, &type_c)) require(false);
-    if(type_c != (unsigned)type)
-      continue;
-    found_matching_type= true;
-    if (connected_nodes.get(tmp))
+  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;
-    found_free_node= true;
-    if(iter.get(CFG_NODE_HOST, &config_hostname)) require(false);
-    if (config_hostname && config_hostname[0] == 0)
-      config_hostname= 0;
-    else if (client_addr) {
-      // check hostname compatability
-      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
-#if 0
-	  ndbout << "MgmtSrvr::getFreeNodeId compare failed for \""
-		 << config_hostname
-		 << "\" id=" << tmp << endl;
-#endif
-	  continue;
-	}
-	// connecting through localhost
-	// check if config_hostname is local
-	if (!SocketServer::tryBind(0,config_hostname)) {
-	  continue;
-	}
-      }
-    } else { // client_addr == 0
-      if (!SocketServer::tryBind(0,config_hostname)) {
-	continue;
+    if (iter.get(CFG_TYPE_OF_SECTION, &type_c))
+      require(false);
+    if (type_c != (unsigned)type)
+    {
+      if (!node_id)
+        continue;
+      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))
+      {
+        if (!node_id)
+          continue;
+        goto error;
       }
+      exact_nodes.set(id);
     }
-    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= tmp;
-	continue; /* continue looking for a nodeid with specified
-		   * hostname
-		   */
-      }
-      assert(id_found == 0);
-      id_found= tmp;
-      break;
-    }
-    if (id_found) { // mgmt server may only have one match
-      error_string.appfmt("Ambiguous node id's %d and %d.\n"
-			  "Suggest specifying node id in connectstring,\n"
-			  "or specifying unique host names in config file.",
-			  id_found, tmp);
-      NdbMutex_Unlock(m_configMutex);
-      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-      DBUG_RETURN(false);
+    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;
+  }
+
+ 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 (config_hostname == 0) {
-      error_string.appfmt("Ambiguity for node id %d.\n"
-			  "Suggest specifying node id in connectstring,\n"
-			  "or specifying unique host names in config file,\n"
-			  "or specifying just one mgmt server in config file.",
-			  tmp);
-      NdbMutex_Unlock(m_configMutex);
-      error_code = NDB_MGM_ALLOCID_CONFIG_MISMATCH;
-      DBUG_RETURN(false);
+    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;
     }
-    id_found= tmp; // mgmt server matched, check for more matches
+    error_string.appfmt("No node defined with id=%d in config file.", node_id);
+    return -1;
   }
-  NdbMutex_Unlock(m_configMutex);
 
-  if (id_found && client_addr != 0)
+  // node_id == 0 and nodes_info.size() == 0
+  if (found_config_hostname)
   {
-    int res = alloc_node_id_req(id_found, type);
-    unsigned save_id_found = id_found;
+    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, type, timeout_ms);
     switch (res)
     {
     case 0:
@@ -2372,155 +2399,176 @@ 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)
+    {
+      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
     {
-      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();
+      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 (g_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);
+
+  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;
 
-  BaseString type_string, type_c_string;
+  // 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)
@@ -2534,27 +2582,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);
 }
@@ -3091,3 +3147,4 @@ template class MutexVector<unsigned shor
 template class MutexVector<Ndb_mgmd_event_service::Event_listener>;
 template class Vector<EventSubscribeReq>;
 template class MutexVector<EventSubscribeReq>;
+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 14:35:49 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2009-02-18 14:29:58 +0000
@@ -399,10 +399,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);
   
   /**
    *
@@ -491,7 +492,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();
@@ -643,6 +646,21 @@ private:
   Config *_props;
 
   ConfigRetriever *m_config_retriever;
+
+  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);
 };
 
 inline

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2009-01-23 11:03:00 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2009-03-12 10:45:04 +0000
@@ -509,7 +509,8 @@ MgmApiSession::get_nodeid(Parser_t::Cont
     while (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype, 
                                    (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/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2008-08-08 09:40:47 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2009-03-12 10:45:04 +0000
@@ -501,7 +501,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;
 }
@@ -1413,7 +1413,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;
@@ -2813,7 +2813,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;
@@ -3950,7 +3950,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()));
@@ -3964,7 +3964,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()));
@@ -5066,7 +5066,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;
 }
 
@@ -5147,7 +5147,7 @@ NdbFileImpl::NdbFileImpl(NdbDictionary::
 {
   m_size = 0;
   m_free = 0;
-  m_filegroup_id = ~0;
+  m_filegroup_id = RNIL;
   m_filegroup_version = ~0;
 }
 
@@ -6491,7 +6491,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	2008-11-11 11:40:42 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2009-02-25 15:59:27 +0000
@@ -627,15 +627,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 {
@@ -1109,15 +1106,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;
   }
@@ -1128,7 +1124,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
@@ -1167,7 +1163,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);
@@ -1189,12 +1185,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);
     /**
@@ -1210,7 +1206,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/ndberror.c'
--- a/storage/ndb/src/ndbapi/ndberror.c	2009-02-09 13:34:12 +0000
+++ b/storage/ndb/src/ndbapi/ndberror.c	2009-03-12 10:45:04 +0000
@@ -288,6 +288,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

=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp	2008-08-21 22:05:42 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp	2009-02-27 13:18:49 +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;

=== added file 'storage/ndb/test/run-test/check-tests.sh'
--- a/storage/ndb/test/run-test/check-tests.sh	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/test/run-test/check-tests.sh	2009-02-20 14:39:37 +0000
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+set -e
+
+files="daily-basic-tests.txt daily-devel-tests.txt upgrade-tests.txt"
+
+die(){
+    echo "error at $1 : $2"
+    exit 1
+}
+
+check_state(){
+    if  [ $1 != $2 ]
+    then
+	die $3 $4
+    fi
+}
+
+check_file(){
+    file=$1
+    lineno=0
+    testcase=0
+
+    echo -n "-- checking $file..."
+    cat $file | awk '{ print "^" $0 "$";}' | while read line
+    do
+	lineno=$(expr $lineno + 1)
+	if [ $(echo $line | grep -c "^^#") -ne 0 ]
+	then
+	    continue
+	fi
+	
+	case "$line" in
+	    ^max-time*)
+		testcase=$(expr $testcase + 1);;
+	    ^cmd*)
+		testcase=$(expr $testcase + 2);;
+	    ^args*)
+		testcase=$(expr $testcase + 4);;
+	    ^type*)
+		;;
+	    ^$) 
+                if [ $testcase -ne 7 ]
+		then
+		    die $file $lineno
+		else
+		    testcase=0
+		    cnt=$(expr $cnt + 1)
+		fi;;
+	    *)
+	        die $file $lineno
+	esac
+   done
+   echo "ok"
+}
+   
+for file in $files
+do
+    check_file $file
+done

=== modified file 'storage/ndb/test/run-test/conf-dl145a.cnf'
--- a/storage/ndb/test/run-test/conf-dl145a.cnf	2007-06-04 08:32:32 +0000
+++ b/storage/ndb/test/run-test/conf-dl145a.cnf	2009-02-17 07:52:13 +0000
@@ -24,3 +24,6 @@ SendBufferMemory = 2M
 NoOfFragmentLogFiles = 4
 FragmentLogFileSize = 64M
 
+SharedGlobalMemory=256M
+InitialLogfileGroup=undo_buffer_size=64M;undofile01.dat:256M;undofile02.dat:128M
+InitialTablespace=datafile01.dat:128M;datafile02.dat:64M

=== modified file 'storage/ndb/test/run-test/conf-ndbmaster.cnf'
--- a/storage/ndb/test/run-test/conf-ndbmaster.cnf	2007-02-13 01:38:54 +0000
+++ b/storage/ndb/test/run-test/conf-ndbmaster.cnf	2009-02-17 07:52:13 +0000
@@ -21,3 +21,7 @@ BackupMemory = 64M
 MaxNoOfConcurrentScans = 100
 MaxNoOfSavedMessages= 1000
 SendBufferMemory = 2M
+
+SharedGlobalMemory=256M
+InitialLogfileGroup=undo_buffer_size=64M;undofile01.dat:256M;undofile02.dat:128M
+InitialTablespace=datafile01.dat:128M;datafile02.dat:64M

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2009-02-04 13:08:05 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2009-03-12 10:45:04 +0000
@@ -255,10 +255,30 @@ max-time: 500
 cmd: testBasic
 args: -n Bug20535
 
+#
+# INDEX
+#
+max-time: 1500
+cmd: testIndex
+args: -n CreateAll T1 T13 T14
+
+max-time: 3600
+cmd: testIndex
+args: -n InsertDelete T1 
+
+max-time: 3600
+cmd: testIndex
+args: -n CreateLoadDrop T1 
+
 max-time: 500
 cmd: testIndex
-args: -n Bug25059 -r 3000 T1
+args: -n MixedTransaction T1 
 
+max-time: 2500
+cmd: testIndex
+args: -n BuildDuring T6 
+
+#
 # SCAN TESTS
 #
 max-time: 500
@@ -517,10 +537,6 @@ max-time: 500
 cmd: testNodeRestart
 args: -n Bug15685 T1
 
-max-time: 500
-cmd: testNodeRestart
-args: -n Bug16772 T1
-
 #max-time: 500
 #cmd: testSystemRestart
 #args: -n Bug18385 T1
@@ -635,14 +651,6 @@ max-time: 1500
 cmd: testDict
 args: -n CreateInvalidTables 
 
-max-time: 1500
-cmd: testDict
-args: -n CreateTableWhenDbIsFull T6 
-
-max-time: 1500
-cmd: testDict
-args: -n CreateMaxTables T6 
-
 max-time: 500
 cmd: testDict
 args: -n FragmentTypeSingle T1 
@@ -669,10 +677,6 @@ args: -n Bug21755 T1
 
 max-time: 1500
 cmd: testDict
-args: -l 25 -n DictRestart T1
-
-max-time: 1500
-cmd: testDict
 args: -n TableAddAttrs
 
 max-time: 1500
@@ -702,10 +706,6 @@ args: -n MaxTransactions T1 T6 T13 
 
 max-time: 500
 cmd: testNdbApi
-args: -n MaxOperations T1 T6 T13 
-
-max-time: 500
-cmd: testNdbApi
 args: -n MaxGetValue T1 T6 T13 
 
 max-time: 500
@@ -840,7 +840,7 @@ max-time: 1500
 cmd: testSystemRestart
 args: -n basic T1 
 
-max-time: 1500
+max-time: 2500
 cmd: testSystemRestart
 args: -n SR1 T1 
 
@@ -880,17 +880,22 @@ max-time: 1500
 cmd: testSystemRestart
 args: -n SR_UNDO T6 
 
-max-time: 1000
-cmd: testSRBank
-args: -n SR -l 300 -r 15 T1
+#
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR6 T1 
 
-max-time: 1000
-cmd: testSRBank
-args: -n NR -l 300 -r 15 T1
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR7 T1 
 
-max-time: 1000
-cmd: testSRBank
-args: -n Mix -l 300 -r 15 T1
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR8 T1 
+
+max-time: 1500
+cmd: testSystemRestart
+args: -l 1 -n SR9 T1 
 
 max-time: 300
 cmd: testNodeRestart
@@ -916,10 +921,77 @@ max-time: 1000
 cmd: test_event
 args: -l 10 -n Bug27169 T1
 
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --separate-events --blob-version 1
+
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --separate-events
+
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --no-multiops --blob-version 1
+
+#
+max-time: 600
+cmd: test_event_merge
+args: --no-implicit-nulls --no-multiops
+
+max-time: 600
+cmd: testBasic
+args: -n PkRead T1
+
 max-time: 300
 cmd: testNodeRestart
 args: -n Bug31980 T1
 
+max-time: 2500
+cmd: testNodeRestart
+args: -n CommittedRead T1
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNode T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n LateCommit T1
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartMasterNodeError T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodes T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesAbort T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartAllNodesError9999 T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n RestartRandomNodeInitial T6 T13 
+
+max-time: 2500
+cmd: testNodeRestart
+args: -n NoLoad T6
+
+#
+# MGMAPI AND MGSRV
+#
+max-time: 1800
+cmd: testMgm
+args: -n SingleUserMode T1 
+
 # OLD FLEX
 max-time: 500
 cmd: flexBench
@@ -929,6 +1001,10 @@ max-time: 500
 cmd: flexHammer
 args: -r 5 -t 32 
 
+max-time: 2500
+cmd: testNodeRestart
+args: -n NF_Hammer -r 5 T1
+
 max-time: 300
 cmd: DbCreate
 args:
@@ -1078,7 +1154,7 @@ max-time: 300
 cmd: test_event
 args: -n Bug31701 T1
 
-max-time: 300
+max-time: 600
 cmd: testSystemRestart
 args: -n Bug22696 T1
 
@@ -1099,10 +1175,6 @@ cmd: testNodeRestart
 args: -n mixedmultiop T1 I2 I3 D2
 
 max-time: 600
-cmd: test_event
-args: -l 1 -n SubscribeNR T1
-
-max-time: 600
 cmd: testNodeRestart
 args: -n Bug34702 T1
 

=== modified file 'storage/ndb/test/run-test/daily-devel-tests.txt'
--- a/storage/ndb/test/run-test/daily-devel-tests.txt	2008-12-03 19:44:54 +0000
+++ b/storage/ndb/test/run-test/daily-devel-tests.txt	2009-02-27 13:18:49 +0000
@@ -1,33 +1,41 @@
 #
-# INDEX
+# BACKUP
 #
+max-time: 1000
+cmd: atrt-testBackup
+args: -n BackupBank T6 
+
+max-time: 500
+cmd: testNdbApi
+args: -n MaxOperations T1 T6 T13 
+
 max-time: 1500
-cmd: testIndex
-args: -n CreateAll T1 T13 T14
+cmd: testDict
+args: -n CreateTableWhenDbIsFull T6 
 
-#-m 7200 1: testIndex -n InsertDeleteGentle T6
-max-time: 3600
-cmd: testIndex
-args: -n InsertDelete T1 
+max-time: 1500
+cmd: testDict
+args: -n CreateMaxTables T6 
 
-#-m 3600 1: testIndex -n CreateLoadDropGentle T6
-max-time: 3600
+max-time: 1500
+cmd: testDict
+args: -l 25 -n DictRestart T1
+
+max-time: 500
 cmd: testIndex
-args: -n CreateLoadDrop T1 
+args: -n Bug25059 -r 3000 T1
 
-#
-# BACKUP
-#
 max-time: 1000
-cmd: atrt-testBackup
-args: -n BackupBank T6 
+cmd: testSRBank
+args: -n SR -l 300 -r 15 T1
 
-#
-# MGMAPI AND MGSRV
-#
-max-time: 1800
-cmd: testMgm
-args: -n SingleUserMode T1 
+max-time: 1000
+cmd: testSRBank
+args: -n NR -l 300 -r 15 T1
+
+max-time: 1000
+cmd: testSRBank
+args: -n Mix -l 300 -r 15 T1
 
 #
 #
@@ -51,10 +59,6 @@ args: -n SR_FULLDB T6 
 #
 max-time: 2500
 cmd: testNodeRestart
-args: -n NoLoad T6
-
-max-time: 2500
-cmd: testNodeRestart
 args: -n MixedPkRead T6 T13 
 
 max-time: 2500
@@ -67,14 +71,6 @@ args: -l 1 -n MixedReadUpdateScan 
 
 max-time: 2500
 cmd: testNodeRestart
-args: -n CommittedRead T1
-
-max-time: 2500
-cmd: testNodeRestart
-args: -n LateCommit T1
-
-max-time: 2500
-cmd: testNodeRestart
 args: -n Terror T6 T13 
 
 max-time: 2500
@@ -83,24 +79,12 @@ args: -n FullDb T6 T13 
 
 max-time: 2500
 cmd: testNodeRestart
-args: -n RestartRandomNode T6 T13 
-
-max-time: 2500
-cmd: testNodeRestart
 args: -n RestartRandomNodeError T6 T13 
 
-max-time: 2500
-cmd: testNodeRestart
-args: -n RestartRandomNodeInitial T6 T13 
-
 max-time: 3600
 cmd: testNodeRestart
 args: -l 1 -n RestartNFDuringNR T6 T13 
 
-max-time: 2500
-cmd: testNodeRestart
-args: -n RestartMasterNodeError T6 T13 
-
 max-time: 3600
 cmd: testNodeRestart
 args: -n RestartNodeDuringLCP T6 
@@ -119,23 +103,11 @@ args: -n FiftyPercentFail T6 T13 
 
 max-time: 2500
 cmd: testNodeRestart
-args: -n RestartAllNodes T6 T13 
-
-max-time: 2500
-cmd: testNodeRestart
-args: -n RestartAllNodesAbort T6 T13 
-
-max-time: 2500
-cmd: testNodeRestart
-args: -n RestartAllNodesError9999 T6 T13 
-
-max-time: 2500
-cmd: testNodeRestart
 args: -n FiftyPercentStopAndWait T6 T13 
 
-max-time: 2500
+max-time: 500
 cmd: testNodeRestart
-args: -n NF_Hammer -r 5 T1
+args: -n Bug16772 T1
 
 #max-time: 500
 #cmd: testNodeRestart
@@ -156,10 +128,6 @@ args: -n NFNR3 T6 T13 
 
 max-time: 2500
 cmd: testIndex
-args: -n BuildDuring T6 
-
-max-time: 2500
-cmd: testIndex
 args: -l 2 -n SR1 T6 T13 
 
 max-time: 2500
@@ -182,32 +150,11 @@ max-time: 2500
 cmd: testIndex
 args: -l 2 -n SR1_O T6 T13 
 
-max-time: 500
-cmd: testIndex
-args: -n MixedTransaction T1 
-
 max-time: 2500
 cmd: testDict
 args: -n NF1 T1 T6 T13 
 
 #
-max-time: 1500
-cmd: testSystemRestart
-args: -l 1 -n SR6 T1 
-
-max-time: 1500
-cmd: testSystemRestart
-args: -l 1 -n SR7 T1 
-
-max-time: 1500
-cmd: testSystemRestart
-args: -l 1 -n SR8 T1 
-
-max-time: 1500
-cmd: testSystemRestart
-args: -l 1 -n SR9 T1 
-
-#
 max-time: 3600
 cmd: test_event
 args: -n EventOperationApplier -l 2
@@ -227,32 +174,12 @@ max-time: 2500
 cmd: test_event
 args: -n Multi
 
+max-time: 600
+cmd: test_event
+args: -l 1 -n SubscribeNR T1
+
 #
 max-time: 3600
 cmd: test_event
 args: -n CreateDropNR -l 1
 
-#
-max-time: 600
-cmd: test_event_merge
-args: --no-implicit-nulls --separate-events --blob-version 1
-
-#
-max-time: 600
-cmd: test_event_merge
-args: --no-implicit-nulls --separate-events
-
-#
-max-time: 600
-cmd: test_event_merge
-args: --no-implicit-nulls --no-multiops --blob-version 1
-
-#
-max-time: 600
-cmd: test_event_merge
-args: --no-implicit-nulls --no-multiops
-
-max-time: 600
-cmd: testBasic
-args: -n PkRead T1
-

=== modified file 'storage/ndb/test/src/NdbBackup.cpp'
--- a/storage/ndb/test/src/NdbBackup.cpp	2008-12-11 09:43:11 +0000
+++ b/storage/ndb/test/src/NdbBackup.cpp	2009-02-23 12:37:14 +0000
@@ -150,28 +150,30 @@ NdbBackup::execRestore(bool _restore_dat
   int res = system(tmp.c_str());  
   
   ndbout << "scp res: " << res << endl;
-  
-  tmp.assfmt("%sndb_restore -c \"%s:%d\" -n %d -b %d %s %s .", 
+
+  if (res == 0 && _restore_meta)
+  {
+    /** don't restore DD objects */
+    
+    tmp.assfmt("%sndb_restore -c \"%s:%d\" -n %d -b %d -m -d .", 
 #if 1
-             "",
+               "",
 #else
-             "valgrind --leak-check=yes -v "
+               "valgrind --leak-check=yes -v "
 #endif
-             ndb_mgm_get_connected_host(handle),
-             ndb_mgm_get_connected_port(handle),
-             _node_id, 
-             _backup_id,
-             _restore_data?"-r":"",
-             _restore_meta?"-m":"");
+               ndb_mgm_get_connected_host(handle),
+               ndb_mgm_get_connected_port(handle),
+               _node_id, 
+               _backup_id);
+    
+    ndbout << "buf: "<< tmp.c_str() <<endl;
+    res = system(tmp.c_str());
+  }
   
-  ndbout << "buf: "<< tmp.c_str() <<endl;
-  res = system(tmp.c_str());
-
-  if (res && _restore_meta)
+  if (res == 0 && _restore_data)
   {
-    /** try once wo/ restoring DD objects */
 
-    tmp.assfmt("%sndb_restore -c \"%s:%d\" -n %d -b %d -d %s %s .", 
+    tmp.assfmt("%sndb_restore -c \"%s:%d\" -n %d -b %d -r .", 
 #if 1
                "",
 #else
@@ -180,9 +182,7 @@ NdbBackup::execRestore(bool _restore_dat
                ndb_mgm_get_connected_host(handle),
                ndb_mgm_get_connected_port(handle),
                _node_id, 
-               _backup_id,
-               _restore_data?"-r":"",
-               _restore_meta?"-m":"");
+               _backup_id);
     
     ndbout << "buf: "<< tmp.c_str() <<endl;
     res = system(tmp.c_str());

=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2008-08-12 18:56:42 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2009-03-12 10:45:04 +0000
@@ -882,7 +882,7 @@ BackupFile::setCtlFile(Uint32 nodeId, Ui
   m_expectedFileHeader.FileType = BackupFormat::CTL_FILE;
 
   char name[PATH_MAX]; const Uint32 sz = sizeof(name);
-  BaseString::snprintf(name, sz, "BACKUP-%d.%d.ctl", backupId, nodeId);  
+  BaseString::snprintf(name, sz, "BACKUP-%u.%d.ctl", backupId, nodeId);  
   setName(path, name);
 }
 
@@ -893,7 +893,7 @@ BackupFile::setDataFile(const BackupFile
   m_expectedFileHeader.FileType = BackupFormat::DATA_FILE;
   
   char name[PATH_MAX]; const Uint32 sz = sizeof(name);
-  BaseString::snprintf(name, sz, "BACKUP-%d-%d.%d.Data", 
+  BaseString::snprintf(name, sz, "BACKUP-%u-%d.%d.Data", 
 	   m_expectedFileHeader.BackupId, no, m_nodeId);
   setName(bf.m_path, name);
 }
@@ -905,7 +905,7 @@ BackupFile::setLogFile(const BackupFile 
   m_expectedFileHeader.FileType = BackupFormat::LOG_FILE;
   
   char name[PATH_MAX]; const Uint32 sz = sizeof(name);
-  BaseString::snprintf(name, sz, "BACKUP-%d.%d.log", 
+  BaseString::snprintf(name, sz, "BACKUP-%u.%d.log", 
 	   m_expectedFileHeader.BackupId, m_nodeId);
   setName(bf.m_path, name);
 }

=== modified file 'storage/ndb/tools/restore/restore_main.cpp'
--- a/storage/ndb/tools/restore/restore_main.cpp	2008-08-12 18:56:42 +0000
+++ b/storage/ndb/tools/restore/restore_main.cpp	2009-03-12 10:45:04 +0000
@@ -694,7 +694,7 @@ main(int argc, char** argv)
     exitHandler(NDBT_FAILED);
   }
 
-  g_options.appfmt(" -b %d", ga_backupId);
+  g_options.appfmt(" -b %u", ga_backupId);
   g_options.appfmt(" -n %d", ga_nodeId);
   if (_restore_meta)
     g_options.appfmt(" -m");

Thread
bzr commit into mysql-6.0-ndb branch (tomas.ulin:2853) Tomas Ulin12 Mar