BUG#671361: virtual int Mrr_ordered_index_reader::refill_buffer(): Assertion `!know_key_tuple_params
- Make sure we have enough space for both rowids and keys.
This commit is contained in:
parent
594a8648ef
commit
3d698ac616
@ -365,3 +365,40 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t2 ALL PRIMARY,idx NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join)
|
1 SIMPLE t2 ALL PRIMARY,idx NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join)
|
||||||
1 SIMPLE t3 ref PRIMARY,idx idx 3 test.t2.v 2 Using index condition; Using where
|
1 SIMPLE t3 ref PRIMARY,idx idx 3 test.t2.v 2 Using index condition; Using where
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
|
# BUG#671361: virtual int Mrr_ordered_index_reader::refill_buffer(): Assertion `!know_key_tuple_params
|
||||||
|
# (works only on Maria because we need 1024-byte long key)
|
||||||
|
#
|
||||||
|
SET SESSION optimizer_use_mrr = 'force';
|
||||||
|
SET SESSION join_cache_level = 6;
|
||||||
|
SET SESSION join_buffer_size = 1024;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (pk),
|
||||||
|
KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
|
||||||
|
) ENGINE=Aria;
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1,'z'),
|
||||||
|
(2,'abcdefjhjkl'),
|
||||||
|
(3,'in'),
|
||||||
|
(4,'abcdefjhjkl'),
|
||||||
|
(6,'abcdefjhjkl');
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
col_varchar_10_latin1 varchar(10) DEFAULT NULL
|
||||||
|
) ENGINE=Aria;
|
||||||
|
INSERT INTO t2 VALUES ('foo'), ('foo');
|
||||||
|
EXPLAIN SELECT count(*)
|
||||||
|
FROM t1 AS table1, t2 AS table2
|
||||||
|
WHERE
|
||||||
|
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE table2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
|
1 SIMPLE table1 ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1027 test.table2.col_varchar_10_latin1 2 Using index condition(BKA); Using where; Using join buffer (flat, BKA join)
|
||||||
|
SELECT count(*)
|
||||||
|
FROM t1 AS table1, t2 AS table2
|
||||||
|
WHERE
|
||||||
|
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
drop table t1, t2;
|
||||||
|
@ -87,7 +87,41 @@ EXPLAIN
|
|||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # BUG#671361: virtual int Mrr_ordered_index_reader::refill_buffer(): Assertion `!know_key_tuple_params
|
||||||
|
--echo # (works only on Maria because we need 1024-byte long key)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET SESSION optimizer_use_mrr = 'force';
|
||||||
|
SET SESSION join_cache_level = 6;
|
||||||
|
SET SESSION join_buffer_size = 1024;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (pk),
|
||||||
|
KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
|
||||||
|
) ENGINE=Aria;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(1,'z'),
|
||||||
|
(2,'abcdefjhjkl'),
|
||||||
|
(3,'in'),
|
||||||
|
(4,'abcdefjhjkl'),
|
||||||
|
(6,'abcdefjhjkl');
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
col_varchar_10_latin1 varchar(10) DEFAULT NULL
|
||||||
|
) ENGINE=Aria;
|
||||||
|
INSERT INTO t2 VALUES ('foo'), ('foo');
|
||||||
|
|
||||||
|
EXPLAIN SELECT count(*)
|
||||||
|
FROM t1 AS table1, t2 AS table2
|
||||||
|
WHERE
|
||||||
|
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
|
||||||
|
|
||||||
|
SELECT count(*)
|
||||||
|
FROM t1 AS table1, t2 AS table2
|
||||||
|
WHERE
|
||||||
|
table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
|
||||||
|
|
||||||
|
drop table t1, t2;
|
||||||
|
@ -1041,6 +1041,7 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
|
|||||||
/* Give all space to the key buffer, key buffer must be forward */
|
/* Give all space to the key buffer, key buffer must be forward */
|
||||||
key_buffer= &forward_key_buf;
|
key_buffer= &forward_key_buf;
|
||||||
key_buffer->set_buffer_space(full_buf, full_buf_end);
|
key_buffer->set_buffer_space(full_buf, full_buf_end);
|
||||||
|
DBUG_ASSERT(key_buffer->have_space_for(key_buff_elem_size));
|
||||||
|
|
||||||
/* Just in case, tell rowid buffer that it has zero size: */
|
/* Just in case, tell rowid buffer that it has zero size: */
|
||||||
rowid_buffer.set_buffer_space(full_buf_end, full_buf_end);
|
rowid_buffer.set_buffer_space(full_buf_end, full_buf_end);
|
||||||
@ -1080,15 +1081,25 @@ void DsMrr_impl::setup_buffer_sizes(uint key_size_in_keybuf,
|
|||||||
if (bytes_for_keys < key_buff_elem_size + 1)
|
if (bytes_for_keys < key_buff_elem_size + 1)
|
||||||
{
|
{
|
||||||
uint add= key_buff_elem_size + 1 - bytes_for_keys;
|
uint add= key_buff_elem_size + 1 - bytes_for_keys;
|
||||||
|
bytes_for_keys= key_buff_elem_size + 1;
|
||||||
bytes_for_rowids -= add;
|
bytes_for_rowids -= add;
|
||||||
DBUG_ASSERT(bytes_for_rowids >=
|
DBUG_ASSERT(bytes_for_rowids >= rowid_buf_elem_size + 1);
|
||||||
(h->ref_length + (int)is_mrr_assoc * sizeof(char*) + 1));
|
}
|
||||||
|
|
||||||
|
if (bytes_for_rowids < rowid_buf_elem_size + 1)
|
||||||
|
{
|
||||||
|
uint add= rowid_buf_elem_size + 1 - bytes_for_rowids;
|
||||||
|
bytes_for_rowids= rowid_buf_elem_size + 1;
|
||||||
|
bytes_for_keys -= add;
|
||||||
|
DBUG_ASSERT(bytes_for_keys >= key_buff_elem_size + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rowid_buffer_end= full_buf + bytes_for_rowids;
|
rowid_buffer_end= full_buf + bytes_for_rowids;
|
||||||
rowid_buffer.set_buffer_space(full_buf, rowid_buffer_end);
|
rowid_buffer.set_buffer_space(full_buf, rowid_buffer_end);
|
||||||
key_buffer= &backward_key_buf;
|
key_buffer= &backward_key_buf;
|
||||||
key_buffer->set_buffer_space(rowid_buffer_end, full_buf_end);
|
key_buffer->set_buffer_space(rowid_buffer_end, full_buf_end);
|
||||||
|
DBUG_ASSERT(key_buffer->have_space_for(key_buff_elem_size));
|
||||||
|
DBUG_ASSERT(rowid_buffer.have_space_for(rowid_buf_elem_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,7 +112,6 @@ public:
|
|||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
virtual uchar *end_of_space() = 0;
|
virtual uchar *end_of_space() = 0;
|
||||||
protected:
|
protected:
|
||||||
virtual bool have_space_for(size_t bytes) = 0;
|
|
||||||
virtual size_t used_size() = 0;
|
virtual size_t used_size() = 0;
|
||||||
|
|
||||||
/* To be used only by iterator class: */
|
/* To be used only by iterator class: */
|
||||||
@ -120,6 +119,8 @@ protected:
|
|||||||
virtual bool read(uchar **position)= 0;
|
virtual bool read(uchar **position)= 0;
|
||||||
friend class Lifo_buffer_iterator;
|
friend class Lifo_buffer_iterator;
|
||||||
public:
|
public:
|
||||||
|
virtual bool have_space_for(size_t bytes) = 0;
|
||||||
|
|
||||||
virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0;
|
virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0;
|
||||||
virtual uchar *used_area() = 0;
|
virtual uchar *used_area() = 0;
|
||||||
virtual ~Lifo_buffer() {};
|
virtual ~Lifo_buffer() {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user