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:
Marko Mäkelä
2023-01-03 16:10:02 +02:00
149 changed files with 2784 additions and 1991 deletions

View File

@ -377,6 +377,11 @@ a b
2 NULL
3 1
4 2
alter table t add c int, drop system versioning;
select * from t;
a b c
3 1 NULL
4 2 NULL
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);
delete from t where a<3;

View File

@ -19,7 +19,7 @@ show create table tt2;
Table Create Table
tt2 CREATE TEMPORARY TABLE `tt2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
connect con1, localhost, root;
create table t3 (a int);
show create table t3;
@ -32,7 +32,7 @@ show create table tt3;
Table Create Table
tt3 CREATE TEMPORARY TABLE `tt3` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
disconnect con1;
connection default;
set debug_dbug='+d,sysvers_show';

View File

@ -146,6 +146,5 @@ delete from t1;
select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all;
f1 f3 check_row_ts(row_start, row_end)
1 1 HISTORICAL ROW
1 NULL ERROR: row_end == row_start
1 1 HISTORICAL ROW
drop table t1;

View File

@ -1,3 +1,5 @@
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
set global innodb_purge_rseg_truncate_frequency= 1;
create table t (a int);
delete history from t before system_time now();
ERROR HY000: Table `t` is not system-versioned
@ -191,6 +193,26 @@ x
drop prepare stmt;
drop table t1;
#
# MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
#
create table t1 (a integer, c0 varchar(255), fulltext key (c0))
with system versioning engine innodb;
set system_versioning_alter_history= keep;
alter table t1 drop system versioning;
alter table t1 add system versioning;
insert into t1 values (1, 'politician');
update t1 set c0= 'criminal';
InnoDB 0 transactions not purged
delete history from t1;
drop table t1;
create table t1 (id int primary key, ftx varchar(255))
with system versioning engine innodb;
insert into t1 values (1, 'c');
delete from t1;
alter table t1 add fulltext key(ftx);
drop table t1;
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
#
# MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
#
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
@ -202,3 +224,4 @@ DELETE HISTORY FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
DROP TABLE t1;
# End of 10.4 tests

View File

@ -445,6 +445,43 @@ pk f1 f2 left(f3, 4) check_row_ts(row_start, row_end)
1 8 8 SHOR HISTORICAL ROW
2 8 8 LONG HISTORICAL ROW
drop table t1;
# Shorter case for clustered index (MDEV-25004)
create table t1 (
y int primary key, r int, f int, key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
y r f check_row_ts(row_start, row_end)
1 6 6 HISTORICAL ROW
2 6 6 HISTORICAL ROW
drop tables t1;
# Secondary unique index
create table t1 (
y int unique null, r int, f int, key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
y r f check_row_ts(row_start, row_end)
1 6 6 HISTORICAL ROW
2 6 6 HISTORICAL ROW
drop tables t1;
# Non-unique index cannot be fixed because it does not trigger duplicate error
create table t1 (
y int, r int, f int, key (y), key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
y r f check_row_ts(row_start, row_end)
1 6 6 HISTORICAL ROW
2 6 NULL ERROR: row_end == row_start
2 6 6 HISTORICAL ROW
drop tables t1;
#
# MDEV-21555 Assertion secondary index is out of sync on delete from versioned table
#

View File

@ -264,6 +264,8 @@ select * from t;
select * from t for system_time all;
insert into t values (4, 0);
select * from t for system_time all;
alter table t add c int, drop system versioning;
select * from t;
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);

View File

@ -2,6 +2,9 @@
--source include/have_partition.inc
--source suite/versioning/engines.inc
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
set global innodb_purge_rseg_truncate_frequency= 1;
create table t (a int);
--error ER_VERS_NOT_VERSIONED
delete history from t before system_time now();
@ -193,6 +196,29 @@ select * from t1;
drop prepare stmt;
drop table t1;
--echo #
--echo # MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
--echo #
create table t1 (a integer, c0 varchar(255), fulltext key (c0))
with system versioning engine innodb;
set system_versioning_alter_history= keep;
alter table t1 drop system versioning;
alter table t1 add system versioning;
insert into t1 values (1, 'politician');
update t1 set c0= 'criminal';
--source suite/innodb/include/wait_all_purged.inc
delete history from t1;
drop table t1;
create table t1 (id int primary key, ftx varchar(255))
with system versioning engine innodb;
insert into t1 values (1, 'c');
delete from t1;
alter table t1 add fulltext key(ftx);
drop table t1;
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
--echo #
--echo # MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
--echo #
@ -206,4 +232,6 @@ DELETE HISTORY FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo # End of 10.4 tests
--source suite/versioning/common_finish.inc

View File

@ -476,6 +476,39 @@ select pk, f1, f2, left(f3, 4), check_row_ts(row_start, row_end) from t1 for sys
# cleanup
drop table t1;
--echo # Shorter case for clustered index (MDEV-25004)
create table t1 (
y int primary key, r int, f int, key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
drop tables t1;
--echo # Secondary unique index
create table t1 (
y int unique null, r int, f int, key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
drop tables t1;
--echo # Non-unique index cannot be fixed because it does not trigger duplicate error
create table t1 (
y int, r int, f int, key (y), key (r),
foreign key (f) references t1 (r) on delete set null)
with system versioning engine innodb;
insert into t1 values (1, 6, 6), (2, 6, 6);
delete from t1;
select *, check_row_ts(row_start, row_end) from t1 for system_time all;
drop tables t1;
--echo #
--echo # MDEV-21555 Assertion secondary index is out of sync on delete from versioned table
--echo #