Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9497ee2f
Commit
9497ee2f
authored
Oct 13, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testBasic -n NoCommit626
Handle commit of zero operations
parent
57612c47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
67 deletions
+67
-67
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+7
-19
ndb/test/ndbapi/testBasic.cpp
ndb/test/ndbapi/testBasic.cpp
+60
-48
No files found.
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
9497ee2f
...
@@ -5107,27 +5107,15 @@ void Dbtc::execLQHKEYREF(Signal* signal)
...
@@ -5107,27 +5107,15 @@ void Dbtc::execLQHKEYREF(Signal* signal)
*---------------------------------------------------------------------*/
*---------------------------------------------------------------------*/
regApiPtr
->
lqhkeyreqrec
--
;
regApiPtr
->
lqhkeyreqrec
--
;
if
(
regApiPtr
->
lqhkeyconfrec
==
regApiPtr
->
lqhkeyreqrec
)
{
if
(
regApiPtr
->
lqhkeyconfrec
==
regApiPtr
->
lqhkeyreqrec
)
{
if
((
regApiPtr
->
lqhkeyconfrec
==
0
)
&&
if
(
regApiPtr
->
apiConnectstate
==
CS_START_COMMITTING
)
{
(
regApiPtr
->
apiConnectstate
==
CS_START_COMMITTING
))
{
if
(
regApiPtr
->
lqhkeyconfrec
)
{
if
(
abort
==
TcKeyReq
::
IgnoreError
){
jam
();
jam
();
regApiPtr
->
returnsignal
=
RS_NO_RETURN
;
diverify010Lab
(
signal
);
abort010Lab
(
signal
);
}
else
{
return
;
jam
();
sendtckeyconf
(
signal
,
1
);
regApiPtr
->
apiConnectstate
=
CS_CONNECTED
;
}
}
/*----------------------------------------------------------------
* Not a single operation was successful.
* This we report as an aborted transaction
* to avoid performing a commit of zero operations.
*----------------------------------------------------------------*/
TCKEY_abort
(
signal
,
54
);
return
;
}
//if
if
(
regApiPtr
->
apiConnectstate
==
CS_START_COMMITTING
)
{
jam
();
diverify010Lab
(
signal
);
return
;
return
;
}
else
if
(
regApiPtr
->
tckeyrec
>
0
||
regApiPtr
->
m_exec_flag
)
{
}
else
if
(
regApiPtr
->
tckeyrec
>
0
||
regApiPtr
->
m_exec_flag
)
{
jam
();
jam
();
...
...
ndb/test/ndbapi/testBasic.cpp
View file @
9497ee2f
...
@@ -398,14 +398,14 @@ int runNoCommitSleep(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -398,14 +398,14 @@ int runNoCommitSleep(NDBT_Context* ctx, NDBT_Step* step){
for
(
int
i
=
2
;
i
<
8
;
i
++
){
for
(
int
i
=
2
;
i
<
8
;
i
++
){
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
ndbout
<<
i
<<
": Sleeping for "
<<
sleepTime
<<
" ms"
<<
endl
;
ndbout
<<
i
<<
": Sleeping for "
<<
sleepTime
<<
" ms"
<<
endl
;
NdbSleep_MilliSleep
(
sleepTime
);
NdbSleep_MilliSleep
(
sleepTime
);
// Dont care about result of these ops
// Dont care about result of these ops
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
);
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
);
hugoOps
.
closeTransaction
(
pNdb
);
hugoOps
.
closeTransaction
(
pNdb
);
sleepTime
=
sleepTime
*
i
;
sleepTime
=
sleepTime
*
i
;
...
@@ -424,16 +424,16 @@ int runCommit626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -424,16 +424,16 @@ int runCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// Commit transaction
// Commit transaction
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
// Commit transaction
// Commit transaction
// Multiple operations
// Multiple operations
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
}
while
(
false
);
}
while
(
false
);
...
@@ -467,7 +467,7 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -467,7 +467,7 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// Commit transaction, TryCommit
// Commit transaction, TryCommit
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
TryCommit
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
TryCommit
)
==
626
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
@@ -475,11 +475,11 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -475,11 +475,11 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
// Several operations in one transaction
// Several operations in one transaction
// The insert is OK
// The insert is OK
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
TryCommit
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
TryCommit
)
==
626
);
}
while
(
false
);
}
while
(
false
);
...
@@ -513,20 +513,23 @@ int runCommit_CommitAsMuchAsPossible626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -513,20 +513,23 @@ int runCommit_CommitAsMuchAsPossible626(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// Commit transaction, CommitAsMuchAsPossible
// Commit transaction, CommitAsMuchAsPossible
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
626
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
// Commit transaction, CommitAsMuchAsPossible
// Commit transaction, CommitAsMuchAsPossible
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
true
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
626
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
626
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
}
while
(
false
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
}
while
(
false
);
hugoOps
.
closeTransaction
(
pNdb
);
hugoOps
.
closeTransaction
(
pNdb
);
...
@@ -542,8 +545,14 @@ int runCommit_CommitAsMuchAsPossible630(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -542,8 +545,14 @@ int runCommit_CommitAsMuchAsPossible630(NDBT_Context* ctx, NDBT_Step* step){
// Commit transaction, CommitAsMuchAsPossible
// Commit transaction, CommitAsMuchAsPossible
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkDeleteRecord
(
pNdb
,
2
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
630
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
630
);
}
while
(
false
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
}
while
(
false
);
hugoOps
.
closeTransaction
(
pNdb
);
hugoOps
.
closeTransaction
(
pNdb
);
...
@@ -558,13 +567,13 @@ int runNoCommit626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -558,13 +567,13 @@ int runNoCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// No commit transaction, readTuple
// No commit transaction, readTuple
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
false
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
// No commit transaction, readTupleExcluive
// No commit transaction, readTupleExcluive
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
}
while
(
false
);
}
while
(
false
);
...
@@ -598,7 +607,7 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -598,7 +607,7 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// No commit transaction, rollback
// No commit transaction, rollback
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
@@ -606,10 +615,10 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -606,10 +615,10 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
// No commit transaction, rollback
// No commit transaction, rollback
// Multiple operations
// Multiple operations
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
}
while
(
false
);
}
while
(
false
);
...
@@ -647,7 +656,7 @@ int runNoCommitAndClose(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -647,7 +656,7 @@ int runNoCommitAndClose(NDBT_Context* ctx, NDBT_Step* step){
// Read
// Read
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
10
;
i
++
)
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
i
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
i
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
@@ -701,7 +710,7 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -701,7 +710,7 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
// Check record is deleted
// Check record is deleted
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
...
@@ -709,13 +718,13 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -709,13 +718,13 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
// Check record is not deleted
// Check record is not deleted
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
// Check record is back to original value
// Check record is back to original value
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
compareRecordToCopy
()
==
NDBT_OK
);
CHECK
(
hugoOps
.
compareRecordToCopy
()
==
NDBT_OK
);
...
@@ -853,7 +862,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -853,7 +862,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
do
{
do
{
// Read record 5
// Read record 5
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
@@ -872,7 +881,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -872,7 +881,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
// Check record is not deleted
// Check record is not deleted
// Close transaction should have rollbacked
// Close transaction should have rollbacked
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
}
while
(
false
);
}
while
(
false
);
...
@@ -964,8 +973,8 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -964,8 +973,8 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){
for
(
int
row
=
0
;
row
<
records
;
row
++
){
for
(
int
row
=
0
;
row
<
records
;
row
++
){
int
res
;
int
res
;
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
for
(
int
i
=
0
;
i
<
OPS_TOTAL
;
i
+=
OPS_PER_TRANS
){
for
(
Uint32
i
=
0
;
i
<
OPS_TOTAL
;
i
+=
OPS_PER_TRANS
){
for
(
int
j
=
0
;
j
<
OPS_PER_TRANS
;
j
++
){
for
(
Uint32
j
=
0
;
j
<
OPS_PER_TRANS
;
j
++
){
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
row
,
1
,
i
)
==
0
);
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
row
,
1
,
i
)
==
0
);
}
}
g_info
<<
"Performed "
<<
(
i
+
OPS_PER_TRANS
)
<<
" updates on row: "
<<
row
g_info
<<
"Performed "
<<
(
i
+
OPS_PER_TRANS
)
<<
" updates on row: "
<<
row
...
@@ -1007,9 +1016,9 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -1007,9 +1016,9 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){
const
Uint32
OPS_TOTAL
=
4096
;
const
Uint32
OPS_TOTAL
=
4096
;
const
Uint32
LOOPS
=
10
;
const
Uint32
LOOPS
=
10
;
for
(
int
loop
=
0
;
loop
<
LOOPS
;
loop
++
){
for
(
Uint32
loop
=
0
;
loop
<
LOOPS
;
loop
++
){
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
for
(
int
i
=
0
;
i
<
OPS_TOTAL
-
1
;
i
++
){
for
(
Uint32
i
=
0
;
i
<
OPS_TOTAL
-
1
;
i
++
){
if
((
i
&
1
)
==
0
){
if
((
i
&
1
)
==
0
){
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
0
,
1
,
loop
)
==
0
);
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
0
,
1
,
loop
)
==
0
);
}
else
{
}
else
{
...
@@ -1110,13 +1119,6 @@ TESTCASE("ReadWithLocksAndInserts",
...
@@ -1110,13 +1119,6 @@ TESTCASE("ReadWithLocksAndInserts",
STEP
(
runInsertUntilStopped
);
STEP
(
runInsertUntilStopped
);
FINALIZER
(
runClearTable
);
FINALIZER
(
runClearTable
);
}
}
TESTCASE
(
"ReadConsistency"
,
"Check that a read within a transaction returns the "
\
"same result no matter"
){
STEP
(
runInsertOne
);
STEP
(
runReadOne
);
FINALIZER
(
runClearTable2
);
}
TESTCASE
(
"PkInsertTwice"
,
TESTCASE
(
"PkInsertTwice"
,
"Verify that we can't insert an already inserted record."
"Verify that we can't insert an already inserted record."
"Error should be returned"
){
"Error should be returned"
){
...
@@ -1124,12 +1126,6 @@ TESTCASE("PkInsertTwice",
...
@@ -1124,12 +1126,6 @@ TESTCASE("PkInsertTwice",
STEP
(
runInsertTwice
);
STEP
(
runInsertTwice
);
FINALIZER
(
runClearTable
);
FINALIZER
(
runClearTable
);
}
}
TESTCASE
(
"Fill"
,
"Verify what happens when we fill the db"
){
INITIALIZER
(
runFillTable
);
INITIALIZER
(
runPkRead
);
FINALIZER
(
runClearTable2
);
}
TESTCASE
(
"NoCommitSleep"
,
TESTCASE
(
"NoCommitSleep"
,
"Verify what happens when a NoCommit transaction is aborted by "
"Verify what happens when a NoCommit transaction is aborted by "
"NDB because the application is sleeping"
){
"NDB because the application is sleeping"
){
...
@@ -1275,8 +1271,24 @@ TESTCASE("MassiveTransaction",
...
@@ -1275,8 +1271,24 @@ TESTCASE("MassiveTransaction",
INITIALIZER
(
runLoadTable2
);
INITIALIZER
(
runLoadTable2
);
FINALIZER
(
runClearTable2
);
FINALIZER
(
runClearTable2
);
}
}
TESTCASE
(
"Fill"
,
"Verify what happens when we fill the db"
){
INITIALIZER
(
runFillTable
);
INITIALIZER
(
runPkRead
);
FINALIZER
(
runClearTable2
);
}
NDBT_TESTSUITE_END
(
testBasic
);
NDBT_TESTSUITE_END
(
testBasic
);
#if 0
TESTCASE("ReadConsistency",
"Check that a read within a transaction returns the " \
"same result no matter"){
STEP(runInsertOne);
STEP(runReadOne);
FINALIZER(runClearTable2);
}
#endif
int
main
(
int
argc
,
const
char
**
argv
){
int
main
(
int
argc
,
const
char
**
argv
){
ndb_init
();
ndb_init
();
return
testBasic
.
execute
(
argc
,
argv
);
return
testBasic
.
execute
(
argc
,
argv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment