1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table

Earlier skip of history row. Cleanup of dead code for VTMD.
This commit is contained in:
Aleksey Midenkov
2020-04-02 20:48:38 +03:00
parent 44c6c7a923
commit ba34f409ad
3 changed files with 28 additions and 13 deletions

View File

@ -10379,7 +10379,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
bool make_versioned= !from->versioned() && to->versioned();
bool make_unversioned= from->versioned() && !to->versioned();
bool keep_versioned= from->versioned() && to->versioned();
bool drop_history= false; // XXX
Field *to_row_start= NULL, *to_row_end= NULL, *from_row_end= NULL;
MYSQL_TIME query_start;
DBUG_ENTER("copy_data_between_tables");
@ -10507,10 +10506,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
{
from_row_end= from->vers_end_field();
}
else if (keep_versioned && drop_history)
{
from_row_end= from->vers_end_field();
}
THD_STAGE_INFO(thd, stage_copy_to_tmp_table);
/* Tell handler that we have values for all columns in the to table */
@ -10542,6 +10537,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
error= 1;
break;
}
if (make_unversioned)
{
if (!from_row_end->is_max())
continue; // Drop history rows.
}
if (unlikely(++thd->progress.counter >= time_to_report_progress))
{
time_to_report_progress+= MY_HOW_OFTEN_TO_WRITE/10;
@ -10561,20 +10563,12 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
copy_ptr->do_copy(copy_ptr);
}
if (drop_history && from_row_end && !from_row_end->is_max())
continue;
if (make_versioned)
{
to_row_start->set_notnull();
to_row_start->store_time(&query_start);
to_row_end->set_max();
}
else if (make_unversioned)
{
if (!from_row_end->is_max())
continue; // Drop history rows.
}
prev_insert_id= to->file->next_insert_id;
if (to->default_field)