Merge 10.1 into 10.2

This commit is contained in:
Marko Mäkelä 2020-10-21 14:02:04 +03:00
commit 620ea816ad
47 changed files with 722 additions and 187 deletions

View File

@ -6,11 +6,11 @@ FUNCTION(MY_CHECK_AND_SET_LINKER_FLAG flag_to_set)
RETURN()
ENDIF()
STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_LINK_FLAG_${flag_to_set}")
SET(SAVE_CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}")
SET(SAVE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
STRING(REGEX REPLACE "^-Wno-" "-W" flag_to_check ${flag_to_set})
SET(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} ${flag_to_check})
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${flag_to_check})
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result})
SET(CMAKE_REQUIRED_LINK_OPTIONS "${SAVE_CMAKE_REQUIRED_LINK_OPTIONS}")
SET(CMAKE_REQUIRED_LIBRARIES "${SAVE_CMAKE_REQUIRED_LIBRARIES}")
IF (${result})
FOREACH(linktype SHARED MODULE EXE)
IF(ARGN)

View File

@ -57,13 +57,13 @@ all would be imported into a table named
patient\&.
.PP
.PP
\fBmysqldump\fR
\fBmysqlimport\fR
supports the following options, which can be specified on the command line or in the
[mysqldump]
[mysqlimport]
and
[client]
option file groups\&.
\fBmysqldump\fR
\fBmysqlimport\fR
also supports the options for processing option files\&.
.sp
.RS 4
@ -267,17 +267,17 @@ Empty the table before importing the text file\&.
.sp -1
.IP \(bu 2.3
.\}
.\" mysqldump: fields-terminated-by option
.\" fields-terminated-by option: mysqldump
.\" mysqlimport: fields-terminated-by option
.\" fields-terminated-by option: mysqlimport
\fB\-\-fields\-terminated\-by=\&.\&.\&.\fR,
.\" mysqldump: fields-enclosed-by option
.\" fields-enclosed-by option: mysqldump
.\" mysqlimport: fields-enclosed-by option
.\" fields-enclosed-by option: mysqlimport
\fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR,
.\" mysqldump: fields-optionally-enclosed-by option
.\" fields-optionally-enclosed-by option: mysqldump
.\" mysqlimport: fields-optionally-enclosed-by option
.\" fields-optionally-enclosed-by option: mysqlimport
\fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR,
.\" mysqldump: fields-escaped-by option
.\" fields-escaped-by option: mysqldump
.\" mysqlimport: fields-escaped-by option
.\" fields-escaped-by option: mysqlimport
\fB\-\-fields\-escaped\-by=\&.\&.\&.\fR
.sp
These options have the same meaning as the corresponding clauses for
@ -379,8 +379,8 @@ lines of the data file\&.
.sp -1
.IP \(bu 2.3
.\}
.\" mysqldump: lines-terminated-by option
.\" lines-terminated-by option: mysqldump
.\" mysqlimport: lines-terminated-by option
.\" lines-terminated-by option: mysqlimport
\fB\-\-lines\-terminated\-by=\&.\&.\&.\fR
.sp
This option has the same meaning as the corresponding clause for

View File

@ -0,0 +1,50 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
--disable_warnings
drop table if exists t0,t1,t2;
--enable_warnings
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int primary key);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
kp1 int,
kp2 int,
col char(100),
key(kp1, kp2)
);
insert into t2 select a, a, a from t1;
select engine from information_schema.tables
where table_schema=database() and table_name='t2';
explain
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
let $target_id= `select connection_id()`;
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
send
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
connect (con1, localhost, root,,);
connection con1;
set debug_sync='now WAIT_FOR at_icp_check';
evalp kill query $target_id;
set debug_sync='now SIGNAL go';
connection default;
--error ER_QUERY_INTERRUPTED
reap;
set debug_sync='RESET';
disconnect con1;
drop table t0,t1,t2;
--source include/wait_until_count_sessions.inc

View File

@ -6546,7 +6546,7 @@ Options for debugging the product
debug-server Use debug version of server, but without turning on
tracing
debugger=NAME Start mysqld in the selected debugger
gdb Start the mysqld(s) in gdb
gdb[=gdb_arguments] Start the mysqld(s) in gdb
manual-debug Let user manually start mysqld in debugger, before
running test(s)
manual-gdb Let user manually start mysqld in gdb, before running

View File

@ -861,3 +861,18 @@ Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
drop view v;
drop table t1, t2;
#
# 10.1 Test
#
# MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
# failed in Diagnostics_area::set_error_status
#
set @old_mode= @@sql_mode;
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
SET @@sql_mode='STRICT_TRANS_TABLES';
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
SET @@sql_mode=@old_mode;
DROP TABLE t1;

View File

@ -380,6 +380,14 @@ slow_log
slow_log_new
drop table slow_log_new, general_log_new;
use test;
SET GLOBAL LOG_OUTPUT = 'FILE';
SET GLOBAL slow_query_log = 1;
SET GLOBAL general_log = 1;
ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
SET GLOBAL LOG_OUTPUT = 'NONE';
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL general_log = 0;
FLUSH LOGS;

View File

@ -2796,5 +2796,16 @@ id
16
drop table t1;
#
# MDEV-5628: Assertion `! is_set()' or `!is_set() ||
# (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
# partitioned table with subquery (MySQL:71630)
#
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1,t2;
#
# End of 10.1 tests
#

View File

@ -0,0 +1,7 @@
set @@global.binlog_checksum = CRC32;
call mtr.add_suppression("Replication event checksum verification failed");
call mtr.add_suppression("Error in Log_event::read_log_event");
set @@global.debug_dbug = VALUE;
set @@global.master_verify_checksum = DO_CHECKSUM;
set @@global.binlog_checksum = BINLOG_CHECKSUM;
# EOF the test

View File

@ -0,0 +1,37 @@
# The test verifies server binlog-based recovery.
#
# MDEV-23832 checksum error at server binlog recovery should not crash
# The test logic really requires --log-bin.
--source include/have_binlog_format_mixed.inc
--source include/have_debug.inc
--let $do_checksum = `SELECT @@global.master_verify_checksum`
--let $debug_dbug_saved = `SELECT @@global.debug_dbug`
--let $binlog_checksum = `SELECT @@global.binlog_checksum`
set @@global.binlog_checksum = CRC32;
call mtr.add_suppression("Replication event checksum verification failed");
call mtr.add_suppression("Error in Log_event::read_log_event");
# Proof of no crash follows.
# There's no need for actual bin-loggable queries to the server
--let $restart_parameters= --master_verify_checksum=ON --debug_dbug="+d,corrupt_read_log_event_char"
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
--let $restart_parameters=
--let $shutdown_timeout=
#
# Cleanup
--replace_regex /= .*/= VALUE/
--eval set @@global.debug_dbug = "$debug_dbug_saved"
--replace_result $do_checksum DO_CHECKSUM
--eval set @@global.master_verify_checksum = $do_checksum
--replace_result $binlog_checksum BINLOG_CHECKSUM
--eval set @@global.binlog_checksum = $binlog_checksum
#
--echo # EOF the test
#

View File

@ -420,6 +420,41 @@ connection default;
XA END 'xid';
XA ROLLBACK 'xid';
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY,
f1 VARCHAR(10), f2 VARCHAR(10),
f3 VARCHAR(10), f4 VARCHAR(10),
f5 VARCHAR(10), f6 VARCHAR(10),
f7 VARCHAR(10), f8 VARCHAR(10),
INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(3, 'innodb', 'innodb', 'innodb', 'innodb',
'innodb', 'innodb', 'innodb', 'innodb');
ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
START TRANSACTION;
DELETE FROM t1 where f1='mariadb';
SELECT * FROM t1;
pk f1 f2 f3 f4 f5 f6 f7 f8
2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb
3 innodb innodb innodb innodb innodb innodb innodb innodb
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
START TRANSACTION;
DELETE FROM t1 where f3='mariadb';
SELECT * FROM t1;
pk f1 f2 f3 f4 f5 f6 f7 f8
3 innodb innodb innodb innodb innodb innodb innodb innodb
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
UPDATE t1 SET f6='update';
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
UPDATE t1 SET f6='cascade';
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
DROP TABLE t1;
# Start of 10.2 tests
#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint

View File

@ -47,3 +47,5 @@ innodb_stats_drop_locked
innodb_stats_drop_locked
innodb_stats_drop_locked
innodb_stats_drop_locked
DELETE FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
DELETE FROM mysql.innodb_table_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';

View File

@ -421,6 +421,41 @@ ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanu
XA END 'xid';
XA ROLLBACK 'xid';
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY,
f1 VARCHAR(10), f2 VARCHAR(10),
f3 VARCHAR(10), f4 VARCHAR(10),
f5 VARCHAR(10), f6 VARCHAR(10),
f7 VARCHAR(10), f8 VARCHAR(10),
INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(3, 'innodb', 'innodb', 'innodb', 'innodb',
'innodb', 'innodb', 'innodb', 'innodb');
ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
START TRANSACTION;
DELETE FROM t1 where f1='mariadb';
SELECT * FROM t1;
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
START TRANSACTION;
DELETE FROM t1 where f3='mariadb';
SELECT * FROM t1;
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
--error ER_ROW_IS_REFERENCED_2
UPDATE t1 SET f6='update';
ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
--error ER_ROW_IS_REFERENCED_2
UPDATE t1 SET f6='cascade';
DROP TABLE t1;
#
# End of 10.1 tests
#

View File

@ -56,6 +56,8 @@ WHERE table_name='innodb_stats_drop_locked';
SELECT table_name FROM mysql.innodb_index_stats
WHERE table_name='innodb_stats_drop_locked';
DELETE FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
DELETE FROM mysql.innodb_table_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
--disable_query_log
call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
--enable_query_log

View File

@ -132,6 +132,27 @@ id title body
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
5 MySQL vs. YourSQL In the following database comparison ...
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
ERROR HY000: Table handler out of memory
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
id title body
6 MySQL Security When configured properly, MySQL ...
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
IN BOOLEAN MODE);
id title body
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
ERROR 42000: syntax error, unexpected $end
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
ERROR 42000: syntax error, unexpected $end
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
id title body

View File

@ -919,4 +919,46 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
#
# InnoDB: Failing assertion: result != FTS_INVALID in
# fts_trx_row_get_new_state
#
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE t1 (pk INT PRIMARY KEY,
f1 VARCHAR(10), f2 VARCHAR(10),
f3 VARCHAR(10), f4 VARCHAR(10),
f5 VARCHAR(10), f6 VARCHAR(10),
f7 VARCHAR(10), f8 VARCHAR(10),
FULLTEXT(f1), FULLTEXT(f2), FULLTEXT(f3), FULLTEXT(f4),
FULLTEXT(f5), FULLTEXT(f6), FULLTEXT(f7), FULLTEXT(f8),
INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(3, 'innodb', 'innodb', 'innodb', 'innodb',
'innodb', 'innodb', 'innodb', 'innodb');
ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
START TRANSACTION;
DELETE FROM t1 where f1='mariadb';
SELECT * FROM t1;
pk f1 f2 f3 f4 f5 f6 f7 f8
2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb
3 innodb innodb innodb innodb innodb innodb innodb innodb
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
START TRANSACTION;
DELETE FROM t1 where f3='mariadb';
SELECT * FROM t1;
pk f1 f2 f3 f4 f5 f6 f7 f8
3 innodb innodb innodb innodb innodb innodb innodb innodb
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
UPDATE t1 SET f6='update';
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
UPDATE t1 SET f6='cascade';
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

View File

@ -107,6 +107,26 @@ SELECT * FROM articles WHERE MATCH (title,body)
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
--error 128
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
IN BOOLEAN MODE);
--error ER_PARSE_ERROR
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
--error ER_PARSE_ERROR
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
IN BOOLEAN MODE);
# Test sub-expression boolean search. Find rows contain
# "MySQL" and "Well" or "MySQL" and "stands". But rank the
# doc with "Well" higher, and doc with "stands" lower.

View File

@ -889,4 +889,46 @@ DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
--echo #
--echo # InnoDB: Failing assertion: result != FTS_INVALID in
--echo # fts_trx_row_get_new_state
--echo #
SET FOREIGN_KEY_CHECKS=1;
CREATE TABLE t1 (pk INT PRIMARY KEY,
f1 VARCHAR(10), f2 VARCHAR(10),
f3 VARCHAR(10), f4 VARCHAR(10),
f5 VARCHAR(10), f6 VARCHAR(10),
f7 VARCHAR(10), f8 VARCHAR(10),
FULLTEXT(f1), FULLTEXT(f2), FULLTEXT(f3), FULLTEXT(f4),
FULLTEXT(f5), FULLTEXT(f6), FULLTEXT(f7), FULLTEXT(f8),
INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
'mariadb', 'mariadb', 'mariadb', 'mariadb'),
(3, 'innodb', 'innodb', 'innodb', 'innodb',
'innodb', 'innodb', 'innodb', 'innodb');
ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
START TRANSACTION;
DELETE FROM t1 where f1='mariadb';
SELECT * FROM t1;
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
START TRANSACTION;
DELETE FROM t1 where f3='mariadb';
SELECT * FROM t1;
ROLLBACK;
ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
--error ER_ROW_IS_REFERENCED_2
UPDATE t1 SET f6='update';
ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
--error ER_ROW_IS_REFERENCED_2
UPDATE t1 SET f6='cascade';
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

View File

@ -3,20 +3,66 @@ include/master-slave.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("table or database name 'mysqltest-1'");
connection master;
DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
CREATE DATABASE `#mysql50#mysqltest-1`;
CREATE DATABASE `mysqltest-1`;
connection slave;
connection master;
connection slave;
connection master;
Master position is not changed
connection slave;
STOP SLAVE SQL_THREAD;
include/wait_for_slave_sql_to_stop.inc
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET @old_log_output = @@global.log_output;
SET GLOBAL general_log = 'ON';
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL log_output = 'FILE';
connection master;
ALTER TABLE mysql.slow_log DROP COLUMN thread_id, DROP COLUMN rows_affected;
DROP DATABASE `mysqltest-1`;
connection slave;
connection slave;
SHOW CREATE TABLE mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
`start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
connection master;
connection master;
Master position has been changed
DROP DATABASE `mysqltest-1`;
connection slave;
DROP DATABASE `#mysql50#mysqltest-1`;
connection slave;
SHOW CREATE TABLE mysql.slow_log;
Table Create Table
slow_log CREATE TABLE `slow_log` (
`start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
`user_host` mediumtext NOT NULL,
`query_time` time(6) NOT NULL,
`lock_time` time(6) NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL,
`rows_affected` int(11) NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
SET GLOBAL general_log = 'OFF';
SET GLOBAL slow_query_log = 'OFF';
truncate mysql.slow_log;
truncate mysql.general_log;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
SET GLOBAL log_output = @old_log_output;
include/rpl_end.inc

View File

@ -14,8 +14,7 @@ call mtr.add_suppression("table or database name 'mysqltest-1'");
connection master;
--disable_warnings
DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
CREATE DATABASE `#mysql50#mysqltest-1`;
CREATE DATABASE `mysqltest-1`;
--enable_warnings
sync_slave_with_master;
@ -34,13 +33,25 @@ if ($before_position == $after_position)
echo Master position is not changed;
}
#Some log events of the mysql_upgrade's will cause errors on slave.
# Some log events of the mysql_upgrade previously caused errors on slave,
# however with MDEV-4851 this should be ok, so we test it:
connection slave;
STOP SLAVE SQL_THREAD;
source include/wait_for_slave_sql_to_stop.inc;
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET @old_log_output = @@global.log_output;
SET GLOBAL general_log = 'ON';
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL log_output = 'FILE';
connection master;
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
ALTER TABLE mysql.slow_log DROP COLUMN thread_id, DROP COLUMN rows_affected;
DROP DATABASE `mysqltest-1`;
sync_slave_with_master;
connection slave;
SHOW CREATE TABLE mysql.slow_log;
connection master;
--exec $MYSQL_UPGRADE --skip-verbose --write-binlog --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
let $datadir= `select @@datadir`;
@ -55,8 +66,15 @@ if ($before_position != $after_position)
echo Master position has been changed;
}
DROP DATABASE `mysqltest-1`;
sync_slave_with_master;
connection slave;
DROP DATABASE `#mysql50#mysqltest-1`;
--let $rpl_only_running_threads= 1
SHOW CREATE TABLE mysql.slow_log;
SET GLOBAL general_log = 'OFF';
SET GLOBAL slow_query_log = 'OFF';
truncate mysql.slow_log;
truncate mysql.general_log;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
SET GLOBAL log_output = @old_log_output;
--source include/rpl_end.inc

View File

@ -1214,7 +1214,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.49
-GLOBAL_VALUE 5.6.50
+GLOBAL_VALUE 5.6.49-89.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL

View File

@ -684,7 +684,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.49
-GLOBAL_VALUE 5.6.50
+GLOBAL_VALUE 5.6.49-89.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL

View File

@ -0,0 +1,34 @@
set default_storage_engine=aria;
drop table if exists t0,t1,t2;
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int primary key);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
kp1 int,
kp2 int,
col char(100),
key(kp1, kp2)
);
insert into t2 select a, a, a from t1;
select engine from information_schema.tables
where table_schema=database() and table_name='t2';
engine
Aria
explain
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range kp1 kp1 5 NULL 10 Using index condition
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
connect con1, localhost, root,,;
connection con1;
set debug_sync='now WAIT_FOR at_icp_check';
kill query $target_id;
set debug_sync='now SIGNAL go';
connection default;
ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
disconnect con1;
drop table t0,t1,t2;
set default_storage_engine=default;

View File

@ -0,0 +1,5 @@
set default_storage_engine=aria;
--source include/icp_debug_kill.inc
set default_storage_engine=default;

View File

@ -0,0 +1,34 @@
set default_storage_engine=innodb;
drop table if exists t0,t1,t2;
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int primary key);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
kp1 int,
kp2 int,
col char(100),
key(kp1, kp2)
);
insert into t2 select a, a, a from t1;
select engine from information_schema.tables
where table_schema=database() and table_name='t2';
engine
InnoDB
explain
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
connect con1, localhost, root,,;
connection con1;
set debug_sync='now WAIT_FOR at_icp_check';
kill query $target_id;
set debug_sync='now SIGNAL go';
connection default;
ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
disconnect con1;
drop table t0,t1,t2;
set default_storage_engine=default;

View File

@ -0,0 +1,6 @@
--source include/have_innodb.inc
set default_storage_engine=innodb;
--source include/icp_debug_kill.inc
set default_storage_engine=default;

View File

@ -577,3 +577,20 @@ EXECUTE ps;
drop view v;
drop table t1, t2;
--echo #
--echo # 10.1 Test
--echo #
--echo # MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
--echo # failed in Diagnostics_area::set_error_status
--echo #
set @old_mode= @@sql_mode;
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
SET @@sql_mode='STRICT_TRANS_TABLES';
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
SET @@sql_mode=@old_mode;
DROP TABLE t1;

View File

@ -54,7 +54,7 @@ select * from general_log where argument like '%general_log%';
#
# Check some basic queries interfering with the log tables.
# In our test we'll use a tbale with verbose comments to the short
# In our test we'll use a table with verbose comments to the short
# command type names, used in the tables
#
@ -474,6 +474,24 @@ show tables like "%log%";
drop table slow_log_new, general_log_new;
use test;
#
# Bug#69953 / MDEV-4851
# Log tables should be modifable on LOG_OUTPUT != TABLE
#
#
SET GLOBAL LOG_OUTPUT = 'FILE';
SET GLOBAL slow_query_log = 1;
SET GLOBAL general_log = 1;
ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
SET GLOBAL LOG_OUTPUT = 'NONE';
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
#
# Bug#27857 (Log tables supplies the wrong value for generating
# AUTO_INCREMENT numbers)

View File

@ -0,0 +1,32 @@
drop table if exists t0,t1,t2;
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int primary key);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (
kp1 int,
kp2 int,
col char(100),
key(kp1, kp2)
);
insert into t2 select a, a, a from t1;
select engine from information_schema.tables
where table_schema=database() and table_name='t2';
engine
MyISAM
explain
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
connect con1, localhost, root,,;
connection con1;
set debug_sync='now WAIT_FOR at_icp_check';
kill query $target_id;
set debug_sync='now SIGNAL go';
connection default;
ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
disconnect con1;
drop table t0,t1,t2;

View File

@ -0,0 +1 @@
--source include/icp_debug_kill.inc

View File

@ -2998,6 +2998,22 @@ insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, '
select id from t1 where data = 'ab' order by id;
drop table t1;
--echo #
--echo # MDEV-5628: Assertion `! is_set()' or `!is_set() ||
--echo # (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
--echo # partitioned table with subquery (MySQL:71630)
--echo #
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (1),(2);
--error ER_SUBQUERY_NO_1_ROW
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
DROP TABLE t1,t2;
--echo #
--echo # End of 10.1 tests
--echo #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env perl -i
#!/usr/bin/perl -i
#
# This script converts all numbers that look like addresses or memory sizes,
# in a debug files generated by --debug (like mysqld --debug-dbug), to #.

View File

@ -5608,6 +5608,7 @@ extern "C" enum icp_result handler_index_cond_check(void* h_arg)
THD *thd= h->table->in_use;
enum icp_result res;
DEBUG_SYNC(thd, "handler_index_cond_check");
enum thd_kill_levels abort_at= h->has_transactions() ?
THD_ABORT_SOFTLY : THD_ABORT_ASAP;
if (thd_kill_level(thd) > abort_at)

View File

@ -543,9 +543,11 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
{
switch (log_table_type) {
case QUERY_LOG_SLOW:
return (table_log_handler != NULL) && global_system_variables.sql_log_slow;
return (table_log_handler != NULL) && global_system_variables.sql_log_slow
&& (log_output_options & LOG_TABLE);
case QUERY_LOG_GENERAL:
return (table_log_handler != NULL) && opt_log ;
return (table_log_handler != NULL) && opt_log
&& (log_output_options & LOG_TABLE);
default:
DBUG_ASSERT(0);
return FALSE; /* make compiler happy */

View File

@ -2037,7 +2037,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
else
DBUG_RETURN(NULL);
#else
*error= ER(ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE);
*error= ER_THD_OR_DEFAULT(current_thd, ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE);
sql_print_error("%s", *error);
DBUG_RETURN(NULL);
#endif

View File

@ -383,11 +383,14 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
If LIMIT ROWS EXAMINED interrupted query execution, issue a warning,
continue with normal processing and produce an incomplete query result.
*/
bool saved_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= false;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT,
ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
thd->abort_on_warning= saved_abort_on_warning;
thd->reset_killed();
}
/* Disable LIMIT ROWS EXAMINED after query execution. */

View File

@ -417,6 +417,8 @@ int mysql_update(THD *thd,
query_plan.set_no_partitions();
if (thd->lex->describe || thd->lex->analyze_stmt)
goto produce_explain_and_leave;
if (thd->is_error())
DBUG_RETURN(1);
my_ok(thd); // No matching records
DBUG_RETURN(0);

View File

@ -96,6 +96,28 @@ operator<<(
return(s << ut_get_name(NULL, table_name.m_name));
}
/** @return whether a table belongs to a system database */
static bool dict_mem_table_is_system(char *name)
{
/* table has the following format: database/table
and some system table are of the form SYS_* */
if (strchr(name, '/')) {
size_t table_len = strlen(name);
const char *system_db;
int i = 0;
while ((system_db = innobase_system_databases[i++])
&& (system_db != NullS)) {
size_t len = strlen(system_db);
if (table_len > len && !strncmp(name, system_db, len)) {
return true;
}
}
return false;
} else {
return true;
}
}
/**********************************************************************//**
Creates a table memory object.
@return own: table object */
@ -1195,31 +1217,20 @@ operator<< (std::ostream& out, const dict_foreign_set& fk_set)
return(out);
}
/****************************************************************//**
Determines if a table belongs to a system database
@return */
bool
dict_mem_table_is_system(
/*================*/
char *name) /*!< in: table name */
/** Check whether fulltext index gets affected by foreign
key constraint. */
bool dict_foreign_t::affects_fulltext() const
{
ut_ad(name);
if (foreign_table == referenced_table || !foreign_table->fts)
return false;
/* table has the following format: database/table
and some system table are of the form SYS_* */
if (strchr(name, '/')) {
size_t table_len = strlen(name);
const char *system_db;
int i = 0;
while ((system_db = innobase_system_databases[i++])
&& (system_db != NullS)) {
size_t len = strlen(system_db);
if (table_len > len && !strncmp(name, system_db, len)) {
return true;
}
}
return false;
} else {
return true;
}
for (ulint i= 0; i < n_fields; i++)
{
const dict_col_t *col= dict_index_get_nth_col(foreign_index, i);
if (dict_table_is_fts_column(foreign_table->fts->indexes, col->ind,
col->is_virtual()) != ULINT_UNDEFINED)
return true;
}
return false;
}

View File

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@ -144,6 +144,8 @@ struct fts_query_t {
ib_rbt_t* wildcard_words; /*!< words with wildcard */
bool multi_exist; /*!< multiple FTS_EXIST oper */
byte visiting_sub_exp; /*!< count of nested
fts_ast_visit_sub_exp() */
st_mysql_ftparser* parser; /*!< fts plugin parser */
};
@ -2963,6 +2965,8 @@ fts_query_get_token(
return(new_ptr);
}
static dberr_t fts_ast_visit_sub_exp(fts_ast_node_t*, fts_ast_callback, void*);
/*****************************************************************//**
Visit every node of the AST. */
static
@ -3087,6 +3091,14 @@ fts_ast_visit_sub_exp(
ut_a(node->type == FTS_AST_SUBEXP_LIST);
/* To avoid stack overflow, we limit the mutual recursion
depth between fts_ast_visit(), fts_query_visitor() and
fts_ast_visit_sub_exp(). */
if (query->visiting_sub_exp++ > 31) {
query->error = DB_OUT_OF_MEMORY;
DBUG_RETURN(query->error);
}
cur_oper = query->oper;
/* Save current result set */
@ -3109,6 +3121,7 @@ fts_ast_visit_sub_exp(
/* Reinstate parent node state */
query->multi_exist = multi_exist;
query->oper = cur_oper;
query->visiting_sub_exp--;
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;

View File

@ -314,14 +314,6 @@ dict_mem_table_create(
ulint n_v_cols, /*!< in: number of virtual columns */
ulint flags, /*!< in: table flags */
ulint flags2); /*!< in: table flags2 */
/**********************************************************************//**
Determines if a table belongs to a system database
@return */
UNIV_INTERN
bool
dict_mem_table_is_system(
/*==================*/
char *name); /*!< in: table name */
/****************************************************************//**
Free a table memory object. */
void
@ -1214,6 +1206,10 @@ struct dict_foreign_t{
dict_vcol_set* v_cols; /*!< set of virtual columns affected
by foreign key constraint. */
/** Check whether the fulltext index gets affected by
foreign key constraint */
bool affects_fulltext() const;
};
std::ostream&

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2018, MariaDB Corporation.
Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software

View File

@ -496,7 +496,7 @@ row_ins_cascade_calc_update_vec(
n_fields_updated = 0;
bool affects_fulltext = false;
bool affects_fulltext = foreign->affects_fulltext();
if (table->fts) {
doc_id_pos = dict_table_get_nth_col_pos(
@ -617,17 +617,6 @@ row_ins_cascade_calc_update_vec(
padded_data, min_size);
}
/* Check whether the current column has
FTS index on it */
if (table->fts
&& dict_table_is_fts_column(
table->fts->indexes,
dict_col_get_no(col),
dict_col_is_virtual(col))
!= ULINT_UNDEFINED) {
affects_fulltext = true;
}
/* If Doc ID is updated, check whether the
Doc ID is valid */
if (table->fts
@ -1257,8 +1246,6 @@ row_ins_foreign_check_on_constraint(
update->n_fields * sizeof *update->fields);
#endif /* HAVE_valgrind_or_MSAN */
bool affects_fulltext = false;
for (ulint i = 0; i < foreign->n_fields; i++) {
upd_field_t* ufield = &update->fields[i];
ulint col_no = dict_index_get_nth_col_no(
@ -1274,19 +1261,9 @@ row_ins_foreign_check_on_constraint(
ufield->orig_len = 0;
ufield->exp = NULL;
dfield_set_null(&ufield->new_val);
if (!affects_fulltext
&& table->fts && dict_table_is_fts_column(
table->fts->indexes,
dict_index_get_nth_col_no(index, i),
dict_col_is_virtual(
dict_index_get_nth_col(index, i)))
!= ULINT_UNDEFINED) {
affects_fulltext = true;
}
}
if (affects_fulltext) {
if (foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
@ -1300,25 +1277,9 @@ row_ins_foreign_check_on_constraint(
goto nonstandard_exit_func;
}
}
} else if (table->fts && cascade->is_delete) {
/* DICT_FOREIGN_ON_DELETE_CASCADE case */
bool affects_fulltext = false;
for (ulint i = 0; i < foreign->n_fields; i++) {
if (dict_table_is_fts_column(
table->fts->indexes,
dict_index_get_nth_col_no(index, i),
dict_col_is_virtual(
dict_index_get_nth_col(index, i)))
!= ULINT_UNDEFINED) {
affects_fulltext = true;
break;
}
}
if (affects_fulltext) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
} else if (table->fts && cascade->is_delete
&& foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
if (!node->is_delete

View File

@ -4024,7 +4024,7 @@ row_sel_try_search_shortcut_for_mysql(
/*********************************************************************//**
Check a pushed-down index condition.
@return ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
@return ICP_ABORTED_BY_USER, ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
static
ICP_RESULT
row_search_idx_cond_check(
@ -4551,10 +4551,13 @@ row_search_mvcc(
switch (row_search_idx_cond_check(
buf, prebuilt,
rec, offsets)) {
case ICP_ABORTED_BY_USER:
mtr_commit(&mtr);
err = DB_INTERRUPTED;
goto unlock_and_exit;
case ICP_ERROR:
case ICP_NO_MATCH:
case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
case ICP_ERROR:
goto shortcut_mismatch;
case ICP_MATCH:
goto shortcut_match;
@ -4582,14 +4585,11 @@ row_search_mvcc(
shortcut_match:
mtr.commit();
err = DB_SUCCESS;
unlock_and_exit:
/* NOTE that we do NOT store the cursor
position */
err = DB_SUCCESS;
rw_lock_s_unlock(latch);
goto func_exit;
case SEL_EXHAUSTED:
@ -4597,13 +4597,7 @@ row_search_mvcc(
mtr.commit();
err = DB_RECORD_NOT_FOUND;
rw_lock_s_unlock(latch);
/* NOTE that we do NOT store the cursor
position */
goto func_exit;
goto unlock_and_exit;
case SEL_RETRY:
break;
@ -5336,8 +5330,10 @@ no_gap_lock:
buf, prebuilt, rec, offsets)) {
case ICP_NO_MATCH:
goto next_rec;
case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
err = DB_INTERRUPTED;
goto idx_cond_failed;
case ICP_OUT_OF_RANGE:
case ICP_ERROR:
err = DB_RECORD_NOT_FOUND;
goto idx_cond_failed;
@ -5396,9 +5392,11 @@ locks_ok_del_marked:
row_unlock_for_mysql(prebuilt, TRUE);
}
goto next_rec;
case ICP_ABORTED_BY_USER:
err = DB_INTERRUPTED;
goto idx_cond_failed;
case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
case ICP_ERROR:
case ICP_ERROR:
err = DB_RECORD_NOT_FOUND;
goto idx_cond_failed;
case ICP_MATCH:

View File

@ -853,3 +853,22 @@ operator<< (std::ostream& out, const dict_foreign_set& fk_set)
return(out);
}
/** Check whether fulltext index gets affected by foreign
key constraint. */
bool dict_foreign_t::affects_fulltext() const
{
if (foreign_table == referenced_table || !foreign_table->fts)
return false;
for (ulint i = 0; i < n_fields; i++)
{
if (dict_table_is_fts_column(
foreign_table->fts->indexes,
dict_index_get_nth_col_no(foreign_index, i))
!= ULINT_UNDEFINED)
return true;
}
return false;
}

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -146,6 +146,8 @@ struct fts_query_t {
fts_word_freq_t */
bool multi_exist; /*!< multiple FTS_EXIST oper */
byte visiting_sub_exp; /*!< count of nested
fts_ast_visit_sub_exp() */
};
/** For phrase matching, first we collect the documents and the positions
@ -2856,6 +2858,8 @@ fts_query_get_token(
return(new_ptr);
}
static dberr_t fts_ast_visit_sub_exp(fts_ast_node_t*, fts_ast_callback, void*);
/*****************************************************************//**
Visit every node of the AST. */
static
@ -2945,7 +2949,7 @@ Process (nested) sub-expression, create a new result set to store the
sub-expression result by processing nodes under current sub-expression
list. Merge the sub-expression result with that of parent expression list.
@return DB_SUCCESS if all well */
UNIV_INTERN
static
dberr_t
fts_ast_visit_sub_exp(
/*==================*/
@ -2965,6 +2969,14 @@ fts_ast_visit_sub_exp(
ut_a(node->type == FTS_AST_SUBEXP_LIST);
/* To avoid stack overflow, we limit the mutual recursion
depth between fts_ast_visit(), fts_query_visitor() and
fts_ast_visit_sub_exp(). */
if (query->visiting_sub_exp++ > 31) {
query->error = DB_OUT_OF_MEMORY;
DBUG_RETURN(query->error);
}
cur_oper = query->oper;
/* Save current result set */
@ -2987,6 +2999,7 @@ fts_ast_visit_sub_exp(
/* Reinstate parent node state */
query->multi_exist = multi_exist;
query->oper = cur_oper;
query->visiting_sub_exp--;
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;

View File

@ -864,6 +864,10 @@ struct dict_foreign_t{
does not generate new indexes
implicitly */
dict_index_t* referenced_index;/*!< referenced index */
/** Check whether the fulltext index gets affected by
foreign key constraint */
bool affects_fulltext() const;
};
std::ostream&

View File

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2018, MariaDB Corporation.
Copyright (c) 2016, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -204,19 +204,6 @@ fts_ast_visit(
operator, currently we only
ignore FTS_IGNORE operator */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*****************************************************************//**
Process (nested) sub-expression, create a new result set to store the
sub-expression result by processing nodes under current sub-expression
list. Merge the sub-expression result with that of parent expression list.
@return DB_SUCCESS if all went well */
UNIV_INTERN
dberr_t
fts_ast_visit_sub_exp(
/*==================*/
fts_ast_node_t* node, /*!< in: instance to traverse*/
fts_ast_callback visitor, /*!< in: callback */
void* arg) /*!< in: callback arg */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/********************************************************************
Create a lex instance.*/
UNIV_INTERN

View File

@ -516,7 +516,7 @@ row_ins_cascade_calc_update_vec(
n_fields_updated = 0;
*fts_col_affected = FALSE;
*fts_col_affected = foreign->affects_fulltext();
if (table->fts) {
doc_id_pos = dict_table_get_nth_col_pos(
@ -637,16 +637,6 @@ row_ins_cascade_calc_update_vec(
padded_data, min_size);
}
/* Check whether the current column has
FTS index on it */
if (table->fts
&& dict_table_is_fts_column(
table->fts->indexes,
dict_col_get_no(col))
!= ULINT_UNDEFINED) {
*fts_col_affected = TRUE;
}
/* If Doc ID is updated, check whether the
Doc ID is valid */
if (table->fts
@ -983,7 +973,6 @@ row_ins_foreign_check_on_constraint(
upd_t* update;
ulint n_to_update;
dberr_t err;
ulint i;
trx_t* trx;
mem_heap_t* tmp_heap = NULL;
doc_id_t doc_id = FTS_NULL_DOC_ID;
@ -1197,7 +1186,7 @@ row_ins_foreign_check_on_constraint(
UNIV_MEM_INVALID(update->fields,
update->n_fields * sizeof *update->fields);
for (i = 0; i < foreign->n_fields; i++) {
for (ulint i = 0; i < foreign->n_fields; i++) {
upd_field_t* ufield = &update->fields[i];
ufield->field_no = dict_table_get_nth_col_pos(
@ -1206,32 +1195,14 @@ row_ins_foreign_check_on_constraint(
ufield->orig_len = 0;
ufield->exp = NULL;
dfield_set_null(&ufield->new_val);
if (table->fts && dict_table_is_fts_column(
table->fts->indexes,
dict_index_get_nth_col_no(index, i))
!= ULINT_UNDEFINED) {
fts_col_affacted = TRUE;
}
}
if (fts_col_affacted) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
} else if (table->fts && cascade->is_delete) {
/* DICT_FOREIGN_ON_DELETE_CASCADE case */
for (i = 0; i < foreign->n_fields; i++) {
if (table->fts && dict_table_is_fts_column(
table->fts->indexes,
dict_index_get_nth_col_no(index, i))
!= ULINT_UNDEFINED) {
fts_col_affacted = TRUE;
}
}
if (fts_col_affacted) {
if (foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
} else if (table->fts && cascade->is_delete
&& foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
if (!node->is_delete