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
4915b228
Commit
4915b228
authored
Jun 22, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl1671 - bug fixes for negative tests
parent
84883229
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
71 deletions
+58
-71
ndb/src/ndbapi/NdbScanOperation.cpp
ndb/src/ndbapi/NdbScanOperation.cpp
+9
-2
ndb/test/ndbapi/ScanFunctions.hpp
ndb/test/ndbapi/ScanFunctions.hpp
+48
-51
ndb/test/ndbapi/testScan.cpp
ndb/test/ndbapi/testScan.cpp
+1
-18
No files found.
ndb/src/ndbapi/NdbScanOperation.cpp
View file @
4915b228
...
@@ -448,6 +448,8 @@ NdbScanOperation::executeCursor(int nodeId){
...
@@ -448,6 +448,8 @@ NdbScanOperation::executeCursor(int nodeId){
return
-
1
;
return
-
1
;
}
}
#define DEBUG_NEXT_RESULT 0
int
NdbScanOperation
::
nextResult
(
bool
fetchAllowed
)
int
NdbScanOperation
::
nextResult
(
bool
fetchAllowed
)
{
{
if
(
m_ordered
)
if
(
m_ordered
)
...
@@ -459,6 +461,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
...
@@ -459,6 +461,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
int
retVal
=
2
;
int
retVal
=
2
;
Uint32
idx
=
m_current_api_receiver
;
Uint32
idx
=
m_current_api_receiver
;
Uint32
last
=
m_api_receivers_count
;
Uint32
last
=
m_api_receivers_count
;
if
(
DEBUG_NEXT_RESULT
)
ndbout_c
(
"nextResult(%d) idx=%d last=%d"
,
fetchAllowed
,
idx
,
last
);
/**
/**
* Check next buckets
* Check next buckets
...
@@ -497,6 +502,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
...
@@ -497,6 +502,9 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
Uint32
cnt
=
m_conf_receivers_count
;
Uint32
cnt
=
m_conf_receivers_count
;
Uint32
sent
=
m_sent_receivers_count
;
Uint32
sent
=
m_sent_receivers_count
;
if
(
DEBUG_NEXT_RESULT
)
ndbout_c
(
"idx=%d last=%d cnt=%d sent=%d"
,
idx
,
last
,
cnt
,
sent
);
if
(
cnt
>
0
){
if
(
cnt
>
0
){
/**
/**
...
@@ -527,6 +535,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
...
@@ -527,6 +535,7 @@ int NdbScanOperation::nextResult(bool fetchAllowed)
theNdb
->
theWaiter
.
m_state
=
WAIT_SCAN
;
theNdb
->
theWaiter
.
m_state
=
WAIT_SCAN
;
int
return_code
=
theNdb
->
receiveResponse
(
WAITFOR_SCAN_TIMEOUT
);
int
return_code
=
theNdb
->
receiveResponse
(
WAITFOR_SCAN_TIMEOUT
);
if
(
return_code
==
0
&&
seq
==
tp
->
getNodeSequence
(
nodeId
))
{
if
(
return_code
==
0
&&
seq
==
tp
->
getNodeSequence
(
nodeId
))
{
theError
.
code
=
-
1
;
// make sure user gets error if he tries again
return
1
;
return
1
;
}
}
retVal
=
-
1
;
//return_code;
retVal
=
-
1
;
//return_code;
...
@@ -1193,8 +1202,6 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
...
@@ -1193,8 +1202,6 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
return
0
;
return
0
;
}
}
#define DEBUG_NEXT_RESULT 0
int
int
NdbIndexScanOperation
::
next_result_ordered
(
bool
fetchAllowed
){
NdbIndexScanOperation
::
next_result_ordered
(
bool
fetchAllowed
){
...
...
ndb/test/ndbapi/ScanFunctions.hpp
View file @
4915b228
...
@@ -79,9 +79,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
...
@@ -79,9 +79,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
const
int
retryMax
=
100
;
const
int
retryMax
=
100
;
int
sleepTime
=
10
;
int
sleepTime
=
10
;
int
check
;
int
check
;
NdbConnection
*
pTrans
;
NdbConnection
*
pTrans
=
0
;
NdbScanOperation
*
pOp
;
NdbScanOperation
*
pOp
=
0
;
NdbResultSet
*
rs
;
NdbResultSet
*
rs
=
0
;
while
(
true
){
while
(
true
){
if
(
retryAttempt
>=
retryMax
){
if
(
retryAttempt
>=
retryMax
){
...
@@ -104,78 +104,75 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
...
@@ -104,78 +104,75 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
}
}
// Execute the scan without defining a scan operation
// Execute the scan without defining a scan operation
if
(
action
!=
ExecuteScanWithOutOpenScan
){
pOp
=
pTrans
->
getNdbScanOperation
(
tab
.
getName
());
if
(
pOp
==
NULL
)
{
pOp
=
pTrans
->
getNdbScanOperation
(
tab
.
getName
());
ERR
(
pTrans
->
getNdbError
());
if
(
pOp
==
NULL
)
{
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
rs
=
pOp
->
readTuples
(
exclusive
?
NdbScanOperation
::
LM_Exclusive
:
NdbScanOperation
::
LM_Read
);
if
(
rs
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
if
(
action
==
OnlyOpenScanOnce
){
// Call openScan one more time when it's already defined
NdbResultSet
*
rs2
=
pOp
->
readTuples
(
NdbScanOperation
::
LM_Read
);
if
(
rs2
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
rs
=
pOp
->
readTuples
(
exclusive
?
if
(
action
==
EqualAfterOpenScan
){
NdbScanOperation
::
LM_Exclusive
:
check
=
pOp
->
equal
(
tab
.
getColumn
(
0
)
->
getName
(),
10
);
NdbScanOperation
::
LM_Read
);
if
(
check
==
-
1
)
{
if
(
rs
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
if
(
action
==
OnlyOpenScanOnce
){
check
=
pOp
->
interpret_exit_ok
();
// Call openScan one more time when it's already defined
if
(
check
==
-
1
)
{
NdbResultSet
*
rs2
=
pOp
->
readTuples
(
NdbScanOperation
::
LM_Read
);
ERR
(
pTrans
->
getNdbError
());
if
(
rs2
==
0
)
{
pNdb
->
closeTransaction
(
pTrans
);
ERR
(
pTrans
->
getNdbError
());
return
NDBT_FAILED
;
pNdb
->
closeTransaction
(
pTrans
);
}
return
NDBT_FAILED
;
}
for
(
int
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
}
if
(
pOp
->
getValue
(
tab
.
getColumn
(
a
)
->
getName
())
==
NULL
)
{
if
(
action
==
EqualAfterOpenScan
){
check
=
pOp
->
equal
(
tab
.
getColumn
(
0
)
->
getName
(),
10
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
}
check
=
pOp
->
interpret_exit_ok
();
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
}
for
(
int
a
=
0
;
a
<
tab
.
getNoOfColumns
();
a
++
){
if
(
pOp
->
getValue
(
tab
.
getColumn
(
a
)
->
getName
())
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
}
}
check
=
pTrans
->
execute
(
NoCommit
);
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
int
abortCount
=
records
/
10
;
int
abortCount
=
records
/
10
;
bool
abortTrans
=
(
action
==
CloseWithoutStop
);
bool
abortTrans
=
(
action
==
CloseWithoutStop
);
int
eof
;
int
eof
;
int
rows
=
0
;
int
rows
=
0
;
eof
=
rs
->
nextResult
();
eof
=
rs
->
nextResult
();
while
(
eof
==
0
){
while
(
eof
==
0
){
rows
++
;
rows
++
;
if
(
abortCount
==
rows
&&
abortTrans
==
true
){
if
(
abortCount
==
rows
&&
abortTrans
==
true
){
g_info
<<
"Scan is aborted after "
<<
abortCount
<<
" rows"
<<
endl
;
g_info
<<
"Scan is aborted after "
<<
abortCount
<<
" rows"
<<
endl
;
...
...
ndb/test/ndbapi/testScan.cpp
View file @
4915b228
...
@@ -805,26 +805,9 @@ int runOnlyOneOpInScanTrans(NDBT_Context* ctx, NDBT_Step* step){
...
@@ -805,26 +805,9 @@ int runOnlyOneOpInScanTrans(NDBT_Context* ctx, NDBT_Step* step){
}
}
int
runExecuteScanWithoutOpenScan
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runExecuteScanWithoutOpenScan
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
return
NDBT_OK
;
int
records
=
ctx
->
getNumRecords
();
int
numFailed
=
0
;
ScanFunctions
scanF
(
*
pTab
);
if
(
scanF
.
scanReadFunctions
(
GETNDB
(
step
),
records
,
1
,
ScanFunctions
::
ExecuteScanWithOutOpenScan
,
false
)
==
0
){
numFailed
++
;
}
if
(
numFailed
>
0
)
return
NDBT_FAILED
;
else
return
NDBT_OK
;
}
}
int
runOnlyOneOpBeforeOpenScan
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
int
runOnlyOneOpBeforeOpenScan
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
){
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
const
NdbDictionary
::
Table
*
pTab
=
ctx
->
getTab
();
int
records
=
ctx
->
getNumRecords
();
int
records
=
ctx
->
getNumRecords
();
...
...
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