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
d22ab3f7
Commit
d22ab3f7
authored
Nov 29, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl2126 ndb read_multi_range - bugfixes + more tests
parent
5d420d91
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
87 deletions
+140
-87
mysql-test/r/ndb_read_multi_range.result
mysql-test/r/ndb_read_multi_range.result
+50
-4
mysql-test/t/ndb_read_multi_range.test
mysql-test/t/ndb_read_multi_range.test
+16
-9
ndb/include/kernel/signaldata/TcIndx.hpp
ndb/include/kernel/signaldata/TcIndx.hpp
+0
-30
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+20
-20
ndb/src/ndbapi/NdbIndexOperation.cpp
ndb/src/ndbapi/NdbIndexOperation.cpp
+1
-13
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+53
-11
No files found.
mysql-test/r/ndb_read_multi_range.result
View file @
d22ab3f7
...
...
@@ -33,18 +33,20 @@ a b c
5 2 12
9 2 8
drop table r1;
create table r1 as select * from t1 where a in (
33,8,12
);
create table r1 as select * from t1 where a in (
2,8) or (a > 11) or (a <= 1
);
select * from r1 order by a;
a b c
1 2 1
2 3 2
8 5 9
12 5 5
drop table r1;
select * from t1 where a in (33,34,35) order by a;
a b c
select * from t1 where a in (33,8,12) order by a;
create table r1 as select * from t1 where a in (33,8,12);
select * from r1 order by a;
a b c
8 5 9
12 5 5
drop table r1;
create table r1 as select * from t1 where a in (2,33,8,12,34);
select * from r1 order by a;
a b c
...
...
@@ -73,6 +75,50 @@ a b c
drop table r1;
select * from t1 where b in (45,22) order by a;
a b c
create table r1 as select * from t1 where c in (2,8,33);
select * from r1 order by a;
a b c
2 3 2
9 2 8
drop table r1;
create table r1 as select * from t1 where c in (13,2,8,33,12);
select * from r1 order by a;
a b c
2 3 2
5 2 12
9 2 8
drop table r1;
select * from t1 where a in (33,8,12) order by a;
a b c
8 5 9
12 5 5
select * from t1 where a in (33,34,35) order by a;
a b c
select * from t1 where a in (2,8) or (a > 11) or (a <= 1) order by a;
a b c
1 2 1
2 3 2
8 5 9
12 5 5
select * from t1 where b in (6,7) or (b <= 5) or (b >= 10) order by b,a;
a b c
1 2 1
5 2 12
9 2 8
2 3 2
6 3 11
10 3 7
3 4 3
7 4 10
11 4 6
4 5 4
8 5 9
12 5 5
select * from t1 where c in (13,2,8,33,12) order by c,a;
a b c
2 3 2
9 2 8
5 2 12
drop table t1;
create table t1 (
a int not null,
...
...
mysql-test/t/ndb_read_multi_range.test
View file @
d22ab3f7
...
...
@@ -34,12 +34,15 @@ create table r1 as select * from t1 where c in (2,8,12);
select
*
from
r1
order
by
a
;
drop
table
r1
;
# batch mixed
create
table
r1
as
select
*
from
t1
where
a
in
(
2
,
8
)
or
(
a
>
11
)
or
(
a
<=
1
);
select
*
from
r1
order
by
a
;
drop
table
r1
;
# batch on primary key, missing values
create
table
r1
as
select
*
from
t1
where
a
in
(
33
,
8
,
12
);
select
*
from
r1
order
by
a
;
drop
table
r1
;
select
*
from
t1
where
a
in
(
33
,
34
,
35
)
order
by
a
;
select
*
from
t1
where
a
in
(
33
,
8
,
12
)
order
by
a
;
create
table
r1
as
select
*
from
t1
where
a
in
(
2
,
33
,
8
,
12
,
34
);
select
*
from
r1
order
by
a
;
drop
table
r1
;
...
...
@@ -54,15 +57,19 @@ select * from r1 order by a;
drop
table
r1
;
select
*
from
t1
where
b
in
(
45
,
22
)
order
by
a
;
# current bug in ndb, cannot handle missing values for unique indexes
# batch on unique hash index, missing values
#
create table r1 as select * from t1 where c in (2,8,33);
#
select * from r1 order by a;
#
drop table r1;
#
create table r1 as select * from t1 where c in (13,2,8,33,12);
#
select * from r1 order by a;
#
drop table r1;
create
table
r1
as
select
*
from
t1
where
c
in
(
2
,
8
,
33
);
select
*
from
r1
order
by
a
;
drop
table
r1
;
create
table
r1
as
select
*
from
t1
where
c
in
(
13
,
2
,
8
,
33
,
12
);
select
*
from
r1
order
by
a
;
drop
table
r1
;
select
*
from
t1
where
a
in
(
33
,
8
,
12
)
order
by
a
;
select
*
from
t1
where
a
in
(
33
,
34
,
35
)
order
by
a
;
select
*
from
t1
where
a
in
(
2
,
8
)
or
(
a
>
11
)
or
(
a
<=
1
)
order
by
a
;
select
*
from
t1
where
b
in
(
6
,
7
)
or
(
b
<=
5
)
or
(
b
>=
10
)
order
by
b
,
a
;
select
*
from
t1
where
c
in
(
13
,
2
,
8
,
33
,
12
)
order
by
c
,
a
;
drop
table
t1
;
#
...
...
ndb/include/kernel/signaldata/TcIndx.hpp
View file @
d22ab3f7
...
...
@@ -123,34 +123,4 @@ TcIndxConf::setMarkerFlag(Uint32 & confInfo, Uint32 flag){
confInfo
|=
(
flag
<<
17
);
}
class
TcIndxRef
{
/**
* Reciver(s)
*/
friend
class
NdbIndexOperation
;
/**
* Sender(s)
*/
friend
class
Dbtc
;
/**
* For printing
*/
friend
bool
printTCINDXREF
(
FILE
*
,
const
Uint32
*
,
Uint32
,
Uint16
);
public:
/**
* Length of signal
*/
public:
STATIC_CONST
(
SignalLength
=
4
);
private:
Uint32
connectPtr
;
Uint32
transId
[
2
];
Uint32
errorCode
;
};
#endif
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
d22ab3f7
...
...
@@ -11144,14 +11144,14 @@ void Dbtc::execTCINDXREQ(Signal* signal)
if
(
!
seizeIndexOperation
(
regApiPtr
,
indexOpPtr
))
{
jam
();
// Failed to allocate index operation
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
tcIndxReq
->
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4000
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
TcIndexOperation
*
indexOp
=
indexOpPtr
.
p
;
...
...
@@ -11465,14 +11465,14 @@ void Dbtc::execTCKEYCONF(Signal* signal)
case
(
IOS_NOOP
):
{
jam
();
// Should never happen, abort
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4349
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
case
(
IOS_INDEX_ACCESS
):
{
...
...
@@ -11484,14 +11484,14 @@ void Dbtc::execTCKEYCONF(Signal* signal)
case
(
IOS_INDEX_ACCESS_WAIT_FOR_TRANSID_AI
):
{
jam
();
// Double TCKEYCONF, should never happen, abort
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4349
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
case
(
IOS_INDEX_ACCESS_WAIT_FOR_TCKEYCONF
):
{
...
...
@@ -11578,7 +11578,7 @@ void Dbtc::execTCKEYREF(Signal* signal)
jam
();
TcKeyReq
*
const
tcIndxReq
=
&
indexOp
->
tcIndxReq
;
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
ndbassert
(
regApiPtr
->
noIndexOp
);
regApiPtr
->
noIndexOp
--
;
// Decrease count
...
...
@@ -11587,7 +11587,7 @@ void Dbtc::execTCKEYREF(Signal* signal)
tcIndxRef
->
transId
[
1
]
=
tcKeyRef
->
transId
[
1
];
tcIndxRef
->
errorCode
=
tcKeyRef
->
errorCode
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
GSN_TCINDXREF
,
signal
,
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
}
...
...
@@ -11654,14 +11654,14 @@ void Dbtc::execTRANSID_AI(Signal* signal)
signal
->
getLength
()
-
TransIdAI
::
HeaderLength
))
{
jam
();
// Failed to allocate space for TransIdAI
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4000
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
...
...
@@ -11669,14 +11669,14 @@ void Dbtc::execTRANSID_AI(Signal* signal)
case
(
IOS_NOOP
):
{
jam
();
// Should never happen, abort
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4349
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
break
;
}
...
...
@@ -11697,14 +11697,14 @@ void Dbtc::execTRANSID_AI(Signal* signal)
#endif
/*
// Too many TRANSID_AI
Tc
IndxRef * const tcIndxRef = (TcIndx
Ref *)signal->getDataPtrSend();
Tc
KeyRef * const tcIndxRef = (TcKey
Ref *)signal->getDataPtrSend();
tcIndexRef->connectPtr = indexOp->tcIndxReq.senderData;
tcIndxRef->transId[0] = regApiPtr->transid[0];
tcIndxRef->transId[1] = regApiPtr->transid[1];
tcIndxRef->errorCode = 4349;
sendSignal(regApiPtr->ndbapiBlockref, GSN_TCINDXREF, signal,
Tc
Indx
Ref::SignalLength, JBB);
Tc
Key
Ref::SignalLength, JBB);
*/
break
;
}
...
...
@@ -11722,14 +11722,14 @@ void Dbtc::execTRANSID_AI(Signal* signal)
case
(
IOS_INDEX_OPERATION
):
{
// Should never receive TRANSID_AI in this state!!
jam
();
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4349
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
}
...
...
@@ -11775,14 +11775,14 @@ void Dbtc::readIndexTable(Signal* signal,
if
((
indexData
=
c_theIndexes
.
getPtr
(
indexOp
->
tcIndxReq
.
tableId
))
==
NULL
)
{
jam
();
// Failed to find index record
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4000
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
tcKeyReq
->
transId1
=
transId1
;
...
...
@@ -11895,14 +11895,14 @@ void Dbtc::executeIndexOperation(Signal* signal,
if
((
indexData
=
c_theIndexes
.
getPtr
(
tcIndxReq
->
tableId
))
==
NULL
)
{
jam
();
// Failed to find index record
Tc
IndxRef
*
const
tcIndxRef
=
(
TcIndx
Ref
*
)
signal
->
getDataPtrSend
();
Tc
KeyRef
*
const
tcIndxRef
=
(
TcKey
Ref
*
)
signal
->
getDataPtrSend
();
tcIndxRef
->
connectPtr
=
indexOp
->
tcIndxReq
.
senderData
;
tcIndxRef
->
transId
[
0
]
=
regApiPtr
->
transid
[
0
];
tcIndxRef
->
transId
[
1
]
=
regApiPtr
->
transid
[
1
];
tcIndxRef
->
errorCode
=
4349
;
sendSignal
(
regApiPtr
->
ndbapiBlockref
,
GSN_TCINDXREF
,
signal
,
Tc
Indx
Ref
::
SignalLength
,
JBB
);
Tc
Key
Ref
::
SignalLength
,
JBB
);
return
;
}
// Find schema version of primary table
...
...
ndb/src/ndbapi/NdbIndexOperation.cpp
View file @
d22ab3f7
...
...
@@ -411,17 +411,5 @@ Remark: Handles the reception of the TCKEYREF signal.
int
NdbIndexOperation
::
receiveTCINDXREF
(
NdbApiSignal
*
aSignal
)
{
const
TcIndxRef
*
const
tcIndxRef
=
CAST_CONSTPTR
(
TcIndxRef
,
aSignal
->
getDataPtr
());
if
(
checkState_TransId
(
aSignal
)
==
-
1
)
{
return
-
1
;
}
//if
theStatus
=
Finished
;
theNdbCon
->
theReturnStatus
=
NdbConnection
::
ReturnFailure
;
Uint32
errorCode
=
tcIndxRef
->
errorCode
;
theError
.
code
=
errorCode
;
theNdbCon
->
setOperationErrorCodeAbort
(
errorCode
);
return
theNdbCon
->
OpCompleteFailure
(
theNdbCon
->
m_abortOption
);
return
NdbOperation
::
receiveTCKEYREF
(
aSignal
);
}
//NdbIndexOperation::receiveTCINDXREF()
sql/ha_ndbcluster.cc
View file @
d22ab3f7
...
...
@@ -3306,7 +3306,7 @@ static int create_ndb_column(NDBCOL &col,
col
.
setPartSize
(
0
);
col
.
setStripeSize
(
0
);
break
;
mysql_type_blob:
//
mysql_type_blob:
case
MYSQL_TYPE_BLOB
:
if
(
field
->
flags
&
BINARY_FLAG
)
col
.
setType
(
NDBCOL
::
Blob
);
...
...
@@ -4788,11 +4788,12 @@ ha_ndbcluster::read_multi_range_first(key_multi_range **found_range_p,
case
ORDERED_INDEX
:
range:
ranges
[
i
].
range_flag
&=
~
(
uint
)
UNIQUE_RANGE
;
if
(
sorted
&&
scanOp
!=
0
&&
curr
!=
buffer
->
buffer
)
if
(
sorted
&&
scanOp
!=
0
)
{
/**
* We currently don't support batching of ordered range scans
*/
i
--
;
curr
=
(
byte
*
)
buffer
->
buffer_end
;
break
;
}
...
...
@@ -4865,12 +4866,47 @@ ha_ndbcluster::read_multi_range_next(key_multi_range ** multi_range_found_p)
}
else
if
(
m_active_cursor
)
{
if
(
m_active_cursor
->
nextResult
())
goto
found
;
int
check
;
bool
contact_ndb
=
m_lock
.
type
<
TL_WRITE_ALLOW_WRITE
;
do
{
check
=
m_active_cursor
->
nextResult
(
contact_ndb
,
m_force_send
);
if
(
check
==
0
)
goto
found
;
else
if
(
check
==
1
||
check
==
2
)
{
// 1: No more records
// 2: No more cached records
/*
Before fetching more rows and releasing lock(s),
all pending update or delete operations should
be sent to NDB
*/
DBUG_PRINT
(
"info"
,
(
"ops_pending: %d"
,
m_ops_pending
));
if
(
m_ops_pending
)
{
// if (current_thd->transaction.on)
if
(
m_transaction_on
)
{
if
(
execute_no_commit
(
this
,
m_active_trans
)
!=
0
)
DBUG_RETURN
(
ndb_err
(
m_active_trans
));
}
else
{
if
(
execute_commit
(
this
,
m_active_trans
)
!=
0
)
DBUG_RETURN
(
ndb_err
(
m_active_trans
));
int
res
=
m_active_trans
->
restart
();
DBUG_ASSERT
(
res
==
0
);
}
m_ops_pending
=
0
;
}
contact_ndb
=
(
check
==
2
);
}
}
while
(
check
==
2
);
multi_range_curr
++
;
m_multi_range_result_ptr
+=
reclength
;
m_active_cursor
->
close
();
m_active_cursor
=
0
;
}
...
...
@@ -4893,17 +4929,23 @@ ha_ndbcluster::read_multi_range_next(key_multi_range ** multi_range_found_p)
multi_range_sorted
,
multi_range_buffer
));
found_next:
multi_range_curr
++
;
op
=
m_active_trans
->
getNextCompletedOperation
(
op
);
m_multi_range_result_ptr
+=
reclength
;
found:
*
multi_range_found_p
=
multi_ranges
+
multi_range_curr
;
memcpy
(
table
->
record
[
0
],
m_multi_range_result_ptr
,
reclength
);
unpack_record
(
table
->
record
[
0
]);
table
->
status
=
0
;
DBUG_RETURN
(
0
);
found_next:
*
multi_range_found_p
=
multi_ranges
+
multi_range_curr
;
memcpy
(
table
->
record
[
0
],
m_multi_range_result_ptr
,
reclength
);
unpack_record
(
table
->
record
[
0
]);
table
->
status
=
0
;
multi_range_curr
++
;
op
=
m_active_trans
->
getNextCompletedOperation
(
op
);
m_multi_range_result_ptr
+=
reclength
;
DBUG_RETURN
(
0
);
}
#endif
/* HAVE_NDBCLUSTER_DB */
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