Skip to content

Commit 9aea7d8

Browse files
committed
Merge 10.5 into 10.6
2 parents 24fe534 + 41028d7 commit 9aea7d8

File tree

7 files changed

+162
-20
lines changed

7 files changed

+162
-20
lines changed

mysql-test/suite/compat/oracle/r/sp-package.result

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,3 +3268,78 @@ a
32683268
This is db1.pkg1.p1
32693269
DROP DATABASE db1;
32703270
DROP DATABASE db2;
3271+
#
3272+
# MDEV-29370 Functions in packages are slow and seems to ignore deterministic
3273+
#
3274+
SET SQL_MODE=ORACLE;
3275+
CREATE TABLE t1 (c1 CHAR(1));
3276+
CREATE FUNCTION f1_deterministic()
3277+
RETURN CHAR(1)
3278+
DETERMINISTIC
3279+
IS
3280+
BEGIN
3281+
RETURN 'X';
3282+
END;
3283+
//
3284+
CREATE FUNCTION f2_not_deterministic()
3285+
RETURN CHAR(1)
3286+
IS
3287+
BEGIN
3288+
RETURN 'X';
3289+
END;
3290+
//
3291+
CREATE PACKAGE pkg1
3292+
IS
3293+
PROCEDURE t1_populate(numrows INTEGER);
3294+
FUNCTION f3_deterministic() RETURN CHAR(1) DETERMINISTIC;
3295+
FUNCTION f4_not_deterministic() RETURN CHAR(1);
3296+
END;
3297+
//
3298+
CREATE PACKAGE BODY pkg1
3299+
IS
3300+
PROCEDURE t1_populate(numrounds INTEGER)
3301+
IS
3302+
i INTEGER;
3303+
BEGIN
3304+
INSERT INTO t1 VALUES('Y');
3305+
FOR i IN 1..numrounds LOOP
3306+
INSERT INTO t1 SELECT * FROM t1;
3307+
END LOOP;
3308+
END;
3309+
FUNCTION f3_deterministic() RETURN CHAR(1) DETERMINISTIC COMMENT 'xxx'
3310+
IS
3311+
BEGIN
3312+
RETURN 'X';
3313+
END;
3314+
FUNCTION f4_not_deterministic() RETURN CHAR(1)
3315+
IS
3316+
BEGIN
3317+
RETURN 'X';
3318+
END;
3319+
END;
3320+
//
3321+
CALL pkg1.t1_populate(3);
3322+
EXPLAIN EXTENDED SELECT 'Deterministic function', COUNT(*) FROM t1 WHERE c1 = f1_deterministic();
3323+
id select_type table type possible_keys key key_len ref rows filtered Extra
3324+
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
3325+
Warnings:
3326+
Note 1003 select 'Deterministic function' AS "Deterministic function",count(0) AS "COUNT(*)" from "test"."t1" where "test"."t1"."c1" = <cache>("f1_deterministic"())
3327+
EXPLAIN EXTENDED SELECT 'Non-deterministic function', COUNT(*) FROM t1 WHERE c1 = f2_not_deterministic();
3328+
id select_type table type possible_keys key key_len ref rows filtered Extra
3329+
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
3330+
Warnings:
3331+
Note 1003 select 'Non-deterministic function' AS "Non-deterministic function",count(0) AS "COUNT(*)" from "test"."t1" where "test"."t1"."c1" = "f2_not_deterministic"()
3332+
EXPLAIN EXTENDED SELECT 'Deterministic package function', COUNT(*) FROM t1 WHERE c1 = pkg1.f3_deterministic();
3333+
id select_type table type possible_keys key key_len ref rows filtered Extra
3334+
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
3335+
Warnings:
3336+
Note 1003 select 'Deterministic package function' AS "Deterministic package function",count(0) AS "COUNT(*)" from "test"."t1" where "test"."t1"."c1" = <cache>("test"."pkg1"."f3_deterministic"())
3337+
EXPLAIN EXTENDED SELECT 'Non-deterministic package function', COUNT(*) FROM t1 WHERE c1 = pkg1.f4_not_deterministic();
3338+
id select_type table type possible_keys key key_len ref rows filtered Extra
3339+
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
3340+
Warnings:
3341+
Note 1003 select 'Non-deterministic package function' AS "Non-deterministic package function",count(0) AS "COUNT(*)" from "test"."t1" where "test"."t1"."c1" = "test"."pkg1"."f4_not_deterministic"()
3342+
DROP TABLE t1;
3343+
DROP FUNCTION f1_deterministic;
3344+
DROP FUNCTION f2_not_deterministic;
3345+
DROP PACKAGE pkg1;

mysql-test/suite/compat/oracle/t/sp-package.test

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,3 +3016,75 @@ CALL db2.pkg1.p2_db1_pkg1_p1;
30163016

30173017
DROP DATABASE db1;
30183018
DROP DATABASE db2;
3019+
3020+
3021+
--echo #
3022+
--echo # MDEV-29370 Functions in packages are slow and seems to ignore deterministic
3023+
--echo #
3024+
3025+
SET SQL_MODE=ORACLE;
3026+
3027+
CREATE TABLE t1 (c1 CHAR(1));
3028+
3029+
DELIMITER //;
3030+
CREATE FUNCTION f1_deterministic()
3031+
RETURN CHAR(1)
3032+
DETERMINISTIC
3033+
IS
3034+
BEGIN
3035+
RETURN 'X';
3036+
END;
3037+
//
3038+
3039+
CREATE FUNCTION f2_not_deterministic()
3040+
RETURN CHAR(1)
3041+
IS
3042+
BEGIN
3043+
RETURN 'X';
3044+
END;
3045+
//
3046+
3047+
CREATE PACKAGE pkg1
3048+
IS
3049+
PROCEDURE t1_populate(numrows INTEGER);
3050+
FUNCTION f3_deterministic() RETURN CHAR(1) DETERMINISTIC;
3051+
FUNCTION f4_not_deterministic() RETURN CHAR(1);
3052+
END;
3053+
//
3054+
3055+
CREATE PACKAGE BODY pkg1
3056+
IS
3057+
PROCEDURE t1_populate(numrounds INTEGER)
3058+
IS
3059+
i INTEGER;
3060+
BEGIN
3061+
INSERT INTO t1 VALUES('Y');
3062+
FOR i IN 1..numrounds LOOP
3063+
INSERT INTO t1 SELECT * FROM t1;
3064+
END LOOP;
3065+
END;
3066+
FUNCTION f3_deterministic() RETURN CHAR(1) DETERMINISTIC COMMENT 'xxx'
3067+
IS
3068+
BEGIN
3069+
RETURN 'X';
3070+
END;
3071+
FUNCTION f4_not_deterministic() RETURN CHAR(1)
3072+
IS
3073+
BEGIN
3074+
RETURN 'X';
3075+
END;
3076+
END;
3077+
//
3078+
DELIMITER ;//
3079+
3080+
CALL pkg1.t1_populate(3);
3081+
3082+
EXPLAIN EXTENDED SELECT 'Deterministic function', COUNT(*) FROM t1 WHERE c1 = f1_deterministic();
3083+
EXPLAIN EXTENDED SELECT 'Non-deterministic function', COUNT(*) FROM t1 WHERE c1 = f2_not_deterministic();
3084+
EXPLAIN EXTENDED SELECT 'Deterministic package function', COUNT(*) FROM t1 WHERE c1 = pkg1.f3_deterministic();
3085+
EXPLAIN EXTENDED SELECT 'Non-deterministic package function', COUNT(*) FROM t1 WHERE c1 = pkg1.f4_not_deterministic();
3086+
3087+
DROP TABLE t1;
3088+
DROP FUNCTION f1_deterministic;
3089+
DROP FUNCTION f2_not_deterministic;
3090+
DROP PACKAGE pkg1;

mysql-test/suite/encryption/r/innochecksum,debug.rdiff

Lines changed: 0 additions & 10 deletions
This file was deleted.

mysql-test/suite/encryption/t/innochecksum.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ print FILE pack("H*", "c00lcafedeadb017");
264264
close FILE or die "close";
265265
EOF
266266

267-
if ($have_debug) {
267+
if (0 && $have_debug) { # these messages sometimes fail to appear
268268
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
269269
--let SEARCH_PATTERN= InnoDB: Crash recovery is broken due to insufficient innodb_log_file_size; last checkpoint LSN=\\d+, current LSN=\\d+\\. Shutdown is in progress\\..*InnoDB: Crash recovery was broken.*
270270
--echo # FOUND 1 is expected for both.

mysql-test/suite/sys_vars/t/wsrep_on_without_provider.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--source include/not_embedded.inc
2+
--source include/have_wsrep.inc
23

34
#
45
# @@global.wsrep_on is not allowed if there

sql/sql_yacc.yy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19204,6 +19204,7 @@ package_implementation_function_body:
1920419204
sp_head *sp= pkg->m_current_routine->sphead;
1920519205
thd->lex= pkg->m_current_routine;
1920619206
sp->reset_thd_mem_root(thd);
19207+
sp->set_c_chistics(thd->lex->sp_chistics);
1920719208
sp->set_body_start(thd, YYLIP->get_cpp_tok_start());
1920819209
}
1920919210
sp_body opt_package_routine_end_name
@@ -19222,6 +19223,7 @@ package_implementation_procedure_body:
1922219223
sp_head *sp= pkg->m_current_routine->sphead;
1922319224
thd->lex= pkg->m_current_routine;
1922419225
sp->reset_thd_mem_root(thd);
19226+
sp->set_c_chistics(thd->lex->sp_chistics);
1922519227
sp->set_body_start(thd, YYLIP->get_cpp_tok_start());
1922619228
}
1922719229
sp_body opt_package_routine_end_name

storage/innobase/log/log0recv.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,14 +1175,6 @@ inline void recv_sys_t::trim(const page_id_t page_id, lsn_t lsn)
11751175
pages.erase(r);
11761176
}
11771177
}
1178-
if (fil_space_t* space = fil_space_get(page_id.space())) {
1179-
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
1180-
fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
1181-
ut_ad(file->is_open());
1182-
os_file_truncate(file->name, file->handle,
1183-
os_offset_t{page_id.page_no()}
1184-
<< srv_page_size_shift, true);
1185-
}
11861178
DBUG_VOID_RETURN;
11871179
}
11881180

@@ -3273,7 +3265,17 @@ void recv_sys_t::apply(bool last_batch)
32733265
{
32743266
const trunc& t= truncated_undo_spaces[id];
32753267
if (t.lsn)
3276-
trim(page_id_t(id + srv_undo_space_id_start, t.pages), t.lsn);
3268+
{
3269+
trim(page_id_t(id + srv_undo_space_id_start, 0), t.lsn);
3270+
if (fil_space_t *space = fil_space_get(id + srv_undo_space_id_start))
3271+
{
3272+
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
3273+
fil_node_t *file= UT_LIST_GET_FIRST(space->chain);
3274+
ut_ad(file->is_open());
3275+
os_file_truncate(file->name, file->handle,
3276+
os_offset_t{t.pages} << srv_page_size_shift, true);
3277+
}
3278+
}
32773279
}
32783280

32793281
fil_system.extend_to_recv_size();

0 commit comments

Comments
 (0)