=== modified file 'storage/ndb/include/mgmapi/mgmapi.h'
--- a/storage/ndb/include/mgmapi/mgmapi.h	2008-04-07 10:26:34 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi.h	2008-08-07 04:13:41 +0000
@@ -444,10 +444,6 @@
   int ndb_mgm_number_of_mgmd_in_connect_string(NdbMgmHandle handle);
 
   int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid);
-  int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
-  int ndb_mgm_get_connected_port(NdbMgmHandle handle);
-  const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
-  const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
 
   /**
    * Set local bindaddress

=== modified file 'storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/include/ndbapi/NdbIndexScanOperation.hpp	2008-08-07 01:34:35 +0000
@@ -307,7 +307,7 @@
 inline
 int
 NdbIndexScanOperation::setBound(const char* attr, int type, const void* value,
-                                Uint32 len)
+                                __attribute__((__unused__))Uint32 len)
 {
   return setBound(attr, type, value);
 }
@@ -315,7 +315,7 @@
 inline
 int
 NdbIndexScanOperation::setBound(Uint32 anAttrId, int type, const void* value,
-                                Uint32 len)
+                                __attribute__((__unused__))Uint32 len)
 {
   return setBound(anAttrId, type, value);
 }

=== modified file 'storage/ndb/include/ndbapi/NdbOperation.hpp'
--- a/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-06-17 20:28:45 +0000
+++ b/storage/ndb/include/ndbapi/NdbOperation.hpp	2008-08-07 01:42:03 +0000
@@ -1457,6 +1457,9 @@
 int
 NdbOperation::checkMagicNumber(bool b)
 {
+#ifndef NDB_NO_DROPPED_SIGNAL
+  (void)b;  // unused param in this context
+#endif
   if (theMagicNumber != 0xABCDEF01){
 #ifdef NDB_NO_DROPPED_SIGNAL
     if(b) abort();
@@ -1576,7 +1579,8 @@
 
 inline
 int
-NdbOperation::equal(const char* anAttrName, const char* aValue, Uint32 len)
+NdbOperation::equal(const char* anAttrName, const char* aValue,
+                    __attribute__((__unused__))Uint32 len)
 {
   return equal(anAttrName, aValue);
 }
@@ -1611,7 +1615,8 @@
 
 inline
 int
-NdbOperation::equal(Uint32 anAttrId, const char* aValue, Uint32 len)
+NdbOperation::equal(Uint32 anAttrId, const char* aValue,
+                    __attribute__((__unused__))Uint32 len)
 {
   return equal(anAttrId, aValue);
 }
@@ -1646,7 +1651,8 @@
 
 inline
 int
-NdbOperation::setValue(const char* anAttrName, const char* aValue, Uint32 len)
+NdbOperation::setValue(const char* anAttrName, const char* aValue,
+                       __attribute__((__unused__))Uint32 len)
 {
   return setValue(anAttrName, aValue);
 }
@@ -1695,7 +1701,8 @@
 
 inline
 int
-NdbOperation::setValue(Uint32 anAttrId, const char* aValue, Uint32 len)
+NdbOperation::setValue(Uint32 anAttrId, const char* aValue,
+                       __attribute__((__unused__))Uint32 len)
 {
   return setValue(anAttrId, aValue);
 }

=== modified file 'storage/ndb/include/ndbapi/NdbTransaction.hpp'
--- a/storage/ndb/include/ndbapi/NdbTransaction.hpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp	2008-08-07 01:34:35 +0000
@@ -1091,7 +1091,7 @@
 
 inline
 void
-NdbTransaction::set_send_size(Uint32 send_size)
+NdbTransaction::set_send_size(__attribute__((__unused__))Uint32 send_size)
 {
   return;
 }

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2008-08-07 11:52:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp	2008-08-07 12:32:06 +0000
@@ -1964,7 +1964,11 @@
 
   Uint32 RattroutCounter= 0;
   Uint32 RinstructionCounter= 5;
-  Uint32 RlogSize= 0;
+
+  /* All information to be logged/propagated to replicas
+   * is generated from here on so reset the log word count
+   */
+  Uint32 RlogSize= req_struct->log_size= 0;
   if (((RtotalLen + 5) == RattrinbufLen) &&
       (RattrinbufLen >= 5) &&
       (RattrinbufLen < ZATTR_BUFFER_SIZE)) {
@@ -2070,7 +2074,12 @@
 	return -1;
       }
     }
-    req_struct->log_size= RlogSize;
+    /* Add log words explicitly generated here to existing log size
+     *  - readAttributes can generate log for ANYVALUE column
+     *    It adds the words directly to req_struct->log_size
+     *    This is used for ANYVALUE and interpreted delete.
+     */
+    req_struct->log_size+= RlogSize;
     req_struct->read_length= RattroutCounter;
     sendReadAttrinfo(signal, req_struct, RattroutCounter, regOperPtr);
     if (RlogSize > 0) {

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp	2008-07-29 13:38:18 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvrConfig.cpp	2008-08-04 21:01:04 +0000
@@ -62,14 +62,14 @@
   _ownNodeId= m_config_retriever.allocNodeId(retry, delay);
   if (_ownNodeId == 0) {
     g_eventLogger->error(m_config_retriever.getErrorString());
-    DBUG_RETURN(NULL);
+    DBUG_RETURN(false);
   }
 
   // read config from other managent server
   struct ndb_mgm_configuration * tmp = m_config_retriever.getConfig();
   if (tmp == NULL) {
     g_eventLogger->error(m_config_retriever.getErrorString());
-    DBUG_RETURN(NULL);
+    DBUG_RETURN(false);
   }
 
   setConfig(new Config(tmp));

=== modified file 'storage/ndb/src/ndbapi/NdbOperationExec.cpp'
--- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp	2008-06-17 20:28:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp	2008-08-05 10:52:53 +0000
@@ -942,6 +942,28 @@
     }
   }
 
+  if (m_use_any_value && 
+      (tOpType == DeleteRequest))
+  {
+    /* Special hack for delete and ANYVALUE pseudo-column
+     * We want to be able set the ANYVALUE pseudo-column as
+     * part of a delete, but deletes don't allow updates
+     * So we perform a 'read' of the column, passing a value.
+     * Code in TUP which handles this 'read' will set the
+     * value when the read is processed.
+     */
+    res= insertATTRINFOHdr_NdbRecord(aTC_ConnectPtr, aTransId,
+                                     AttributeHeader::ANY_VALUE, 4,
+                                     &attrInfoPtr, &remain);
+    if(res)
+      return res;
+    res= insertATTRINFOData_NdbRecord(aTC_ConnectPtr, aTransId,
+                                      (const char *)(&m_any_value), 4,
+                                      &attrInfoPtr, &remain);
+    if(res)
+      return res;
+  }
+
   /* Interpreted program main signal words */
   if (code)
   {
@@ -1126,10 +1148,9 @@
 
   if ((tOpType == InsertRequest) ||
       (tOpType == WriteRequest) ||
-      (tOpType == UpdateRequest) ||
-      (tOpType == DeleteRequest))
+      (tOpType == UpdateRequest))
   {
-    /* Handle any setAnyValue(). */
+    /* Handle setAnyValue() for all cases except delete */
     if (m_use_any_value)
     {
       res= insertATTRINFOHdr_NdbRecord(aTC_ConnectPtr, aTransId,

=== modified file 'storage/ndb/src/ndbapi/NdbScanFilter.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanFilter.cpp	2008-05-29 15:06:11 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanFilter.cpp	2008-08-06 15:46:41 +0000
@@ -75,7 +75,11 @@
     m_code= code;
     m_associated_op= NULL;
     
-    m_error.code = 0;
+    if (code == NULL)
+      /* NdbInterpretedCode not supported for operation type */
+      m_error.code = 4539;
+    else
+      m_error.code = 0;
   };
 
   /* This method propagates an error code from NdbInterpretedCode
@@ -136,13 +140,22 @@
 {
   DBUG_ENTER("NdbScanFilter::NdbScanFilter(NdbOperation)");
   
-  /* We ask the NdbScanOperation to allocate an InterpretedCode
-   * object for us.  It will look after freeing it when 
-   * necessary.  This allows the InterpretedCode object to 
-   * survive after the NdbScanFilter has gone out of scope
+  NdbInterpretedCode* code= NULL;
+  NdbOperation::Type opType= op->getType();
+
+  /* If the operation is not of the correct type then
+   * m_impl.init() will set an error on the scan filter
    */
-  NdbInterpretedCode* code= 
-    ((NdbScanOperation *)op)->allocInterpretedCodeOldApi();
+  if (likely((opType == NdbOperation::TableScan) || 
+             (opType == NdbOperation::OrderedIndexScan)))
+  {    
+    /* We ask the NdbScanOperation to allocate an InterpretedCode
+     * object for us.  It will look after freeing it when 
+     * necessary.  This allows the InterpretedCode object to 
+     * survive after the NdbScanFilter has gone out of scope
+     */
+    code= ((NdbScanOperation *)op)->allocInterpretedCodeOldApi();
+  }
 
   m_impl.init(code);
 
@@ -158,6 +171,8 @@
 
 int
 NdbScanFilter::begin(Group group){
+  if (m_impl.m_error.code != 0) return -1;
+
   if (m_impl.m_stack2.push_back(m_impl.m_negative))
   {
     /* Memory allocation problem */
@@ -244,6 +259,8 @@
 
 int
 NdbScanFilter::end(){
+  if (m_impl.m_error.code != 0) return -1;
+
   if(m_impl.m_stack2.size() == 0){
     /* Invalid set of range scan bounds */
     m_impl.m_error.code= 4259;
@@ -353,6 +370,8 @@
 
 int
 NdbScanFilter::istrue(){
+  if(m_impl.m_error.code != 0) return -1;
+
   if(m_impl.m_current.m_group < NdbScanFilter::AND || 
      m_impl.m_current.m_group > NdbScanFilter::NOR){
     /* Operator is not defined in NdbScanFilter::Group */
@@ -373,6 +392,7 @@
 
 int
 NdbScanFilter::isfalse(){
+  if (m_impl.m_error.code != 0) return -1;
   if(m_impl.m_current.m_group < NdbScanFilter::AND || 
      m_impl.m_current.m_group > NdbScanFilter::NOR){
     /* Operator is not defined in NdbScanFilter::Group */
@@ -436,6 +456,8 @@
 int
 NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){
   
+  if (m_error.code != 0) return -1;
+
   if(op < 0 || op >= tab2_sz){
     /* Condition is out of bounds */
     m_error.code= 4262;
@@ -458,6 +480,8 @@
 
 int
 NdbScanFilter::isnull(int AttrId){
+  if (m_impl.m_error.code != 0) return -1;
+
   if(m_impl.m_negative == 1)
     return m_impl.cond_col(Interpreter::IS_NOT_NULL, AttrId);
   else
@@ -466,6 +490,8 @@
 
 int
 NdbScanFilter::isnotnull(int AttrId){
+  if (m_impl.m_error.code != 0) return -1;
+
   if(m_impl.m_negative == 1)
     return m_impl.cond_col(Interpreter::IS_NULL, AttrId);
   else
@@ -568,6 +594,8 @@
 NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op, 
 				  Uint32 AttrId, 
 				  const void * value, Uint32 len){
+  if (m_error.code != 0) return -1;
+
   if(op < 0 || op >= tab3_sz){
     /* Condition is out of bounds */
     m_error.code= 4262;

=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2008-06-17 20:28:45 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp	2008-08-06 15:46:41 +0000
@@ -53,7 +53,7 @@
   theSCAN_TABREQ = 0;
   m_executed = false;
   m_scan_buffer= NULL;
-  m_scanUsingOldApi= false;
+  m_scanUsingOldApi= true;
   m_interpretedCodeOldApi= NULL;
 }
 
@@ -119,7 +119,7 @@
   m_descending= false;
   m_read_range_no = 0;
   m_executed = false;
-  m_scanUsingOldApi= false;
+  m_scanUsingOldApi= true;
   m_interpretedCodeOldApi= NULL;
 
   m_api_receivers_count = 0;
@@ -937,16 +937,14 @@
                              Uint32 parallel,
                              Uint32 batch)
 {
-  // It is only possible to call readTuples if 
-  //  1. the scan transaction doesn't already  contain another scan operation
-  //  2. We have not already defined an old Api scan operation.
-  if (theNdbCon->theScanningOp != NULL ||
-      m_scanUsingOldApi ){
+  // It is only possible to call readTuples if the scan transaction 
+  // doesn't already contain a scan operation
+  if (theNdbCon->theScanningOp != NULL)
+  {
     setErrorCode(4605);
     return -1;
   }
-
-  m_scanUsingOldApi= true;
+  
   /* Save parameters for later */
   m_savedLockModeOldApi= lm;
   m_savedScanFlagsOldApi= scan_flags;

=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-06-03 16:18:01 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-08-06 15:39:54 +0000
@@ -2583,6 +2583,8 @@
     DBUG_RETURN(NULL);
   }
 
+  op_idx->m_scanUsingOldApi= false;
+
   /* The real work is done in NdbScanOperation */
   if (op_idx->scanTableImpl(result_record,
                             lock_mode,
@@ -2622,6 +2624,8 @@
     return NULL;
   }
 
+  op->m_scanUsingOldApi= false;
+
   /* Defer the rest of the work to NdbIndexScanOperation */
   if (op->scanIndexImpl(key_record,
                         result_record,

=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp	2008-07-25 11:28:05 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp	2008-08-04 20:59:33 +0000
@@ -145,7 +145,7 @@
   }
 
   /* Remove old signals from usedBuffer */
-  for (int i= 0; i < m_usedBuffer.size(); i++)
+  for (unsigned i= 0; i < m_usedBuffer.size(); i++)
     delete m_usedBuffer[i];
   m_usedBuffer.clear();
 

=== modified file 'storage/ndb/test/include/NDBT_Test.hpp'
--- a/storage/ndb/test/include/NDBT_Test.hpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/include/NDBT_Test.hpp	2008-08-04 13:40:17 +0000
@@ -483,7 +483,10 @@
   pt->m_all_tables= true;
 
 #define NDBT_TESTSUITE_END(suitname) \
- } } ; C##suitname suitname
+ } } ; 
+
+#define NDBT_TESTSUITE_INSTANCE(suitname) \
+  C##suitname suitname
 
 // Helper functions for retrieving variables from NDBT_Step
 #define GETNDB(ps) ((NDBT_Step*)ps)->getNdb()

=== modified file 'storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp'
--- a/storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/ndbapi/acrt/NdbRepStress.cpp	2008-08-04 13:40:17 +0000
@@ -474,6 +474,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(NdbRepStress);
   NdbRepStress.setCreateAllTables(true);
   return NdbRepStress.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/ndbapi/bank/testBank.cpp'
--- a/storage/ndb/test/ndbapi/bank/testBank.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/bank/testBank.cpp	2008-08-04 13:40:17 +0000
@@ -144,6 +144,7 @@
 int main(int argc, const char** argv){
   ndb_init();
   // Tables should not be auto created
+  NDBT_TESTSUITE_INSTANCE(testBank);
   testBank.setCreateTable(false);
 
   return testBank.execute(argc, argv);

=== modified file 'storage/ndb/test/ndbapi/testBackup.cpp'
--- a/storage/ndb/test/ndbapi/testBackup.cpp	2008-03-03 11:12:37 +0000
+++ b/storage/ndb/test/ndbapi/testBackup.cpp	2008-08-04 13:40:17 +0000
@@ -579,6 +579,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testBackup);
   return testBackup.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testBasic.cpp'
--- a/storage/ndb/test/ndbapi/testBasic.cpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/ndbapi/testBasic.cpp	2008-08-04 13:40:17 +0000
@@ -1840,6 +1840,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testBasic);
   return testBasic.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testBasicAsynch.cpp'
--- a/storage/ndb/test/ndbapi/testBasicAsynch.cpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/ndbapi/testBasicAsynch.cpp	2008-08-04 13:40:17 +0000
@@ -179,6 +179,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testBasicAsynch);
   return testBasicAsynch.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testDict.cpp'
--- a/storage/ndb/test/ndbapi/testDict.cpp	2008-07-01 16:16:30 +0000
+++ b/storage/ndb/test/ndbapi/testDict.cpp	2008-08-07 12:32:06 +0000
@@ -6552,6 +6552,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testDict);
   // Tables should not be auto created
   testDict.setCreateTable(false);
   myRandom48Init(NdbTick_CurrentMillisecond());

=== modified file 'storage/ndb/test/ndbapi/testIndex.cpp'
--- a/storage/ndb/test/ndbapi/testIndex.cpp	2008-03-25 14:17:03 +0000
+++ b/storage/ndb/test/ndbapi/testIndex.cpp	2008-08-04 13:40:17 +0000
@@ -1752,6 +1752,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testIndex);
   return testIndex.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testInterpreter.cpp'
--- a/storage/ndb/test/ndbapi/testInterpreter.cpp	2008-06-18 14:55:21 +0000
+++ b/storage/ndb/test/ndbapi/testInterpreter.cpp	2008-08-04 13:40:17 +0000
@@ -482,6 +482,7 @@
 int main(int argc, const char** argv){
   ndb_init();
   //  TABLE("T1");
+  NDBT_TESTSUITE_INSTANCE(testInterpreter);
   return testInterpreter.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testLimits.cpp'
--- a/storage/ndb/test/ndbapi/testLimits.cpp	2008-07-01 12:35:34 +0000
+++ b/storage/ndb/test/ndbapi/testLimits.cpp	2008-08-04 13:40:17 +0000
@@ -824,5 +824,6 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testLimits);
   return testLimits.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/ndbapi/testMgm.cpp'
--- a/storage/ndb/test/ndbapi/testMgm.cpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/ndbapi/testMgm.cpp	2008-08-04 13:40:17 +0000
@@ -682,6 +682,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testMgm);
   testMgm.setCreateTable(false);
   testMgm.setRunAllTables(true);
   return testMgm.execute(argc, argv);

=== modified file 'storage/ndb/test/ndbapi/testNDBT.cpp'
--- a/storage/ndb/test/ndbapi/testNDBT.cpp	2008-03-03 15:10:42 +0000
+++ b/storage/ndb/test/ndbapi/testNDBT.cpp	2008-08-04 13:40:17 +0000
@@ -180,6 +180,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testNDBT);
   return testNDBT.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp	2008-06-03 12:37:17 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp	2008-08-04 13:40:17 +0000
@@ -1844,6 +1844,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testNdbApi);
   //  TABLE("T1");
   return testNdbApi.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/ndbapi/testNodeRestart.cpp'
--- a/storage/ndb/test/ndbapi/testNodeRestart.cpp	2008-04-25 07:20:39 +0000
+++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp	2008-08-04 13:40:17 +0000
@@ -3644,6 +3644,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testNodeRestart);
 #if 0
   // It might be interesting to have longer defaults for num
   // loops in this test

=== modified file 'storage/ndb/test/ndbapi/testPartitioning.cpp'
--- a/storage/ndb/test/ndbapi/testPartitioning.cpp	2008-07-22 13:27:57 +0000
+++ b/storage/ndb/test/ndbapi/testPartitioning.cpp	2008-08-04 13:40:17 +0000
@@ -622,6 +622,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testPartitioning);
   testPartitioning.setCreateTable(false);
   return testPartitioning.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/ndbapi/testRestartGci.cpp'
--- a/storage/ndb/test/ndbapi/testRestartGci.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/testRestartGci.cpp	2008-08-04 13:40:17 +0000
@@ -215,6 +215,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testRestartGci);
   return testRestartGci.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testSRBank.cpp'
--- a/storage/ndb/test/ndbapi/testSRBank.cpp	2008-04-28 15:17:02 +0000
+++ b/storage/ndb/test/ndbapi/testSRBank.cpp	2008-08-04 13:40:17 +0000
@@ -291,6 +291,7 @@
       break;
     }
   } 
+  NDBT_TESTSUITE_INSTANCE(testSRBank);
   return testSRBank.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testScan.cpp'
--- a/storage/ndb/test/ndbapi/testScan.cpp	2008-04-28 14:17:28 +0000
+++ b/storage/ndb/test/ndbapi/testScan.cpp	2008-08-04 13:40:17 +0000
@@ -1730,6 +1730,7 @@
 int main(int argc, const char** argv){
   ndb_init();
   myRandom48Init(NdbTick_CurrentMillisecond());
+  NDBT_TESTSUITE_INSTANCE(testScan);
   return testScan.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testScanFilter.cpp'
--- a/storage/ndb/test/ndbapi/testScanFilter.cpp	2008-02-19 15:00:29 +0000
+++ b/storage/ndb/test/ndbapi/testScanFilter.cpp	2008-08-06 15:46:41 +0000
@@ -894,6 +894,132 @@
   return NDBT_OK;
 }
 
+
+int runScanFilterConstructorFail(NDBT_Context* ctx, NDBT_Step* step)
+{
+  /* We test that failures in the ScanFilter constructor can be
+   * detected by the various ScanFilter methods without
+   * issues
+   */
+  Ndb *myNdb = GETNDB(step);
+  const NdbDictionary::Dictionary* myDict= myNdb->getDictionary();
+  const NdbDictionary::Table *myTable= myDict->getTable(TABLE_NAME);
+  if(myTable == NULL) 
+    APIERROR(myDict->getNdbError());
+
+  NdbTransaction* trans=myNdb->startTransaction();
+  
+  if (trans == NULL)
+  {
+    APIERROR(trans->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  /* Create an NdbRecord scan operation */
+  const NdbScanOperation* tabScan=
+    trans->scanTable(myTable->getDefaultRecord());
+  
+  if (tabScan==NULL)
+  {
+    APIERROR(trans->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  /* Now we hackily try to add a ScanFilter after the operation
+   * is defined.  This will cause a failure within the 
+   * constructor
+   */
+  NdbScanFilter brokenSf((NdbScanOperation*) tabScan);
+
+  /* Scan operation should have an error */
+  if (tabScan->getNdbError().code != 4536)
+  {
+    ndbout << "Expected error 4536, had error " << 
+      tabScan->getNdbError().code << " instead" << endl;
+    return NDBT_FAILED;
+  }
+
+  /* ScanFilter should have an error */
+  if (brokenSf.getNdbError().code != 4539)
+  {
+    ndbout  << "Expected error 4539, had error " << 
+      brokenSf.getNdbError().code << " instead" << endl;
+    return NDBT_FAILED;
+  }
+  
+  if (brokenSf.begin() != -1)
+  { ndbout << "Bad rc from begin" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.istrue() != -1)
+  { ndbout << "Bad rc from istrue" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.isfalse() != -1)
+  { ndbout << "Bad rc from isfalse" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.isnull(0) != -1)
+  { ndbout << "Bad rc from isnull" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.isnotnull(0) != -1)
+  { ndbout << "Bad rc from isnotnull" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.cmp(NdbScanFilter::COND_EQ, 0, NULL, 0) != -1)
+  { ndbout << "Bad rc from cmp" << endl; return NDBT_FAILED; }
+
+  if (brokenSf.end() != -1)
+  { ndbout << "Bad rc from begin" << endl; return NDBT_FAILED; }
+
+  trans->close();
+
+  /* Now we check that we can define a ScanFilter before 
+   * calling readTuples() for a scan operation
+   */
+  trans= myNdb->startTransaction();
+  
+  if (trans == NULL)
+  {
+    APIERROR(trans->getNdbError());
+    return NDBT_FAILED;
+  }
+  
+  /* Get an old Api table scan operation */
+  NdbScanOperation* tabScanOp=
+    trans->getNdbScanOperation(myTable);
+
+  if (tabScanOp==NULL)
+  {
+    APIERROR(trans->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  /* Attempt to define a ScanFilter before calling readTuples() */
+  NdbScanFilter sf(tabScanOp);
+
+  /* Should be no problem ... */
+  if (sf.getNdbError().code != 0) 
+  { APIERROR(sf.getNdbError()); return NDBT_FAILED; };
+  
+ 
+  /* Ok, now attempt to define a ScanFilter against a primary key op */
+  NdbOperation* pkOp= trans->getNdbOperation(myTable);
+
+  if (pkOp == NULL)
+  {
+    APIERROR(trans->getNdbError());
+    return NDBT_FAILED;
+  }
+
+  NdbScanFilter sf2(pkOp);
+  
+  if (sf2.getNdbError().code != 4539)
+  {
+    ndbout << "Error, expected 4539" << endl;
+    APIERROR(sf2.getNdbError());
+    return NDBT_FAILED;
+  }
+
+  return NDBT_OK;
+}
+
 NDBT_TESTSUITE(testScanFilter);
 TESTCASE(TEST_NAME, 
 	 "Scan table TABLE_NAME for the records which accord with \
@@ -903,6 +1029,7 @@
   INITIALIZER(runPopulate);
   INITIALIZER(runScanRandomFilterTest);
   INITIALIZER(runMaxScanFilterSize);
+  INITIALIZER(runScanFilterConstructorFail);
   FINALIZER(runDropTables);
 }
 
@@ -918,6 +1045,7 @@
   {
     return NDBT_ProgramExit(NDBT_FAILED);
   }
-  
+
+  NDBT_TESTSUITE_INSTANCE(testScanFilter);  
   return testScanFilter.executeOneCtx(con, &MYTAB1, TEST_NAME);
 }

=== modified file 'storage/ndb/test/ndbapi/testScanInterpreter.cpp'
--- a/storage/ndb/test/ndbapi/testScanInterpreter.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/testScanInterpreter.cpp	2008-08-04 13:40:17 +0000
@@ -273,6 +273,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testScanInterpreter);
   return testScanInterpreter.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testSingleUserMode.cpp'
--- a/storage/ndb/test/ndbapi/testSingleUserMode.cpp	2008-06-23 12:52:49 +0000
+++ b/storage/ndb/test/ndbapi/testSingleUserMode.cpp	2008-08-04 13:40:17 +0000
@@ -176,6 +176,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testSingleUserMode);
   return testSingleUserMode.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testSystemRestart.cpp'
--- a/storage/ndb/test/ndbapi/testSystemRestart.cpp	2008-06-18 21:25:50 +0000
+++ b/storage/ndb/test/ndbapi/testSystemRestart.cpp	2008-08-04 13:40:17 +0000
@@ -2018,6 +2018,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testSystemRestart);
   return testSystemRestart.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testTimeout.cpp'
--- a/storage/ndb/test/ndbapi/testTimeout.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/test/ndbapi/testTimeout.cpp	2008-08-04 13:40:17 +0000
@@ -556,6 +556,7 @@
 int main(int argc, const char** argv){
   ndb_init();
   myRandom48Init(NdbTick_CurrentMillisecond());
+  NDBT_TESTSUITE_INSTANCE(testTimeout);
   return testTimeout.execute(argc, argv);
 }
 

=== modified file 'storage/ndb/test/ndbapi/testUpgrade.cpp'
--- a/storage/ndb/test/ndbapi/testUpgrade.cpp	2008-02-21 13:57:42 +0000
+++ b/storage/ndb/test/ndbapi/testUpgrade.cpp	2008-08-04 13:40:17 +0000
@@ -484,6 +484,7 @@
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(testUpgrade);
   testUpgrade.setCreateAllTables(true);
   return testUpgrade.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/ndbapi/test_event.cpp'
--- a/storage/ndb/test/ndbapi/test_event.cpp	2008-07-22 13:27:57 +0000
+++ b/storage/ndb/test/ndbapi/test_event.cpp	2008-08-05 10:52:53 +0000
@@ -23,14 +23,13 @@
 #include <NdbRestarts.hpp>
 #include <signaldata/DumpStateOrd.hpp>
 
-static int createEvent(Ndb *pNdb, 
+static int createEvent(Ndb *pNdb,
                        const NdbDictionary::Table &tab,
-                       NDBT_Context* ctx)
+                       bool merge_events,
+                       bool report)
 {
   char eventName[1024];
   sprintf(eventName,"%s_EVENT",tab.getName());
-  bool merge_events = ctx->getProperty("MergeEvents");
-  bool report = ctx->getProperty("ReportSubscribe");
 
   NdbDictionary::Dictionary *myDict = pNdb->getDictionary();
 
@@ -87,6 +86,16 @@
   return NDBT_OK;
 }
 
+static int createEvent(Ndb *pNdb, 
+                       const NdbDictionary::Table &tab,
+                       NDBT_Context* ctx)
+{
+  bool merge_events = ctx->getProperty("MergeEvents");
+  bool report = ctx->getProperty("ReportSubscribe");
+
+  return createEvent(pNdb, tab, merge_events, report);
+}
+
 static int dropEvent(Ndb *pNdb, const NdbDictionary::Table &tab)
 {
   char eventName[1024];
@@ -2688,6 +2697,346 @@
   return NDBT_OK;
 }
 
+const NdbDictionary::Table* createBoringTable(const char* name, Ndb* pNdb)
+{
+  NdbDictionary::Table tab;
+
+  tab.setName(name);
+
+  NdbDictionary::Column pk;
+  pk.setName("Key");
+  pk.setType(NdbDictionary::Column::Unsigned);
+  pk.setLength(1); 
+  pk.setNullable(false);
+  pk.setPrimaryKey(true);
+  tab.addColumn(pk);
+
+  NdbDictionary::Column attr;
+  attr.setName("Attr");
+  attr.setType(NdbDictionary::Column::Unsigned);
+  attr.setLength(1);
+  attr.setNullable(true);
+  attr.setPrimaryKey(false);
+  tab.addColumn(attr);
+  
+  pNdb->getDictionary()->dropTable(tab.getName());
+  if(pNdb->getDictionary()->createTable(tab) == 0)
+  {
+    ndbout << (NDBT_Table&)tab << endl;
+    return pNdb->getDictionary()->getTable(tab.getName());
+  }
+  
+  ndbout << "Table create failed, err : " << 
+    pNdb->getDictionary()->getNdbError().code << endl;
+  
+  return NULL;
+}
+
+/* Types of operation which can be tagged via 'setAnyValue */
+enum OpTypes {Insert, Update, Write, Delete, EndOfOpTypes};
+
+/** 
+ * executeOps
+ * Generate a number of PK operations of the supplied type
+ * using the passed operation options and setting the
+ * anyValue tag
+ */
+int
+executeOps(Ndb* pNdb,
+           const NdbDictionary::Table* tab,
+           OpTypes op, 
+           Uint32 rowCount,
+           Uint32 keyOffset,
+           Uint32 anyValueOffset,
+           NdbOperation::OperationOptions opts)
+{
+  NdbTransaction* trans= pNdb->startTransaction();
+  const NdbRecord* record= tab->getDefaultRecord();
+
+  char RowBuf[16];
+  Uint32* keyPtr= (Uint32*) NdbDictionary::getValuePtr(record,
+                                                       RowBuf,
+                                                       0);
+  Uint32* attrPtr= (Uint32*) NdbDictionary::getValuePtr(record,
+                                                       RowBuf,
+                                                       1);
+
+  for (Uint32 i=keyOffset; i < (keyOffset + rowCount); i++)
+  {
+    *keyPtr= *attrPtr= i;
+    opts.optionsPresent |= NdbOperation::OperationOptions::OO_ANYVALUE;
+    opts.anyValue= anyValueOffset + i;
+    bool allowInterpreted= 
+      (op == Update) ||
+      (op == Delete);
+
+    if (!allowInterpreted)
+      opts.optionsPresent &= 
+        ~ (Uint64) NdbOperation::OperationOptions::OO_INTERPRETED;
+
+    switch (op) {
+    case Insert : 
+      if (trans->insertTuple(record, 
+                             RowBuf, 
+                             NULL,
+                             &opts, 
+                             sizeof(opts)) == NULL)
+      {
+        g_err << "Can't create operation : " <<
+          trans->getNdbError().code << endl;
+        return NDBT_FAILED;
+      }
+      break;
+    case Update :
+      if (trans->updateTuple(record,
+                             RowBuf,
+                             record,
+                             RowBuf,
+                             NULL,
+                             &opts,
+                             sizeof(opts)) == NULL)
+      {
+        g_err << "Can't create operation : " <<
+          trans->getNdbError().code << endl;
+        return NDBT_FAILED;
+      }
+      break;
+    case Write : 
+      if (trans->writeTuple(record,
+                            RowBuf,
+                            record,
+                            RowBuf,
+                            NULL,
+                            &opts,
+                            sizeof(opts)) == NULL)
+      {
+        g_err << "Can't create operation : " <<
+          trans->getNdbError().code << endl;
+        return NDBT_FAILED;
+      }
+      break;
+    case Delete : 
+      if (trans->deleteTuple(record,
+                             RowBuf,
+                             record,
+                             NULL,
+                             NULL,
+                             &opts,
+                             sizeof(opts)) == NULL)
+      {
+        g_err << "Can't create operation : " <<
+          trans->getNdbError().code << endl;
+        return NDBT_FAILED;
+      }
+      break;
+    default:
+      g_err << "Bad operation type : " << op << endl;
+      return NDBT_FAILED;
+    }
+  }
+
+  trans->execute(Commit);
+
+  if (trans->getNdbError().code != 0)
+  {
+    g_err << "Error executing operations :" << 
+      trans->getNdbError().code << endl;
+    return NDBT_FAILED;
+  }
+  
+  trans->close();
+
+  return NDBT_OK;
+}
+
+int
+checkAnyValueInEvent(Ndb* pNdb,
+                     NdbRecAttr* preKey,
+                     NdbRecAttr* postKey,
+                     NdbRecAttr* preAttr,
+                     NdbRecAttr* postAttr,
+                     Uint32 num,
+                     Uint32 anyValueOffset,
+                     bool checkPre)
+{
+  Uint32 received= 0;
+
+  while (received < num)
+  {
+    int pollRc;
+
+    if ((pollRc= pNdb->pollEvents(10000)) < 0)
+    {
+      g_err << "Error while polling for events : " <<
+        pNdb->getNdbError().code;
+      return NDBT_FAILED;
+    }
+
+    if (pollRc == 0)
+    {
+      printf("No event, waiting...\n");
+      continue;
+    }
+
+    NdbEventOperation* event;
+    while((event= pNdb->nextEvent()) != NULL)
+    {
+//       printf("Event is %p of type %u\n",
+//              event, event->getEventType());
+//       printf("Got event, prekey is %u predata is %u \n",
+//              preKey->u_32_value(),
+//              preAttr->u_32_value());
+//       printf("           postkey is %u postdata is %u anyvalue is %u\n",
+//              postKey->u_32_value(),
+//              postAttr->u_32_value(),
+//              event->getAnyValue());
+      
+      received ++;
+      Uint32 keyVal= (checkPre? 
+                      preKey->u_32_value() :
+                      postKey->u_32_value());
+      
+      if (event->getAnyValue() != 
+          (anyValueOffset + keyVal))
+      {
+        g_err << "Error : Got event, key is " <<
+          keyVal << " anyValue is " <<
+          event->getAnyValue() <<
+          " expected " << (anyValueOffset + keyVal) 
+              << endl;
+        return NDBT_FAILED;
+      }
+    }
+  }
+
+  return NDBT_OK;
+}
+                      
+                      
+
+int
+runBug37672(NDBT_Context* ctx, NDBT_Step* step)
+{
+  /* InterpretedDelete and setAnyValue failed */
+  /* Let's create a boring, known table for this since 
+   * we don't yet have Hugo tools for NdbRecord
+   */
+  BaseString name; 
+  name.assfmt("TAB_TESTEVENT%d", rand() & 65535);
+  Ndb* pNdb= GETNDB(step);
+  
+  const NdbDictionary::Table* tab= createBoringTable(name.c_str(), pNdb);
+  
+  if (tab == NULL)
+    return NDBT_FAILED;
+  
+  /* Create an event to listen to events on the table */
+  char eventName[1024];
+  sprintf(eventName,"%s_EVENT", tab->getName());
+
+  if (createEvent(pNdb, *tab, false, true) != 0)
+    return NDBT_FAILED;
+
+  /* Now create the event operation to retrieve the events */
+  NdbEventOperation* eventOp;
+  eventOp= pNdb->createEventOperation(eventName);
+
+  if (eventOp == NULL)
+  {
+    g_err << "Failed to create event operation :" << 
+      pNdb->getNdbError().code << endl;
+    return NDBT_FAILED;
+  }
+
+  NdbRecAttr* eventKeyData= eventOp->getValue("Key");
+  NdbRecAttr* eventOldKeyData= eventOp->getPreValue("Key");
+  NdbRecAttr* eventAttrData= eventOp->getValue("Attr");
+  NdbRecAttr* eventOldAttrData= eventOp->getPreValue("Attr");
+  
+  if ((eventKeyData == NULL) || (eventAttrData == NULL))
+  {
+    g_err << "Failed to get NdbRecAttrs for events" << endl;
+    return NDBT_FAILED;
+  };
+  
+  if (eventOp->execute() != 0)
+  {
+    g_err << "Failed to execute event operation :" <<
+      eventOp->getNdbError().code << endl;
+    return NDBT_FAILED;
+  }
+
+  /* Perform some operations on the table, and check
+   * that we get the correct AnyValues propagated
+   * through
+   */
+  NdbOperation::OperationOptions opts;
+  opts.optionsPresent= 0;
+
+  NdbInterpretedCode nonsenseProgram;
+
+  nonsenseProgram.load_const_u32(0, 0);
+  nonsenseProgram.interpret_exit_ok();
+
+  nonsenseProgram.finalise();
+
+  const Uint32 rowCount= 1500;
+  Uint32 keyOffset= 0;
+  Uint32 anyValueOffset= 100;
+
+  printf ("Testing AnyValue with no interpreted program\n");
+  for (int variants= 0; variants < 2; variants ++)
+  {
+    for (int op= Insert; op < EndOfOpTypes; op++)
+    {
+      printf("  Testing opType %d (ko=%d, ao=%d)...", 
+             op, keyOffset, anyValueOffset);
+      
+      if (executeOps(pNdb, 
+                     tab, 
+                     (OpTypes)op, 
+                     rowCount, 
+                     keyOffset, 
+                     anyValueOffset, 
+                     opts))
+        return NDBT_FAILED;
+      
+      if (checkAnyValueInEvent(pNdb, 
+                               eventOldKeyData, eventKeyData,
+                               eventOldAttrData, eventAttrData,
+                               rowCount,
+                               anyValueOffset,
+                               false // always use postKey data
+                               ) != NDBT_OK)
+        return NDBT_FAILED;
+      printf("ok\n");
+    };
+    
+    printf("Testing AnyValue with interpreted program\n");
+    opts.optionsPresent|= NdbOperation::OperationOptions::OO_INTERPRETED;
+    opts.interpretedCode= &nonsenseProgram;
+  }
+    
+  if (dropEventOperations(pNdb) != 0)
+  {
+    g_err << "Dropping event operations failed : " << 
+      pNdb->getNdbError().code << endl;
+    return NDBT_FAILED;
+  }
+  
+  if (dropEvent(pNdb, tab->getName()) != 0)
+  {
+    g_err << "Dropping event failed : " << 
+      pNdb->getDictionary()->getNdbError().code << endl;
+    return NDBT_FAILED;
+  }
+
+  pNdb->getDictionary()->dropTable(tab->getName());
+  
+  return NDBT_OK;
+}
+
+
 NDBT_TESTSUITE(test_event);
 TESTCASE("BasicEventOperation", 
 	 "Verify that we can listen to Events"
@@ -2879,10 +3228,15 @@
 {
   INITIALIZER(runBug37442);
 }
+TESTCASE("Bug37672", "NdbRecord option OO_ANYVALUE causes interpreted delete to abort.")
+{
+  INITIALIZER(runBug37672);
+}
 NDBT_TESTSUITE_END(test_event);
 
 int main(int argc, const char** argv){
   ndb_init();
+  NDBT_TESTSUITE_INSTANCE(test_event);
   test_event.setCreateAllTables(true);
   return test_event.execute(argc, argv);
 }

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2008-07-01 16:16:30 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2008-08-07 12:32:06 +0000
@@ -1197,6 +1197,16 @@
 cmd: testBasic
 args: -n PkUpdate WIDE_MAXKEY_HUGO WIDE_MAXATTR_HUGO WIDE_MAXKEYMAXCOLS_HUGO WIDE_MINKEYMAXCOLS_HUGO
 
-
 # EOF 2008-06-30
-# EOF
+
+max-time: 500
+cmd: test_event
+args -n bug37672 T1
+
+#EOF 2008-07-04
+
+max-time: 500
+cmd: testScanFilter
+args: 
+
+#EOF 2008-07-09

=== modified file 'storage/ndb/test/run-test/daily-devel-tests.txt'
--- a/storage/ndb/test/run-test/daily-devel-tests.txt	2008-06-23 12:52:49 +0000
+++ b/storage/ndb/test/run-test/daily-devel-tests.txt	2008-08-04 19:58:31 +0000
@@ -3,7 +3,7 @@
 #
 max-time: 1500
 cmd: testIndex
-args: -n CreateAll T1 T6 T13
+args: -n CreateAll T1 T13 T14
 
 #-m 7200 1: testIndex -n InsertDeleteGentle T6
 max-time: 3600

=== modified file 'storage/ndb/test/src/NDBT_Test.cpp'
--- a/storage/ndb/test/src/NDBT_Test.cpp	2008-07-22 13:25:43 +0000
+++ b/storage/ndb/test/src/NDBT_Test.cpp	2008-08-04 19:02:08 +0000
@@ -1049,15 +1049,16 @@
   for(unsigned i = 0; i<m_tables_in_test.size(); i++)
   {
     const char *tab_name=  m_tables_in_test[i].c_str();
-    if (pDict->dropTable(tab_name) != 0)
+    if (pDict->dropTable(tab_name) != 0 &&
+        pDict->getNdbError().code != 723) // No such table
     {
-      g_err << "runCreateTables: Failed to drop table " << tab_name
+      g_err << "runCreateTables: Failed to drop table " << tab_name << endl
             << pDict->getNdbError() << endl;
       return NDBT_FAILED;
     }
-    if(NDBT_Tables::createTable(&ndb, tab_name, getLogging()) != 0)
+    if(NDBT_Tables::createTable(&ndb, tab_name, !getLogging()) != 0)
     {
-      g_err << "runCreateTables: Failed to create table " << tab_name
+      g_err << "runCreateTables: Failed to create table " << tab_name << endl
             << pDict->getNdbError() << endl;
       return NDBT_FAILED;
     }
@@ -1091,15 +1092,16 @@
   NdbDictionary::Dictionary* pDict = ndb.getDictionary();
   const NdbDictionary::Table* pTab = ctx->getTab();
   const char *tab_name=  pTab->getName();
-  if (pDict->dropTable(tab_name) > 0)
+  if (pDict->dropTable(tab_name) != 0 &&
+      pDict->getNdbError().code != 723) // No such table
   {
-    g_err << "runCreateTable: Failed to drop table " << tab_name
+    g_err << "runCreateTable: Failed to drop table " << tab_name << endl
           << pDict->getNdbError() << endl;
     return NDBT_FAILED;
   }
 
   if(NDBT_Tables::createTable(&ndb, tab_name,
-                              ctx->getSuite()->getLogging()) != 0)
+                              !ctx->getSuite()->getLogging()) != 0)
   {
     g_err << "runCreateTable: Failed to create table " << tab_name
           << pDict->getNdbError() << endl;

=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2008-06-02 13:27:27 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2008-08-05 14:34:39 +0000
@@ -1365,13 +1365,19 @@
     if (Header.SectionType == BackupFormat::EMPTY_ENTRY)
     {
       void *tmp;
-      buffer_get_ptr(&tmp, Header.SectionLength*4-8, 1);
+      if (Header.SectionLength < 2)
+      {
+        err << "getFragmentFooter:Error reading fragment footer" << endl;
+        return false;
+      }
+      if (Header.SectionLength > 2)
+        buffer_get_ptr(&tmp, Header.SectionLength*4-8, 1);
       continue;
     }
     break;
   }
   /* read rest of header */
-  if (buffer_read(((char*)&Header)+8, sizeof(Header)-8, 1) != 1)
+  if (buffer_read(((char*)&Header)+8, Header.SectionLength*4-8, 1) != 1)
   {
     ret = 0;
     return false;


