Skip to content

Commit aa61f56

Browse files
AliSQLAliSQL
authored andcommitted
[bugfix] Issue: #64 replication regression with RBR and partition tables
This patch is ported from MySQL upstream (commit id: 9414c7). Bug#25687813 REPLICATION REGRESSION WITH RBR AND PARTITIONED TABLES PROBLEM ------- While applying update the slave is trying to initialize all partitions before reading from rnd_pos() call. This is done for each row update because of which the performance is getting effected. FIX --- Initialize only the partition on which rnd_pos() is called.
1 parent 4ec960a commit aa61f56

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

sql/ha_partition.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4981,14 +4981,11 @@ int ha_partition::rnd_pos(uchar * buf, uchar *pos)
49814981
int ha_partition::rnd_pos_by_record(uchar *record)
49824982
{
49834983
DBUG_ENTER("ha_partition::rnd_pos_by_record");
4984-
49854984
if (unlikely(get_part_for_delete(record, m_rec0, m_part_info, &m_last_part)))
49864985
DBUG_RETURN(1);
4987-
4988-
DBUG_RETURN(handler::rnd_pos_by_record(record));
4986+
DBUG_RETURN(m_file[m_last_part]->rnd_pos_by_record(record));
49894987
}
49904988

4991-
49924989
/****************************************************************************
49934990
MODULE index scan
49944991
****************************************************************************/

sql/handler.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,10 +2457,19 @@ class handler :public Sql_alloc
24572457
*/
24582458
virtual int rnd_pos_by_record(uchar *record)
24592459
{
2460+
int error;
24602461
DBUG_ASSERT(table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION);
2462+
2463+
error = ha_rnd_init(false);
2464+
if (error != 0)
2465+
return error;
2466+
24612467
position(record);
2462-
return ha_rnd_pos(record, ref);
2468+
error = ha_rnd_pos(record, ref);
2469+
ha_rnd_end();
2470+
return error;
24632471
}
2472+
24642473
virtual int read_first_row(uchar *buf, uint primary_key);
24652474
/**
24662475
The following function is only needed for tables that may be temporary

sql/log_event.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10655,12 +10655,7 @@ int Rows_log_event::do_index_scan_and_update(Relay_log_info const *rli)
1065510655
if (m_table->file->inited && (error= m_table->file->ha_index_end()))
1065610656
goto end;
1065710657

10658-
if ((error= m_table->file->ha_rnd_init(FALSE)))
10659-
goto end;
10660-
1066110658
error= m_table->file->rnd_pos_by_record(m_table->record[0]);
10662-
10663-
m_table->file->ha_rnd_end();
1066410659
if (error)
1066510660
{
1066610661
DBUG_PRINT("info",("rnd_pos returns error %d",error));

0 commit comments

Comments
 (0)