diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-11-07 16:51:35 +0100 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2023-04-18 00:29:51 +0300 |
commit | 94def18dee62458186bdd1849920901a97eed276 (patch) | |
tree | 3f43a3ca6b3a8afcfe02037cec5d2e9bb0beef7a | |
parent | 2b13104c60641e23768f00f1ac78498c2fe7810a (diff) | |
download | mariadb-git-94def18dee62458186bdd1849920901a97eed276.tar.gz |
cleanup: remove rpl_group_info::get_table_data()
use table->pos_in_table_list instead.
Also, table->in_use is always set
-rw-r--r-- | sql/log_event_server.cc | 10 | ||||
-rw-r--r-- | sql/rpl_record.cc | 16 | ||||
-rw-r--r-- | sql/rpl_rli.h | 22 |
3 files changed, 6 insertions, 42 deletions
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index f3b2082eca3..3bdc487bbcd 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -5012,8 +5012,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. @@ -5080,10 +5079,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); @@ -5091,8 +5087,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); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index da05fc31078..6440fb0eecb 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -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) { diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 1de082daaf0..06e2379df80 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -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 *); |