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:
@ -684,3 +684,12 @@ add column c int without system versioning,
|
|||||||
change column c c int,
|
change column c c int,
|
||||||
change column b b int without system versioning;
|
change column b b int without system versioning;
|
||||||
drop table t;
|
drop table t;
|
||||||
|
#
|
||||||
|
# MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table
|
||||||
|
#
|
||||||
|
create or replace table t1 (a int) with system versioning;
|
||||||
|
insert into t1 values (128);
|
||||||
|
delete from t1;
|
||||||
|
set statement system_versioning_alter_history=keep for
|
||||||
|
alter table t1 drop system versioning, modify column a tinyint;
|
||||||
|
drop table t1;
|
||||||
|
@ -580,3 +580,15 @@ alter table t
|
|||||||
change column b b int without system versioning;
|
change column b b int without system versioning;
|
||||||
|
|
||||||
drop table t;
|
drop table t;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-21688 Assertion or ER_WARN_DATA_OUT_OF_RANGE upon ALTER on previously versioned table
|
||||||
|
--echo #
|
||||||
|
create or replace table t1 (a int) with system versioning;
|
||||||
|
insert into t1 values (128);
|
||||||
|
delete from t1;
|
||||||
|
set statement system_versioning_alter_history=keep for
|
||||||
|
alter table t1 drop system versioning, modify column a tinyint;
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
drop table t1;
|
||||||
|
@ -10379,7 +10379,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
|||||||
bool make_versioned= !from->versioned() && to->versioned();
|
bool make_versioned= !from->versioned() && to->versioned();
|
||||||
bool make_unversioned= from->versioned() && !to->versioned();
|
bool make_unversioned= from->versioned() && !to->versioned();
|
||||||
bool keep_versioned= 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;
|
Field *to_row_start= NULL, *to_row_end= NULL, *from_row_end= NULL;
|
||||||
MYSQL_TIME query_start;
|
MYSQL_TIME query_start;
|
||||||
DBUG_ENTER("copy_data_between_tables");
|
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();
|
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);
|
THD_STAGE_INFO(thd, stage_copy_to_tmp_table);
|
||||||
/* Tell handler that we have values for all columns in the to 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;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (make_unversioned)
|
||||||
|
{
|
||||||
|
if (!from_row_end->is_max())
|
||||||
|
continue; // Drop history rows.
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(++thd->progress.counter >= time_to_report_progress))
|
if (unlikely(++thd->progress.counter >= time_to_report_progress))
|
||||||
{
|
{
|
||||||
time_to_report_progress+= MY_HOW_OFTEN_TO_WRITE/10;
|
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);
|
copy_ptr->do_copy(copy_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drop_history && from_row_end && !from_row_end->is_max())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (make_versioned)
|
if (make_versioned)
|
||||||
{
|
{
|
||||||
to_row_start->set_notnull();
|
to_row_start->set_notnull();
|
||||||
to_row_start->store_time(&query_start);
|
to_row_start->store_time(&query_start);
|
||||||
to_row_end->set_max();
|
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;
|
prev_insert_id= to->file->next_insert_id;
|
||||||
if (to->default_field)
|
if (to->default_field)
|
||||||
|
Reference in New Issue
Block a user