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
46b2eae0
Commit
46b2eae0
authored
Oct 08, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test prg update
- make test node restart test harder
parent
07359aef
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
178 additions
and
135 deletions
+178
-135
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+0
-2
ndb/test/include/HugoOperations.hpp
ndb/test/include/HugoOperations.hpp
+2
-10
ndb/test/include/HugoTransactions.hpp
ndb/test/include/HugoTransactions.hpp
+2
-2
ndb/test/ndbapi/testBasic.cpp
ndb/test/ndbapi/testBasic.cpp
+15
-15
ndb/test/ndbapi/testNdbApi.cpp
ndb/test/ndbapi/testNdbApi.cpp
+1
-1
ndb/test/ndbapi/testNodeRestart.cpp
ndb/test/ndbapi/testNodeRestart.cpp
+117
-3
ndb/test/ndbapi/testOperations.cpp
ndb/test/ndbapi/testOperations.cpp
+4
-4
ndb/test/ndbapi/testTransactions.cpp
ndb/test/ndbapi/testTransactions.cpp
+4
-4
ndb/test/run-test/daily-devel-tests.txt
ndb/test/run-test/daily-devel-tests.txt
+3
-3
ndb/test/src/HugoOperations.cpp
ndb/test/src/HugoOperations.cpp
+15
-87
ndb/test/src/HugoTransactions.cpp
ndb/test/src/HugoTransactions.cpp
+15
-4
No files found.
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
46b2eae0
...
...
@@ -3379,8 +3379,6 @@ void Dbtc::releaseSimpleRead(Signal* signal,
(
state
==
CS_START_COMMITTING
?
CS_CONNECTED
:
state
);
setApiConTimer
(
regApiPtr
.
i
,
0
,
__LINE__
);
if
(
state
!=
regApiPtr
.
p
->
apiConnectstate
)
ndbout_c
(
"resettting state from %d to %d"
,
state
,
regApiPtr
.
p
->
apiConnectstate
);
return
;
}
...
...
ndb/test/include/HugoOperations.hpp
View file @
46b2eae0
...
...
@@ -38,16 +38,8 @@ public:
int
pkReadRecord
(
Ndb
*
,
int
recordNo
,
bool
exclusive
=
false
,
int
numRecords
=
1
);
int
pkSimpleReadRecord
(
Ndb
*
,
int
recordNo
,
int
numRecords
=
1
);
int
pkDirtyReadRecord
(
Ndb
*
,
int
recordNo
,
int
numRecords
=
1
);
int
numRecords
=
1
,
NdbOperation
::
LockMode
lm
=
NdbOperation
::
LM_Read
);
int
pkUpdateRecord
(
Ndb
*
,
int
recordNo
,
...
...
ndb/test/include/HugoTransactions.hpp
View file @
46b2eae0
...
...
@@ -48,8 +48,8 @@ public:
int
pkReadRecords
(
Ndb
*
,
int
records
,
int
batchsize
=
1
,
bool
dirty
=
false
);
NdbOperation
::
LockMode
=
NdbOperation
::
LM_Read
);
int
scanUpdateRecords
(
Ndb
*
,
int
records
,
int
abort
=
0
,
...
...
ndb/test/ndbapi/testBasic.cpp
View file @
46b2eae0
...
...
@@ -160,8 +160,8 @@ int runPkDirtyRead(NDBT_Context* ctx, NDBT_Step* step){
HugoTransactions
hugoTrans
(
*
ctx
->
getTab
());
while
(
i
<
loops
)
{
g_info
<<
i
<<
": "
;
if
(
hugoTrans
.
pkReadRecords
(
GETNDB
(
step
),
records
,
batchSize
,
dirty
)
!=
NDBT_OK
){
if
(
hugoTrans
.
pkReadRecords
(
GETNDB
(
step
),
records
,
batchSize
,
NdbOperation
::
LM_CommittedRead
)
!=
NDBT_OK
){
g_info
<<
endl
;
return
NDBT_FAILED
;
}
...
...
@@ -736,7 +736,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
// Read value and save it for later
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
false
,
numRecords
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
numRecords
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
0
)
==
NDBT_OK
);
// Update value 0
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -747,7 +747,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
// Check record is updated
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
,
numRecords
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
numRecords
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
5
)
==
NDBT_OK
);
// Updates value 5
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
...
...
@@ -756,7 +756,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){
// Check record is back to original value
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
,
numRecords
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
numRecords
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
0
)
==
NDBT_OK
);
// Updates value 0
...
...
@@ -775,7 +775,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Read value and save it for later
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
false
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
0
)
==
NDBT_OK
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
...
@@ -785,7 +785,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
for
(
Uint32
i
=
0
;
i
<
1
;
i
++
){
// Read record 5 - 10
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
for
(
j
=
0
;
j
<
10
;
j
++
){
...
...
@@ -794,7 +794,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
5
,
10
,
updatesValue
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
updatesValue
)
==
0
);
}
...
...
@@ -806,7 +806,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
#if 0
// Check records are deleted
CHECK(hugoOps.pkReadRecord(pNdb, 5,
true, 10
) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, 5,
10, NdbOperation::LM_Exclusive
) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 626);
#endif
...
...
@@ -814,7 +814,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
pkInsertRecord
(
pNdb
,
5
,
10
,
updatesValue
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
updatesValue
)
==
0
);
}
...
...
@@ -823,7 +823,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
// Check records are deleted
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
626
);
CHECK
(
hugoOps
.
execute_Rollback
(
pNdb
)
==
0
);
...
...
@@ -833,7 +833,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){
// Check records are not deleted
// after rollback
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
verifyUpdatesValue
(
0
)
==
NDBT_OK
);
...
...
@@ -889,7 +889,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){
do
{
// Read 10 records
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_NoCommit
(
pNdb
)
==
0
);
// Update 10 records
...
...
@@ -905,7 +905,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){
// Check record's are deleted
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
626
);
}
while
(
false
);
...
...
@@ -930,7 +930,7 @@ int runRollbackNothing(NDBT_Context* ctx, NDBT_Step* step){
// Check records are not deleted
CHECK
(
hugoOps
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
true
,
10
)
==
0
);
CHECK
(
hugoOps
.
pkReadRecord
(
pNdb
,
5
,
10
,
NdbOperation
::
LM_Exclusive
)
==
0
);
CHECK
(
hugoOps
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOps
.
closeTransaction
(
pNdb
)
==
0
);
...
...
ndb/test/ndbapi/testNdbApi.cpp
View file @
46b2eae0
...
...
@@ -229,7 +229,7 @@ int runTestMaxOperations(NDBT_Context* ctx, NDBT_Step* step){
int
i
=
0
;
while
(
errors
<
maxErrors
){
if
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
false
,
1
)
!=
NDBT_OK
){
if
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
)
!=
NDBT_OK
){
errors
++
;
continue
;
}
...
...
ndb/test/ndbapi/testNodeRestart.cpp
View file @
46b2eae0
...
...
@@ -100,11 +100,16 @@ int runScanReadUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
int
runPkReadUntilStopped
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
result
=
NDBT_OK
;
int
records
=
ctx
->
getNumRecords
();
NdbOperation
::
LockMode
lm
=
(
NdbOperation
::
LockMode
)
ctx
->
getProperty
(
"ReadLockMode"
,
(
Uint32
)
NdbOperation
::
LM_Read
);
int
i
=
0
;
HugoTransactions
hugoTrans
(
*
ctx
->
getTab
());
while
(
ctx
->
isTestStopped
()
==
false
)
{
g_info
<<
i
<<
": "
;
if
(
hugoTrans
.
pkReadRecords
(
GETNDB
(
step
),
records
,
128
)
!=
0
){
int
rows
=
(
rand
()
%
records
)
+
1
;
int
batch
=
(
rand
()
%
rows
)
+
1
;
if
(
hugoTrans
.
pkReadRecords
(
GETNDB
(
step
),
rows
,
batch
,
lm
)
!=
0
){
return
NDBT_FAILED
;
}
i
++
;
...
...
@@ -119,7 +124,9 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
HugoTransactions
hugoTrans
(
*
ctx
->
getTab
());
while
(
ctx
->
isTestStopped
()
==
false
)
{
g_info
<<
i
<<
": "
;
if
(
hugoTrans
.
pkUpdateRecords
(
GETNDB
(
step
),
records
)
!=
0
){
int
rows
=
(
rand
()
%
records
)
+
1
;
int
batch
=
(
rand
()
%
rows
)
+
1
;
if
(
hugoTrans
.
pkUpdateRecords
(
GETNDB
(
step
),
rows
,
batch
)
!=
0
){
return
NDBT_FAILED
;
}
i
++
;
...
...
@@ -127,6 +134,60 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){
return
result
;
}
int
runPkReadPkUpdateUntilStopped
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
result
=
NDBT_OK
;
int
records
=
ctx
->
getNumRecords
();
Ndb
*
pNdb
=
GETNDB
(
step
);
int
i
=
0
;
HugoOperations
hugoOps
(
*
ctx
->
getTab
());
while
(
ctx
->
isTestStopped
()
==
false
)
{
g_info
<<
i
++
<<
": "
;
int
rows
=
(
rand
()
%
records
)
+
1
;
int
batch
=
(
rand
()
%
rows
)
+
1
;
int
row
=
(
records
-
rows
)
?
rand
()
%
(
records
-
rows
)
:
0
;
int
j
,
k
;
for
(
j
=
0
;
j
<
rows
;
j
+=
batch
)
{
k
=
batch
;
if
(
j
+
k
>
rows
)
k
=
rows
-
j
;
if
(
hugoOps
.
startTransaction
(
pNdb
)
!=
0
)
goto
err
;
if
(
hugoOps
.
pkReadRecord
(
pNdb
,
row
+
j
,
k
,
NdbOperation
::
LM_Exclusive
)
!=
0
)
goto
err
;
if
(
hugoOps
.
execute_NoCommit
(
pNdb
)
!=
0
)
goto
err
;
if
(
hugoOps
.
pkUpdateRecord
(
pNdb
,
row
+
j
,
k
,
rand
())
!=
0
)
goto
err
;
if
(
hugoOps
.
execute_Commit
(
pNdb
)
!=
0
)
goto
err
;
if
(
hugoOps
.
closeTransaction
(
pNdb
)
!=
0
)
return
NDBT_FAILED
;
}
continue
;
err:
NdbConnection
*
pCon
=
hugoOps
.
getTransaction
();
if
(
pCon
==
0
)
continue
;
NdbError
error
=
pCon
->
getNdbError
();
hugoOps
.
closeTransaction
(
pNdb
);
if
(
error
.
status
==
NdbError
::
TemporaryError
){
NdbSleep_MilliSleep
(
50
);
continue
;
}
return
NDBT_FAILED
;
}
return
NDBT_OK
;
}
int
runScanUpdateUntilStopped
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
result
=
NDBT_OK
;
int
records
=
ctx
->
getNumRecords
();
...
...
@@ -178,7 +239,7 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){
int
id
=
lastId
%
restarter
.
getNumDbNodes
();
int
nodeId
=
restarter
.
getDbNodeId
(
id
);
ndbout
<<
"Restart node "
<<
nodeId
<<
endl
;
if
(
restarter
.
restartOneDbNode
(
nodeId
)
!=
0
){
if
(
restarter
.
restartOneDbNode
(
nodeId
,
false
,
false
,
true
)
!=
0
){
g_err
<<
"Failed to restartNextDbNode"
<<
endl
;
result
=
NDBT_FAILED
;
break
;
...
...
@@ -246,6 +307,27 @@ TESTCASE("NoLoad",
TESTCASE
(
"PkRead"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
NdbOperation
::
LM_Read
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"PkReadCommitted"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
NdbOperation
::
LM_CommittedRead
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"MixedPkRead"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
-
1
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
...
...
@@ -255,14 +337,31 @@ TESTCASE("PkRead",
TESTCASE
(
"PkReadPkUpdate"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read and pk update while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
NdbOperation
::
LM_Read
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"MixedPkReadPkUpdate"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read and pk update while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
-
1
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"ReadUpdateScan"
,
...
...
@@ -273,6 +372,21 @@ TESTCASE("ReadUpdateScan",
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
STEP
(
runScanReadUntilStopped
);
STEP
(
runScanUpdateUntilStopped
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"MixedReadUpdateScan"
,
"Test that one node at a time can be stopped and then restarted "
\
"perform pk read, pk update and scan reads while restarting. Do this loop number of times"
){
TC_PROPERTY
(
"ReadLockMode"
,
-
1
);
INITIALIZER
(
runCheckAllNodesStarted
);
INITIALIZER
(
runLoadTable
);
STEP
(
runRestarter
);
STEP
(
runPkReadUntilStopped
);
STEP
(
runPkUpdateUntilStopped
);
STEP
(
runPkReadPkUpdateUntilStopped
);
STEP
(
runScanReadUntilStopped
);
STEP
(
runScanUpdateUntilStopped
);
FINALIZER
(
runClearTable
);
...
...
ndb/test/ndbapi/testOperations.cpp
View file @
46b2eae0
...
...
@@ -110,13 +110,13 @@ runOp(HugoOperations & hugoOps,
return NDBT_FAILED; }}
if
(
strcmp
(
op
,
"READ"
)
==
0
){
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
false
,
1
),
0
);
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
),
0
);
}
else
if
(
strcmp
(
op
,
"READ-EX"
)
==
0
){
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
,
1
),
0
);
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusive
),
0
);
}
else
if
(
strcmp
(
op
,
"S-READ"
)
==
0
){
C2
(
hugoOps
.
pk
SimpleReadRecord
(
pNdb
,
1
,
1
),
0
);
C2
(
hugoOps
.
pk
ReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
),
0
);
}
else
if
(
strcmp
(
op
,
"D-READ"
)
==
0
){
C2
(
hugoOps
.
pk
DirtyReadRecord
(
pNdb
,
1
,
1
),
0
);
C2
(
hugoOps
.
pk
ReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_CommittedRead
),
0
);
}
else
if
(
strcmp
(
op
,
"INSERT"
)
==
0
){
C2
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
,
1
,
value
),
0
);
}
else
if
(
strcmp
(
op
,
"UPDATE"
)
==
0
){
...
...
ndb/test/ndbapi/testTransactions.cpp
View file @
46b2eae0
...
...
@@ -190,13 +190,13 @@ runOp(HugoOperations & hugoOps,
return NDBT_FAILED; }
if
(
strcmp
(
op
,
"READ"
)
==
0
){
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
false
,
1
)
==
0
);
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
}
else
if
(
strcmp
(
op
,
"READ-EX"
)
==
0
){
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
true
,
1
)
==
0
);
C2
(
hugoOps
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Exclusive
)
==
0
);
}
else
if
(
strcmp
(
op
,
"S-READ"
)
==
0
){
C2
(
hugoOps
.
pk
SimpleReadRecord
(
pNdb
,
1
,
1
)
==
0
);
C2
(
hugoOps
.
pk
ReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
}
else
if
(
strcmp
(
op
,
"D-READ"
)
==
0
){
C2
(
hugoOps
.
pk
DirtyReadRecord
(
pNdb
,
1
,
1
)
==
0
);
C2
(
hugoOps
.
pk
ReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_CommittedRead
)
==
0
);
}
else
if
(
strcmp
(
op
,
"INSERT"
)
==
0
){
C2
(
hugoOps
.
pkInsertRecord
(
pNdb
,
1
,
1
,
value
)
==
0
);
}
else
if
(
strcmp
(
op
,
"UPDATE"
)
==
0
){
...
...
ndb/test/run-test/daily-devel-tests.txt
View file @
46b2eae0
...
...
@@ -63,15 +63,15 @@ args: -n NoLoad T6 T8 T13
max-time: 2500
cmd: testNodeRestart
args: -n PkRead T6 T8 T13
args: -n
Mixed
PkRead T6 T8 T13
max-time: 2500
cmd: testNodeRestart
args: -l 1 -n PkReadPkUpdate
args: -l 1 -n
Mixed
PkReadPkUpdate
max-time: 2500
cmd: testNodeRestart
args: -l 1 -n ReadUpdateScan
args: -l 1 -n
Mixed
ReadUpdateScan
max-time: 2500
cmd: testNodeRestart
...
...
ndb/test/src/HugoOperations.cpp
View file @
46b2eae0
...
...
@@ -52,8 +52,8 @@ NdbConnection* HugoOperations::getTransaction(){
int
HugoOperations
::
pkReadRecord
(
Ndb
*
pNdb
,
int
recordNo
,
bool
exclusive
,
int
numRecords
){
int
numRecords
,
NdbOperation
::
LockMode
lm
){
int
a
;
allocRows
(
numRecords
);
int
check
;
...
...
@@ -64,94 +64,22 @@ int HugoOperations::pkReadRecord(Ndb* pNdb,
return
NDBT_FAILED
;
}
if
(
exclusive
==
true
)
check
=
pOp
->
readTupleExclusive
();
else
rand_lock_mode:
switch
(
lm
){
case
NdbOperation
:
:
LM_Read
:
check
=
pOp
->
readTuple
();
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 read
for
(
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
if
((
rows
[
r
]
->
attributeStore
(
a
)
=
pOp
->
getValue
(
tab
.
getColumn
(
a
)
->
getName
()))
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
return
NDBT_FAILED
;
}
}
}
return
NDBT_OK
;
}
int
HugoOperations
::
pkDirtyReadRecord
(
Ndb
*
pNdb
,
int
recordNo
,
int
numRecords
){
int
a
;
allocRows
(
numRecords
);
int
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
->
dirtyRead
();
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 read
for
(
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
if
((
rows
[
r
]
->
attributeStore
(
a
)
=
pOp
->
getValue
(
tab
.
getColumn
(
a
)
->
getName
()))
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
return
NDBT_FAILED
;
}
}
}
return
NDBT_OK
;
}
int
HugoOperations
::
pkSimpleReadRecord
(
Ndb
*
pNdb
,
int
recordNo
,
int
numRecords
){
int
a
;
allocRows
(
numRecords
);
int
check
;
for
(
int
r
=
0
;
r
<
numRecords
;
r
++
){
NdbOperation
*
pOp
=
pTrans
->
getNdbOperation
(
tab
.
getName
());
if
(
pOp
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
return
NDBT_FAILED
;
break
;
case
NdbOperation
:
:
LM_Exclusive
:
check
=
pOp
->
readTupleExclusive
();
break
;
case
NdbOperation
:
:
LM_CommittedRead
:
check
=
pOp
->
dirtyRead
();
break
;
default:
lm
=
(
NdbOperation
::
LockMode
)((
rand
()
>>
16
)
&
3
);
goto
rand_lock_mode
;
}
check
=
pOp
->
simpleRead
();
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
return
NDBT_FAILED
;
...
...
ndb/test/src/HugoTransactions.cpp
View file @
46b2eae0
...
...
@@ -1230,7 +1230,7 @@ int
HugoTransactions
::
pkReadRecords
(
Ndb
*
pNdb
,
int
records
,
int
batchsize
,
bool
dirty
){
NdbOperation
::
LockMode
lm
){
int
reads
=
0
;
int
r
=
0
;
int
retryAttempt
=
0
;
...
...
@@ -1275,11 +1275,22 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
return
NDBT_FAILED
;
}
if
(
dirty
==
true
){
check
=
pOp
->
dirtyRead
();
}
else
{
rand_lock_mode:
switch
(
lm
){
case
NdbOperation
:
:
LM_Read
:
check
=
pOp
->
readTuple
();
break
;
case
NdbOperation
:
:
LM_Exclusive
:
check
=
pOp
->
readTupleExclusive
();
break
;
case
NdbOperation
:
:
LM_CommittedRead
:
check
=
pOp
->
dirtyRead
();
break
;
default:
lm
=
(
NdbOperation
::
LockMode
)((
rand
()
>>
16
)
&
3
);
goto
rand_lock_mode
;
}
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
...
...
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