mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
cleanup: read_set/write_set are based on metadata
they should be set once, not for every row
This commit is contained in:
@@ -6047,6 +6047,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
|
|||||||
&m_cols_ai : &m_cols);
|
&m_cols_ai : &m_cols);
|
||||||
bitmap_intersect(table->write_set, after_image);
|
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
|
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
|
||||||
|
|
||||||
// Do event specific preparations
|
// Do event specific preparations
|
||||||
@@ -7681,8 +7687,6 @@ Rows_log_event::write_row(rpl_group_info *rgi,
|
|||||||
if (table->versioned(VERS_TIMESTAMP))
|
if (table->versioned(VERS_TIMESTAMP))
|
||||||
{
|
{
|
||||||
ulong sec_part;
|
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.
|
// 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)
|
if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
|
||||||
table->vers_update_fields();
|
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();
|
Field *row_end= table->vers_end_field();
|
||||||
DBUG_ASSERT(table->read_set);
|
DBUG_ASSERT(table->read_set);
|
||||||
bitmap_set_bit(table->read_set, row_end->field_index);
|
|
||||||
// check whether master table is unversioned
|
// check whether master table is unversioned
|
||||||
if (row_end->val_int() == 0)
|
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
|
// 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
|
// a part of PRIMARY KEY. Set it to max value for engine to find it in
|
||||||
// index. Needed for an UPDATE/DELETE cases.
|
// index. Needed for an UPDATE/DELETE cases.
|
||||||
table->vers_end_field()->set_max();
|
table->vers_end_field()->set_max();
|
||||||
m_vers_from_plain= true;
|
m_vers_from_plain= true;
|
||||||
}
|
}
|
||||||
table->file->column_bitmaps_signal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_PRINT("info",("looking for the following record"));
|
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))
|
if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
|
||||||
{
|
{
|
||||||
Field *end= m_table->vers_end_field();
|
Field *end= m_table->vers_end_field();
|
||||||
bitmap_set_bit(m_table->write_set, end->field_index);
|
|
||||||
store_record(m_table, record[1]);
|
store_record(m_table, record[1]);
|
||||||
end->set_time();
|
end->set_time();
|
||||||
error= m_table->file->ha_update_row(m_table->record[1],
|
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)
|
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
|
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.
|
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();
|
mark_auto_increment_column();
|
||||||
if (default_field)
|
if (default_field)
|
||||||
mark_default_fields_for_write(TRUE);
|
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 */
|
/* Mark virtual columns for insert */
|
||||||
if (vfield)
|
if (vfield)
|
||||||
mark_virtual_columns_for_write(TRUE);
|
mark_virtual_columns_for_write(TRUE);
|
||||||
@@ -9148,29 +9156,21 @@ bool TABLE::check_period_overlaps(const KEY &key,
|
|||||||
void TABLE::vers_update_fields()
|
void TABLE::vers_update_fields()
|
||||||
{
|
{
|
||||||
if (!vers_write)
|
if (!vers_write)
|
||||||
{
|
|
||||||
file->column_bitmaps_signal();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (versioned(VERS_TIMESTAMP))
|
if (versioned(VERS_TIMESTAMP))
|
||||||
{
|
{
|
||||||
bitmap_set_bit(write_set, vers_start_field()->field_index);
|
|
||||||
if (vers_start_field()->store_timestamp(in_use->query_start(),
|
if (vers_start_field()->store_timestamp(in_use->query_start(),
|
||||||
in_use->query_start_sec_part()))
|
in_use->query_start_sec_part()))
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
}
|
}
|
||||||
vers_start_field()->set_has_explicit_value();
|
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_max();
|
||||||
vers_end_field()->set_has_explicit_value();
|
vers_end_field()->set_has_explicit_value();
|
||||||
bitmap_set_bit(read_set, vers_end_field()->field_index);
|
|
||||||
|
|
||||||
file->column_bitmaps_signal();
|
|
||||||
if (vfield)
|
if (vfield)
|
||||||
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
|
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user