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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
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
Show 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)
*---------------------------------------------------------------------*/
regApiPtr
->
lqhkeyreqrec
--
;
if
(
regApiPtr
->
lqhkeyconfrec
==
regApiPtr
->
lqhkeyreqrec
)
{
if
((
regApiPtr
->
lqhkeyconfrec
==
0
)
&&
(
regApiPtr
->
apiConnectstate
==
CS_START_COMMITTING
))
{
if
(
abort
==
TcKeyReq
::
IgnoreError
){
jam
();
regApiPtr
->
returnsignal
=
RS_NO_RETURN
;
abort010Lab
(
signal
);
return
;
}
/*----------------------------------------------------------------
* 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
)
{
if
(
regApiPtr
->
lqhkeyconfrec
)
{
jam
();
diverify010Lab
(
signal
);
}
else
{
jam
();
sendtckeyconf
(
signal
,
1
);
regApiPtr
->
apiConnectstate
=
CS_CONNECTED
;
}
return
;
}
else
if
(
regApiPtr
->
tckeyrec
>
0
||
regApiPtr
->
m_exec_flag
)
{
jam
();
...
...
ndb/test/ndbapi/testBasic.cpp
View file @
9497ee2f
...
...
@@ -398,14 +398,14 @@ int runNoCommitSleep(NDBT_Context* ctx, NDBT_Step* step){
for
(
int
i
=
2
;
i
<
8
;
i
++
){
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
);
ndbout
<<
i
<<
": Sleeping for "
<<
sleepTime
<<
" ms"
<<
endl
;
NdbSleep_MilliSleep
(
sleepTime
);
// 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
);
sleepTime
=
sleepTime
*
i
;
...
...
@@ -424,16 +424,16 @@ int runCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Commit transaction
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
.
closeTransaction
(
pNdb
)
==
0
);
// Commit transaction
// Multiple operations
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
}
while
(
false
);
...
...
@@ -467,7 +467,7 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Commit transaction, TryCommit
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
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -475,11 +475,11 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){
// Several operations in one transaction
// The insert is OK
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
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
);
}
while
(
false
);
...
...
@@ -513,20 +513,23 @@ int runCommit_CommitAsMuchAsPossible626(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Commit transaction, CommitAsMuchAsPossible
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
.
closeTransaction
(
pNdb
)
==
0
);
// Commit transaction, CommitAsMuchAsPossible
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
true
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
true
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
,
CommitAsMuchAsPossible
)
==
626
);
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
);
...
...
@@ -542,8 +545,14 @@ int runCommit_CommitAsMuchAsPossible630(NDBT_Context* ctx, NDBT_Step* step){
// Commit transaction, CommitAsMuchAsPossible
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
)
==
0
);
CHECK
(
hugoOps
.
pkDeleteRecord
(
pNdb
,
2
)
==
0
);
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
);
...
...
@@ -558,13 +567,13 @@ int runNoCommit626(NDBT_Context* ctx, NDBT_Step* step){
do
{
// No commit transaction, readTuple
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
.
closeTransaction
(
pNdb
)
==
0
);
// No commit transaction, readTupleExcluive
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
);
}
while
(
false
);
...
...
@@ -598,7 +607,7 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
do
{
// No commit transaction, rollback
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_Rollback
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -606,10 +615,10 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){
// No commit transaction, rollback
// Multiple operations
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
tru
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
2
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
3
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
4
,
1
,
NdbOperation
::
LM_Exclusiv
e
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
}
while
(
false
);
...
...
@@ -647,7 +656,7 @@ int runNoCommitAndClose(NDBT_Context* ctx, NDBT_Step* step){
// Read
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
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
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -701,7 +710,7 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
// 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_Rollback
(
pNdb
)
==
0
);
...
...
@@ -709,13 +718,13 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
// Check record is not deleted
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
.
closeTransaction
(
pNdb
)
==
0
);
// Check record is back to original value
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
.
compareRecordToCopy
()
==
NDBT_OK
);
...
...
@@ -853,7 +862,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Read record 5
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
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -872,7 +881,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){
// Check record is not deleted
// Close transaction should have rollbacked
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
);
}
while
(
false
);
...
...
@@ -964,8 +973,8 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){
for
(
int
row
=
0
;
row
<
records
;
row
++
){
int
res
;
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
for
(
int
i
=
0
;
i
<
OPS_TOTAL
;
i
+=
OPS_PER_TRANS
){
for
(
int
j
=
0
;
j
<
OPS_PER_TRANS
;
j
++
){
for
(
Uint32
i
=
0
;
i
<
OPS_TOTAL
;
i
+=
OPS_PER_TRANS
){
for
(
Uint32
j
=
0
;
j
<
OPS_PER_TRANS
;
j
++
){
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
row
,
1
,
i
)
==
0
);
}
g_info
<<
"Performed "
<<
(
i
+
OPS_PER_TRANS
)
<<
" updates on row: "
<<
row
...
...
@@ -1007,9 +1016,9 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){
const
Uint32
OPS_TOTAL
=
4096
;
const
Uint32
LOOPS
=
10
;
for
(
int
loop
=
0
;
loop
<
LOOPS
;
loop
++
){
for
(
Uint32
loop
=
0
;
loop
<
LOOPS
;
loop
++
){
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
){
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
0
,
1
,
loop
)
==
0
);
}
else
{
...
...
@@ -1110,13 +1119,6 @@ TESTCASE("ReadWithLocksAndInserts",
STEP
(
runInsertUntilStopped
);
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"
,
"Verify that we can't insert an already inserted record."
"Error should be returned"
){
...
...
@@ -1124,12 +1126,6 @@ TESTCASE("PkInsertTwice",
STEP
(
runInsertTwice
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"Fill"
,
"Verify what happens when we fill the db"
){
INITIALIZER
(
runFillTable
);
INITIALIZER
(
runPkRead
);
FINALIZER
(
runClearTable2
);
}
TESTCASE
(
"NoCommitSleep"
,
"Verify what happens when a NoCommit transaction is aborted by "
"NDB because the application is sleeping"
){
...
...
@@ -1275,8 +1271,24 @@ TESTCASE("MassiveTransaction",
INITIALIZER
(
runLoadTable2
);
FINALIZER
(
runClearTable2
);
}
TESTCASE
(
"Fill"
,
"Verify what happens when we fill the db"
){
INITIALIZER
(
runFillTable
);
INITIALIZER
(
runPkRead
);
FINALIZER
(
runClearTable2
);
}
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
){
ndb_init
();
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