=== modified file 'storage/ndb/src/ndbapi/NdbTransaction.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-05-21 16:43:13 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp	2008-06-03 16:18:01 +0000
@@ -1926,28 +1926,24 @@
       tGCI_lo = 0;
     }
     Uint64 tGCI = Uint64(tGCI_lo) | (Uint64(tGCI_hi) << 32);
-    if (tCommitFlag == 1) {
+    if (tCommitFlag == 1) 
+    {
       theCommitStatus = Committed;
       theGlobalCheckpointId = tGCI;
       if (tGCI) // Read(dirty) only transaction doesnt get GCI
       {
 	*p_latest_trans_gci = tGCI;
       }
-    } else if ((tNoComp >= tNoSent) &&
-               (theLastExecOpInList->theCommitIndicator == 1)){
-      
-      
-/**********************************************************************/
-// We sent the transaction with Commit flag set and received a CONF with
-// no Commit flag set. This is clearly an anomaly.
-/**********************************************************************/
-      theError.code = 4011;
-      theCompletionStatus = CompletedFailure;
-      theReturnStatus = NdbTransaction::ReturnFailure;
-      theCommitStatus = Aborted;
-      return 0;
+    } 
+    else if (theLastExecOpInList->theCommitIndicator == 1)
+    {  
+      /**
+       * We're waiting for a commit reply...
+       */
+      return -1;
     }//if
-    if (tNoComp >= tNoSent) {
+    if (tNoComp >= tNoSent) 
+    {
       return 0;	// No more operations to wait for
     }//if
      // Not completed the reception yet.
@@ -2107,27 +2103,25 @@
     Uint64 tGCI = Uint64(tGCI_lo) | (Uint64(tGCI_hi) << 32);
 
     theNoOfOpCompleted = tNoComp;
-    if (tCommitFlag == 1) {
+    if (tCommitFlag == 1) 
+    {
       theCommitStatus = Committed;
       theGlobalCheckpointId = tGCI;
       if (tGCI) // Read(dirty) only transaction doesnt get GCI
       {
 	*p_latest_trans_gci = tGCI;
       }
-    } else if ((tNoComp >= tNoSent) &&
-               (theLastExecOpInList->theCommitIndicator == 1)){
+    }
+    else if (theLastExecOpInList->theCommitIndicator == 1)
+    {  
+      /**
+       * We're waiting for a commit reply...
+       */
+      return -1;
+    }//if
 
-      /**********************************************************************/
-      // We sent the transaction with Commit flag set and received a CONF with
-      // no Commit flag set. This is clearly an anomaly.
-      /**********************************************************************/
-      theError.code = 4011;
-      theCompletionStatus = NdbTransaction::CompletedFailure;
-      theCommitStatus = NdbTransaction::Aborted;
-      theReturnStatus = NdbTransaction::ReturnFailure;
-      return 0;
-    }//if
-    if (tNoComp >= tNoSent) {
+    if (tNoComp >= tNoSent) 
+    {
       return 0;	// No more operations to wait for
     }//if
      // Not completed the reception yet.

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp	2008-05-29 15:06:11 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp	2008-06-03 16:28:09 +0000
@@ -205,10 +205,10 @@
   case GSN_API_REGCONF:
     return false;
 #endif
-#if 0
+#if 1
   case GSN_SUB_GCP_COMPLETE_REP:
   case GSN_SUB_GCP_COMPLETE_ACK:
-    return true;
+    return false;
 #endif
   default:
     return true;

=== modified file 'storage/ndb/test/ndbapi/testDict.cpp'
--- a/storage/ndb/test/ndbapi/testDict.cpp	2008-05-31 06:36:34 +0000
+++ b/storage/ndb/test/ndbapi/testDict.cpp	2008-06-04 11:36:09 +0000
@@ -6034,6 +6034,67 @@
 }
 
 // end schema trans
+
+int 
+runFailCreateHashmap(NDBT_Context* ctx, NDBT_Step* step)
+{
+  static int lst[] = { 6204, 6205, 6206, 6207, 6208, 6209, 6210, 6211, 0 };
+  
+  NdbRestarter restarter;
+  int nodeId = restarter.getMasterNodeId();
+  Ndb* pNdb = GETNDB(step);  
+  NdbDictionary::Dictionary* pDic = pNdb->getDictionary();
+
+  int errNo = 0;
+  char buf[100];
+  if (NdbEnv_GetEnv("ERRNO", buf, sizeof(buf)))
+  {
+    errNo = atoi(buf);
+    ndbout_c("Using errno: %u", errNo);
+  }
+  
+  const int loops = ctx->getNumLoops();
+  int result = NDBT_OK;
+
+  int dump1 = DumpStateOrd::SchemaResourceSnapshot;
+  int dump2 = DumpStateOrd::SchemaResourceCheckLeak;
+
+  NdbDictionary::HashMap hm;
+  pDic->initDefaultHashMap(hm, 1);
+
+loop:
+  if (pDic->getHashMap(hm, hm.getName()) != -1)
+  {
+    pDic->initDefaultHashMap(hm, rand() % 64);
+    goto loop;
+  }
+
+  for (int l = 0; l < loops; l++) 
+  {
+    for (unsigned i0 = 0; lst[i0]; i0++) 
+    {
+      unsigned j = (l == 0 ? i0 : myRandom48(i0 + l));
+      int errval = lst[j];
+      if (errNo != 0 && errNo != errval)
+        continue;
+      g_info << "insert error node=" << nodeId << " value=" << errval << endl;
+      CHECK2(restarter.insertErrorInNode(nodeId, errval) == 0,
+             "failed to set error insert");
+      CHECK(restarter.dumpStateAllNodes(&dump1, 1) == 0);
+      
+      int res = pDic->createHashMap(hm);
+      CHECK2(res != 0, "create hashmap failed to fail");
+
+      NdbDictionary::HashMap check;
+      CHECK2(res != 0, "create hashmap existed");
+      
+      CHECK(restarter.dumpStateAllNodes(&dump2, 1) == 0);
+    }
+  }
+end:
+  return result;
+}
+// end FAIL create hashmap
  
 NDBT_TESTSUITE(testDict);
 TESTCASE("testDropDDObjects",
@@ -6240,6 +6301,11 @@
          ""){
   INITIALIZER(runBug29186);
 }
+TESTCASE("FailCreateHashmap",
+         "Fail create hashmap")
+{
+  INITIALIZER(runFailCreateHashmap);
+}
 NDBT_TESTSUITE_END(testDict);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp	2007-07-02 17:08:02 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp	2008-06-03 12:37:17 +0000
@@ -1674,6 +1674,60 @@
   return result;
 }
 
+int 
+runBug37158(NDBT_Context* ctx, NDBT_Step* step)
+{
+  int result = NDBT_OK;
+  Ndb* pNdb = GETNDB(step);
+
+  for (Uint32 i = 0; i<ctx->getNumLoops(); i++)
+  {
+    HugoOperations hugoOps(*ctx->getTab());
+    hugoOps.startTransaction(pNdb);
+    if (hugoOps.pkWriteRecord(pNdb, 0) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    
+
+    if (hugoOps.pkWritePartialRecord(pNdb, 1) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    
+    if (hugoOps.pkWriteRecord(pNdb, 2) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    
+    if (hugoOps.pkUpdateRecord(pNdb, 0) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    
+    if (hugoOps.execute_Commit(pNdb, AO_IgnoreError) == 4011)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+    hugoOps.closeTransaction(pNdb);
+
+    if (runClearTable(ctx, step) != 0)
+    {
+      result = NDBT_FAILED;
+      goto done;
+    }
+  }
+  
+done:
+
+  return result;
+}
+
 NDBT_TESTSUITE(testNdbApi);
 TESTCASE("MaxNdb", 
 	 "Create Ndb objects until no more can be created\n"){ 
@@ -1782,6 +1836,10 @@
 	 ""){ 
   INITIALIZER(runBug28443);
 }
+TESTCASE("Bug37158", 
+	 ""){ 
+  INITIALIZER(runBug37158);
+}
 NDBT_TESTSUITE_END(testNdbApi);
 
 int main(int argc, const char** argv){

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2008-06-02 13:27:27 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2008-06-03 16:28:09 +0000
@@ -1157,4 +1157,10 @@
 args: -l 1 -n FailCreateHashmap T1
 
 # EOF 2008-05-30
+# 2008-06-03
+max-time: 1200
+cmd: testNdbApi
+args: -l 100 -n Bug37158
+
+# EOF 2008-06-03
 # EOF


