Commit 0fe67f2e authored by Eugene Kosov's avatar Eugene Kosov

MDEV-14744 Assertion `table->versioned() == m_prebuilt->table->versioned()'...

MDEV-14744 Assertion `table->versioned() == m_prebuilt->table->versioned()' failed in ha_innobase::open
parent 04451f0f
......@@ -432,5 +432,16 @@ alter table t change column if exists b c bigint unsigned generated always as ro
ERROR HY000: This is not yet supported for generated columns
alter table t change column if exists b c bigint unsigned generated always as row end;
ERROR HY000: This is not yet supported for generated columns
drop table t;
# MDEV-14744 trx_id-based and transaction-based mixup in assertion
create or replace table t (c text) engine=innodb with system versioning;
show create table t;
Table Create Table
t CREATE TABLE `t` (
`c` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t add fulltext key (c);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
drop database test;
create database test;
......@@ -6,6 +6,9 @@ id int unique key
) engine innodb;
create table child(
parent_id int,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete restrict
on update restrict
......@@ -36,6 +39,9 @@ id int(10) unsigned unique key
) engine innodb;
create table child(
parent_id int(10) unsigned primary key,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
) engine innodb with system versioning;
insert into parent values(1);
......@@ -52,6 +58,9 @@ id int unique key
) engine innodb;
create table child(
parent_id int,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete cascade
on update cascade
......@@ -83,7 +92,10 @@ parent_id
drop table child;
drop table parent;
create or replace table parent (
id int primary key
id int primary key,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end)
) with system versioning
engine innodb;
create or replace table child (
......@@ -136,6 +148,9 @@ id int unique key
) engine innodb;
create table child(
parent_id int,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete set null
on update set null
......@@ -163,7 +178,10 @@ drop table parent;
# Parent table is foreign #
###########################
create or replace table parent(
id int unique key
id int unique key,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end)
) engine innodb with system versioning;
create or replace table child(
parent_id int,
......@@ -192,12 +210,18 @@ drop table parent;
###################
create or replace table a (
cola int(10) primary key,
v_cola int(10) as (cola mod 10) virtual
v_cola int(10) as (cola mod 10) virtual,
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end)
) engine=innodb with system versioning;
create index v_cola on a (v_cola);
create or replace table b(
cola int(10),
v_cola int(10)
v_cola int(10),
sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end)
) engine=innodb with system versioning;
alter table b add constraint `v_cola_fk`
foreign key (v_cola) references a (v_cola);
......
......@@ -368,6 +368,12 @@ create or replace temporary table t (a int);
alter table t change column if exists b c bigint unsigned generated always as row start;
--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
alter table t change column if exists b c bigint unsigned generated always as row end;
drop table t;
--echo # MDEV-14744 trx_id-based and transaction-based mixup in assertion
create or replace table t (c text) engine=innodb with system versioning;
show create table t;
alter table t add fulltext key (c);
drop database test;
......
[timestamp]
default-storage-engine=innodb
[trx_id]
default-storage-engine=innodb
-- source include/have_innodb.inc
--source suite/versioning/common.inc
--echo #################
--echo # Test RESTRICT #
......@@ -8,8 +8,12 @@ create table parent(
id int unique key
) engine innodb;
create table child(
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table child(
parent_id int,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete restrict
on update restrict
......@@ -42,8 +46,12 @@ create table parent(
id int(10) unsigned unique key
) engine innodb;
create table child(
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table child(
parent_id int(10) unsigned primary key,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
) engine innodb with system versioning;
......@@ -64,8 +72,12 @@ create table parent(
id int unique key
) engine innodb;
create table child(
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table child(
parent_id int,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete cascade
on update cascade
......@@ -93,8 +105,12 @@ select * from child for system_time all;
drop table child;
drop table parent;
create or replace table parent (
id int primary key
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table parent (
id int primary key,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end)
) with system versioning
engine innodb;
......@@ -151,8 +167,12 @@ create table parent(
id int unique key
) engine innodb;
create table child(
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table child(
parent_id int,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end),
foreign key(parent_id) references parent(id)
on delete set null
on update set null
......@@ -189,8 +209,12 @@ drop table parent;
--echo # Parent table is foreign #
--echo ###########################
create or replace table parent(
id int unique key
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table parent(
id int unique key,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end)
) engine innodb with system versioning;
create or replace table child(
......@@ -225,16 +249,24 @@ drop table parent;
--echo # crash on DELETE #
--echo ###################
create or replace table a (
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table a (
cola int(10) primary key,
v_cola int(10) as (cola mod 10) virtual
v_cola int(10) as (cola mod 10) virtual,
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end)
) engine=innodb with system versioning;
create index v_cola on a (v_cola);
create or replace table b(
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table b(
cola int(10),
v_cola int(10)
v_cola int(10),
sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end)
) engine=innodb with system versioning;
alter table b add constraint `v_cola_fk`
......@@ -246,3 +278,5 @@ insert into b(cola, v_cola) values (10,2);
delete from a;
drop table b, a;
--source suite/versioning/common_finish.inc
......@@ -3584,6 +3584,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
*/
if (sql_field->stored_in_db())
record_offset+= sql_field->pack_length;
if (sql_field->flags & VERS_SYSTEM_FIELD)
continue;
if (sql_field->invisible == INVISIBLE_USER &&
sql_field->flags & NOT_NULL_FLAG &&
sql_field->flags & NO_DEFAULT_VALUE_FLAG)
......
......@@ -4995,7 +4995,7 @@ prepare_inplace_alter_table_dict(
field_type |= DATA_UNSIGNED;
}
if (altered_table->versioned(VERS_TRX_ID)) {
if (altered_table->versioned()) {
if (i == altered_table->s->row_start_field) {
field_type |= DATA_VERS_START;
} else if (i ==
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment