Commit 4ab55835 authored by kostja@vajra.(none)'s avatar kostja@vajra.(none)

Fix events.test failure on manu pushbuild hosts (5.1-runtime).

parent b1b0d8d3
...@@ -310,17 +310,27 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, ...@@ -310,17 +310,27 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
DBUG_PRINT("info", ("Using prefix scanning on PK")); DBUG_PRINT("info", ("Using prefix scanning on PK"));
event_table->file->ha_index_init(0, 1); event_table->file->ha_index_init(0, 1);
event_table->field[ET_FIELD_DB]->store(db, strlen(db), scs);
key_info= event_table->key_info; key_info= event_table->key_info;
if (key_info->key_parts == 0 ||
key_info->key_part[0].field != event_table->field[ET_FIELD_DB])
{
/* Corrupted table: no index or index on a wrong column */
my_error(ER_CANNOT_LOAD_FROM_TABLE, MYF(0), "event");
ret= 1;
goto end;
}
event_table->field[ET_FIELD_DB]->store(db, strlen(db), scs);
key_len= key_info->key_part[0].store_length; key_len= key_info->key_part[0].store_length;
if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len))) if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len)))
{ {
ret= 1;
/* Don't send error, it would be done by sql_alloc_error_handler() */ /* Don't send error, it would be done by sql_alloc_error_handler() */
ret= 1;
goto end;
} }
else
{
key_copy(key_buf, event_table->record[0], key_info, key_len); key_copy(key_buf, event_table->record[0], key_info, key_len);
if (!(ret= event_table->file->index_read(event_table->record[0], key_buf, if (!(ret= event_table->file->index_read(event_table->record[0], key_buf,
(key_part_map)1, HA_READ_PREFIX))) (key_part_map)1, HA_READ_PREFIX)))
...@@ -335,13 +345,17 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, ...@@ -335,13 +345,17 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
} while (ret == 0); } while (ret == 0);
} }
DBUG_PRINT("info", ("Scan finished. ret=%d", ret)); DBUG_PRINT("info", ("Scan finished. ret=%d", ret));
}
event_table->file->ha_index_end();
/* ret is guaranteed to be != 0 */ /* ret is guaranteed to be != 0 */
if (ret == HA_ERR_END_OF_FILE || ret == HA_ERR_KEY_NOT_FOUND) if (ret == HA_ERR_END_OF_FILE || ret == HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(FALSE); ret= 0;
else
event_table->file->print_error(ret, MYF(0));
DBUG_RETURN(TRUE); end:
event_table->file->ha_index_end();
DBUG_RETURN(test(ret));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment