mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge branch '10.3' into 10.4
This commit is contained in:
@ -631,8 +631,32 @@ Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`x` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`y` int(11) DEFAULT NULL,
|
||||
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START WITHOUT SYSTEM VERSIONING,
|
||||
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END WITHOUT SYSTEM VERSIONING,
|
||||
`row_start` timestamp(6) GENERATED ALWAYS AS ROW START,
|
||||
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
|
||||
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
|
||||
#
|
||||
create or replace table t (
|
||||
a int,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e))
|
||||
with system versioning;
|
||||
ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t`
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e));
|
||||
ERROR HY000: `s` must be of type TIMESTAMP(6) for system-versioned table `t`
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
b int with system versioning,
|
||||
s timestamp(6) as row start,
|
||||
e timestamp(6) as row end,
|
||||
period for system_time (s, e));
|
||||
insert into t () values (),();
|
||||
drop table t;
|
||||
|
@ -1,3 +1,39 @@
|
||||
#
|
||||
# SYSTEM_VERSIONING_ASOF sysvar
|
||||
#
|
||||
create table t (a int) with system versioning;
|
||||
set @before= UNIX_TIMESTAMP(now(6));
|
||||
insert into t values (1);
|
||||
set @after= UNIX_TIMESTAMP(now(6));
|
||||
update t set a= 2;
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
set system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
||||
connection subcon;
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
disconnect subcon;
|
||||
connection default;
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@before);
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
||||
connection subcon;
|
||||
select * from t as empty;
|
||||
a
|
||||
disconnect subcon;
|
||||
connection default;
|
||||
drop table t;
|
||||
set global system_versioning_asof= DEFAULT;
|
||||
set system_versioning_asof= DEFAULT;
|
||||
#
|
||||
# DELETE HISTORY and privileges
|
||||
#
|
||||
connect root,localhost,root,,test;
|
||||
connection root;
|
||||
create database mysqltest;
|
||||
@ -31,3 +67,6 @@ GRANT DELETE HISTORY ON `mysqltest`.* TO `mysqltest_1`@`localhost`
|
||||
GRANT DELETE HISTORY ON `mysqltest`.`t` TO `mysqltest_1`@`localhost`
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
disconnect user1;
|
||||
disconnect root;
|
||||
connection default;
|
@ -559,6 +559,18 @@ t1 CREATE TABLE `t1` (
|
||||
(PARTITION `ver_p1` HISTORY ENGINE = DEFAULT_ENGINE,
|
||||
PARTITION `ver_pn` CURRENT ENGINE = DEFAULT_ENGINE)
|
||||
#
|
||||
# MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||
#
|
||||
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||
engine=innodb with system versioning partition by key() partitions 2;
|
||||
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||
alter table t1 drop system versioning;
|
||||
replace into t1 select * from t1;
|
||||
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||
pk i c
|
||||
1 1 a
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table
|
||||
#
|
||||
create or replace table t1 (f int) with system versioning partition by hash(f);
|
||||
@ -763,6 +775,38 @@ alter table t1 add x serial;
|
||||
alter table t1 add partition (partition p1 history);
|
||||
alter table t1 add partition (partition p2 history);
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-27217 DELETE partition selection doesn't work for history partitions
|
||||
#
|
||||
create table t1 (f char) with system versioning
|
||||
partition by system_time limit 10 (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition p2 history,
|
||||
partition pn current);
|
||||
delete from t1 partition (p1);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
drop table t1;
|
||||
set timestamp=unix_timestamp('2000-01-01 00:00:00');
|
||||
create or replace table t1 (i int) with system versioning
|
||||
partition by system_time interval 1 day (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
set timestamp=unix_timestamp('2000-01-02 00:00:00');
|
||||
insert t1 values (1);
|
||||
delete from t1 partition (p0, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
drop table t1;
|
||||
set timestamp= default;
|
||||
# End of 10.3 tests
|
||||
#
|
||||
# MDEV-22283 Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine
|
||||
|
@ -1,80 +0,0 @@
|
||||
# MDEV-15951 system versioning by trx id doesn't work with partitioning
|
||||
# currently trx_id does not support partitioning by system_time
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning;
|
||||
alter table t1 partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
|
||||
drop table t1;
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key() (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key(a, row_start) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by hash(a + row_end * 2) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by range columns (a, row_start) (
|
||||
partition p1 values less than (100, 100)
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
#
|
||||
# MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||
#
|
||||
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||
engine=innodb with system versioning partition by key() partitions 2;
|
||||
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||
alter table t1 drop system versioning;
|
||||
replace into t1 select * from t1;
|
||||
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||
pk i c
|
||||
1 1 a
|
||||
drop table t1;
|
||||
# End of 10.3 tests
|
@ -1,30 +0,0 @@
|
||||
create table t (a int) with system versioning;
|
||||
set @before= UNIX_TIMESTAMP(now(6));
|
||||
insert into t values (1);
|
||||
set @after= UNIX_TIMESTAMP(now(6));
|
||||
update t set a= 2;
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
set system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
||||
connection subcon;
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
disconnect subcon;
|
||||
connection default;
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@before);
|
||||
select * from t as nonempty;
|
||||
a
|
||||
1
|
||||
connect subcon,127.0.0.1,root,,,$SERVER_MYPORT_1;
|
||||
connection subcon;
|
||||
select * from t as empty;
|
||||
a
|
||||
disconnect subcon;
|
||||
connection default;
|
||||
drop table t;
|
||||
set global system_versioning_asof= DEFAULT;
|
||||
set system_versioning_asof= DEFAULT;
|
@ -175,7 +175,78 @@ select x, row_start < row_end from t1 for system_time all;
|
||||
x row_start < row_end
|
||||
4 1
|
||||
2 1
|
||||
#
|
||||
# MDEV-15951 system versioning by trx id doesn't work with partitioning
|
||||
# currently trx_id does not support partitioning by system_time
|
||||
#
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning;
|
||||
alter table t1 partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
|
||||
drop table t1;
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key() (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key(a, row_start) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by hash(a + row_end * 2) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by range columns (a, row_start) (
|
||||
partition p1 values less than (100, 100)
|
||||
);
|
||||
ERROR HY000: Transaction-precise system-versioned tables do not support partitioning by ROW START or ROW END
|
||||
#
|
||||
# MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL
|
||||
#
|
||||
create or replace table t1 (
|
||||
x int,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
|
@ -400,6 +400,17 @@ a check_row(row_start, row_end)
|
||||
1 CURRENT ROW
|
||||
drop tables t1, t2, t3;
|
||||
#
|
||||
# MDEV-26778 row_start is not updated in current row for InnoDB
|
||||
#
|
||||
create or replace table t1 (x int) with system versioning;
|
||||
insert t1 values (1);
|
||||
update t1 set x= 1;
|
||||
select row_start into @r from t1;
|
||||
select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r;
|
||||
check_row_ts(row_start, row_end)
|
||||
CURRENT ROW
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob
|
||||
#
|
||||
create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning;
|
||||
|
@ -468,3 +468,32 @@ create or replace table t1 (
|
||||
show create table t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27452 TIMESTAMP(0) system field is allowed for certain creation of system-versioned table
|
||||
--echo #
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t (
|
||||
a int,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e))
|
||||
with system versioning;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
s timestamp as row start,
|
||||
e timestamp as row end,
|
||||
period for system_time (s, e));
|
||||
|
||||
create or replace table t (
|
||||
a int with system versioning,
|
||||
b int with system versioning,
|
||||
s timestamp(6) as row start,
|
||||
e timestamp(6) as row end,
|
||||
period for system_time (s, e));
|
||||
insert into t () values (),();
|
||||
|
||||
# cleanup
|
||||
drop table t;
|
||||
|
79
mysql-test/suite/versioning/t/not_embedded.test
Normal file
79
mysql-test/suite/versioning/t/not_embedded.test
Normal file
@ -0,0 +1,79 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--echo #
|
||||
--echo # SYSTEM_VERSIONING_ASOF sysvar
|
||||
--echo #
|
||||
create table t (a int) with system versioning;
|
||||
set @before= UNIX_TIMESTAMP(now(6));
|
||||
insert into t values (1);
|
||||
set @after= UNIX_TIMESTAMP(now(6));
|
||||
update t set a= 2;
|
||||
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
set system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
select * from t as nonempty;
|
||||
|
||||
--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
|
||||
--connection subcon
|
||||
select * from t as nonempty;
|
||||
--disconnect subcon
|
||||
--connection default
|
||||
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@before);
|
||||
select * from t as nonempty;
|
||||
|
||||
--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
|
||||
--connection subcon
|
||||
select * from t as empty;
|
||||
--disconnect subcon
|
||||
--connection default
|
||||
|
||||
drop table t;
|
||||
|
||||
set global system_versioning_asof= DEFAULT;
|
||||
set system_versioning_asof= DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # DELETE HISTORY and privileges
|
||||
--echo #
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (root,localhost,root,,test);
|
||||
connection root;
|
||||
|
||||
--disable_warnings
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create user mysqltest_1@localhost;
|
||||
connect (user1,localhost,mysqltest_1,,test);
|
||||
connection user1;
|
||||
|
||||
connection root;
|
||||
create table mysqltest.t (a int) with system versioning;
|
||||
|
||||
connection user1;
|
||||
show grants;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
delete history from mysqltest.t before system_time now();
|
||||
|
||||
connection root;
|
||||
grant delete history on mysqltest.* to mysqltest_1@localhost;
|
||||
grant delete history on mysqltest.t to mysqltest_1@localhost;
|
||||
|
||||
connection user1;
|
||||
show grants;
|
||||
delete history from mysqltest.t before system_time now();
|
||||
|
||||
connection root;
|
||||
grant all on *.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
--disconnect user1
|
||||
--disconnect root
|
||||
--connection default
|
@ -489,6 +489,17 @@ partition by system_time interval column_get(column_create(7,7), 7 as int) secon
|
||||
--replace_result $default_engine DEFAULT_ENGINE
|
||||
show create table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||
--echo #
|
||||
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||
engine=innodb with system versioning partition by key() partitions 2;
|
||||
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||
alter table t1 drop system versioning;
|
||||
replace into t1 select * from t1;
|
||||
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table
|
||||
--echo #
|
||||
@ -728,6 +739,40 @@ alter table t1 add partition (partition p1 history);
|
||||
alter table t1 add partition (partition p2 history);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27217 DELETE partition selection doesn't work for history partitions
|
||||
--echo #
|
||||
create table t1 (f char) with system versioning
|
||||
partition by system_time limit 10 (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition p2 history,
|
||||
partition pn current);
|
||||
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, pn);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
drop table t1;
|
||||
|
||||
set timestamp=unix_timestamp('2000-01-01 00:00:00');
|
||||
create or replace table t1 (i int) with system versioning
|
||||
partition by system_time interval 1 day (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
set timestamp=unix_timestamp('2000-01-02 00:00:00');
|
||||
insert t1 values (1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, pn);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
drop table t1;
|
||||
set timestamp= default;
|
||||
--echo # End of 10.3 tests
|
||||
|
||||
--echo #
|
||||
|
@ -1,93 +0,0 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_partition.inc
|
||||
--source suite/versioning/common.inc
|
||||
|
||||
--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning
|
||||
--echo # currently trx_id does not support partitioning by system_time
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
alter table t1 partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
|
||||
drop table t1;
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key() (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key(a, row_start) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by hash(a + row_end * 2) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by range columns (a, row_start) (
|
||||
partition p1 values less than (100, 100)
|
||||
);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||
--echo #
|
||||
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||
engine=innodb with system versioning partition by key() partitions 2;
|
||||
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||
alter table t1 drop system versioning;
|
||||
replace into t1 select * from t1;
|
||||
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||
drop table t1;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
||||
--source suite/versioning/common_finish.inc
|
@ -1,31 +0,0 @@
|
||||
source include/not_embedded.inc;
|
||||
|
||||
create table t (a int) with system versioning;
|
||||
set @before= UNIX_TIMESTAMP(now(6));
|
||||
insert into t values (1);
|
||||
set @after= UNIX_TIMESTAMP(now(6));
|
||||
update t set a= 2;
|
||||
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
set system_versioning_asof= FROM_UNIXTIME(@after);
|
||||
select * from t as nonempty;
|
||||
|
||||
--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
|
||||
--connection subcon
|
||||
select * from t as nonempty;
|
||||
--disconnect subcon
|
||||
--connection default
|
||||
|
||||
set global system_versioning_asof= FROM_UNIXTIME(@before);
|
||||
select * from t as nonempty;
|
||||
|
||||
--connect (subcon,127.0.0.1,root,,,$SERVER_MYPORT_1)
|
||||
--connection subcon
|
||||
select * from t as empty;
|
||||
--disconnect subcon
|
||||
--connection default
|
||||
|
||||
drop table t;
|
||||
|
||||
set global system_versioning_asof= DEFAULT;
|
||||
set system_versioning_asof= DEFAULT;
|
@ -1,41 +0,0 @@
|
||||
# Can't test with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (root,localhost,root,,test);
|
||||
connection root;
|
||||
|
||||
--disable_warnings
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create user mysqltest_1@localhost;
|
||||
connect (user1,localhost,mysqltest_1,,test);
|
||||
connection user1;
|
||||
|
||||
connection root;
|
||||
create table mysqltest.t (a int) with system versioning;
|
||||
|
||||
connection user1;
|
||||
show grants;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
delete history from mysqltest.t before system_time now();
|
||||
|
||||
connection root;
|
||||
grant delete history on mysqltest.* to mysqltest_1@localhost;
|
||||
grant delete history on mysqltest.t to mysqltest_1@localhost;
|
||||
|
||||
connection user1;
|
||||
show grants;
|
||||
delete history from mysqltest.t before system_time now();
|
||||
|
||||
connection root;
|
||||
grant all on *.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
@ -3,6 +3,7 @@ if (!$TEST_VERSIONING_SO)
|
||||
--skip needs test_versioning plugin
|
||||
}
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_partition.inc
|
||||
--source include/default_charset.inc
|
||||
|
||||
--disable_query_log
|
||||
@ -155,7 +156,87 @@ update t1 set x= 4;
|
||||
commit;
|
||||
select x, row_start < row_end from t1 for system_time all;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15951 system versioning by trx id doesn't work with partitioning
|
||||
--echo # currently trx_id does not support partitioning by system_time
|
||||
--echo #
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
|
||||
create or replace table t1(
|
||||
i int,
|
||||
row_start bigint unsigned generated always as row start,
|
||||
row_end bigint unsigned generated always as row end,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=InnoDB with system versioning;
|
||||
|
||||
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
alter table t1 partition by system_time (
|
||||
partition p0 history,
|
||||
partition pn current
|
||||
);
|
||||
|
||||
drop table t1;
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key() (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by key(a, row_start) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by hash(a + row_end * 2) (
|
||||
partition p1,
|
||||
partition p2
|
||||
);
|
||||
|
||||
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
|
||||
create or replace table t (
|
||||
a int primary key,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
row_end bigint unsigned as row end invisible,
|
||||
period for system_time(row_start, row_end)
|
||||
) engine=innodb with system versioning
|
||||
partition by range columns (a, row_start) (
|
||||
partition p1 values less than (100, 100)
|
||||
);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16010 Too many rows with AS OF point_in_the_past_or_NULL
|
||||
--echo #
|
||||
create or replace table t1 (
|
||||
x int,
|
||||
row_start bigint unsigned as row start invisible,
|
||||
|
@ -326,6 +326,16 @@ select *, check_row(row_start, row_end) from t2 for system_time all order by row
|
||||
# cleanup
|
||||
drop tables t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-26778 row_start is not updated in current row for InnoDB
|
||||
--echo #
|
||||
create or replace table t1 (x int) with system versioning;
|
||||
insert t1 values (1);
|
||||
update t1 set x= 1;
|
||||
select row_start into @r from t1;
|
||||
select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user