Commit e72ed758 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove rpl_group_info::get_table_data()

use table->pos_in_table_list instead.

Also, table->in_use is always set
parent 8a8f71b8
......@@ -5059,8 +5059,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
set_flags(COMPLETE_ROWS_F);
Rpl_table_data rpl_data{};
rgi->get_table_data(table, &rpl_data);
Rpl_table_data rpl_data= *(RPL_TABLE_LIST*)table->pos_in_table_list;
/*
Set tables write and read sets.
......@@ -5127,10 +5126,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
THD_STAGE_INFO(thd, stage_executing);
do
{
/* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use;
if (!table->in_use)
table->in_use= thd;
DBUG_ASSERT(table->in_use);
error= do_exec_row(rgi);
......@@ -5138,8 +5134,6 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
table->in_use = old_thd;
if (unlikely(error))
{
int actual_error= convert_handler_error(error, thd, table);
......
......@@ -223,23 +223,13 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
// The "current" null bits
unsigned int null_bits= *null_ptr++;
uint i= 0;
Rpl_table_data rpl_data{};
bool table_found= rgi && rgi->get_table_data(table, &rpl_data);
Rpl_table_data rpl_data= *(RPL_TABLE_LIST*)table->pos_in_table_list;
const table_def *tabledef= rpl_data.tabledef;
const TABLE *conv_table= rpl_data.conv_table;
DBUG_PRINT("debug", ("Table data: table_found: %d, tabldef: %p, conv_table: %p",
table_found, tabledef, conv_table));
DBUG_ASSERT(table_found);
DBUG_PRINT("debug", ("Table data: tabldef: %p, conv_table: %p",
tabledef, conv_table));
DBUG_ASSERT(rgi);
/*
If rgi is NULL it means that there is no source table and that the
row shall just be unpacked without doing any checks. This feature
is used by MySQL Backup, but can be used for other purposes as
well.
*/
if (rgi && !table_found)
DBUG_RETURN(HA_ERR_GENERIC);
for (field_ptr= begin_ptr; field_ptr < end_ptr && *field_ptr; ++field_ptr)
{
......
......@@ -675,13 +675,12 @@ struct Rpl_table_data
TABLE *conv_table;
const Copy_field *copy_fields;
const Copy_field *copy_fields_end;
Rpl_table_data& operator =(const RPL_TABLE_LIST &rpl_table_list)
Rpl_table_data(const RPL_TABLE_LIST &rpl_table_list)
{
tabledef= &rpl_table_list.m_tabledef;
conv_table= rpl_table_list.m_conv_table;
copy_fields= rpl_table_list.m_online_alter_copy_fields;
copy_fields_end= rpl_table_list.m_online_alter_copy_fields_end;
return *this;
}
bool is_online_alter() const { return copy_fields != NULL; }
};
......@@ -958,25 +957,6 @@ struct rpl_group_info
}
}
bool get_table_data(const TABLE *table_arg, Rpl_table_data *table_data) const
{
DBUG_ASSERT(table_data);
for (TABLE_LIST *ptr= tables_to_lock ; ptr != NULL ; ptr= ptr->next_global)
if (ptr->table == table_arg)
{
auto *rpl_table_list= static_cast<RPL_TABLE_LIST*>(ptr);
DBUG_ASSERT(rpl_table_list->m_tabledef_valid);
*table_data= *rpl_table_list;
DBUG_PRINT("debug", ("Fetching table data for table %s.%s:"
" tabledef: %p, conv_table: %p",
table_arg->s->db.str, table_arg->s->table_name.str,
table_data->tabledef, table_data->conv_table));
return true;
}
return false;
}
void clear_tables_to_lock();
void cleanup_context(THD *, bool);
void slave_close_thread_tables(THD *);
......
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