diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2010-11-09 18:02:08 +0200 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2010-11-09 18:02:08 +0200 |
commit | 3d698ac61618f658e5a25219d3eb3b29b451db00 (patch) | |
tree | affc497d6401ffe9001e7596d821e098ea1e3b44 /sql | |
parent | 594a8648ef133705638ef909667157cb47ae0aee (diff) | |
download | mariadb-git-3d698ac61618f658e5a25219d3eb3b29b451db00.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/multi_range_read.cc | 15 | ||||
-rw-r--r-- | sql/sql_lifo_buffer.h | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 234a5fdaa2f..0caa5e55e51 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -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 */ key_buffer= &forward_key_buf; 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: */ 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) { uint add= key_buff_elem_size + 1 - bytes_for_keys; + bytes_for_keys= key_buff_elem_size + 1; bytes_for_rowids -= add; - DBUG_ASSERT(bytes_for_rowids >= - (h->ref_length + (int)is_mrr_assoc * sizeof(char*) + 1)); + DBUG_ASSERT(bytes_for_rowids >= rowid_buf_elem_size + 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.set_buffer_space(full_buf, rowid_buffer_end); key_buffer= &backward_key_buf; 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)); } diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h index 89b520484e4..8718177fc4f 100644 --- a/sql/sql_lifo_buffer.h +++ b/sql/sql_lifo_buffer.h @@ -112,7 +112,6 @@ public: virtual void reset() = 0; virtual uchar *end_of_space() = 0; protected: - virtual bool have_space_for(size_t bytes) = 0; virtual size_t used_size() = 0; /* To be used only by iterator class: */ @@ -120,6 +119,8 @@ protected: virtual bool read(uchar **position)= 0; friend class Lifo_buffer_iterator; public: + virtual bool have_space_for(size_t bytes) = 0; + virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0; virtual uchar *used_area() = 0; virtual ~Lifo_buffer() {}; |