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
686be32e
Commit
686be32e
authored
Feb 08, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge siva.hindu.god:/home/tsmith/m/bk/50
into siva.hindu.god:/home/tsmith/m/bk/maint/50
parents
780e60af
1daa0e44
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
110 additions
and
15 deletions
+110
-15
mysql-test/r/ndb_read_multi_range.result
mysql-test/r/ndb_read_multi_range.result
+24
-0
mysql-test/t/ndb_read_multi_range.test
mysql-test/t/ndb_read_multi_range.test
+38
-0
ndb/include/ndbapi/NdbIndexScanOperation.hpp
ndb/include/ndbapi/NdbIndexScanOperation.hpp
+4
-2
ndb/include/ndbapi/NdbScanOperation.hpp
ndb/include/ndbapi/NdbScanOperation.hpp
+6
-2
ndb/src/mgmclient/CommandInterpreter.cpp
ndb/src/mgmclient/CommandInterpreter.cpp
+12
-0
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+7
-0
ndb/src/ndbapi/NdbScanOperation.cpp
ndb/src/ndbapi/NdbScanOperation.cpp
+11
-4
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+8
-7
No files found.
mysql-test/r/ndb_read_multi_range.result
View file @
686be32e
...
@@ -381,3 +381,27 @@ SELECT id, tag, doc, type FROM t1 WHERE id IN ('flipper','sakila');
...
@@ -381,3 +381,27 @@ SELECT id, tag, doc, type FROM t1 WHERE id IN ('flipper','sakila');
id tag doc type
id tag doc type
sakila 1 Some text goes here text
sakila 1 Some text goes here text
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (
var1 int(2) NOT NULL,
var2 int(2) NOT NULL,
PRIMARY KEY (var1)
) ENGINE=ndbcluster DEFAULT CHARSET=ascii CHECKSUM=1;
CREATE TABLE t2 (
var1 int(2) NOT NULL,
var2 int(2) NOT NULL,
PRIMARY KEY (var1)
) ENGINE=MyISAM DEFAULT CHARSET=ascii CHECKSUM=1;
CREATE TRIGGER testtrigger
AFTER UPDATE ON t1 FOR EACH ROW BEGIN
REPLACE INTO t2 SELECT * FROM t1 WHERE t1.var1 = NEW.var1;END|
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
UPDATE t1 SET var2 = 9 WHERE var1 IN(1,2,3);
DROP TRIGGER testtrigger;
DROP TABLE t1, t2;
create table t2 (a int, b int, primary key (a), key ab (a,b)) engine=ndbcluster;
insert into t2 values (1,1), (10,10);
select * from t2 use index (ab) where a in(1,10) order by a;
a b
1 1
10 10
drop table t2;
mysql-test/t/ndb_read_multi_range.test
View file @
686be32e
...
@@ -253,3 +253,41 @@ SELECT id, tag, doc, type FROM t1 WHERE id IN ('flipper','orka');
...
@@ -253,3 +253,41 @@ SELECT id, tag, doc, type FROM t1 WHERE id IN ('flipper','orka');
SELECT
id
,
tag
,
doc
,
type
FROM
t1
WHERE
id
IN
(
'flipper'
,
'sakila'
);
SELECT
id
,
tag
,
doc
,
type
FROM
t1
WHERE
id
IN
(
'flipper'
,
'sakila'
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#bug#25522
CREATE
TABLE
t1
(
var1
int
(
2
)
NOT
NULL
,
var2
int
(
2
)
NOT
NULL
,
PRIMARY
KEY
(
var1
)
)
ENGINE
=
ndbcluster
DEFAULT
CHARSET
=
ascii
CHECKSUM
=
1
;
CREATE
TABLE
t2
(
var1
int
(
2
)
NOT
NULL
,
var2
int
(
2
)
NOT
NULL
,
PRIMARY
KEY
(
var1
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
ascii
CHECKSUM
=
1
;
DELIMITER
|
;
CREATE
TRIGGER
testtrigger
AFTER
UPDATE
ON
t1
FOR
EACH
ROW
BEGIN
REPLACE
INTO
t2
SELECT
*
FROM
t1
WHERE
t1
.
var1
=
NEW
.
var1
;
END
|
DELIMITER
;
|
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
);
UPDATE
t1
SET
var2
=
9
WHERE
var1
IN
(
1
,
2
,
3
);
DROP
TRIGGER
testtrigger
;
DROP
TABLE
t1
,
t2
;
#bug#25821
create
table
t2
(
a
int
,
b
int
,
primary
key
(
a
),
key
ab
(
a
,
b
))
engine
=
ndbcluster
;
insert
into
t2
values
(
1
,
1
),
(
10
,
10
);
select
*
from
t2
use
index
(ab) where a in(1,10) order by a
;
drop
table
t2
;
ndb/include/ndbapi/NdbIndexScanOperation.hpp
View file @
686be32e
...
@@ -63,12 +63,14 @@ public:
...
@@ -63,12 +63,14 @@ public:
bool
order_by
,
bool
order_by
,
bool
order_desc
=
false
,
bool
order_desc
=
false
,
bool
read_range_no
=
false
,
bool
read_range_no
=
false
,
bool
keyinfo
=
false
)
{
bool
keyinfo
=
false
,
bool
multi_range
=
false
)
{
Uint32
scan_flags
=
Uint32
scan_flags
=
(
SF_OrderBy
&
-
(
Int32
)
order_by
)
|
(
SF_OrderBy
&
-
(
Int32
)
order_by
)
|
(
SF_Descending
&
-
(
Int32
)
order_desc
)
|
(
SF_Descending
&
-
(
Int32
)
order_desc
)
|
(
SF_ReadRangeNo
&
-
(
Int32
)
read_range_no
)
|
(
SF_ReadRangeNo
&
-
(
Int32
)
read_range_no
)
|
(
SF_KeyInfo
&
-
(
Int32
)
keyinfo
);
(
SF_KeyInfo
&
-
(
Int32
)
keyinfo
)
|
(
SF_MultiRange
&
-
(
Int32
)
multi_range
);
return
readTuples
(
lock_mode
,
scan_flags
,
parallel
,
batch
);
return
readTuples
(
lock_mode
,
scan_flags
,
parallel
,
batch
);
}
}
...
...
ndb/include/ndbapi/NdbScanOperation.hpp
View file @
686be32e
...
@@ -37,13 +37,15 @@ class NdbScanOperation : public NdbOperation {
...
@@ -37,13 +37,15 @@ class NdbScanOperation : public NdbOperation {
public:
public:
/**
/**
* Scan flags. OR-ed together and passed as second argument to
* Scan flags. OR-ed together and passed as second argument to
* readTuples.
* readTuples. Note that SF_MultiRange has to be set if several
* ranges (bounds) are to be passed.
*/
*/
enum
ScanFlag
{
enum
ScanFlag
{
SF_TupScan
=
(
1
<<
16
),
// scan TUP
SF_TupScan
=
(
1
<<
16
),
// scan TUP
SF_OrderBy
=
(
1
<<
24
),
// index scan in order
SF_OrderBy
=
(
1
<<
24
),
// index scan in order
SF_Descending
=
(
2
<<
24
),
// index scan in descending order
SF_Descending
=
(
2
<<
24
),
// index scan in descending order
SF_ReadRangeNo
=
(
4
<<
24
),
// enable @ref get_range_no
SF_ReadRangeNo
=
(
4
<<
24
),
// enable @ref get_range_no
SF_MultiRange
=
(
8
<<
24
),
// scan is part of multi-range scan
SF_KeyInfo
=
1
// request KeyInfo to be sent back
SF_KeyInfo
=
1
// request KeyInfo to be sent back
};
};
...
@@ -70,7 +72,8 @@ public:
...
@@ -70,7 +72,8 @@ public:
*/
*/
#ifdef ndb_readtuples_impossible_overload
#ifdef ndb_readtuples_impossible_overload
int
readTuples
(
LockMode
lock_mode
=
LM_Read
,
int
readTuples
(
LockMode
lock_mode
=
LM_Read
,
Uint32
batch
=
0
,
Uint32
parallel
=
0
,
bool
keyinfo
=
false
);
Uint32
batch
=
0
,
Uint32
parallel
=
0
,
bool
keyinfo
=
false
,
bool
multi_range
=
false
);
#endif
#endif
inline
int
readTuples
(
int
parallell
){
inline
int
readTuples
(
int
parallell
){
...
@@ -262,6 +265,7 @@ protected:
...
@@ -262,6 +265,7 @@ protected:
bool
m_descending
;
bool
m_descending
;
Uint32
m_read_range_no
;
Uint32
m_read_range_no
;
NdbRecAttr
*
m_curr_row
;
// Pointer to last returned row
NdbRecAttr
*
m_curr_row
;
// Pointer to last returned row
bool
m_multi_range
;
// Mark if operation is part of multi-range scan
};
};
inline
inline
...
...
ndb/src/mgmclient/CommandInterpreter.cpp
View file @
686be32e
...
@@ -2120,6 +2120,18 @@ CommandInterpreter::executeStatus(int processId,
...
@@ -2120,6 +2120,18 @@ CommandInterpreter::executeStatus(int processId,
ndbout
<<
processId
<<
": Node not found"
<<
endl
;
ndbout
<<
processId
<<
": Node not found"
<<
endl
;
return
-
1
;
return
-
1
;
}
}
if
(
cl
->
node_states
[
i
].
node_type
!=
NDB_MGM_NODE_TYPE_NDB
){
if
(
cl
->
node_states
[
i
].
version
!=
0
){
ndbout
<<
"Node "
<<
cl
->
node_states
[
i
].
node_id
<<
": connected"
;
ndbout_c
(
" (Version %d.%d.%d)"
,
getMajor
(
version
)
,
getMinor
(
version
),
getBuild
(
version
));
}
else
ndbout
<<
"Node "
<<
cl
->
node_states
[
i
].
node_id
<<
": not connected"
<<
endl
;
return
0
;
}
status
=
cl
->
node_states
[
i
].
node_status
;
status
=
cl
->
node_states
[
i
].
node_status
;
startPhase
=
cl
->
node_states
[
i
].
start_phase
;
startPhase
=
cl
->
node_states
[
i
].
start_phase
;
version
=
cl
->
node_states
[
i
].
version
;
version
=
cl
->
node_states
[
i
].
version
;
...
...
ndb/src/ndbapi/Ndb.cpp
View file @
686be32e
...
@@ -983,6 +983,8 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
...
@@ -983,6 +983,8 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
Uint64
tValue
;
Uint64
tValue
;
NdbRecAttr
*
tRecAttrResult
;
NdbRecAttr
*
tRecAttrResult
;
NdbError
savedError
;
CHECK_STATUS_MACRO_ZERO
;
CHECK_STATUS_MACRO_ZERO
;
BaseString
currentDb
(
getDatabaseName
());
BaseString
currentDb
(
getDatabaseName
());
...
@@ -1077,7 +1079,12 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
...
@@ -1077,7 +1079,12 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
error_handler:
error_handler:
theError
.
code
=
tConnection
->
theError
.
code
;
theError
.
code
=
tConnection
->
theError
.
code
;
savedError
=
theError
;
this
->
closeTransaction
(
tConnection
);
this
->
closeTransaction
(
tConnection
);
theError
=
savedError
;
error_return:
error_return:
// Restore current name space
// Restore current name space
setDatabaseName
(
currentDb
.
c_str
());
setDatabaseName
(
currentDb
.
c_str
());
...
...
ndb/src/ndbapi/NdbScanOperation.cpp
View file @
686be32e
...
@@ -1188,7 +1188,7 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
...
@@ -1188,7 +1188,7 @@ NdbIndexScanOperation::setBound(const NdbColumnImpl* tAttrInfo,
* so it's safe to use [tIndexAttrId]
* so it's safe to use [tIndexAttrId]
* (instead of looping as is NdbOperation::equal_impl)
* (instead of looping as is NdbOperation::equal_impl)
*/
*/
if
(
type
==
BoundEQ
&&
tDistrKey
)
if
(
type
==
BoundEQ
&&
tDistrKey
&&
!
m_multi_range
)
{
{
theNoOfTupKeyLeft
--
;
theNoOfTupKeyLeft
--
;
return
handle_distribution_key
((
Uint64
*
)
aValue
,
sizeInWords
);
return
handle_distribution_key
((
Uint64
*
)
aValue
,
sizeInWords
);
...
@@ -1249,6 +1249,7 @@ NdbIndexScanOperation::readTuples(LockMode lm,
...
@@ -1249,6 +1249,7 @@ NdbIndexScanOperation::readTuples(LockMode lm,
const
bool
order_by
=
scan_flags
&
SF_OrderBy
;
const
bool
order_by
=
scan_flags
&
SF_OrderBy
;
const
bool
order_desc
=
scan_flags
&
SF_Descending
;
const
bool
order_desc
=
scan_flags
&
SF_Descending
;
const
bool
read_range_no
=
scan_flags
&
SF_ReadRangeNo
;
const
bool
read_range_no
=
scan_flags
&
SF_ReadRangeNo
;
m_multi_range
=
scan_flags
&
SF_MultiRange
;
int
res
=
NdbScanOperation
::
readTuples
(
lm
,
scan_flags
,
parallel
,
batch
);
int
res
=
NdbScanOperation
::
readTuples
(
lm
,
scan_flags
,
parallel
,
batch
);
if
(
!
res
&&
read_range_no
)
if
(
!
res
&&
read_range_no
)
...
@@ -1716,6 +1717,12 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){
...
@@ -1716,6 +1717,12 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){
int
int
NdbIndexScanOperation
::
end_of_bound
(
Uint32
no
)
NdbIndexScanOperation
::
end_of_bound
(
Uint32
no
)
{
{
DBUG_ENTER
(
"end_of_bound"
);
DBUG_PRINT
(
"info"
,
(
"Range number %u"
,
no
));
/* Check that SF_MultiRange has been specified if more
than one range is specified */
if
(
no
>
0
&&
!
m_multi_range
)
DBUG_RETURN
(
-
1
);
if
(
no
<
(
1
<<
13
))
// Only 12-bits no of ranges
if
(
no
<
(
1
<<
13
))
// Only 12-bits no of ranges
{
{
Uint32
bound_head
=
*
m_first_bound_word
;
Uint32
bound_head
=
*
m_first_bound_word
;
...
@@ -1724,9 +1731,9 @@ NdbIndexScanOperation::end_of_bound(Uint32 no)
...
@@ -1724,9 +1731,9 @@ NdbIndexScanOperation::end_of_bound(Uint32 no)
m_first_bound_word
=
theKEYINFOptr
+
theTotalNrOfKeyWordInSignal
;;
m_first_bound_word
=
theKEYINFOptr
+
theTotalNrOfKeyWordInSignal
;;
m_this_bound_start
=
theTupKeyLen
;
m_this_bound_start
=
theTupKeyLen
;
return
0
;
DBUG_RETURN
(
0
)
;
}
}
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
}
int
int
...
...
sql/ha_ndbcluster.cc
View file @
686be32e
...
@@ -1995,8 +1995,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
...
@@ -1995,8 +1995,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
DBUG_PRINT
(
"error"
,
(
"key %d unknown flag %d"
,
j
,
p
.
key
->
flag
));
DBUG_PRINT
(
"error"
,
(
"key %d unknown flag %d"
,
j
,
p
.
key
->
flag
));
DBUG_ASSERT
(
FALSE
);
DBUG_ASSERT
(
FALSE
);
// Stop setting bounds but continue with what we have
// Stop setting bounds but continue with what we have
op
->
end_of_bound
(
range_no
);
DBUG_RETURN
(
op
->
end_of_bound
(
range_no
));
DBUG_RETURN
(
0
);
}
}
}
}
}
}
...
@@ -2043,8 +2042,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
...
@@ -2043,8 +2042,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
tot_len
+=
part_store_len
;
tot_len
+=
part_store_len
;
}
}
op
->
end_of_bound
(
range_no
);
DBUG_RETURN
(
op
->
end_of_bound
(
range_no
));
DBUG_RETURN
(
0
);
}
}
/*
/*
...
@@ -3882,11 +3880,10 @@ int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type)
...
@@ -3882,11 +3880,10 @@ int ha_ndbcluster::start_stmt(THD *thd, thr_lock_type lock_type)
ERR_RETURN
(
ndb
->
getNdbError
());
ERR_RETURN
(
ndb
->
getNdbError
());
no_uncommitted_rows_reset
(
thd
);
no_uncommitted_rows_reset
(
thd
);
thd_ndb
->
stmt
=
trans
;
thd_ndb
->
stmt
=
trans
;
thd_ndb
->
query_state
&=
NDB_QUERY_NORMAL
;
trans_register_ha
(
thd
,
FALSE
,
&
ndbcluster_hton
);
trans_register_ha
(
thd
,
FALSE
,
&
ndbcluster_hton
);
}
}
thd_ndb
->
query_state
&=
NDB_QUERY_NORMAL
;
m_active_trans
=
trans
;
m_active_trans
=
trans
;
// Start of statement
// Start of statement
m_retrieve_all_fields
=
FALSE
;
m_retrieve_all_fields
=
FALSE
;
m_retrieve_primary_key
=
FALSE
;
m_retrieve_primary_key
=
FALSE
;
...
@@ -6365,7 +6362,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
...
@@ -6365,7 +6362,7 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
}
}
else
if
((
scanOp
=
m_active_trans
->
getNdbIndexScanOperation
(
idx
,
tab
))
else
if
((
scanOp
=
m_active_trans
->
getNdbIndexScanOperation
(
idx
,
tab
))
&&!
scanOp
->
readTuples
(
lm
,
0
,
parallelism
,
sorted
,
&&!
scanOp
->
readTuples
(
lm
,
0
,
parallelism
,
sorted
,
FALSE
,
TRUE
,
need_pk
)
FALSE
,
TRUE
,
need_pk
,
TRUE
)
&&!
generate_scan_filter
(
m_cond_stack
,
scanOp
)
&&!
generate_scan_filter
(
m_cond_stack
,
scanOp
)
&&!
define_read_attrs
(
end_of_buffer
-
reclength
,
scanOp
))
&&!
define_read_attrs
(
end_of_buffer
-
reclength
,
scanOp
))
{
{
...
@@ -6528,7 +6525,11 @@ close_scan:
...
@@ -6528,7 +6525,11 @@ close_scan:
}
}
if
(
multi_range_curr
==
multi_range_end
)
if
(
multi_range_curr
==
multi_range_end
)
{
Thd_ndb
*
thd_ndb
=
get_thd_ndb
(
current_thd
);
thd_ndb
->
query_state
&=
NDB_QUERY_NORMAL
;
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
DBUG_RETURN
(
HA_ERR_END_OF_FILE
);
}
/**
/**
* Read remaining ranges
* Read remaining ranges
...
...
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