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
abb093fc
Commit
abb093fc
authored
Jul 19, 2004
by
mronstrom@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/mikron/mysql-4.1
parents
5eadafe5
03f43020
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
20 deletions
+48
-20
ndb/test/include/HugoTransactions.hpp
ndb/test/include/HugoTransactions.hpp
+2
-1
ndb/test/ndbapi/testBasic.cpp
ndb/test/ndbapi/testBasic.cpp
+16
-2
ndb/test/src/HugoTransactions.cpp
ndb/test/src/HugoTransactions.cpp
+30
-17
No files found.
ndb/test/include/HugoTransactions.hpp
View file @
abb093fc
...
...
@@ -34,7 +34,8 @@ public:
int
records
,
int
batch
=
512
,
bool
allowConstraintViolation
=
true
,
int
doSleep
=
0
);
int
doSleep
=
0
,
bool
oneTrans
=
false
);
int
scanReadRecords
(
Ndb
*
,
int
records
,
int
abort
=
0
,
...
...
ndb/test/ndbapi/testBasic.cpp
View file @
abb093fc
...
...
@@ -29,9 +29,18 @@
* delete should be visible to same transaction
*
*/
int
runLoadTable2
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
int
records
=
ctx
->
getNumRecords
();
HugoTransactions
hugoTrans
(
*
ctx
->
getTab
());
if
(
hugoTrans
.
loadTable
(
GETNDB
(
step
),
records
,
512
,
false
,
0
,
true
)
!=
0
){
return
NDBT_FAILED
;
}
return
NDBT_OK
;
}
int
runLoadTable
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
int
runLoadTable
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
int
records
=
ctx
->
getNumRecords
();
HugoTransactions
hugoTrans
(
*
ctx
->
getTab
());
if
(
hugoTrans
.
loadTable
(
GETNDB
(
step
),
records
)
!=
0
){
...
...
@@ -1255,6 +1264,11 @@ TESTCASE("MassiveRollback2",
INITIALIZER
(
runMassiveRollback2
);
FINALIZER
(
runClearTable2
);
}
TESTCASE
(
"MassiveTransaction"
,
"Test very large insert transaction"
){
INITIALIZER
(
runLoadTable2
);
FINALIZER
(
runClearTable2
);
}
NDBT_TESTSUITE_END
(
testBasic
);
int
main
(
int
argc
,
const
char
**
argv
){
...
...
ndb/test/src/HugoTransactions.cpp
View file @
abb093fc
...
...
@@ -819,12 +819,14 @@ HugoTransactions::loadTable(Ndb* pNdb,
int
records
,
int
batch
,
bool
allowConstraintViolation
,
int
doSleep
){
int
doSleep
,
bool
oneTrans
){
int
check
;
int
retryAttempt
=
0
;
int
retryMax
=
5
;
NdbConnection
*
pTrans
;
NdbOperation
*
pOp
;
bool
first_batch
=
true
;
const
int
org
=
batch
;
const
int
cols
=
tab
.
getNoOfColumns
();
...
...
@@ -833,7 +835,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
batch
=
(
batch
*
256
);
// -> 512 -> 65536k per commit
batch
=
batch
/
bytes
;
//
batch
=
batch
==
0
?
1
:
batch
;
if
(
batch
!=
org
){
g_info
<<
"batch = "
<<
org
<<
" rowsize = "
<<
bytes
<<
" -> rows/commit = "
<<
batch
<<
endl
;
...
...
@@ -841,7 +843,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
g_info
<<
"|- Inserting records..."
<<
endl
;
for
(
int
c
=
0
;
c
<
records
;
){
bool
closeTrans
;
if
(
retryAttempt
>=
retryMax
){
g_info
<<
"Record "
<<
c
<<
" could not be inserted, has retried "
<<
retryAttempt
<<
" times "
<<
endl
;
...
...
@@ -852,19 +854,22 @@ HugoTransactions::loadTable(Ndb* pNdb,
if
(
doSleep
>
0
)
NdbSleep_MilliSleep
(
doSleep
);
pTrans
=
pNdb
->
startTransaction
();
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
pNdb
->
getNdbError
();
if
(
first_batch
||
!
oneTrans
)
{
first_batch
=
false
;
pTrans
=
pNdb
->
startTransaction
();
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
pNdb
->
getNdbError
();
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
NdbSleep_MilliSleep
(
50
);
retryAttempt
++
;
continue
;
if
(
err
.
status
==
NdbError
::
TemporaryError
){
ERR
(
err
);
NdbSleep_MilliSleep
(
50
);
retryAttempt
++
;
continue
;
}
ERR
(
err
);
return
NDBT_FAILED
;
}
ERR
(
err
);
return
NDBT_FAILED
;
}
for
(
int
b
=
0
;
b
<
batch
&&
c
+
b
<
records
;
b
++
){
...
...
@@ -894,7 +899,13 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
// Execute the transaction and insert the record
check
=
pTrans
->
execute
(
Commit
);
if
(
!
oneTrans
||
(
c
+
batch
)
>=
records
)
{
closeTrans
=
true
;
check
=
pTrans
->
execute
(
Commit
);
}
else
{
closeTrans
=
false
;
check
=
pTrans
->
execute
(
NoCommit
);
}
if
(
check
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
pNdb
->
closeTransaction
(
pTrans
);
...
...
@@ -937,8 +948,10 @@ HugoTransactions::loadTable(Ndb* pNdb,
break
;
}
}
else
{
pNdb
->
closeTransaction
(
pTrans
);
else
{
if
(
closeTrans
)
{
pNdb
->
closeTransaction
(
pTrans
);
}
}
// Step to next record
...
...
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