Commit 28e1f145 authored by Andrei Elkin's avatar Andrei Elkin

MDEV-15242 Poor RBR update performance with partitioned tables

Observed and described
partitioned engine execution time difference
between master and slave was caused by excessive invocation
of base_engine::rnd_init which was done also for partitions
uninvolved into Rows-event operation.
The bug's slave slowdown therefore scales with the number of partitions.

Fixed with applying an upstream patch.

References:
----------
https://bugs.mysql.com/bug.php?id=73648
Bug#25687813 REPLICATION REGRESSION WITH RBR AND PARTITIONED TABLES
parent 364a20fe
......@@ -5090,7 +5090,8 @@ int ha_partition::rnd_pos_by_record(uchar *record)
if (unlikely(get_part_for_delete(record, m_rec0, m_part_info, &m_last_part)))
DBUG_RETURN(1);
DBUG_RETURN(handler::rnd_pos_by_record(record));
int err= m_file[m_last_part]->rnd_pos_by_record(record);
DBUG_RETURN(err);
}
......
......@@ -3042,9 +3042,17 @@ class handler :public Sql_alloc
*/
virtual int rnd_pos_by_record(uchar *record)
{
int error;
DBUG_ASSERT(table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION);
error = ha_rnd_init(false);
if (error != 0)
return error;
position(record);
return rnd_pos(record, ref);
error = ha_rnd_pos(record, ref);
ha_rnd_end();
return error;
}
virtual int read_first_row(uchar *buf, uint primary_key);
public:
......
......@@ -12135,10 +12135,6 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
int error;
DBUG_PRINT("info",("locating record using primary key (position)"));
if (!table->file->inited &&
(error= table->file->ha_rnd_init_with_error(0)))
DBUG_RETURN(error);
error= table->file->ha_rnd_pos_by_record(table->record[0]);
if (error)
{
......
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