From 413113dad68736d7411c71f8cb44bf88f0f2f5e1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 25 Mar 2014 22:41:18 +0100 Subject: [PATCH] move file->position() down, to make sure it's executed only when previous file->index_next (or other file->... index access method) succeeded --- sql/ha_partition.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 37c3b172bc4..ab4afc03fac 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -5765,12 +5765,6 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) error= file->ha_index_next_same(rec_buf, m_start_key.key, m_start_key.length); - if (!m_using_extended_keys) - { - file->position(rec_buf); - memcpy(rec_buf + m_rec_length, file->ref, file->ref_length); - } - if (error) { if (error == HA_ERR_END_OF_FILE) @@ -5788,6 +5782,13 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same) } DBUG_RETURN(error); } + + if (!m_using_extended_keys) + { + file->position(rec_buf); + memcpy(rec_buf + m_rec_length, file->ref, file->ref_length); + } + queue_replace_top(&m_queue); return_top_record(buf); DBUG_PRINT("info", ("Record returned from partition %u", m_top_entry));