1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 11.4 into 11.8

This commit is contained in:
Marko Mäkelä
2025-03-05 20:39:47 +02:00
177 changed files with 5360 additions and 2623 deletions

View File

@ -71,6 +71,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/log_event.cc ../sql/log_event_server.cc ../sql/log_event.cc ../sql/log_event_server.cc
../sql/mf_iocache.cc ../sql/my_decimal.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc
../sql/net_serv.cc ../sql/opt_range.cc ../sql/net_serv.cc ../sql/opt_range.cc
../sql/opt_group_by_cardinality.cc
../sql/opt_rewrite_date_cmp.cc ../sql/opt_rewrite_date_cmp.cc
../sql/opt_rewrite_remove_casefold.cc ../sql/opt_rewrite_remove_casefold.cc
../sql/opt_sargable_left.cc ../sql/opt_sargable_left.cc

View File

@ -0,0 +1,24 @@
DELIMITER $$;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS INT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc INT DEFAULT 0;
FUNCTION f1() RETURNS INT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
DELIMITER ;$$

View File

@ -0,0 +1,20 @@
# Mixing a package body variable and a local variable in the same FETCH.
DELIMITER $$;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc1 INT DEFAULT 0;
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE vc2 INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN CONCAT(vc1, ' ', vc2);
END;
END;
$$
DELIMITER ;$$

View File

@ -0,0 +1,19 @@
# Fetching into a PACKAGE BODY variable of the ROW type
DELIMITER $$;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc ROW(p1 INT, p2 INT);
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN CONCAT(vc.p1, ' ', vc.p2);
END;
END;
$$
DELIMITER ;$$

View File

@ -76,3 +76,16 @@ WHERE schema_name='comment';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT
def comment latin2 latin2_general_ci NULL comment def comment latin2 latin2_general_ci NULL comment
DROP DATABASE comment; DROP DATABASE comment;
CREATE DATABASE db1;
# restart
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */
Warnings:
Note 1105 Database 'db1' does not have a db.opt file. You can create one with ALTER DATABASE if needed
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */
Warnings:
Note 1105 Database 'db1' does not have a db.opt file. You can create one with ALTER DATABASE if needed
DROP DATABASE db1;

View File

@ -63,3 +63,11 @@ SELECT * FROM information_schema.schemata
WHERE schema_name='comment'; WHERE schema_name='comment';
DROP DATABASE comment; DROP DATABASE comment;
--enable_service_connection --enable_service_connection
CREATE DATABASE db1;
--remove_file $MARIADB_DATADIR/db1/db.opt
--source include/restart_mysqld.inc
# We need to call this two times to ensure all code paths are used
SHOW CREATE DATABASE db1;
SHOW CREATE DATABASE db1;
DROP DATABASE db1;

View File

@ -68,6 +68,8 @@ SET @@collation_database=DEFAULT;
SHOW CREATE DATABASE db1; SHOW CREATE DATABASE db1;
Database Create Database Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */
Warnings:
Note 1105 Database 'db1' does not have a db.opt file. You can create one with ALTER DATABASE if needed
USE db1; USE db1;
SELECT @@collation_database, 'taken from defaults' AS comment; SELECT @@collation_database, 'taken from defaults' AS comment;
@@collation_database comment @@collation_database comment

View File

@ -318,7 +318,7 @@ a 7.0000
b 3.5000 b 3.5000
explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name; explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.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 289 Using temporary; Using filesort 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort 2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
2 DERIVED y ALL NULL NULL NULL NULL 17 Using where; Using join buffer (flat, BNL join) 2 DERIVED y ALL NULL NULL NULL NULL 17 Using where; Using join buffer (flat, BNL join)
drop table t1; drop table t1;
@ -1999,8 +1999,8 @@ group by ic1
) dt1 (oc1, oc2, oc3) ) dt1 (oc1, oc2, oc3)
join t3 on t3.c1 = dt1.oc1+9; join t3 on t3.c1 = dt1.oc1+9;
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 t3 ALL NULL NULL NULL NULL 2 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 DERIVED <derived3> ALL NULL NULL NULL NULL 2 Using temporary; Using filesort 2 DERIVED <derived3> ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort 3 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort

View File

@ -20183,7 +20183,7 @@ where t2.b < 40 and t2.a=t3.a and t3.c=t.c;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where 1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where
1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 5 100.00
2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort 2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40
@ -20233,7 +20233,7 @@ EXPLAIN
"used_key_parts": ["c"], "used_key_parts": ["c"],
"ref": ["test.t3.c"], "ref": ["test.t3.c"],
"loops": 80.99999987, "loops": 80.99999987,
"rows": 10, "rows": 5,
"cost": "COST_REPLACED", "cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"materialized": { "materialized": {
@ -22798,7 +22798,7 @@ from t1 limit 5;
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 ALL NULL NULL NULL NULL 1000 1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where 2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 100 2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 1
3 DERIVED t2 ALL a NULL NULL NULL 1000 Using temporary; Using filesort 3 DERIVED t2 ALL a NULL NULL NULL 1000 Using temporary; Using filesort
select select
a, a,

View File

@ -283,7 +283,7 @@ on t3.a=t.a and t3.c=t.c
where t3.b > 15; where t3.b > 15;
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 t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where 1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where
1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2
2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort 2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort
drop table t3, t4; drop table t3, t4;
# End of 10.3 tests # End of 10.3 tests
@ -815,7 +815,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (flat, BNL join) 1 PRIMARY t2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (incremental, BNL join) 1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (incremental, BNL join)
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 1000 Using where 1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 DERIVED t10 ALL grp_id NULL NULL NULL 10000 Using temporary; Using filesort 2 DERIVED t10 ALL grp_id NULL NULL NULL 10000 Using temporary; Using filesort
2 DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) 2 DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select * select *

View File

@ -154,7 +154,7 @@ INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED SELECT 1 EXPLAIN EXTENDED SELECT 1
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
@ -162,7 +162,7 @@ Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(disti
EXPLAIN EXTENDED SELECT 1 EXPLAIN EXTENDED SELECT 1
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
@ -172,7 +172,7 @@ prepare s1 from
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
execute s1; execute s1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
@ -182,14 +182,14 @@ prepare s1 from
FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
execute s1; execute s1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
execute s1; execute s1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:

View File

@ -990,8 +990,8 @@ INSERT INTO t1 VALUES (),();
EXPLAIN EXTENDED SELECT 1 FROM EXPLAIN EXTENDED SELECT 1 FROM
(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED td ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED td ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:
@ -1012,7 +1012,7 @@ EXPLAIN EXTENDED SELECT 1 FROM
(SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM
t1 t2, t1 GROUP BY t1.a) AS d; t1 t2, t1 GROUP BY t1.a) AS d;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort 2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
Warnings: Warnings:

View File

@ -5465,6 +5465,33 @@ INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
SELECT NTH_VALUE(a,b) OVER () FROM t; SELECT NTH_VALUE(a,b) OVER () FROM t;
ERROR HY000: Illegal parameter data types point and bigint for operation '-' ERROR HY000: Illegal parameter data types point and bigint for operation '-'
DROP TABLE t; DROP TABLE t;
#
# MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid)
#
SELECT
ST_SRID(g1),
ST_SRID(ST_GeomFromWKB(g1, 4326)),
ST_SRID(ST_GeomFromWKB(g1)),
ST_AsText(g1),
ST_SRID(ST_PointFromWKB(g2, 4326)),
ST_SRID(g2),
ST_SRID(ST_LineStringFromWKB(g3, 3)),
ST_SRID(ST_PolygonFromWKB(g4, 4)),
ST_SRID(ST_MultiPointFromWKB(g5, 5)),
ST_SRID(ST_MultiLineStringFromWKB(g6, 6)),
ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
FROM (
SELECT
POINT(1, 2) AS g1,
POINT(4, 3) AS g2,
LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3,
POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4,
MULTIPOINT(POINT(4, 3)) AS g5,
MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6,
MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7
) AS t;
ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7
# End of 10.5 tests # End of 10.5 tests
# #
# Start of 11.5 tests # Start of 11.5 tests

View File

@ -3471,6 +3471,32 @@ INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
SELECT NTH_VALUE(a,b) OVER () FROM t; SELECT NTH_VALUE(a,b) OVER () FROM t;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid)
--echo #
SELECT
ST_SRID(g1),
ST_SRID(ST_GeomFromWKB(g1, 4326)),
ST_SRID(ST_GeomFromWKB(g1)),
ST_AsText(g1),
ST_SRID(ST_PointFromWKB(g2, 4326)),
ST_SRID(g2),
ST_SRID(ST_LineStringFromWKB(g3, 3)),
ST_SRID(ST_PolygonFromWKB(g4, 4)),
ST_SRID(ST_MultiPointFromWKB(g5, 5)),
ST_SRID(ST_MultiLineStringFromWKB(g6, 6)),
ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
FROM (
SELECT
POINT(1, 2) AS g1,
POINT(4, 3) AS g2,
LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3,
POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4,
MULTIPOINT(POINT(4, 3)) AS g5,
MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6,
MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7
) AS t;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@ -0,0 +1,213 @@
#
# MDEV-30877: Output cardinality for derived table ignores GROUP BY
#
create table t1 (
groups_20 int,
groups_20_2 int,
b int,
index (groups_20)
);
insert into t1 select seq/1000, seq/1000, seq from seq_1_to_20000;
create table t2 (a int, b int, index(a));
insert into t2 select seq, seq from seq_1_to_10;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
set optimizer_trace=1;
# Case 1: one indexed column
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1
group by groups_20) TBL
where
1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
2 DERIVED t1 index NULL groups_20 5 NULL 20000 Using index
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
[
{
"join_output_cardinality": 20000,
"estimation":
[
{
"table": "t1",
"steps":
[
{
"index_name": "groups_20",
"cardinality": 20.99999895
}
],
"cardinality": 20.99999895
}
],
"post_group_cardinality": 20.99999895
}
]
# Case 2: one non- indexed column
explain
select *
from
t2,
(select count(*) cnt, groups_20_2 from t1
group by groups_20_2) TBL
where
1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 20000 Using temporary; Using filesort
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
[
{
"join_output_cardinality": 20000,
"estimation":
[
{
"table": "t1",
"steps":
[
{
"column": "groups_20_2",
"cardinality": 20.99999895
}
],
"cardinality": 20.99999895
}
],
"post_group_cardinality": 20.99999895
}
]
# Case 4: one indexed column, multiple tables
create table t3(c int);
insert into t3 select seq from seq_1_to_10;
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1,t3
group by groups_20) TBL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
2 DERIVED t3 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
2 DERIVED t1 index NULL groups_20 5 NULL 20000 Using index; Using join buffer (flat, BNL join)
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
[
{
"join_output_cardinality": 200000,
"estimation":
[
{
"table": "t1",
"steps":
[
{
"index_name": "groups_20",
"cardinality": 20.99999895
}
],
"cardinality": 20.99999895
}
],
"post_group_cardinality": 20.99999895
}
]
# Case 5: group by two tables
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1,t3
group by groups_20, t3.c) TBL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 209 Using join buffer (flat, BNL join)
2 DERIVED t3 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
2 DERIVED t1 index NULL groups_20 5 NULL 20000 Using index; Using join buffer (flat, BNL join)
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
[
{
"join_output_cardinality": 200000,
"estimation":
[
{
"table": "t1",
"steps":
[
{
"index_name": "groups_20",
"cardinality": 20.99999895
}
],
"cardinality": 20.99999895
},
{
"table": "t3",
"steps":
[],
"cardinality": 10
}
],
"post_group_cardinality": 209.9999895
}
]
# Now, without an index
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1 use index(),t3 group by groups_20) TBL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join)
2 DERIVED t3 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
2 DERIVED t1 ALL NULL NULL NULL NULL 20000 Using join buffer (flat, BNL join)
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
[
{
"join_output_cardinality": 200000,
"estimation":
[
{
"table": "t1",
"steps":
[
{
"column": "groups_20",
"cardinality": 20.99999895
}
],
"cardinality": 20.99999895
}
],
"post_group_cardinality": 20.99999895
}
]
set optimizer_trace=default;
drop table t1, t2, t3;

View File

@ -0,0 +1,108 @@
--echo #
--echo # MDEV-30877: Output cardinality for derived table ignores GROUP BY
--echo #
--source include/have_sequence.inc
--source include/not_embedded.inc
create table t1 (
groups_20 int,
groups_20_2 int,
b int,
index (groups_20)
);
insert into t1 select seq/1000, seq/1000, seq from seq_1_to_20000;
create table t2 (a int, b int, index(a));
insert into t2 select seq, seq from seq_1_to_10;
analyze table t1 persistent for all;
set optimizer_trace=1;
--echo # Case 1: one indexed column
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1
group by groups_20) TBL
where
1;
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
--enable_view_protocol
--echo # Case 2: one non- indexed column
explain
select *
from
t2,
(select count(*) cnt, groups_20_2 from t1
group by groups_20_2) TBL
where
1;
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
--enable_view_protocol
--echo # Case 4: one indexed column, multiple tables
create table t3(c int);
insert into t3 select seq from seq_1_to_10;
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1,t3
group by groups_20) TBL;
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
--enable_view_protocol
--echo # Case 5: group by two tables
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1,t3
group by groups_20, t3.c) TBL;
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
--enable_view_protocol
--echo # Now, without an index
explain
select *
from
t2,
(select count(*) cnt, groups_20 from t1 use index(),t3 group by groups_20) TBL;
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.materialized_output_cardinality'))
from
information_schema.optimizer_trace;
--enable_view_protocol
set optimizer_trace=default;
drop table t1, t2, t3;

View File

@ -6507,4 +6507,30 @@ DROP TABLE t1, t2;
# #
# End of 10.5 tests # End of 10.5 tests
# #
#
# MDEV-36165: BKA join cache buffer is employed despite join_cache_level=3 (flat BNLH)
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t2(a INT, b INT);
INSERT INTO t2 SELECT a, a from t1;
CREATE TABLE t3(a INT, b INT, c INT, key (a,b));
INSERT INTO t3 select a, a, a FROM t1;
SET optimizer_switch = 'join_cache_hashed=off,join_cache_bka=on,mrr=on';
SET join_cache_level = 3;
EXPLAIN SELECT * FROM t2, t3 WHERE t2.a=t3.a AND (t3.b+1 <= t2.b+1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t3 ref a a 5 test.t2.a 1 Using index condition
SET join_cache_level = 4;
EXPLAIN SELECT * FROM t2, t3 WHERE t2.a=t3.a AND (t3.b+1 <= t2.b+1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t3 ref a a 5 test.t2.a 1 Using index condition
SET join_cache_level = default;
SET optimizer_switch = default;
DROP TABLE t1, t2, t3;
#
# End of 10.11 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

@ -4383,4 +4383,31 @@ DROP TABLE t1, t2;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #
--echo #
--echo # MDEV-36165: BKA join cache buffer is employed despite join_cache_level=3 (flat BNLH)
--echo #
--source include/have_sequence.inc
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t2(a INT, b INT);
INSERT INTO t2 SELECT a, a from t1;
CREATE TABLE t3(a INT, b INT, c INT, key (a,b));
INSERT INTO t3 select a, a, a FROM t1;
SET optimizer_switch = 'join_cache_hashed=off,join_cache_bka=on,mrr=on';
SET join_cache_level = 3;
EXPLAIN SELECT * FROM t2, t3 WHERE t2.a=t3.a AND (t3.b+1 <= t2.b+1);
SET join_cache_level = 4;
EXPLAIN SELECT * FROM t2, t3 WHERE t2.a=t3.a AND (t3.b+1 <= t2.b+1);
SET join_cache_level = default;
SET optimizer_switch = default;
DROP TABLE t1, t2, t3;
--echo #
--echo # End of 10.11 tests
--echo #
--source include/test_db_charset_restore.inc --source include/test_db_charset_restore.inc

View File

@ -296,11 +296,11 @@ db2.locations: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
Adding secondary indexes to table `locations` Adding secondary indexes to table `locations`
show index from vec; show index from vec;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
vec 0 PRIMARY 1 id A 10 NULL NULL BTREE NO vec 0 PRIMARY 1 id A 1 NULL NULL BTREE NO
vec 1 v 1 v A NULL NULL NULL VECTOR NO vec 1 v 1 v A NULL NULL NULL VECTOR NO
show index from locations; show index from locations;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
locations 0 PRIMARY 1 id A 0 NULL NULL BTREE NO locations 0 PRIMARY 1 id A 1 NULL NULL BTREE NO
locations 1 idx_geom 1 geom A NULL 32 NULL SPATIAL NO locations 1 idx_geom 1 geom A NULL 32 NULL SPATIAL NO
show index from ft; show index from ft;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored

View File

@ -12,6 +12,8 @@ FLUSH TABLES;
SHOW CREATE DATABASE sys; SHOW CREATE DATABASE sys;
Database Create Database Database Create Database
sys CREATE DATABASE `sys` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */ sys CREATE DATABASE `sys` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */
Warnings:
Note 1105 Database 'sys' does not have a db.opt file. You can create one with ALTER DATABASE if needed
Phase 1/8: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
Processing databases Processing databases
mysql mysql

View File

@ -514,6 +514,23 @@ select * from v2 {
} }
] ]
}, },
{
"materialized_output_cardinality": {
"join_output_cardinality": 1,
"estimation": [
{
"table": "t1",
"steps": [
{
"column": "b",
"cardinality": 2
}
],
"cardinality": 2
}
]
}
},
{ {
"check_split_materialized": { "check_split_materialized": {
"not_applicable": "no candidate field can be accessed through ref" "not_applicable": "no candidate field can be accessed through ref"
@ -803,7 +820,7 @@ explain select * from v2 {
# Non-Mergeable view # Non-Mergeable view
explain select * from v1 ; explain select * from v1 ;
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 10 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
2 DERIVED t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
explain select * from v1 { explain select * from v1 {
@ -908,6 +925,24 @@ explain select * from v1 {
} }
] ]
}, },
{
"materialized_output_cardinality": {
"join_output_cardinality": 10,
"estimation": [
{
"table": "t1",
"steps": [
{
"column": "b",
"cardinality": 4
}
],
"cardinality": 4
}
],
"post_group_cardinality": 4
}
},
{ {
"check_split_materialized": { "check_split_materialized": {
"not_applicable": "group list has no candidates" "not_applicable": "group list has no candidates"
@ -953,9 +988,9 @@ explain select * from v1 {
{ {
"table": "<derived2>", "table": "<derived2>",
"table_scan": { "table_scan": {
"rows": 10, "rows": 4,
"read_cost": 0.010103506, "read_cost": 0.010041402,
"read_and_compare_cost": 0.010446846 "read_and_compare_cost": 0.010178738
} }
} }
] ]
@ -974,19 +1009,19 @@ explain select * from v1 {
"considered_access_paths": [ "considered_access_paths": [
{ {
"access_type": "scan", "access_type": "scan",
"rows": 10, "rows": 4,
"rows_after_filter": 10, "rows_after_filter": 4,
"rows_out": 10, "rows_out": 4,
"cost": 0.010446846, "cost": 0.010178738,
"index_only": false, "index_only": false,
"chosen": true "chosen": true
} }
], ],
"chosen_access_method": { "chosen_access_method": {
"type": "scan", "type": "scan",
"rows_read": 10, "rows_read": 4,
"rows_out": 10, "rows_out": 4,
"cost": 0.010446846, "cost": 0.010178738,
"uses_join_buffering": false "uses_join_buffering": false
} }
} }
@ -996,15 +1031,15 @@ explain select * from v1 {
{ {
"plan_prefix": "", "plan_prefix": "",
"table": "<derived2>", "table": "<derived2>",
"rows_for_plan": 10, "rows_for_plan": 4,
"cost_for_plan": 0.010446846 "cost_for_plan": 0.010178738
} }
] ]
}, },
{ {
"best_join_order": ["<derived2>"], "best_join_order": ["<derived2>"],
"rows": 10, "rows": 4,
"cost": 0.010446846 "cost": 0.010178738
}, },
{ {
"attaching_conditions_to_tables": { "attaching_conditions_to_tables": {

View File

@ -248,3 +248,63 @@ SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4;
id id
5 5
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-34620: Many index_merge variants made and discarded for a big OR
#
CREATE TABLE t1 (
a1 int NOT NULL,
a2 int NOT NULL,
filler char(100),
KEY key1 (a1,a2),
KEY key2 (a2,a1)
);
insert into t1 (a1,a2) values (1,1),(2,2),(3,3);
set @query= concat(
"explain select * from t1 where\n",
(select
group_concat(concat("a1=", seq, " and a2=", seq, " ") separator "\nor " )
from seq_1_to_30)
);
set optimizer_trace=1;
prepare s from @query;
execute s;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL key1,key2 NULL NULL NULL 3 Using where
set @trace=json_extract((select trace from information_schema.optimizer_trace), '$**.range_analysis');
# Observe that "key1" is a a part of several index_merge_union:
select json_pretty(json_search(@trace, 'all', 'key1'));
json_pretty(json_search(@trace, 'all', 'key1'))
[
"$[0].potential_range_indexes[0].index",
"$[0].analyzing_range_alternatives.range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[0].indexes_to_merge[0].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[0].indexes_to_merge[1].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[1].indexes_to_merge[0].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[1].indexes_to_merge[1].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[1].indexes_to_merge[2].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[2].indexes_to_merge[0].range_scan_alternatives[0].index",
"$[0].analyzing_range_alternatives.analyzing_index_merge_union[2].indexes_to_merge[1].range_scan_alternatives[0].index"
]
#
# Now, same as above but for a long IN-list
#
set @query= concat(
"explain select * from t1 where\n",
(select
group_concat(concat("a1=", seq, " and a2=", seq, " ") separator "\nor " )
from seq_1_to_120)
);
set optimizer_trace=1;
prepare s from @query;
execute s;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL key1,key2 NULL NULL NULL 3 Using where
set @trace=json_extract((select trace from information_schema.optimizer_trace), '$**.range_analysis');
# Observe that there are NO index_merge_union candidates. Only one potential range scan:
select json_pretty(json_search(@trace, 'all', 'key1'));
json_pretty(json_search(@trace, 'all', 'key1'))
[
"$[0].potential_range_indexes[0].index",
"$[0].analyzing_range_alternatives.range_scan_alternatives[0].index"
]
drop table t1;

View File

@ -163,3 +163,51 @@ INSERT INTO t1 VALUES (1),(5);
SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4; SELECT id FROM t1 WHERE id IS NULL OR id NOT BETWEEN 1 AND 4;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-34620: Many index_merge variants made and discarded for a big OR
--echo #
CREATE TABLE t1 (
a1 int NOT NULL,
a2 int NOT NULL,
filler char(100),
KEY key1 (a1,a2),
KEY key2 (a2,a1)
);
insert into t1 (a1,a2) values (1,1),(2,2),(3,3);
set @query= concat(
"explain select * from t1 where\n",
(select
group_concat(concat("a1=", seq, " and a2=", seq, " ") separator "\nor " )
from seq_1_to_30)
);
set optimizer_trace=1;
prepare s from @query;
execute s;
set @trace=json_extract((select trace from information_schema.optimizer_trace), '$**.range_analysis');
--echo # Observe that "key1" is a a part of several index_merge_union:
select json_pretty(json_search(@trace, 'all', 'key1'));
--echo #
--echo # Now, same as above but for a long IN-list
--echo #
set @query= concat(
"explain select * from t1 where\n",
(select
group_concat(concat("a1=", seq, " and a2=", seq, " ") separator "\nor " )
from seq_1_to_120)
);
set optimizer_trace=1;
prepare s from @query;
execute s;
set @trace=json_extract((select trace from information_schema.optimizer_trace), '$**.range_analysis');
--echo # Observe that there are NO index_merge_union candidates. Only one potential range scan:
select json_pretty(json_search(@trace, 'all', 'key1'));
drop table t1;

View File

@ -144,9 +144,9 @@ and total_revenue = (select max(total_revenue) from revenue0)
order by s_suppkey; order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort 1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 1 100.00 Using where
3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort 3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 269 100.00 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 10 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
@ -165,9 +165,9 @@ and total_revenue = (select max(total_revenue) from revenue0)
order by s_suppkey; order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort 1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 1 100.00 Using where
3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort 3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 269 100.00 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 10 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`

View File

@ -149,9 +149,9 @@ and total_revenue = (select max(total_revenue) from revenue0)
order by s_suppkey; order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00 1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 1 100.00 Using where
3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort 3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 229 100.00 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 10 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`
@ -170,9 +170,9 @@ and total_revenue = (select max(total_revenue) from revenue0)
order by s_suppkey; order by s_suppkey;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00 1 PRIMARY supplier index PRIMARY PRIMARY 4 NULL 10 100.00
1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where 1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 1 100.00 Using where
3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort 3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 229 100.00 2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 10 100.00
4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort 4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 229 100.00 Using where; Using temporary; Using filesort
Warnings: Warnings:
Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey`

View File

@ -852,3 +852,75 @@ ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor param
# #
# End of 10.8 tests # End of 10.8 tests
# #
# Start of 11.4 tests
#
# MDEV-36047 Package body variables are not allowed as FETCH targets
#
CREATE PACKAGE pkg
FUNCTION f1() RETURNS INT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc INT DEFAULT 0;
FUNCTION f1() RETURNS INT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
SELECT pkg.f1();
pkg.f1()
1
DROP PACKAGE pkg;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc1 INT DEFAULT 0;
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE vc2 INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN CONCAT(vc1, ' ', vc2);
END;
END;
$$
SELECT pkg.f1();
pkg.f1()
1 2
DROP PACKAGE pkg;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc ROW(p1 INT, p2 INT);
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN CONCAT(vc.p1, ' ', vc.p2);
END;
END;
$$
SELECT pkg.f1();
pkg.f1()
1 2
DROP PACKAGE pkg;
# End of 11.4 tests

View File

@ -872,3 +872,23 @@ DELIMITER ;$$
--echo # --echo #
--echo # End of 10.8 tests --echo # End of 10.8 tests
--echo # --echo #
--echo # Start of 11.4 tests
--echo #
--echo # MDEV-36047 Package body variables are not allowed as FETCH targets
--echo #
--source include/sp-cursor-pkg-01.inc
SELECT pkg.f1();
DROP PACKAGE pkg;
--source include/sp-cursor-pkg-02.inc
SELECT pkg.f1();
DROP PACKAGE pkg;
--source include/sp-cursor-pkg-03.inc
SELECT pkg.f1();
DROP PACKAGE pkg;
--echo # End of 11.4 tests

View File

@ -258,3 +258,105 @@ Pos Instruction
6 set a.a@0["a"] b.a@1["a"] + 1 6 set a.a@0["a"] b.a@1["a"] + 1
DROP PACKAGE pkg1; DROP PACKAGE pkg1;
DROP TABLE t1; DROP TABLE t1;
# Start of 11.4 tests
#
# MDEV-36047 Package body variables are not allowed as FETCH targets
#
CREATE PACKAGE pkg
FUNCTION f1() RETURNS INT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc INT DEFAULT 0;
FUNCTION f1() RETURNS INT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c FROM DUAL;
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 cpush cur@0
1 copen cur@0
2 cfetch cur@0 PACKAGE_BODY.vc@0
3 cclose cur@0
4 freturn int PACKAGE_BODY.vc@0
SHOW PACKAGE BODY CODE pkg;
Pos Instruction
0 set vc@0 0
1 cpush cur@0
2 copen cur@0
3 cfetch cur@0 vc@0
4 cclose cur@0
5 cpop 1
DROP PACKAGE pkg;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc1 INT DEFAULT 0;
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE vc2 INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN CONCAT(vc1, ' ', vc2);
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 set vc2@0 0
1 cpush cur@0
2 copen cur@0
3 cfetch cur@0 PACKAGE_BODY.vc1@0 vc2@0
4 cclose cur@0
5 freturn blob concat(PACKAGE_BODY.vc1@0,' ',vc2@0)
DROP PACKAGE pkg;
CREATE PACKAGE pkg
FUNCTION f1() RETURNS TEXT;
END;
$$
CREATE PACKAGE BODY pkg
DECLARE vc ROW(p1 INT, p2 INT);
FUNCTION f1() RETURNS TEXT
BEGIN
DECLARE cur CURSOR FOR SELECT 1 AS c1, 2 AS c2 FROM DUAL;
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN CONCAT(vc.p1, ' ', vc.p2);
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 cpush cur@0
1 copen cur@0
2 cfetch cur@0 PACKAGE_BODY.vc@0
3 cclose cur@0
4 freturn blob concat(PACKAGE_BODY.vc.p1@0[0],' ',PACKAGE_BODY.vc.p2@0[1])
DROP PACKAGE pkg;
# End of 11.4 tests

View File

@ -198,3 +198,26 @@ DROP PACKAGE pkg1;
DROP TABLE t1; DROP TABLE t1;
--echo # Start of 11.4 tests
--echo #
--echo # MDEV-36047 Package body variables are not allowed as FETCH targets
--echo #
--source include/sp-cursor-pkg-01.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
SHOW PACKAGE BODY CODE pkg;
DROP PACKAGE pkg;
--source include/sp-cursor-pkg-02.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
DROP PACKAGE pkg;
--source include/sp-cursor-pkg-03.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
DROP PACKAGE pkg;
--echo # End of 11.4 tests

View File

@ -772,7 +772,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select t1.* from t1 left join v2b on t1.a=v2b.b; explain select t1.* from t1 left join v2b on t1.a=v2b.b;
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 ALL NULL NULL NULL NULL 10 1 PRIMARY t1 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ref key0 key0 8 test.t1.a 10 Using where 1 PRIMARY <derived2> ref key0 key0 8 test.t1.a 1 Using where
2 DERIVED t11 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort 2 DERIVED t11 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort
# Check format JSON as well # Check format JSON as well
explain format=JSON select t1.* from t1 left join v2b on t1.a=v2b.b; explain format=JSON select t1.* from t1 left join v2b on t1.a=v2b.b;
@ -803,7 +803,7 @@ EXPLAIN
"used_key_parts": ["b"], "used_key_parts": ["b"],
"ref": ["test.t1.a"], "ref": ["test.t1.a"],
"loops": 10, "loops": 10,
"rows": 10, "rows": 1,
"cost": "COST_REPLACED", "cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "trigcond(t1.a = v2b.b and trigcond(t1.a is not null))", "attached_condition": "trigcond(t1.a = v2b.b and trigcond(t1.a is not null))",
@ -870,7 +870,7 @@ EXPLAIN
explain select t1.* from t1 left join v2c on t1.a=v2c.b; explain select t1.* from t1 left join v2c on t1.a=v2c.b;
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 ALL NULL NULL NULL NULL 10 1 PRIMARY t1 ALL NULL NULL NULL NULL 10
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 10 Using where 1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 Using where
2 DERIVED t11 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort 2 DERIVED t11 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort
2 DERIVED t12 eq_ref PRIMARY PRIMARY 4 test.t11.b 1 Using where 2 DERIVED t12 eq_ref PRIMARY PRIMARY 4 test.t11.b 1 Using where
# Check format JSON as well # Check format JSON as well
@ -902,7 +902,7 @@ EXPLAIN
"used_key_parts": ["b"], "used_key_parts": ["b"],
"ref": ["test.t1.a"], "ref": ["test.t1.a"],
"loops": 10, "loops": 10,
"rows": 10, "rows": 1,
"cost": "COST_REPLACED", "cost": "COST_REPLACED",
"filtered": 100, "filtered": 100,
"attached_condition": "trigcond(trigcond(t1.a is not null))", "attached_condition": "trigcond(trigcond(t1.a is not null))",

View File

@ -46,23 +46,70 @@ ALTER TABLE t1 MODIFY a DECIMAL(10,0);
SELECT * FROM t1,t2 WHERE a=d; SELECT * FROM t1,t2 WHERE a=d;
a b c pk d e a b c pk d e
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DECIMAL value: 'd' Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DECIMAL value: 'f' Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DECIMAL value: 'f' Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DECIMAL value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DECIMAL value: 'k' Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DECIMAL value: 'm' Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DECIMAL value: 'm' Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DECIMAL value: 'm' Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DECIMAL value: 'o' Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DECIMAL value: 'q' Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DECIMAL value: 'r' Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DECIMAL value: 'u' Warning 1292 Truncated incorrect DOUBLE value: 'u'
Warning 1292 Truncated incorrect DECIMAL value: 'w' Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DECIMAL value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DECIMAL value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DECIMAL value: 'y' Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
ALTER TABLE t1 MODIFY a DOUBLE; ALTER TABLE t1 MODIFY a DOUBLE;
SELECT * FROM t1,t2 WHERE a=d; SELECT * FROM t1,t2 WHERE a=d;
a b c pk d e a b c pk d e
@ -84,6 +131,53 @@ Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x' Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'y' Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
Warning 1292 Truncated incorrect DOUBLE value: 'w'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'y'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'k'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'm'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
Warning 1292 Truncated incorrect DOUBLE value: 'q'
Warning 1292 Truncated incorrect DOUBLE value: 'r'
Warning 1292 Truncated incorrect DOUBLE value: 'u'
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# End of 10.2 tests # End of 10.2 tests

View File

@ -767,6 +767,86 @@ u xxb
drop table t1; drop table t1;
# End of MariaDB 10.4 tests # End of MariaDB 10.4 tests
# #
# MDEV-35955 Wrong result for UPDATE ... ORDER BY LIMIT which uses tmp.table
#
create table t1 (id int primary key, v int);
create table t2 (id int primary key, v int);
insert into t1 (id, v) values (2,3),(1,4);
insert into t2 (id, v) values (5,5),(6,6);
select t1.*, t2.* from t1, t2 order by t1.id, t2.id limit 2;
id v id v
1 4 5 5
1 4 6 6
UPDATE t1, t2 SET t1.v=-1, t2.v=-1 ORDER BY t1.id, t2.id LIMIT 2;
select * from t1;
id v
2 3
1 -1
select * from t2;
id v
5 -1
6 -1
drop table t1, t2;
create table t1 (id int primary key, v text) engine=myisam;
create table t2 (id int primary key, v text) engine=myisam;
insert into t1 (id, v) values (1,'b'),(2,'fo'),(3,'bar'),(4,'barr'),(5,'bazzz');
insert into t2 (id, v) values (6,'quxqux'),(7,'foofoof'),(8,'barbarba'),(9,'quxquxqux'),(10,'bazbazbazb');
select t1.*, t2.* from t1, t2 order by t1.id, t2.id limit 2;
id v id v
1 b 6 quxqux
1 b 7 foofoof
update t1, t2 set t1.v='DELETED', t2.v='DELETED' order by t1.id, t2.id limit 2;
select * from t1;
id v
1 DELETED
2 fo
3 bar
4 barr
5 bazzz
select * from t2;
id v
6 DELETED
7 DELETED
8 barbarba
9 quxquxqux
10 bazbazbazb
drop table t1, t2;
create table t1 (id int primary key, v int);
create table t2 (id int primary key, v int);
create table t3 (id int primary key, v int);
insert into t1 (id, v) values (1, 1000), (2, 2000), (3, 3000), (4, 4000), (5, 5000);
insert into t2 (id, v) values (10, 100), (20, 200), (30, 300), (40, 400), (50, 500);
insert into t3 (id, v) values (11, 111), (22, 222), (33, 333), (44, 444), (55, 555);
select t1.*, t2.*, t3.* from t1, t2, t3 order by t1.id, t2.id, t3.id limit 3;
id v id v id v
1 1000 10 100 11 111
1 1000 10 100 22 222
1 1000 10 100 33 333
UPDATE t1, t2, t3 SET t1.v=-1, t2.v=-2, t3.v=-3 ORDER BY t1.id, t2.id, t3.id LIMIT 3;
select * from t1;
id v
1 -1
2 2000
3 3000
4 4000
5 5000
select * from t2;
id v
10 -2
20 200
30 300
40 400
50 500
select * from t3;
id v
11 -3
22 -3
33 -3
44 444
55 555
drop table t1, t2, t3;
# End of MariaDB 10.11 tests
#
# MDEV-29189: Second execution of SF using UPDATE?DELETE # MDEV-29189: Second execution of SF using UPDATE?DELETE
# after reported error by the first execution # after reported error by the first execution
# #
@ -803,7 +883,7 @@ c
DROP FUNCTION f1; DROP FUNCTION f1;
DROP FUNCTION f2; DROP FUNCTION f2;
DROP TABLE t1; DROP TABLE t1;
# End of MariaDB 10.10 tests # End of MariaDB 11.1 tests
# #
# MDEV-25008: Delete query gets stuck on mariadb, same query works # MDEV-25008: Delete query gets stuck on mariadb, same query works
# on MySQL 8.0.21 # on MySQL 8.0.21
@ -916,4 +996,4 @@ id v
44 444 44 444
55 555 55 555
drop table t1, t2, t3; drop table t1, t2, t3;
# End of MariaDB 10.11 tests # End of MariaDB 11.8 tests

View File

@ -710,6 +710,46 @@ drop table t1;
--echo # End of MariaDB 10.4 tests --echo # End of MariaDB 10.4 tests
--echo #
--echo # MDEV-35955 Wrong result for UPDATE ... ORDER BY LIMIT which uses tmp.table
--echo #
create table t1 (id int primary key, v int);
create table t2 (id int primary key, v int);
insert into t1 (id, v) values (2,3),(1,4);
insert into t2 (id, v) values (5,5),(6,6);
select t1.*, t2.* from t1, t2 order by t1.id, t2.id limit 2;
UPDATE t1, t2 SET t1.v=-1, t2.v=-1 ORDER BY t1.id, t2.id LIMIT 2;
select * from t1;
select * from t2;
drop table t1, t2;
create table t1 (id int primary key, v text) engine=myisam;
create table t2 (id int primary key, v text) engine=myisam;
insert into t1 (id, v) values (1,'b'),(2,'fo'),(3,'bar'),(4,'barr'),(5,'bazzz');
insert into t2 (id, v) values (6,'quxqux'),(7,'foofoof'),(8,'barbarba'),(9,'quxquxqux'),(10,'bazbazbazb');
select t1.*, t2.* from t1, t2 order by t1.id, t2.id limit 2;
update t1, t2 set t1.v='DELETED', t2.v='DELETED' order by t1.id, t2.id limit 2;
select * from t1;
select * from t2;
drop table t1, t2;
create table t1 (id int primary key, v int);
create table t2 (id int primary key, v int);
create table t3 (id int primary key, v int);
insert into t1 (id, v) values (1, 1000), (2, 2000), (3, 3000), (4, 4000), (5, 5000);
insert into t2 (id, v) values (10, 100), (20, 200), (30, 300), (40, 400), (50, 500);
insert into t3 (id, v) values (11, 111), (22, 222), (33, 333), (44, 444), (55, 555);
select t1.*, t2.*, t3.* from t1, t2, t3 order by t1.id, t2.id, t3.id limit 3;
UPDATE t1, t2, t3 SET t1.v=-1, t2.v=-2, t3.v=-3 ORDER BY t1.id, t2.id, t3.id LIMIT 3;
select * from t1;
select * from t2;
select * from t3;
drop table t1, t2, t3;
--echo # End of MariaDB 10.11 tests
--echo # --echo #
--echo # MDEV-29189: Second execution of SF using UPDATE?DELETE --echo # MDEV-29189: Second execution of SF using UPDATE?DELETE
--echo # after reported error by the first execution --echo # after reported error by the first execution
@ -748,7 +788,7 @@ DROP FUNCTION f2;
DROP TABLE t1; DROP TABLE t1;
--enable_ps2_protocol --enable_ps2_protocol
--echo # End of MariaDB 10.10 tests --echo # End of MariaDB 11.1 tests
--echo # --echo #
--echo # MDEV-25008: Delete query gets stuck on mariadb, same query works --echo # MDEV-25008: Delete query gets stuck on mariadb, same query works
@ -824,4 +864,4 @@ select * from t3;
drop table t1, t2, t3; drop table t1, t2, t3;
--echo # End of MariaDB 10.11 tests --echo # End of MariaDB 11.8 tests

View File

@ -270,6 +270,9 @@ our $opt_force= 0;
our $opt_skip_not_found= 0; our $opt_skip_not_found= 0;
our $opt_mem= $ENV{'MTR_MEM'}; our $opt_mem= $ENV{'MTR_MEM'};
our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'}; our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
our $opt_catalogs= 0;
our $opt_catalog_name="";
our $catalog_name="def";
our $opt_gcov; our $opt_gcov;
our $opt_gprof; our $opt_gprof;
@ -3956,6 +3959,23 @@ sub run_testcase ($$) {
} }
} }
# Set up things for catalogs
# The values of MARIADB_TOPDIR and MARIAD_DATADIR should
# be taken from the values used by the default (first)
# connection that is used by mariadb-test.
my ($mysqld, @servers);
@servers= all_servers();
$mysqld= $servers[0];
$ENV{'MARIADB_TOPDIR'}= $mysqld->value('datadir');
if (!$opt_catalogs)
{
$ENV{'MARIADB_DATADIR'}= $mysqld->value('datadir');
}
else
{
$ENV{'MARIADB_DATADIR'}= $mysqld->value('datadir') . "/" . $catalog_name;
}
# Write start of testcase to log # Write start of testcase to log
mark_log($path_current_testlog, $tinfo); mark_log($path_current_testlog, $tinfo);
@ -4469,14 +4489,12 @@ sub extract_warning_lines ($$) {
( (
@global_suppressions, @global_suppressions,
qr/error .*connecting to master/, qr/error .*connecting to master/,
qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/,
qr/InnoDB: Error: table `test`.`t[12]` .*does not exist in the InnoDB internal/,
qr/InnoDB: Warning: a long semaphore wait:/,
qr/InnoDB: Dumping buffer pool.*/, qr/InnoDB: Dumping buffer pool.*/,
qr/InnoDB: Buffer pool.*/, qr/InnoDB: Buffer pool.*/,
qr/InnoDB: Could not free any blocks in the buffer pool!/, qr/InnoDB: Could not free any blocks in the buffer pool!/,
qr/InnoDB: Warning: Writer thread is waiting this semaphore:/,
qr/InnoDB: innodb_open_files .* should not be greater than/, qr/InnoDB: innodb_open_files .* should not be greater than/,
qr/InnoDB: Trying to delete tablespace.*but there are.*pending/,
qr/InnoDB: Tablespace 1[0-9]* was not found at .*, and innodb_force_recovery was set/,
qr/Slave: Unknown table 't1' .* 1051/, qr/Slave: Unknown table 't1' .* 1051/,
qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/, qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/,
qr/slave SQL thread aborted/, qr/slave SQL thread aborted/,

View File

@ -1 +1,2 @@
--innodb-max-dirty-pages-pct=0 --innodb-max-dirty-pages-pct=0
--skip-ssl

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_log_bin.inc --source include/have_log_bin.inc
--source include/default_charset.inc
--source include/test_db_charset_latin1.inc
if (!$BIG_TEST) if (!$BIG_TEST)
{ {
@ -9,6 +11,7 @@ if (!$BIG_TEST)
# Starting with 11.7, this will hit the 900-second timeout on WITH_MSAN=ON CMAKE_BUILD_TYPE=Debug # Starting with 11.7, this will hit the 900-second timeout on WITH_MSAN=ON CMAKE_BUILD_TYPE=Debug
--source include/not_msan.inc --source include/not_msan.inc
# #
# Testing of atomic create table with crashes in a lot of different places # Testing of atomic create table with crashes in a lot of different places
# #
@ -207,3 +210,4 @@ while ($e < $engine_count)
} }
drop database test2; drop database test2;
--enable_query_log --enable_query_log
--source include/test_db_charset_restore.inc

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,15 @@
***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts ***
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection server_2; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET sql_log_bin=0; CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1; connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
connection server_1; connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,;

View File

@ -1020,3 +1020,77 @@ ERROR 42000: This version of MariaDB doesn't yet support 'OUT/INOUT cursor param
# #
# End of 10.8 tests # End of 10.8 tests
# #
# Start of 11.4 tests
#
# MDEV-36047 Package body variables are not allowed as FETCH targets
#
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN INT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc INT := 0;
FUNCTION f1 RETURN INT AS
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1
DROP PACKAGE pkg;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc1 INT := 0;
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
vc2 INT := 0;
BEGIN
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN vc1 || ' ' || vc2;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
DROP PACKAGE pkg;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc ROW(p1 INT, p2 INT);
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN vc.p1 || ' ' || vc.p2;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
DROP PACKAGE pkg;
# End of 11.4 tests

View File

@ -243,3 +243,107 @@ Pos Instruction
7 jump 11 7 jump 11
DROP PACKAGE pkg1; DROP PACKAGE pkg1;
DROP TABLE t1; DROP TABLE t1;
# Start of 11.4 tests
#
# MDEV-36047 Package body variables are not allowed as FETCH targets
#
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN INT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc INT := 0;
FUNCTION f1 RETURN INT AS
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 cpush cur@0
1 copen cur@0
2 cfetch cur@0 PACKAGE_BODY.vc@0
3 cclose cur@0
4 freturn int PACKAGE_BODY.vc@0
SHOW PACKAGE BODY CODE pkg;
Pos Instruction
0 set vc@0 0
1 cpush cur@0
2 copen cur@0
3 cfetch cur@0 vc@0
4 cclose cur@0
5 cpop 1
DROP PACKAGE pkg;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc1 INT := 0;
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
vc2 INT := 0;
BEGIN
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN vc1 || ' ' || vc2;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 set vc2@0 0
1 cpush cur@0
2 copen cur@0
3 cfetch cur@0 PACKAGE_BODY.vc1@0 vc2@0
4 cclose cur@0
5 freturn blob concat(concat(PACKAGE_BODY.vc1@0,' '),vc2@0)
DROP PACKAGE pkg;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc ROW(p1 INT, p2 INT);
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN vc.p1 || ' ' || vc.p2;
END;
END;
$$
SELECT pkg.f1() FROM DUAL;
pkg.f1()
1 2
SHOW FUNCTION CODE pkg.f1;
Pos Instruction
0 cpush cur@0
1 copen cur@0
2 cfetch cur@0 PACKAGE_BODY.vc@0
3 cclose cur@0
4 freturn blob concat(concat(PACKAGE_BODY.vc.p1@0[0],' '),PACKAGE_BODY.vc.p2@0[1])
DROP PACKAGE pkg;
# End of 11.4 tests

View File

@ -0,0 +1,26 @@
DELIMITER $$;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN INT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc INT := 0;
FUNCTION f1 RETURN INT AS
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc with a "PACKAGE_BODY" prefix
CLOSE cur;
RETURN vc;
END;
BEGIN
DECLARE
CURSOR cur IS SELECT 1 AS c FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc; -- SHOW CODE should display vc without a prefix
CLOSE cur;
END;
END;
$$
DELIMITER ;$$

View File

@ -0,0 +1,20 @@
# Mixing a package body variable and a local variable in the same FETCH.
DELIMITER $$;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc1 INT := 0;
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
vc2 INT := 0;
BEGIN
OPEN cur;
FETCH cur INTO vc1, vc2;
CLOSE cur;
RETURN vc1 || ' ' || vc2;
END;
END;
$$
DELIMITER ;$$

View File

@ -0,0 +1,19 @@
# Fetching into a PACKAGE BODY variable of the ROW type
DELIMITER $$;
CREATE PACKAGE pkg AS
FUNCTION f1 RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg AS
vc ROW(p1 INT, p2 INT);
FUNCTION f1 RETURN TEXT AS
CURSOR cur IS SELECT 1 AS c1, 2 AS c2 FROM DUAL;
BEGIN
OPEN cur;
FETCH cur INTO vc;
CLOSE cur;
RETURN vc.p1 || ' ' || vc.p2;
END;
END;
$$
DELIMITER ;$$

View File

@ -1042,3 +1042,24 @@ DELIMITER ;$$
--echo # --echo #
--echo # End of 10.8 tests --echo # End of 10.8 tests
--echo # --echo #
--echo # Start of 11.4 tests
--echo #
--echo # MDEV-36047 Package body variables are not allowed as FETCH targets
--echo #
--source sp-cursor-pkg-01.inc
SELECT pkg.f1() FROM DUAL;
DROP PACKAGE pkg;
--source sp-cursor-pkg-02.inc
SELECT pkg.f1() FROM DUAL;
DROP PACKAGE pkg;
--source sp-cursor-pkg-03.inc
SELECT pkg.f1() FROM DUAL;
DROP PACKAGE pkg;
--echo # End of 11.4 tests

View File

@ -180,3 +180,28 @@ SHOW PROCEDURE CODE pkg1.p1;
SHOW PACKAGE BODY CODE pkg1; SHOW PACKAGE BODY CODE pkg1;
DROP PACKAGE pkg1; DROP PACKAGE pkg1;
DROP TABLE t1; DROP TABLE t1;
--echo # Start of 11.4 tests
--echo #
--echo # MDEV-36047 Package body variables are not allowed as FETCH targets
--echo #
--source sp-cursor-pkg-01.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
SHOW PACKAGE BODY CODE pkg;
DROP PACKAGE pkg;
--source sp-cursor-pkg-02.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
DROP PACKAGE pkg;
--source sp-cursor-pkg-03.inc
SELECT pkg.f1() FROM DUAL;
SHOW FUNCTION CODE pkg.f1;
DROP PACKAGE pkg;
--echo # End of 11.4 tests

View File

@ -79,7 +79,7 @@ CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default '' `name` varchar(32) NOT NULL default ''
) )
ENGINE="FEDERATED" DEFAULT CHARSET=latin1 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; CONNECTION='mariadb://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
INSERT INTO federated.t1 (id, `group`) VALUES (3, 42); INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);

View File

@ -92,7 +92,7 @@ eval CREATE TABLE federated.t1 (
`name` varchar(32) NOT NULL default '' `name` varchar(32) NOT NULL default ''
) )
ENGINE="FEDERATED" DEFAULT CHARSET=latin1 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; CONNECTION='mariadb://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');

View File

@ -497,12 +497,12 @@ CREATE TABLE federated.t3 (a INT);
INSERT INTO federated.t3 VALUES (1),(2),(3); INSERT INTO federated.t3 VALUES (1),(2),(3);
CREATE TABLE federated.t4 (a INT); CREATE TABLE federated.t4 (a INT);
connection master; connection master;
CREATE SERVER fedlink FOREIGN DATA WRAPPER mysql CREATE SERVER fedlink FOREIGN DATA WRAPPER mariadb
OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated', OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated',
PORT SLAVE_PORT); PORT SLAVE_PORT);
CREATE TABLE federated.t3 (a INT) CREATE TABLE federated.t3 (a INT)
ENGINE=FEDERATED ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3' CONNECTION='mariadb://root@127.0.0.1:$SLAVE_MYPORT/federated/t3'
PARTITION BY list (a) PARTITION BY list (a)
(PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3', (PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3',
PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4'); PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4');

View File

@ -310,13 +310,13 @@ CREATE TABLE federated.t4 (a INT);
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE SERVER fedlink FOREIGN DATA WRAPPER mysql eval CREATE SERVER fedlink FOREIGN DATA WRAPPER mariadb
OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated', OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated',
PORT $SLAVE_MYPORT); PORT $SLAVE_MYPORT);
CREATE TABLE federated.t3 (a INT) CREATE TABLE federated.t3 (a INT)
ENGINE=FEDERATED ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3' CONNECTION='mariadb://root@127.0.0.1:$SLAVE_MYPORT/federated/t3'
PARTITION BY list (a) PARTITION BY list (a)
(PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3', (PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3',
PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4'); PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4');

View File

@ -0,0 +1,35 @@
# include/wait_condition_with_debug_and_kill.inc
#
# SUMMARY
#
# Waits until the passed statement returns true, or the operation
# times out. If the operation times out, the additional error
# statement will be executed and server is killed.
#
# USAGE
#
# let $wait_condition=
# SELECT c = 3 FROM t;
# let $wait_condition_on_error_output= select count(*) from t;
# [let $explicit_default_wait_timeout= N] # to override the default reset
# --source include/wait_condition_with_debug_and_kill.inc
#
# OR
#
# let $wait_timeout= 60; # Override default 30 seconds with 60.
# let $wait_condition=
# SELECT c = 3 FROM t;
# let $wait_condition_on_error_output= select count(*) from t;
# --source include/wait_condition_with_debug_and_kill.inc
# --echo Executed the test condition $wait_condition_reps times
#
#
# EXAMPLE
# events_bugs.test, events_time_zone.test
#
--source include/wait_condition_with_debug.inc
if (!$success)
{
--source include/kill_galera.inc
}

View File

@ -0,0 +1,31 @@
connection node_2;
connection node_1;
connection node_1;
INSTALL PLUGIN IF NOT EXISTS connect SONAME 'ha_connect';
CREATE TABLE t1 (f INT) ENGINE=CONNECT;
Warnings:
Warning 1105 No table_type. Will be set to DOS
Warning 1105 No file name. Table will use t1.dos
CREATE TABLE t2 (f INT) ENGINE=ROCKSDB;
CREATE TABLE t3 (f INT) ENGINE=SEQUENCE;
ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
show warnings;
Level Code Message
Error 1235 This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
Note 1235 ENGINE=SEQUENCE not supported by Galera
connection node_2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f` int(11) DEFAULT NULL
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table t3;
ERROR 42S02: Table 'test.t3' doesn't exist
connection node_1;
DROP TABLE t1, t2;
UNINSTALL PLUGIN IF EXISTS connect;

View File

@ -0,0 +1,16 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0;
SET SESSION wsrep_sync_wait=DEFAULT;
DELETE FROM mysql.wsrep_streaming_log;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE
Primary
SET SESSION wsrep_sync_wait=DEFAULT;
CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\.");

View File

@ -7,6 +7,7 @@ LOCK TABLE t1 WRITE;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
connection node_2; connection node_2;
SET SESSION wsrep_sync_wait = 0;
UNLOCK TABLES; UNLOCK TABLES;
COMMIT; COMMIT;
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;

View File

@ -40,18 +40,19 @@ drop table t1;
disconnect node_2a; disconnect node_2a;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a; connection node_2a;
CREATE TABLE t1 (i int primary key); CREATE TABLE t1 (i int primary key) engine=innodb;
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue"; SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connection node_2; connection node_2;
SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached"; SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
SET DEBUG_SYNC = "now SIGNAL bwoc_continue"; SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
SET DEBUG_SYNC='RESET';
connection node_2a; connection node_2a;
connection node_2; connection node_2;
SET DEBUG_SYNC='RESET';
select * from t1; select * from t1;
i i
1 1
disconnect node_2a; disconnect node_2a;
disconnect node_2b;
connection node_1; connection node_1;
drop table t1; drop table t1;

View File

@ -0,0 +1,176 @@
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*");
# wsrep-mode= DEFAULT
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
@@wsrep_mode
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1,1),(2,2);
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v3 = 3;
UPDATE t2 SET v3 = 3;
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
DROP INDEX xx2 ON t2;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2_v2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v3 = t1_v2.v3+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2_v2 FOR EACH ROW
UPDATE t2_v2 SET t2_v2.v3 = t2_v2.v3+1;
connection node_2;
SHOW CREATE TABLE t1_v2;
Table Create Table
t1_v2 CREATE TABLE `t1_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
`v3` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE TABLE t2_v2;
Table Create Table
t2_v2 CREATE TABLE `t2_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
`v3` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE VIEW x1;
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` latin1 latin1_swedish_ci
SHOW CREATE VIEW x2;
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` latin1 latin1_swedish_ci
SELECT * FROM t1_v2;
v1 v2 v3
SELECT * FROM t2_v2;
v1 v2 v3
connection node_1;
DROP VIEW x1;
DROP VIEW x2;
DROP TRIGGER increment_before_t1;
DROP TRIGGER increment_before_t2;
DROP TABLE t1_v2;
DROP TABLE t2_v2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
# wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
@@wsrep_mode
STRICT_REPLICATION
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t3 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ERROR HY000: Galera replication not supported
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
ERROR HY000: Galera replication not supported
INSERT INTO t1 VALUES (1,1),(2,2);
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t1' is not supported in Galera
INSERT INTO t2 VALUES (1),(2);
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t2' is not supported in Galera
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ERROR HY000: Galera replication not supported
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
ERROR HY000: Galera replication not supported
UPDATE t1 SET v2 = v2 + 3;
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t1' is not supported in Galera
UPDATE t2 SET v1 = v1 + 3;
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table 'test'.'t2' is not supported in Galera
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
ERROR HY000: Galera replication not supported
DROP INDEX xx1 ON t1;
DROP INDEX xx2 on t2;
ERROR HY000: Galera replication not supported
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
ERROR HY000: Galera replication not supported
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
RENAME TABLE t2_v2 TO t2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2;
ERROR HY000: Galera replication not supported
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v2 = t1_v2.v2+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2 FOR EACH ROW
UPDATE t2 SET t2.v1 = t2.v1+1;
ERROR HY000: Galera replication not supported
connection node_2;
SHOW CREATE TABLE t1_v2;
Table Create Table
t1_v2 CREATE TABLE `t1_v2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`v1` int(11) NOT NULL,
`v2` int(11) DEFAULT NULL,
PRIMARY KEY (`v1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`v1`)
PARTITIONS 2
SHOW CREATE VIEW x1;
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` latin1 latin1_swedish_ci
SELECT * FROM t1_v2;
v1 v2
SELECT * FROM t2;
v1 v2
connection node_1;
DROP VIEW x1;
DROP TRIGGER increment_before_t1;
DROP TABLE t1_v2;
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
# wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
@@wsrep_mode
STRICT_REPLICATION
ALTER TABLE t2 ENGINE=InnoDB;
DROP TABLE t2;
SET GLOBAL wsrep_mode = DEFAULT;

View File

@ -0,0 +1,30 @@
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_1;
connection node_2;
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_2;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: write_handler\\(\\)");
connection node_2;
call mtr.add_suppression("WSREP: write_handler\\(\\)");

View File

@ -0,0 +1,84 @@
connection node_2;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
f0
NULL
connection node_2;
SELECT * FROM t;
f0
NULL
DROP TABLE t;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
ERROR HY000: wsrep_forced_binlog_format=[MIXED|STATEMENT] can't be set if wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA]
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW]
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;

View File

@ -31,3 +31,6 @@ test.t1 repair status OK
test.t2 repair status OK test.t2 repair status OK
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
connection node_1;
disconnect node_2a;
disconnect node_2b;

View File

@ -32,6 +32,8 @@ SHOW WARNINGS;
Level Code Message Level Code Message
Error 4165 Galera replication not supported Error 4165 Galera replication not supported
Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported. Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported.
Error 4165 Galera replication not supported
Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported.
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (

View File

@ -0,0 +1 @@
--plugin-load=$HA_ROCKSDB_SO

View File

@ -0,0 +1,22 @@
--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/have_rocksdb.inc
--connection node_1
INSTALL PLUGIN IF NOT EXISTS connect SONAME 'ha_connect';
CREATE TABLE t1 (f INT) ENGINE=CONNECT;
CREATE TABLE t2 (f INT) ENGINE=ROCKSDB;
--error ER_NOT_SUPPORTED_YET
CREATE TABLE t3 (f INT) ENGINE=SEQUENCE;
show warnings;
--connection node_2
show create table t1;
show create table t2;
--error ER_NO_SUCH_TABLE
show create table t3;
--connection node_1
DROP TABLE t1, t2;
UNINSTALL PLUGIN IF EXISTS connect;

View File

@ -0,0 +1,41 @@
#
# MDEV-35946: Assertion `thd->is_error()' failed in Sql_cmd_dml::prepare
#
--source include/have_innodb.inc
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
#
# Disconnect from the cluster
#
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SET SESSION wsrep_sync_wait=DEFAULT;
#
# If bug is present, assertion will fire
# during the execution of the following DELETE
#
--error ER_LOCK_WAIT_TIMEOUT
DELETE FROM mysql.wsrep_streaming_log;
#
# Reconnect to the cluster
#
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SET SESSION wsrep_sync_wait=DEFAULT;
--source include/auto_increment_offset_restore.inc
CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\.");

View File

@ -16,13 +16,16 @@ LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' SET SESSION wsrep_sync_wait = 0;
--source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%');
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug.inc
UNLOCK TABLES; UNLOCK TABLES;
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%');
--source include/wait_condition.inc --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug.inc
COMMIT; COMMIT;
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;

View File

@ -110,7 +110,7 @@ drop table t1;
--connection node_2a --connection node_2a
--let $connection_id = `SELECT CONNECTION_ID()` --let $connection_id = `SELECT CONNECTION_ID()`
CREATE TABLE t1 (i int primary key); CREATE TABLE t1 (i int primary key) engine=innodb;
# Set up sync point # Set up sync point
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue"; SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
@ -129,17 +129,17 @@ SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
--enable_query_log --enable_query_log
SET DEBUG_SYNC = "now SIGNAL bwoc_continue"; SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
SET DEBUG_SYNC='RESET';
--connection node_2a --connection node_2a
--error 0,1213,2013,2026 --error 0,1213,2013,2026
--reap --reap
--connection node_2 --connection node_2
SET DEBUG_SYNC='RESET';
# victim was able to complete the INSERT # victim was able to complete the INSERT
select * from t1; select * from t1;
--disconnect node_2a --disconnect node_2a
--disconnect node_2b
--connection node_1 --connection node_1
drop table t1; drop table t1;

View File

@ -0,0 +1,133 @@
--source include/galera_cluster.inc
--source include/have_partition.inc
--source include/have_innodb.inc
--source include/have_aria.inc
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*");
--echo # wsrep-mode= DEFAULT
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1,1),(2,2);
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v3 = 3;
UPDATE t2 SET v3 = 3;
CREATE INDEX xx1 ON t1(v2);
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
DROP INDEX xx2 ON t2;
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
CREATE VIEW x2 AS SELECT * FROM t2_v2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v3 = t1_v2.v3+1;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2_v2 FOR EACH ROW
UPDATE t2_v2 SET t2_v2.v3 = t2_v2.v3+1;
--connection node_2
SHOW CREATE TABLE t1_v2;
SHOW CREATE TABLE t2_v2;
SHOW CREATE VIEW x1;
SHOW CREATE VIEW x2;
SELECT * FROM t1_v2;
SELECT * FROM t2_v2;
--connection node_1
DROP VIEW x1;
DROP VIEW x2;
DROP TRIGGER increment_before_t1;
DROP TRIGGER increment_before_t2;
DROP TABLE t1_v2;
DROP TABLE t2_v2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
--echo # wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
CREATE OR REPLACE TABLE t1 (v1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB
PARTITION BY KEY (v1)
PARTITIONS 2;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE OR REPLACE TABLE t3 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
ALTER TABLE t1 ADD COLUMN v2 int;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t2 ADD COLUMN v2 int;
INSERT INTO t1 VALUES (1,1),(2,2);
INSERT INTO t2 VALUES (1),(2);
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN v3 int, ENGINE=MyISAM;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
ALTER TABLE t2 ADD COLUMN v3 int, ENGINE=Aria;
UPDATE t1 SET v2 = v2 + 3;
UPDATE t2 SET v1 = v1 + 3;
CREATE INDEX xx1 ON t1(v2);
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE INDEX xx2 ON t2(v2);
DROP INDEX xx1 ON t1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
DROP INDEX xx2 on t2;
TRUNCATE TABLE t1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
TRUNCATE TABLE t2;
# At the moment can't restrict rename
RENAME TABLE t1 TO t1_v2;
RENAME TABLE t2 TO t2_v2;
RENAME TABLE t2_v2 TO t2;
CREATE VIEW x1 AS SELECT * FROM t1_v2;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE VIEW x2 AS SELECT * FROM t2;
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
AFTER INSERT ON t1_v2 FOR EACH ROW
UPDATE t1_v2 SET t1_v2.v2 = t1_v2.v2+1;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t2
AFTER INSERT ON t2 FOR EACH ROW
UPDATE t2 SET t2.v1 = t2.v1+1;
--connection node_2
SHOW CREATE TABLE t1_v2;
SHOW CREATE TABLE t2;
SHOW CREATE VIEW x1;
SELECT * FROM t1_v2;
SELECT * FROM t2;
--connection node_1
DROP VIEW x1;
DROP TRIGGER increment_before_t1;
DROP TABLE t1_v2;
# We allow dropping table
DROP TABLE t2;
SET GLOBAL wsrep_mode = "";
CREATE OR REPLACE TABLE t2 (v1 INT NOT NULL PRIMARY KEY) ENGINE=MyISAM
PARTITION BY KEY (v1)
PARTITIONS 2;
--echo # wsrep-mode= STRICT_REPLICATION
SET GLOBAL wsrep_mode = "STRICT_REPLICATION";
SELECT @@wsrep_mode;
ALTER TABLE t2 ENGINE=InnoDB;
DROP TABLE t2;
SET GLOBAL wsrep_mode = DEFAULT;

View File

@ -0,0 +1,11 @@
!include ../galera_2nodes.cnf
[mysqld]
loose-galera-ssl-cipher=1
wsrep-debug=1
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES'

View File

@ -0,0 +1,82 @@
#
# Test upgrading the SSL chipher
#
--source include/galera_cluster.inc
--source include/have_ssl_communication.inc
--source include/have_openssl.inc
--source include/force_restart.inc
#
# Lowest supported Galera library version
#
--let $galera_version=26.4.21
source ../wsrep/include/check_galera_version.inc;
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
# Setup galera ports
--connection node_1
--source suite/galera/include/galera_base_port.inc
--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
--connection node_2
--source suite/galera/include/galera_base_port.inc
--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
# 2. Restart node #1 with a socket.ssl_cipher
--connection node_1
--source include/shutdown_mysqld.inc
--let $restart_noprint = 1
--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem;socket.ssl_cipher=AES256-SHA
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
# 3. Restart node #2 with the new socket.ssl_ca , socket.ssl_cert, socket.ssl_key and socket.ssl_cipher
--connection node_2
--source include/shutdown_mysqld.inc
--let $start_mysqld_params = --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-key.pem;socket.ssl_cipher=AES256-SHA
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
# 4. Restart node #1 with the new socket.ssl_ca , socket.ssl_cert, socket.ssl_key and socket.ssl_cipher
--connection node_1
--source include/shutdown_mysqld.inc
--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-upgrade-server-key.pem;socket.ssl_cipher=AES256-SHA
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
# 5. Make sure node_2 is ready as well
--connection node_2
--source include/galera_wait_ready.inc
# Upgrade complete. Both nodes now use the new key and certificate
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
--connection node_1
call mtr.add_suppression("WSREP: write_handler\\(\\)");
--connection node_2
call mtr.add_suppression("WSREP: write_handler\\(\\)");

View File

@ -3,7 +3,6 @@
# #
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);

View File

@ -0,0 +1,81 @@
--source include/galera_cluster.inc
--source include/have_aria.inc
#
# MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam
#
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=MyISAM;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=ROW;
CREATE TABLE t (f0 CHAR(0)) ENGINE=Aria;
INSERT INTO t VALUES();
SELECT * FROM t;
--connection node_2
SELECT * FROM t;
DROP TABLE t;
--connection node_1
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode=REPLICATE_ARIA;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode = REPLICATE_ARIA;
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;
SET GLOBAL wsrep_forced_binlog_format=MIXED;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
SET GLOBAL wsrep_forced_binlog_format=DEFAULT;
SET GLOBAL wsrep_mode=DEFAULT;

View File

@ -1,9 +1,4 @@
!include ../galera_2nodes.cnf !include ../galera_2nodes.cnf
[mysqld.1] [mysqld]
log-bin log-bin
wsrep-debug=1
[mysqld.1]
log-bin
wsrep-debug=1

View File

@ -1,6 +1,5 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/force_restart.inc
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
@ -21,8 +20,9 @@ LOCK TABLE t2 WRITE;
--connection node_2 --connection node_2
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock' --let $wait_condition = SELECT COUNT(*) BETWEEN 1 AND 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%';
--source include/wait_condition.inc --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc
--connection node_1 --connection node_1
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
@ -38,3 +38,8 @@ UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
--connection node_1
--disconnect node_2a
--disconnect node_2b

View File

@ -38,6 +38,10 @@ idxa n_diff_pfx01 a
idxa n_diff_pfx02 a,DB_ROW_ID idxa n_diff_pfx02 a,DB_ROW_ID
idxa n_leaf_pages Number of leaf pages in the index idxa n_leaf_pages Number of leaf pages in the index
idxa size Number of pages in the index idxa size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 c vidxcd n_diff_pfx01 c
vidxcd n_diff_pfx02 c,d vidxcd n_diff_pfx02 c,d
vidxcd n_diff_pfx03 c,d,DB_ROW_ID vidxcd n_diff_pfx03 c,d,DB_ROW_ID
@ -54,6 +58,14 @@ index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE; ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
select count(*) from t; select count(*) from t;
count(*) count(*)
@ -65,6 +77,18 @@ index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE; ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
select count(*) from t; select count(*) from t;
count(*) count(*)
@ -76,6 +100,22 @@ index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
vidxf n_diff_pfx01 f
vidxf n_diff_pfx02 f,DB_ROW_ID
vidxf n_leaf_pages Number of leaf pages in the index
vidxf size Number of pages in the index
ALTER TABLE t DROP INDEX vidxcd; ALTER TABLE t DROP INDEX vidxcd;
SELECT index_name, stat_name, stat_description SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats FROM mysql.innodb_index_stats
@ -84,4 +124,16 @@ index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
vidxf n_diff_pfx01 f
vidxf n_diff_pfx02 f,DB_ROW_ID
vidxf n_leaf_pages Number of leaf pages in the index
vidxf size Number of pages in the index
DROP TABLE t; DROP TABLE t;

View File

@ -1,4 +1,6 @@
@@ -13,212 +13,212 @@ --- autoinc_persist.result
+++ autoinc_persist.result,desc
@@ -13,224 +13,224 @@
# #
# Pre-create several tables # Pre-create several tables
SET SQL_MODE='STRICT_ALL_TABLES'; SET SQL_MODE='STRICT_ALL_TABLES';
@ -296,8 +298,7 @@
+2 +2
+1 +1
+CREATE TABLE t11(a FLOAT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; +CREATE TABLE t11(a FLOAT AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB;
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t11; SELECT * FROM t11;
a a
--10 --10
@ -310,7 +311,7 @@
-20 -20
-30 -30
31 31
-CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; -CREATE TABLE t11u(a FLOAT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
+30 +30
+20 +20
+5 +5
@ -320,9 +321,30 @@
+1 +1
+-1 +-1
+-10 +-10
+CREATE TABLE t11u(a FLOAT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB;
INSERT INTO t11u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
ERROR 22003: Out of range value for column 'a' at row 5
INSERT INTO t11u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
SELECT * FROM t11u;
a
-11
-12
-13
-14
-15
-20
-30
31
-CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB;
+30
+20
+15
+14
+13
+12
+11
+CREATE TABLE t12(a DOUBLE AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB; +CREATE TABLE t12(a DOUBLE AUTO_INCREMENT, PRIMARY KEY(a DESC)) ENGINE = InnoDB;
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t12; SELECT * FROM t12;
a a
--10 --10
@ -344,10 +366,10 @@
+1 +1
+-1 +-1
+-10 +-10
# Scenario 1: Normal restart, to test if the counters are persisted CREATE TABLE t12u(a DOUBLE UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
# Scenario 2: Delete some values, to test the counters should not be the INSERT INTO t12u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
# one which is the largest in current table ERROR 22003: Out of range value for column 'a' at row 5
@@ -242,14 +242,14 @@ @@ -268,14 +268,14 @@
SELECT MAX(a) AS `Expect 100000000000` FROM t9; SELECT MAX(a) AS `Expect 100000000000` FROM t9;
Expect 100000000000 Expect 100000000000
100000000000 100000000000
@ -364,7 +386,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=1234 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t13 VALUES(0); INSERT INTO t13 VALUES(0);
SELECT a AS `Expect 1234` FROM t13; SELECT a AS `Expect 1234` FROM t13;
@@ -464,28 +464,28 @@ @@ -490,28 +490,28 @@
INSERT INTO t1 VALUES(0), (0); INSERT INTO t1 VALUES(0), (0);
SELECT * FROM t1; SELECT * FROM t1;
a a
@ -398,7 +420,7 @@
# Ensure that all changes before the server is killed are persisted. # Ensure that all changes before the server is killed are persisted.
set global innodb_flush_log_at_trx_commit=1; set global innodb_flush_log_at_trx_commit=1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
@@ -498,63 +498,63 @@ @@ -524,63 +524,63 @@
INSERT INTO t19 VALUES(0), (0); INSERT INTO t19 VALUES(0), (0);
SELECT * FROM t19; SELECT * FROM t19;
a a
@ -481,7 +503,7 @@
DELETE FROM t3 WHERE a > 300; DELETE FROM t3 WHERE a > 300;
SELECT MAX(a) AS `Expect 200` FROM t3; SELECT MAX(a) AS `Expect 200` FROM t3;
Expect 200 Expect 200
@@ -566,7 +566,7 @@ @@ -592,7 +592,7 @@
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -490,7 +512,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t3 VALUES(0); INSERT INTO t3 VALUES(0);
SELECT MAX(a) AS `Expect 201` FROM t3; SELECT MAX(a) AS `Expect 201` FROM t3;
@@ -579,7 +579,7 @@ @@ -605,7 +605,7 @@
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -499,7 +521,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t3 VALUES(0); INSERT INTO t3 VALUES(0);
SELECT MAX(a) AS `Expect 500` FROM t3; SELECT MAX(a) AS `Expect 500` FROM t3;
@@ -591,13 +591,13 @@ @@ -617,13 +617,13 @@
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -515,7 +537,7 @@
INSERT INTO t3 VALUES(150), (180); INSERT INTO t3 VALUES(150), (180);
UPDATE t3 SET a = 200 WHERE a = 150; UPDATE t3 SET a = 200 WHERE a = 150;
INSERT INTO t3 VALUES(220); INSERT INTO t3 VALUES(220);
@@ -607,7 +607,7 @@ @@ -633,7 +633,7 @@
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -524,7 +546,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t3 VALUES(0); INSERT INTO t3 VALUES(0);
SELECT MAX(a) AS `Expect 221` FROM t3; SELECT MAX(a) AS `Expect 221` FROM t3;
@@ -619,7 +619,7 @@ @@ -645,7 +645,7 @@
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -533,7 +555,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# MDEV-6076: Test adding an AUTO_INCREMENT COLUMN # MDEV-6076: Test adding an AUTO_INCREMENT COLUMN
CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB;
@@ -669,18 +669,18 @@ @@ -695,18 +695,18 @@
INSERT INTO t_inplace SELECT * FROM t3; INSERT INTO t_inplace SELECT * FROM t3;
SELECT * FROM t_inplace; SELECT * FROM t_inplace;
a a
@ -559,7 +581,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This will keep the autoinc counter # This will keep the autoinc counter
ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE; ALTER TABLE t_inplace AUTO_INCREMENT = 250, ALGORITHM = INPLACE;
@@ -689,7 +689,7 @@ @@ -715,7 +715,7 @@
Table Create Table Table Create Table
t_inplace CREATE TABLE `t_inplace` ( t_inplace CREATE TABLE `t_inplace` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -568,7 +590,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This should keep the autoinc counter as well # This should keep the autoinc counter as well
ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE; ALTER TABLE t_inplace ADD COLUMN b INT, ALGORITHM = INPLACE;
@@ -699,16 +699,16 @@ @@ -725,16 +725,16 @@
t_inplace CREATE TABLE `t_inplace` ( t_inplace CREATE TABLE `t_inplace` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
@ -590,7 +612,7 @@
# This should reset the autoinc counter to the one specified # This should reset the autoinc counter to the one specified
# Since it's smaller than current one but bigger than existing # Since it's smaller than current one but bigger than existing
# biggest counter in the table # biggest counter in the table
@@ -719,7 +719,7 @@ @@ -745,7 +745,7 @@
t_inplace CREATE TABLE `t_inplace` ( t_inplace CREATE TABLE `t_inplace` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
@ -599,7 +621,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This should reset the autoinc counter to the next value of # This should reset the autoinc counter to the next value of
# current max counter in the table, since the specified value # current max counter in the table, since the specified value
@@ -730,7 +730,7 @@ @@ -756,7 +756,7 @@
Table Create Table Table Create Table
t_inplace CREATE TABLE `t_inplace` ( t_inplace CREATE TABLE `t_inplace` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -608,7 +630,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t_inplace VALUES(0), (0); INSERT INTO t_inplace VALUES(0), (0);
SELECT MAX(a) AS `Expect 124` FROM t_inplace; SELECT MAX(a) AS `Expect 124` FROM t_inplace;
@@ -757,18 +757,18 @@ @@ -783,18 +783,18 @@
INSERT INTO t_copy SELECT * FROM t3; INSERT INTO t_copy SELECT * FROM t3;
SELECT * FROM t_copy; SELECT * FROM t_copy;
a a
@ -634,7 +656,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=211 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This will keep the autoinc counter # This will keep the autoinc counter
ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY; ALTER TABLE t_copy AUTO_INCREMENT = 250, ALGORITHM = COPY;
@@ -777,7 +777,7 @@ @@ -803,7 +803,7 @@
Table Create Table Table Create Table
t_copy CREATE TABLE `t_copy` ( t_copy CREATE TABLE `t_copy` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -643,7 +665,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This should keep the autoinc counter as well # This should keep the autoinc counter as well
ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY; ALTER TABLE t_copy ADD COLUMN b INT, ALGORITHM = COPY;
@@ -787,16 +787,16 @@ @@ -813,16 +813,16 @@
t_copy CREATE TABLE `t_copy` ( t_copy CREATE TABLE `t_copy` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
@ -665,7 +687,7 @@
# This should reset the autoinc counter to the one specified # This should reset the autoinc counter to the one specified
# Since it's smaller than current one but bigger than existing # Since it's smaller than current one but bigger than existing
# biggest counter in the table # biggest counter in the table
@@ -807,7 +807,7 @@ @@ -833,7 +833,7 @@
t_copy CREATE TABLE `t_copy` ( t_copy CREATE TABLE `t_copy` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
@ -674,7 +696,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=180 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# This should reset the autoinc counter to the next value of # This should reset the autoinc counter to the next value of
# current max counter in the table, since the specified value # current max counter in the table, since the specified value
@@ -818,7 +818,7 @@ @@ -844,7 +844,7 @@
Table Create Table Table Create Table
t_copy CREATE TABLE `t_copy` ( t_copy CREATE TABLE `t_copy` (
`a` smallint(6) NOT NULL AUTO_INCREMENT, `a` smallint(6) NOT NULL AUTO_INCREMENT,
@ -683,7 +705,7 @@
) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t_copy VALUES(0), (0); INSERT INTO t_copy VALUES(0), (0);
SELECT MAX(a) AS `Expect 124` FROM t_copy; SELECT MAX(a) AS `Expect 124` FROM t_copy;
@@ -842,7 +842,7 @@ @@ -868,7 +868,7 @@
126 126
DROP TABLE t_copy, it_copy; DROP TABLE t_copy, it_copy;
# Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO # Scenario 9: Test the sql_mode = NO_AUTO_VALUE_ON_ZERO
@ -692,7 +714,7 @@
set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; set SQL_MODE = NO_AUTO_VALUE_ON_ZERO;
INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3); INSERT INTO t30 VALUES(NULL, 1), (200, 2), (0, 3);
INSERT INTO t30(b) VALUES(4), (5), (6), (7); INSERT INTO t30(b) VALUES(4), (5), (6), (7);
@@ -869,20 +869,20 @@ @@ -895,20 +895,20 @@
set global innodb_flush_log_at_trx_commit=1; set global innodb_flush_log_at_trx_commit=1;
CREATE TABLE t31 (a INT) ENGINE = InnoDB; CREATE TABLE t31 (a INT) ENGINE = InnoDB;
INSERT INTO t31 VALUES(1), (2); INSERT INTO t31 VALUES(1), (2);
@ -719,7 +741,7 @@
INSERT INTO t32 VALUES(0), (0); INSERT INTO t32 VALUES(0), (0);
# Ensure that all changes before the server is killed are persisted. # Ensure that all changes before the server is killed are persisted.
set global innodb_flush_log_at_trx_commit=1; set global innodb_flush_log_at_trx_commit=1;
@@ -897,7 +897,7 @@ @@ -923,7 +923,7 @@
# increasing the counter # increasing the counter
CREATE TABLE t33 ( CREATE TABLE t33 (
a BIGINT NOT NULL PRIMARY KEY, a BIGINT NOT NULL PRIMARY KEY,
@ -728,7 +750,7 @@
INSERT INTO t33 VALUES(1, NULL); INSERT INTO t33 VALUES(1, NULL);
INSERT INTO t33 VALUES(2, NULL); INSERT INTO t33 VALUES(2, NULL);
INSERT INTO t33 VALUES(2, NULL); INSERT INTO t33 VALUES(2, NULL);
@@ -920,13 +920,13 @@ @@ -946,13 +946,13 @@
INSERT INTO t31(a) VALUES(6), (0); INSERT INTO t31(a) VALUES(6), (0);
SELECT * FROM t31; SELECT * FROM t31;
a b a b
@ -748,7 +770,7 @@
DROP TABLE t31; DROP TABLE t31;
set SQL_MODE = NO_AUTO_VALUE_ON_ZERO; set SQL_MODE = NO_AUTO_VALUE_ON_ZERO;
DELETE FROM t30 WHERE a = 0; DELETE FROM t30 WHERE a = 0;
@@ -965,7 +965,7 @@ @@ -991,7 +991,7 @@
DROP TABLE t33; DROP TABLE t33;
CREATE TABLE t33 ( CREATE TABLE t33 (
a BIGINT NOT NULL PRIMARY KEY, a BIGINT NOT NULL PRIMARY KEY,
@ -757,7 +779,7 @@
ALTER TABLE t33 DISCARD TABLESPACE; ALTER TABLE t33 DISCARD TABLESPACE;
restore: t33 .ibd and .cfg files restore: t33 .ibd and .cfg files
ALTER TABLE t33 IMPORT TABLESPACE; ALTER TABLE t33 IMPORT TABLESPACE;
@@ -975,7 +975,7 @@ @@ -1001,8 +1001,8 @@
4 4
SELECT * FROM t33; SELECT * FROM t33;
a b a b
@ -766,4 +788,5 @@
3 4 3 4
+2 2 +2 2
+10 1 +10 1
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t11u, t12u,
t30, t32, t33;

View File

@ -191,8 +191,7 @@ a
100000000000 100000000000
100000000006 100000000006
CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB; CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB;
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t11; SELECT * FROM t11;
a a
-10 -10
@ -205,9 +204,22 @@ a
20 20
30 30
31 31
CREATE TABLE t11u(a FLOAT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
INSERT INTO t11u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
ERROR 22003: Out of range value for column 'a' at row 5
INSERT INTO t11u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
SELECT * FROM t11u;
a
11
12
13
14
15
20
30
31
CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB; CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB;
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t12; SELECT * FROM t12;
a a
-10 -10
@ -220,6 +232,20 @@ a
20 20
30 30
31 31
CREATE TABLE t12u(a DOUBLE UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
INSERT INTO t12u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
ERROR 22003: Out of range value for column 'a' at row 5
INSERT INTO t12u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
SELECT * FROM t12u;
a
11
12
13
14
15
20
30
31
# Scenario 1: Normal restart, to test if the counters are persisted # Scenario 1: Normal restart, to test if the counters are persisted
# Scenario 2: Delete some values, to test the counters should not be the # Scenario 2: Delete some values, to test the counters should not be the
# one which is the largest in current table # one which is the largest in current table
@ -979,5 +1005,6 @@ a b
10 1 10 1
2 2 2 2
3 4 3 4
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t11u, t12u,
t30, t32, t33;
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci; ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;

View File

@ -11,9 +11,11 @@ insert into t1 values(5, repeat('.',12));
commit work; commit work;
SET GLOBAL innodb_fast_shutdown = 0; SET GLOBAL innodb_fast_shutdown = 0;
# restart # restart
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0,innodb_max_dirty_pages_pct=0;
SET GLOBAL innodb_max_dirty_pages_pct=99;
connect dml,localhost,root,,; connect dml,localhost,root,,;
XA START 'x'; XA START 'x';
insert into t1 values (6, repeat('%', @@innodb_page_size/2)); insert into t1 values(6, repeat('%', @@innodb_page_size/2));
XA END 'x'; XA END 'x';
XA PREPARE 'x'; XA PREPARE 'x';
disconnect dml; disconnect dml;
@ -23,7 +25,6 @@ flush table t1 for export;
# restart # restart
FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=0\]/ in mysqld.1.err FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=0\]/ in mysqld.1.err
# restart # restart
XA ROLLBACK 'x';
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
@ -34,18 +35,13 @@ f1 f2
3 //////////// 3 ////////////
4 ------------ 4 ------------
5 ............ 5 ............
connect dml,localhost,root,,; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0,innodb_max_dirty_pages_pct=0;
XA START 'x'; SET GLOBAL innodb_max_dirty_pages_pct=99;
insert into t1 values (6, repeat('%', @@innodb_page_size/2)); XA ROLLBACK 'x';
XA END 'x'; FLUSH TABLE t1 FOR EXPORT;
XA PREPARE 'x';
disconnect dml;
connection default;
flush table t1 for export;
# Kill the server # Kill the server
# restart # restart
FOUND 4 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=[03]\]/ in mysqld.1.err FOUND 4 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=[03]\]/ in mysqld.1.err
XA ROLLBACK 'x';
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK

View File

@ -1,10 +1,18 @@
CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0; CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (1); INSERT INTO t VALUES (1);
SET GLOBAL innodb_monitor_reset = "module_innodb"; SET GLOBAL innodb_monitor_disable="lock_row_lock_time";
SET GLOBAL innodb_monitor_disable="lock_row_lock_time_max";
SET GLOBAL innodb_monitor_reset_all='lock_row_lock_time';
SET GLOBAL innodb_monitor_reset_all='lock_row_lock_time_max';
SET GLOBAL innodb_monitor_enable="lock_row_lock_time";
SET GLOBAL innodb_monitor_enable="lock_row_lock_time_max";
BEGIN; BEGIN;
SELECT * FROM t FOR UPDATE; SELECT * FROM t FOR UPDATE;
id id
1 1
SELECT @innodb_row_lock_time_before := variable_value
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time';
connect con1,localhost,root,,; connect con1,localhost,root,,;
SET innodb_lock_wait_timeout = 1; SET innodb_lock_wait_timeout = 1;
SELECT * FROM t FOR UPDATE; SELECT * FROM t FOR UPDATE;
@ -12,29 +20,27 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1; disconnect con1;
connection default; connection default;
COMMIT; COMMIT;
SELECT variable_value > 100 FROM information_schema.global_status SELECT variable_value - @innodb_row_lock_time_before > 100
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time'; WHERE LOWER(variable_name) = 'innodb_row_lock_time';
variable_value > 100 variable_value - @innodb_row_lock_time_before > 100
1 1
SELECT variable_value > 100 FROM information_schema.global_status SELECT variable_value > 100
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
variable_value > 100 variable_value > 100
1 1
SELECT variable_value > 100 FROM information_schema.global_status SELECT count_reset > 100
WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; FROM INFORMATION_SCHEMA.INNODB_METRICS
variable_value > 100 WHERE NAME='lock_row_lock_time';
1
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time";
count_reset > 100 count_reset > 100
1 1
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS SELECT count_reset > 100
WHERE NAME="lock_row_lock_time_max"; FROM INFORMATION_SCHEMA.INNODB_METRICS
count_reset > 100 WHERE NAME='lock_row_lock_time_max';
1
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time_avg";
count_reset > 100 count_reset > 100
1 1
DROP TABLE t; DROP TABLE t;
SET GLOBAL innodb_monitor_reset=default; SET GLOBAL innodb_monitor_enable=default;
SET GLOBAL innodb_monitor_disable=default;
SET GLOBAL innodb_monitor_reset_all=default;

View File

@ -5,13 +5,13 @@ COUNT(*) 1
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 3 COUNT(*) 3
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 1 COUNT(*) 1
@ -25,13 +25,13 @@ COUNT(*) 1
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 3 COUNT(*) 3
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 1 COUNT(*) 1
@ -45,13 +45,13 @@ COUNT(*) 1
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 3 COUNT(*) 3
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_index_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0
RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't'; SELECT COUNT(*) FROM mysql.innodb_table_stats WHERE table_name = 't';
COUNT(*) 0 COUNT(*) 0

View File

@ -125,7 +125,7 @@ WHERE
table_name = 'test_ps_fetch' AND table_name = 'test_ps_fetch' AND
index_name = 'idx' AND index_name = 'idx' AND
stat_name = 'n_diff_pfx02'; stat_name = 'n_diff_pfx02';
FLUSH TABLE test_ps_fetch; RENAME TABLE test_ps_fetch TO tmp, tmp TO test_ps_fetch;
SELECT seq_in_index, column_name, cardinality SELECT seq_in_index, column_name, cardinality
FROM information_schema.statistics WHERE table_name = 'test_ps_fetch' FROM information_schema.statistics WHERE table_name = 'test_ps_fetch'
ORDER BY index_name, seq_in_index; ORDER BY index_name, seq_in_index;

View File

@ -96,15 +96,25 @@ INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0),
SELECT * FROM t10; SELECT * FROM t10;
eval CREATE TABLE t11(a FLOAT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; eval CREATE TABLE t11(a FLOAT $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB;
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t11; SELECT * FROM t11;
eval CREATE TABLE t11u(a FLOAT UNSIGNED $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB;
--error ER_WARN_DATA_OUT_OF_RANGE
INSERT INTO t11u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
INSERT INTO t11u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
SELECT * FROM t11u;
eval CREATE TABLE t12(a DOUBLE $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB; eval CREATE TABLE t12(a DOUBLE $AUTO_INCREMENT_KEY_a) ENGINE = InnoDB;
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
(20), (30), (31);
SELECT * FROM t12; SELECT * FROM t12;
CREATE TABLE t12u(a DOUBLE UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
--error ER_WARN_DATA_OUT_OF_RANGE
INSERT INTO t12u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
INSERT INTO t12u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
SELECT * FROM t12u;
--echo # Scenario 1: Normal restart, to test if the counters are persisted --echo # Scenario 1: Normal restart, to test if the counters are persisted
--echo # Scenario 2: Delete some values, to test the counters should not be the --echo # Scenario 2: Delete some values, to test the counters should not be the
--echo # one which is the largest in current table --echo # one which is the largest in current table
@ -567,6 +577,6 @@ INSERT INTO t33 VALUES(3, NULL);
SELECT MAX(b) AS `Expect 4` FROM t33; SELECT MAX(b) AS `Expect 4` FROM t33;
SELECT * FROM t33; SELECT * FROM t33;
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33; DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t11u, t12u,
t30, t32, t33;
--source include/test_db_charset_restore.inc --source include/test_db_charset_restore.inc

View File

@ -1,7 +1,9 @@
[strict_crc32] [strict_crc32]
--innodb-checksum-algorithm=strict_crc32 --innodb-checksum-algorithm=strict_crc32
--innodb-use-atomic-writes=0 --innodb-use-atomic-writes=0
--innodb-undo-tablespaces=0
[strict_full_crc32] [strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32 --innodb-checksum-algorithm=strict_full_crc32
--innodb-use-atomic-writes=0 --innodb-use-atomic-writes=0
--innodb-undo-tablespaces=0

View File

@ -42,10 +42,17 @@ commit work;
SET GLOBAL innodb_fast_shutdown = 0; SET GLOBAL innodb_fast_shutdown = 0;
let $shutdown_timeout=; let $shutdown_timeout=;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0,innodb_max_dirty_pages_pct=0;
let $wait_condition =
SELECT variable_value = 0
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
--source include/wait_condition.inc
SET GLOBAL innodb_max_dirty_pages_pct=99;
--source ../include/no_checkpoint_start.inc --source ../include/no_checkpoint_start.inc
connect (dml,localhost,root,,); connect (dml,localhost,root,,);
XA START 'x'; XA START 'x';
insert into t1 values (6, repeat('%', @@innodb_page_size/2)); insert into t1 values(6, repeat('%', @@innodb_page_size/2));
XA END 'x'; XA END 'x';
XA PREPARE 'x'; XA PREPARE 'x';
disconnect dml; disconnect dml;
@ -53,10 +60,12 @@ connection default;
flush table t1 for export; flush table t1 for export;
let $restart_parameters=; --let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint;
--let CLEANUP_IF_CHECKPOINT=XA COMMIT 'x';drop table t1;
--source ../include/no_checkpoint_end.inc --source ../include/no_checkpoint_end.inc
--copy_file $MYSQLD_DATADIR/ibdata1 $MYSQLD_DATADIR/ibdata1.bak
--copy_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile0.bak
perl; perl;
use IO::Handle; use IO::Handle;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
@ -145,6 +154,12 @@ let $shutdown_timeout=0;
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc
let $shutdown_timeout=; let $shutdown_timeout=;
# Corrupt the file in a better way. # Corrupt the file in a better way.
--remove_file $MYSQLD_DATADIR/ibdata1
--remove_file $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ibdata1.bak $MYSQLD_DATADIR/ibdata1
--move_file $MYSQLD_DATADIR/ib_logfile0.bak $MYSQLD_DATADIR/ib_logfile0
perl; perl;
use IO::Handle; use IO::Handle;
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
@ -157,22 +172,23 @@ syswrite(FILE, chr(0) x ($page_size/2));
close FILE; close FILE;
EOF EOF
--source include/start_mysqld.inc --source include/start_mysqld.inc
XA ROLLBACK 'x';
check table t1; check table t1;
select f1, f2 from t1; select f1, f2 from t1;
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0,innodb_max_dirty_pages_pct=0;
let $wait_condition =
SELECT variable_value = 0
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
--source include/wait_condition.inc
SET GLOBAL innodb_max_dirty_pages_pct=99;
--source ../include/no_checkpoint_start.inc --source ../include/no_checkpoint_start.inc
connect (dml,localhost,root,,); XA ROLLBACK 'x';
XA START 'x'; FLUSH TABLE t1 FOR EXPORT;
insert into t1 values (6, repeat('%', @@innodb_page_size/2));
XA END 'x';
XA PREPARE 'x';
disconnect dml;
connection default;
flush table t1 for export; # If we are skipping the test at this point due to an unexpected
# checkpoint, we will already have tested a part of this functionality.
let $restart_parameters=; --let CLEANUP_IF_CHECKPOINT=drop table t1;
--source ../include/no_checkpoint_end.inc --source ../include/no_checkpoint_end.inc
# Zero out the first page in file and try to recover from dblwr # Zero out the first page in file and try to recover from dblwr
@ -186,7 +202,6 @@ EOF
--source include/start_mysqld.inc --source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9][0-9]*, page number=[03]\\]; let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9][0-9]*, page number=[03]\\];
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
XA ROLLBACK 'x';
check table t1; check table t1;
select f1, f2 from t1; select f1, f2 from t1;
drop table t1; drop table t1;

View File

@ -5,11 +5,26 @@ CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (1); INSERT INTO t VALUES (1);
SET GLOBAL innodb_monitor_reset = "module_innodb"; SET GLOBAL innodb_monitor_disable="lock_row_lock_time";
SET GLOBAL innodb_monitor_disable="lock_row_lock_time_max";
SET GLOBAL innodb_monitor_reset_all='lock_row_lock_time';
SET GLOBAL innodb_monitor_reset_all='lock_row_lock_time_max';
SET GLOBAL innodb_monitor_enable="lock_row_lock_time";
SET GLOBAL innodb_monitor_enable="lock_row_lock_time_max";
BEGIN; BEGIN;
SELECT * FROM t FOR UPDATE; SELECT * FROM t FOR UPDATE;
# We can't predict (innodb/lock)_row_lock_time_avg value, because it's counted
# as the whole waiting time divided by the amount of waits. The
# corresponding counters in lock_sys can't be reset with any query.
--disable_result_log
SELECT @innodb_row_lock_time_before := variable_value
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time';
--enable_result_log
--connect(con1,localhost,root,,) --connect(con1,localhost,root,,)
SET innodb_lock_wait_timeout = 1; SET innodb_lock_wait_timeout = 1;
--error ER_LOCK_WAIT_TIMEOUT --error ER_LOCK_WAIT_TIMEOUT
@ -19,24 +34,28 @@ SELECT * FROM t FOR UPDATE;
--connection default --connection default
COMMIT; COMMIT;
SELECT variable_value > 100 FROM information_schema.global_status SELECT variable_value - @innodb_row_lock_time_before > 100
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time'; WHERE LOWER(variable_name) = 'innodb_row_lock_time';
SELECT variable_value > 100 FROM information_schema.global_status # We can't use 'variable_value - @innodb_row_lock_time_max_before' trick for
# innodb_row_lock_time_max, because we can't reset it, and we don't know the
# initial value at the moment of the test execution.
SELECT variable_value > 100
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
SELECT variable_value > 100 FROM information_schema.global_status SELECT count_reset > 100
WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME='lock_row_lock_time';
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS SELECT count_reset > 100
WHERE NAME="lock_row_lock_time"; FROM INFORMATION_SCHEMA.INNODB_METRICS
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME='lock_row_lock_time_max';
WHERE NAME="lock_row_lock_time_max";
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time_avg";
DROP TABLE t; DROP TABLE t;
--disable_warnings --disable_warnings
SET GLOBAL innodb_monitor_reset=default; SET GLOBAL innodb_monitor_enable=default;
SET GLOBAL innodb_monitor_disable=default;
SET GLOBAL innodb_monitor_reset_all=default;
--enable_warnings --enable_warnings
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc

View File

@ -17,9 +17,7 @@ CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB;
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open and close the table
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
@ -27,7 +25,8 @@ DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open the table, causing stats recalc/save # rename and open the table, causing stats recalc/save
RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
-- eval $check_stats1 -- eval $check_stats1
@ -43,9 +42,7 @@ CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=1;
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open and close the table
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
@ -53,7 +50,7 @@ DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open the table, causing stats recalc/save RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
-- eval $check_stats1 -- eval $check_stats1
@ -69,9 +66,7 @@ CREATE TABLE t (a INT, PRIMARY KEY (a)) ENGINE=INNODB STATS_AUTO_RECALC=0;
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open and close the table
SELECT * FROM t; SELECT * FROM t;
FLUSH TABLE t;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_index_stats WHERE table_name = 't';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 't'; DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
@ -79,7 +74,8 @@ DELETE FROM mysql.innodb_table_stats WHERE table_name = 't';
-- eval $check_stats1 -- eval $check_stats1
-- eval $check_stats2 -- eval $check_stats2
# open the table, stats should not be present, since autorecalc is disabled # rename the table, stats should not be present, since autorecalc is disabled
RENAME TABLE t TO tmp, tmp TO t;
SELECT * FROM t; SELECT * FROM t;
-- eval $check_stats1 -- eval $check_stats1

View File

@ -69,7 +69,7 @@ table_name = 'test_ps_fetch' AND
index_name = 'idx' AND index_name = 'idx' AND
stat_name = 'n_diff_pfx02'; stat_name = 'n_diff_pfx02';
FLUSH TABLE test_ps_fetch; RENAME TABLE test_ps_fetch TO tmp, tmp TO test_ps_fetch;
SELECT seq_in_index, column_name, cardinality SELECT seq_in_index, column_name, cardinality
FROM information_schema.statistics WHERE table_name = 'test_ps_fetch' FROM information_schema.statistics WHERE table_name = 'test_ps_fetch'

View File

@ -5,6 +5,9 @@ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200), title VARCHAR(200),
content TEXT content TEXT
) ENGINE= InnoDB; ) ENGINE= InnoDB;
SET STATEMENT debug_dbug='+d,innodb_report_deadlock' FOR
CREATE FULLTEXT INDEX idx ON articles (title, content);
ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB
CREATE FULLTEXT INDEX idx ON articles (title, content); CREATE FULLTEXT INDEX idx ON articles (title, content);
INSERT INTO articles (title, content) VALUES INSERT INTO articles (title, content) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),

View File

@ -3,6 +3,9 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_debug.inc -- source include/have_debug.inc
--disable_query_log
call mtr.add_suppression("InnoDB: \\(Deadlock\\) writing `use_stopword'");
--enable_query_log
SET @optimize=@@GLOBAL.INNODB_OPTIMIZE_FULLTEXT_ONLY; SET @optimize=@@GLOBAL.INNODB_OPTIMIZE_FULLTEXT_ONLY;
SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1; SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
@ -14,6 +17,9 @@ CREATE TABLE articles (
content TEXT content TEXT
) ENGINE= InnoDB; ) ENGINE= InnoDB;
--error ER_GET_ERRNO
SET STATEMENT debug_dbug='+d,innodb_report_deadlock' FOR
CREATE FULLTEXT INDEX idx ON articles (title, content);
CREATE FULLTEXT INDEX idx ON articles (title, content); CREATE FULLTEXT INDEX idx ON articles (title, content);
INSERT INTO articles (title, content) VALUES INSERT INTO articles (title, content) VALUES

View File

@ -1,10 +1,10 @@
SELECT name, type, processlist_user, processlist_host, processlist_db, SELECT name, type, processlist_user, processlist_host, processlist_db,
processlist_command, processlist_time, processlist_state, processlist_info, processlist_command, processlist_time, processlist_info,
parent_thread_id, role, instrumented parent_thread_id, role, instrumented
FROM performance_schema.threads FROM performance_schema.threads
WHERE name LIKE 'thread/innodb/%' WHERE name LIKE 'thread/innodb/%'
GROUP BY name; GROUP BY name;
name type processlist_user processlist_host processlist_db processlist_command processlist_time processlist_state processlist_info parent_thread_id role instrumented name type processlist_user processlist_host processlist_db processlist_command processlist_time processlist_info parent_thread_id role instrumented
thread/innodb/ib_tpool_worker BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES thread/innodb/ib_tpool_worker BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/page_cleaner BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES thread/innodb/page_cleaner BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/page_encrypt BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL NULL YES thread/innodb/page_encrypt BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES

View File

@ -14,7 +14,7 @@
# We suppress here duplicates rows with the goal to avoid that the test fails # We suppress here duplicates rows with the goal to avoid that the test fails
# in case some defaults are changed. # in case some defaults are changed.
SELECT name, type, processlist_user, processlist_host, processlist_db, SELECT name, type, processlist_user, processlist_host, processlist_db,
processlist_command, processlist_time, processlist_state, processlist_info, processlist_command, processlist_time, processlist_info,
parent_thread_id, role, instrumented parent_thread_id, role, instrumented
FROM performance_schema.threads FROM performance_schema.threads
WHERE name LIKE 'thread/innodb/%' WHERE name LIKE 'thread/innodb/%'

View File

@ -1,16 +1,15 @@
***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts ***
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection server_2; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET sql_log_bin=0; CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1; connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
connection server_1; connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,;

View File

@ -0,0 +1,26 @@
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1),(3,3),(5,5),(7,7);
create table t2 (m int) engine=aria;
# Create multi-engine, two-phase XA transaction (T1)
xa start '1';
insert t2 values (1);
update t1 set b=50 where b=5;
xa end '1';
xa prepare '1';
# Create T2
connection server_1;
update t1 set b=10 where a=5;
connection master;
xa commit '1';
connection server_1;
include/save_master_gtid.inc
# This would hang prior to MDEV-21117
connection slave;
include/sync_with_master_gtid.inc
connection master;
drop table t1, t2;
include/rpl_end.inc
# End of rpl_xa_2pc_multi_engine.test

View File

@ -5,21 +5,19 @@
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/master-slave.inc --source include/master-slave.inc
--disable_query_log ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CALL mtr.add_suppression("InnoDB: Transaction was aborted due to ");
--enable_query_log CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
--save_master_pos
--connection server_2 --connection server_2
SET sql_log_bin=0; --sync_with_master
CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends");
SET sql_log_bin=1;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos; CHANGE MASTER TO master_use_gtid=slave_pos;
--connection server_1 --connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) --connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)

View File

@ -0,0 +1,63 @@
#
# This test ensures binlog order is correct for multi-engine, two-phase XA
# transactions. MDEV-26652 exposed a race condition which would allow
# concurrent transactions which modify the same table record to binlog in
# the "opposite" order, i.e. what _should_ be:
# T1 XA PREPARE
# T1 XA COMMIT
# T2
#
# was binlogged as
# T1 XA PREPARE
# T2
# T1 XA COMMIT
#
# which would break replication.
#
# Note that the actual fix for this issue was done with MDEV-21117.
#
# References:
# MDEV-26652: xa transactions binlogged in wrong order
# MDEV-21117: refine the server binlog-based recovery for semisync
#
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
source include/master-slave.inc;
--connection master
create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1),(3,3),(5,5),(7,7);
create table t2 (m int) engine=aria;
--echo # Create multi-engine, two-phase XA transaction (T1)
xa start '1';
insert t2 values (1);
update t1 set b=50 where b=5;
xa end '1';
# Aria doesn't support XA PREPARE, so disable warnings
--disable_warnings
xa prepare '1';
--enable_warnings
--echo # Create T2
--connection server_1
--send update t1 set b=10 where a=5
--connection master
xa commit '1';
--connection server_1
--reap
--source include/save_master_gtid.inc
--echo # This would hang prior to MDEV-21117
--connection slave
--source include/sync_with_master_gtid.inc
--connection master
drop table t1, t2;
--source include/rpl_end.inc
--echo # End of rpl_xa_2pc_multi_engine.test

View File

@ -1487,10 +1487,10 @@ VARIABLE_NAME INNODB_STATS_PERSISTENT_SAMPLE_PAGES
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 20 DEFAULT_VALUE 20
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The number of leaf index pages to sample when calculating persistent statistics (by ANALYZE, default 20) VARIABLE_COMMENT The number of leaf index pages to sample when calculating persistent statistics (by ANALYZE, default 20)
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
@ -1511,10 +1511,10 @@ VARIABLE_NAME INNODB_STATS_TRANSIENT_SAMPLE_PAGES
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 8 DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The number of leaf index pages to sample when calculating transient statistics (if persistent statistics are not used, default 8) VARIABLE_COMMENT The number of leaf index pages to sample when calculating transient statistics (if persistent statistics are not used, default 8)
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO

View File

@ -0,0 +1,15 @@
#
# wsrep_replicate_myisam
#
# save the initial value
SET @wsrep_mode_saved = @@global.wsrep_mode;
# scope and valid values
SET @@global.wsrep_mode=REPLICATE_MYISAM;
SELECT @@global.wsrep_mode;
@@global.wsrep_mode
REPLICATE_MYISAM
# restore the initial value
SET @@global.wsrep_mode = @wsrep_mode_saved;
# End of test

View File

@ -0,0 +1,19 @@
--source include/have_wsrep.inc
--echo #
--echo # wsrep_replicate_myisam
--echo #
--echo # save the initial value
SET @wsrep_mode_saved = @@global.wsrep_mode;
--echo
--echo # scope and valid values
SET @@global.wsrep_mode=REPLICATE_MYISAM;
SELECT @@global.wsrep_mode;
--echo
--echo # restore the initial value
SET @@global.wsrep_mode = @wsrep_mode_saved;
--echo # End of test

View File

@ -0,0 +1,7 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
wsrep-cluster-address=gcomm://
wsrep-provider=@ENV.WSREP_PROVIDER
binlog-format=ROW

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