mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-31776 Online ALTER reports the number of affected rows incorrectly
Add a new virtual function that will increase the inserted rows count for the insert log event and decrease it for the delete event. Reuses Rows_log_event::m_row_count on the replication side, which was only set on the logging side.
This commit is contained in:
committed by
Sergei Golubchik
parent
9c8554259a
commit
e026a366bf
@ -11656,7 +11656,8 @@ public:
|
||||
|
||||
|
||||
static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
|
||||
Cache_flip_event_log *log)
|
||||
Cache_flip_event_log *log,
|
||||
ha_rows *found_rows)
|
||||
{
|
||||
int error= 0;
|
||||
|
||||
@ -11681,8 +11682,11 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
|
||||
|
||||
ev->thd= thd;
|
||||
error= ev->apply_event(rgi);
|
||||
if (thd->is_error())
|
||||
error= 1;
|
||||
|
||||
error= error || thd->is_error();
|
||||
if(likely(!error))
|
||||
ev->online_alter_update_row_count(found_rows);
|
||||
|
||||
if (ev != rgi->rli->relay_log.description_event_for_exec)
|
||||
delete ev;
|
||||
thd_progress_report(thd, my_b_tell(log_file), thd->progress.max_counter);
|
||||
@ -12108,7 +12112,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
mysql_unlock_tables(thd, thd->lock);
|
||||
thd->lock= NULL;
|
||||
|
||||
error= online_alter_read_from_binlog(thd, &rgi, binlog);
|
||||
error= online_alter_read_from_binlog(thd, &rgi, binlog, &found_count);
|
||||
if (start_alter_id)
|
||||
{
|
||||
DBUG_ASSERT(thd->slave_thread);
|
||||
@ -12129,7 +12133,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
if (!error)
|
||||
{
|
||||
thd_progress_next_stage(thd);
|
||||
error= online_alter_read_from_binlog(thd, &rgi, binlog);
|
||||
error= online_alter_read_from_binlog(thd, &rgi, binlog, &found_count);
|
||||
}
|
||||
if (error)
|
||||
from->s->tdc->flush_unused(1); // to free the binlog
|
||||
|
Reference in New Issue
Block a user