mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 01:34:17 +01:00
cleanup: read_set/write_set are based on metadata
they should be set once, not for every row
This commit is contained in:
parent
bf62d8e7e7
commit
adcbf015c9
2 changed files with 14 additions and 14 deletions
|
@ -6047,6 +6047,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
|
|||
&m_cols_ai : &m_cols);
|
||||
bitmap_intersect(table->write_set, after_image);
|
||||
|
||||
if (table->versioned())
|
||||
{
|
||||
bitmap_set_bit(table->write_set, table->s->vers.start_fieldno);
|
||||
bitmap_set_bit(table->write_set, table->s->vers.end_fieldno);
|
||||
}
|
||||
|
||||
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
|
||||
|
||||
// Do event specific preparations
|
||||
|
@ -7681,8 +7687,6 @@ Rows_log_event::write_row(rpl_group_info *rgi,
|
|||
if (table->versioned(VERS_TIMESTAMP))
|
||||
{
|
||||
ulong sec_part;
|
||||
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
|
||||
table->file->column_bitmaps_signal();
|
||||
// Check whether a row came from unversioned table and fix vers fields.
|
||||
if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
|
||||
table->vers_update_fields();
|
||||
|
@ -8207,18 +8211,15 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
|
|||
{
|
||||
Field *row_end= table->vers_end_field();
|
||||
DBUG_ASSERT(table->read_set);
|
||||
bitmap_set_bit(table->read_set, row_end->field_index);
|
||||
// check whether master table is unversioned
|
||||
if (row_end->val_int() == 0)
|
||||
{
|
||||
bitmap_set_bit(table->write_set, row_end->field_index);
|
||||
// Plain source table may have a PRIMARY KEY. And row_end is always
|
||||
// a part of PRIMARY KEY. Set it to max value for engine to find it in
|
||||
// index. Needed for an UPDATE/DELETE cases.
|
||||
table->vers_end_field()->set_max();
|
||||
m_vers_from_plain= true;
|
||||
}
|
||||
table->file->column_bitmaps_signal();
|
||||
}
|
||||
|
||||
DBUG_PRINT("info",("looking for the following record"));
|
||||
|
@ -8578,7 +8579,6 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi)
|
|||
if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
|
||||
{
|
||||
Field *end= m_table->vers_end_field();
|
||||
bitmap_set_bit(m_table->write_set, end->field_index);
|
||||
store_record(m_table, record[1]);
|
||||
end->set_time();
|
||||
error= m_table->file->ha_update_row(m_table->record[1],
|
||||
|
|
16
sql/table.cc
16
sql/table.cc
|
@ -7614,6 +7614,8 @@ void TABLE::mark_columns_needed_for_update()
|
|||
}
|
||||
if (s->versioned)
|
||||
{
|
||||
bitmap_set_bit(write_set, s->vers.start_fieldno);
|
||||
bitmap_set_bit(write_set, s->vers.end_fieldno);
|
||||
/*
|
||||
For System Versioning we have to read all columns since we store
|
||||
a copy of previous row with modified row_end back to a table.
|
||||
|
@ -7671,6 +7673,12 @@ void TABLE::mark_columns_needed_for_insert()
|
|||
mark_auto_increment_column();
|
||||
if (default_field)
|
||||
mark_default_fields_for_write(TRUE);
|
||||
if (s->versioned)
|
||||
{
|
||||
bitmap_set_bit(write_set, s->vers.start_fieldno);
|
||||
bitmap_set_bit(write_set, s->vers.end_fieldno);
|
||||
bitmap_set_bit(read_set, s->vers.end_fieldno);
|
||||
}
|
||||
/* Mark virtual columns for insert */
|
||||
if (vfield)
|
||||
mark_virtual_columns_for_write(TRUE);
|
||||
|
@ -9148,29 +9156,21 @@ bool TABLE::check_period_overlaps(const KEY &key,
|
|||
void TABLE::vers_update_fields()
|
||||
{
|
||||
if (!vers_write)
|
||||
{
|
||||
file->column_bitmaps_signal();
|
||||
return;
|
||||
}
|
||||
|
||||
if (versioned(VERS_TIMESTAMP))
|
||||
{
|
||||
bitmap_set_bit(write_set, vers_start_field()->field_index);
|
||||
if (vers_start_field()->store_timestamp(in_use->query_start(),
|
||||
in_use->query_start_sec_part()))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
vers_start_field()->set_has_explicit_value();
|
||||
bitmap_set_bit(read_set, vers_start_field()->field_index);
|
||||
}
|
||||
|
||||
bitmap_set_bit(write_set, vers_end_field()->field_index);
|
||||
vers_end_field()->set_max();
|
||||
vers_end_field()->set_has_explicit_value();
|
||||
bitmap_set_bit(read_set, vers_end_field()->field_index);
|
||||
|
||||
file->column_bitmaps_signal();
|
||||
if (vfield)
|
||||
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue