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
d99c91b6
Commit
d99c91b6
authored
Jun 11, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handler w.r.t scan
parent
eb863023
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
33 deletions
+31
-33
ndb/include/ndbapi/NdbApi.hpp
ndb/include/ndbapi/NdbApi.hpp
+0
-2
ndb/src/ndbapi/NdbRecAttr.cpp
ndb/src/ndbapi/NdbRecAttr.cpp
+0
-1
ndb/tools/select_count.cpp
ndb/tools/select_count.cpp
+13
-14
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+15
-15
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+3
-1
No files found.
ndb/include/ndbapi/NdbApi.hpp
View file @
d99c91b6
...
...
@@ -25,8 +25,6 @@
#include "NdbIndexOperation.hpp"
#include "NdbIndexScanOperation.hpp"
#include "NdbScanFilter.hpp"
#include "NdbSchemaCon.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp"
#include "NdbDictionary.hpp"
...
...
ndb/src/ndbapi/NdbRecAttr.cpp
View file @
d99c91b6
...
...
@@ -220,5 +220,4 @@ NdbOut& operator<<(NdbOut& ndbout, const NdbRecAttr &r)
}
return
ndbout
;
>>>>>>>
}
ndb/tools/select_count.cpp
View file @
d99c91b6
...
...
@@ -30,8 +30,7 @@ static int
select_count
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
int
parallelism
,
int
*
count_rows
,
UtilTransactions
::
ScanLock
lock
,
NdbConnection
*
pBuddyTrans
=
0
);
UtilTransactions
::
ScanLock
lock
);
int
main
(
int
argc
,
const
char
**
argv
){
const
char
*
_dbname
=
"TEST_DB"
;
...
...
@@ -95,14 +94,13 @@ int
select_count
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
int
parallelism
,
int
*
count_rows
,
UtilTransactions
::
ScanLock
lock
,
NdbConnection
*
pBuddyTrans
){
UtilTransactions
::
ScanLock
lock
){
int
retryAttempt
=
0
;
const
int
retryMax
=
100
;
int
check
;
NdbConnection
*
pTrans
;
NdbOperation
*
pOp
;
Ndb
Scan
Operation
*
pOp
;
while
(
true
){
...
...
@@ -112,7 +110,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
return
NDBT_FAILED
;
}
pTrans
=
pNdb
->
hupp
(
pBuddyTrans
);
pTrans
=
pNdb
->
startTransaction
(
);
if
(
pTrans
==
NULL
)
{
const
NdbError
err
=
pNdb
->
getNdbError
();
...
...
@@ -124,26 +122,27 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
ERR
(
err
);
return
NDBT_FAILED
;
}
pOp
=
pTrans
->
getNdbOperation
(
pTab
->
getName
());
pOp
=
pTrans
->
getNdb
Scan
Operation
(
pTab
->
getName
());
if
(
pOp
==
NULL
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
}
NdbResultSet
*
rs
;
switch
(
lock
){
case
UtilTransactions
:
:
SL_ReadHold
:
check
=
pOp
->
openScanReadHoldLock
(
parallelism
);
rs
=
pOp
->
readTuples
(
NdbScanOperation
::
LM_Read
,
0
,
parallelism
);
break
;
case
UtilTransactions
:
:
SL_Exclusive
:
check
=
pOp
->
openScanExclusive
(
parallelism
);
rs
=
pOp
->
readTuples
(
NdbScanOperation
::
LM_Exclusive
,
0
,
parallelism
);
break
;
case
UtilTransactions
:
:
SL_Read
:
default:
check
=
pOp
->
openScanRead
(
parallelism
);
rs
=
pOp
->
readTuples
(
NdbScanOperation
::
LM_Dirty
,
0
,
parallelism
);
}
if
(
check
==
-
1
)
{
if
(
rs
==
0
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_FAILED
;
...
...
@@ -156,7 +155,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
return
NDBT_FAILED
;
}
check
=
pTrans
->
execute
Scan
();
check
=
pTrans
->
execute
(
NoCommit
);
if
(
check
==
-
1
)
{
ERR
(
pTrans
->
getNdbError
());
pNdb
->
closeTransaction
(
pTrans
);
...
...
@@ -165,11 +164,11 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int
eof
;
int
rows
=
0
;
eof
=
pTrans
->
nextScan
Result
();
eof
=
rs
->
next
Result
();
while
(
eof
==
0
){
rows
++
;
eof
=
pTrans
->
nextScan
Result
();
eof
=
rs
->
next
Result
();
}
if
(
eof
==
-
1
)
{
const
NdbError
err
=
pTrans
->
getNdbError
();
...
...
sql/ha_ndbcluster.cc
View file @
d99c91b6
...
...
@@ -462,10 +462,10 @@ void ha_ndbcluster::release_metadata()
DBUG_VOID_RETURN
;
}
Ndb
Cursor
Operation
::
LockMode
get_ndb_lock_type
(
enum
thr_lock_type
type
)
Ndb
Scan
Operation
::
LockMode
get_ndb_lock_type
(
enum
thr_lock_type
type
)
{
return
(
type
==
TL_WRITE_ALLOW_WRITE
)
?
Ndb
CursorOperation
::
LM_Exclusive
:
NdbCursor
Operation
::
LM_Read
;
Ndb
ScanOperation
::
LM_Exclusive
:
NdbScan
Operation
::
LM_Read
;
}
static
const
ulong
index_type_flags
[]
=
...
...
@@ -795,7 +795,7 @@ inline int ha_ndbcluster::next_result(byte *buf)
Set bounds for a ordered index scan, use key_range
*/
int
ha_ndbcluster
::
set_bounds
(
NdbOperation
*
op
,
int
ha_ndbcluster
::
set_bounds
(
Ndb
IndexScan
Operation
*
op
,
const
key_range
*
key
,
int
bound
)
{
...
...
@@ -843,7 +843,7 @@ int ha_ndbcluster::set_bounds(NdbOperation *op,
so if this bound was not EQ, bail out and make
a best effort attempt
*/
if
(
bound
!=
NdbOperation
::
BoundEQ
)
if
(
bound
!=
Ndb
IndexScan
Operation
::
BoundEQ
)
break
;
}
...
...
@@ -861,7 +861,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
{
NdbConnection
*
trans
=
m_active_trans
;
NdbResultSet
*
cursor
;
NdbScanOperation
*
op
;
Ndb
Index
ScanOperation
*
op
;
const
char
*
index_name
;
DBUG_ENTER
(
"ordered_index_scan"
);
...
...
@@ -869,19 +869,19 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
DBUG_PRINT
(
"enter"
,
(
"Starting new ordered scan on %s"
,
m_tabname
));
index_name
=
get_index_name
(
active_index
);
if
(
!
(
op
=
trans
->
getNdbScanOperation
(
index_name
,
m_tabname
)))
if
(
!
(
op
=
trans
->
getNdb
Index
ScanOperation
(
index_name
,
m_tabname
)))
ERR_RETURN
(
trans
->
getNdbError
());
if
(
!
(
cursor
=
op
->
readTuples
(
parallelism
,
get_ndb_lock_type
(
m_lock
.
type
)
)))
if
(
!
(
cursor
=
op
->
readTuples
(
get_ndb_lock_type
(
m_lock
.
type
),
0
,
parallelism
)))
ERR_RETURN
(
trans
->
getNdbError
());
m_active_cursor
=
cursor
;
if
(
start_key
&&
set_bounds
(
op
,
start_key
,
(
start_key
->
flag
==
HA_READ_KEY_EXACT
)
?
NdbOperation
::
BoundEQ
:
Ndb
IndexScan
Operation
::
BoundEQ
:
(
start_key
->
flag
==
HA_READ_AFTER_KEY
)
?
NdbOperation
::
BoundLT
:
NdbOperation
::
BoundLE
))
Ndb
IndexScan
Operation
::
BoundLT
:
Ndb
IndexScan
Operation
::
BoundLE
))
DBUG_RETURN
(
1
);
if
(
end_key
)
...
...
@@ -892,8 +892,8 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
}
else
if
(
set_bounds
(
op
,
end_key
,
(
end_key
->
flag
==
HA_READ_AFTER_KEY
)
?
NdbOperation
::
BoundGE
:
NdbOperation
::
BoundGT
))
Ndb
IndexScan
Operation
::
BoundGE
:
Ndb
IndexScan
Operation
::
BoundGT
))
DBUG_RETURN
(
1
);
}
DBUG_RETURN
(
define_read_attrs
(
buf
,
op
));
...
...
@@ -931,10 +931,10 @@ int ha_ndbcluster::filtered_scan(const byte *key, uint key_len,
if
(
!
(
op
=
trans
->
getNdbScanOperation
(
m_tabname
)))
ERR_RETURN
(
trans
->
getNdbError
());
if
(
!
(
cursor
=
op
->
readTuples
(
parallelism
,
get_ndb_lock_type
(
m_lock
.
type
)
)))
if
(
!
(
cursor
=
op
->
readTuples
(
get_ndb_lock_type
(
m_lock
.
type
),
0
,
parallelism
)))
ERR_RETURN
(
trans
->
getNdbError
());
m_active_cursor
=
cursor
;
{
// Start scan filter
NdbScanFilter
sf
(
op
);
...
...
@@ -1000,7 +1000,7 @@ int ha_ndbcluster::full_table_scan(byte *buf)
if
(
!
(
op
=
trans
->
getNdbScanOperation
(
m_tabname
)))
ERR_RETURN
(
trans
->
getNdbError
());
if
(
!
(
cursor
=
op
->
readTuples
(
parallelism
,
get_ndb_lock_type
(
m_lock
.
type
)
)))
if
(
!
(
cursor
=
op
->
readTuples
(
get_ndb_lock_type
(
m_lock
.
type
),
0
,
parallelism
)))
ERR_RETURN
(
trans
->
getNdbError
());
m_active_cursor
=
cursor
;
DBUG_RETURN
(
define_read_attrs
(
buf
,
op
));
...
...
sql/ha_ndbcluster.h
View file @
d99c91b6
...
...
@@ -33,6 +33,8 @@ class NdbOperation; // Forward declaration
class
NdbConnection
;
// Forward declaration
class
NdbRecAttr
;
// Forward declaration
class
NdbResultSet
;
// Forward declaration
class
NdbScanOperation
;
class
NdbIndexScanOperation
;
typedef
enum
ndb_index_type
{
UNDEFINED_INDEX
=
0
,
...
...
@@ -182,7 +184,7 @@ class ha_ndbcluster: public handler
int
set_primary_key
(
NdbOperation
*
op
,
const
byte
*
key
);
int
set_primary_key
(
NdbOperation
*
op
);
int
set_primary_key_from_old_data
(
NdbOperation
*
op
,
const
byte
*
old_data
);
int
set_bounds
(
NdbOperation
*
ndb_op
,
const
key_range
*
key
,
int
set_bounds
(
Ndb
IndexScan
Operation
*
ndb_op
,
const
key_range
*
key
,
int
bound
);
int
key_cmp
(
uint
keynr
,
const
byte
*
old_row
,
const
byte
*
new_row
);
void
print_results
();
...
...
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