summaryrefslogtreecommitdiff
path: root/ndb/test/src
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2005-07-01 09:57:48 +0200
committerunknown <joreland@mysql.com>2005-07-01 09:57:48 +0200
commit5285b530428439c536ca6c58b9624e3ea8b33c08 (patch)
tree6f0ae3227272c5ad841ac3e67cc2c7366bccf4e0 /ndb/test/src
parent8cf4e0c86bed9dc02f4383289a1e5f621feca775 (diff)
downloadmariadb-git-5285b530428439c536ca6c58b9624e3ea8b33c08.tar.gz
bug#11133 - ndb write handling
fix handling of write's in lock queue add test case add support for pkWrite+async exec in HugoOperations ndb/src/kernel/blocks/dbacc/DbaccMain.cpp: Handle operation type wrt ZWRITE when restarting operations ndb/test/include/HugoOperations.hpp: Add support for 1) pkWriteRecord 2) async execute ndb/test/ndbapi/testNdbApi.cpp: Extend test case for bug#11133 with multi transaction tests aswell... ndb/test/src/HugoOperations.cpp: Add support for 1) pkWriteRecord 2) async execute
Diffstat (limited to 'ndb/test/src')
-rw-r--r--ndb/test/src/HugoOperations.cpp91
1 files changed, 87 insertions, 4 deletions
diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp
index 8e6603ec6ff..6b1a1ca395b 100644
--- a/ndb/test/src/HugoOperations.cpp
+++ b/ndb/test/src/HugoOperations.cpp
@@ -16,7 +16,6 @@
#include <HugoOperations.hpp>
-
int HugoOperations::startTransaction(Ndb* pNdb){
if (pTrans != NULL){
@@ -199,6 +198,48 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb,
return NDBT_OK;
}
+int HugoOperations::pkWriteRecord(Ndb* pNdb,
+ int recordNo,
+ int numRecords,
+ int updatesValue){
+
+ int a, check;
+ for(int r=0; r < numRecords; r++){
+ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ check = pOp->writeTuple();
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ // Define primary keys
+ for(a = 0; a<tab.getNoOfColumns(); a++){
+ if (tab.getColumn(a)->getPrimaryKey() == true){
+ if(equalForAttr(pOp, a, r+recordNo) != 0){
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ // Define attributes to update
+ for(a = 0; a<tab.getNoOfColumns(); a++){
+ if (tab.getColumn(a)->getPrimaryKey() == false){
+ if(setValueForAttr(pOp, a, recordNo+r, updatesValue ) != 0){
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+ }
+ return NDBT_OK;
+}
+
int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int recordNo,
int numRecords){
@@ -399,16 +440,58 @@ int HugoOperations::execute_Rollback(Ndb* pNdb){
return NDBT_OK;
}
+void
+HugoOperations_async_callback(int res, NdbConnection* pCon, void* ho)
+{
+ ((HugoOperations*)ho)->callback(res, pCon);
+}
+
+void
+HugoOperations::callback(int res, NdbConnection* pCon)
+{
+ assert(pCon == pTrans);
+ m_async_reply= 1;
+ m_async_return= res;
+}
+
+int
+HugoOperations::execute_async(Ndb* pNdb, ExecType et, AbortOption eao){
+
+ m_async_reply= 0;
+ pTrans->executeAsynchPrepare(et,
+ HugoOperations_async_callback,
+ this,
+ eao);
+
+ pNdb->sendPreparedTransactions();
+
+ return NDBT_OK;
+}
+
+int
+HugoOperations::wait_async(Ndb* pNdb, int timeout)
+{
+ pNdb->pollNdb(1000);
+
+ if(m_async_reply)
+ {
+ return m_async_return;
+ }
+ ndbout_c("wait returned nothing...");
+ return -1;
+}
+
HugoOperations::HugoOperations(const NdbDictionary::Table& _tab):
UtilTransactions(_tab),
calc(_tab),
- pTrans(NULL){
-
+ pTrans(NULL)
+{
}
HugoOperations::~HugoOperations(){
deallocRows();
- if (pTrans != NULL){
+ if (pTrans != NULL)
+ {
pTrans->close();
pTrans = NULL;
}