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
6a78878e
Commit
6a78878e
authored
Sep 28, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post merge
parent
1e832bf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
180 deletions
+0
-180
storage/ndb/test/src/HugoTransactions.cpp
storage/ndb/test/src/HugoTransactions.cpp
+0
-180
No files found.
storage/ndb/test/src/HugoTransactions.cpp
View file @
6a78878e
...
...
@@ -477,186 +477,6 @@ HugoTransactions::scanUpdateRecords(Ndb* pNdb,
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
,
AbortOnError
);
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
ERR
(
err
);
closeTransaction
(
pNdb
);
if
(
err
.
status
==
NdbError
::
TemporaryError
){
NdbSleep_MilliSleep
(
50
);
continue
;
}
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
rows
=
0
;
while
((
check
=
pOp
->
nextResult
(
true
))
==
0
){
do
{
rows
++
;
NdbOperation
*
pUp
=
pOp
->
updateCurrentTuple
();
if
(
pUp
==
0
){
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
const
int
updates
=
calc
.
getUpdatesValue
(
&
row
)
+
1
;
const
int
r
=
calc
.
getIdValue
(
&
row
);
for
(
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
if
(
tab
.
getColumn
(
a
)
->
getPrimaryKey
()
==
false
){
if
(
setValueForAttr
(
pUp
,
a
,
r
,
updates
)
!=
0
){
ERR
(
pTrans
->
getNdbError
());
closeTransaction
(
pNdb
);
return
NDBT_FAILED
;
}
}
}
if
(
rows
==
abortCount
&&
abortTrans
==
true
){
g_info
<<
"Scan is aborted"
<<
endl
;
// This scan should be aborted
closeTransaction
(
pNdb
);
return
NDBT_OK
;
}
}
while
((
check
=
pOp
->
nextResult
(
false
))
==
0
);
if
(
check
!=
-
1
){
check
=
pTrans
->
execute
(
Commit
,
AbortOnError
);
if
(
check
!=
-
1
)
m_latest_gci
=
pTrans
->
getGCI
();
pTrans
->
restart
();
}
const
NdbError
err
=
pTrans
->
getNdbError
();
if
(
check
==
-
1
)
{
closeTransaction
(
pNdb
);
ERR
(
err
);
if
(
err
.
status
==
NdbError
::
TemporaryError
){
NdbSleep_MilliSleep
(
50
);
goto
restart
;
}
return
NDBT_FAILED
;
}
}
const
NdbError
err
=
pTrans
->
getNdbError
();
if
(
check
==
-
1
)
{
closeTransaction
(
pNdb
);
ERR
(
err
);
if
(
err
.
status
==
NdbError
::
TemporaryError
){
NdbSleep_MilliSleep
(
50
);
goto
restart
;
}
return
NDBT_FAILED
;
}
closeTransaction
(
pNdb
);
g_info
<<
rows
<<
" rows have been updated"
<<
endl
;
return
NDBT_OK
;
}
return
NDBT_FAILED
;
}
int
HugoTransactions
::
scanUpdateRecords
(
Ndb
*
pNdb
,
int
records
,
...
...
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