[Commits] 37b432c1d59: MDEV-15242 Poor RBR update performance with partitioned tables
revision-id: 37b432c1d59e66b742f97a280cae7784d85e62ec (mariadb-10.0.35-41-g37b432c1d59) parent(s): d2e1ed8b936a78ceeec0e64231997d7ed18a4daf author: Andrei Elkin committer: Andrei Elkin timestamp: 2018-06-19 18:14:47 +0300 message: 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 --- sql/ha_partition.cc | 3 ++- sql/handler.h | 10 +++++++++- sql/log_event.cc | 4 ---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 6a6627f9276..0488ebfb60f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -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); } diff --git a/sql/handler.h b/sql/handler.h index 74d50536ec4..52396b84c0d 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -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: diff --git a/sql/log_event.cc b/sql/log_event.cc index 7989db9c687..3638269cbf5 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -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) {
participants (1)
-
andrei.elkin@pp.inet.fi