Bug #28430 Failure in replication of innodb partitioned tables on row/mixed format.

In the ha_partition::position() we didn't calculate the number
of the partition of the record. We used m_last_part value instead,
relying on that it is set in other place like previous call of a method
like ::write_row(). In replication we don't call any of these befor
position(). Delete_rows_log_event::do_exec_row calls find_and_fetch_row.
In case of InnoDB-based PARTITION table, we have HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
enabled, so use position() / rnd_pos() calls to fetch the record.

Fixed by adding partition_id calculation to the ha_partition::position()
parent 3608dbdc
...@@ -631,7 +631,7 @@ flush status; ...@@ -631,7 +631,7 @@ flush status;
delete from t2 where b > 5; delete from t2 where b > 5;
show status like 'Handler_read_rnd_next'; show status like 'Handler_read_rnd_next';
Variable_name Value Variable_name Value
Handler_read_rnd_next 1215 Handler_read_rnd_next 1115
show status like 'Handler_read_key'; show status like 'Handler_read_key';
Variable_name Value Variable_name Value
Handler_read_key 0 Handler_read_key 0
...@@ -645,7 +645,7 @@ flush status; ...@@ -645,7 +645,7 @@ flush status;
delete from t2 where b < 5 or b > 3; delete from t2 where b < 5 or b > 3;
show status like 'Handler_read_rnd_next'; show status like 'Handler_read_rnd_next';
Variable_name Value Variable_name Value
Handler_read_rnd_next 1215 Handler_read_rnd_next 1115
show status like 'Handler_read_key'; show status like 'Handler_read_key';
Variable_name Value Variable_name Value
Handler_read_key 0 Handler_read_key 0
......
...@@ -3235,9 +3235,14 @@ end_dont_reset_start_part: ...@@ -3235,9 +3235,14 @@ end_dont_reset_start_part:
void ha_partition::position(const uchar *record) void ha_partition::position(const uchar *record)
{ {
handler *file= m_file[m_last_part]; handler *file;
DBUG_ENTER("ha_partition::position"); DBUG_ENTER("ha_partition::position");
if (unlikely(get_part_for_delete(record, m_rec0, m_part_info, &m_last_part)))
m_last_part= 0;
file= m_file[m_last_part];
file->position(record); file->position(record);
int2store(ref, m_last_part); int2store(ref, m_last_part);
memcpy((ref + PARTITION_BYTES_IN_POS), file->ref, memcpy((ref + PARTITION_BYTES_IN_POS), file->ref,
...@@ -5587,6 +5592,13 @@ int ha_partition::indexes_are_disabled(void) ...@@ -5587,6 +5592,13 @@ int ha_partition::indexes_are_disabled(void)
} }
void ha_partition::column_bitmaps_signal()
{
handler::column_bitmaps_signal();
bitmap_union(table->read_set, &m_part_info->full_part_field_set);
}
/**************************************************************************** /****************************************************************************
MODULE Partition Share MODULE Partition Share
****************************************************************************/ ****************************************************************************/
......
...@@ -449,6 +449,7 @@ private: ...@@ -449,6 +449,7 @@ private:
int handle_ordered_next(uchar * buf, bool next_same); int handle_ordered_next(uchar * buf, bool next_same);
int handle_ordered_prev(uchar * buf); int handle_ordered_prev(uchar * buf);
void return_top_record(uchar * buf); void return_top_record(uchar * buf);
void column_bitmaps_signal();
public: public:
/* /*
------------------------------------------------------------------------- -------------------------------------------------------------------------
......
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