1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-09 11:41:36 +03:00

Merge branch 'bb-11.8-release' into bb-12.1-release

This commit is contained in:
Oleksandr Byelkin
2025-11-04 22:47:26 +01:00
184 changed files with 3745 additions and 1373 deletions

View File

@@ -163,6 +163,7 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock"
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
SET(INSTALL_RUNDATADIR_RPM "/run/mariadb")
SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security") SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security")
SET(INSTALL_PAMDATADIR_RPM "/etc/security") SET(INSTALL_PAMDATADIR_RPM "/etc/security")
@@ -193,7 +194,8 @@ SET(INSTALL_SUPPORTFILESDIR_DEB "share/mariadb")
# #
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_UNIX_ADDRDIR_DEB "/run/mysqld/mysqld.sock") SET(INSTALL_RUNDATADIR_DEB "/run/mysqld")
SET(INSTALL_UNIX_ADDRDIR_DEB "${INSTALL_RUNDATADIR_DEB}/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")
@@ -257,3 +259,7 @@ IF(NOT MYSQL_UNIX_ADDR)
SET(MYSQL_UNIX_ADDR ${INSTALL_UNIX_ADDRDIR}) SET(MYSQL_UNIX_ADDR ${INSTALL_UNIX_ADDRDIR})
ENDIF() ENDIF()
IF(NOT INSTALL_RUNDATADIR)
get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
SET(INSTALL_RUNDATADIR "${MYSQL_UNIX_DIR}" CACHE FILEPATH "Rundata installation directory" ${FORCE})
ENDIF()

View File

@@ -50,8 +50,7 @@ MACRO(CHECK_SYSTEMD)
SET(SYSTEMD_SCRIPTS ${SYSTEMD_SCRIPTS} galera_recovery) SET(SYSTEMD_SCRIPTS ${SYSTEMD_SCRIPTS} galera_recovery)
ENDIF() ENDIF()
IF(DEB) IF(DEB)
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=+/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld") SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=!/etc/mysql/debian-start")
SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=+/etc/mysql/debian-start")
ENDIF() ENDIF()
IF(URING_FOUND) IF(URING_FOUND)
SET(SYSTEMD_LIMIT "# For liburing and io_uring_setup() SET(SYSTEMD_LIMIT "# For liburing and io_uring_setup()

18
debian/control vendored
View File

@@ -980,8 +980,7 @@ Description: Connect storage engine JDBC interface for MariaDB server.
Package: mariadb-plugin-s3 Package: mariadb-plugin-s3
Architecture: any Architecture: any
Depends: libcurl4, Depends: mariadb-server (= ${server:Version}),
mariadb-server (= ${server:Version}),
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Description: Amazon S3 archival storage engine for MariaDB Description: Amazon S3 archival storage engine for MariaDB
@@ -1010,8 +1009,7 @@ Description: RocksDB storage engine for MariaDB server
Package: mariadb-plugin-oqgraph Package: mariadb-plugin-oqgraph
Architecture: any Architecture: any
Depends: libjudydebian1, Depends: mariadb-server (= ${server:Version}),
mariadb-server (= ${server:Version}),
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Breaks: mariadb-oqgraph-engine-10.0, Breaks: mariadb-oqgraph-engine-10.0,
@@ -1076,8 +1074,7 @@ Description: Spider storage engine for MariaDB server
Package: mariadb-plugin-gssapi-server Package: mariadb-plugin-gssapi-server
Architecture: any Architecture: any
Depends: libgssapi-krb5-2, Depends: mariadb-server (= ${server:Version}),
mariadb-server,
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Breaks: mariadb-gssapi-server-10.1, Breaks: mariadb-gssapi-server-10.1,
@@ -1100,8 +1097,7 @@ Description: GSSAPI authentication plugin for MariaDB server
Package: mariadb-plugin-gssapi-client Package: mariadb-plugin-gssapi-client
Architecture: any Architecture: any
Depends: libgssapi-krb5-2, Depends: mariadb-client (= ${binary:Version}),
mariadb-client (= ${binary:Version}),
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Breaks: mariadb-gssapi-client-10.1, Breaks: mariadb-gssapi-client-10.1,
@@ -1120,8 +1116,7 @@ Description: GSSAPI authentication plugin for MariaDB client
Package: mariadb-plugin-cracklib-password-check Package: mariadb-plugin-cracklib-password-check
Architecture: any Architecture: any
Depends: libcrack2 (>= 2.9.0), Depends: mariadb-server,
mariadb-server,
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB server Description: CrackLib Password Validation Plugin for MariaDB server
@@ -1134,8 +1129,7 @@ Description: CrackLib Password Validation Plugin for MariaDB server
Package: mariadb-plugin-hashicorp-key-management Package: mariadb-plugin-hashicorp-key-management
Architecture: any Architecture: any
Depends: libcurl4, Depends: mariadb-server,
mariadb-server,
${misc:Depends}, ${misc:Depends},
${shlibs:Depends} ${shlibs:Depends}
Description: Hashicorp Key Management plugin for MariaDB Description: Hashicorp Key Management plugin for MariaDB

View File

@@ -15,6 +15,7 @@ lib/systemd/system/mariadb@.socket
lib/systemd/system/mysql.service lib/systemd/system/mysql.service
lib/systemd/system/mysqld.service lib/systemd/system/mysqld.service
support-files/rpm/enable_encryption.preset etc/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset support-files/rpm/enable_encryption.preset etc/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset
usr/lib/tmpfiles.d/mariadb.conf
usr/bin/aria_chk usr/bin/aria_chk
usr/bin/aria_dump_log usr/bin/aria_dump_log
usr/bin/aria_ftdump usr/bin/aria_ftdump

View File

@@ -22,7 +22,6 @@ usr/lib/*/pkgconfig/mariadb.pc
usr/bin/uca-dump usr/bin/uca-dump
usr/bin/wsrep_sst_backup usr/bin/wsrep_sst_backup
usr/lib/sysusers.d/mariadb.conf # Not used (yet) in Debian systemd usr/lib/sysusers.d/mariadb.conf # Not used (yet) in Debian systemd
usr/lib/tmpfiles.d/mariadb.conf # Not used (yet) in Debian systemd
usr/sbin/rcmysql usr/sbin/rcmysql
usr/share/doc/mariadb-server/COPYING (related file: "debian/tmp/usr/share/mariadb/mroonga/COPYING") usr/share/doc/mariadb-server/COPYING (related file: "debian/tmp/usr/share/mariadb/mroonga/COPYING")
usr/share/doc/mariadb-server/CREDITS usr/share/doc/mariadb-server/CREDITS

View File

@@ -25,6 +25,12 @@ typedef struct st_typelib { /* Different types saved here */
const char *name; /* Name of typelib */ const char *name; /* Name of typelib */
const char **type_names; const char **type_names;
unsigned int *type_lengths; unsigned int *type_lengths;
/*
An array of indexes of enum values that are no longer supported and so are
hidden. One cannot specify hidden values, an attempt to do so will produce
a warning (while an attempt to use a name that was never part of this set
will produce an error).
*/
const int *hidden_values; const int *hidden_values;
} TYPELIB; } TYPELIB;

View File

@@ -1,23 +1,4 @@
# #
# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
#
SET @max_session_mem_used_save= @@max_session_mem_used;
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
a
ALTER TABLE x MODIFY xx INT;
ERROR 42S02: Table 'test.x' doesn't exist
SET SESSION max_session_mem_used= 8192;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
SET SESSION max_session_mem_used = @max_session_mem_used_save;
UNLOCK TABLES;
DROP TABLE t1;
#
# End of 10.5 tests
#
#
# MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON # MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
# #
create table t1 (f int) engine=innodb; create table t1 (f int) engine=innodb;
@@ -58,9 +39,6 @@ alter online table t1 add column s blob not null, algorithm=inplace;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
drop table t1; drop table t1;
# #
# End of 10.11 tests
#
#
# MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER # MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER
# #
CREATE TABLE t (a INT) ENGINE=MyISAM; CREATE TABLE t (a INT) ENGINE=MyISAM;
@@ -76,6 +54,4 @@ disconnect con1;
connection default; connection default;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t; DROP TABLE t;
#
# End of 11.4 tests # End of 11.4 tests
#

View File

@@ -1,36 +1,6 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--echo #
--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
--echo #
SET @max_session_mem_used_save= @@max_session_mem_used;
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
--error ER_NO_SUCH_TABLE
ALTER TABLE x MODIFY xx INT;
SET SESSION max_session_mem_used= 8192;
--error 0,ER_OPTION_PREVENTS_STATEMENT
LOCK TABLE t1 WRITE;
--disable_warnings
--error 0,ER_OPTION_PREVENTS_STATEMENT
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
--enable_warnings
SET SESSION max_session_mem_used = @max_session_mem_used_save;
UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--echo # --echo #
--echo # MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --echo # MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
--echo # --echo #
@@ -75,10 +45,6 @@ lock table t1 write;
alter online table t1 add column s blob not null, algorithm=inplace; alter online table t1 add column s blob not null, algorithm=inplace;
drop table t1; drop table t1;
--echo #
--echo # End of 10.11 tests
--echo #
--echo # --echo #
--echo # MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER --echo # MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER
--echo # --echo #
@@ -97,6 +63,4 @@ ALTER TABLE IF EXISTS t FORCE;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # End of 11.4 tests --echo # End of 11.4 tests
--echo #

View File

@@ -1036,6 +1036,71 @@ set statement optimizer_switch='split_materialized=off' for $query;
a b name total_amt a b name total_amt
1 NULL A 10 1 NULL A 10
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-37407 Wrong result with ORDER BY LIMIT
# Both, with and without split_materialized should
# produce the same results
#
SET @save_optimizer_switch= @@optimizer_switch;
CREATE TABLE t1
(a varchar(35), b varchar(4), KEY (a))
ENGINE=InnoDB;
INSERT INTO t1 VALUES
('Albania','AXA'), ('Australia','AUS'), ('Myanmar','MMR'),
('Bahamas','BS'), ('Brazil','BRA'), ('Barbados','BRB');
CREATE TABLE t2
(a varchar(4), b varchar(50), PRIMARY KEY (b,a), KEY (a))
ENGINE=InnoDB;
INSERT INTO t2 VALUES
('AUS','Anglican'), ('MMR','Baptist'), ('BS','Anglican'),
('BS','Baptist'), ('BS','Methodist'), ('BRB','Methodist'),
('BRA','Baptist'), ('USA','Baptist');
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
ANALYZE TABLE t2 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
set optimizer_switch='split_materialized=off';
SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY a, COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON
dt.a=t1.b
WHERE t1.a LIKE 'B%';
a
set optimizer_switch='split_materialized=on';
SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY a, COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON
dt.a=t1.b
WHERE t1.a LIKE 'B%';
a
DROP TABLE t1,t2;
SET optimizer_switch= @save_optimizer_switch;
#
# MDEV-29638 Crash when considering Split-Materialized plan
#
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='condition_pushdown_for_derived=off,split_materialized=on';
CREATE TABLE t1 (id int PRIMARY KEY)engine=innodb;
CREATE TABLE t2 (id int PRIMARY KEY, c int) engine=innodb;
CREATE TABLE t3 (id int PRIMARY KEY, a int , b int, KEY (a))engine=innodb;
SELECT * FROM
(
SELECT DISTINCT t1.id
FROM t1 JOIN
(
SELECT t2.id FROM t2 JOIN t3
ON t3.id = t2.c
WHERE (t3.a > 2 AND t3.b = 2)
GROUP BY t2.id
) m2 ON m2.id = t1.id
) dt;
id
drop table t1, t2, t3;
SET optimizer_switch= @save_optimizer_switch;
# End of 10.11 tests # End of 10.11 tests
# #
# MDEV-37057 Wrong result with LATERAL DERIVED # MDEV-37057 Wrong result with LATERAL DERIVED

View File

@@ -632,6 +632,77 @@ evalp set statement optimizer_switch='split_materialized=off' for $query;
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # MDEV-37407 Wrong result with ORDER BY LIMIT
--echo # Both, with and without split_materialized should
--echo # produce the same results
--echo #
SET @save_optimizer_switch= @@optimizer_switch;
CREATE TABLE t1
(a varchar(35), b varchar(4), KEY (a))
ENGINE=InnoDB;
INSERT INTO t1 VALUES
('Albania','AXA'), ('Australia','AUS'), ('Myanmar','MMR'),
('Bahamas','BS'), ('Brazil','BRA'), ('Barbados','BRB');
CREATE TABLE t2
(a varchar(4), b varchar(50), PRIMARY KEY (b,a), KEY (a))
ENGINE=InnoDB;
INSERT INTO t2 VALUES
('AUS','Anglican'), ('MMR','Baptist'), ('BS','Anglican'),
('BS','Baptist'), ('BS','Methodist'), ('BRB','Methodist'),
('BRA','Baptist'), ('USA','Baptist');
ANALYZE TABLE t1 PERSISTENT FOR ALL;
ANALYZE TABLE t2 PERSISTENT FOR ALL;
let $q=
SELECT t1.a
FROM (SELECT a FROM t2 GROUP BY a ORDER BY a, COUNT(DISTINCT b) LIMIT 1) dt
JOIN t1 ON
dt.a=t1.b
WHERE t1.a LIKE 'B%';
set optimizer_switch='split_materialized=off';
eval $q;
set optimizer_switch='split_materialized=on';
eval $q;
DROP TABLE t1,t2;
SET optimizer_switch= @save_optimizer_switch;
--echo #
--echo # MDEV-29638 Crash when considering Split-Materialized plan
--echo #
set @save_optimizer_switch= @@optimizer_switch;
set optimizer_switch='condition_pushdown_for_derived=off,split_materialized=on';
CREATE TABLE t1 (id int PRIMARY KEY)engine=innodb;
CREATE TABLE t2 (id int PRIMARY KEY, c int) engine=innodb;
CREATE TABLE t3 (id int PRIMARY KEY, a int , b int, KEY (a))engine=innodb;
SELECT * FROM
(
SELECT DISTINCT t1.id
FROM t1 JOIN
(
SELECT t2.id FROM t2 JOIN t3
ON t3.id = t2.c
WHERE (t3.a > 2 AND t3.b = 2)
GROUP BY t2.id
) m2 ON m2.id = t1.id
) dt;
drop table t1, t2, t3;
SET optimizer_switch= @save_optimizer_switch;
--echo # End of 10.11 tests --echo # End of 10.11 tests
--echo # --echo #

View File

@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index 1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
explain SELECT distinct a from t3 order by a desc limit 2; explain SELECT distinct a from t3 order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index NULL a 5 NULL 40 Using index 1 SIMPLE t3 range a a 5 NULL 10 Using index for group-by; Using temporary; Using filesort
explain SELECT distinct a,b from t3 order by a+1; explain SELECT distinct a,b from t3 order by a+1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort 1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort

View File

@@ -125,13 +125,4 @@ SELECT f1(1);
Got one of the listed errors Got one of the listed errors
DROP FUNCTION f1; DROP FUNCTION f1;
SET debug_dbug= @saved_dbug; SET debug_dbug= @saved_dbug;
#
# MDEV-27978 wrong option name in error when exceeding max_session_mem_used
#
SET SESSION max_session_mem_used = 8192;
SELECT * FROM information_schema.processlist;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET SESSION max_session_mem_used = DEFAULT;
#
# End of 10.2 tests # End of 10.2 tests
#

View File

@@ -144,8 +144,6 @@ SELECT a FROM t1 ORDER BY rand(1);
--echo #cleanup --echo #cleanup
DROP TABLE t1, pid_table; DROP TABLE t1, pid_table;
--echo # --echo #
--echo # MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash --echo # MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
--echo # --echo #
@@ -158,15 +156,4 @@ SELECT f1(1);
DROP FUNCTION f1; DROP FUNCTION f1;
SET debug_dbug= @saved_dbug; SET debug_dbug= @saved_dbug;
--echo #
--echo # MDEV-27978 wrong option name in error when exceeding max_session_mem_used
--echo #
SET SESSION max_session_mem_used = 8192;
--error ER_OPTION_PREVENTS_STATEMENT
SELECT * FROM information_schema.processlist;
SET SESSION max_session_mem_used = DEFAULT;
--echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo #

View File

@@ -1,4 +1,3 @@
drop table if exists t1;
insert into t1 values(1); insert into t1 values(1);
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
delete from t1; delete from t1;
@@ -170,12 +169,6 @@ UPDATE t1 SET a = 'new'
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
ERROR 22007: Illegal value used as argument of dynamic column function ERROR 22007: Illegal value used as argument of dynamic column function
drop table t1; drop table t1;
set @max_session_mem_used_save= @@max_session_mem_used;
set max_session_mem_used = 50000;
select * from seq_1_to_1000;
set max_session_mem_used = 8192;
select * from seq_1_to_1000;
set max_session_mem_used = @max_session_mem_used_save;
# #
# MDEV-20604: Duplicate key value is silently truncated to 64 # MDEV-20604: Duplicate key value is silently truncated to 64
# characters in print_keydup_error # characters in print_keydup_error
@@ -231,16 +224,3 @@ Error 1327 Undeclared variable: foo
Error 1305 PROCEDURE P1 does not exist Error 1305 PROCEDURE P1 does not exist
drop procedure P1; drop procedure P1;
# End of 10.4 tests # End of 10.4 tests
#
# MDEV-35828: Assertion fails in alloc_root() when memory causes it to call itself
#
CREATE TEMPORARY TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
SET
@tmp=@@max_session_mem_used,
max_session_mem_used=8192;
SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
DROP TABLE t1;
SET max_session_mem_used=@tmp;
# End of 10.6 tests

View File

@@ -3,31 +3,28 @@
# #
--source include/have_sequence.inc --source include/have_sequence.inc
--disable_warnings --error ER_NO_SUCH_TABLE
drop table if exists t1;
--enable_warnings
--error 1146
insert into t1 values(1); insert into t1 values(1);
--error 1146 --error ER_NO_SUCH_TABLE
delete from t1; delete from t1;
--error 1146 --error ER_NO_SUCH_TABLE
update t1 set a=1; update t1 set a=1;
create table t1 (a int); create table t1 (a int);
--error 1054 --error ER_BAD_FIELD_ERROR
select count(test.t1.b) from t1; select count(test.t1.b) from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
select count(not_existing_database.t1) from t1; select count(not_existing_database.t1) from t1;
--error 1054 --error ER_BAD_FIELD_ERROR
select count(not_existing_database.t1.a) from t1; select count(not_existing_database.t1.a) from t1;
--error 1044,1146 --error ER_DBACCESS_DENIED_ERROR,ER_NO_SUCH_TABLE
select count(not_existing_database.t1.a) from not_existing_database.t1; select count(not_existing_database.t1.a) from not_existing_database.t1;
--error 1054 --error ER_BAD_FIELD_ERROR
select 1 from t1 order by 2; select 1 from t1 order by 2;
--error 1054 --error ER_BAD_FIELD_ERROR
select 1 from t1 group by 2; select 1 from t1 group by 2;
--error 1054 --error ER_BAD_FIELD_ERROR
select 1 from t1 order by t1.b; select 1 from t1 order by t1.b;
--error 1054 --error ER_BAD_FIELD_ERROR
select count(*),b from t1; select count(*),b from t1;
drop table t1; drop table t1;
@@ -36,10 +33,10 @@ drop table t1;
# #
# Bug #6080: Error message for a field with a display width that is too long # Bug #6080: Error message for a field with a display width that is too long
# #
--error 1439 --error ER_TOO_BIG_DISPLAYWIDTH
create table t1 (a int(256)); create table t1 (a int(256));
set sql_mode='traditional'; set sql_mode='traditional';
--error 1074 --error ER_TOO_BIG_FIELDLENGTH
create table t1 (a varchar(66000)); create table t1 (a varchar(66000));
set sql_mode=default; set sql_mode=default;
@@ -95,7 +92,7 @@ delimiter ;|
flush status; flush status;
--disable_ps2_protocol --disable_ps2_protocol
--error 1062 --error ER_DUP_ENTRY
select f1(), f2(); select f1(), f2();
--enable_ps2_protocol --enable_ps2_protocol
show status like 'Com_insert'; show status like 'Com_insert';
@@ -202,24 +199,6 @@ UPDATE t1 SET a = 'new'
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
drop table t1; drop table t1;
#
# errors caused by max_session_mem_used
#
set @max_session_mem_used_save= @@max_session_mem_used;
--disable_result_log
set max_session_mem_used = 50000;
--error 0,ER_OPTION_PREVENTS_STATEMENT
select * from seq_1_to_1000;
set max_session_mem_used = 8192;
--error 0,ER_OPTION_PREVENTS_STATEMENT
select * from seq_1_to_1000;
--enable_result_log
# We may not be able to execute any more queries with this connection
# because of too little memory#
set max_session_mem_used = @max_session_mem_used_save;
--echo # --echo #
--echo # MDEV-20604: Duplicate key value is silently truncated to 64 --echo # MDEV-20604: Duplicate key value is silently truncated to 64
--echo # characters in print_keydup_error --echo # characters in print_keydup_error
@@ -283,24 +262,4 @@ show warnings;
drop procedure P1; drop procedure P1;
-- echo # End of 10.4 tests --echo # End of 10.4 tests
--echo #
--echo # MDEV-35828: Assertion fails in alloc_root() when memory causes it to call itself
--echo #
CREATE TEMPORARY TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
SET
@tmp=@@max_session_mem_used,
max_session_mem_used=8192;
--error ER_OPTION_PREVENTS_STATEMENT
SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1;
DROP TABLE t1;
SET max_session_mem_used=@tmp;
--echo # End of 10.6 tests

View File

@@ -846,7 +846,7 @@ group by first_name, last_name
order by first_name order by first_name
fetch first 2 rows with ties; fetch first 2 rows with ties;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range t1_name t1_name 206 NULL 3 Using where; Using index for group-by 1 SIMPLE t1 range t1_name t1_name 206 NULL 3 Using where; Using index for group-by; Using temporary; Using filesort
select first_name, last_name select first_name, last_name
from t1 from t1
where first_name != 'John' where first_name != 'John'
@@ -871,7 +871,7 @@ select * from temp_table
order by first_name, last_name; order by first_name, last_name;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using filesort 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using filesort
2 DERIVED t1 range t1_name t1_name 206 NULL 3 Using where; Using index for group-by 2 DERIVED t1 range t1_name t1_name 206 NULL 3 Using where; Using index for group-by; Using temporary; Using filesort
with temp_table as ( with temp_table as (
select first_name, last_name select first_name, last_name
from t1 from t1
@@ -1462,3 +1462,88 @@ a b
3 bar 3 bar
3 zzz 3 zzz
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-37901: Wrong result with Loose Scan on QUICK_GROUP_MIN_MAX_SELECT WITH TIES
#
create table t1 (
country varchar(100),
city varchar(100),
user_score int,
index (country, city, user_score)
);
insert into t1
select 'China', 'Shenzhen', seq from seq_10_to_100;
insert into t1
select 'India', 'New Delhi', seq from seq_10_to_100;
insert into t1
select 'Sri Lanka', 'Colombo', seq from seq_10_to_100;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
insert into t1
select 'Finland', 'Espoo', seq from seq_10_to_200;
insert into t1
select 'Greece', 'Chania', seq from seq_10_to_20;
insert into t1
select 'Estonia', 'Narva', seq from seq_10_to_20;
insert into t1
select 'Russia', 'St Petersburg', seq from seq_10_to_20;
# Must use "Using index for group-by":
explain
select country, city, min(user_score)
from t1
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL country 811 NULL 4 Using where; Using index for group-by; Using temporary; Using filesort
# Must not use "Using index for group-by":
explain
select country, city, sum(user_score)
from t1
where user_score between 9 and 199
group by country, concat(city,'AA')
order by country
fetch first 5 rows with ties;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL country 811 NULL 273 Using where; Using index; Using temporary; Using filesort
select country, city, sum(user_score)
from t1
where user_score between 9 and 199
group by country, concat(city,'AA')
order by country
fetch first 5 rows with ties;
country city sum(user_score)
China Shenzhen 5005
Estonia Narva 165
Finland Espoo 19855
Greece Chania 165
India New Delhi 5005
# both using index and index with group by should produce same result
select country, city, min(user_score)
from t1
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
country city min(user_score)
China Shenzhen 10
Estonia Narva 10
Finland Espoo 10
Greece Chania 10
India New Delhi 10
select country, city, min(user_score)
from t1 use index()
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
country city min(user_score)
China Shenzhen 10
Estonia Narva 10
Finland Espoo 10
Greece Chania 10
India New Delhi 10
drop table t1;

View File

@@ -1095,3 +1095,77 @@ SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES;
# Cleanup # Cleanup
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-37901: Wrong result with Loose Scan on QUICK_GROUP_MIN_MAX_SELECT WITH TIES
--echo #
--source include/have_sequence.inc
create table t1 (
country varchar(100),
city varchar(100),
user_score int,
index (country, city, user_score)
);
insert into t1
select 'China', 'Shenzhen', seq from seq_10_to_100;
insert into t1
select 'India', 'New Delhi', seq from seq_10_to_100;
insert into t1
select 'Sri Lanka', 'Colombo', seq from seq_10_to_100;
analyze table t1 persistent for all;
insert into t1
select 'Finland', 'Espoo', seq from seq_10_to_200;
insert into t1
select 'Greece', 'Chania', seq from seq_10_to_20;
insert into t1
select 'Estonia', 'Narva', seq from seq_10_to_20;
insert into t1
select 'Russia', 'St Petersburg', seq from seq_10_to_20;
--echo # Must use "Using index for group-by":
explain
select country, city, min(user_score)
from t1
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
--echo # Must not use "Using index for group-by":
explain
select country, city, sum(user_score)
from t1
where user_score between 9 and 199
group by country, concat(city,'AA')
order by country
fetch first 5 rows with ties;
select country, city, sum(user_score)
from t1
where user_score between 9 and 199
group by country, concat(city,'AA')
order by country
fetch first 5 rows with ties;
--echo # both using index and index with group by should produce same result
select country, city, min(user_score)
from t1
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
select country, city, min(user_score)
from t1 use index()
where user_score between 9 and 199
group by country, city
order by country
fetch first 5 rows with ties;
drop table t1;

View File

@@ -2713,6 +2713,77 @@ json_detailed('[[123],456]')
SELECT JSON_VALUE(JSON_OBJECT("a", ""), '$.a') = "" AS not_null; SELECT JSON_VALUE(JSON_OBJECT("a", ""), '$.a') = "" AS not_null;
not_null not_null
1 1
#
# MDEV-36319: Wrong result json_table
#
SET @JSON='
{
"SZ": [
{
"NAME": "S0",
"OFFERS": [
{
"NAME": "S0A0"
}
]
},
{
"NAME": "S1",
"OFFERS": [
{
"NAME": "S1A0"
},
{
"NAME": "S1A1"
}
]
},
{
"NAME": "S2",
"OFFERS": [
{
"NAME": "S2A0"
}
]
},
{
"NAME": "S3",
"OFFERS": [
{
"NAME": "S3A0"
}
]
},
{
"NAME": "S4",
"OFFERS": [
{
"NAME": "S4A0"
}
]
},
{
"NAME": "S5",
"OFFERS": [
{
"NAME": "S5A0"
}
]
}
]
}
'
;
# Should return EMPTY result
SELECT * FROM json_table(@JSON, '$.SZ[0].OFFERS[1]'
COLUMNS(NAME VARCHAR(30) PATH '$.NAME')) AS t_sz;
NAME
# Should return S1A1
SELECT * FROM json_table(@JSON, '$.SZ[1].OFFERS[1]'
COLUMNS(NAME VARCHAR(30) PATH '$.NAME')) AS t_sz;
NAME
S1A1
# End of 10.11 Test # End of 10.11 Test
# #
# MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-) # MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-)

View File

@@ -1965,6 +1965,78 @@ select json_detailed('[[123],456]');
SELECT JSON_VALUE(JSON_OBJECT("a", ""), '$.a') = "" AS not_null; SELECT JSON_VALUE(JSON_OBJECT("a", ""), '$.a') = "" AS not_null;
--echo #
--echo # MDEV-36319: Wrong result json_table
--echo #
SET @JSON='
{
"SZ": [
{
"NAME": "S0",
"OFFERS": [
{
"NAME": "S0A0"
}
]
},
{
"NAME": "S1",
"OFFERS": [
{
"NAME": "S1A0"
},
{
"NAME": "S1A1"
}
]
},
{
"NAME": "S2",
"OFFERS": [
{
"NAME": "S2A0"
}
]
},
{
"NAME": "S3",
"OFFERS": [
{
"NAME": "S3A0"
}
]
},
{
"NAME": "S4",
"OFFERS": [
{
"NAME": "S4A0"
}
]
},
{
"NAME": "S5",
"OFFERS": [
{
"NAME": "S5A0"
}
]
}
]
}
'
;
--echo # Should return EMPTY result
SELECT * FROM json_table(@JSON, '$.SZ[0].OFFERS[1]'
COLUMNS(NAME VARCHAR(30) PATH '$.NAME')) AS t_sz;
--echo # Should return S1A1
SELECT * FROM json_table(@JSON, '$.SZ[1].OFFERS[1]'
COLUMNS(NAME VARCHAR(30) PATH '$.NAME')) AS t_sz;
--echo # End of 10.11 Test --echo # End of 10.11 Test
--echo # --echo #

View File

@@ -5415,8 +5415,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1; DROP TABLE t1;
# #
# End of 10.6 tests # MDEV-37947 Item_func_hex doesn't check for max_allowed_packet
# #
select hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex('\\'))))))))))))))))))))))))))))))))))))))))))))) as x;
x
NULL
Warnings:
Warning 1301 Result of hex() was larger than max_allowed_packet (16777216) - truncated
# End of 10.6 tests
# #
# MDEV-25704 Function random_bytes # MDEV-25704 Function random_bytes
# #

View File

@@ -2451,8 +2451,11 @@ SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # End of 10.6 tests --echo # MDEV-37947 Item_func_hex doesn't check for max_allowed_packet
--echo # --echo #
select hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex(hex('\\'))))))))))))))))))))))))))))))))))))))))))))) as x;
--echo # End of 10.6 tests
--echo # --echo #
--echo # MDEV-25704 Function random_bytes --echo # MDEV-25704 Function random_bytes

View File

@@ -2465,7 +2465,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index 1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index 2 SUBQUERY t1 range a a 5 NULL 6 Using index for group-by
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra

View File

@@ -0,0 +1,130 @@
#
# MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
# Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
#
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
a
ALTER TABLE x MODIFY xx INT;
ERROR 42S02: Table 'test.x' doesn't exist
SET SESSION max_session_mem_used= 8192;
LOCK TABLE t1 WRITE;
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
SET SESSION max_session_mem_used = DEFAULT;
UNLOCK TABLES;
DROP TABLE t1;
#
# MDEV-27978 wrong option name in error when exceeding max_session_mem_used
#
SET SESSION max_session_mem_used = 8192;
SELECT * FROM information_schema.processlist;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET SESSION max_session_mem_used = DEFAULT;
set max_session_mem_used = 50000;
select * from seq_1_to_1000;
set max_session_mem_used = 8192;
select * from seq_1_to_1000;
set max_session_mem_used = DEFAULT;
#
# MDEV-35828: Assertion fails in alloc_root() when memory causes it to call itself
#
CREATE TEMPORARY TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
SET max_session_mem_used=8192;
SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET max_session_mem_used=DEFAULT;
DROP TABLE t1;
#
# MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
#
CREATE TABLE t1 (i INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
SET max_session_mem_used=50000;
REPAIR LOCAL TABLE t1 USE_FRM;
REPAIR LOCAL TABLE t1;
DROP TABLE t1;
SET max_session_mem_used=default;
# End of 10.6 tests
#
# MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
#
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
ERROR 42000: FUNCTION test.func does not exist
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with func() defined
CREATE FUNCTION func(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x
10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with multiple functions
CREATE FUNCTION func2(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
BEGIN
SELECT x, y;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y
10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with function and constant default param
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
BEGIN
SELECT x, y, z;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y z
10 10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 3 IN z int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
# End of 11.8 tests

View File

@@ -0,0 +1,179 @@
# memory usage is sensitive to valgrind/ps-protocol/embedded
source include/not_msan.inc;
source include/not_valgrind.inc;
source include/no_protocol.inc;
source include/not_embedded.inc;
source include/have_64bit.inc;
source include/have_sequence.inc;
--echo #
--echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in
--echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK)
--echo #
CREATE TABLE t1 (a INT);
SELECT * FROM t1;
--error ER_NO_SUCH_TABLE
ALTER TABLE x MODIFY xx INT;
SET SESSION max_session_mem_used= 8192;
--error 0,ER_OPTION_PREVENTS_STATEMENT
LOCK TABLE t1 WRITE;
--disable_warnings
--error 0,ER_OPTION_PREVENTS_STATEMENT
ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT;
--enable_warnings
SET SESSION max_session_mem_used = DEFAULT;
UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # MDEV-27978 wrong option name in error when exceeding max_session_mem_used
--echo #
SET SESSION max_session_mem_used = 8192;
--error ER_OPTION_PREVENTS_STATEMENT
SELECT * FROM information_schema.processlist;
SET SESSION max_session_mem_used = DEFAULT;
#
# errors caused by max_session_mem_used
#
--disable_result_log
set max_session_mem_used = 50000;
--error 0,ER_OPTION_PREVENTS_STATEMENT
select * from seq_1_to_1000;
set max_session_mem_used = 8192;
--error 0,ER_OPTION_PREVENTS_STATEMENT
select * from seq_1_to_1000;
--enable_result_log
# We may not be able to execute any more queries with this connection
# because of too little memory
set max_session_mem_used = DEFAULT;
--echo #
--echo # MDEV-35828: Assertion fails in alloc_root() when memory causes it to call itself
--echo #
CREATE TEMPORARY TABLE t1 (a INT,b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
SET max_session_mem_used=8192;
--error ER_OPTION_PREVENTS_STATEMENT
SELECT * FROM (t1 AS t2 LEFT JOIN t1 AS t3 USING (a)),t1;
SET max_session_mem_used=DEFAULT;
DROP TABLE t1;
--echo #
--echo # MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
--echo #
CREATE TABLE t1 (i INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
SET max_session_mem_used=50000;
--disable_result_log
REPAIR LOCAL TABLE t1 USE_FRM;
REPAIR LOCAL TABLE t1;
--enable_result_log
DROP TABLE t1;
SET max_session_mem_used=default;
--echo # End of 10.6 tests
--echo #
--echo # MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
--echo #
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
--ERROR ER_SP_DOES_NOT_EXIST
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with func() defined
--DELIMITER //
CREATE FUNCTION func(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with multiple functions
--DELIMITER //
CREATE FUNCTION func2(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
BEGIN
SELECT x, y;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with function and constant default param
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
BEGIN
SELECT x, y, z;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
--echo # End of 11.8 tests

View File

@@ -0,0 +1 @@
--timezone=GMT-3

View File

@@ -0,0 +1,77 @@
SET timestamp=1000000000;
RESET MASTER;
CREATE TABLE t (i1 int, i2 int, pk int) ;
CREATE TABLE t3 LIKE t ;
ALTER TABLE t3 ENGINE = MERGE UNION (t1,t2);
insert into t values(1,1,1);
flush logs;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Gtid list []
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000001
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX GTID 0-1-1 ddl thread_id=#
/*M!100101 SET @@session.skip_parallel_replication=0*//*!*/;
/*M!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*M!100001 SET @@session.server_id=1*//*!*/;
/*M!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid=<xid>
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=X,@@session.collation_connection=X,@@session.collation_server=X/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t (i1 int, i2 int, pk int)
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX GTID 0-1-2 ddl thread_id=#
/*M!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid=<xid>
SET TIMESTAMP=1000000000/*!*/;
CREATE TABLE t3 LIKE t
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX GTID 0-1-3 ddl thread_id=#
/*M!100001 SET @@session.gtid_seq_no=3*//*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid=<xid>
SET TIMESTAMP=1000000000/*!*/;
ALTER TABLE t3 ENGINE = MERGE UNION (t1,t2)
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX GTID 0-1-4 thread_id=#
/*M!100001 SET @@session.gtid_seq_no=4*//*!*/;
START TRANSACTION
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid=<xid>
SET TIMESTAMP=1000000000/*!*/;
insert into t values(1,1,1)
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid=<xid>
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t,t3;

View File

@@ -0,0 +1,20 @@
--source include/have_binlog_format_mixed.inc
# MDEV-37903 ALTER TABLE ... ENGINE=MRG_MyISAM is not binlogged as DDL
# Fix timestamp to avoid varying results.
SET timestamp=1000000000;
RESET MASTER;
CREATE TABLE t (i1 int, i2 int, pk int) ;
CREATE TABLE t3 LIKE t ;
ALTER TABLE t3 ENGINE = MERGE UNION (t1,t2);
insert into t values(1,1,1);
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ /xid=\d*/xid=<xid>/
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
drop table t,t3;

View File

@@ -2,8 +2,6 @@
# mysqld --help # mysqld --help
# #
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/not_asan.inc
--source include/not_ubsan.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
--source include/have_profiling.inc --source include/have_profiling.inc
--source include/platform.inc --source include/platform.inc

View File

@@ -0,0 +1,162 @@
SET @session_start_value = @@new_mode;
# Small driving table
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1, 1), (2, 2000),(3,300);
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
# Table that will be accessed by an index lookup (`ref` access)
CREATE TABLE t2 (a INT, b INT, KEY key_b(b));
# All t11.b values are NULL
INSERT INTO t2 SELECT seq/100, NULL FROM seq_1_to_1000;
ANALYZE TABLE t2 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
SET @@new_mode = "FIX_INDEX_STATS_FOR_ALL_NULLS";
Warnings:
Warning 4200 The setting 'new_mode=FIX_INDEX_STATS_FOR_ALL_NULLS' is ignored. It only exists for compatibility with old installations and will be removed in a future release
# NULL-rejecting equality t1.b = t2.b will not return any matches
# because all values of t2.b are NULL. So "rows" = 1 for t2 where 1 is
# a special value meaning "very few" rows
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ref key_b key_b 5 test.t1.b 1 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b`
# However, rows estimation for not NULL-rejecting conditions
# must not be affected ("rows" > 1 is expected)
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b <=> t2.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
1 SIMPLE t2 ref key_b key_b 5 test.t1.b 11 100.00 Using index condition; Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <=> `test`.`t2`.`b`
# Insert some non-NULL values and re-collect the stats
INSERT INTO t2 SELECT 1, 1 FROM seq_1_to_100;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS (b) INDEXES (key_b);
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ref key_b key_b 5 test.t1.b 100 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b`
# Test composite index for two columns. Key prefix is used for access
CREATE TABLE t3 (a INT, b INT, KEY key_ab(a,b));
# All t3.b values are NULL
INSERT INTO t3 SELECT seq/100, NULL FROM seq_1_to_1000;
ANALYZE TABLE t3 PERSISTENT FOR COLUMNS(b) INDEXES(key_ab);
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
# NULL-rejecting equality t1.b = t3.b, same as above.
# "rows" must be estimated to 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b = t3.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ref key_ab key_ab 10 test.t1.a,test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t3`.`b` = `test`.`t1`.`b`
# Rows estimation for not NULL-rejecting conditions are not affected
# ("rows" > 1 is expected)
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ref key_ab key_ab 5 test.t1.a 90 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b <=> t3.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ref key_ab key_ab 10 test.t1.a,test.t1.b 11 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <=> `test`.`t3`.`b`
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t3.b is NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ref key_ab key_ab 10 test.t1.a,const 11 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t3`.`b` is null
# In the old mode (null-aware estimation is not enabled), "rows" > 1
SET @@new_mode = "";
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ref key_b key_b 5 test.t1.b 100 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b`
# Insert some non-NULL values and re-collect the stats
INSERT INTO t3 SELECT 1, 1 FROM seq_1_to_100;
ANALYZE TABLE t3 PERSISTENT FOR COLUMNS (b) INDEXES (key_ab);
Table Op Msg_type Msg_text
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
SET @@new_mode = "FIX_INDEX_STATS_FOR_ALL_NULLS";
Warnings:
Warning 4200 The setting 'new_mode=FIX_INDEX_STATS_FOR_ALL_NULLS' is ignored. It only exists for compatibility with old installations and will be removed in a future release
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b = t3.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ref key_ab key_ab 10 test.t1.a,test.t1.b 100 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a` and `test`.`t3`.`b` = `test`.`t1`.`b`
# Test composite index for 3 columns. Key prefix is used for access
CREATE TABLE t4 (a INT, b INT, c INT, KEY key_abc(a,b,c));
# All t3.b values are NULL
INSERT INTO t4 SELECT seq/10, NULL, seq/10 FROM seq_1_to_1000;
ANALYZE TABLE t4 PERSISTENT FOR COLUMNS(b) INDEXES(key_abc);
Table Op Msg_type Msg_text
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status Table is already up to date
# NULL-rejecting equality t1.b = t3.b, same as above.
# "rows" must be estimated to 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b = t4.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t4 ref key_abc key_abc 10 test.t1.a,test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t1` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t1`.`a` and `test`.`t4`.`b` = `test`.`t1`.`b`
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b = t4.b and t1.b = t4.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t4 ref key_abc key_abc 15 test.t1.a,test.t1.b,test.t1.b 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t1` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t1`.`a` and `test`.`t4`.`b` = `test`.`t1`.`b` and `test`.`t4`.`c` = `test`.`t1`.`b`
# "rows" expected to be > 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t4 ref key_abc key_abc 5 test.t1.a 9 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t1` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b <=> t4.c;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t4 ref key_abc key_abc 5 test.t1.a 9 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t1` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <=> `test`.`t4`.`c`
DROP TABLE t1, t2, t3, t4;
# Test for partially covered column
CREATE TABLE t1 (a VARCHAR(10));
INSERT INTO t1 SELECT seq FROM seq_1_to_10;
CREATE TABLE t2 (
a VARCHAR(10),
b VARCHAR(10),
INDEX i1(a, b(5))
);
INSERT INTO t2 SELECT seq, NULL FROM seq_1_to_1000;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS (b) INDEXES (i1);
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
EXPLAIN SELECT * FROM t1, t2 WHERE t2.a=t1.a AND t2.b=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t2 ref i1 i1 66 test.t1.a,test.t1.a 1 Using where
SET @@new_mode = @session_start_value;
DROP TABLE t1, t2;

View File

@@ -0,0 +1,103 @@
--source include/have_sequence.inc
SET @session_start_value = @@new_mode;
--echo # Small driving table
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1, 1), (2, 2000),(3,300);
ANALYZE TABLE t1 PERSISTENT FOR ALL;
--echo # Table that will be accessed by an index lookup (`ref` access)
CREATE TABLE t2 (a INT, b INT, KEY key_b(b));
--echo # All t11.b values are NULL
INSERT INTO t2 SELECT seq/100, NULL FROM seq_1_to_1000;
ANALYZE TABLE t2 PERSISTENT FOR ALL;
SET @@new_mode = "FIX_INDEX_STATS_FOR_ALL_NULLS";
--echo # NULL-rejecting equality t1.b = t2.b will not return any matches
--echo # because all values of t2.b are NULL. So "rows" = 1 for t2 where 1 is
--echo # a special value meaning "very few" rows
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
--echo # However, rows estimation for not NULL-rejecting conditions
--echo # must not be affected ("rows" > 1 is expected)
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b <=> t2.b;
--echo # Insert some non-NULL values and re-collect the stats
INSERT INTO t2 SELECT 1, 1 FROM seq_1_to_100;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS (b) INDEXES (key_b);
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
--echo # Test composite index for two columns. Key prefix is used for access
CREATE TABLE t3 (a INT, b INT, KEY key_ab(a,b));
--echo # All t3.b values are NULL
INSERT INTO t3 SELECT seq/100, NULL FROM seq_1_to_1000;
ANALYZE TABLE t3 PERSISTENT FOR COLUMNS(b) INDEXES(key_ab);
--echo # NULL-rejecting equality t1.b = t3.b, same as above.
--echo # "rows" must be estimated to 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b = t3.b;
--echo # Rows estimation for not NULL-rejecting conditions are not affected
--echo # ("rows" > 1 is expected)
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a;
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b <=> t3.b;
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t3.b is NULL;
--echo # In the old mode (null-aware estimation is not enabled), "rows" > 1
SET @@new_mode = "";
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b;
--echo # Insert some non-NULL values and re-collect the stats
INSERT INTO t3 SELECT 1, 1 FROM seq_1_to_100;
ANALYZE TABLE t3 PERSISTENT FOR COLUMNS (b) INDEXES (key_ab);
SET @@new_mode = "FIX_INDEX_STATS_FOR_ALL_NULLS";
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t3 ON t1.a = t3.a AND t1.b = t3.b;
--echo # Test composite index for 3 columns. Key prefix is used for access
CREATE TABLE t4 (a INT, b INT, c INT, KEY key_abc(a,b,c));
--echo # All t3.b values are NULL
INSERT INTO t4 SELECT seq/10, NULL, seq/10 FROM seq_1_to_1000;
ANALYZE TABLE t4 PERSISTENT FOR COLUMNS(b) INDEXES(key_abc);
--echo # NULL-rejecting equality t1.b = t3.b, same as above.
--echo # "rows" must be estimated to 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b = t4.b;
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b = t4.b and t1.b = t4.c;
--echo # "rows" expected to be > 1
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a;
EXPLAIN EXTENDED SELECT * FROM t1 JOIN t4 ON t1.a = t4.a AND t1.b <=> t4.c;
DROP TABLE t1, t2, t3, t4;
--echo # Test for partially covered column
CREATE TABLE t1 (a VARCHAR(10));
INSERT INTO t1 SELECT seq FROM seq_1_to_10;
CREATE TABLE t2 (
a VARCHAR(10),
b VARCHAR(10),
INDEX i1(a, b(5))
);
INSERT INTO t2 SELECT seq, NULL FROM seq_1_to_1000;
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS (b) INDEXES (i1);
EXPLAIN SELECT * FROM t1, t2 WHERE t2.a=t1.a AND t2.b=t1.a;
SET @@new_mode = @session_start_value;
DROP TABLE t1, t2;

View File

@@ -3794,6 +3794,27 @@ DROP TABLE t1;
# #
# End of 10.5 tests # End of 10.5 tests
# #
#
# MDEV-37913: disable_index_merge_plans causes SELECT data loss when more than 100 ORs
#
CREATE TABLE t1 (
id int primary key,
key1 int,
index(key1)
);
INSERT INTO t1 VALUES
(1, 1),
(2, 1),
(3, 2);
$query;
id key1
1 1
2 1
3 2
drop table t1;
#
# End of 10.11 tests
#
set global innodb_stats_persistent= @innodb_stats_persistent_save; set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages= set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save; @innodb_stats_persistent_sample_pages_save;

View File

@@ -2558,6 +2558,32 @@ DROP TABLE t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # MDEV-37913: disable_index_merge_plans causes SELECT data loss when more than 100 ORs
--echo #
CREATE TABLE t1 (
id int primary key,
key1 int,
index(key1)
);
INSERT INTO t1 VALUES
(1, 1),
(2, 1),
(3, 2);
let $query=`
select concat('select * from t1 where (key1 = 2 AND id = 3) ',
REPEAT(' OR (key1 = 1)', 100))
`;
evalp $query;
drop table t1;
--echo #
--echo # End of 10.11 tests
--echo #
set global innodb_stats_persistent= @innodb_stats_persistent_save; set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages= set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save; @innodb_stats_persistent_sample_pages_save;

View File

@@ -3792,6 +3792,27 @@ DROP TABLE t1;
# #
# End of 10.5 tests # End of 10.5 tests
# #
#
# MDEV-37913: disable_index_merge_plans causes SELECT data loss when more than 100 ORs
#
CREATE TABLE t1 (
id int primary key,
key1 int,
index(key1)
);
INSERT INTO t1 VALUES
(1, 1),
(2, 1),
(3, 2);
$query;
id key1
1 1
2 1
3 2
drop table t1;
#
# End of 10.11 tests
#
set global innodb_stats_persistent= @innodb_stats_persistent_save; set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages= set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save; @innodb_stats_persistent_sample_pages_save;

View File

@@ -1,3 +1,6 @@
#
# MDEV-6610 Assertion `thd->is_error() || thd->killed' failed in mysql_execute_command on executing an SP with repeated CREATE TABLE .. SELECT
#
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
SET @a = 2; SET @a = 2;
CREATE TABLE IF NOT EXISTS t2 (i INT) ENGINE = MyISAM CREATE TABLE IF NOT EXISTS t2 (i INT) ENGINE = MyISAM
@@ -94,6 +97,34 @@ CALL p1();
# Clean up # Clean up
DROP FUNCTION cnt; DROP FUNCTION cnt;
DROP PROCEDURE p1; DROP PROCEDURE p1;
#
# MDEV-37710 ASAN errors in find_type2 upon executing a procedure from sys schema
#
set names utf8mb3 collate utf8mb3_general_ci;
create procedure p1()
begin
declare found int;
repeat
set found = exists (select * from information_schema.routines where routine_name='f');
if (sys.ps_is_consumer_enabled('events_waits_history_long') = 'yes') then
select * from mysql.user;
end if;
select release_all_locks();
until found end repeat;
end$$
select get_lock('p1', 300);
get_lock('p1', 300)
1
call p1();
connect con1,localhost,root,,;
select get_lock('p1', 300);
get_lock('p1', 300)
1
create function f() returns int return 1;
connection default;
drop function f;
drop procedure p1;
set names utf8mb3;
# End of 10.11 tests # End of 10.11 tests
# #
# MDEV-26115: Crash when calling stored function in FOR loop argument # MDEV-26115: Crash when calling stored function in FOR loop argument

View File

@@ -1,6 +1,6 @@
# --echo #
# MDEV-6610 Assertion `thd->is_error() || thd->killed' failed in mysql_execute_command on executing an SP with repeated CREATE TABLE .. SELECT --echo # MDEV-6610 Assertion `thd->is_error() || thd->killed' failed in mysql_execute_command on executing an SP with repeated CREATE TABLE .. SELECT
# --echo #
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
SET @a = 2; SET @a = 2;
@@ -97,6 +97,35 @@ CALL p1();
DROP FUNCTION cnt; DROP FUNCTION cnt;
DROP PROCEDURE p1; DROP PROCEDURE p1;
--echo #
--echo # MDEV-37710 ASAN errors in find_type2 upon executing a procedure from sys schema
--echo #
set names utf8mb3 collate utf8mb3_general_ci;
delimiter $$;
create procedure p1()
begin
declare found int;
repeat
set found = exists (select * from information_schema.routines where routine_name='f');
if (sys.ps_is_consumer_enabled('events_waits_history_long') = 'yes') then
select * from mysql.user;
end if;
select release_all_locks();
until found end repeat;
end$$
delimiter ;$$
select get_lock('p1', 300);
--send call p1()
--connect con1,localhost,root,,
select get_lock('p1', 300);
create function f() returns int return 1;
--connection default
--disable_result_log
--reap
--enable_result_log
drop function f;
drop procedure p1;
set names utf8mb3;
--echo # End of 10.11 tests --echo # End of 10.11 tests

View File

@@ -130,85 +130,4 @@ SET p2 = p2 + 1;
END; END;
DELIMITER ;$$ DELIMITER ;$$
ERROR 42000: This version of MariaDB doesn't yet support 'IN sparam1 <type> DEFAULT <expr>, OUT spparam2 <type>' ERROR 42000: This version of MariaDB doesn't yet support 'IN sparam1 <type> DEFAULT <expr>, OUT spparam2 <type>'
#
# MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
#
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
ERROR 42000: FUNCTION test.func does not exist
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with func() defined
CREATE FUNCTION func(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x
10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with multiple functions
CREATE FUNCTION func2(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
BEGIN
SELECT x, y;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y
10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with function and constant default param
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
BEGIN
SELECT x, y, z;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y z
10 10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 3 IN z int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
# End of 11.8 tests # End of 11.8 tests

View File

@@ -139,96 +139,4 @@ BEGIN
END; END;
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
--echo #
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
--ERROR ER_SP_DOES_NOT_EXIST
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with func() defined
--DELIMITER //
CREATE FUNCTION func(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with multiple functions
--DELIMITER //
CREATE FUNCTION func2(x INT DEFAULT 10) RETURNS INT
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
BEGIN
SELECT x, y;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with function and constant default param
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
BEGIN
SELECT x, y, z;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
--echo # End of 11.8 tests --echo # End of 11.8 tests

View File

@@ -222,91 +222,4 @@ SET p2 = p2 + 1;
END; END;
DELIMITER ;$$ DELIMITER ;$$
ERROR 42000: This version of MariaDB doesn't yet support 'sparam1 IN <type> DEFAULT <expr>, spparam2 OUT <type>' ERROR 42000: This version of MariaDB doesn't yet support 'sparam1 IN <type> DEFAULT <expr>, spparam2 OUT <type>'
#
# MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
#
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
AS
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
ERROR 42000: FUNCTION test.func does not exist
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with func() defined
CREATE FUNCTION func(x INT DEFAULT 10) RETURN INT
AS
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
AS
BEGIN
SELECT x;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x
10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with multiple functions
CREATE FUNCTION func2(x INT DEFAULT 10) RETURN INT
AS
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
AS
BEGIN
SELECT x, y;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y
10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# with function and constant default param
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
AS
BEGIN
SELECT x, y, z;
END;
//
SET SESSION max_session_mem_used=8192;
CALL p0();
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET @@max_session_mem_used=DEFAULT;
CALL p0();
x y z
10 10 10
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def test p0 1 IN x int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 2 IN y int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
def test p0 3 IN z int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
# End of 11.8 tests # End of 11.8 tests

View File

@@ -244,102 +244,4 @@ BEGIN
END; END;
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # MDEV-37489: SIGSEGV in get_param_default_value | store_schema_params
--echo #
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
AS
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
--ERROR ER_SP_DOES_NOT_EXIST
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with func() defined
--DELIMITER //
CREATE FUNCTION func(x INT DEFAULT 10) RETURN INT
AS
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func())
AS
BEGIN
SELECT x;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with multiple functions
--DELIMITER //
CREATE FUNCTION func2(x INT DEFAULT 10) RETURN INT
AS
BEGIN
RETURN x;
END;
//
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2())
AS
BEGIN
SELECT x, y;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
--echo # with function and constant default param
--DELIMITER //
CREATE OR REPLACE PROCEDURE p0 (x INT DEFAULT func(), y INT DEFAULT func2(), z INT DEFAULT 10)
AS
BEGIN
SELECT x, y, z;
END;
//
--DELIMITER ;
SET SESSION max_session_mem_used=8192;
--ERROR ER_OPTION_PREVENTS_STATEMENT
CALL p0();
SET @@max_session_mem_used=DEFAULT;
CALL p0();
SELECT * FROM information_schema.PARAMETERS where specific_name = 'p0';
DROP PROCEDURE p0;
DROP FUNCTION func;
DROP FUNCTION func2;
--echo # End of 11.8 tests --echo # End of 11.8 tests

View File

@@ -624,6 +624,41 @@ id name
4 xxx 4 xxx
5 yyy 5 yyy
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
#
# FederatedX error 10000 on multi-table UPDATE/DELETE
#
connection slave;
DROP TABLE IF EXISTS federated.t1, federated.t2;
CREATE TABLE federated.t1 (a int, b int);
INSERT INTO federated.t1 VALUES (1,1), (2,2), (3,3);
CREATE TABLE federated.t2 (a int, b int);
INSERT INTO federated.t2 VALUES (1,1), (2,2), (4,4);
connection master;
DROP TABLE IF EXISTS federated.t1, federated.t2;
CREATE TABLE federated.t1 (a int, b int)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
CREATE TABLE federated.t2 (a int, b int)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2';
use federated;
# Multi-table UPDATE
UPDATE t1, t2 SET t1.a = 2 WHERE t1.a=t2.a;
# Check the result
SELECT * FROM t1;
a b
2 1
2 2
3 3
# Multi-table DELETE
DELETE FROM t1 USING t1 JOIN t2 ON t1.a = t2.a WHERE t2.b > 1;
SELECT * FROM t1;
a b
3 3
# Another form of multi-table DELETE
DELETE FROM a1 USING t1 AS a1;
SELECT * FROM t1;
a b
DROP TABLES federated.t1, federated.t2, federated.t3, federated.t10, DROP TABLES federated.t1, federated.t2, federated.t3, federated.t10,
federated.t11; federated.t11;
connection slave; connection slave;

View File

@@ -440,6 +440,50 @@ EXECUTE stmt;
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
--echo #
--echo # FederatedX error 10000 on multi-table UPDATE/DELETE
--echo #
connection slave;
DROP TABLE IF EXISTS federated.t1, federated.t2;
CREATE TABLE federated.t1 (a int, b int);
INSERT INTO federated.t1 VALUES (1,1), (2,2), (3,3);
CREATE TABLE federated.t2 (a int, b int);
INSERT INTO federated.t2 VALUES (1,1), (2,2), (4,4);
connection master;
DROP TABLE IF EXISTS federated.t1, federated.t2;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval
CREATE TABLE federated.t1 (a int, b int)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval
CREATE TABLE federated.t2 (a int, b int)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
use federated;
--echo # Multi-table UPDATE
UPDATE t1, t2 SET t1.a = 2 WHERE t1.a=t2.a;
--echo # Check the result
SELECT * FROM t1;
--echo # Multi-table DELETE
DELETE FROM t1 USING t1 JOIN t2 ON t1.a = t2.a WHERE t2.b > 1;
SELECT * FROM t1;
--echo # Another form of multi-table DELETE
DELETE FROM a1 USING t1 AS a1;
SELECT * FROM t1;
DROP TABLES federated.t1, federated.t2, federated.t3, federated.t10, DROP TABLES federated.t1, federated.t2, federated.t3, federated.t10,
federated.t11; federated.t11;

View File

@@ -15,3 +15,4 @@ galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced
galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml
galera_var_notify_cmd : MDEV-37257 WSREP: Notification command failed: 1 (Operation not permitted) galera_var_notify_cmd : MDEV-37257 WSREP: Notification command failed: 1 (Operation not permitted)
galera_var_notify_ssl_ipv6 : MDEV-37257 WSREP: Notification command failed: 1 (Operation not permitted) galera_var_notify_ssl_ipv6 : MDEV-37257 WSREP: Notification command failed: 1 (Operation not permitted)
MDEV-26266 : cannot work reliably

View File

@@ -0,0 +1,15 @@
connection node_2;
connection node_1;
connection node_1;
SET SESSION wsrep_on=OFF;
SET default_storage_engine=MYISAM;
CREATE SEQUENCE t;
SET SESSION wsrep_on=ON;
CREATE INDEX idx ON t (a);
ERROR HY000: Sequence 'test.t' table structure is invalid (Sequence tables cannot have any keys)
DROP SEQUENCE t;
SET default_storage_engine='MYISAM';
CREATE SEQUENCE t INCREMENT BY 0 CACHE=0 ENGINE=InnoDB;
CREATE INDEX c ON t (c);
ERROR HY000: Sequence 'test.t' table structure is invalid (Sequence tables cannot have any keys)
DROP SEQUENCE t;

View File

@@ -0,0 +1,44 @@
connection node_2;
connection node_1;
drop table if exists t1;
drop view if exists t1;
connection node_2;
SELECT @@character_set_server, @@collation_server;
@@character_set_server @@collation_server
utf8mb4 utf8mb4_uca1400_ai_ci
SELECT @@character_set_client, @@collation_connection;
@@character_set_client @@collation_connection
latin1 latin1_swedish_ci
connection node_1;
SET NAMES latin1 COLLATE latin1_bin;
SELECT @@character_set_server, @@collation_server;
@@character_set_server @@collation_server
utf8mb4 utf8mb4_uca1400_ai_ci
SELECT @@character_set_client, @@collation_connection;
@@character_set_client @@collation_connection
latin1 latin1_bin
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_bin
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection node_2;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_bin
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
connection node_1;
DROP VIEW v1;
DROP TABLE t1;
disconnect node_2;
disconnect node_1;

View File

@@ -37,7 +37,7 @@ Function sql_mode Create Function character_set_client collation_connection Data
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci
MODIFIES SQL DATA MODIFIES SQL DATA
COMMENT 'f1_comment' COMMENT 'f1_comment'
RETURN 'abc' utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci RETURN 'abc' latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
connection node_1; connection node_1;
SHOW CREATE FUNCTION f2; SHOW CREATE FUNCTION f2;
Function sql_mode Create Function character_set_client collation_connection Database Collation Function sql_mode Create Function character_set_client collation_connection Database Collation
@@ -53,7 +53,7 @@ f2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_
NO SQL NO SQL
DETERMINISTIC DETERMINISTIC
SQL SECURITY INVOKER SQL SECURITY INVOKER
RETURN 123 utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci RETURN 123 latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
SELECT f1(1) = 'abc'; SELECT f1(1) = 'abc';
f1(1) = 'abc' f1(1) = 'abc'
1 1

View File

@@ -36,7 +36,7 @@ Procedure sql_mode Create Procedure character_set_client collation_connection Da
p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER) p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
MODIFIES SQL DATA MODIFIES SQL DATA
COMMENT 'p1_comment' COMMENT 'p1_comment'
INSERT INTO t1 VALUES (1) utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
connection node_1; connection node_1;
SHOW CREATE PROCEDURE p2; SHOW CREATE PROCEDURE p2;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
@@ -52,7 +52,7 @@ p2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_
NO SQL NO SQL
DETERMINISTIC DETERMINISTIC
SQL SECURITY INVOKER SQL SECURITY INVOKER
BEGIN END utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci BEGIN END latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
CALL p1(@a, @b, @c); CALL p1(@a, @b, @c);
CALL p2('abc'); CALL p2('abc');
connection node_1; connection node_1;

View File

@@ -59,10 +59,10 @@ t2_v2 CREATE TABLE `t2_v2` (
PARTITIONS 2 PARTITIONS 2
SHOW CREATE VIEW x1; SHOW CREATE VIEW x1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2`,`t1_v2`.`v3` AS `v3` from `t1_v2` utf8mb4 utf8mb4_uca1400_ai_ci x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2`,`t1_v2`.`v3` AS `v3` from `t1_v2` latin1 latin1_swedish_ci
SHOW CREATE VIEW x2; SHOW CREATE VIEW x2;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
x2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x2` AS select `t2_v2`.`v1` AS `v1`,`t2_v2`.`v2` AS `v2`,`t2_v2`.`v3` AS `v3` from `t2_v2` utf8mb4 utf8mb4_uca1400_ai_ci x2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x2` AS select `t2_v2`.`v1` AS `v1`,`t2_v2`.`v2` AS `v2`,`t2_v2`.`v3` AS `v3` from `t2_v2` latin1 latin1_swedish_ci
SELECT * FROM t1_v2; SELECT * FROM t1_v2;
v1 v2 v3 v1 v2 v3
SELECT * FROM t2_v2; SELECT * FROM t2_v2;
@@ -148,7 +148,7 @@ t2 CREATE TABLE `t2` (
PARTITIONS 2 PARTITIONS 2
SHOW CREATE VIEW x1; SHOW CREATE VIEW x1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2` from `t1_v2` utf8mb4 utf8mb4_uca1400_ai_ci x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2` from `t1_v2` latin1 latin1_swedish_ci
SELECT * FROM t1_v2; SELECT * FROM t1_v2;
v1 v2 v1 v2
SELECT * FROM t2; SELECT * FROM t2;

View File

@@ -15,7 +15,7 @@ connection node_2;
SHOW CREATE PROCEDURE p1; SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SELECT 1 FROM DUAL utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci SELECT 1 FROM DUAL latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
DROP PROCEDURE p1; DROP PROCEDURE p1;
connection node_1; connection node_1;
CREATE PROCEDURE p1 () SELECT 1 FROM DUAL; CREATE PROCEDURE p1 () SELECT 1 FROM DUAL;
@@ -30,7 +30,7 @@ connection node_2;
SHOW CREATE FUNCTION f1; SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 123 utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci RETURN 123 latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
DROP FUNCTION f1; DROP FUNCTION f1;
connection node_1; connection node_1;
CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123; CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123;
@@ -45,12 +45,12 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a';
connection node_2; connection node_2;
SHOW CREATE TRIGGER tr1; SHOW CREATE TRIGGER tr1;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
tr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci # tr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci #
DROP TABLE t1; DROP TABLE t1;
connection node_1; connection node_1;
CREATE EVENT event1 ON SCHEDULE AT '2038-01-01 23:59:59' DO SELECT 1; CREATE EVENT event1 ON SCHEDULE AT '2038-01-01 23:59:59' DO SELECT 1;
connection node_2; connection node_2;
SHOW CREATE EVENT event1; SHOW CREATE EVENT event1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
event1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `event1` ON SCHEDULE AT '2038-01-01 23:59:59' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO SELECT 1 utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4_uca1400_ai_ci event1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `event1` ON SCHEDULE AT '2038-01-01 23:59:59' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO SELECT 1 latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
DROP EVENT event1; DROP EVENT event1;

View File

@@ -22,16 +22,16 @@ connection node_2;
USE test; USE test;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v2; SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v3; SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v4; SHOW CREATE VIEW v4;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
# On node_1 # On node_1
connection node_1; connection node_1;
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
@@ -42,16 +42,16 @@ ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
connection node_2; connection node_2;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v2; SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v3; SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
SHOW CREATE VIEW v4; SHOW CREATE VIEW v4;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` utf8mb4 utf8mb4_uca1400_ai_ci v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
# Cleanup # Cleanup
DROP VIEW v1, v2, v3, v4; DROP VIEW v1, v2, v3, v4;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -0,0 +1,18 @@
--source include/galera_cluster.inc
--connection node_1
SET SESSION wsrep_on=OFF;
SET default_storage_engine=MYISAM;
CREATE SEQUENCE t;
SET SESSION wsrep_on=ON;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE INDEX idx ON t (a);
DROP SEQUENCE t;
SET default_storage_engine='MYISAM';
CREATE SEQUENCE t INCREMENT BY 0 CACHE=0 ENGINE=InnoDB;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE INDEX c ON t (c);
# cleanup
DROP SEQUENCE t;

View File

@@ -0,0 +1,29 @@
--source include/galera_cluster.inc
--disable_warnings
drop table if exists t1;
drop view if exists t1;
--enable_warnings
--connection node_2
SELECT @@character_set_server, @@collation_server;
SELECT @@character_set_client, @@collation_connection;
--connection node_1
SET NAMES latin1 COLLATE latin1_bin;
SELECT @@character_set_server, @@collation_server;
SELECT @@character_set_client, @@collation_connection;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
SHOW CREATE VIEW v1;
SHOW CREATE TABLE t1;
--connection node_2
SHOW CREATE VIEW v1;
SHOW CREATE TABLE t1;
--connection node_1
DROP VIEW v1;
DROP TABLE t1;
--source include/galera_end.inc

View File

@@ -1,18 +0,0 @@
call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too");
drop database if exists mysqltest;
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
connection default;
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
ERROR HY000: Can't create table `mysqltest`.`testtable` (errno: 177 "Too many active concurrent transactions")
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
connection default;
select count(*) from information_schema.processlist where command != 'Daemon';
count(*)
33
drop database mysqltest;

View File

@@ -1,102 +0,0 @@
# Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
# Don't test under valgrind, undo slots of the previous test might exist still
# and cause unstable result.
--source include/not_valgrind.inc
# undo slots of the previous test might exist still
--source include/not_windows.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: Cannot find a free slot for an undo log. Do you have too");
--disable_query_log
set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
set global innodb_trx_rseg_n_slots_debug = 32;
--enable_query_log
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
--disable_query_log
#
# Insert in 1 transaction which needs over 1 page undo record to avoid the insert_undo cached,
# because the cached insert_undo can be reused at "CREATE TABLE" statement later.
#
START TRANSACTION;
let $c = 1024;
while ($c)
{
eval INSERT INTO mysqltest.transtable (id) VALUES ($c);
dec $c;
}
COMMIT;
let $c = 32;
while ($c)
{
# if failed at here, it might be shortage of file descriptors limit.
connect (con$c,localhost,root,,);
dec $c;
}
--enable_query_log
select count(*) from information_schema.processlist where command != 'Daemon';
#
# fill the all undo slots
#
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
START TRANSACTION;
eval UPDATE mysqltest.transtable SET val = 1 WHERE id = 33 - $c;
dec $c;
}
--enable_query_log
connection default;
--error ER_CANT_CREATE_TABLE
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
select count(*) from information_schema.processlist where command != 'Daemon';
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
ROLLBACK;
dec $c;
}
--enable_query_log
connection default;
select count(*) from information_schema.processlist where command != 'Daemon';
--disable_query_log
let $c = 32;
while ($c)
{
disconnect con$c;
dec $c;
}
--enable_query_log
#
# If the isolated .ibd file remained, the drop database should fail.
#
drop database mysqltest;
--disable_query_log
set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
--enable_query_log

View File

@@ -72,4 +72,108 @@ INSERT INTO t1 SELECT POINTFROMTEXT ('POINT(0 0)') FROM seq_1_to_6;
ROLLBACK; ROLLBACK;
SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-27675 Incorrect r-tree split after group
# assignment causes page overflow
#
CREATE TABLE t1 (f1 INT, f2 INT, f3 VARCHAR(2500),
f4 MULTIPOLYGON NOT NULL,
PRIMARY KEY (f1,f2,f3), SPATIAL(f4)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1,1,'id',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.53,0.23 0.92,0.12 0.53)))')),
(2,2,REPEAT('s',853),MULTIPOLYGONFromText('MULTIPOLYGON(((0.09 0.71,0.92 0.49,0.09 0.71)))')),
(3,3,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.62 0.71,0.62 0.71)))')),
(4,4,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.00 0.06,0.40 0.39,0.61 0.20,0.69 0.91,0.13 0.45,0.71 0.49,0.81 0.52,0.08 0.02,0.00 0.06)))')),
(5,5,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.20,0.45 0.96,0.59 0.46,0.26 0.12,0.45 0.68,0.41 0.10,0.05 0.20)))')),
(6,6,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.30 0.09,0.42 0.27,0.96 0.83,0.81 0.89,0.42 0.16,0.89 0.64,0.30 0.09)))')),
(7,7,'f',MULTIPOLYGONFromText('MULTIPOLYGON(((0.62 0.42,0.12 0.70,0.07 0.24,0.10 0.07,0.92 0.29,0.20 0.52,0.62 0.42)))')),
(8,8,'a',MULTIPOLYGONFromText('MULTIPOLYGON(((0.74 0.96,0.80 0.93,0.61 0.40,0.23 0.49,0.79 0.96,0.67 0.30,0.67 0.25,0.74 0.96)))')),
(9,9,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.18 0.56,0.03 0.48,0.89 0.30,0.79 0.85,0.40 0.92,0.47 0.34,0.38 0.48,0.18 0.56)))')),
(10,10,'ko',MULTIPOLYGONFromText('MULTIPOLYGON(((0.60 0.23,0.03 0.43,0.33 0.94,0.20 0.37,0.60 0.23)))')),
(11,11,'o',MULTIPOLYGONFromText('MULTIPOLYGON(((0.94 0.33,0.16 0.47,0.94 0.33)))')),
(12,12,'bs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.78 0.81,0.71 0.29,0.03 0.85,0.54 0.16,0.23 0.20,0.86 0.77,0.41 0.96,0.85 0.67,0.78 0.81)))')),
(13,13,'z',MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.92,0.61 0.64,0.05 0.75,0.60 1.00,0.47 0.14,0.70 0.92)))')),
(14,14,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.03 0.78,0.83 0.08,0.18 0.49,0.02 0.88,0.62 0.46,0.25 0.53,0.03 0.78)))')),
(15,15,'oaz',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.22,0.73 0.35,0.08 0.39,0.23 0.31,0.84 0.19,0.46 0.77,0.63 0.69,0.12 0.22)))')),
(16,16,'a',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.49,0.48 0.69,0.25 0.87,0.85 0.62,0.96 0.28,0.07 0.70,0.45 0.79,0.87 0.36,0.50 0.49)))')),
(17,17,'cj',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.93,0.03 0.94,0.77 0.06,0.29 0.76,0.82 0.68,0.16 0.59,0.15 0.73,0.72 0.93)))')),
(18,18,REPEAT('r',149),MULTIPOLYGONFromText('MULTIPOLYGON(((0.02 0.67,0.05 0.90,0.68 0.02,0.02 0.67)))')),
(19,19,'ihb',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.40,0.77 0.06,0.61 0.40)),((0.43 0.52,0.77 0.27,0.31 0.49,0.43 0.52)))')),
(20,20,'h',MULTIPOLYGONFromText('MULTIPOLYGON(((0.37 0.98,0.88 0.84,0.18 0.47,0.15 0.77,0.82 0.92,0.66 0.55,0.60 0.02,0.17 0.09,0.37 0.98)))')),
(21,21,'i',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.55,0.85 0.85,0.68 0.24,0.20 0.42,0.67 0.36,0.35 0.25,0.48 0.20,0.89 0.55)))')),
(22,22,'q',MULTIPOLYGONFromText('MULTIPOLYGON(((0.67 0.40,0.63 0.18,0.80 0.66,0.65 0.47,0.66 0.56,0.64 0.97,0.00 0.92,0.66 0.18,0.67 0.40)))')),
(23,23,'kh',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.31,0.33 0.68,0.75 0.35,0.40 0.57,0.94 0.91,0.88 0.23,0.89 0.31)))')),
(24,24,'hbtgc',MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.12,0.73 0.75,0.46 0.85,0.55 0.92,0.12 0.44,0.22 0.13,0.11 0.61,0.99 0.12)))')),
(25,25,REPEAT('t',71),MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.06,0.31 0.98,0.95 0.02,0.84 0.77,0.46 0.09,0.63 0.92,0.35 0.90,0.72 0.06)))')),
(26,26,'g',MULTIPOLYGONFromText('MULTIPOLYGON(((0.18 0.27,0.28 0.15,0.18 0.27)),((0.22 0.55,0.22 0.55)),((0.28 0.70,0.28 0.70)))')),
(27,27,'c',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.28,0.62 0.71,0.04 1.00,0.12 0.57,0.72 0.28)))')),
(28,28,REPEAT('q',885),MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.04,0.62 0.29,0.42 0.82,0.90 0.87,0.79 0.69,0.59 0.99,0.24 0.24,0.69 0.96,0.70 0.04)))')),
(29,29,'oy',MULTIPOLYGONFromText('MULTIPOLYGON(((0.23 0.87,0.51 0.65,0.70 0.97,0.44 0.14,0.25 0.83,0.23 0.87)))')),
(30,30,REPEAT('k',1684),MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.78,0.78 0.99,0.76 0.51,0.25 0.31,0.13 0.86,0.16 0.11,0.45 0.94,0.23 0.98,0.99 0.78)))')),
(31,31,'ylsmiix',MULTIPOLYGONFromText('MULTIPOLYGON(((0.85 0.35,0.03 0.75,0.18 0.31,0.84 0.36,0.92 0.72,0.52 0.93,0.65 0.10,0.55 0.80,0.85 0.35)))')),
(32,32,'ojouw',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.00,0.83 0.45,0.32 0.62,0.36 0.40,0.19 0.95,0.50 0.38,0.30 0.76,0.72 0.00)))')),
(33,33,'ou',MULTIPOLYGONFromText('MULTIPOLYGON(((0.98 0.02,0.01 0.23,0.27 0.11,0.98 0.02)),((0.44 0.54,0.44 0.54)),((0.86 0.97,0.86 0.97)))')),
(34,34,'u',MULTIPOLYGONFromText('MULTIPOLYGON(((0.13 0.07,0.29 0.09,0.53 0.79,0.85 0.66,0.64 0.17,0.22 0.18,0.35 0.39,0.30 0.28,0.13 0.07)))')),
(35,35,'sax',MULTIPOLYGONFromText('MULTIPOLYGON(((0.26 0.03,0.24 0.93,0.15 0.48,0.26 0.03)),((0.73 0.46,0.35 0.63,0.73 0.46)))')),
(36,36,'xmet',MULTIPOLYGONFromText('MULTIPOLYGON(((0.23 0.35,0.35 0.82,0.23 0.35)),((0.29 0.61,0.82 0.54,0.29 0.61)))')),
(37,37,REPEAT('e',276),MULTIPOLYGONFromText('MULTIPOLYGON(((0.65 0.67,0.65 0.67)))')),
(38,38,'ty',MULTIPOLYGONFromText('MULTIPOLYGON(((0.43 0.44,0.64 0.76,0.92 0.59,0.73 0.23,0.43 0.44)))')),
(39,39,'yq',MULTIPOLYGONFromText('MULTIPOLYGON(((0.84 0.27,0.19 0.67,0.84 0.27)),((0.55 0.13,0.39 0.64,0.21 0.70,0.18 0.45,0.55 0.13)))')),
(40,40,'hcsv',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.79,0.83 0.16,0.63 0.80,0.78 0.28,0.88 0.66,0.61 0.79)))')),
(41,41,'csvhlr',MULTIPOLYGONFromText('MULTIPOLYGON(((0.82 0.24,0.31 0.52,0.61 0.67,0.99 0.90,0.05 0.73,0.52 0.18,0.71 0.87,0.82 0.24)))')),
(42,42,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.09 0.21,0.37 0.57,0.81 0.75,0.61 0.16,0.48 0.17,0.29 0.28,0.72 0.46,0.09 0.21)))')),
(43,43,'wd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.06 0.25,0.52 0.23,0.02 0.05,0.06 0.25)),((0.70 0.52,0.44 0.46,0.95 0.47,0.70 0.52)))')),
(44,44,'dg',MULTIPOLYGONFromText('MULTIPOLYGON(((0.81 0.28,0.19 0.17,0.81 0.28)))')),
(45,45,'qtqkyyhkayeoopxmexd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.80 0.66,0.81 0.12,0.83 0.31,0.52 0.29,0.08 0.04,0.80 0.66)))')),
(46,46,'tqk',MULTIPOLYGONFromText('MULTIPOLYGON(((0.95 0.08,0.95 0.08)),((0.09 0.31,0.09 0.31)),((0.38 0.75,0.30 0.04,0.38 0.75)))')),
(47,47,REPEAT('q',925),MULTIPOLYGONFromText('MULTIPOLYGON(((0.56 0.73,0.87 0.11,0.37 0.86,0.48 0.05,0.82 0.55,0.25 0.06,0.19 0.85,0.10 0.75,0.56 0.73)))')),
(48,48,'yhk',MULTIPOLYGONFromText('MULTIPOLYGON(((0.06 0.67,0.41 0.51,0.03 0.83,0.40 0.20,0.16 0.87,0.16 0.07,0.29 0.52,0.06 0.67)))')),
(49,49,'k',MULTIPOLYGONFromText('MULTIPOLYGON(((0.16 0.14,0.16 0.14)),((0.97 0.69,0.45 0.32,0.45 0.38,0.97 0.69)))')),
(50,50,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.00,0.70 0.00)),((0.88 0.53,0.90 0.16,0.88 0.53)))')),
(51,51,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.48 0.06,0.45 0.05,0.03 0.12,0.27 0.80,0.22 0.75,0.53 0.55,0.48 0.06)))')),
(52,52,'o',MULTIPOLYGONFromText('MULTIPOLYGON(((0.32 0.76,0.17 0.43,0.32 0.76)),((0.40 0.79,0.40 0.79)),((0.42 0.34,0.42 0.34)))')),
(53,53,'pxme',MULTIPOLYGONFromText('MULTIPOLYGON(((0.44 0.08,0.02 0.74,0.26 0.21,0.75 0.42,0.91 0.32,0.24 0.65,0.67 0.50,0.44 0.08)))')),
(54,54,'m',MULTIPOLYGONFromText('MULTIPOLYGON(((0.86 0.13,0.21 0.34,0.00 0.87,0.76 0.23,0.69 0.73,0.13 0.63,0.86 0.13)))')),
(55,55,'mex',MULTIPOLYGONFromText('MULTIPOLYGON(((0.84 0.11,0.63 0.13,0.51 0.81,0.58 0.25,0.53 0.29,0.53 0.42,0.84 0.11)))')),
(56,56,REPEAT('e',504),MULTIPOLYGONFromText('MULTIPOLYGON(((0.27 0.84,0.65 0.26,0.75 0.44,0.29 0.52,0.27 0.84)))')),
(57,57,'i',MULTIPOLYGONFromText('MULTIPOLYGON(((0.71 0.84,0.77 0.27,0.45 0.71,0.91 0.01,0.84 0.35,0.71 0.84)))')),
(58,58,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.36,0.02 0.47,0.57 0.76,0.15 0.54,0.12 0.36)))')),
(59,59,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.77 0.80,0.25 0.69,0.34 0.68,0.77 0.80)))')),
(60,60,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.57 0.30,0.58 0.81,0.57 0.30)))')),
(61,61,'nh',MULTIPOLYGONFromText('MULTIPOLYGON(((0.42 0.99,0.42 0.99)))')),
(62,62,'hwi',MULTIPOLYGONFromText('MULTIPOLYGON(((0.40 0.50,0.97 0.34,0.60 0.75,0.26 0.74,0.40 0.50)))')),
(63,63,'id',MULTIPOLYGONFromText('MULTIPOLYGON(((0.30 0.67,0.13 0.43,0.16 0.64,0.04 0.72,0.95 0.87,0.83 0.24,0.17 0.82,0.30 0.67)))')),
(64,64,'toy',MULTIPOLYGONFromText('MULTIPOLYGON(((0.68 0.75,0.92 0.90,0.68 0.75)),((0.58 0.03,0.41 0.09,0.62 0.05,0.58 0.03)))')),
(65,65,'yhawdptl',MULTIPOLYGONFromText('MULTIPOLYGON(((0.95 0.50,0.61 0.35,0.78 0.07,0.67 0.43,0.50 0.70,0.48 0.98,0.95 0.50)))')),
(66,66,'gs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.59 0.06,0.12 0.94,0.05 0.90,0.99 0.22,0.13 0.55,0.59 0.06)))')),
(67,67,'bplb',MULTIPOLYGONFromText('MULTIPOLYGON(((0.33 0.90,0.54 0.11,0.05 0.04,0.59 0.66,0.33 0.90)))')),
(68,68,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.52,0.23 0.54,0.80 0.14,0.88 0.70,0.13 0.67,0.68 0.66,0.50 0.52)))')),
(69,69,'p',MULTIPOLYGONFromText('MULTIPOLYGON(((0.07 0.99,0.11 0.79,0.07 0.99)),((0.50 0.22,0.77 0.58,0.50 0.22)))')),
(70,70,'l',MULTIPOLYGONFromText('MULTIPOLYGON(((0.21 0.75,0.21 0.75)))')),
(71,71,'rwkqhip',MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.89,0.25 0.77,0.99 0.89)))')),
(72,72,'n',MULTIPOLYGONFromText('MULTIPOLYGON(((0.01 0.10,0.01 0.20,0.01 0.10)),((0.83 0.75,0.29 0.21,0.83 0.75)))')),
(73,73,'q',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.03,0.51 0.05,0.27 0.77,0.74 0.06,0.12 0.03)))')),
(74,74,'hipd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.94,0.54 0.92,0.37 0.71,0.89 0.94)))')),
(75,75,'ipdec',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.48,0.07 0.31,0.19 0.23,0.51 0.74,0.50 0.48)))')),
(76,76,'pde',MULTIPOLYGONFromText('MULTIPOLYGON(((0.79 0.42,0.61 0.98,0.13 0.85,0.52 0.16,0.79 0.42)))')),
(77,77,REPEAT('e',1432),MULTIPOLYGONFromText('MULTIPOLYGON(((0.78 0.29,0.42 0.20,0.88 0.86,0.99 0.81,0.78 0.29)))')),
(78,78,'cyhr',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.16,0.62 0.19,0.61 0.16)),((0.62 0.94,0.65 0.53,0.15 0.25,0.71 0.41,0.62 0.94)),((0.67 0.63,0.86 0.60,0.67 0.63)))')),
(79,79,'n',MULTIPOLYGONFromText('MULTIPOLYGON(((0.39 0.89,0.25 0.77,0.22 0.21,0.51 0.19,0.71 0.51,0.39 0.89)))')),
(80,80,'y',MULTIPOLYGONFromText('MULTIPOLYGON(((0.29 0.36,0.29 0.36)))')),
(81,81,'r',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.94,0.93 0.37,0.22 0.07,0.73 0.75,0.99 0.35,0.05 0.94)))')),
(82,82,'w',MULTIPOLYGONFromText('MULTIPOLYGON(((0.33 0.37,0.06 0.59,0.34 0.82,0.73 0.86,0.18 0.78,0.99 0.03,0.33 0.37)))')),
(83,83,REPEAT('g',74),MULTIPOLYGONFromText('MULTIPOLYGON(((0.60 0.54,0.25 0.31,0.60 0.54)))')),
(84,84,REPEAT('s',214),MULTIPOLYGONFromText('MULTIPOLYGON(((0.80 0.34,0.09 0.74,0.47 0.96,0.55 0.19,0.80 0.34)))')),
(85,85,REPEAT('h',223),MULTIPOLYGONFromText('MULTIPOLYGON(((0.76 0.26,0.16 0.85,0.91 0.75,0.64 0.83,0.47 0.02,0.92 0.58,0.76 0.26)))')),
(86,86,'l',MULTIPOLYGONFromText('MULTIPOLYGON(((0.11 0.64,0.41 0.64,0.64 0.64,0.11 0.64)))')),
(87,87,'hj',MULTIPOLYGONFromText('MULTIPOLYGON(((0.66 1.00,0.21 0.96,0.52 0.44,0.94 0.06,0.80 0.39,0.33 0.57,0.30 0.89,0.66 1.00)))')),
(88,88,'axcs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.20 0.66,0.71 0.41,0.32 0.94,0.30 0.66,0.50 0.49,0.60 0.67,0.20 0.66)))')),
(89,89,'cs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.02 0.69,0.80 0.21,0.09 0.23,0.45 0.66,0.10 0.72,0.02 0.69)))')),
(90,90,'f',MULTIPOLYGONFromText('MULTIPOLYGON(((0.87 0.14,0.54 0.83,0.87 0.42,0.36 0.58,0.87 0.14)))')),
(91,91,'icq',MULTIPOLYGONFromText('MULTIPOLYGON(((0.73 0.57,0.36 0.41,0.86 0.33,0.76 0.49,0.44 0.83,0.73 0.57)))')),
(92,92,REPEAT('z',783),MULTIPOLYGONFromText('MULTIPOLYGON(((0.28 0.98,0.05 0.26,0.09 0.59,1.00 0.17,0.55 0.68,0.12 0.04,0.28 0.98)))')),
(93,93,'z',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.89,0.05 0.89)))')),
(94,94,REPEAT('x',1412),MULTIPOLYGONFromText('MULTIPOLYGON(((0.79 0.83,0.12 0.49,0.54 0.63,0.79 0.83)))')),
(95,95,REPEAT('u',2500),MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.55,0.13 0.19,0.72 0.06,0.50 0.55)),((0.73 0.92,0.02 0.48,0.73 0.92)))'));
DROP TABLE t1;
# End of 10.6 tests # End of 10.6 tests

View File

@@ -87,4 +87,109 @@ ROLLBACK;
SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-27675 Incorrect r-tree split after group
--echo # assignment causes page overflow
--echo #
CREATE TABLE t1 (f1 INT, f2 INT, f3 VARCHAR(2500),
f4 MULTIPOLYGON NOT NULL,
PRIMARY KEY (f1,f2,f3), SPATIAL(f4)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1,1,'id',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.53,0.23 0.92,0.12 0.53)))')),
(2,2,REPEAT('s',853),MULTIPOLYGONFromText('MULTIPOLYGON(((0.09 0.71,0.92 0.49,0.09 0.71)))')),
(3,3,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.62 0.71,0.62 0.71)))')),
(4,4,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.00 0.06,0.40 0.39,0.61 0.20,0.69 0.91,0.13 0.45,0.71 0.49,0.81 0.52,0.08 0.02,0.00 0.06)))')),
(5,5,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.20,0.45 0.96,0.59 0.46,0.26 0.12,0.45 0.68,0.41 0.10,0.05 0.20)))')),
(6,6,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.30 0.09,0.42 0.27,0.96 0.83,0.81 0.89,0.42 0.16,0.89 0.64,0.30 0.09)))')),
(7,7,'f',MULTIPOLYGONFromText('MULTIPOLYGON(((0.62 0.42,0.12 0.70,0.07 0.24,0.10 0.07,0.92 0.29,0.20 0.52,0.62 0.42)))')),
(8,8,'a',MULTIPOLYGONFromText('MULTIPOLYGON(((0.74 0.96,0.80 0.93,0.61 0.40,0.23 0.49,0.79 0.96,0.67 0.30,0.67 0.25,0.74 0.96)))')),
(9,9,'j',MULTIPOLYGONFromText('MULTIPOLYGON(((0.18 0.56,0.03 0.48,0.89 0.30,0.79 0.85,0.40 0.92,0.47 0.34,0.38 0.48,0.18 0.56)))')),
(10,10,'ko',MULTIPOLYGONFromText('MULTIPOLYGON(((0.60 0.23,0.03 0.43,0.33 0.94,0.20 0.37,0.60 0.23)))')),
(11,11,'o',MULTIPOLYGONFromText('MULTIPOLYGON(((0.94 0.33,0.16 0.47,0.94 0.33)))')),
(12,12,'bs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.78 0.81,0.71 0.29,0.03 0.85,0.54 0.16,0.23 0.20,0.86 0.77,0.41 0.96,0.85 0.67,0.78 0.81)))')),
(13,13,'z',MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.92,0.61 0.64,0.05 0.75,0.60 1.00,0.47 0.14,0.70 0.92)))')),
(14,14,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.03 0.78,0.83 0.08,0.18 0.49,0.02 0.88,0.62 0.46,0.25 0.53,0.03 0.78)))')),
(15,15,'oaz',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.22,0.73 0.35,0.08 0.39,0.23 0.31,0.84 0.19,0.46 0.77,0.63 0.69,0.12 0.22)))')),
(16,16,'a',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.49,0.48 0.69,0.25 0.87,0.85 0.62,0.96 0.28,0.07 0.70,0.45 0.79,0.87 0.36,0.50 0.49)))')),
(17,17,'cj',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.93,0.03 0.94,0.77 0.06,0.29 0.76,0.82 0.68,0.16 0.59,0.15 0.73,0.72 0.93)))')),
(18,18,REPEAT('r',149),MULTIPOLYGONFromText('MULTIPOLYGON(((0.02 0.67,0.05 0.90,0.68 0.02,0.02 0.67)))')),
(19,19,'ihb',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.40,0.77 0.06,0.61 0.40)),((0.43 0.52,0.77 0.27,0.31 0.49,0.43 0.52)))')),
(20,20,'h',MULTIPOLYGONFromText('MULTIPOLYGON(((0.37 0.98,0.88 0.84,0.18 0.47,0.15 0.77,0.82 0.92,0.66 0.55,0.60 0.02,0.17 0.09,0.37 0.98)))')),
(21,21,'i',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.55,0.85 0.85,0.68 0.24,0.20 0.42,0.67 0.36,0.35 0.25,0.48 0.20,0.89 0.55)))')),
(22,22,'q',MULTIPOLYGONFromText('MULTIPOLYGON(((0.67 0.40,0.63 0.18,0.80 0.66,0.65 0.47,0.66 0.56,0.64 0.97,0.00 0.92,0.66 0.18,0.67 0.40)))')),
(23,23,'kh',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.31,0.33 0.68,0.75 0.35,0.40 0.57,0.94 0.91,0.88 0.23,0.89 0.31)))')),
(24,24,'hbtgc',MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.12,0.73 0.75,0.46 0.85,0.55 0.92,0.12 0.44,0.22 0.13,0.11 0.61,0.99 0.12)))')),
(25,25,REPEAT('t',71),MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.06,0.31 0.98,0.95 0.02,0.84 0.77,0.46 0.09,0.63 0.92,0.35 0.90,0.72 0.06)))')),
(26,26,'g',MULTIPOLYGONFromText('MULTIPOLYGON(((0.18 0.27,0.28 0.15,0.18 0.27)),((0.22 0.55,0.22 0.55)),((0.28 0.70,0.28 0.70)))')),
(27,27,'c',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.28,0.62 0.71,0.04 1.00,0.12 0.57,0.72 0.28)))')),
(28,28,REPEAT('q',885),MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.04,0.62 0.29,0.42 0.82,0.90 0.87,0.79 0.69,0.59 0.99,0.24 0.24,0.69 0.96,0.70 0.04)))')),
(29,29,'oy',MULTIPOLYGONFromText('MULTIPOLYGON(((0.23 0.87,0.51 0.65,0.70 0.97,0.44 0.14,0.25 0.83,0.23 0.87)))')),
(30,30,REPEAT('k',1684),MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.78,0.78 0.99,0.76 0.51,0.25 0.31,0.13 0.86,0.16 0.11,0.45 0.94,0.23 0.98,0.99 0.78)))')),
(31,31,'ylsmiix',MULTIPOLYGONFromText('MULTIPOLYGON(((0.85 0.35,0.03 0.75,0.18 0.31,0.84 0.36,0.92 0.72,0.52 0.93,0.65 0.10,0.55 0.80,0.85 0.35)))')),
(32,32,'ojouw',MULTIPOLYGONFromText('MULTIPOLYGON(((0.72 0.00,0.83 0.45,0.32 0.62,0.36 0.40,0.19 0.95,0.50 0.38,0.30 0.76,0.72 0.00)))')),
(33,33,'ou',MULTIPOLYGONFromText('MULTIPOLYGON(((0.98 0.02,0.01 0.23,0.27 0.11,0.98 0.02)),((0.44 0.54,0.44 0.54)),((0.86 0.97,0.86 0.97)))')),
(34,34,'u',MULTIPOLYGONFromText('MULTIPOLYGON(((0.13 0.07,0.29 0.09,0.53 0.79,0.85 0.66,0.64 0.17,0.22 0.18,0.35 0.39,0.30 0.28,0.13 0.07)))')),
(35,35,'sax',MULTIPOLYGONFromText('MULTIPOLYGON(((0.26 0.03,0.24 0.93,0.15 0.48,0.26 0.03)),((0.73 0.46,0.35 0.63,0.73 0.46)))')),
(36,36,'xmet',MULTIPOLYGONFromText('MULTIPOLYGON(((0.23 0.35,0.35 0.82,0.23 0.35)),((0.29 0.61,0.82 0.54,0.29 0.61)))')),
(37,37,REPEAT('e',276),MULTIPOLYGONFromText('MULTIPOLYGON(((0.65 0.67,0.65 0.67)))')),
(38,38,'ty',MULTIPOLYGONFromText('MULTIPOLYGON(((0.43 0.44,0.64 0.76,0.92 0.59,0.73 0.23,0.43 0.44)))')),
(39,39,'yq',MULTIPOLYGONFromText('MULTIPOLYGON(((0.84 0.27,0.19 0.67,0.84 0.27)),((0.55 0.13,0.39 0.64,0.21 0.70,0.18 0.45,0.55 0.13)))')),
(40,40,'hcsv',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.79,0.83 0.16,0.63 0.80,0.78 0.28,0.88 0.66,0.61 0.79)))')),
(41,41,'csvhlr',MULTIPOLYGONFromText('MULTIPOLYGON(((0.82 0.24,0.31 0.52,0.61 0.67,0.99 0.90,0.05 0.73,0.52 0.18,0.71 0.87,0.82 0.24)))')),
(42,42,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.09 0.21,0.37 0.57,0.81 0.75,0.61 0.16,0.48 0.17,0.29 0.28,0.72 0.46,0.09 0.21)))')),
(43,43,'wd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.06 0.25,0.52 0.23,0.02 0.05,0.06 0.25)),((0.70 0.52,0.44 0.46,0.95 0.47,0.70 0.52)))')),
(44,44,'dg',MULTIPOLYGONFromText('MULTIPOLYGON(((0.81 0.28,0.19 0.17,0.81 0.28)))')),
(45,45,'qtqkyyhkayeoopxmexd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.80 0.66,0.81 0.12,0.83 0.31,0.52 0.29,0.08 0.04,0.80 0.66)))')),
(46,46,'tqk',MULTIPOLYGONFromText('MULTIPOLYGON(((0.95 0.08,0.95 0.08)),((0.09 0.31,0.09 0.31)),((0.38 0.75,0.30 0.04,0.38 0.75)))')),
(47,47,REPEAT('q',925),MULTIPOLYGONFromText('MULTIPOLYGON(((0.56 0.73,0.87 0.11,0.37 0.86,0.48 0.05,0.82 0.55,0.25 0.06,0.19 0.85,0.10 0.75,0.56 0.73)))')),
(48,48,'yhk',MULTIPOLYGONFromText('MULTIPOLYGON(((0.06 0.67,0.41 0.51,0.03 0.83,0.40 0.20,0.16 0.87,0.16 0.07,0.29 0.52,0.06 0.67)))')),
(49,49,'k',MULTIPOLYGONFromText('MULTIPOLYGON(((0.16 0.14,0.16 0.14)),((0.97 0.69,0.45 0.32,0.45 0.38,0.97 0.69)))')),
(50,50,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.70 0.00,0.70 0.00)),((0.88 0.53,0.90 0.16,0.88 0.53)))')),
(51,51,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.48 0.06,0.45 0.05,0.03 0.12,0.27 0.80,0.22 0.75,0.53 0.55,0.48 0.06)))')),
(52,52,'o',MULTIPOLYGONFromText('MULTIPOLYGON(((0.32 0.76,0.17 0.43,0.32 0.76)),((0.40 0.79,0.40 0.79)),((0.42 0.34,0.42 0.34)))')),
(53,53,'pxme',MULTIPOLYGONFromText('MULTIPOLYGON(((0.44 0.08,0.02 0.74,0.26 0.21,0.75 0.42,0.91 0.32,0.24 0.65,0.67 0.50,0.44 0.08)))')),
(54,54,'m',MULTIPOLYGONFromText('MULTIPOLYGON(((0.86 0.13,0.21 0.34,0.00 0.87,0.76 0.23,0.69 0.73,0.13 0.63,0.86 0.13)))')),
(55,55,'mex',MULTIPOLYGONFromText('MULTIPOLYGON(((0.84 0.11,0.63 0.13,0.51 0.81,0.58 0.25,0.53 0.29,0.53 0.42,0.84 0.11)))')),
(56,56,REPEAT('e',504),MULTIPOLYGONFromText('MULTIPOLYGON(((0.27 0.84,0.65 0.26,0.75 0.44,0.29 0.52,0.27 0.84)))')),
(57,57,'i',MULTIPOLYGONFromText('MULTIPOLYGON(((0.71 0.84,0.77 0.27,0.45 0.71,0.91 0.01,0.84 0.35,0.71 0.84)))')),
(58,58,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.36,0.02 0.47,0.57 0.76,0.15 0.54,0.12 0.36)))')),
(59,59,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.77 0.80,0.25 0.69,0.34 0.68,0.77 0.80)))')),
(60,60,'',MULTIPOLYGONFromText('MULTIPOLYGON(((0.57 0.30,0.58 0.81,0.57 0.30)))')),
(61,61,'nh',MULTIPOLYGONFromText('MULTIPOLYGON(((0.42 0.99,0.42 0.99)))')),
(62,62,'hwi',MULTIPOLYGONFromText('MULTIPOLYGON(((0.40 0.50,0.97 0.34,0.60 0.75,0.26 0.74,0.40 0.50)))')),
(63,63,'id',MULTIPOLYGONFromText('MULTIPOLYGON(((0.30 0.67,0.13 0.43,0.16 0.64,0.04 0.72,0.95 0.87,0.83 0.24,0.17 0.82,0.30 0.67)))')),
(64,64,'toy',MULTIPOLYGONFromText('MULTIPOLYGON(((0.68 0.75,0.92 0.90,0.68 0.75)),((0.58 0.03,0.41 0.09,0.62 0.05,0.58 0.03)))')),
(65,65,'yhawdptl',MULTIPOLYGONFromText('MULTIPOLYGON(((0.95 0.50,0.61 0.35,0.78 0.07,0.67 0.43,0.50 0.70,0.48 0.98,0.95 0.50)))')),
(66,66,'gs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.59 0.06,0.12 0.94,0.05 0.90,0.99 0.22,0.13 0.55,0.59 0.06)))')),
(67,67,'bplb',MULTIPOLYGONFromText('MULTIPOLYGON(((0.33 0.90,0.54 0.11,0.05 0.04,0.59 0.66,0.33 0.90)))')),
(68,68,'b',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.52,0.23 0.54,0.80 0.14,0.88 0.70,0.13 0.67,0.68 0.66,0.50 0.52)))')),
(69,69,'p',MULTIPOLYGONFromText('MULTIPOLYGON(((0.07 0.99,0.11 0.79,0.07 0.99)),((0.50 0.22,0.77 0.58,0.50 0.22)))')),
(70,70,'l',MULTIPOLYGONFromText('MULTIPOLYGON(((0.21 0.75,0.21 0.75)))')),
(71,71,'rwkqhip',MULTIPOLYGONFromText('MULTIPOLYGON(((0.99 0.89,0.25 0.77,0.99 0.89)))')),
(72,72,'n',MULTIPOLYGONFromText('MULTIPOLYGON(((0.01 0.10,0.01 0.20,0.01 0.10)),((0.83 0.75,0.29 0.21,0.83 0.75)))')),
(73,73,'q',MULTIPOLYGONFromText('MULTIPOLYGON(((0.12 0.03,0.51 0.05,0.27 0.77,0.74 0.06,0.12 0.03)))')),
(74,74,'hipd',MULTIPOLYGONFromText('MULTIPOLYGON(((0.89 0.94,0.54 0.92,0.37 0.71,0.89 0.94)))')),
(75,75,'ipdec',MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.48,0.07 0.31,0.19 0.23,0.51 0.74,0.50 0.48)))')),
(76,76,'pde',MULTIPOLYGONFromText('MULTIPOLYGON(((0.79 0.42,0.61 0.98,0.13 0.85,0.52 0.16,0.79 0.42)))')),
(77,77,REPEAT('e',1432),MULTIPOLYGONFromText('MULTIPOLYGON(((0.78 0.29,0.42 0.20,0.88 0.86,0.99 0.81,0.78 0.29)))')),
(78,78,'cyhr',MULTIPOLYGONFromText('MULTIPOLYGON(((0.61 0.16,0.62 0.19,0.61 0.16)),((0.62 0.94,0.65 0.53,0.15 0.25,0.71 0.41,0.62 0.94)),((0.67 0.63,0.86 0.60,0.67 0.63)))')),
(79,79,'n',MULTIPOLYGONFromText('MULTIPOLYGON(((0.39 0.89,0.25 0.77,0.22 0.21,0.51 0.19,0.71 0.51,0.39 0.89)))')),
(80,80,'y',MULTIPOLYGONFromText('MULTIPOLYGON(((0.29 0.36,0.29 0.36)))')),
(81,81,'r',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.94,0.93 0.37,0.22 0.07,0.73 0.75,0.99 0.35,0.05 0.94)))')),
(82,82,'w',MULTIPOLYGONFromText('MULTIPOLYGON(((0.33 0.37,0.06 0.59,0.34 0.82,0.73 0.86,0.18 0.78,0.99 0.03,0.33 0.37)))')),
(83,83,REPEAT('g',74),MULTIPOLYGONFromText('MULTIPOLYGON(((0.60 0.54,0.25 0.31,0.60 0.54)))')),
(84,84,REPEAT('s',214),MULTIPOLYGONFromText('MULTIPOLYGON(((0.80 0.34,0.09 0.74,0.47 0.96,0.55 0.19,0.80 0.34)))')),
(85,85,REPEAT('h',223),MULTIPOLYGONFromText('MULTIPOLYGON(((0.76 0.26,0.16 0.85,0.91 0.75,0.64 0.83,0.47 0.02,0.92 0.58,0.76 0.26)))')),
(86,86,'l',MULTIPOLYGONFromText('MULTIPOLYGON(((0.11 0.64,0.41 0.64,0.64 0.64,0.11 0.64)))')),
(87,87,'hj',MULTIPOLYGONFromText('MULTIPOLYGON(((0.66 1.00,0.21 0.96,0.52 0.44,0.94 0.06,0.80 0.39,0.33 0.57,0.30 0.89,0.66 1.00)))')),
(88,88,'axcs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.20 0.66,0.71 0.41,0.32 0.94,0.30 0.66,0.50 0.49,0.60 0.67,0.20 0.66)))')),
(89,89,'cs',MULTIPOLYGONFromText('MULTIPOLYGON(((0.02 0.69,0.80 0.21,0.09 0.23,0.45 0.66,0.10 0.72,0.02 0.69)))')),
(90,90,'f',MULTIPOLYGONFromText('MULTIPOLYGON(((0.87 0.14,0.54 0.83,0.87 0.42,0.36 0.58,0.87 0.14)))')),
(91,91,'icq',MULTIPOLYGONFromText('MULTIPOLYGON(((0.73 0.57,0.36 0.41,0.86 0.33,0.76 0.49,0.44 0.83,0.73 0.57)))')),
(92,92,REPEAT('z',783),MULTIPOLYGONFromText('MULTIPOLYGON(((0.28 0.98,0.05 0.26,0.09 0.59,1.00 0.17,0.55 0.68,0.12 0.04,0.28 0.98)))')),
(93,93,'z',MULTIPOLYGONFromText('MULTIPOLYGON(((0.05 0.89,0.05 0.89)))')),
(94,94,REPEAT('x',1412),MULTIPOLYGONFromText('MULTIPOLYGON(((0.79 0.83,0.12 0.49,0.54 0.63,0.79 0.83)))')),
(95,95,REPEAT('u',2500),MULTIPOLYGONFromText('MULTIPOLYGON(((0.50 0.55,0.13 0.19,0.72 0.06,0.50 0.55)),((0.73 0.92,0.02 0.48,0.73 0.92)))'));
DROP TABLE t1;
--echo # End of 10.6 tests --echo # End of 10.6 tests

View File

@@ -1088,13 +1088,8 @@ show create view v;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 'asdf' ON EMPTY)) `T` latin1 latin1_swedish_ci v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 'asdf' ON EMPTY)) `T` latin1 latin1_swedish_ci
drop view v; drop view v;
#
# End of 10.6 tests # End of 10.6 tests
# #
#
# Start of 10.9 tests
#
#
# MDEV-27743 Remove Lex::charset # MDEV-27743 Remove Lex::charset
# #
SELECT collation(name) SELECT collation(name)
@@ -1214,12 +1209,11 @@ name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
) AS jt; ) AS jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ENUM('Laptop') CHARACTER SET BINARY PATH '$.name') ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
) AS jt' at line 6 ) AS jt' at line 6
#
# End of 10.9 tests # End of 10.9 tests
# #
#
# MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges # MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges
# #
# Beginning of 10.11 tests
create view v1 as (select * from create view v1 as (select * from
json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt);
create user u1@localhost; create user u1@localhost;
@@ -1232,7 +1226,58 @@ connection default;
DROP VIEW v2; DROP VIEW v2;
DROP VIEW v1; DROP VIEW v1;
DROP USER u1@localhost; DROP USER u1@localhost;
# End of 10.11 tests #
# MDEV-34081: View containing JSON_TABLE does not return JSON
#
CREATE OR REPLACE VIEW test_view AS SELECT * FROM JSON_TABLE('
[
{
"caption": "First Element",
"value": 1
},
{
"caption": "Second Element",
"value": 2
}
]
', '$[*]' COLUMNS(
caption VARCHAR(200) PATH '$.caption',
whole_block JSON PATH '$')) t;
SELECT * FROM test_view;
caption whole_block
First Element {
"caption": "First Element",
"value": 1
}
Second Element {
"caption": "Second Element",
"value": 2
}
SELECT * FROM JSON_TABLE('
[
{
"caption": "First Element",
"value": 1
},
{
"caption": "Second Element",
"value": 2
}
]
', '$[*]' COLUMNS(
caption VARCHAR(200) PATH '$.caption',
whole_block JSON PATH '$')) t;
caption whole_block
First Element {
"caption": "First Element",
"value": 1
}
Second Element {
"caption": "Second Element",
"value": 2
}
DROP VIEW test_view;
# End of 10.11 test
# #
# MDEV-29390: Improve coverage for UPDATE and DELETE statements in MTR test suites # MDEV-29390: Improve coverage for UPDATE and DELETE statements in MTR test suites
# #
@@ -1331,7 +1376,5 @@ Laptop black 20000.00 2
Jacket brown 5000.00 1 Jacket brown 5000.00 1
Jeans blue 5000.00 2 Jeans blue 5000.00 2
drop table t1; drop table t1;
#
# End of 11.0 tests # End of 11.0 tests
#
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci; ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;

View File

@@ -920,13 +920,7 @@ show create view v;
drop view v; drop view v;
--echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo #
--echo #
--echo # Start of 10.9 tests
--echo #
--echo # --echo #
--echo # MDEV-27743 Remove Lex::charset --echo # MDEV-27743 Remove Lex::charset
@@ -1041,14 +1035,14 @@ COLUMNS
name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name') name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
) AS jt; ) AS jt;
--echo #
--echo # End of 10.9 tests --echo # End of 10.9 tests
--echo #
--echo # --echo #
--echo # MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges --echo # MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges
--echo # --echo #
--echo # Beginning of 10.11 tests
create view v1 as (select * from create view v1 as (select * from
json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt);
@@ -1066,7 +1060,45 @@ DROP VIEW v2;
DROP VIEW v1; DROP VIEW v1;
DROP USER u1@localhost; DROP USER u1@localhost;
--echo # End of 10.11 tests --echo #
--echo # MDEV-34081: View containing JSON_TABLE does not return JSON
--echo #
CREATE OR REPLACE VIEW test_view AS SELECT * FROM JSON_TABLE('
[
{
"caption": "First Element",
"value": 1
},
{
"caption": "Second Element",
"value": 2
}
]
', '$[*]' COLUMNS(
caption VARCHAR(200) PATH '$.caption',
whole_block JSON PATH '$')) t;
SELECT * FROM test_view;
SELECT * FROM JSON_TABLE('
[
{
"caption": "First Element",
"value": 1
},
{
"caption": "Second Element",
"value": 2
}
]
', '$[*]' COLUMNS(
caption VARCHAR(200) PATH '$.caption',
whole_block JSON PATH '$')) t;
DROP VIEW test_view;
--echo # End of 10.11 test
--echo # --echo #
--echo # MDEV-29390: Improve coverage for UPDATE and DELETE statements in MTR test suites --echo # MDEV-29390: Improve coverage for UPDATE and DELETE statements in MTR test suites
@@ -1158,8 +1190,6 @@ select * from t1;
drop table t1; drop table t1;
--echo #
--echo # End of 11.0 tests --echo # End of 11.0 tests
--echo #
--source include/test_db_charset_restore.inc --source include/test_db_charset_restore.inc

View File

@@ -23,16 +23,6 @@ i
1 1
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
#
CREATE TABLE t1 (i INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
SET max_session_mem_used=50000;
REPAIR LOCAL TABLE t1 USE_FRM;
REPAIR LOCAL TABLE t1;
DROP TABLE t1;
SET max_session_mem_used=default;
# MDEV-17223 Assertion `thd->killed != 0' failed in # MDEV-17223 Assertion `thd->killed != 0' failed in
# ha_maria::enable_indexes # ha_maria::enable_indexes

View File

@@ -1,8 +1,3 @@
# We should not run this test with embedded as we are using
# max_session_mem_used, which causes things to fail/not fail randomly
# as memory usage is different compared to normal server.
--source include/not_embedded.inc
--source include/have_sequence.inc --source include/have_sequence.inc
--source include/test_db_charset_latin1.inc --source include/test_db_charset_latin1.inc
@@ -31,20 +26,6 @@ SELECT * FROM t1;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-23824 SIGSEGV in end_io_cache on REPAIR LOCAL TABLE for Aria table
--echo #
CREATE TABLE t1 (i INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
SET max_session_mem_used=50000;
--disable_result_log
REPAIR LOCAL TABLE t1 USE_FRM;
REPAIR LOCAL TABLE t1;
--enable_result_log
DROP TABLE t1;
SET max_session_mem_used=default;
--echo --echo
--echo # MDEV-17223 Assertion `thd->killed != 0' failed in --echo # MDEV-17223 Assertion `thd->killed != 0' failed in
--echo # ha_maria::enable_indexes --echo # ha_maria::enable_indexes

View File

@@ -882,6 +882,7 @@ SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2;
COUNT(*) COUNT(*)
2 2
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# End of 4.1 tests
create table t1 (b bit(1)); create table t1 (b bit(1));
create table t2 (b bit(1)); create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2); create table tm (b bit(1)) engine = merge union = (t1,t2);
@@ -1007,7 +1008,7 @@ ERROR HY000: Unable to open underlying table which is differently defined or of
SELECT * FROM m2; SELECT * FROM m2;
a a
DROP TABLE t1, t2, m1, m2; DROP TABLE t1, t2, m1, m2;
End of 5.0 tests # End of 5.0 tests
create table t1 (c1 int, index(c1)); create table t1 (c1 int, index(c1));
create table t2 (c1 int, index(c1)) engine=merge union=(t1); create table t2 (c1 int, index(c1)) engine=merge union=(t1);
insert into t1 values (1); insert into t1 values (1);
@@ -2419,7 +2420,7 @@ check table tm_temp_temp;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.tm_temp_temp check status OK test.tm_temp_temp check status OK
drop temporary table t1_temp, tm_temp_temp; drop temporary table t1_temp, tm_temp_temp;
End of 5.1 tests # End of 5.1 tests
# #
# MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
# #
@@ -2550,7 +2551,7 @@ i a b filler
2 999 999 filler-data-FILLER-DATA-qqq 2 999 999 filler-data-FILLER-DATA-qqq
drop table t5; drop table t5;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
End of 5.3 tests # End of 5.3 tests
CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
SELECT MAX(a) FROM t1; SELECT MAX(a) FROM t1;
MAX(a) MAX(a)
@@ -3800,10 +3801,8 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date test.t1 analyze status Table is already up to date
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge; DROP TABLE t1, tmerge;
#
# End of 5.5 tests # End of 5.5 tests
# #
#
# Additional coverage for refactoring which is made as part # Additional coverage for refactoring which is made as part
# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
# to allow temp table operations". # to allow temp table operations".
@@ -3898,7 +3897,7 @@ f
foo foo
bar bar
DROP TABLE mrg, t1; DROP TABLE mrg, t1;
# End of 10.5 tests # End of 10.0 tests
# #
# MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results # MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results
# #
@@ -3921,10 +3920,8 @@ a
2 2
1 1
drop table tm, t; drop table tm, t;
#
# End of 10.8 tests # End of 10.8 tests
# #
#
# MDEV-35816 ASAN use-after-poison in st_select_lex::print # MDEV-35816 ASAN use-after-poison in st_select_lex::print
# #
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@@ -3961,10 +3958,8 @@ a
4 4
5 5
DROP TABLE t1; DROP TABLE t1;
#
# End of 10.11 tests # End of 10.11 tests
# #
#
# MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost # MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost
# #
CREATE TABLE t1 (a TIMESTAMP, KEY(a)) ENGINE=MRG_MyISAM; CREATE TABLE t1 (a TIMESTAMP, KEY(a)) ENGINE=MRG_MyISAM;
@@ -4017,10 +4012,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL i1 5 NULL 1 Using index for group-by 1 SIMPLE t1 range NULL i1 5 NULL 1 Using index for group-by
drop table t1; drop table t1;
set use_stat_tables=default; set use_stat_tables=default;
#
# End of 11.0 tests # End of 11.0 tests
# #
#
# MDEV-29174: UPDATE of view that uses MERGE table # MDEV-29174: UPDATE of view that uses MERGE table
# #
CREATE TABLE t1 (a int) ENGINE=MERGE; CREATE TABLE t1 (a int) ENGINE=MERGE;
@@ -4029,3 +4022,4 @@ UPDATE v1 SET a=0;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
# End of 11.1 tests # End of 11.1 tests
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;

View File

@@ -520,7 +520,7 @@ INSERT INTO t2 VALUES ('ss',2),(0xDF,2);
SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2; SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# End of 4.1 tests --echo # End of 4.1 tests
# #
# BUG#19648 - Merge table does not work with bit types # BUG#19648 - Merge table does not work with bit types
@@ -629,7 +629,7 @@ SELECT * FROM m1;
SELECT * FROM m2; SELECT * FROM m2;
DROP TABLE t1, t2, m1, m2; DROP TABLE t1, t2, m1, m2;
--echo End of 5.0 tests --echo # End of 5.0 tests
# #
@@ -1826,7 +1826,7 @@ alter table tm_temp_temp insert_method=first;
check table tm_temp_temp; check table tm_temp_temp;
drop temporary table t1_temp, tm_temp_temp; drop temporary table t1_temp, tm_temp_temp;
--echo End of 5.1 tests --echo # End of 5.1 tests
--echo # --echo #
--echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg --echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
@@ -1863,7 +1863,7 @@ select * from t2, t5 where t5.a=999 and t5.b=999;
drop table t5; drop table t5;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
--echo End of 5.3 tests --echo # End of 5.3 tests
# #
# BUG#35274 - merge table doesn't need any base tables, gives error 124 when # BUG#35274 - merge table doesn't need any base tables, gives error 124 when
@@ -2770,9 +2770,7 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1, tmerge; DROP TABLE t1, tmerge;
--echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo #
--echo # --echo #
--echo # Additional coverage for refactoring which is made as part --echo # Additional coverage for refactoring which is made as part
@@ -2853,7 +2851,7 @@ CREATE TABLE mrg (f TEXT) ENGINE=MERGE, UNION(t1);
SELECT * FROM mrg; SELECT * FROM mrg;
DROP TABLE mrg, t1; DROP TABLE mrg, t1;
--echo # End of 10.5 tests --echo # End of 10.0 tests
--echo # --echo #
--echo # MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results --echo # MDEV-27407 Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results
@@ -2875,9 +2873,7 @@ insert into tm () values ();
select * from tm; select * from tm;
drop table tm, t; drop table tm, t;
--echo #
--echo # End of 10.8 tests --echo # End of 10.8 tests
--echo #
--echo # --echo #
--echo # MDEV-35816 ASAN use-after-poison in st_select_lex::print --echo # MDEV-35816 ASAN use-after-poison in st_select_lex::print
@@ -2893,9 +2889,7 @@ EXECUTE nested;
EXECUTE nested; EXECUTE nested;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # End of 10.11 tests --echo # End of 10.11 tests
--echo #
--echo # --echo #
--echo # MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost --echo # MDEV-30088 Assertion `cond_selectivity <= 1.0' failed in get_range_limit_read_cost
@@ -2942,9 +2936,8 @@ EXPLAIN SELECT DISTINCT a FROM t1;
drop table t1; drop table t1;
set use_stat_tables=default; set use_stat_tables=default;
--echo #
--echo # End of 11.0 tests --echo # End of 11.0 tests
--echo #
--echo # --echo #
--echo # MDEV-29174: UPDATE of view that uses MERGE table --echo # MDEV-29174: UPDATE of view that uses MERGE table
--echo # --echo #
@@ -2956,3 +2949,4 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 11.1 tests --echo # End of 11.1 tests
--source include/test_db_charset_restore.inc

View File

@@ -1,5 +1,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
--source include/not_msan.inc
--source include/not_valgrind.inc
# This does not crash on 32 bit because of less memory used # This does not crash on 32 bit because of less memory used
--source include/have_64bit.inc --source include/have_64bit.inc
--echo # --echo #
@@ -16,7 +18,9 @@ set max_session_mem_used=32768;
select * from performance_schema.session_status; select * from performance_schema.session_status;
--enable_result_log --enable_result_log
# this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables # this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables
--disable_ps_protocol # different memory requirements
set global innodb_io_capacity_max=100; set global innodb_io_capacity_max=100;
set max_session_mem_used=default; set max_session_mem_used=default;
--enable_ps_protocol
set global innodb_io_capacity=@old_innodb_io_capacity; set global innodb_io_capacity=@old_innodb_io_capacity;
set global innodb_io_capacity_max=@old_innodb_io_capacity_max; set global innodb_io_capacity_max=@old_innodb_io_capacity_max;

View File

@@ -488,7 +488,6 @@ insert into test.sanity values
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_SYNC_SPIN_LOOPS"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_SYNC_SPIN_LOOPS"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TEMP_DATA_FILE_PATH"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TEMP_DATA_FILE_PATH"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_TRX_RSEG_N_SLOTS_DEBUG"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_DIRECTORY"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_DIRECTORY"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_LOG_TRUNCATE"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_LOG_TRUNCATE"),
("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_TABLESPACES"), ("JUNK: GLOBAL-ONLY", "I_S.SESSION_VARIABLES", "INNODB_UNDO_TABLESPACES"),

View File

@@ -245,6 +245,8 @@ insert delayed into t1 values (1);
connection default; connection default;
# Waiting until INSERT DELAYED thread does the insert. # Waiting until INSERT DELAYED thread does the insert.
drop table t1; drop table t1;
create table test_partitions (i int) partition by hash (i) partitions 4;
drop table test_partitions;
set global server_audit_logging= off; set global server_audit_logging= off;
set global server_audit_incl_users='root'; set global server_audit_incl_users='root';
set global server_audit_logging= on; set global server_audit_logging= on;

View File

@@ -2,6 +2,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_ssl_communication.inc --source include/have_ssl_communication.inc
--source include/no_view_protocol.inc --source include/no_view_protocol.inc
--source include/have_partition.inc
if (!$SERVER_AUDIT_SO) { if (!$SERVER_AUDIT_SO) {
skip No SERVER_AUDIT plugin; skip No SERVER_AUDIT plugin;
@@ -179,12 +180,20 @@ connect (cn1,127.0.0.1,user1,,sa_db,$MASTER_MYPORT);
create table t1(id int) engine=myisam; create table t1(id int) engine=myisam;
insert delayed into t1 values (1); insert delayed into t1 values (1);
connection default; connection default;
--echo # Waiting until INSERT DELAYED thread does the insert. --echo # Waiting until INSERT DELAYED thread does the insert.
let $wait_condition= SELECT COUNT(*) = 1 FROM t1; let $wait_condition= SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
drop table t1; drop table t1;
#
# MDEV-7451 Server audit: Table events for partitioned tables are duplicated for each partition.
#
create table test_partitions (i int) partition by hash (i) partitions 4;
drop table test_partitions;
set global server_audit_logging= off; set global server_audit_logging= off;
set global server_audit_incl_users='root'; set global server_audit_incl_users='root';
set global server_audit_logging= on; set global server_audit_logging= on;

View File

@@ -382,6 +382,35 @@ disconnect con1;
connection default; connection default;
drop sequence s1; drop sequence s1;
drop sequence s2; drop sequence s2;
#
# End of 10.4 tests # End of 10.4 tests
# #
# MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
#
create sequence s engine=myisam;
create table t (id bigint default(nextval(s))) engine=myisam;
insert delayed into t () values();
drop table t;
drop sequence s;
#
# MDEV-37345 Item_func_nextval::val_int() crash on INSERT...SELECT with subqueries
#
create sequence s;
create table t1 (a int, b int default(nextval(s)));
insert into t1 () values ();
create table t2 (c int);
create procedure p() update t1 set a = 0;
create trigger tr after insert on t2 for each row
begin
insert into t1 () values ();
call p();
end $
insert into t2 values ();
drop table t1, t2, s;
drop procedure p;
create sequence s;
create temporary table t (f int);
alter table t modify f int default(nextval(s));
create or replace sequence s;
insert into t values (default);
drop sequence s;
# End of 10.11 tests

View File

@@ -414,6 +414,43 @@ insert into s1 values (1, 1, 10000, 100, 1, 1000, 0, 0);
drop sequence s1; drop sequence s1;
drop sequence s2; drop sequence s2;
--echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
--echo # MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
--echo #
create sequence s engine=myisam;
create table t (id bigint default(nextval(s))) engine=myisam;
insert delayed into t () values();
drop table t;
drop sequence s;
--echo #
--echo # MDEV-37345 Item_func_nextval::val_int() crash on INSERT...SELECT with subqueries
--echo #
# sequence and prelocking.
create sequence s;
create table t1 (a int, b int default(nextval(s)));
insert into t1 () values ();
create table t2 (c int);
create procedure p() update t1 set a = 0;
--delimiter $
create trigger tr after insert on t2 for each row
begin
insert into t1 () values ();
call p();
end $
--delimiter ;
insert into t2 values ();
drop table t1, t2, s;
drop procedure p;
# another one, temporary table, ALTER, recreate sequence
create sequence s;
create temporary table t (f int);
alter table t modify f int default(nextval(s));
create or replace sequence s;
insert into t values (default);
drop sequence s;
--echo # End of 10.11 tests

View File

@@ -1,65 +0,0 @@
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
@start_global_value
0
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
@@global.innodb_trx_rseg_n_slots_debug between 0 and 1024
1
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select @@session.innodb_trx_rseg_n_slots_debug;
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable
show global variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
show session variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
1
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set session innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_trx_rseg_n_slots_debug=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug='foo';
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=-2;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '-2'
set global innodb_trx_rseg_n_slots_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '1025'
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0

View File

@@ -1664,18 +1664,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INNODB_TRX_RSEG_N_SLOTS_DEBUG
SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1024
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME INNODB_UNDO_DIRECTORY VARIABLE_NAME INNODB_UNDO_DIRECTORY
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE DEFAULT_VALUE

View File

@@ -1,59 +0,0 @@
--source include/have_innodb.inc
--source include/have_debug.inc
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
#
# exists as global only
#
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
select @@global.innodb_trx_rseg_n_slots_debug;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_trx_rseg_n_slots_debug;
show global variables like 'innodb_trx_rseg_n_slots_debug';
show session variables like 'innodb_trx_rseg_n_slots_debug';
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
#
# show that it's writable
#
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--enable_warnings
--error ER_GLOBAL_VARIABLE
set session innodb_trx_rseg_n_slots_debug='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_trx_rseg_n_slots_debug='some';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug='foo';
set global innodb_trx_rseg_n_slots_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1e1;
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
#
# Cleanup
#
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;

View File

@@ -47,7 +47,6 @@ enum session_stat
static const char *session_stat_names[]= {"GLOBAL", "ON", "OFF", NullS}; static const char *session_stat_names[]= {"GLOBAL", "ON", "OFF", NullS};
static TYPELIB session_stat_typelib= CREATE_TYPELIB_FOR(session_stat_names); static TYPELIB session_stat_typelib= CREATE_TYPELIB_FOR(session_stat_names);
static MYSQL_SYSVAR_ULONG(range_base, opt_query_response_time_range_base, static MYSQL_SYSVAR_ULONG(range_base, opt_query_response_time_range_base,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Select base of log for query_response_time ranges. " "Select base of log for query_response_time ranges. "

View File

@@ -21,11 +21,11 @@ EOF
exit 0 exit 0
fi fi
echo _WSREP_NEW_CLUSTER='--wsrep-new-cluster' > @mysqlunixdir@/"wsrep-new-cluster" && \ echo _WSREP_NEW_CLUSTER='--wsrep-new-cluster' > "@INSTALL_RUNDATADIR@/wsrep-new-cluster" && \
systemctl restart mariadb.service systemctl restart mariadb.service
extcode=$? extcode=$?
rm -f @mysqlunixdir@/"wsrep-new-cluster" rm -f "@INSTALL_RUNDATADIR@/wsrep-new-cluster"
exit $extcode exit $extcode

View File

@@ -5969,7 +5969,12 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info_arg)
info_arg->options|= HA_LEX_CREATE_GLOBAL_TMP_TABLE; info_arg->options|= HA_LEX_CREATE_GLOBAL_TMP_TABLE;
int error= create(name, form, info_arg); int error= create(name, form, info_arg);
if (!error && if (!error &&
!(info_arg->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER))) !(info_arg->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER)) &&
/*
DO not notify if not main handler.
So skip notifications for partitions.
*/
form->file == this)
mysql_audit_create_table(form); mysql_audit_create_table(form);
return error; return error;
} }

View File

@@ -4450,7 +4450,7 @@ protected:
bool check_access(THD *, privilege_t); bool check_access(THD *, privilege_t);
public: public:
Item_func_nextval(THD *thd, TABLE_LIST *table_list_arg): Item_func_nextval(THD *thd, TABLE_LIST *table_list_arg):
Item_longlong_func(thd), table_list(table_list_arg) {} Item_longlong_func(thd), table_list(table_list_arg), table(0) {}
longlong val_int() override; longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@@ -4480,14 +4480,8 @@ public:
*/ */
void update_table() void update_table()
{ {
if (!(table= table_list->table)) table= table_list->table;
{ DBUG_ASSERT(table);
/*
If nextval was used in DEFAULT then next_local points to
the table_list used by to open the sequence table
*/
table= table_list->next_local->table;
}
} }
bool const_item() const override { return 0; } bool const_item() const override { return 0; }
Item *do_get_copy(THD *thd) const override Item *do_get_copy(THD *thd) const override

View File

@@ -211,24 +211,23 @@ int json_path_parts_compare(
{ {
if (b->type & JSON_PATH_ARRAY) if (b->type & JSON_PATH_ARRAY)
{ {
int res= 0, corrected_n_item_a= 0; int res = 0;
if (array_sizes) if (a->type & JSON_PATH_WILD)
corrected_n_item_a= a->n_item < 0 ? res = 1;
array_sizes[b-temp_b] + a->n_item : a->n_item; else if (a->type & JSON_PATH_ARRAY_RANGE && array_sizes)
if (a->type & JSON_PATH_ARRAY_RANGE)
{ {
int corrected_n_item_end_a= 0; int start = (a->n_item >= 0) ? a->n_item
if (array_sizes) : array_sizes[b - temp_b] + a->n_item;
corrected_n_item_end_a= a->n_item_end < 0 ? int end = (a->n_item_end >= 0) ? a->n_item_end
array_sizes[b-temp_b] + a->n_item_end : : array_sizes[b - temp_b] + a->n_item_end;
a->n_item_end; res = (b->n_item >= start && b->n_item <= end);
res= b->n_item >= corrected_n_item_a &&
b->n_item <= corrected_n_item_end_a;
} }
else else if (a->n_item >= 0)
res= corrected_n_item_a == b->n_item; res = (a->n_item == b->n_item);
else if (a->n_item < 0 && array_sizes)
res = (a->n_item == b->n_item - array_sizes[b - temp_b]);
if ((a->type & JSON_PATH_WILD) || res) if (res)
goto step_fits; goto step_fits;
goto step_failed; goto step_failed;
} }

View File

@@ -4258,9 +4258,21 @@ String *Item_func_hex::val_str_ascii_from_val_str(String *str)
{ {
DBUG_ASSERT(&tmp_value != str); DBUG_ASSERT(&tmp_value != str);
String *res= args[0]->val_str(&tmp_value); String *res= args[0]->val_str(&tmp_value);
DBUG_ASSERT(res != str); THD *thd= current_thd;
if ((null_value= (res == NULL))) if ((null_value= (res == NULL)))
return NULL; return NULL;
if (res->length()*2 > thd->variables.max_allowed_packet)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), thd->variables.max_allowed_packet);
null_value= true;
return NULL;
}
return str->set_hex(res->ptr(), res->length()) ? make_empty_result(str) : str; return str->set_hex(res->ptr(), res->length()) ? make_empty_result(str) : str;
} }

View File

@@ -978,8 +978,9 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
(*f)->sql_type(column_type); (*f)->sql_type(column_type);
if (str->append(column_type) || if ((m_format_json ? str->append(STRING_WITH_LEN(" JSON ")) : str->append(column_type)))
((*f)->has_charset() && m_explicit_cs && return 1;
if (((*f)->has_charset() && m_explicit_cs &&
(str->append(STRING_WITH_LEN(" CHARSET ")) || (str->append(STRING_WITH_LEN(" CHARSET ")) ||
str->append(&m_explicit_cs->cs_name) || str->append(&m_explicit_cs->cs_name) ||
(Charset(m_explicit_cs).can_have_collate_clause() && (Charset(m_explicit_cs).can_have_collate_clause() &&

View File

@@ -167,6 +167,7 @@ public:
{ {
m_on_error.m_response= RESPONSE_NOT_SPECIFIED; m_on_error.m_response= RESPONSE_NOT_SPECIFIED;
m_on_empty.m_response= RESPONSE_NOT_SPECIFIED; m_on_empty.m_response= RESPONSE_NOT_SPECIFIED;
m_format_json= false;
} }
int print(THD *tnd, Field **f, String *str); int print(THD *tnd, Field **f, String *str);
}; };

View File

@@ -1914,7 +1914,16 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
if (charset_inited) if (charset_inited)
{ {
rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info; rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;
if (thd->slave_thread && sql_info->cached_charset_compare(charset)) const bool applier=
#ifdef WITH_WSREP
WSREP(thd) ? thd->wsrep_applier :
#endif
false;
// Event charset should be compared for slave thread
// and applier threads
if ((thd->slave_thread || applier) &&
sql_info->cached_charset_compare(charset))
{ {
/* Verify that we support the charsets found in the event. */ /* Verify that we support the charsets found in the event. */
if (!(thd->variables.character_set_client= if (!(thd->variables.character_set_client=

View File

@@ -10427,8 +10427,6 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
{ {
bool must_be_ored= sel_trees_must_be_ored(param, tree1, tree2, ored_keys); bool must_be_ored= sel_trees_must_be_ored(param, tree1, tree2, ored_keys);
no_imerge_from_ranges= must_be_ored; no_imerge_from_ranges= must_be_ored;
if (param->disable_index_merge_plans)
no_imerge_from_ranges= true;
if (no_imerge_from_ranges && no_merges1 && no_merges2) if (no_imerge_from_ranges && no_merges1 && no_merges2)
{ {
@@ -10478,6 +10476,13 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
DBUG_RETURN(result); DBUG_RETURN(result);
} }
/*
Ok, the result now has the ranges that one gets for (RT1 OR RT2).
If construction of SEL_IMERGE is disabled, stop right here.
*/
if (param->disable_index_merge_plans)
DBUG_RETURN(result);
SEL_IMERGE *imerge_from_ranges; SEL_IMERGE *imerge_from_ranges;
if (!(imerge_from_ranges= new SEL_IMERGE())) if (!(imerge_from_ranges= new SEL_IMERGE()))
result= NULL; result= NULL;
@@ -15852,6 +15857,46 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *param, bool retrieve_full_rows,
} }
/*
@brief
Return true if the select is using "Using index for group-by" and also
has "ORDER BY ... FETCH FIRST n ROWS WITH TIES"
@detail
There is a rewrite that removes the ORDER BY (JOIN::order) if the select
also has a GROUP BY that produces a compatible ordering.
However "FETCH FIRST ... WITH TIES" needs an ORDER BY clause (in
JOIN::alloc_order_fields()).
GROUP BY strategies handle it this way:
- For strategies using temporary table, JOIN::make_aggr_tables_info() will
put the ORDER BY clause back.
- OrderedGroupBy in end_send_group() handles WITH TIES with the GROUP BY
clause (note that SQL doesn't allow "GROUP BY ... WITH TIES").
- The remaining strategy is QUICK_GROUP_MIN_MAX_SELECT, for which
= the grouping strategy in the quick select doesn't handle WITH TIES.
= end_send() would not handle WITH TIES, because JOIN::order is removed.
The solution is to NOT remove ORDER BY when QUICK_GROUP_MIN_MAX_SELECT is
used.
Unfortunately, the optimizer then will not recognize that it can skip
sorting and will use filesort, which will prevent short-cutting the
execution when LIMIT is reached.
*/
bool using_with_ties_and_group_min_max(JOIN *join)
{
if (join->unit->lim.is_with_ties())
{
JOIN_TAB *tab= &join->join_tab[join->const_tables];
if (tab->select && tab->select->quick &&
tab->select->quick->get_type() ==
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)
return true;
}
return false;
}
/* /*
Construct new quick select for group queries with min/max. Construct new quick select for group queries with min/max.

View File

@@ -1873,6 +1873,7 @@ public:
Explain_quick_select *get_explain(MEM_ROOT *alloc) override; Explain_quick_select *get_explain(MEM_ROOT *alloc) override;
}; };
bool using_with_ties_and_group_min_max(JOIN *join);
class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT class QUICK_SELECT_DESC: public QUICK_RANGE_SELECT
{ {

View File

@@ -394,6 +394,7 @@ struct SplM_field_ext_info: public SplM_field_info
with available statistics. with available statistics.
10. The select doesn't use WITH ROLLUP (This limitation can probably be 10. The select doesn't use WITH ROLLUP (This limitation can probably be
lifted) lifted)
11. The select doesn't have ORDER BY with LIMIT
@retval @retval
true if the answer is positive true if the answer is positive
@@ -429,6 +430,9 @@ bool JOIN::check_for_splittable_materialized()
if (!partition_list) if (!partition_list)
return false; return false;
if (select_lex->order_list.elements > 0 && !unit->lim.is_unlimited()) //!(11)
return false;
Json_writer_object trace_wrapper(thd); Json_writer_object trace_wrapper(thd);
Json_writer_object trace_split(thd, "check_split_materialized"); Json_writer_object trace_split(thd, "check_split_materialized");

View File

@@ -1198,7 +1198,7 @@ Sp_handler::sp_drop_routine_internal(THD *thd,
sp_cache **spc= get_cache(thd); sp_cache **spc= get_cache(thd);
DBUG_ASSERT(spc); DBUG_ASSERT(spc);
if ((sp= sp_cache_lookup(spc, name))) if ((sp= sp_cache_lookup(spc, name)))
sp_cache_flush_obsolete(spc, &sp); sp_cache_remove(spc, &sp);
/* Drop statistics for this stored program from performance schema. */ /* Drop statistics for this stored program from performance schema. */
MYSQL_DROP_SP(type(), name->m_db.str, static_cast<uint>(name->m_db.length), MYSQL_DROP_SP(type(), name->m_db.str, static_cast<uint>(name->m_db.length),
name->m_name.str, static_cast<uint>(name->m_name.length)); name->m_name.str, static_cast<uint>(name->m_name.length));
@@ -2901,10 +2901,12 @@ int Sp_handler::sp_cache_routine(THD *thd,
DBUG_ASSERT(spc); DBUG_ASSERT(spc);
*sp= sp_cache_lookup(spc, name); *sp= sp_cache_lookup(spc, name);
thd->set_sp_cache_version_if_needed(sp_cache_version());
if (*sp) if (*sp)
{ {
sp_cache_flush_obsolete(spc, sp); if ((*sp)->sp_cache_version() < thd->sp_cache_version())
sp_cache_remove(spc, sp);
if (*sp) if (*sp)
DBUG_RETURN(SP_OK); DBUG_RETURN(SP_OK);
} }

View File

@@ -229,14 +229,10 @@ void sp_cache_invalidate()
inside SP'. inside SP'.
*/ */
void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp) void sp_cache_remove(sp_cache **cp, sp_head **sp)
{ {
if ((*sp)->sp_cache_version() < Cversion && !(*sp)->is_invoked())
{
DBUG_EXECUTE_IF("check_sp_cache_not_invalidated", DBUG_SUICIDE(););
(*cp)->remove(*sp); (*cp)->remove(*sp);
*sp= NULL; *sp= NULL;
}
} }
/** /**

View File

@@ -55,7 +55,7 @@ void sp_cache_clear(sp_cache **cp);
void sp_cache_insert(sp_cache **cp, sp_head *sp); void sp_cache_insert(sp_cache **cp, sp_head *sp);
sp_head *sp_cache_lookup(sp_cache **cp, const Database_qualified_name *name); sp_head *sp_cache_lookup(sp_cache **cp, const Database_qualified_name *name);
void sp_cache_invalidate(); void sp_cache_invalidate();
void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp); void sp_cache_remove(sp_cache **cp, sp_head **sp);
ulong sp_cache_version(); ulong sp_cache_version();
void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements); void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);

View File

@@ -2045,7 +2045,14 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
table->query_id == 0)) table->query_id == 0))
{ {
int distance= ((int) table->reginfo.lock_type - int distance= ((int) table->reginfo.lock_type -
(int) table_list->lock_type); (int) table_list->lock_type) * 2;
/*
if we need a table for inserting, make sure it has
its internal tables (a.k.a. sequences) ready
*/
if (table->internal_tables &&
table_list->for_insert_data == !table->internal_tables->table)
distance|= 1;
/* /*
Find a table that either has the exact lock type requested, Find a table that either has the exact lock type requested,
@@ -2448,6 +2455,11 @@ retry_share:
DBUG_ASSERT(table->file->pushed_cond == NULL); DBUG_ASSERT(table->file->pushed_cond == NULL);
table_list->updatable= 1; // It is not derived table nor non-updatable VIEW table_list->updatable= 1; // It is not derived table nor non-updatable VIEW
table_list->table= table; table_list->table= table;
if (table_list->linked_table)
{
/* Update link for sequence tables in default */
table_list->linked_table->table= table;
}
if (!from_share && table->vcol_fix_expr(thd)) if (!from_share && table->vcol_fix_expr(thd))
DBUG_RETURN(true); DBUG_RETURN(true);
@@ -3210,7 +3222,7 @@ static bool
check_and_update_routine_version(THD *thd, Sroutine_hash_entry *rt, check_and_update_routine_version(THD *thd, Sroutine_hash_entry *rt,
sp_head *sp) sp_head *sp)
{ {
ulong spc_version= sp_cache_version(); ulong spc_version= thd->sp_cache_version();
/* sp is NULL if there is no such routine. */ /* sp is NULL if there is no such routine. */
ulong version= sp ? sp->sp_cache_version() : spc_version; ulong version= sp ? sp->sp_cache_version() : spc_version;
/* /*
@@ -3220,7 +3232,7 @@ check_and_update_routine_version(THD *thd, Sroutine_hash_entry *rt,
Sic: version != spc_version <--> sp is not NULL. Sic: version != spc_version <--> sp is not NULL.
*/ */
if (rt->m_sp_cache_version != version || if (rt->m_sp_cache_version != version ||
(version != spc_version && !sp->is_invoked())) (version < spc_version && !sp->is_invoked()))
{ {
if (thd->m_reprepare_observer && if (thd->m_reprepare_observer &&
thd->m_reprepare_observer->report_error(thd)) thd->m_reprepare_observer->report_error(thd))
@@ -5079,7 +5091,7 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
next_local value as it may have been changed by a previous next_local value as it may have been changed by a previous
statement using the same table. statement using the same table.
*/ */
tables->next_local= tmp; tmp->linked_table= tables;
continue; continue;
} }
@@ -5094,10 +5106,10 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
&prelocking_ctx->query_tables_last, &prelocking_ctx->query_tables_last,
tables->for_insert_data); tables->for_insert_data);
/* /*
Store link to the new table_list that will be used by open so that Store link to the sequences table so that we can in open_table() update
Item_func_nextval() can find it it to point to the opened table.
*/ */
tables->next_local= tl; tl->linked_table= tables;
DBUG_PRINT("info", ("table name: %s added", tables->table_name.str)); DBUG_PRINT("info", ("table name: %s added", tables->table_name.str));
} while ((tables= tables->next_global)); } while ((tables= tables->next_global));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);

View File

@@ -235,6 +235,7 @@ void old_mode_deprecated_warnings(ulonglong v);
#define NEW_MODE_TEST_WARNING1 NOW_DEFAULT #define NEW_MODE_TEST_WARNING1 NOW_DEFAULT
#define NEW_MODE_TEST_WARNING2 NOW_DEFAULT #define NEW_MODE_TEST_WARNING2 NOW_DEFAULT
#define NEW_MODE_FIX_DISK_TMPTABLE_COSTS NOW_DEFAULT #define NEW_MODE_FIX_DISK_TMPTABLE_COSTS NOW_DEFAULT
#define NEW_MODE_FIX_INDEX_STATS_FOR_ALL_NULLS NOW_DEFAULT
#define TEST_NEW_MODE_FLAG(thd, flag) \ #define TEST_NEW_MODE_FLAG(thd, flag) \
(flag == NOW_DEFAULT ? TRUE : thd->variables.new_behavior & flag) (flag == NOW_DEFAULT ? TRUE : thd->variables.new_behavior & flag)
@@ -2824,16 +2825,16 @@ struct wait_for_commit
class Sp_caches class Sp_caches
{ {
protected:
ulong m_sp_cache_version;
public: public:
sp_cache *sp_proc_cache; sp_cache *sp_proc_cache;
sp_cache *sp_func_cache; sp_cache *sp_func_cache;
sp_cache *sp_package_spec_cache; sp_cache *sp_package_spec_cache;
sp_cache *sp_package_body_cache; sp_cache *sp_package_body_cache;
Sp_caches() Sp_caches()
:sp_proc_cache(NULL), :m_sp_cache_version(0), sp_proc_cache(NULL), sp_func_cache(NULL),
sp_func_cache(NULL), sp_package_spec_cache(NULL), sp_package_body_cache(NULL)
sp_package_spec_cache(NULL),
sp_package_body_cache(NULL)
{ } { }
~Sp_caches() ~Sp_caches()
{ {
@@ -2843,19 +2844,22 @@ public:
DBUG_ASSERT(sp_package_spec_cache == NULL); DBUG_ASSERT(sp_package_spec_cache == NULL);
DBUG_ASSERT(sp_package_body_cache == NULL); DBUG_ASSERT(sp_package_body_cache == NULL);
} }
void sp_caches_swap(Sp_caches &rhs)
{
swap_variables(sp_cache*, sp_proc_cache, rhs.sp_proc_cache);
swap_variables(sp_cache*, sp_func_cache, rhs.sp_func_cache);
swap_variables(sp_cache*, sp_package_spec_cache, rhs.sp_package_spec_cache);
swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache);
}
void sp_caches_clear(); void sp_caches_clear();
/** /**
Clear content of sp related caches. Clear content of sp related caches.
Don't delete cache objects itself. Don't delete cache objects itself.
*/ */
void sp_caches_empty(); void sp_caches_empty();
ulong sp_cache_version() const
{
DBUG_ASSERT(m_sp_cache_version);
return m_sp_cache_version;
}
void set_sp_cache_version_if_needed(ulong version)
{
if (!m_sp_cache_version)
m_sp_cache_version= version;
}
}; };

View File

@@ -41,6 +41,8 @@ typedef bool (*dt_processor)(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_optimize_stage2(THD *thd, LEX *lex,
TABLE_LIST *derived);
static bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived);
static bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived); static bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived);
@@ -58,6 +60,7 @@ dt_processor processors[]=
&mysql_derived_create, &mysql_derived_create,
&mysql_derived_fill, &mysql_derived_fill,
&mysql_derived_reinit, &mysql_derived_reinit,
&mysql_derived_optimize_stage2
}; };
/* /*
@@ -109,7 +112,7 @@ mysql_handle_derived(LEX *lex, uint phases)
{ {
if (!cursor->is_view_or_derived() && phases == DT_MERGE_FOR_INSERT) if (!cursor->is_view_or_derived() && phases == DT_MERGE_FOR_INSERT)
continue; continue;
uint8 allowed_phases= (cursor->is_merged_derived() ? DT_PHASES_MERGE : uint allowed_phases= (cursor->is_merged_derived() ? DT_PHASES_MERGE :
DT_PHASES_MATERIALIZE | DT_MERGE_FOR_INSERT); DT_PHASES_MATERIALIZE | DT_MERGE_FOR_INSERT);
/* /*
Skip derived tables to which the phase isn't applicable. Skip derived tables to which the phase isn't applicable.
@@ -170,7 +173,7 @@ bool
mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases) mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases)
{ {
bool res= FALSE; bool res= FALSE;
uint8 allowed_phases= (derived->is_merged_derived() ? DT_PHASES_MERGE : uint allowed_phases= (derived->is_merged_derived() ? DT_PHASES_MERGE :
DT_PHASES_MATERIALIZE); DT_PHASES_MATERIALIZE);
DBUG_ENTER("mysql_handle_single_derived"); DBUG_ENTER("mysql_handle_single_derived");
DBUG_PRINT("enter", ("phases: 0x%x allowed: 0x%x alias: '%s'", DBUG_PRINT("enter", ("phases: 0x%x allowed: 0x%x alias: '%s'",
@@ -1071,6 +1074,43 @@ err:
} }
/*
@brief
Call JOIN::optimize_stage2_and_finish() for all child selects that use
two-phase optimization.
*/
static
bool mysql_derived_optimize_stage2(THD *thd, LEX *lex, TABLE_LIST *derived)
{
SELECT_LEX_UNIT *unit= derived->get_unit();
SELECT_LEX *first_select= unit->first_select();
SELECT_LEX *save_current_select= lex->current_select;
bool res= FALSE;
if (derived->merged || unit->is_unit_op())
{
/*
Two-phase join optimization is not applicable for merged derived tables
and UNIONs.
*/
return FALSE;
}
lex->current_select= first_select;
/* Same condition as in mysql_derived_optimize(): */
if (unit->derived && !derived->is_merged_derived())
{
JOIN *join= first_select->join;
if (join && join->optimization_state == JOIN::OPTIMIZATION_PHASE_1_DONE)
res= join->optimize_stage2_and_finish();
}
lex->current_select= save_current_select;
return res;
}
/** /**
Actually create result table for a materialized derived table/view. Actually create result table for a materialized derived table/view.

View File

@@ -3476,11 +3476,11 @@ bool Delayed_insert::open_and_lock_table()
return TRUE; return TRUE;
} }
if (table->triggers || table->check_constraints) if (table->triggers || table->check_constraints || table->internal_tables)
{ {
/* /*
Table has triggers or check constraints. This is not an error, but we do Table uses triggers, check constraints or sequences. This is not an error,
not support these with delayed insert. Terminate the delayed but we do not support these with delayed insert. Terminate the delayed
thread without an error and thus request lock upgrade. thread without an error and thus request lock upgrade.
*/ */
return TRUE; return TRUE;

View File

@@ -2035,6 +2035,12 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
const uchar *const state_map= cs->state_map; const uchar *const state_map= cs->state_map;
const uchar *const ident_map= cs->ident_map; const uchar *const ident_map= cs->ident_map;
if (thd->killed)
{
thd->send_kill_message();
return END_OF_INPUT;
}
start_token(); start_token();
state= next_state; state= next_state;
next_state= MY_LEX_OPERATOR_OR_IDENT; next_state= MY_LEX_OPERATOR_OR_IDENT;

View File

@@ -7472,6 +7472,7 @@ void THD::reset_for_next_command(bool do_clear_error)
binlog_unsafe_warning_flags= 0; binlog_unsafe_warning_flags= 0;
save_prep_leaf_list= false; save_prep_leaf_list= false;
m_sp_cache_version= 0;
#if defined(WITH_WSREP) && !defined(DBUG_OFF) #if defined(WITH_WSREP) && !defined(DBUG_OFF)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())

View File

@@ -1996,7 +1996,6 @@ bool JOIN::build_explain()
int JOIN::optimize() int JOIN::optimize()
{ {
int res= 0; int res= 0;
join_optimization_state init_state= optimization_state;
if (select_lex->pushdown_select) if (select_lex->pushdown_select)
{ {
if (optimization_state == JOIN::OPTIMIZATION_DONE) if (optimization_state == JOIN::OPTIMIZATION_DONE)
@@ -2013,18 +2012,18 @@ int JOIN::optimize()
} }
with_two_phase_optimization= false; with_two_phase_optimization= false;
} }
else if (optimization_state == JOIN::OPTIMIZATION_PHASE_1_DONE)
res= optimize_stage2();
else else
{ {
// to prevent double initialization on EXPLAIN /*
This function may be invoked multiple times. Do nothing if the
optimization (either full or stage1) are already done.
*/
if (optimization_state != JOIN::NOT_OPTIMIZED) if (optimization_state != JOIN::NOT_OPTIMIZED)
return FALSE; return FALSE;
optimization_state= JOIN::OPTIMIZATION_IN_PROGRESS; optimization_state= JOIN::OPTIMIZATION_IN_PROGRESS;
res= optimize_inner(); res= optimize_inner();
} }
if (!with_two_phase_optimization || if (!with_two_phase_optimization)
init_state == JOIN::OPTIMIZATION_PHASE_1_DONE)
{ {
if (!res && have_query_plan != QEP_DELETED) if (!res && have_query_plan != QEP_DELETED)
res= build_explain(); res= build_explain();
@@ -2041,6 +2040,29 @@ int JOIN::optimize()
} }
/*
@brief
Call optimize_stage2() and save the query plan.
*/
int JOIN::optimize_stage2_and_finish()
{
int res= 0;
DBUG_ASSERT(with_two_phase_optimization);
DBUG_ASSERT(optimization_state == OPTIMIZATION_PHASE_1_DONE);
if (optimize_stage2())
res= 1;
else
{
if (have_query_plan != JOIN::QEP_DELETED)
res= build_explain();
optimization_state= JOIN::OPTIMIZATION_DONE;
}
return res;
}
/** /**
@brief @brief
Create range filters objects needed in execution for all join tables Create range filters objects needed in execution for all join tables
@@ -2777,6 +2799,19 @@ setup_subq_exit:
} }
/*
@brief
In the Stage 1 we've picked the join order.
Now, refine the query plan and sort out all the details.
The choice how to handle GROUP/ORDER BY is also made here.
@detail
The main reason this is a separate function is Split-Materialized
optimization. There, we first consider doing non-split Materialization for
a SELECT. After that, the parent SELECT will attempt doing Splitting in
multiple ways and make the final choice.
*/
int JOIN::optimize_stage2() int JOIN::optimize_stage2()
{ {
ulonglong select_opts_for_readinfo; ulonglong select_opts_for_readinfo;
@@ -2797,7 +2832,7 @@ int JOIN::optimize_stage2()
if (make_range_rowid_filters()) if (make_range_rowid_filters())
DBUG_RETURN(1); DBUG_RETURN(1);
if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE)) if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE_STAGE2))
DBUG_RETURN(1); DBUG_RETURN(1);
/* /*
@@ -3272,9 +3307,14 @@ int JOIN::optimize_stage2()
(as MariaDB is by default sorting on GROUP BY) or (as MariaDB is by default sorting on GROUP BY) or
if there is no GROUP BY and aggregate functions are used if there is no GROUP BY and aggregate functions are used
(as the result will only contain one row). (as the result will only contain one row).
(1) - Do not remove ORDER BY if we have WITH TIES and are using
QUICK_GROUP_MIN_MAX_SELECT to handle GROUP BY. See the comment
for using_with_ties_and_group_min_max() for details.
*/ */
if (order && (test_if_subpart(group_list, order) || if (order && (test_if_subpart(group_list, order) ||
(!group_list && tmp_table_param.sum_func_count))) (!group_list && tmp_table_param.sum_func_count)) &&
!using_with_ties_and_group_min_max(this)) // (1)
order=0; order=0;
// Can't use sort on head table if using join buffering // Can't use sort on head table if using join buffering
@@ -3588,7 +3628,7 @@ setup_subq_exit:
some of the derived tables, and never did stage 2. some of the derived tables, and never did stage 2.
Do it now, otherwise Explain data structure will not be complete. Do it now, otherwise Explain data structure will not be complete.
*/ */
if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE)) if (select_lex->handle_derived(thd->lex, DT_OPTIMIZE_STAGE2))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* /*
@@ -4868,6 +4908,7 @@ bool JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
int JOIN::exec() int JOIN::exec()
{ {
int res; int res;
DBUG_ASSERT(optimization_state == OPTIMIZATION_DONE);
DBUG_EXECUTE_IF("show_explain_probe_join_exec_start", DBUG_EXECUTE_IF("show_explain_probe_join_exec_start",
if (dbug_user_var_equals_int(thd, if (dbug_user_var_equals_int(thd,
"show_explain_probe_select_id", "show_explain_probe_select_id",
@@ -8813,7 +8854,26 @@ best_access_path(JOIN *join,
ulong key_flags; ulong key_flags;
uint key_parts; uint key_parts;
key_part_map found_part= 0; key_part_map found_part= 0;
/* key parts which won't have NULL in lookup tuple */
/*
Bitmap indicating which key parts are used with NULL-rejecting
conditions.
A bit is set to 1 for a key part if it's used with a
NULL-rejecting condition (i.e., the condition will never be
satisfied when the indexed column contains NULL). A bit is 0 if
the key part is used with a non-NULL-rejecting condition (i.e.,
the condition can be satisfied even when the indexed column
contains NULL, e.g., is NULL or <=>).
Example: for condition
t1.keypart1 = t2.col1 AND t1.keypart2 <=> t2.col2 AND
t1.keypart3 = t2.col3
the notnull_part bitmap will be 101 (binary), because:
- keypart1: '=' is NULL-rejecting (bit 1)
- keypart2: '<=>' is NOT NULL-rejecting (bit 0)
- keypart3: '=' is NULL-rejecting (bit 1)
*/
key_part_map notnull_part=0; key_part_map notnull_part=0;
table_map found_ref= 0; table_map found_ref= 0;
uint key= keyuse->key; uint key= keyuse->key;
@@ -9068,7 +9128,8 @@ best_access_path(JOIN *join,
} }
else else
{ {
if (!(records= keyinfo->actual_rec_per_key(key_parts-1))) if (!(records=
keyinfo->rec_per_key_null_aware(key_parts-1, notnull_part)))
{ /* Prefer longer keys */ { /* Prefer longer keys */
trace_access_idx.add("rec_per_key_stats_missing", true); trace_access_idx.add("rec_per_key_stats_missing", true);
records= records=
@@ -9200,7 +9261,9 @@ best_access_path(JOIN *join,
else else
{ {
/* Check if we have statistic about the distribution */ /* Check if we have statistic about the distribution */
if ((records= keyinfo->actual_rec_per_key(max_key_part-1))) if ((records=
keyinfo->rec_per_key_null_aware(max_key_part-1,
notnull_part)))
{ {
/* /*
Fix for the case where the index statistics is too Fix for the case where the index statistics is too
@@ -13556,6 +13619,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->flags= HA_GENERATED_KEY; keyinfo->flags= HA_GENERATED_KEY;
keyinfo->is_statistics_from_stat_tables= FALSE; keyinfo->is_statistics_from_stat_tables= FALSE;
keyinfo->all_nulls_key_parts= 0;
keyinfo->name.str= "$hj"; keyinfo->name.str= "$hj";
keyinfo->name.length= 3; keyinfo->name.length= 3;
keyinfo->rec_per_key= thd->calloc<ulong>(key_parts); keyinfo->rec_per_key= thd->calloc<ulong>(key_parts);
@@ -14754,6 +14818,19 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (build_tmp_join_prefix_cond(join, tab, &sel->cond)) if (build_tmp_join_prefix_cond(join, tab, &sel->cond))
return true; return true;
/*
To be removed in 11.0+:
Caution: we can reach this point with quick=NULL. Below, we'll
use tab->keys and not tab->const_keys like
get_quick_record_count() did. If we have constructed a
group-min-max quick select, make sure we're able to construct it
again
*/
if (sel->quick && sel->quick->get_type() ==
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)
{
tab->keys.set_bit(sel->quick->index);
}
/* /*
We can't call sel->cond->fix_fields, We can't call sel->cond->fix_fields,
as it will break tab->on_expr if it's AND condition as it will break tab->on_expr if it's AND condition
@@ -22611,6 +22688,7 @@ bool Create_tmp_table::finalize(THD *thd,
keyinfo->collected_stats= NULL; keyinfo->collected_stats= NULL;
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->is_statistics_from_stat_tables= FALSE; keyinfo->is_statistics_from_stat_tables= FALSE;
keyinfo->all_nulls_key_parts= 0;
keyinfo->name= group_key; keyinfo->name= group_key;
keyinfo->comment.str= 0; keyinfo->comment.str= 0;
ORDER *cur_group= m_group; ORDER *cur_group= m_group;
@@ -22732,6 +22810,7 @@ bool Create_tmp_table::finalize(THD *thd,
keyinfo->name= distinct_key; keyinfo->name= distinct_key;
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
keyinfo->is_statistics_from_stat_tables= FALSE; keyinfo->is_statistics_from_stat_tables= FALSE;
keyinfo->all_nulls_key_parts= 0;
keyinfo->read_stats= NULL; keyinfo->read_stats= NULL;
keyinfo->collected_stats= NULL; keyinfo->collected_stats= NULL;

View File

@@ -1793,6 +1793,7 @@ public:
int optimize(); int optimize();
int optimize_inner(); int optimize_inner();
int optimize_stage2(); int optimize_stage2();
int optimize_stage2_and_finish();
bool build_explain(); bool build_explain();
int reinit(); int reinit();
int init_execution(); int init_execution();

View File

@@ -5301,20 +5301,18 @@ static int fill_schema_table_from_frm(THD *thd, MEM_ROOT *mem_root,
res= open_table_from_share(thd, share, table_name, 0, res= open_table_from_share(thd, share, table_name, 0,
EXTRA_RECORD | OPEN_FRM_FILE_ONLY, EXTRA_RECORD | OPEN_FRM_FILE_ONLY,
thd->open_options, &tbl, FALSE); thd->open_options, &tbl, FALSE);
if (res && hide_object_error(thd->get_stmt_da()->sql_errno())) if (res)
{
if (hide_object_error(thd->get_stmt_da()->sql_errno()))
res= 0; res= 0;
}
else else
{ {
char buf[NAME_CHAR_LEN + 1];
if (unlikely(res))
get_table_engine_for_i_s(thd, buf, &table_list, db_name, table_name);
tbl.s= share; tbl.s= share;
table_list.table= &tbl; table_list.table= &tbl;
table_list.view= (LEX*) share->is_view; table_list.view= (LEX*) share->is_view;
bool res2= schema_table->process_table(thd, &table_list, table, res, bool res2= schema_table->process_table(thd, &table_list, table, res,
db_name, table_name); db_name, table_name);
if (res == 0)
closefrm(&tbl); closefrm(&tbl);
res= res2; res= res2;
} }
@@ -5458,30 +5456,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
uint table_open_method= tables->table_open_method; uint table_open_method= tables->table_open_method;
bool can_deadlock; bool can_deadlock;
MEM_ROOT tmp_mem_root; MEM_ROOT tmp_mem_root;
/*
We're going to open FRM files for tables.
In case of VIEWs that contain stored function calls,
these stored functions will be parsed and put to the SP cache.
Suppose we have a view containing a stored function call:
CREATE VIEW v1 AS SELECT f1() AS c1;
and now we're running:
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=f1();
If a parallel thread invalidates the cache,
e.g. by creating or dropping some stored routine,
the SELECT query will re-parse f1() when processing "v1"
and replace the outdated cached version of f1() to a new one.
But the old version of f1() is referenced from the m_sp member
of the Item_func_sp instances used in the WHERE condition.
We cannot destroy it. To avoid such clashes, let's remember
all old routines into a temporary SP cache collection
and process tables with a new empty temporary SP cache collection.
Then restore to the old SP cache collection at the end.
*/
Sp_caches old_sp_caches;
old_sp_caches.sp_caches_swap(*thd);
bzero(&tmp_mem_root, sizeof(tmp_mem_root)); bzero(&tmp_mem_root, sizeof(tmp_mem_root));
/* /*
@@ -5706,14 +5680,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
err: err:
thd->restore_backup_open_tables_state(&open_tables_state_backup); thd->restore_backup_open_tables_state(&open_tables_state_backup);
free_root(&tmp_mem_root, 0); free_root(&tmp_mem_root, 0);
/*
Now restore to the saved SP cache collection
and clear the temporary SP cache collection.
*/
old_sp_caches.sp_caches_swap(*thd);
old_sp_caches.sp_caches_clear();
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@@ -3122,7 +3122,10 @@ read_statistics_for_table(THD *thd, TABLE *table,
found|= index_stat.get_stat_values(index_statistics); found|= index_stat.get_stat_values(index_statistics);
} }
if (found) if (found)
{
new_stats_cb->stats_available|= TABLE_STAT_INDEX; new_stats_cb->stats_available|= TABLE_STAT_INDEX;
index_statistics->mark_stats_as_read();
}
key_part_map ext_key_part_map= key_info->ext_key_part_map; key_part_map ext_key_part_map= key_info->ext_key_part_map;
if (key_info->user_defined_key_parts != key_info->ext_key_parts && if (key_info->user_defined_key_parts != key_info->ext_key_parts &&
@@ -4156,11 +4159,35 @@ void set_statistics_for_table(THD *thd, TABLE *table)
for (key_info= table->key_info, key_info_end= key_info+table->s->keys; for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
key_info < key_info_end; key_info++) key_info < key_info_end; key_info++)
{ {
key_info->all_nulls_key_parts= 0;
key_info->is_statistics_from_stat_tables= key_info->is_statistics_from_stat_tables=
(check_eits_preferred(thd) && (check_eits_preferred(thd) &&
table->stats_is_read && table->stats_is_read &&
key_info->read_stats->avg_frequency_is_inited() && key_info->read_stats->avg_frequency_is_inited() &&
key_info->read_stats->get_avg_frequency(0) > 0.5); key_info->read_stats->has_stats(thd));
// Fill out `all_nulls_key_parts` bitmap
if (TEST_NEW_MODE_FLAG(thd, NEW_MODE_FIX_INDEX_STATS_FOR_ALL_NULLS) &&
key_info->is_statistics_from_stat_tables)
{
for (uint part_idx= 0; part_idx < key_info->usable_key_parts; part_idx++)
{
Field *field=
table->field[key_info->key_part[part_idx].field->field_index];
if (!field->read_stats)
{
// No column statistics available
continue;
}
// Check if all values in this column are NULL according to statistics
double nulls_ratio= field->read_stats->get_nulls_ratio();
if (nulls_ratio == 1.0)
{
key_info->all_nulls_key_parts |= (1 << part_idx);
}
}
}
} }
} }

View File

@@ -603,10 +603,24 @@ private:
k-component prefixes among them k-component prefixes among them
*/ */
ulonglong *avg_frequency; ulonglong *avg_frequency;
bool stats_were_read;
public: public:
void init_avg_frequency(ulonglong *ptr)
{
avg_frequency= ptr;
stats_were_read= false;
}
void init_avg_frequency(ulonglong *ptr) { avg_frequency= ptr; } void mark_stats_as_read() { stats_were_read= true; }
bool has_stats(THD *thd) const
{
if (TEST_NEW_MODE_FLAG(thd, NEW_MODE_FIX_INDEX_STATS_FOR_ALL_NULLS))
return stats_were_read;
else
return get_avg_frequency(0) > 0.5;
}
bool avg_frequency_is_inited() { return avg_frequency != NULL; } bool avg_frequency_is_inited() { return avg_frequency != NULL; }

View File

@@ -5111,32 +5111,35 @@ bool wsrep_check_sequence(THD* thd,
const bool used_engine) const bool used_engine)
{ {
enum legacy_db_type db_type; enum legacy_db_type db_type;
const LEX_CSTRING *engine_name;
DBUG_ASSERT(WSREP(thd)); DBUG_ASSERT(WSREP(thd));
if (used_engine) if (used_engine)
{ {
db_type= thd->lex->create_info.db_type->db_type; db_type= thd->lex->create_info.db_type->db_type;
// Currently any dynamic storage engine is not possible to identify
// using DB_TYPE_XXXX and ENGINE=SEQUENCE is one of them.
// Therefore, we get storage engine name from lex.
engine_name=
thd->lex->m_sql_cmd->option_storage_engine_name()->name();
} }
else else
{ {
const handlerton *hton= ha_default_handlerton(thd); const handlerton *hton= ha_default_handlerton(thd);
db_type= hton->db_type; db_type= hton->db_type;
engine_name= hton_name(hton);
} }
// In Galera cluster we support only InnoDB sequences // In Galera cluster we support only InnoDB sequences
if (db_type != DB_TYPE_INNODB) if (db_type != DB_TYPE_INNODB)
{ {
// Currently any dynamic storage engine is not possible to identify
// using DB_TYPE_XXXX and ENGINE=SEQUENCE is one of them.
// Therefore, we get storage engine name from lex.
const LEX_CSTRING *tb_name= thd->lex->m_sql_cmd->option_storage_engine_name()->name();
// (1) CREATE TABLE ... ENGINE=SEQUENCE OR // (1) CREATE TABLE ... ENGINE=SEQUENCE OR
// (2) ALTER TABLE ... ENGINE= OR // (2) ALTER TABLE ... ENGINE= OR
// Note in ALTER TABLE table->s->sequence != nullptr // Note in ALTER TABLE table->s->sequence != nullptr
// (3) CREATE SEQUENCE ... ENGINE= // (3) CREATE SEQUENCE ... ENGINE=
if ((thd->lex->sql_command == SQLCOM_CREATE_TABLE && if ((thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
lex_string_eq(tb_name, STRING_WITH_LEN("SEQUENCE"))) || lex_string_eq(engine_name, STRING_WITH_LEN("SEQUENCE"))) ||
(thd->lex->sql_command == SQLCOM_ALTER_TABLE) || (thd->lex->sql_command == SQLCOM_ALTER_TABLE) ||
(thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE)) (thd->lex->sql_command == SQLCOM_CREATE_SEQUENCE))
{ {
@@ -5144,7 +5147,8 @@ bool wsrep_check_sequence(THD* thd,
"non-InnoDB sequences in Galera cluster"); "non-InnoDB sequences in Galera cluster");
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NOT_SUPPORTED_YET, ER_NOT_SUPPORTED_YET,
"ENGINE=%s not supported by Galera", tb_name->str); "ENGINE=%s not supported by Galera",
engine_name->str);
return(true); return(true);
} }
} }
@@ -11972,6 +11976,7 @@ alter_copy:
} }
else else
{ {
/* MERGE TABLE */
if (!table->s->tmp_table && if (!table->s->tmp_table &&
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN)) wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
goto err_new_table_cleanup; goto err_new_table_cleanup;
@@ -11980,6 +11985,8 @@ alter_copy:
alter_info->keys_onoff); alter_info->keys_onoff);
if (trans_commit_stmt(thd) || trans_commit_implicit(thd)) if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
goto err_new_table_cleanup; goto err_new_table_cleanup;
/* Ensure that the ALTER is binlogged as a DDL */
thd->transaction->stmt.mark_trans_did_ddl();
} }
thd->count_cuted_fields= CHECK_FIELD_IGNORE; thd->count_cuted_fields= CHECK_FIELD_IGNORE;

View File

@@ -173,7 +173,17 @@ typedef struct st_key {
engine_option_value *option_list; engine_option_value *option_list;
ha_index_option_struct *option_struct; /* structure with parsed options */ ha_index_option_struct *option_struct; /* structure with parsed options */
double actual_rec_per_key(uint i) const; /*
Bitmap of key parts where all values are NULL (nulls_ratio == 1.0).
Bit N set means key part N has all NULLs in the corresponding column.
Used for NULL-aware cardinality estimation.
It is computed based on EITS data, otherwise it is 0.
*/
key_part_map all_nulls_key_parts;
double actual_rec_per_key(uint last_key_part_in_prefix) const;
double rec_per_key_null_aware(uint last_key_part_in_prefix,
key_part_map notnull_part) const;
} KEY; } KEY;

View File

@@ -4175,6 +4175,7 @@ static Sys_var_set Sys_old_behavior(
static const char *new_mode_all_names[]= static const char *new_mode_all_names[]=
{ {
"FIX_DISK_TMPTABLE_COSTS", "FIX_DISK_TMPTABLE_COSTS",
"FIX_INDEX_STATS_FOR_ALL_NULLS",
"TEST_WARNING1", // Default from here, See NEW_MODE_MAX "TEST_WARNING1", // Default from here, See NEW_MODE_MAX
"TEST_WARNING2", "TEST_WARNING2",
0 0
@@ -4183,9 +4184,10 @@ static const char *new_mode_all_names[]=
static int new_mode_hidden_names[] = static int new_mode_hidden_names[] =
{ {
0, // FIX_DISK_TMPTABLE_COSTS 0, // FIX_DISK_TMPTABLE_COSTS
1, // TEST_WARNING1 1, // FIX_INDEX_STATS_FOR_ALL_NULLS
2, // TEST_WARNING2 2, // TEST_WARNING1
-1 // End of list 3, // TEST_WARNING2
-1
}; };
/* /*

View File

@@ -8728,6 +8728,7 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
bzero(keyinfo->rec_per_key, sizeof(ulong)*key_parts); bzero(keyinfo->rec_per_key, sizeof(ulong)*key_parts);
keyinfo->read_stats= NULL; keyinfo->read_stats= NULL;
keyinfo->collected_stats= NULL; keyinfo->collected_stats= NULL;
keyinfo->all_nulls_key_parts= 0;
for (i= 0; i < key_parts; i++) for (i= 0; i < key_parts; i++)
{ {
@@ -10488,12 +10489,68 @@ uint TABLE_SHARE::actual_n_key_parts(THD *thd)
} }
double KEY::actual_rec_per_key(uint i) const /**
Get records-per-key estimate for an index prefix.
Returns average number of records per key value for the given index prefix.
Prefers engine-independent statistics (EITS) if available and falls back
to engine-dependent statistics otherwise.
@param last_key_part_in_prefix Index of the last key part
in the prefix (0-based)
@return Estimated records per key value:
- 0.0 if no statistics available
- avg_frequency from EITS if available
- rec_per_key from engine statistics if EITS is not available
*/
double KEY::actual_rec_per_key(uint last_key_part_in_prefix) const
{ {
if (rec_per_key == 0) if (is_statistics_from_stat_tables)
return 0; {
return (is_statistics_from_stat_tables ? // Use engine-independent statistics (EITS)
read_stats->get_avg_frequency(i) : (double) rec_per_key[i]); return read_stats->get_avg_frequency(last_key_part_in_prefix);
}
// Fall back to engine-dependent statistics if EITS is not available
return rec_per_key ? (double) rec_per_key[last_key_part_in_prefix] : 0.0;
}
/**
Get records-per-key estimate for an index prefix with NULL-aware optimization.
Returns average number of records per key value for the given index prefix.
When EITS statistics show avg_frequency == 0 (typically all NULL values) and
the query uses NULL-rejecting conditions (e.g., =), returns 1.0 to indicate
high selectivity since NULL = NULL never matches.
@param last_key_part_in_prefix Index of the last key part
in the prefix (0-based)
@param notnull_part Bitmap indicating which key parts have NULL-rejecting
conditions (bit N set means key part N uses =, not <=>)
@return Estimated records per key value:
- 0.0 if no statistics available
- avg_frequency from EITS if available
- 1.0 if all values are NULL with NULL-rejecting condition
- rec_per_key from engine statistics if EITS is not available
*/
double KEY::rec_per_key_null_aware(uint last_key_part_in_prefix,
key_part_map notnull_part) const
{
if (notnull_part & all_nulls_key_parts)
{
/*
For NULL-rejecting conditions like `t1.key_col = t2.col`, we know
there will be no matches (since NULL = NULL is never true).
If at least one NULL-rejecting condition is present, and all
corresponding key part values are NULL, return number of records 1.0
(highly selective), indicating no expected matches.
*/
return 1.0;
}
return actual_rec_per_key(last_key_part_in_prefix);
} }
/* /*

Some files were not shown because too many files have changed in this diff Show More