1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.3 into 10.4

This commit is contained in:
Aleksey Midenkov
2019-12-02 12:51:53 +03:00
18 changed files with 278 additions and 38 deletions

View File

@ -599,3 +599,17 @@ x a
3 bar
4 bar
drop table t1;
#
# MDEV-21011 Table corruption reported for versioned partitioned table after DELETE: "Found a misplaced row"
#
create table t1 (a int) with system versioning
partition by system_time limit 3
(partition p1 history, partition p2 history, partition pn current);
insert into t1 values (1),(2),(3),(4);
delete from t1;
delete from t1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check note Not supported for non-INTERVAL history partitions
test.t1 check note The storage engine for the table doesn't support check
drop table t1;

View File

@ -276,3 +276,24 @@ update t1 set a= '2012-12-12';
update v set a= '2000-01-01' order by b limit 1;
drop view v;
drop table t1, t2;
#
# MDEV-20441 ER_CRASHED_ON_USAGE upon update on versioned Aria table
#
create or replace table t1 (a varchar(8))
engine=aria row_format=fixed
with system versioning;
insert into t1 (a) values ('foo');
update t1 set a = 'bar';
drop table t1;
#
# MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
#
create or replace table t1 (
pk int, a char(8), b char(8),
primary key (pk)
) with system versioning;
create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = '';
drop view v1;
drop table t1;

View File

@ -160,6 +160,7 @@ period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1), (2);
create or replace view v1 as select * from t1 where x > 1;
# update, delete
update v1 set x= x + 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
x check_row(row_start, row_end)
@ -211,5 +212,70 @@ x check_row(row_start, row_end)
1 CURRENT ROW
2 HISTORICAL ROW
3 HISTORICAL ROW
# replace
create or replace table t1 (
x int primary key, y int,
row_start SYS_DATATYPE as row start invisible,
row_end SYS_DATATYPE as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1, 0), (2, 0);
create or replace view v1 as select * from t1 where x > 1;
replace v1 values (1, 1);
replace v1 values (2, 1);
replace v1 values (3, 1);
# REPLACE ignores VIEW condition because itself doesn't use WHERE
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
x y check_row(row_start, row_end)
1 0 HISTORICAL ROW
1 1 CURRENT ROW
2 0 HISTORICAL ROW
2 1 CURRENT ROW
3 1 CURRENT ROW
# insert-select, on duplicate key
insert v1 select * from t1 where x = 1 on duplicate key update x = v1.x - 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
x y check_row(row_start, row_end)
0 1 CURRENT ROW
1 0 HISTORICAL ROW
1 1 HISTORICAL ROW
2 0 HISTORICAL ROW
2 1 CURRENT ROW
3 1 CURRENT ROW
drop view v1, v2;
drop tables t1, t2;
#
# MDEV-21146 Assertion `m_lock_type == 2' in handler::ha_drop_table upon LOAD DATA
#
create table t1 (a int);
create view v1 as select * from t1;
create or replace table t1 (b int) with system versioning;
load data infile 'xx' into table v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
drop table t1;
#
# MDEV-21155 Assertion with versioned table upon DELETE from view of view after replacing first view
#
create table t1 (a int);
insert into t1 values (1);
create table t2 (
b int,
row_start SYS_DATATYPE as row start invisible,
row_end SYS_DATATYPE as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t2 values (2);
create view v1 as select * from t1;
create view v2 as select * from v1;
create or replace view v1 as select * from t2;
delete from v2;
select * from t1;
a
1
select *, check_row(row_start, row_end) from t2 for system_time all;
b check_row(row_start, row_end)
2 HISTORICAL ROW
drop view v2;
drop view v1;
drop table t1, t2;

View File

@ -530,4 +530,19 @@ update t1 set a= 'bar' limit 4;
select * from t1;
drop table t1;
--echo #
--echo # MDEV-21011 Table corruption reported for versioned partitioned table after DELETE: "Found a misplaced row"
--echo #
create table t1 (a int) with system versioning
partition by system_time limit 3
(partition p1 history, partition p2 history, partition pn current);
insert into t1 values (1),(2),(3),(4);
delete from t1;
delete from t1;
check table t1;
# cleanup
drop table t1;
--source suite/versioning/common_finish.inc

View File

@ -157,7 +157,6 @@ replace t1 values (1,2),(1,3),(2,4);
--echo #
--echo # MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
--echo #
create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;
@ -192,4 +191,31 @@ drop view v;
drop table t1, t2;
--enable_warnings
--echo #
--echo # MDEV-20441 ER_CRASHED_ON_USAGE upon update on versioned Aria table
--echo #
create or replace table t1 (a varchar(8))
engine=aria row_format=fixed
with system versioning;
insert into t1 (a) values ('foo');
update t1 set a = 'bar';
drop table t1;
--echo #
--echo # MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
--echo #
create or replace table t1 (
pk int, a char(8), b char(8),
primary key (pk)
) with system versioning;
create or replace view v1 as select * from t1;
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
update v1 set a= null where b = '';
# cleanup
drop view v1;
drop table t1;
source suite/versioning/common_finish.inc;

View File

@ -136,6 +136,7 @@ eval create or replace table t1 (
) with system versioning;
insert into t1 values (1), (2);
create or replace view v1 as select * from t1 where x > 1;
--echo # update, delete
update v1 set x= x + 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
insert v1 values (4);
@ -153,8 +154,63 @@ select *, check_row(row_start, row_end) from t2 for system_time all order by x;
delete v1, v2 from v1 join v2 where v1.x = v2.x + 2;
select *, check_row(row_start, row_end) from t1 for system_time all order by x;
select *, check_row(row_start, row_end) from t2 for system_time all order by x;
--echo # replace
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create or replace table t1 (
x int primary key, y int,
row_start $sys_datatype_expl as row start invisible,
row_end $sys_datatype_expl as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t1 values (1, 0), (2, 0);
create or replace view v1 as select * from t1 where x > 1;
replace v1 values (1, 1);
replace v1 values (2, 1);
replace v1 values (3, 1);
--echo # REPLACE ignores VIEW condition because itself doesn't use WHERE
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
--echo # insert-select, on duplicate key
insert v1 select * from t1 where x = 1 on duplicate key update x = v1.x - 1;
select *, check_row(row_start, row_end) from t1 for system_time all order by x, row_end;
drop view v1, v2;
drop tables t1, t2;
--echo #
--echo # MDEV-21146 Assertion `m_lock_type == 2' in handler::ha_drop_table upon LOAD DATA
--echo #
create table t1 (a int);
create view v1 as select * from t1;
create or replace table t1 (b int) with system versioning;
--error ER_VIEW_INVALID
load data infile 'xx' into table v1;
# cleanup
drop view v1;
drop table t1;
--echo #
--echo # MDEV-21155 Assertion with versioned table upon DELETE from view of view after replacing first view
--echo #
create table t1 (a int);
insert into t1 values (1);
--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table t2 (
b int,
row_start $sys_datatype_expl as row start invisible,
row_end $sys_datatype_expl as row end invisible,
period for system_time (row_start, row_end)
) with system versioning;
insert into t2 values (2);
create view v1 as select * from t1;
create view v2 as select * from v1;
create or replace view v1 as select * from t2;
delete from v2;
select * from t1;
select *, check_row(row_start, row_end) from t2 for system_time all;
# cleanup
drop view v2;
drop view v1;
drop table t1, t2;
--source suite/versioning/common_finish.inc