mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-11836 vcol.vcol_keys_myisam fails in buildbot and outside
move TABLE::key_read into handler. Because in index merge and DS-MRR there can be many handlers per table, and some of them use key read while others don't. "keyread" is really per handler, not per TABLE property.
This commit is contained in:
@ -11260,7 +11260,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
join_read_system :join_read_const;
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
table->set_keyread(true);
|
||||
table->file->ha_start_keyread();
|
||||
else if ((!jcl || jcl > 4) && !tab->ref.is_access_triggered())
|
||||
push_index_cond(tab, tab->ref.key);
|
||||
break;
|
||||
@ -11269,7 +11269,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
/* fall through */
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
table->set_keyread(true);
|
||||
table->file->ha_start_keyread();
|
||||
else if ((!jcl || jcl > 4) && !tab->ref.is_access_triggered())
|
||||
push_index_cond(tab, tab->ref.key);
|
||||
break;
|
||||
@ -11284,7 +11284,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
tab->quick=0;
|
||||
if (table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread)
|
||||
table->set_keyread(true);
|
||||
table->file->ha_start_keyread();
|
||||
else if ((!jcl || jcl > 4) && !tab->ref.is_access_triggered())
|
||||
push_index_cond(tab, tab->ref.key);
|
||||
break;
|
||||
@ -11347,7 +11347,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
if (tab->select && tab->select->quick &&
|
||||
tab->select->quick->index != MAX_KEY && //not index_merge
|
||||
table->covering_keys.is_set(tab->select->quick->index))
|
||||
table->set_keyread(true);
|
||||
table->file->ha_start_keyread();
|
||||
else if (!table->covering_keys.is_clear_all() &&
|
||||
!(tab->select && tab->select->quick))
|
||||
{ // Only read index tree
|
||||
@ -11376,7 +11376,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
||||
}
|
||||
}
|
||||
if (tab->select && tab->select->quick &&
|
||||
tab->select->quick->index != MAX_KEY && ! tab->table->key_read)
|
||||
tab->select->quick->index != MAX_KEY && !tab->table->file->key_read)
|
||||
push_index_cond(tab, tab->select->quick->index);
|
||||
}
|
||||
break;
|
||||
@ -11529,12 +11529,12 @@ void JOIN_TAB::cleanup()
|
||||
if (table &&
|
||||
(table->s->tmp_table != INTERNAL_TMP_TABLE || table->is_created()))
|
||||
{
|
||||
table->set_keyread(FALSE);
|
||||
table->file->ha_end_keyread();
|
||||
table->file->ha_index_or_rnd_end();
|
||||
}
|
||||
if (table)
|
||||
{
|
||||
table->set_keyread(false);
|
||||
table->file->ha_end_keyread();
|
||||
table->file->ha_index_or_rnd_end();
|
||||
preread_init_done= FALSE;
|
||||
if (table->pos_in_table_list &&
|
||||
@ -18825,15 +18825,15 @@ join_read_const_table(THD *thd, JOIN_TAB *tab, POSITION *pos)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!table->key_read && table->covering_keys.is_set(tab->ref.key) &&
|
||||
!table->no_keyread &&
|
||||
if (/*!table->file->key_read && */
|
||||
table->covering_keys.is_set(tab->ref.key) && !table->no_keyread &&
|
||||
(int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY)
|
||||
{
|
||||
table->set_keyread(true);
|
||||
table->file->ha_start_keyread();
|
||||
tab->index= tab->ref.key;
|
||||
}
|
||||
error=join_read_const(tab);
|
||||
table->set_keyread(false);
|
||||
table->file->ha_end_keyread();
|
||||
if (error)
|
||||
{
|
||||
tab->info= ET_UNIQUE_ROW_NOT_FOUND;
|
||||
@ -19348,9 +19348,8 @@ join_read_first(JOIN_TAB *tab)
|
||||
TABLE *table=tab->table;
|
||||
DBUG_ENTER("join_read_first");
|
||||
|
||||
if (table->covering_keys.is_set(tab->index) && !table->no_keyread &&
|
||||
!table->key_read)
|
||||
table->set_keyread(true);
|
||||
if (table->covering_keys.is_set(tab->index) && !table->no_keyread)
|
||||
table->file->ha_start_keyread();
|
||||
tab->table->status=0;
|
||||
tab->read_record.read_record=join_read_next;
|
||||
tab->read_record.table=table;
|
||||
@ -19388,9 +19387,8 @@ join_read_last(JOIN_TAB *tab)
|
||||
int error= 0;
|
||||
DBUG_ENTER("join_read_first");
|
||||
|
||||
if (table->covering_keys.is_set(tab->index) && !table->no_keyread &&
|
||||
!table->key_read)
|
||||
table->set_keyread(true);
|
||||
if (table->covering_keys.is_set(tab->index) && !table->no_keyread)
|
||||
table->file->ha_start_keyread();
|
||||
tab->table->status=0;
|
||||
tab->read_record.read_record=join_read_prev;
|
||||
tab->read_record.table=table;
|
||||
@ -21256,12 +21254,9 @@ check_reverse_order:
|
||||
and best_key doesn't, then revert the decision.
|
||||
*/
|
||||
if (!table->covering_keys.is_set(best_key))
|
||||
table->set_keyread(false);
|
||||
table->file->ha_end_keyread();
|
||||
else
|
||||
{
|
||||
if (!table->key_read)
|
||||
table->set_keyread(true);
|
||||
}
|
||||
table->file->ha_start_keyread();
|
||||
|
||||
if (!quick_created)
|
||||
{
|
||||
@ -21291,7 +21286,7 @@ check_reverse_order:
|
||||
tab->ref.key_parts= 0;
|
||||
if (select_limit < table->stat_records())
|
||||
tab->limit= select_limit;
|
||||
table->set_keyread(false);
|
||||
table->file->ha_end_keyread();
|
||||
}
|
||||
}
|
||||
else if (tab->type != JT_ALL || tab->select->quick)
|
||||
@ -21465,7 +21460,7 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
|
||||
and in index_merge 'Only index' cannot be used
|
||||
*/
|
||||
if (((uint) tab->ref.key != select->quick->index))
|
||||
table->set_keyread(FALSE);
|
||||
table->file->ha_end_keyread();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -21518,7 +21513,7 @@ create_sort_index(THD *thd, JOIN *join, JOIN_TAB *tab, Filesort *fsort)
|
||||
select->cleanup();
|
||||
}
|
||||
|
||||
table->set_keyread(FALSE); // Restore if we used indexes
|
||||
table->file->ha_end_keyread();
|
||||
if (tab->type == JT_FT)
|
||||
table->file->ft_end();
|
||||
else
|
||||
@ -24213,7 +24208,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
|
||||
}
|
||||
|
||||
/* Build "Extra" field and save it */
|
||||
key_read=table->key_read;
|
||||
key_read=table->file->key_read;
|
||||
if ((tab_type == JT_NEXT || tab_type == JT_CONST) &&
|
||||
table->covering_keys.is_set(index))
|
||||
key_read=1;
|
||||
|
Reference in New Issue
Block a user