Skip to content

Commit 28e1f14

Browse files
committed
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
1 parent 364a20f commit 28e1f14

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

sql/ha_partition.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5090,7 +5090,8 @@ int ha_partition::rnd_pos_by_record(uchar *record)
50905090
if (unlikely(get_part_for_delete(record, m_rec0, m_part_info, &m_last_part)))
50915091
DBUG_RETURN(1);
50925092

5093-
DBUG_RETURN(handler::rnd_pos_by_record(record));
5093+
int err= m_file[m_last_part]->rnd_pos_by_record(record);
5094+
DBUG_RETURN(err);
50945095
}
50955096

50965097

sql/handler.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3042,9 +3042,17 @@ class handler :public Sql_alloc
30423042
*/
30433043
virtual int rnd_pos_by_record(uchar *record)
30443044
{
3045+
int error;
30453046
DBUG_ASSERT(table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION);
3047+
3048+
error = ha_rnd_init(false);
3049+
if (error != 0)
3050+
return error;
3051+
30463052
position(record);
3047-
return rnd_pos(record, ref);
3053+
error = ha_rnd_pos(record, ref);
3054+
ha_rnd_end();
3055+
return error;
30483056
}
30493057
virtual int read_first_row(uchar *buf, uint primary_key);
30503058
public:

sql/log_event.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12135,10 +12135,6 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
1213512135
int error;
1213612136
DBUG_PRINT("info",("locating record using primary key (position)"));
1213712137

12138-
if (!table->file->inited &&
12139-
(error= table->file->ha_rnd_init_with_error(0)))
12140-
DBUG_RETURN(error);
12141-
1214212138
error= table->file->ha_rnd_pos_by_record(table->record[0]);
1214312139
if (error)
1214412140
{

0 commit comments

Comments
 (0)