List:Commits« Previous MessageNext Message »
From:knielsen Date:March 28 2007 1:02pm
Subject:bk commit into 5.0 tree (knielsen:1.2417) BUG#27495
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of knielsen. When knielsen 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, 2007-03-28 15:02:07+02:00, knielsen@ymer.(none) +4 -0
  BUG#27495: Missing implementation of NdbTransaction::executeAsynch().
  
  NdbTransaction::executeAsynch() was not implemented. Add implementation.

  ndb/include/ndbapi/NdbTransaction.hpp@stripped, 2007-03-28 15:02:05+02:00, knielsen@ymer.(none) +5 -3
    executeAsynch() should probably allow setting forceSend.

  ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2007-03-28 15:02:05+02:00, knielsen@ymer.(none) +11 -0
    Add missing implementation of executeAsynch().

  ndb/test/ndbapi/testNdbApi.cpp@stripped, 2007-03-28 15:02:05+02:00, knielsen@ymer.(none) +74 -0
    Add test case.

  ndb/test/run-test/daily-basic-tests.txt@stripped, 2007-03-28 15:02:05+02:00, knielsen@ymer.(none) +4 -0
    Add new test.

# 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:	knielsen
# Host:	ymer.(none)
# Root:	/usr/local/mysql/mysql-5.0-ndb-bug27495

--- 1.49/ndb/test/run-test/daily-basic-tests.txt	2007-03-28 15:02:12 +02:00
+++ 1.50/ndb/test/run-test/daily-basic-tests.txt	2007-03-28 15:02:12 +02:00
@@ -625,6 +625,10 @@ max-time: 500
 cmd: testNdbApi
 args: -n Scan_4006 T1
 
+max-time: 500
+cmd: testNdbApi
+args: -n ExecuteAsynch T1
+
 #max-time: 500
 #cmd: testInterpreter
 #args: T1 

--- 1.46/ndb/include/ndbapi/NdbTransaction.hpp	2007-03-28 15:02:12 +02:00
+++ 1.47/ndb/include/ndbapi/NdbTransaction.hpp	2007-03-28 15:02:12 +02:00
@@ -379,14 +379,16 @@ public:
   void executeAsynch(ExecType            aTypeOfExec,
 		     NdbAsynchCallback   aCallback,
 		     void*               anyObject,
-		     AbortOption abortOption = AbortOnError);
+                     AbortOption abortOption = AbortOnError,
+                     int forceSend= 0);
 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
   void executeAsynch(::ExecType         aTypeOfExec,
 		     NdbAsynchCallback   aCallback,
 		     void*               anyObject,
-		     ::AbortOption abortOption= ::AbortOnError)
+                     ::AbortOption abortOption= ::AbortOnError,
+                     int forceSend= 0)
   { executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
-		  (AbortOption)abortOption); }
+		  (AbortOption)abortOption, forceSend); }
 #endif
 #endif
   /**

--- 1.57/ndb/src/ndbapi/NdbTransaction.cpp	2007-03-28 15:02:12 +02:00
+++ 1.58/ndb/src/ndbapi/NdbTransaction.cpp	2007-03-28 15:02:12 +02:00
@@ -694,6 +694,17 @@ NdbTransaction::executeAsynchPrepare( Ex
   DBUG_VOID_RETURN;
 }//NdbTransaction::executeAsynchPrepare()
 
+void
+NdbTransaction::executeAsynch(ExecType aTypeOfExec,
+                              NdbAsynchCallback aCallback,
+                              void* anyObject,
+                              AbortOption abortOption,
+                              int forceSend)
+{
+  executeAsynchPrepare(aTypeOfExec, aCallback, anyObject, abortOption);
+  theNdb->sendPreparedTransactions(forceSend);
+}
+
 void NdbTransaction::close()
 {
   theNdb->closeTransaction(this);

--- 1.23/ndb/test/ndbapi/testNdbApi.cpp	2007-03-28 15:02:12 +02:00
+++ 1.24/ndb/test/ndbapi/testNdbApi.cpp	2007-03-28 15:02:12 +02:00
@@ -1234,6 +1234,76 @@ int runScan_4006(NDBT_Context* ctx, NDBT
   return result;
 }
 
+static void
+testExecuteAsynchCallback(int res, NdbTransaction *con, void *data_ptr)
+{
+  int *res_ptr= (int *)data_ptr;
+
+  *res_ptr= res;
+}
+
+int runTestExecuteAsynch(NDBT_Context* ctx, NDBT_Step* step){
+  /* Test that NdbTransaction::executeAsynch() works (BUG#27495). */
+  int result = NDBT_OK;
+  const NdbDictionary::Table* pTab = ctx->getTab();
+
+  Ndb* pNdb = new Ndb(&ctx->m_cluster_connection, "TEST_DB");
+  if (pNdb == NULL){
+    ndbout << "pNdb == NULL" << endl;      
+    return NDBT_FAILED;  
+  }
+  if (pNdb->init(2048)){
+    ERR(pNdb->getNdbError());
+    delete pNdb;
+    return NDBT_FAILED;
+  }
+
+  NdbConnection* pCon = pNdb->startTransaction();
+  if (pCon == NULL){
+    ERR(pNdb->getNdbError());
+    delete pNdb;
+    return NDBT_FAILED;
+  }
+
+  NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
+  if (pOp == NULL){
+    ERR(pOp->getNdbError());
+    pNdb->closeTransaction(pCon);
+    delete pNdb;
+    return NDBT_FAILED;
+  }
+
+  if (pOp->readTuples() != 0){
+    ERR(pOp->getNdbError());
+    pNdb->closeTransaction(pCon);
+    delete pNdb;
+    return NDBT_FAILED;
+  }
+
+  if (pOp->getValue(NdbDictionary::Column::FRAGMENT) == 0){
+    ERR(pOp->getNdbError());
+    pNdb->closeTransaction(pCon);
+    delete pNdb;
+    return NDBT_FAILED;
+  }
+  int res= 42;
+  pCon->executeAsynch(NoCommit, testExecuteAsynchCallback, &res);
+  while(pNdb->pollNdb(100000) == 0)
+    ;
+  if (res != 0){
+    ERR(pCon->getNdbError());
+    ndbout << "Error returned from execute: " << res << endl;
+    result= NDBT_FAILED;
+  }
+
+  pNdb->closeTransaction(pCon);
+
+  delete pNdb;
+
+  return result;
+}
+
+
 template class Vector<NdbScanOperation*>;
 
 
@@ -1321,6 +1391,10 @@ TESTCASE("Scan_4006", 
   INITIALIZER(runLoadTable);
   INITIALIZER(runScan_4006);
   FINALIZER(runClearTable);
+}
+TESTCASE("ExecuteAsynch", 
+	 "Check that executeAsync() works (BUG#27495)\n"){ 
+  INITIALIZER(runTestExecuteAsynch);
 }
 NDBT_TESTSUITE_END(testNdbApi);
 
Thread
bk commit into 5.0 tree (knielsen:1.2417) BUG#27495knielsen28 Mar