diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2007-01-30 19:45:14 +0100 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2007-01-30 19:45:14 +0100 |
commit | 16c58c11b1617a8a4982e46c0d339ff850cfb05f (patch) | |
tree | 4f99a47920ef821bdee7fecb704a376f0ef4cbf3 /storage/ndb/src/ndbapi/NdbOperationDefine.cpp | |
parent | faac0f1d1b3755a49dcf8ead4d408681e1e3916f (diff) | |
download | mariadb-git-16c58c11b1617a8a4982e46c0d339ff850cfb05f.tar.gz |
ndb - interface change of handling of abort option
1) move AbortOption from NdbTransaction to NdbOperation
2) let each operation have a "default" abort option dependant on
operation type
- read - AO_IgnoreError
- dml - AbortOnError
- scan take over - AbortOnError
3) Changed default value to execute() from AbortOnError to DefaultAbortOption, which does not change the operations abort-option.
Another value to execute(AO) is equivalent to setting AO on each operation before calling execute
4) execute() does _only_ return -1 if transaction has been aborted
otherwise, you need to check each operation for error code
sql/ha_ndbcluster.cc:
adopt to changes in aption option handling
storage/ndb/include/ndbapi/NdbOperation.hpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/include/ndbapi/NdbTransaction.hpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/src/ndbapi/NdbBlob.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/src/ndbapi/NdbIndexStat.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
Put default value on abortoption dependant on operation type
storage/ndb/src/ndbapi/NdbOperationExec.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/src/ndbapi/NdbTransaction.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/test/include/HugoOperations.hpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/test/ndbapi/testNdbApi.cpp:
Move "ownership" of AbortOption to operation from transaction
storage/ndb/test/src/HugoOperations.cpp:
Move "ownership" of AbortOption to operation from transaction
Diffstat (limited to 'storage/ndb/src/ndbapi/NdbOperationDefine.cpp')
-rw-r--r-- | storage/ndb/src/ndbapi/NdbOperationDefine.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp index d14fcf60ec4..52b517a1168 100644 --- a/storage/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -45,6 +45,7 @@ NdbOperation::insertTuple() tNdbCon->theSimpleState = 0; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -65,6 +66,7 @@ NdbOperation::updateTuple() theOperationType = UpdateRequest; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -85,12 +87,35 @@ NdbOperation::writeTuple() theOperationType = WriteRequest; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); return -1; }//if }//NdbOperation::writeTuple() +/***************************************************************************** + * int deleteTuple(); + *****************************************************************************/ +int +NdbOperation::deleteTuple() +{ + NdbTransaction* tNdbCon = theNdbCon; + int tErrorLine = theErrorLine; + if (theStatus == Init) { + theStatus = OperationDefined; + tNdbCon->theSimpleState = 0; + theOperationType = DeleteRequest; + theErrorLine = tErrorLine++; + theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; + return 0; + } else { + setErrorCode(4200); + return -1; + }//if +}//NdbOperation::deleteTuple() + /****************************************************************************** * int readTuple(); *****************************************************************************/ @@ -125,6 +150,7 @@ NdbOperation::readTuple() theOperationType = ReadRequest; theErrorLine = tErrorLine++; theLockMode = LM_Read; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -132,27 +158,6 @@ NdbOperation::readTuple() }//if }//NdbOperation::readTuple() -/***************************************************************************** - * int deleteTuple(); - *****************************************************************************/ -int -NdbOperation::deleteTuple() -{ - NdbTransaction* tNdbCon = theNdbCon; - int tErrorLine = theErrorLine; - if (theStatus == Init) { - theStatus = OperationDefined; - tNdbCon->theSimpleState = 0; - theOperationType = DeleteRequest; - theErrorLine = tErrorLine++; - theLockMode = LM_Exclusive; - return 0; - } else { - setErrorCode(4200); - return -1; - }//if -}//NdbOperation::deleteTuple() - /****************************************************************************** * int readTupleExclusive(); *****************************************************************************/ @@ -167,6 +172,7 @@ NdbOperation::readTupleExclusive() theOperationType = ReadExclusive; theErrorLine = tErrorLine++; theLockMode = LM_Exclusive; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -223,6 +229,7 @@ NdbOperation::committedRead() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AO_IgnoreError; return 0; } else { setErrorCode(4200); @@ -246,6 +253,7 @@ NdbOperation::dirtyUpdate() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -269,6 +277,7 @@ NdbOperation::dirtyWrite() theDirtyIndicator = 1; theErrorLine = tErrorLine++; theLockMode = LM_CommittedRead; + m_abortOption = AbortOnError; return 0; } else { setErrorCode(4200); @@ -291,6 +300,7 @@ NdbOperation::interpretedUpdateTuple() theAI_LenInCurrAI = 25; theLockMode = LM_Exclusive; theErrorLine = tErrorLine++; + m_abortOption = AbortOnError; initInterpreter(); return 0; } else { @@ -315,6 +325,7 @@ NdbOperation::interpretedDeleteTuple() theErrorLine = tErrorLine++; theAI_LenInCurrAI = 25; theLockMode = LM_Exclusive; + m_abortOption = AbortOnError; initInterpreter(); return 0; } else { |