Merge branch 10.4 into 10.5

A few of constaint -> constraint
This commit is contained in:
Daniel Black 2022-04-21 14:48:13 +10:00
commit 580cbd18b3
20 changed files with 2132 additions and 901 deletions

View File

@ -9,7 +9,7 @@ disconnect default;
connect default,localhost,root,,test;
START TRANSACTION;
CREATE TABLE t2 SELECT * FROM t1;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
COMMIT;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)

View File

@ -0,0 +1,8 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
SET SESSION wsrep_on = OFF;
XA START 'xatest';
ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication'

View File

@ -0,0 +1,19 @@
#
# MDEV-26575 Server crashes when execute shutdown statement after
# starting an XA transaction
#
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
SET SESSION wsrep_on = OFF;
--error ER_NOT_SUPPORTED_YET
XA START 'xatest';
--source include/restart_mysqld.inc
--source include/auto_increment_offset_restore.inc

View File

@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/no_protocol.inc
CREATE TABLE t (i int primary key auto_increment, j varchar(20) character set utf8);

View File

@ -1,3 +1,5 @@
connection node_2;
connection node_1;
connection node_1;
connection node_1;
connection node_2;

View File

@ -705,7 +705,7 @@ ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
SET foreign_key_checks=0;
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk' in the foreign table 't1'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk' in the foreign table 't1'
ALTER TABLE t1 ADD INDEX(v4);
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
SET foreign_key_checks=1;

View File

@ -36,13 +36,13 @@ SET foreign_key_checks = 0;
ALTER TABLE child ADD CONSTRAINT fk_20 FOREIGN KEY (a1, a2)
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
ALGORITHM = INPLACE;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent'
SHOW WARNINGS;
Level Code Message
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent'
SHOW ERRORS;
Level Code Message
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_20' in the referenced table 'parent'
Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_20' in the referenced table 'parent'
CREATE INDEX idx1 on parent(a, b);
ALTER TABLE child ADD CONSTRAINT fk_10 FOREIGN KEY (a1, a2)
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
@ -143,11 +143,11 @@ SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx';
ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2)
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
ALGORITHM = INPLACE;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child'
SET DEBUG_DBUG = @saved_debug_dbug;
SHOW ERRORS;
Level Code Message
Error 1821 Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
Error 1821 Failed to add the foreign key constraint. Missing index for constraint 'fk_40' in the foreign table '#child'
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/fk_1 test/child test/parent 1 6
@ -170,11 +170,11 @@ SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx';
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
ALGORITHM = INPLACE;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent'
SET DEBUG_DBUG = @saved_debug_dbug;
SHOW ERRORS;
Level Code Message
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
Error 1822 Failed to add the foreign key constraint. Missing index for constraint 'fk_42' in the referenced table 'parent'
SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option';
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
@ -480,7 +480,7 @@ ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1_new) REFERENCES parent(b),
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2_new) REFERENCES parent(a),
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
ALGORITHM = INPLACE;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
SHOW CREATE TABLE child;
Table Create Table
child CREATE TABLE `child` (
@ -542,7 +542,7 @@ ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(c),
ALGORITHM = INPLACE;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_new_3' in the referenced table 'parent'
SHOW CREATE TABLE child;
Table Create Table
child CREATE TABLE `child` (

View File

@ -958,13 +958,13 @@ FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1), ALGORITHM=COPY;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=INPLACE;
ERROR HY000: Failed to add the foreign key constraint on table 't2'. Incorrect options in FOREIGN KEY constraint 'test/fk_t2_ca'
@ -979,7 +979,7 @@ FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
affected rows: 0

View File

@ -49,7 +49,7 @@ CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT,
d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
@ -57,7 +57,7 @@ CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL,
b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
@ -68,7 +68,7 @@ DROP TABLE s,t;
CREATE TABLE s (a INT, b INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ERROR HY000: Failed to add the foreign key constraint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;

View File

@ -3,7 +3,7 @@ include/master-slave.inc
connection master;
SET GLOBAL max_binlog_cache_size = 65536;
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
DROP TABLE t1;
include/rpl_end.inc

View File

@ -142,5 +142,17 @@ SELECT global.tmp_disk_table_size;
ERROR 42S02: Unknown table 'global' in field list
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
ERROR 42S22: Unknown column 'tmp_disk_table_size' in 'field list'
#
# Beginning of 10.4 test
#
# Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
# failed on SELECT after setting tmp_disk_table_size.
#
SET @@tmp_disk_table_size=16384;
CREATE VIEW v AS SELECT 'a';
SELECT table_name FROM INFORMATION_SCHEMA.views;
ERROR HY000: The table '(temporary)' is full
DROP VIEW v;
# End of 10.4 test
SET @@global.tmp_disk_table_size = @start_global_value;
SET @@session.tmp_disk_table_size = @start_session_value;

View File

@ -193,6 +193,22 @@ SELECT global.tmp_disk_table_size;
--Error ER_BAD_FIELD_ERROR
SELECT tmp_disk_table_size = @@session.tmp_disk_table_size;
--echo #
--echo # Beginning of 10.4 test
--echo #
--echo # Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR'
--echo # failed on SELECT after setting tmp_disk_table_size.
--echo #
SET @@tmp_disk_table_size=16384;
CREATE VIEW v AS SELECT 'a';
--error ER_RECORD_FILE_FULL
SELECT table_name FROM INFORMATION_SCHEMA.views;
DROP VIEW v;
--echo # End of 10.4 test
####################################
# Restore initial value #

View File

@ -187,3 +187,15 @@ x
1
drop prepare stmt;
drop table t1;
#
# MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
#
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
SET optimizer_trace= 'enabled=on';
DELETE HISTORY FROM v1 BEFORE SYSTEM_TIME '2021-01-01';
ERROR HY000: The target table v1 of the DELETE is not updatable
DELETE HISTORY FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
DROP TABLE t1;

View File

@ -191,4 +191,17 @@ select * from t1;
drop prepare stmt;
drop table t1;
--echo #
--echo # MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
--echo #
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
SET optimizer_trace= 'enabled=on';
--error ER_NON_UPDATABLE_TABLE
DELETE HISTORY FROM v1 BEFORE SYSTEM_TIME '2021-01-01';
--error ER_NON_UPDATABLE_TABLE
DELETE HISTORY FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--source suite/versioning/common_finish.inc

File diff suppressed because it is too large Load Diff

View File

@ -5906,7 +5906,7 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_XA_START:
#ifdef WITH_WSREP
if (WSREP(thd))
if (WSREP_ON)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"XA transactions with Galera replication");

View File

@ -798,8 +798,10 @@ void vers_select_conds_t::print(String *str, enum_query_type query_type) const
end.print(str, query_type, STRING_WITH_LEN(" AND "));
break;
case SYSTEM_TIME_BEFORE:
start.print(str, query_type, STRING_WITH_LEN(" FOR SYSTEM_TIME BEFORE "));
break;
case SYSTEM_TIME_HISTORY:
DBUG_ASSERT(0);
// nothing to add
break;
case SYSTEM_TIME_ALL:
str->append(" FOR SYSTEM_TIME ALL");

View File

@ -5068,7 +5068,8 @@ end:
*/
DBUG_ASSERT(thd->open_tables == NULL);
thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
thd->clear_error();
if (!thd->is_fatal_error)
thd->clear_error();
return res;
}
@ -5284,6 +5285,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
error= 0;
goto err;
}
if (thd->is_fatal_error)
goto err;
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
if (fill_schema_table_by_open(thd, &tmp_mem_root, FALSE,

View File

@ -2821,7 +2821,7 @@ no_match:
= key_part.field->pack_length();
/* Any index on virtual columns cannot be used
for reference constaint */
for reference constraint */
if (!key_part.field->stored_in_db()) {
goto no_match;
}