diff options
author | Andrei Elkin <andrei.elkin@mariadb.com> | 2018-06-19 18:14:47 +0300 |
---|---|---|
committer | Andrei Elkin <andrei.elkin@mariadb.com> | 2018-06-25 16:45:00 +0300 |
commit | 28e1f1453f12b8b748c31a86a22b336f62002654 (patch) | |
tree | 5f985c1e86323bbdef4ad3485bc8f55119f4876a | |
parent | 364a20fe0b072fb1d2a9b54a8c4e47a5012f3e97 (diff) | |
download | mariadb-git-28e1f1453f12b8b748c31a86a22b336f62002654.tar.gz |
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
-rw-r--r-- | sql/ha_partition.cc | 3 | ||||
-rw-r--r-- | sql/handler.h | 10 | ||||
-rw-r--r-- | 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 @@ private: */ 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) { |