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
35bfea94
Commit
35bfea94
authored
Feb 05, 2007
by
jonas@eel.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb -
Add abort option to lots of Hugo code, as it assumes it and default value has changed
parent
8619dfc2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
206 deletions
+30
-206
storage/ndb/test/src/HugoTransactions.cpp
storage/ndb/test/src/HugoTransactions.cpp
+19
-195
storage/ndb/test/src/UtilTransactions.cpp
storage/ndb/test/src/UtilTransactions.cpp
+11
-11
No files found.
storage/ndb/test/src/HugoTransactions.cpp
View file @
35bfea94
...
...
@@ -94,7 +94,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
...
...
@@ -245,183 +245,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
closeTransaction
(
pNdb
);
NdbSleep_MilliSleep
(
50
);
retryAttempt
++
;
continue
;
}
ERR
(
err
);
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
// Abort after 1-100 or 1-records rows
int
ranVal
=
rand
();
int
abortCount
=
ranVal
%
(
records
==
0
?
100
:
records
);
bool
abortTrans
=
false
;
if
(
abort
>
0
){
// Abort if abortCount is less then abortPercent
if
(
abortCount
<
abortPercent
)
abortTrans
=
true
;
}
int
eof
;
int
rows
=
0
;
while
((
eof
=
pOp
->
nextResult
(
true
))
==
0
){
rows
++
;
if
(
calc
.
verifyRowValues
(
&
row
)
!=
0
){
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
if
(
abortCount
==
rows
&&
abortTrans
==
true
){
ndbout
<<
"Scan is aborted"
<<
endl
;
g_info
<<
"Scan is aborted"
<<
endl
;
pOp
->
close
();
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
closeTransaction
(
pNdb
);
return
NDBT_OK
;
}
}
if
(
eof
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR_INFO
(
err
);
closeTransaction
(
pNdb
);
NdbSleep_MilliSleep
(
50
);
switch
(
err
.
code
){
case
488
:
case
245
:
case
490
:
// Too many active scans, no limit on number of retry attempts
break
;
default:
retryAttempt
++
;
}
continue
;
}
ERR
(
err
);
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
closeTransaction
(
pNdb
);
g_info
<<
rows
<<
" rows have been read"
<<
endl
;
if
(
records
!=
0
&&
rows
!=
records
){
g_err
<<
"Check expected number of records failed"
<<
endl
<<
" expected="
<<
records
<<
", "
<<
endl
<<
" read="
<<
rows
<<
endl
;
return
NDBT_FAILED
;
}
return
NDBT_OK
;
}
return
NDBT_FAILED
;
}
#define RESTART_SCAN 99
int
HugoTransactions
::
scanUpdateRecords
(
Ndb
*
pNdb
,
int
records
,
int
abortPercent
,
int
parallelism
){
if
(
m_defaultScanUpdateMethod
==
1
){
return
scanUpdateRecords1
(
pNdb
,
records
,
abortPercent
,
parallelism
);
}
else
if
(
m_defaultScanUpdateMethod
==
2
){
return
scanUpdateRecords2
(
pNdb
,
records
,
abortPercent
,
parallelism
);
}
else
{
return
scanUpdateRecords3
(
pNdb
,
records
,
abortPercent
,
parallelism
);
}
}
// Scan all records exclusive and update
// them one by one
int
HugoTransactions
::
scanUpdateRecords1
(
Ndb
*
pNdb
,
int
records
,
int
abortPercent
,
int
parallelism
){
return
scanUpdateRecords3
(
pNdb
,
records
,
abortPercent
,
1
);
}
// Scan all records exclusive and update
// them batched by asking nextScanResult to
// give us all cached records before fetching new
// records from db
int
HugoTransactions
::
scanUpdateRecords2
(
Ndb
*
pNdb
,
int
records
,
int
abortPercent
,
int
parallelism
){
return
scanUpdateRecords3
(
pNdb
,
records
,
abortPercent
,
parallelism
);
}
int
HugoTransactions
::
scanUpdateRecords3
(
Ndb
*
pNdb
,
int
records
,
int
abortPercent
,
int
parallelism
){
int
retryAttempt
=
0
;
int
check
,
a
;
NdbScanOperation
*
pOp
;
while
(
true
){
restart:
if
(
retryAttempt
++
>=
m_retryMax
){
g_info
<<
"ERROR: has retried this operation "
<<
retryAttempt
<<
" times, failing!"
<<
endl
;
return
NDBT_FAILED
;
}
pTrans
=
pNdb
->
startTransaction
();
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
pNdb
->
getNdbError
();
ERR
(
err
);
if
(
err
.
status
==
NdbError
::
TemporaryError
){
NdbSleep_MilliSleep
(
50
);
continue
;
}
return
NDBT_FAILED
;
}
pOp
=
getScanOperation
(
pTrans
);
if
(
pOp
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
if
(
pOp
->
readTuplesExclusive
(
parallelism
)
)
{
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
// Read all attributes from this table
for
(
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
if
((
row
.
attributeStore
(
a
)
=
pOp
->
getValue
(
tab
.
getColumn
(
a
)
->
getName
()))
==
NULL
){
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
ERR
(
err
);
...
...
@@ -474,7 +298,7 @@ restart:
}
while
((
check
=
pOp
->
nextResult
(
false
))
==
0
);
if
(
check
!=
-
1
){
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
!=
-
1
)
m_latest_gci
=
pTrans
->
getGCI
();
pTrans
->
restart
();
...
...
@@ -587,14 +411,14 @@ HugoTransactions::loadTable(Ndb* pNdb,
closeTrans
=
false
;
if
(
!
abort
)
{
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
!=
-
1
)
m_latest_gci
=
pTrans
->
getGCI
();
pTrans
->
restart
();
}
else
{
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
!=
-
1
)
{
check
=
pTrans
->
execute
(
Rollback
);
...
...
@@ -603,7 +427,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
}
else
{
closeTrans
=
false
;
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
}
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -717,7 +541,7 @@ HugoTransactions::fillTable(Ndb* pNdb,
}
// Execute the transaction and insert the record
check
=
pTrans
->
execute
(
Commit
,
CommitAsMuchAsPossible
);
check
=
pTrans
->
execute
(
Commit
,
CommitAsMuchAsPossible
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
closeTransaction
(
pNdb
);
...
...
@@ -829,7 +653,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
return
NDBT_FAILED
;
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -950,7 +774,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
return
NDBT_FAILED
;
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -991,7 +815,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if
(
check
!=
2
)
break
;
if
((
check
=
pTrans
->
execute
(
NoCommit
))
!=
0
)
if
((
check
=
pTrans
->
execute
(
NoCommit
,
,
AbortOnError
))
!=
0
)
break
;
}
if
(
check
!=
1
||
rows_found
!=
batch
)
...
...
@@ -1019,7 +843,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
return
NDBT_FAILED
;
}
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
}
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1119,7 +943,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1194,7 +1018,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1274,7 +1098,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
return
NDBT_FAILED
;
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1387,7 +1211,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
int
lockCount
=
lockTime
/
sleepInterval
;
int
commitCount
=
0
;
do
{
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1413,7 +1237,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
}
while
(
commitCount
<
lockCount
);
// Really commit the trans, puuh!
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1543,7 +1367,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
check
=
(
check
==
-
1
?
-
1
:
!
ordered
?
check
:
sOp
->
nextResult
(
true
));
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1684,7 +1508,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
check
=
(
check
==
-
1
?
-
1
:
!
ordered
?
check
:
sOp
->
nextResult
(
true
));
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1756,7 +1580,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
ERR
(
err
);
...
...
storage/ndb/test/src/UtilTransactions.cpp
View file @
35bfea94
...
...
@@ -121,7 +121,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
goto
failed
;
}
if
(
pTrans
->
execute
(
NoCommit
)
!=
0
){
if
(
pTrans
->
execute
(
NoCommit
,
AbortOnError
)
!=
0
){
err
=
pTrans
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
...
...
@@ -141,7 +141,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
}
while
((
check
=
pOp
->
nextResult
(
false
))
==
0
);
if
(
check
!=
-
1
){
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
pTrans
->
restart
();
}
...
...
@@ -245,7 +245,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
...
...
@@ -262,7 +262,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
}
}
while
((
eof
=
pOp
->
nextResult
(
false
))
==
0
);
check
=
pTrans
->
execute
(
Commit
);
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
pTrans
->
restart
();
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -414,7 +414,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb,
}
// *************************************************
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -520,7 +520,7 @@ UtilTransactions::selectCount(Ndb* pNdb,
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
...
...
@@ -693,7 +693,7 @@ restart:
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -956,7 +956,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
printf
(
"
\n
"
);
#endif
scanTrans
->
refresh
();
check
=
pTrans1
->
execute
(
Commit
);
check
=
pTrans1
->
execute
(
Commit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans1
->
getNdbError
();
...
...
@@ -1078,7 +1078,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
abort
();
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
@@ -1137,7 +1137,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
goto
error
;
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
,
AbortOnError
);
if
(
check
)
goto
error
;
...
...
@@ -1376,7 +1376,7 @@ loop:
}
}
if
(
pTrans
->
execute
(
NoCommit
)
==
-
1
)
{
if
(
pTrans
->
execute
(
NoCommit
,
AbortOnError
)
==
-
1
)
{
ERR
(
err
=
pTrans
->
getNdbError
());
goto
error
;
}
...
...
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