List:Commits« Previous MessageNext Message »
From:jonas Date:October 19 2006 7:24am
Subject:bk commit into 5.0 tree (jonas:1.2260)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-19 09:23:56+02:00, jonas@stripped +1 -0
  Merge perch.ndb.mysql.com:/home/jonas/src/41-work
  into  perch.ndb.mysql.com:/home/jonas/src/50-work
  MERGE: 1.1616.2144.200

  ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2006-10-19 09:23:54+02:00, jonas@stripped +0 -0
    Auto merged
    MERGE: 1.30.7.2

  ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2006-10-19 09:23:54+02:00, jonas@stripped +0 -0
    Merge rename: ndb/src/ndbapi/NdbConnection.cpp -> ndb/src/ndbapi/NdbTransaction.cpp

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/50-work/RESYNC

--- 1.30.7.1/ndb/src/ndbapi/NdbConnection.cpp	2006-10-19 09:24:00 +02:00
+++ 1.50/ndb/src/ndbapi/NdbTransaction.cpp	2006-10-19 09:24:00 +02:00
@@ -16,7 +16,7 @@
 
 #include <ndb_global.h>
 #include <NdbOut.hpp>
-#include <NdbConnection.hpp>
+#include <NdbTransaction.hpp>
 #include <NdbOperation.hpp>
 #include <NdbScanOperation.hpp>
 #include <NdbIndexScanOperation.hpp>
@@ -25,7 +25,6 @@
 #include "TransporterFacade.hpp"
 #include "API.hpp"
 #include "NdbBlob.hpp"
-#include <ndb_limits.h>
 
 #include <signaldata/TcKeyConf.hpp>
 #include <signaldata/TcIndx.hpp>
@@ -34,13 +33,13 @@
 #include <signaldata/TcHbRep.hpp>
 
 /*****************************************************************************
-NdbConnection( Ndb* aNdb );
+NdbTransaction( Ndb* aNdb );
 
 Return Value:  None
 Parameters:    aNdb: Pointers to the Ndb object 
 Remark:        Creates a connection object. 
 *****************************************************************************/
-NdbConnection::NdbConnection( Ndb* aNdb ) :
+NdbTransaction::NdbTransaction( Ndb* aNdb ) :
   theSendStatus(NotInit),
   theCallbackFunction(NULL),
   theCallbackObject(NULL),
@@ -89,19 +88,19 @@
 
   CHECK_SZ(m_db_nodes, NdbNodeBitmask::Size);
   CHECK_SZ(m_failed_db_nodes, NdbNodeBitmask::Size);
-}//NdbConnection::NdbConnection()
+}//NdbTransaction::NdbTransaction()
 
 /*****************************************************************************
-~NdbConnection();
+~NdbTransaction();
 
 Remark:        Deletes the connection object. 
 *****************************************************************************/
-NdbConnection::~NdbConnection()
+NdbTransaction::~NdbTransaction()
 {
-  DBUG_ENTER("NdbConnection::~NdbConnection");
+  DBUG_ENTER("NdbTransaction::~NdbTransaction");
   theNdb->theImpl->theNdbObjectIdMap.unmap(theId, this);
   DBUG_VOID_RETURN;
-}//NdbConnection::~NdbConnection()
+}//NdbTransaction::~NdbTransaction()
 
 /*****************************************************************************
 void init();
@@ -109,7 +108,7 @@
 Remark:         Initialise connection object for new transaction. 
 *****************************************************************************/
 void	
-NdbConnection::init()
+NdbTransaction::init()
 {
   theListState            = NotInList;
   theInUseState           = true;
@@ -149,7 +148,7 @@
   //
   theBlobFlag = false;
   thePendingBlobOps = 0;
-}//NdbConnection::init()
+}//NdbTransaction::init()
 
 /*****************************************************************************
 setOperationErrorCode(int error);
@@ -158,9 +157,9 @@
                operation object. 
 *****************************************************************************/
 void
-NdbConnection::setOperationErrorCode(int error)
+NdbTransaction::setOperationErrorCode(int error)
 {
-  DBUG_ENTER("NdbConnection::setOperationErrorCode");
+  DBUG_ENTER("NdbTransaction::setOperationErrorCode");
   setErrorCode(error);
   DBUG_VOID_RETURN;
 }
@@ -172,9 +171,9 @@
                operation object. 
 *****************************************************************************/
 void
-NdbConnection::setOperationErrorCodeAbort(int error, int abortOption)
+NdbTransaction::setOperationErrorCodeAbort(int error, int abortOption)
 {
-  DBUG_ENTER("NdbConnection::setOperationErrorCodeAbort");
+  DBUG_ENTER("NdbTransaction::setOperationErrorCodeAbort");
   if (abortOption == -1)
     abortOption = m_abortOption;
   if (theTransactionIsStarted == false) {
@@ -194,20 +193,20 @@
 Remark:        Sets an error indication on the connection object. 
 *****************************************************************************/
 void
-NdbConnection::setErrorCode(int error)
+NdbTransaction::setErrorCode(int error)
 {
-  DBUG_ENTER("NdbConnection::setErrorCode");
+  DBUG_ENTER("NdbTransaction::setErrorCode");
   DBUG_PRINT("enter", ("error: %d, theError.code: %d", error, theError.code));
 
   if (theError.code == 0)
     theError.code = error;
 
   DBUG_VOID_RETURN;
-}//NdbConnection::setErrorCode()
+}//NdbTransaction::setErrorCode()
 
 int
-NdbConnection::restart(){
-  DBUG_ENTER("NdbConnection::restart");
+NdbTransaction::restart(){
+  DBUG_ENTER("NdbTransaction::restart");
   if(theCompletionStatus == CompletedSuccess){
     releaseCompletedOperations();
     Uint64 tTransid = theNdb->theFirstTransId;
@@ -232,23 +231,8 @@
 Remark:        Handle time-out on a transaction object. 
 *****************************************************************************/
 void
-NdbConnection::handleExecuteCompletion()
+NdbTransaction::handleExecuteCompletion()
 {
-  
-  if (theCompletionStatus == CompletedFailure) {
-    NdbOperation* tOpTemp = theFirstExecOpInList;
-    while (tOpTemp != NULL) {
-/*****************************************************************************
- *	Ensure that all executing operations report failed for each 
- *      read attribute when failure occurs. 
- *      We do not want any operations to report both failure and 
- *      success on different read attributes.
- ****************************************************************************/
-      tOpTemp->handleFailedAI_ElemLen();
-      tOpTemp = tOpTemp->next();
-    }//while
-    theReturnStatus = ReturnFailure;
-  }//if
   /***************************************************************************
    *	  Move the NdbOperation objects from the list of executing 
    *      operations to list of completed
@@ -265,7 +249,7 @@
   }//if
   theSendStatus = InitState;
   return;
-}//NdbConnection::handleExecuteCompletion()
+}//NdbTransaction::handleExecuteCompletion()
 
 /*****************************************************************************
 int execute(ExecType aTypeOfExec, CommitType aTypeOfCommit, int forceSend);
@@ -276,12 +260,12 @@
 Remark:        Initialise connection object for new transaction. 
 *****************************************************************************/
 int 
-NdbConnection::execute(ExecType aTypeOfExec, 
+NdbTransaction::execute(ExecType aTypeOfExec, 
 		       AbortOption abortOption,
 		       int forceSend)
 {
   NdbError savedError= theError;
-  DBUG_ENTER("NdbConnection::execute");
+  DBUG_ENTER("NdbTransaction::execute");
   DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d", 
 		       aTypeOfExec, abortOption));
 
@@ -439,11 +423,11 @@
 }
 
 int 
-NdbConnection::executeNoBlobs(ExecType aTypeOfExec, 
+NdbTransaction::executeNoBlobs(ExecType aTypeOfExec, 
                               AbortOption abortOption,
                               int forceSend)
 {
-  DBUG_ENTER("NdbConnection::executeNoBlobs");
+  DBUG_ENTER("NdbTransaction::executeNoBlobs");
   DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d", 
 		       aTypeOfExec, abortOption));
 
@@ -452,7 +436,7 @@
 // since last execute or since beginning. If this works ok we will continue
 // by calling the poll with wait method. This method will return when
 // the NDB kernel has completed its task or when 10 seconds have passed.
-// The NdbConnectionCallBack-method will receive the return code of the
+// The NdbTransactionCallBack-method will receive the return code of the
 // transaction. The normal methods of reading error codes still apply.
 //------------------------------------------------------------------------
   Ndb* tNdb = theNdb;
@@ -500,7 +484,7 @@
   }
   thePendingBlobOps = 0;
   DBUG_RETURN(0);
-}//NdbConnection::execute()
+}//NdbTransaction::execute()
 
 /*****************************************************************************
 void executeAsynchPrepare(ExecType           aTypeOfExec,
@@ -518,12 +502,12 @@
 Remark:        Prepare a part of a transaction in an asynchronous manner. 
 *****************************************************************************/
 void 
-NdbConnection::executeAsynchPrepare( ExecType           aTypeOfExec,
+NdbTransaction::executeAsynchPrepare( ExecType           aTypeOfExec,
                                      NdbAsynchCallback  aCallback,
                                      void*              anyObject,
                                      AbortOption abortOption)
 {
-  DBUG_ENTER("NdbConnection::executeAsynchPrepare");
+  DBUG_ENTER("NdbTransaction::executeAsynchPrepare");
   DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: %x, anyObject: %x", 
 		       aTypeOfExec, aCallback, anyObject));
 
@@ -686,14 +670,14 @@
   NdbNodeBitmask::clear(m_db_nodes);
   NdbNodeBitmask::clear(m_failed_db_nodes);
   DBUG_VOID_RETURN;
-}//NdbConnection::executeAsynchPrepare()
+}//NdbTransaction::executeAsynchPrepare()
 
-void NdbConnection::close()
+void NdbTransaction::close()
 {
   theNdb->closeTransaction(this);
 }
 
-int NdbConnection::refresh(){
+int NdbTransaction::refresh(){
   return sendTC_HBREP();
 }
 
@@ -705,7 +689,7 @@
 Remark:        Order NDB to refresh the timeout counter of the transaction. 
 ******************************************************************************/
 int 	
-NdbConnection::sendTC_HBREP()		// Send a TC_HBREP signal;
+NdbTransaction::sendTC_HBREP()		// Send a TC_HBREP signal;
 {
   NdbApiSignal* tSignal;
   Ndb* tNdb = theNdb;
@@ -740,7 +724,7 @@
   }    
   
   return 0;
-}//NdbConnection::sendTC_HBREP()
+}//NdbTransaction::sendTC_HBREP()
 
 /*****************************************************************************
 int doSend();
@@ -752,9 +736,9 @@
                object from the prepared transactions array on the Ndb-object.
 *****************************************************************************/
 int
-NdbConnection::doSend()
+NdbTransaction::doSend()
 {
-  DBUG_ENTER("NdbConnection::doSend");
+  DBUG_ENTER("NdbTransaction::doSend");
 
   /*
   This method assumes that at least one operation have been defined. This
@@ -813,7 +797,7 @@
   theTransactionIsStarted = false;
   theCommitStatus = Aborted;
   DBUG_RETURN(-1);
-}//NdbConnection::doSend()
+}//NdbTransaction::doSend()
 
 /**************************************************************************
 int sendROLLBACK();
@@ -823,7 +807,7 @@
 Remark:        Order NDB to rollback the transaction. 
 **************************************************************************/
 int 	
-NdbConnection::sendROLLBACK()      // Send a TCROLLBACKREQ signal;
+NdbTransaction::sendROLLBACK()      // Send a TCROLLBACKREQ signal;
 {
   Ndb* tNdb = theNdb;
   if ((theTransactionIsStarted == true) &&
@@ -867,7 +851,7 @@
     return 0;
     ;
   }//if
-}//NdbConnection::sendROLLBACK()
+}//NdbTransaction::sendROLLBACK()
 
 /***************************************************************************
 int sendCOMMIT();
@@ -878,7 +862,7 @@
 Remark:        Order NDB to commit the transaction. 
 ***************************************************************************/
 int 	
-NdbConnection::sendCOMMIT()    // Send a TC_COMMITREQ signal;
+NdbTransaction::sendCOMMIT()    // Send a TC_COMMITREQ signal;
 {
   NdbApiSignal tSignal(theNdb->theMyRef);
   Uint32 tTransId1, tTransId2;
@@ -900,7 +884,7 @@
   } else {
     return -1;
   }//if
-}//NdbConnection::sendCOMMIT()
+}//NdbTransaction::sendCOMMIT()
 
 /******************************************************************************
 void release();
@@ -908,7 +892,7 @@
 Remark:         Release all operations.
 ******************************************************************************/
 void 
-NdbConnection::release(){
+NdbTransaction::release(){
   releaseOperations();
   if ( (theTransactionIsStarted == true) &&
        ((theCommitStatus != Committed) &&
@@ -927,10 +911,10 @@
     abort();
   }
 #endif
-}//NdbConnection::release()
+}//NdbTransaction::release()
 
 void
-NdbConnection::releaseOps(NdbOperation* tOp){
+NdbTransaction::releaseOps(NdbOperation* tOp){
   while (tOp != NULL) {
     NdbOperation* tmp = tOp;
     tOp->release();
@@ -945,7 +929,7 @@
 Remark:         Release all operations.
 ******************************************************************************/
 void 
-NdbConnection::releaseOperations()
+NdbTransaction::releaseOperations()
 {
   // Release any open scans
   releaseScanOperations(m_theFirstScanOperation);
@@ -965,15 +949,15 @@
   m_theFirstScanOperation = NULL;
   m_theLastScanOperation = NULL;
   m_firstExecutedScanOp = NULL;
-}//NdbConnection::releaseOperations()
+}//NdbTransaction::releaseOperations()
 
 void 
-NdbConnection::releaseCompletedOperations()
+NdbTransaction::releaseCompletedOperations()
 {
   releaseOps(theCompletedFirstOp);
   theCompletedFirstOp = NULL;
   theCompletedLastOp = NULL;
-}//NdbConnection::releaseOperations()
+}//NdbTransaction::releaseOperations()
 
 /******************************************************************************
 void releaseScanOperations();
@@ -982,7 +966,7 @@
                 (NdbScanOperation and NdbIndexOperation)
 ******************************************************************************/
 void 
-NdbConnection::releaseScanOperations(NdbIndexScanOperation* cursorOp)
+NdbTransaction::releaseScanOperations(NdbIndexScanOperation* cursorOp)
 {
   while(cursorOp != 0){
     NdbIndexScanOperation* next = (NdbIndexScanOperation*)cursorOp->next();
@@ -990,7 +974,7 @@
     theNdb->releaseScanOperation(cursorOp);
     cursorOp = next;
   }
-}//NdbConnection::releaseScanOperations()
+}//NdbTransaction::releaseScanOperations()
 
 /*****************************************************************************
 void releaseExecutedScanOperation();
@@ -998,30 +982,61 @@
 Remark:         Release scan op when hupp'ed trans closed (save memory)
 ******************************************************************************/
 void 
-NdbConnection::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
+NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
 {
-  DBUG_ENTER("NdbConnection::releaseExecutedScanOperation");
-  DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp))
+  DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
+  DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp));
+  
+  releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp);
+  
+  DBUG_VOID_RETURN;
+}//NdbTransaction::releaseExecutedScanOperation()
 
-  // here is one reason to make op lists doubly linked
-  if (m_firstExecutedScanOp == cursorOp) {
-    m_firstExecutedScanOp = (NdbIndexScanOperation*)cursorOp->theNext;
-    cursorOp->release();
-    theNdb->releaseScanOperation(cursorOp);
-  } else if (m_firstExecutedScanOp != NULL) {
-    NdbIndexScanOperation* tOp = m_firstExecutedScanOp;
-    while (tOp->theNext != NULL) {
-      if (tOp->theNext == cursorOp) {
-        tOp->theNext = cursorOp->theNext;
-        cursorOp->release();
-        theNdb->releaseScanOperation(cursorOp);
-        break;
+bool
+NdbTransaction::releaseScanOperation(NdbIndexScanOperation** listhead,
+				     NdbIndexScanOperation** listtail,
+				     NdbIndexScanOperation* op)
+{
+  if (* listhead == op)
+  {
+    * listhead = (NdbIndexScanOperation*)op->theNext;
+    if (listtail && *listtail == op)
+    {
+      assert(* listhead == 0);
+      * listtail = 0;
+    }
+      
+  }
+  else
+  {
+    NdbIndexScanOperation* tmp = * listhead;
+    while (tmp != NULL)
+    {
+      if (tmp->theNext == op)
+      {
+	tmp->theNext = (NdbIndexScanOperation*)op->theNext;
+	if (listtail && *listtail == op)
+	{
+	  assert(op->theNext == 0);
+	  *listtail = tmp;
+	}
+	break;
       }
-      tOp = (NdbIndexScanOperation*)tOp->theNext;
+      tmp = (NdbIndexScanOperation*)tmp->theNext;
     }
+    if (tmp == NULL)
+      op = NULL;
   }
-  DBUG_VOID_RETURN;
-}//NdbConnection::releaseExecutedScanOperation()
+  
+  if (op != NULL)
+  {
+    op->release();
+    theNdb->releaseScanOperation(op);
+    return true;
+  }
+  
+  return false;
+}
 
 /*****************************************************************************
 NdbOperation* getNdbOperation(const char* aTableName);
@@ -1031,13 +1046,13 @@
                 Return NULL : In all other case. 	
 Parameters:     aTableName : Name of the database table. 	
 Remark:         Get an operation from NdbOperation idlelist and get the 
-                NdbConnection object 
+                NdbTransaction object 
 		who was fetch by startTransaction pointing to this  operation  
 		getOperation will set the theTableId in the NdbOperation object.
                 synchronous
 ******************************************************************************/
 NdbOperation*
-NdbConnection::getNdbOperation(const char* aTableName)
+NdbTransaction::getNdbOperation(const char* aTableName)
 {
   if (theCommitStatus == Started){
     NdbTableImpl* table = theNdb->theDictionary->getTable(aTableName);
@@ -1052,7 +1067,7 @@
   setOperationErrorCodeAbort(4114);
   
   return NULL;
-}//NdbConnection::getNdbOperation()
+}//NdbTransaction::getNdbOperation()
 
 /*****************************************************************************
 NdbOperation* getNdbOperation(int aTableId);
@@ -1062,13 +1077,13 @@
                 Return NULL: In all other case. 	
 Parameters:     tableId : Id of the database table beeing deleted.
 Remark:         Get an operation from NdbOperation object idlelist and 
-                get the NdbConnection object who was fetch by 
+                get the NdbTransaction object who was fetch by 
                 startTransaction pointing to this operation 
   	        getOperation will set the theTableId in the NdbOperation 
                 object, synchronous.
 *****************************************************************************/
 NdbOperation*
-NdbConnection::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp)
+NdbTransaction::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp)
 { 
   NdbOperation* tOp;
 
@@ -1112,15 +1127,15 @@
  getNdbOp_error1:
   setOperationErrorCodeAbort(4000);
   return NULL;
-}//NdbConnection::getNdbOperation()
+}//NdbTransaction::getNdbOperation()
 
-NdbOperation* NdbConnection::getNdbOperation(const NdbDictionary::Table * table)
+NdbOperation* NdbTransaction::getNdbOperation(const NdbDictionary::Table * table)
 {
   if (table)
     return getNdbOperation(& NdbTableImpl::getImpl(*table));
   else
     return NULL;
-}//NdbConnection::getNdbOperation()
+}//NdbTransaction::getNdbOperation()
 
 // NdbScanOperation
 /*****************************************************************************
@@ -1129,12 +1144,12 @@
 Return Value    Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful.
                 Return NULL : In all other case. 	
 Parameters:     aTableName : Name of the database table. 	
-Remark:         Get an operation from NdbScanOperation idlelist and get the NdbConnection object 
+Remark:         Get an operation from NdbScanOperation idlelist and get the NdbTransaction object 
 		who was fetch by startTransaction pointing to this  operation  
 		getOperation will set the theTableId in the NdbOperation object.synchronous
 ******************************************************************************/
 NdbScanOperation*
-NdbConnection::getNdbScanOperation(const char* aTableName)
+NdbTransaction::getNdbScanOperation(const char* aTableName)
 {
   if (theCommitStatus == Started){
     NdbTableImpl* tab = theNdb->theDictionary->getTable(aTableName);
@@ -1148,78 +1163,106 @@
   
   setOperationErrorCodeAbort(4114);
   return NULL;
-}//NdbConnection::getNdbScanOperation()
+}//NdbTransaction::getNdbScanOperation()
 
 /*****************************************************************************
-NdbScanOperation* getNdbScanOperation(const char* anIndexName, const char* aTableName);
+NdbScanOperation* getNdbIndexScanOperation(const char* anIndexName, const char* aTableName);
 
-Return Value    Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful.
+Return Value    Return a pointer to a NdbIndexScanOperation object if getNdbIndexScanOperation was succesful.
                 Return NULL : In all other case. 	
 Parameters:     anIndexName : Name of the index to use. 	
                 aTableName : Name of the database table. 	
-Remark:         Get an operation from NdbScanOperation idlelist and get the NdbConnection object 
+Remark:         Get an operation from NdbIndexScanOperation idlelist and get the NdbTransaction object 
 		who was fetch by startTransaction pointing to this  operation  
-		getOperation will set the theTableId in the NdbOperation object.synchronous
+		getOperation will set the theTableId in the NdbIndexScanOperation object.synchronous
 ******************************************************************************/
 NdbIndexScanOperation*
-NdbConnection::getNdbIndexScanOperation(const char* anIndexName, 
+NdbTransaction::getNdbIndexScanOperation(const char* anIndexName, 
 					const char* aTableName)
 {
   NdbIndexImpl* index = 
     theNdb->theDictionary->getIndex(anIndexName, aTableName);
+  if (index == 0)
+  {
+    setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code);
+    return 0;
+  }
   NdbTableImpl* table = theNdb->theDictionary->getTable(aTableName);
+  if (table == 0)
+  {
+    setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code);
+    return 0;
+  }
 
   return getNdbIndexScanOperation(index, table);
 }
 
 NdbIndexScanOperation*
-NdbConnection::getNdbIndexScanOperation(const NdbIndexImpl* index,
+NdbTransaction::getNdbIndexScanOperation(const NdbIndexImpl* index,
 					const NdbTableImpl* table)
 {
   if (theCommitStatus == Started){
     const NdbTableImpl * indexTable = index->getIndexTable();
     if (indexTable != 0){
-      NdbIndexScanOperation* tOp = 
-	getNdbScanOperation((NdbTableImpl *) indexTable);
+      NdbIndexScanOperation* tOp = getNdbScanOperation(indexTable);
       if(tOp)
       {
 	tOp->m_currentTable = table;
-	tOp->m_cursor_type = NdbScanOperation::IndexCursor;
       }
+      // Mark that this really an NdbIndexScanOperation
+      tOp->m_type = NdbOperation::OrderedIndexScan; 
       return tOp;
     } else {
-      setOperationErrorCodeAbort(theNdb->theError.code);
+      setOperationErrorCodeAbort(4271);
       return NULL;
     }//if
   } 
   
   setOperationErrorCodeAbort(4114);
   return NULL;
-}//NdbConnection::getNdbIndexScanOperation()
+}//NdbTransaction::getNdbIndexScanOperation()
+
+NdbIndexScanOperation* 
+NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index)
+{ 
+  if (index)
+  {
+    const NdbDictionary::Table *table=
+      theNdb->theDictionary->getTable(index->getTable());
+
+    if (table)
+      return getNdbIndexScanOperation(index, table);
+
+    setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code);
+    return NULL;
+  }
+  setOperationErrorCodeAbort(4271);
+  return NULL;
+}
 
 NdbIndexScanOperation* 
-NdbConnection::getNdbIndexScanOperation(const NdbDictionary::Index * index,
+NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index,
 					const NdbDictionary::Table * table)
 {
   if (index && table)
     return getNdbIndexScanOperation(& NdbIndexImpl::getImpl(*index),
 				    & NdbTableImpl::getImpl(*table));
-  else
-    return NULL;
-}//NdbConnection::getNdbIndexScanOperation()
+  setOperationErrorCodeAbort(4271);
+  return NULL;
+}//NdbTransaction::getNdbIndexScanOperation()
 
 /*****************************************************************************
 NdbScanOperation* getNdbScanOperation(int aTableId);
 
-Return Value    Return a pointer to a NdbOperation object if getNdbOperation was succesful.
+Return Value    Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful.
                 Return NULL: In all other case. 	
 Parameters:     tableId : Id of the database table beeing deleted.
-Remark:         Get an operation from NdbScanOperation object idlelist and get the NdbConnection 
+Remark:         Get an operation from NdbScanOperation object idlelist and get the NdbTransaction 
                 object who was fetch by startTransaction pointing to this  operation 
-  	        getOperation will set the theTableId in the NdbOperation object, synchronous.
+  	        getOperation will set the theTableId in the NdbScanOperation object, synchronous.
 *****************************************************************************/
 NdbIndexScanOperation*
-NdbConnection::getNdbScanOperation(const NdbTableImpl * tab)
+NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab)
 { 
   NdbIndexScanOperation* tOp;
   
@@ -1229,6 +1272,8 @@
   
   if (tOp->init(tab, this) != -1) {
     define_scan_op(tOp);
+    // Mark that this NdbIndexScanOperation is used as NdbScanOperation
+    tOp->m_type = NdbOperation::TableScan; 
     return tOp;
   } else {
     theNdb->releaseScanOperation(tOp);
@@ -1238,10 +1283,10 @@
 getNdbOp_error1:
   setOperationErrorCodeAbort(4000);
   return NULL;
-}//NdbConnection::getNdbScanOperation()
+}//NdbTransaction::getNdbScanOperation()
 
 void
-NdbConnection::remove_list(NdbOperation*& list, NdbOperation* op){
+NdbTransaction::remove_list(NdbOperation*& list, NdbOperation* op){
   NdbOperation* tmp= list;
   if(tmp == op)
     list = op->next();
@@ -1254,7 +1299,7 @@
 }
 
 void
-NdbConnection::define_scan_op(NdbIndexScanOperation * tOp){
+NdbTransaction::define_scan_op(NdbIndexScanOperation * tOp){
   // Link scan operation into list of cursor operations
   if (m_theLastScanOperation == NULL)
     m_theFirstScanOperation = m_theLastScanOperation = tOp;
@@ -1266,13 +1311,13 @@
 }
 
 NdbScanOperation* 
-NdbConnection::getNdbScanOperation(const NdbDictionary::Table * table)
+NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table)
 {
   if (table)
     return getNdbScanOperation(& NdbTableImpl::getImpl(*table));
   else
     return NULL;
-}//NdbConnection::getNdbScanOperation()
+}//NdbTransaction::getNdbScanOperation()
 
 
 // IndexOperation
@@ -1280,21 +1325,39 @@
 NdbIndexOperation* getNdbIndexOperation(const char* anIndexName,
 					const char* aTableName);
 
-Return Value    Return a pointer to a NdbOperation object if getNdbScanOperation was succesful.
+Return Value    Return a pointer to a NdbOperation object if getNdbIndexOperation was succesful.
                 Return NULL : In all other case. 	
 Parameters:     aTableName : Name of the database table. 	
-Remark:         Get an operation from NdbScanOperation idlelist and get the NdbConnection object 
-		who was fetch by startTransaction pointing to this  operation  
-		getOperation will set the theTableId in the NdbScanOperation object.synchronous
+Remark:         Get an operation from NdbIndexOperation idlelist and get the NdbTransaction object 
+		who was fetch by startTransaction pointing to this operation  
+		getOperation will set the theTableId in the NdbIndexOperation object.synchronous
 ******************************************************************************/
 NdbIndexOperation*
-NdbConnection::getNdbIndexOperation(const char* anIndexName, 
+NdbTransaction::getNdbIndexOperation(const char* anIndexName, 
                                     const char* aTableName)
 {
   if (theCommitStatus == Started) {
     NdbTableImpl * table = theNdb->theDictionary->getTable(aTableName);
-    NdbIndexImpl * index = theNdb->theDictionary->getIndex(anIndexName,
-							   aTableName);
+    NdbIndexImpl * index;
+
+    if (table == 0)
+    {
+      setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code);
+      return NULL;
+    }
+
+    if (table->m_frm.get_data())
+    {
+      // This unique index is defined from SQL level
+      static const char* uniqueSuffix= "$unique";
+      BaseString uniqueIndexName(anIndexName);
+      uniqueIndexName.append(uniqueSuffix);
+      index = theNdb->theDictionary->getIndex(uniqueIndexName.c_str(),
+					      aTableName);      
+    }
+    else
+      index = theNdb->theDictionary->getIndex(anIndexName,
+					      aTableName);
     if(table != 0 && index != 0){
       return getNdbIndexOperation(index, table);
     }
@@ -1304,14 +1367,13 @@
       return NULL;
     }
 
-    // table == 0
-    setOperationErrorCodeAbort(theNdb->theError.code);
+    setOperationErrorCodeAbort(4243);
     return NULL;
   } 
   
   setOperationErrorCodeAbort(4114);
   return 0;
-}//NdbConnection::getNdbIndexOperation()
+}//NdbTransaction::getNdbIndexOperation()
 
 /*****************************************************************************
 NdbIndexOperation* getNdbIndexOperation(int anIndexId, int aTableId);
@@ -1319,12 +1381,12 @@
 Return Value    Return a pointer to a NdbIndexOperation object if getNdbIndexOperation was succesful.
                 Return NULL: In all other case. 	
 Parameters:     tableId : Id of the database table beeing deleted.
-Remark:         Get an operation from NdbIndexOperation object idlelist and get the NdbConnection 
+Remark:         Get an operation from NdbIndexOperation object idlelist and get the NdbTransaction 
                 object who was fetch by startTransaction pointing to this  operation 
   	        getOperation will set the theTableId in the NdbIndexOperation object, synchronous.
 *****************************************************************************/
 NdbIndexOperation*
-NdbConnection::getNdbIndexOperation(const NdbIndexImpl * anIndex, 
+NdbTransaction::getNdbIndexOperation(const NdbIndexImpl * anIndex, 
 				    const NdbTableImpl * aTable,
                                     NdbOperation* aNextOp)
 { 
@@ -1365,18 +1427,37 @@
  getNdbOp_error1:
   setOperationErrorCodeAbort(4000);
   return NULL;
-}//NdbConnection::getNdbIndexOperation()
+}//NdbTransaction::getNdbIndexOperation()
 
 NdbIndexOperation* 
-NdbConnection::getNdbIndexOperation(const NdbDictionary::Index * index,
+NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index)
+{ 
+  if (index)
+  {
+    const NdbDictionary::Table *table=
+      theNdb->theDictionary->getTable(index->getTable());
+
+    if (table)
+      return getNdbIndexOperation(index, table);
+
+    setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code);
+    return NULL;
+  }
+  setOperationErrorCodeAbort(4271);
+  return NULL;
+}
+
+NdbIndexOperation* 
+NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index,
 				    const NdbDictionary::Table * table)
 {
   if (index && table)
     return getNdbIndexOperation(& NdbIndexImpl::getImpl(*index),
 				& NdbTableImpl::getImpl(*table));
-  else
-    return NULL;
-}//NdbConnection::getNdbIndexOperation()
+  
+  setOperationErrorCodeAbort(4271);
+  return NULL;
+}//NdbTransaction::getNdbIndexOperation()
 
 
 /*******************************************************************************
@@ -1388,7 +1469,7 @@
 Remark:        Sets theRestartGCI in the NDB object. 
 *******************************************************************************/
 int			
-NdbConnection::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
+NdbTransaction::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
 {
   if (theStatus != Connecting) {
     return -1;
@@ -1397,7 +1478,7 @@
     theStatus = Connected;
   }//if
   return 0;  
-}//NdbConnection::receiveDIHNDBTAMPER()
+}//NdbTransaction::receiveDIHNDBTAMPER()
 
 /*******************************************************************************
 int  receiveTCSEIZECONF(NdbApiSignal* aSignal);
@@ -1408,7 +1489,7 @@
 Remark:        Sets TC Connect pointer at reception of TCSEIZECONF. 
 *******************************************************************************/
 int			
-NdbConnection::receiveTCSEIZECONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCSEIZECONF(NdbApiSignal* aSignal)
 {
   if (theStatus != Connecting)
   {
@@ -1419,7 +1500,7 @@
     theStatus = Connected;
   }
   return 0;
-}//NdbConnection::receiveTCSEIZECONF()
+}//NdbTransaction::receiveTCSEIZECONF()
 
 /*******************************************************************************
 int  receiveTCSEIZEREF(NdbApiSignal* aSignal);
@@ -1430,18 +1511,22 @@
 Remark:        Sets TC Connect pointer. 
 *******************************************************************************/
 int			
-NdbConnection::receiveTCSEIZEREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCSEIZEREF(NdbApiSignal* aSignal)
 {
+  DBUG_ENTER("NdbTransaction::receiveTCSEIZEREF");
   if (theStatus != Connecting)
   {
-    return -1;
+    DBUG_RETURN(-1);
   } else
   {
     theStatus = ConnectFailure;
     theNdb->theError.code = aSignal->readData(2);
-    return 0;
+    DBUG_PRINT("info",("error code %d, %s",
+		       theNdb->getNdbError().code,
+		       theNdb->getNdbError().message));
+    DBUG_RETURN(0);
   }
-}//NdbConnection::receiveTCSEIZEREF()
+}//NdbTransaction::receiveTCSEIZEREF()
 
 /*******************************************************************************
 int  receiveTCRELEASECONF(NdbApiSignal* aSignal);
@@ -1452,7 +1537,7 @@
 Remark:         DisConnect TC Connect pointer to NDBAPI. 
 *******************************************************************************/
 int			
-NdbConnection::receiveTCRELEASECONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCRELEASECONF(NdbApiSignal* aSignal)
 {
   if (theStatus != DisConnecting)
   {
@@ -1462,7 +1547,7 @@
     theStatus = NotConnected;
   }
   return 0;
-}//NdbConnection::receiveTCRELEASECONF()
+}//NdbTransaction::receiveTCRELEASECONF()
 
 /*******************************************************************************
 int  receiveTCRELEASEREF(NdbApiSignal* aSignal);
@@ -1473,7 +1558,7 @@
 Remark:        DisConnect TC Connect pointer to NDBAPI Failure. 
 *******************************************************************************/
 int			
-NdbConnection::receiveTCRELEASEREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCRELEASEREF(NdbApiSignal* aSignal)
 {
   if (theStatus != DisConnecting) {
     return -1;
@@ -1482,7 +1567,7 @@
     theNdb->theError.code = aSignal->readData(2);
     return 0;
   }//if
-}//NdbConnection::receiveTCRELEASEREF()
+}//NdbTransaction::receiveTCRELEASEREF()
 
 /******************************************************************************
 int  receiveTC_COMMITCONF(NdbApiSignal* aSignal);
@@ -1493,11 +1578,12 @@
 Remark:        
 ******************************************************************************/
 int			
-NdbConnection::receiveTC_COMMITCONF(const TcCommitConf * commitConf)
+NdbTransaction::receiveTC_COMMITCONF(const TcCommitConf * commitConf)
 { 
   if(checkState_TransId(&commitConf->transId1)){
     theCommitStatus = Committed;
     theCompletionStatus = CompletedSuccess;
+    theGlobalCheckpointId = commitConf->gci;
     return 0;
   } else {
 #ifdef NDB_NO_DROPPED_SIGNAL
@@ -1505,7 +1591,7 @@
 #endif
   }
   return -1;
-}//NdbConnection::receiveTC_COMMITCONF()
+}//NdbTransaction::receiveTC_COMMITCONF()
 
 /******************************************************************************
 int  receiveTC_COMMITREF(NdbApiSignal* aSignal);
@@ -1516,13 +1602,14 @@
 Remark:        
 ******************************************************************************/
 int			
-NdbConnection::receiveTC_COMMITREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTC_COMMITREF(NdbApiSignal* aSignal)
 {
   const TcCommitRef * ref = CAST_CONSTPTR(TcCommitRef, aSignal->getDataPtr());
   if(checkState_TransId(&ref->transId1)){
     setOperationErrorCodeAbort(ref->errorCode);
     theCommitStatus = Aborted;
     theCompletionStatus = CompletedFailure;
+    theReturnStatus = ReturnFailure;
     return 0;
   } else {
 #ifdef NDB_NO_DROPPED_SIGNAL
@@ -1531,7 +1618,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTC_COMMITREF()
+}//NdbTransaction::receiveTC_COMMITREF()
 
 /******************************************************************************
 int  receiveTCROLLBACKCONF(NdbApiSignal* aSignal);
@@ -1542,7 +1629,7 @@
 Remark:        
 ******************************************************************************/
 int			
-NdbConnection::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
 {
   if(checkState_TransId(aSignal->getDataPtr() + 1)){
     theCommitStatus = Aborted;
@@ -1555,7 +1642,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTCROLLBACKCONF()
+}//NdbTransaction::receiveTCROLLBACKCONF()
 
 /*******************************************************************************
 int  receiveTCROLLBACKREF(NdbApiSignal* aSignal);
@@ -1566,12 +1653,13 @@
 Remark:        
 *******************************************************************************/
 int			
-NdbConnection::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
 {
   if(checkState_TransId(aSignal->getDataPtr() + 1)){
     setOperationErrorCodeAbort(aSignal->readData(4));
     theCommitStatus = Aborted;
     theCompletionStatus = CompletedFailure;
+    theReturnStatus = ReturnFailure;
     return 0;
   } else {
 #ifdef NDB_NO_DROPPED_SIGNAL
@@ -1580,7 +1668,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTCROLLBACKREF()
+}//NdbTransaction::receiveTCROLLBACKREF()
 
 /*****************************************************************************
 int receiveTCROLLBACKREP( NdbApiSignal* aSignal)
@@ -1592,7 +1680,7 @@
 Remark:         Handles the reception of the ROLLBACKREP signal.
 *****************************************************************************/
 int
-NdbConnection::receiveTCROLLBACKREP( NdbApiSignal* aSignal)
+NdbTransaction::receiveTCROLLBACKREP( NdbApiSignal* aSignal)
 {
   /****************************************************************************
 Check that we are expecting signals from this transaction and that it doesn't
@@ -1611,6 +1699,7 @@
     /**********************************************************************/
     theCompletionStatus = CompletedFailure;
     theCommitStatus = Aborted;
+    theReturnStatus = ReturnFailure;
     return 0;
   } else {
 #ifdef NDB_NO_DROPPED_SIGNAL
@@ -1619,7 +1708,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTCROLLBACKREP()
+}//NdbTransaction::receiveTCROLLBACKREP()
 
 /*******************************************************************************
 int  receiveTCKEYCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);
@@ -1630,7 +1719,7 @@
 Remark:        
 *******************************************************************************/
 int			
-NdbConnection::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength)
+NdbTransaction::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength)
 {
   NdbReceiver* tOp;
   const Uint32 tTemp = keyConf->confInfo;
@@ -1659,6 +1748,7 @@
 	    done = 1;
 	    tOp->setErrorCode(4119);
 	    theCompletionStatus = CompletedFailure;
+	    theReturnStatus = NdbTransaction::ReturnFailure;
 	  }	    
 	}
 	tNoComp += done;
@@ -1688,6 +1778,7 @@
 /**********************************************************************/
       theError.code = 4011;
       theCompletionStatus = CompletedFailure;
+      theReturnStatus = NdbTransaction::ReturnFailure;
       theCommitStatus = Aborted;
       return 0;
     }//if
@@ -1702,7 +1793,7 @@
   }
   
   return -1;
-}//NdbConnection::receiveTCKEYCONF()
+}//NdbTransaction::receiveTCKEYCONF()
 
 /*****************************************************************************
 int receiveTCKEY_FAILCONF( NdbApiSignal* aSignal)
@@ -1714,7 +1805,7 @@
 Remark:         Handles the reception of the TCKEY_FAILCONF signal.
 *****************************************************************************/
 int
-NdbConnection::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
+NdbTransaction::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
 {
   NdbOperation*	tOp;
   /*
@@ -1747,6 +1838,7 @@
       case NdbOperation::OpenScanRequest:
       case NdbOperation::OpenRangeScanRequest:
 	theCompletionStatus = CompletedFailure;
+	theReturnStatus = NdbTransaction::ReturnFailure;
 	setOperationErrorCodeAbort(4115);
 	tOp = NULL;
 	break;
@@ -1764,7 +1856,7 @@
 #endif
   }
   return -1;
-}//NdbConnection::receiveTCKEY_FAILCONF()
+}//NdbTransaction::receiveTCKEY_FAILCONF()
 
 /*************************************************************************
 int receiveTCKEY_FAILREF( NdbApiSignal* aSignal)
@@ -1776,7 +1868,7 @@
 Remark:         Handles the reception of the TCKEY_FAILREF signal.
 **************************************************************************/
 int
-NdbConnection::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
+NdbTransaction::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
 {
   /*
     Check that we are expecting signals from this transaction and
@@ -1788,18 +1880,19 @@
       We received an indication of that this transaction was aborted due to a
       node failure.
     */
-    if (theSendStatus == NdbConnection::sendTC_ROLLBACK) {
+    if (theSendStatus == NdbTransaction::sendTC_ROLLBACK) {
       /*
 	We were in the process of sending a rollback anyways. We will
 	report it as a success.
       */
-      theCompletionStatus = NdbConnection::CompletedSuccess;
+      theCompletionStatus = NdbTransaction::CompletedSuccess;
     } else {
-      theCompletionStatus = NdbConnection::CompletedFailure;
+      theReturnStatus = NdbTransaction::ReturnFailure;
+      theCompletionStatus = NdbTransaction::CompletedFailure;
       theError.code = 4031;
     }//if
     theReleaseOnClose = true;
-    theCommitStatus = NdbConnection::Aborted;
+    theCommitStatus = NdbTransaction::Aborted;
     return 0;
   } else {
 #ifdef VM_TRACE
@@ -1807,7 +1900,7 @@
 #endif
   }
   return -1;
-}//NdbConnection::receiveTCKEY_FAILREF()
+}//NdbTransaction::receiveTCKEY_FAILREF()
 
 /******************************************************************************
 int  receiveTCINDXCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);
@@ -1818,7 +1911,7 @@
 Remark:        
 ******************************************************************************/
 int			
-NdbConnection::receiveTCINDXCONF(const TcIndxConf * indxConf, 
+NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf, 
 				 Uint32 aDataLength)
 {
   if(checkState_TransId(&indxConf->transId1)){
@@ -1852,8 +1945,9 @@
       // no Commit flag set. This is clearly an anomaly.
       /**********************************************************************/
       theError.code = 4011;
-      theCompletionStatus = NdbConnection::CompletedFailure;
-      theCommitStatus = NdbConnection::Aborted;
+      theCompletionStatus = NdbTransaction::CompletedFailure;
+      theCommitStatus = NdbTransaction::Aborted;
+      theReturnStatus = NdbTransaction::ReturnFailure;
       return 0;
     }//if
     if (tNoComp >= tNoSent) {
@@ -1867,7 +1961,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTCINDXCONF()
+}//NdbTransaction::receiveTCINDXCONF()
 
 /*****************************************************************************
 int receiveTCINDXREF( NdbApiSignal* aSignal)
@@ -1879,7 +1973,7 @@
 Remark:         Handles the reception of the TCINDXREF signal.
 *****************************************************************************/
 int
-NdbConnection::receiveTCINDXREF( NdbApiSignal* aSignal)
+NdbTransaction::receiveTCINDXREF( NdbApiSignal* aSignal)
 {
   if(checkState_TransId(aSignal->getDataPtr()+1)){
     theError.code = aSignal->readData(4);	// Override any previous errors
@@ -1891,8 +1985,9 @@
     /*	and we only need to report completion and return with the     */
     /*	error code to the application.				      */
     /**********************************************************************/
-    theCompletionStatus = NdbConnection::CompletedFailure;
-    theCommitStatus = NdbConnection::Aborted;
+    theCompletionStatus = NdbTransaction::CompletedFailure;
+    theCommitStatus = NdbTransaction::Aborted;
+    theReturnStatus = NdbTransaction::ReturnFailure;
     return 0;
   } else {
 #ifdef NDB_NO_DROPPED_SIGNAL
@@ -1901,7 +1996,7 @@
   }
 
   return -1;
-}//NdbConnection::receiveTCINDXREF()
+}//NdbTransaction::receiveTCINDXREF()
 
 /*******************************************************************************
 int OpCompletedFailure();
@@ -1912,12 +2007,12 @@
 Remark:        An operation was completed with failure.
 *******************************************************************************/
 int 
-NdbConnection::OpCompleteFailure(Uint8 abortOption, bool setFailure)
+NdbTransaction::OpCompleteFailure(Uint8 abortOption, bool setFailure)
 {
   Uint32 tNoComp = theNoOfOpCompleted;
   Uint32 tNoSent = theNoOfOpSent;
   if (setFailure)
-    theCompletionStatus = NdbConnection::CompletedFailure;
+    theCompletionStatus = NdbTransaction::CompletedFailure;
   tNoComp++;
   theNoOfOpCompleted = tNoComp;
   if (tNoComp == tNoSent) {
@@ -1942,7 +2037,7 @@
   } else {
     return -1;	// Continue waiting for more signals
   }//if
-}//NdbConnection::OpCompleteFailure()
+}//NdbTransaction::OpCompleteFailure()
 
 /******************************************************************************
 int OpCompleteSuccess();
@@ -1952,7 +2047,7 @@
 Remark:        An operation was completed with success.
 *******************************************************************************/
 int 
-NdbConnection::OpCompleteSuccess()
+NdbTransaction::OpCompleteSuccess()
 {
   Uint32 tNoComp = theNoOfOpCompleted;
   Uint32 tNoSent = theNoOfOpSent;
@@ -1965,10 +2060,11 @@
   } else {
     setOperationErrorCodeAbort(4113);	// Too many operations, 
                                         // stop waiting for more
-    theCompletionStatus = NdbConnection::CompletedFailure;
+    theCompletionStatus = NdbTransaction::CompletedFailure;
+    theReturnStatus = NdbTransaction::ReturnFailure;
     return 0;
   }//if
-}//NdbConnection::OpCompleteSuccess()
+}//NdbTransaction::OpCompleteSuccess()
 
 /******************************************************************************
  int            getGCI();
@@ -1976,13 +2072,13 @@
 Remark:		Get global checkpoint identity of the transaction
 *******************************************************************************/
 int
-NdbConnection::getGCI()
+NdbTransaction::getGCI()
 {
-  if (theCommitStatus == NdbConnection::Committed) {
+  if (theCommitStatus == NdbTransaction::Committed) {
     return theGlobalCheckpointId;
   }//if
   return 0;
-}//NdbConnection::getGCI()
+}//NdbTransaction::getGCI()
 
 /*******************************************************************************
 Uint64 getTransactionId(void);
@@ -1990,31 +2086,31 @@
 Remark:        Get the transaction identity. 
 *******************************************************************************/
 Uint64
-NdbConnection::getTransactionId()
+NdbTransaction::getTransactionId()
 {
   return theTransactionId;
-}//NdbConnection::getTransactionId()
+}//NdbTransaction::getTransactionId()
 
-NdbConnection::CommitStatusType
-NdbConnection::commitStatus()
+NdbTransaction::CommitStatusType
+NdbTransaction::commitStatus()
 {
   return theCommitStatus;
-}//NdbConnection::commitStatus()
+}//NdbTransaction::commitStatus()
 
 int 
-NdbConnection::getNdbErrorLine()
+NdbTransaction::getNdbErrorLine()
 {
   return theErrorLine;
 }
 
 NdbOperation*
-NdbConnection::getNdbErrorOperation()
+NdbTransaction::getNdbErrorOperation()
 {
   return theErrorOperation;
-}//NdbConnection::getNdbErrorOperation()
+}//NdbTransaction::getNdbErrorOperation()
 
 const NdbOperation * 
-NdbConnection::getNextCompletedOperation(const NdbOperation * current) const {
+NdbTransaction::getNextCompletedOperation(const NdbOperation * current) const {
   if(current == 0)
     return theCompletedFirstOp;
   return current->theNext;
@@ -2023,7 +2119,7 @@
 #ifdef VM_TRACE
 #define CASE(x) case x: ndbout << " " << #x; break
 void
-NdbConnection::printState()
+NdbTransaction::printState()
 {
   ndbout << "con=" << hex << this << dec;
   ndbout << " node=" << getConnectedNodeId();
@@ -2076,7 +2172,7 @@
 #endif
 
 int
-NdbConnection::report_node_failure(Uint32 id){
+NdbTransaction::report_node_failure(Uint32 id){
   NdbNodeBitmask::set(m_failed_db_nodes, id);
   if(!NdbNodeBitmask::get(m_db_nodes, id))
   {
@@ -2095,22 +2191,28 @@
   const Uint32 len = TcKeyConf::SimpleReadBit | id;
   Uint32 tNoComp = theNoOfOpCompleted;
   Uint32 tNoSent = theNoOfOpSent;
+  Uint32 count = 0;
   while(tmp != 0)
   {
     if(tmp->theReceiver.m_expected_result_length == len && 
        tmp->theReceiver.m_received_result_length == 0)
     {
-      tNoComp++;
+      count++;
       tmp->theError.code = 4119;
     }
     tmp = tmp->next();
   }
+  tNoComp += count;
   theNoOfOpCompleted = tNoComp;
-  if(tNoComp == tNoSent)
+  if(count)
   {
-    theError.code = 4119;
-    theCompletionStatus = NdbConnection::CompletedFailure;    
-    return 1;
+    theReturnStatus = NdbTransaction::ReturnFailure;
+    if(tNoComp == tNoSent)
+    {
+      theError.code = 4119;
+      theCompletionStatus = NdbTransaction::CompletedFailure;    
+      return 1;
+    }
   }
   return 0;
 }
Thread
bk commit into 5.0 tree (jonas:1.2260)jonas19 Oct