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
e697ec1c
Commit
e697ec1c
authored
Jun 07, 2005
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#11133 - ndb
incorrect handling of writeTuple with multi op transaction
parent
61638019
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
269 additions
and
14 deletions
+269
-14
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
+12
-1
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
+14
-13
ndb/test/ndbapi/testNdbApi.cpp
ndb/test/ndbapi/testNdbApi.cpp
+239
-0
ndb/test/run-test/daily-basic-tests.txt
ndb/test/run-test/daily-basic-tests.txt
+4
-0
No files found.
ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
View file @
e697ec1c
...
...
@@ -1589,7 +1589,7 @@ void Dbacc::initOpRec(Signal* signal)
void
Dbacc
::
sendAcckeyconf
(
Signal
*
signal
)
{
signal
->
theData
[
0
]
=
operationRecPtr
.
p
->
userptr
;
signal
->
theData
[
1
]
=
operationRecPtr
.
p
->
insertIsDone
;
signal
->
theData
[
1
]
=
operationRecPtr
.
p
->
operation
;
signal
->
theData
[
2
]
=
operationRecPtr
.
p
->
fid
;
signal
->
theData
[
3
]
=
operationRecPtr
.
p
->
localdata
[
0
];
signal
->
theData
[
4
]
=
operationRecPtr
.
p
->
localdata
[
1
];
...
...
@@ -1671,6 +1671,11 @@ void Dbacc::execACCKEYREQ(Signal* signal)
case
ZWRITE
:
case
ZSCAN_OP
:
if
(
!
tgeLocked
){
if
(
operationRecPtr
.
p
->
operation
==
ZWRITE
)
{
jam
();
operationRecPtr
.
p
->
operation
=
ZUPDATE
;
}
sendAcckeyconf
(
signal
);
if
(
operationRecPtr
.
p
->
dirtyRead
==
ZFALSE
)
{
/*---------------------------------------------------------------*/
...
...
@@ -2182,6 +2187,12 @@ Uint32 Dbacc::placeWriteInLockQueue(Signal* signal)
return
ZWRITE_ERROR
;
}
//if
if
(
operationRecPtr
.
p
->
operation
==
ZWRITE
)
{
operationRecPtr
.
p
->
operation
=
(
mlpqOperPtr
.
p
->
operation
==
ZDELETE
)
?
ZINSERT
:
ZUPDATE
;
}
operationRecPtr
.
p
->
localdata
[
0
]
=
queOperPtr
.
p
->
localdata
[
0
];
operationRecPtr
.
p
->
localdata
[
1
]
=
queOperPtr
.
p
->
localdata
[
1
];
operationRecPtr
.
p
->
prevParallelQue
=
mlpqOperPtr
.
i
;
...
...
ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
View file @
e697ec1c
...
...
@@ -3897,20 +3897,21 @@ void Dblqh::execACCKEYCONF(Signal* signal)
* EITHER TO THE TC BLOCK OR DIRECTLY TO THE APPLICATION. THE SCHEMA VERSION
* IS NEEDED SINCE TWO SCHEMA VERSIONS CAN BE ACTIVE SIMULTANEOUSLY ON A
* TABLE.
* -----------------------------------------------------------------------
-
*/
if
(
regTcPtr
->
operation
==
ZWRITE
)
{
if
(
signal
->
theData
[
1
]
>
0
)
{
/* --------------------------------------------------------------------
* ACC did perform an insert and thus we should indicate that the WRITE
* is an INSERT otherwise it is an UPDATE.
* -------------------------------------------------------------------- */
jam
();
regTcPtr
->
operation
=
ZINSERT
;
}
else
{
jam
(
);
tcConnectptr
.
p
->
operation
=
ZUPDATE
;
}
//if
* ----------------------------------------------------------------------- */
if
(
regTcPtr
->
operation
==
ZWRITE
)
{
Uint32
op
=
signal
->
theData
[
1
];
if
(
likely
(
op
==
ZINSERT
||
op
==
ZUPDATE
))
{
regTcPtr
->
operation
=
op
;
}
else
{
warningEvent
(
"Convering %d to ZUPDATE"
,
op
);
regTcPtr
->
operation
=
ZUPDATE
;
}
}
//if
ndbrequire
(
localKeyFlag
==
1
);
localKey2
=
localKey1
&
MAX_TUPLES_PER_PAGE
;
localKey1
=
localKey1
>>
MAX_TUPLES_BITS
;
...
...
ndb/test/ndbapi/testNdbApi.cpp
View file @
e697ec1c
...
...
@@ -1049,6 +1049,239 @@ int runCheckGetNdbErrorOperation(NDBT_Context* ctx, NDBT_Step* step){
return
result
;
}
int
runBug_11133
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
result
=
NDBT_OK
;
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
HugoOperations
hugoOps
(
*
pTab
);
Ndb
*
pNdb
=
GETNDB
(
step
);
Uint32
lm
;
NdbConnection
*
pCon
=
pNdb
->
startTransaction
();
if
(
pCon
==
NULL
){
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
NdbOperation
*
pOp
=
pCon
->
getNdbOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
if
(
pOp
->
readTuple
(
NdbOperation
::
LM_Exclusive
)
!=
0
){
pNdb
->
closeTransaction
(
pCon
);
ERR
(
pOp
->
getNdbError
());
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
==
true
){
if
(
hugoOps
.
equalForAttr
(
pOp
,
a
,
1
)
!=
0
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
!=
true
){
if
(
pOp
->
getValue
(
pTab
->
getColumn
(
a
)
->
getName
())
==
NULL
)
{
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
int
check
=
pCon
->
execute
(
NoCommit
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
pOp
=
pCon
->
getNdbOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
if
(
pOp
->
deleteTuple
()
!=
0
){
pNdb
->
closeTransaction
(
pCon
);
ERR
(
pOp
->
getNdbError
());
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
==
true
){
if
(
hugoOps
.
equalForAttr
(
pOp
,
a
,
1
)
!=
0
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
check
=
pCon
->
execute
(
NoCommit
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
pOp
=
pCon
->
getNdbOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
if
(
pOp
->
writeTuple
()
!=
0
){
pNdb
->
closeTransaction
(
pCon
);
ERR
(
pOp
->
getNdbError
());
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
==
true
){
if
(
hugoOps
.
equalForAttr
(
pOp
,
a
,
1
)
!=
0
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
!=
true
){
if
(
hugoOps
.
setValueForAttr
(
pOp
,
a
,
1
,
1
)
!=
0
)
{
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
check
=
pCon
->
execute
(
NoCommit
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
pOp
=
pCon
->
getNdbOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
if
(
pOp
->
writeTuple
()
!=
0
){
pNdb
->
closeTransaction
(
pCon
);
ERR
(
pOp
->
getNdbError
());
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
==
true
){
if
(
hugoOps
.
equalForAttr
(
pOp
,
a
,
1
)
!=
0
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
!=
true
){
if
(
hugoOps
.
setValueForAttr
(
pOp
,
a
,
1
,
1
)
!=
0
)
{
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
check
=
pCon
->
execute
(
NoCommit
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
check
=
pCon
->
execute
(
Rollback
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
pCon
->
close
();
pCon
=
pNdb
->
startTransaction
();
if
(
pCon
==
NULL
){
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
pOp
=
pCon
->
getNdbOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
if
(
pOp
->
writeTuple
()
!=
0
){
pNdb
->
closeTransaction
(
pCon
);
ERR
(
pOp
->
getNdbError
());
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
==
true
){
if
(
hugoOps
.
equalForAttr
(
pOp
,
a
,
1
)
!=
0
){
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
for
(
int
a
=
0
;
a
<
pTab
->
getNoOfColumns
();
a
++
){
if
(
pTab
->
getColumn
(
a
)
->
getPrimaryKey
()
!=
true
){
if
(
hugoOps
.
setValueForAttr
(
pOp
,
a
,
1
,
1
)
!=
0
)
{
ERR
(
pCon
->
getNdbError
());
pNdb
->
closeTransaction
(
pCon
);
return
NDBT_FAILED
;
}
}
}
check
=
pCon
->
execute
(
Commit
);
if
(
check
==
0
){
ndbout
<<
"execute worked"
<<
endl
;
}
else
{
ERR
(
pCon
->
getNdbError
());
result
=
NDBT_FAILED
;
}
return
result
;
}
NDBT_TESTSUITE
(
testNdbApi
);
TESTCASE
(
"MaxNdb"
,
...
...
@@ -1124,6 +1357,12 @@ TESTCASE("ReadWithoutGetValue",
INITIALIZER
(
runReadWithoutGetValue
);
FINALIZER
(
runClearTable
);
}
TESTCASE
(
"Bug_11133"
,
"Test ReadEx-Delete-Write
\n
"
){
INITIALIZER
(
runLoadTable
);
INITIALIZER
(
runBug_11133
);
FINALIZER
(
runClearTable
);
}
NDBT_TESTSUITE_END
(
testNdbApi
);
int
main
(
int
argc
,
const
char
**
argv
){
...
...
ndb/test/run-test/daily-basic-tests.txt
View file @
e697ec1c
...
...
@@ -546,6 +546,10 @@ max-time: 500
cmd: testNdbApi
args: -n ReadWithoutGetValue
max-time: 500
cmd: testNdbApi
args: -n Bug_11133 T1
#max-time: 500
#cmd: testInterpreter
#args: T1
...
...
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