1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2022-02-01 20:33:04 +01:00
460 changed files with 9909 additions and 2408 deletions

View File

@@ -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;

View 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

View File

@@ -771,6 +771,17 @@ partition by system_time interval column_get(column_create(7,7), 7 as int) secon
show create table t1;
set timestamp= default;
--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 #
@@ -1024,6 +1035,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 #

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,
@@ -507,3 +588,38 @@ drop table t;
uninstall plugin test_versioning;
--error ER_SP_DOES_NOT_EXIST
select trt_begin_ts(0);
--echo #
--echo # MDEV-21650 Non-empty statement transaction on global rollback after TRT update error
--echo #
create table t1 (s date, e date, period for app(s,e)) engine=innodb;
alter table t1
add row_start bigint unsigned as row start,
add row_end bigint unsigned as row end,
add period for system_time(row_start,row_end),
with system versioning,
add period if not exists for app(x,y);
set transaction isolation level serializable;
start transaction;
insert into t1 (s,e) values ('2021-07-04','2024-08-18');
--connect (con1,localhost,root,,test)
start transaction;
insert into t1 (s,e) values ('2018-06-01','2021-09-15');
--connection default
--replace_regex /TRX_ID \d+/TRX_ID .../
--error ER_VERS_NO_TRX_ID
select * from t1 for system_time as of now();
--connection con1
set innodb_lock_wait_timeout= 1, lock_wait_timeout= 1;
# can be existing or non-existing table, does not matter
--error ER_LOCK_WAIT_TIMEOUT
alter table xx;
# cleanup
--disconnect con1
--connection default
drop table t1;

View File

@@ -328,9 +328,19 @@ 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
--echo #
create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning;
insert into t1 values (1, 1, 'foo'), (2, 11, 'bar');