mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Online alter: set read_set early, before row reads
also * don't modify write_set * backup/restore rpl_write_set
This commit is contained in:
@@ -7272,14 +7272,17 @@ static int binlog_log_row_online_alter(TABLE* table,
|
|||||||
trans_register_ha(thd, true, binlog_hton, 0);
|
trans_register_ha(thd, true, binlog_hton, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to log all columns for the case if alter table changes primary key.
|
// We need to log all columns for the case if alter table changes primary key
|
||||||
table->use_all_columns();
|
DBUG_ASSERT(!before_record || bitmap_is_set_all(table->read_set));
|
||||||
bitmap_set_all(table->rpl_write_set);
|
MY_BITMAP *old_rpl_write_set= table->rpl_write_set;
|
||||||
|
table->rpl_write_set= &table->s->all_set;
|
||||||
|
|
||||||
int error= (*log_func)(thd, table, table->s->online_alter_binlog,
|
int error= (*log_func)(thd, table, table->s->online_alter_binlog,
|
||||||
table->online_alter_cache, has_trans,
|
table->online_alter_cache, has_trans,
|
||||||
before_record, after_record);
|
before_record, after_record);
|
||||||
|
|
||||||
|
table->rpl_write_set= old_rpl_write_set;
|
||||||
|
|
||||||
return unlikely(error) ? HA_ERR_RBR_LOGGING_FAILED : 0;
|
return unlikely(error) ? HA_ERR_RBR_LOGGING_FAILED : 0;
|
||||||
}
|
}
|
||||||
#endif // HAVE_REPLICATION
|
#endif // HAVE_REPLICATION
|
||||||
|
24
sql/table.cc
24
sql/table.cc
@@ -7681,6 +7681,17 @@ void TABLE::mark_columns_needed_for_delete()
|
|||||||
bitmap_set_bit(write_set, s->vers.end_fieldno);
|
bitmap_set_bit(write_set, s->vers.end_fieldno);
|
||||||
need_signal= true;
|
need_signal= true;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_REPLICATION
|
||||||
|
if (s->online_alter_binlog)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
For online alter we have to read all columns, because we need PK columns
|
||||||
|
in the row event, and we don't know what columns will be in PK after ALTER
|
||||||
|
*/
|
||||||
|
bitmap_set_all(read_set);
|
||||||
|
need_signal= true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (need_signal)
|
if (need_signal)
|
||||||
file->column_bitmaps_signal();
|
file->column_bitmaps_signal();
|
||||||
@@ -7767,9 +7778,20 @@ void TABLE::mark_columns_needed_for_update()
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
bitmap_union(read_set, &s->all_set);
|
bitmap_set_all(read_set);
|
||||||
need_signal= true;
|
need_signal= true;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_REPLICATION
|
||||||
|
if (s->online_alter_binlog)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
For online alter we have to read all columns, because we need PK columns
|
||||||
|
in the row event, and we don't know what columns will be in PK after ALTER
|
||||||
|
*/
|
||||||
|
bitmap_set_all(read_set);
|
||||||
|
need_signal= true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (check_constraints)
|
if (check_constraints)
|
||||||
{
|
{
|
||||||
mark_check_constraint_columns_for_read();
|
mark_check_constraint_columns_for_read();
|
||||||
|
Reference in New Issue
Block a user