Commit 27187443 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14650 Assertion 0 failed in TABLE::vers_update_fields [fixes #402]

SQL: fixed selecion of handlerton by respecting partitioning
parent ab5ec0f3
...@@ -31,6 +31,16 @@ begin ...@@ -31,6 +31,16 @@ begin
return e; return e;
end~~ end~~
create function if not exists non_default_engine()
returns varchar(255)
deterministic
begin
if default_engine() = 'InnoDB' then
return 'MyISAM';
end if;
return 'InnoDB';
end~~
create function if not exists sys_datatype(engine varchar(255)) create function if not exists sys_datatype(engine varchar(255))
returns varchar(255) returns varchar(255)
deterministic deterministic
...@@ -99,6 +109,7 @@ end~~ ...@@ -99,6 +109,7 @@ end~~
delimiter ;~~ delimiter ;~~
let $default_engine= `select default_engine()`; let $default_engine= `select default_engine()`;
let $non_default_engine= `select non_default_engine()`;
let $sys_datatype= `select sys_datatype(default_engine())`; let $sys_datatype= `select sys_datatype(default_engine())`;
let $sys_datatype_uc= `select upper(sys_datatype(default_engine()))`; let $sys_datatype_uc= `select upper(sys_datatype(default_engine()))`;
--enable_query_log --enable_query_log
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
drop procedure verify_vtq; drop procedure verify_vtq;
drop procedure innodb_verify_vtq; drop procedure innodb_verify_vtq;
drop function default_engine; drop function default_engine;
drop function non_default_engine;
drop function sys_commit_ts; drop function sys_commit_ts;
drop function sys_datatype; drop function sys_datatype;
drop function current_row; drop function current_row;
......
drop table if exists t1; drop table if exists t1;
create function if not exists non_default_engine()
returns varchar(255)
deterministic
begin
if default_engine() = 'InnoDB' then
return 'MyISAM';
end if;
return 'InnoDB';
end~~
create table t1 ( create table t1 (
x1 int unsigned, x1 int unsigned,
Sys_start SYS_DATATYPE generated always as row start comment 'start', Sys_start SYS_DATATYPE generated always as row start comment 'start',
......
### check System Versioning and conventional partitioning
create table t1 (x int) create table t1 (x int)
with system versioning with system versioning
partition by range columns (x) ( partition by range columns (x) (
...@@ -27,6 +28,11 @@ x ...@@ -27,6 +28,11 @@ x
select * from t1 partition (p1) for system_time all; select * from t1 partition (p1) for system_time all;
x x
300 300
### Engine change versioned/non-versioned prohibited
create or replace table t1 (i int) engine=MyISAM with system versioning partition by hash(i);
alter table t1 engine=InnoDB;
ERROR HY000: Not allowed for versioned `test`.`t1`. Change to/from native versioning engine is prohibited.
### check server-level partitioning
create or replace table t1 (x int) create or replace table t1 (x int)
partition by system_time ( partition by system_time (
partition p0 versioning, partition p0 versioning,
......
...@@ -5,19 +5,6 @@ ...@@ -5,19 +5,6 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
delimiter ~~;
create function if not exists non_default_engine()
returns varchar(255)
deterministic
begin
if default_engine() = 'InnoDB' then
return 'MyISAM';
end if;
return 'InnoDB';
end~~
delimiter ;~~
let $non_default_engine= `select non_default_engine()`;
let $non_sys_datatype= `select sys_datatype(non_default_engine())`; let $non_sys_datatype= `select sys_datatype(non_default_engine())`;
let $non_sys_datatype_uc= `select upper(sys_datatype(non_default_engine()))`; let $non_sys_datatype_uc= `select upper(sys_datatype(non_default_engine()))`;
let $sys_datatype_null= $sys_datatype NULL DEFAULT NULL; let $sys_datatype_null= $sys_datatype NULL DEFAULT NULL;
......
-- source suite/versioning/common.inc -- source suite/versioning/common.inc
### check System Versioning and conventional partitioning --echo ### check System Versioning and conventional partitioning
create table t1 (x int) create table t1 (x int)
with system versioning with system versioning
...@@ -19,7 +19,12 @@ select * from t1 for system_time all; ...@@ -19,7 +19,12 @@ select * from t1 for system_time all;
select * from t1 partition (p0) for system_time all; select * from t1 partition (p0) for system_time all;
select * from t1 partition (p1) for system_time all; select * from t1 partition (p1) for system_time all;
### check server-level partitioning --echo ### Engine change versioned/non-versioned prohibited
eval create or replace table t1 (i int) engine=$default_engine with system versioning partition by hash(i);
--error ER_VERS_ALTER_ENGINE_PROHIBITED
eval alter table t1 engine=$non_default_engine;
--echo ### check server-level partitioning
# create errors # create errors
--error ER_VERS_ENGINE_UNSUPPORTED --error ER_VERS_ENGINE_UNSUPPORTED
......
...@@ -8856,7 +8856,7 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name, ...@@ -8856,7 +8856,7 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
{ {
if (handlerton *hton1= create_info->db_type) if (handlerton *hton1= create_info->db_type)
{ {
handlerton *hton2= table->file->ht; handlerton *hton2= table->file->partition_ht();
if (hton1 != hton2 && if (hton1 != hton2 &&
(ha_check_storage_engine_flag(hton1, HTON_NATIVE_SYS_VERSIONING) || (ha_check_storage_engine_flag(hton1, HTON_NATIVE_SYS_VERSIONING) ||
ha_check_storage_engine_flag(hton2, HTON_NATIVE_SYS_VERSIONING))) ha_check_storage_engine_flag(hton2, HTON_NATIVE_SYS_VERSIONING)))
......
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