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
39914c9b
Commit
39914c9b
authored
Apr 25, 2007
by
knielsen@ymer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge ymer.(none):/usr/local/mysql/mysql-5.1-telco-gca
into ymer.(none):/usr/local/mysql/mysql-5.1-new-ndb
parents
f1898c05
0027a93d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
7 deletions
+176
-7
storage/ndb/include/ndbapi/NdbTransaction.hpp
storage/ndb/include/ndbapi/NdbTransaction.hpp
+5
-3
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+2
-1
storage/ndb/src/ndbapi/NdbTransaction.cpp
storage/ndb/src/ndbapi/NdbTransaction.cpp
+11
-0
storage/ndb/test/include/HugoOperations.hpp
storage/ndb/test/include/HugoOperations.hpp
+2
-1
storage/ndb/test/ndbapi/testBasic.cpp
storage/ndb/test/ndbapi/testBasic.cpp
+71
-0
storage/ndb/test/ndbapi/testNdbApi.cpp
storage/ndb/test/ndbapi/testNdbApi.cpp
+73
-0
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/test/run-test/daily-basic-tests.txt
+8
-0
storage/ndb/test/src/HugoOperations.cpp
storage/ndb/test/src/HugoOperations.cpp
+4
-2
No files found.
storage/ndb/include/ndbapi/NdbTransaction.hpp
View file @
39914c9b
...
...
@@ -369,14 +369,16 @@ public:
void
executeAsynch
(
ExecType
aTypeOfExec
,
NdbAsynchCallback
aCallback
,
void
*
anyObject
,
NdbOperation
::
AbortOption
=
NdbOperation
::
DefaultAbortOption
);
NdbOperation
::
AbortOption
=
NdbOperation
::
DefaultAbortOption
,
int
forceSend
=
0
);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
void
executeAsynch
(
::
ExecType
aTypeOfExec
,
NdbAsynchCallback
aCallback
,
void
*
anyObject
,
::
AbortOption
abortOption
=
::
DefaultAbortOption
)
::
AbortOption
abortOption
=
::
DefaultAbortOption
,
int
forceSend
=
0
)
{
executeAsynch
((
ExecType
)
aTypeOfExec
,
aCallback
,
anyObject
,
(
NdbOperation
::
AbortOption
)
abortOption
);
}
(
NdbOperation
::
AbortOption
)
abortOption
,
forceSend
);
}
#endif
#endif
/**
...
...
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
View file @
39914c9b
...
...
@@ -1320,7 +1320,7 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp)
* We must check if there are many transactions in parallel queue...
*/
OperationrecPtr
tmp
;
tmp
.
i
=
loPtr
.
p
->
nextParallelQue
;
tmp
=
loPtr
;
while
(
tmp
.
i
!=
RNIL
)
{
ptrCheckGuard
(
tmp
,
coprecsize
,
operationrec
);
...
...
@@ -1332,6 +1332,7 @@ Dbacc::startNext(Signal* signal, OperationrecPtr lastOp)
*/
return
;
}
tmp
.
i
=
tmp
.
p
->
nextParallelQue
;
}
upgrade:
...
...
storage/ndb/src/ndbapi/NdbTransaction.cpp
View file @
39914c9b
...
...
@@ -676,6 +676,17 @@ NdbTransaction::executeAsynchPrepare(NdbTransaction::ExecType aTypeOfExec,
DBUG_VOID_RETURN
;
}
//NdbTransaction::executeAsynchPrepare()
void
NdbTransaction
::
executeAsynch
(
ExecType
aTypeOfExec
,
NdbAsynchCallback
aCallback
,
void
*
anyObject
,
AbortOption
abortOption
,
int
forceSend
)
{
executeAsynchPrepare
(
aTypeOfExec
,
aCallback
,
anyObject
,
abortOption
);
theNdb
->
sendPreparedTransactions
(
forceSend
);
}
void
NdbTransaction
::
close
()
{
theNdb
->
closeTransaction
(
this
);
...
...
storage/ndb/test/include/HugoOperations.hpp
View file @
39914c9b
...
...
@@ -27,7 +27,8 @@ public:
const
NdbDictionary
::
Index
*
idx
=
0
);
~
HugoOperations
();
int
startTransaction
(
Ndb
*
);
int
startTransaction
(
Ndb
*
,
const
NdbDictionary
::
Table
*
table
=
0
,
const
char
*
keyData
=
0
,
Uint32
keyLen
=
0
);
int
setTransaction
(
NdbTransaction
*
,
bool
not_null_ok
=
false
);
int
closeTransaction
(
Ndb
*
);
NdbTransaction
*
getTransaction
();
...
...
storage/ndb/test/ndbapi/testBasic.cpp
View file @
39914c9b
...
...
@@ -1374,6 +1374,73 @@ runBug27756(NDBT_Context* ctx, NDBT_Step* step)
return
NDBT_OK
;
}
runBug28073
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
int
result
=
NDBT_OK
;
const
NdbDictionary
::
Table
*
table
=
ctx
->
getTab
();
HugoOperations
hugoOp1
(
*
table
);
HugoOperations
hugoOp2
(
*
table
);
Ndb
*
pNdb
=
GETNDB
(
step
);
int
loops
=
ctx
->
getNumLoops
();
bool
inserted
=
false
;
while
(
loops
--
)
{
if
(
!
inserted
)
{
CHECK
(
hugoOp1
.
startTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOp1
.
pkInsertRecord
(
pNdb
,
1
,
1
)
==
0
);
CHECK
(
hugoOp1
.
execute_Commit
(
pNdb
)
==
0
);
CHECK
(
hugoOp1
.
closeTransaction
(
pNdb
)
==
0
);
inserted
=
1
;
}
// Use TC hint to hit the same node in both transactions.
Uint32
key_val
=
0
;
const
char
*
key
=
(
const
char
*
)(
&
key_val
);
CHECK
(
hugoOp1
.
startTransaction
(
pNdb
,
table
,
key
,
4
)
==
0
);
CHECK
(
hugoOp2
.
startTransaction
(
pNdb
,
table
,
key
,
4
)
==
0
);
// First take 2*read lock on the tuple in transaction 1.
for
(
Uint32
i
=
0
;
i
<
2
;
i
++
)
{
CHECK
(
hugoOp1
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
CHECK
(
hugoOp1
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
}
CHECK
(
hugoOp1
.
execute_NoCommit
(
pNdb
)
==
0
);
// Now send ops in two transactions, one batch.
// First 2*read in transaction 2.
for
(
Uint32
i
=
0
;
i
<
2
;
i
++
)
{
CHECK
(
hugoOp2
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
CHECK
(
hugoOp2
.
pkReadRecord
(
pNdb
,
1
,
1
,
NdbOperation
::
LM_Read
)
==
0
);
}
CHECK
(
hugoOp2
.
execute_async_prepare
(
pNdb
,
NdbTransaction
::
NoCommit
)
==
0
);
// Second op an update in transaction 1.
CHECK
(
hugoOp1
.
pkUpdateRecord
(
pNdb
,
1
,
1
)
==
0
);
CHECK
(
hugoOp1
.
execute_async_prepare
(
pNdb
,
NdbTransaction
::
Commit
)
==
0
);
// Transaction 1 will now hang waiting on transaction 2 to commit before it
// can upgrade its read lock to a write lock.
// With the bug, we get a node failure due to watchdog timeout here.
CHECK
(
hugoOp2
.
wait_async
(
pNdb
)
==
0
);
// Now commit transaction 2, we should see transaction 1 finish with the
// update.
CHECK
(
hugoOp2
.
execute_async_prepare
(
pNdb
,
NdbTransaction
::
Commit
)
==
0
);
CHECK
(
hugoOp2
.
wait_async
(
pNdb
)
==
0
);
// No error check, as transaction 1 may have terminated already.
hugoOp1
.
wait_async
(
pNdb
);
CHECK
(
hugoOp1
.
closeTransaction
(
pNdb
)
==
0
);
CHECK
(
hugoOp2
.
closeTransaction
(
pNdb
)
==
0
);
}
return
result
;
}
template
class
Vector
<
Uint64
>;
NDBT_TESTSUITE
(
testBasic
);
...
...
@@ -1656,6 +1723,10 @@ TESTCASE("Bug27756",
"Verify what happens when we fill the db"
){
STEP
(
runBug27756
);
}
TESTCASE
(
"Bug28073"
,
"Infinite loop in lock queue"
){
STEP
(
runBug28073
);
}
NDBT_TESTSUITE_END
(
testBasic
);
#if 0
...
...
storage/ndb/test/ndbapi/testNdbApi.cpp
View file @
39914c9b
...
...
@@ -1517,6 +1517,75 @@ runTestIgnoreError(NDBT_Context* ctx, NDBT_Step* step)
return
NDBT_OK
;
}
static
void
testExecuteAsynchCallback
(
int
res
,
NdbTransaction
*
con
,
void
*
data_ptr
)
{
int
*
res_ptr
=
(
int
*
)
data_ptr
;
*
res_ptr
=
res
;
}
int
runTestExecuteAsynch
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
/* Test that NdbTransaction::executeAsynch() works (BUG#27495). */
int
result
=
NDBT_OK
;
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
Ndb
*
pNdb
=
new
Ndb
(
&
ctx
->
m_cluster_connection
,
"TEST_DB"
);
if
(
pNdb
==
NULL
){
ndbout
<<
"pNdb == NULL"
<<
endl
;
return
NDBT_FAILED
;
}
if
(
pNdb
->
init
(
2048
)){
ERR
(
pNdb
->
getNdbError
());
delete
pNdb
;
return
NDBT_FAILED
;
}
NdbConnection
*
pCon
=
pNdb
->
startTransaction
();
if
(
pCon
==
NULL
){
ERR
(
pNdb
->
getNdbError
());
delete
pNdb
;
return
NDBT_FAILED
;
}
NdbScanOperation
*
pOp
=
pCon
->
getNdbScanOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pOp
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
delete
pNdb
;
return
NDBT_FAILED
;
}
if
(
pOp
->
readTuples
()
!=
0
){
ERR
(
pOp
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
delete
pNdb
;
return
NDBT_FAILED
;
}
if
(
pOp
->
getValue
(
NdbDictionary
::
Column
::
FRAGMENT
)
==
0
){
ERR
(
pOp
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
delete
pNdb
;
return
NDBT_FAILED
;
}
int
res
=
42
;
pCon
->
executeAsynch
(
NoCommit
,
testExecuteAsynchCallback
,
&
res
);
while
(
pNdb
->
pollNdb
(
100000
)
==
0
)
;
if
(
res
!=
0
){
ERR
(
pCon
->
getNdbError
());
ndbout
<<
"Error returned from execute: "
<<
res
<<
endl
;
result
=
NDBT_FAILED
;
}
pNdb
->
closeTransaction
(
pCon
);
delete
pNdb
;
return
result
;
}
template
class
Vector
<
NdbScanOperation
*
>;
...
...
@@ -1616,6 +1685,10 @@ TESTCASE("IgnoreError", ""){
FINALIZER
(
runClearTable
);
FINALIZER
(
createPkIndex_Drop
);
}
TESTCASE
(
"ExecuteAsynch"
,
"Check that executeAsync() works (BUG#27495)
\n
"
){
INITIALIZER
(
runTestExecuteAsynch
);
}
NDBT_TESTSUITE_END
(
testNdbApi
);
int
main
(
int
argc
,
const
char
**
argv
){
...
...
storage/ndb/test/run-test/daily-basic-tests.txt
View file @
39914c9b
...
...
@@ -243,6 +243,10 @@ max-time: 1000
cmd: testBasic
args: -n Bug27756
max-time: 500
cmd: testBasic
args: -n Bug28073
max-time: 500
cmd: testIndex
args: -n Bug25059 -r 3000 T1
...
...
@@ -688,6 +692,10 @@ max-time: 500
cmd: testNdbApi
args: -n Bug_WritePartialIgnoreError T1
max-time: 500
cmd: testNdbApi
args: -n ExecuteAsynch T1
#max-time: 500
#cmd: testInterpreter
#args: T1
...
...
storage/ndb/test/src/HugoOperations.cpp
View file @
39914c9b
...
...
@@ -15,13 +15,15 @@
#include <HugoOperations.hpp>
int
HugoOperations
::
startTransaction
(
Ndb
*
pNdb
){
int
HugoOperations
::
startTransaction
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
table
,
const
char
*
keyData
,
Uint32
keyLen
){
if
(
pTrans
!=
NULL
){
ndbout
<<
"HugoOperations::startTransaction, pTrans != NULL"
<<
endl
;
return
NDBT_FAILED
;
}
pTrans
=
pNdb
->
startTransaction
();
pTrans
=
pNdb
->
startTransaction
(
table
,
keyData
,
keyLen
);
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
pNdb
->
getNdbError
();
ERR
(
err
);
...
...
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