1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix for bug #54007: assert in ha_myisam::index_next, HANDLER

Problem: the server missed the fact that one can read from 
2 indexes alternately using HANDLER interface.

Fix: check if the same (initialized) index is involved
reading next/prev values from the index.


mysql-test/r/handler_myisam.result:
  Fix for bug #54007: assert in ha_myisam::index_next, HANDLER
    - test result.
mysql-test/t/handler_myisam.test:
  Fix for bug #54007: assert in ha_myisam::index_next, HANDLER
    - test case.
sql/sql_handler.cc:
  Fix for bug #54007: assert in ha_myisam::index_next, HANDLER
    - check if we use the same (initialized) index 
  to read next/prev values from the index.
This commit is contained in:
Ramil Kalimullin
2010-06-09 14:45:04 +04:00
parent 04f4786c08
commit f4b7c50d6e
3 changed files with 162 additions and 3 deletions

View File

@ -539,6 +539,14 @@ retry:
my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
goto err;
}
/* Check if the same index involved. */
if ((uint) keyno != table->file->get_index())
{
if (mode == RNEXT)
mode= RFIRST;
else if (mode == RPREV)
mode= RLAST;
}
}
if (insert_fields(thd, &thd->lex->select_lex.context,
@ -561,9 +569,16 @@ retry:
case RNEXT:
if (table->file->inited != handler::NONE)
{
error=keyname ?
table->file->index_next(table->record[0]) :
table->file->rnd_next(table->record[0]);
if (keyname)
{
/* Check if we read from the same index. */
DBUG_ASSERT((uint) keyno == table->file->get_index());
error= table->file->index_next(table->record[0]);
}
else
{
error= table->file->rnd_next(table->record[0]);
}
break;
}
/* else fall through */
@ -584,6 +599,8 @@ retry:
break;
case RPREV:
DBUG_ASSERT(keyname != 0);
/* Check if we read from the same index. */
DBUG_ASSERT((uint) keyno == table->file->get_index());
if (table->file->inited != handler::NONE)
{
error=table->file->index_prev(table->record[0]);