summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2018-12-20 09:52:34 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2019-04-25 18:02:31 +0200
commit4e01bc8c963d9513625dd984cd1aca24b8a7b516 (patch)
tree9814be2b0ce45c9833328b63cf403d76d1e24c50 /sql/handler.cc
parent3dffdee667666df9ade9f2c458bf1ea495ffba02 (diff)
downloadmariadb-git-4e01bc8c963d9513625dd984cd1aca24b8a7b516.tar.gz
MDEV-16240: Assertion `0' failed in row_sel_convert_mysql_key_to_innobasebb-10.2-MDEV-16240
Set table in row ID position mode before using this function.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index ad1bad59efa..e5b452f9649 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2649,8 +2649,7 @@ int handler::ha_rnd_pos(uchar *buf, uchar *pos)
DBUG_ENTER("handler::ha_rnd_pos");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
- /* TODO: Find out how to solve ha_rnd_pos when finding duplicate update. */
- /* DBUG_ASSERT(inited == RND); */
+ DBUG_ASSERT(inited == RND);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0,
{ result= rnd_pos(buf, pos); })
@@ -3308,6 +3307,10 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nr;
int error;
MY_BITMAP *old_read_set;
+ bool rnd_inited= (inited == RND);
+
+ if (rnd_inited && ha_rnd_end())
+ return;
old_read_set= table->prepare_for_keyread(table->s->next_number_index);
@@ -3317,6 +3320,10 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
DBUG_ASSERT(0);
(void) extra(HA_EXTRA_NO_KEYREAD);
*first_value= ULONGLONG_MAX;
+ if (rnd_inited && ha_rnd_init_with_error(0))
+ {
+ //TODO: it would be nice to return here an error
+ }
return;
}
@@ -3363,6 +3370,10 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
ha_index_end();
table->restore_column_maps_after_keyread(old_read_set);
*first_value= nr;
+ if (rnd_inited && ha_rnd_init_with_error(0))
+ {
+ //TODO: it would be nice to return here an error
+ }
return;
}