Skip to content

Commit af4f9da

Browse files
committed
Merge 11.2 into 11.3
2 parents 193b22d + e4cb1e3 commit af4f9da

30 files changed

+358
-408
lines changed

mysql-test/main/delete.result

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -610,49 +610,4 @@ c1 c2 c3
610610
2 1 4
611611
2 2 5
612612
drop table t1;
613-
#
614-
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
615-
#
616-
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
617-
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
618-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
619-
INSERT INTO t2 values (2);
620-
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
621-
select * from t1;
622-
c1
623-
1
624-
3
625-
4
626-
5
627-
6
628-
truncate t1;
629-
truncate t2;
630-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
631-
INSERT INTO t2 values (2);
632-
check sj optimization with order-by
633-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
634-
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
635-
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
636-
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
637-
select * from t1;
638-
c1
639-
1
640-
3
641-
4
642-
5
643-
6
644-
truncate t2;
645-
INSERT INTO t2 values (3);
646-
disallows sj optimization
647-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
648-
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
649-
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
650-
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
651-
select * from t1;
652-
c1
653-
1
654-
4
655-
5
656-
6
657-
DROP TABLE t1, t2;
658613
End of 11.1 tests

mysql-test/main/delete.test

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -667,31 +667,4 @@ select *from t1;
667667

668668
drop table t1;
669669

670-
--echo #
671-
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
672-
--echo #
673-
--source include/have_innodb.inc
674-
675-
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
676-
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
677-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
678-
INSERT INTO t2 values (2);
679-
680-
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
681-
select * from t1;
682-
truncate t1;
683-
truncate t2;
684-
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
685-
INSERT INTO t2 values (2);
686-
--echo check sj optimization with order-by
687-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
688-
select * from t1;
689-
truncate t2;
690-
INSERT INTO t2 values (3);
691-
--echo disallows sj optimization
692-
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
693-
select * from t1;
694-
695-
DROP TABLE t1, t2;
696-
697670
--echo End of 11.1 tests

mysql-test/main/delete_innodb.result

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,49 @@ SELECT * FROM t1;
2424
c1
2525
SET sort_buffer_size=@save_sort_buffer_size;
2626
DROP TABLE t1;
27+
#
28+
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
29+
#
30+
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
31+
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
32+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
33+
INSERT INTO t2 values (2);
34+
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
35+
select * from t1;
36+
c1
37+
1
38+
3
39+
4
40+
5
41+
6
42+
truncate t1;
43+
truncate t2;
44+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
45+
INSERT INTO t2 values (2);
46+
check sj optimization with order-by
47+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
48+
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
49+
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
50+
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
51+
select * from t1;
52+
c1
53+
1
54+
3
55+
4
56+
5
57+
6
58+
truncate t2;
59+
INSERT INTO t2 values (3);
60+
disallows sj optimization
61+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
62+
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
63+
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
64+
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
65+
select * from t1;
66+
c1
67+
1
68+
4
69+
5
70+
6
71+
DROP TABLE t1, t2;
72+
End of 11.1 tests

mysql-test/main/delete_innodb.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--source include/have_innodb.inc
22
--source include/have_sequence.inc
33

4+
--source include/innodb_stable_estimates.inc
5+
46
--echo # Tests for delete with INNODB
57

68
--echo #
@@ -20,3 +22,31 @@ SELECT * FROM t1;
2022

2123
SET sort_buffer_size=@save_sort_buffer_size;
2224
DROP TABLE t1;
25+
26+
--echo #
27+
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
28+
--echo #
29+
--source include/have_innodb.inc
30+
31+
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
32+
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
33+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
34+
INSERT INTO t2 values (2);
35+
36+
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
37+
select * from t1;
38+
truncate t1;
39+
truncate t2;
40+
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
41+
INSERT INTO t2 values (2);
42+
--echo check sj optimization with order-by
43+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
44+
select * from t1;
45+
truncate t2;
46+
INSERT INTO t2 values (3);
47+
--echo disallows sj optimization
48+
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
49+
select * from t1;
50+
51+
DROP TABLE t1, t2;
52+
--echo End of 11.1 tests

mysql-test/main/func_regexp_pcre.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,3 +895,12 @@ REGEXP_INSTR('a_kollision', 'o([lm])\\1')
895895
4
896896
SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
897897
a
898+
#
899+
# MDEV-11777 REGEXP_REPLACE converts utf8mb4 supplementary characters to '?'
900+
#
901+
select hex(regexp_replace(cast(x'F09F9881' as char character set 'utf8mb4'), _utf8mb4'a', _utf8mb4'b')) as Text;
902+
Text
903+
F09F9881
904+
#
905+
# End of 10.6 tests
906+
#

mysql-test/main/func_regexp_pcre.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,11 @@ SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
470470
#
471471
SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
472472
--enable_service_connection
473+
474+
--echo #
475+
--echo # MDEV-11777 REGEXP_REPLACE converts utf8mb4 supplementary characters to '?'
476+
--echo #
477+
select hex(regexp_replace(cast(x'F09F9881' as char character set 'utf8mb4'), _utf8mb4'a', _utf8mb4'b')) as Text;
478+
--echo #
479+
--echo # End of 10.6 tests
480+
--echo #

mysql-test/suite/innodb/t/doublewrite_debug.test

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,6 @@ set global innodb_fil_make_page_dirty_debug = 0;
6161
set global innodb_buf_flush_list_now = 1;
6262

6363
--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint;
64-
# Occasionally, a checkpoint would occur on the MSAN builder.
65-
# We do not know the reason, because the failure can only be reproduced if there is
66-
# enough load in that environment.
67-
# Therefore, we allow the test to be skipped when run on MSAN.
68-
# In other environments, we want the test to fail if a checkpoint occurs,
69-
# so that we would catch it if it starts to happen regularly.
70-
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`)
71-
{
72-
--let CLEANUP_IF_CHECKPOINT=drop table t1;
73-
}
74-
7564
--source ../include/no_checkpoint_end.inc
7665

7766
--echo # Make the 1st page (page_no=0) and 2nd page (page_no=1)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
3+
#
4+
set @old_innodb_io_capacity=@@global.innodb_io_capacity;
5+
set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
6+
select * from performance_schema.session_status limit 0;
7+
VARIABLE_NAME VARIABLE_VALUE
8+
set max_session_mem_used=32768;
9+
select * from performance_schema.session_status;
10+
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
11+
set global innodb_io_capacity_max=100;
12+
Warnings:
13+
Warning 1210 Setting innodb_io_capacity_max 100 lower than innodb_io_capacity 200.
14+
Warning 1210 Setting innodb_io_capacity to 100
15+
set max_session_mem_used=default;
16+
set global innodb_io_capacity=@old_innodb_io_capacity;
17+
Warnings:
18+
Warning 1210 Setting innodb_io_capacity to 200 higher than innodb_io_capacity_max 100
19+
Warning 1210 Setting innodb_max_io_capacity to 400
20+
set global innodb_io_capacity_max=@old_innodb_io_capacity_max;

mysql-test/suite/perfschema/r/rpl_threads.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
5252
from performance_schema.threads
5353
where PROCESSLIST_ID = @slave_sql_pid;
5454
NAME TYPE PROCESSLIST_COMMAND PROCESSLIST_STATE
55+
#
56+
# MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
57+
#
58+
select variable_name, variable_value from performance_schema.status_by_thread
59+
where variable_name like '%impossible%';
60+
variable_name variable_value
5561
include/rpl_end.inc
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--source include/not_embedded.inc
2+
--source include/have_perfschema.inc
3+
--echo #
4+
--echo # MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
5+
--echo #
6+
source include/have_innodb.inc;
7+
set @old_innodb_io_capacity=@@global.innodb_io_capacity;
8+
set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
9+
select * from performance_schema.session_status limit 0; # discover the table
10+
set max_session_mem_used=32768;
11+
--error ER_OPTION_PREVENTS_STATEMENT
12+
# this used to crash, when OOM happened under LOCK_thd_kill
13+
select * from performance_schema.session_status;
14+
# this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables
15+
set global innodb_io_capacity_max=100;
16+
set max_session_mem_used=default;
17+
set global innodb_io_capacity=@old_innodb_io_capacity;
18+
set global innodb_io_capacity_max=@old_innodb_io_capacity_max;

mysql-test/suite/perfschema/t/rpl_threads.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,11 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
8181
from performance_schema.threads
8282
where PROCESSLIST_ID = @slave_sql_pid;
8383

84+
--echo #
85+
--echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
86+
--echo #
87+
select variable_name, variable_value from performance_schema.status_by_thread
88+
where variable_name like '%impossible%'; # should not crash
89+
8490
--source include/rpl_end.inc
8591

sql/item_cmpfunc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6090,7 +6090,7 @@ void Regexp_processor_pcre::init(CHARSET_INFO *data_charset, int extra_flags)
60906090

60916091
// Convert text data to utf-8.
60926092
m_library_charset= data_charset == &my_charset_bin ?
6093-
&my_charset_bin : &my_charset_utf8mb3_general_ci;
6093+
&my_charset_bin : &my_charset_utf8mb4_general_ci;
60946094

60956095
m_conversion_is_needed= (data_charset != &my_charset_bin) &&
60966096
!my_charset_same(data_charset, m_library_charset);

sql/item_cmpfunc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3057,7 +3057,7 @@ class Regexp_processor_pcre
30573057
m_pcre(NULL), m_pcre_match_data(NULL),
30583058
m_conversion_is_needed(true), m_is_const(0),
30593059
m_library_flags(0),
3060-
m_library_charset(&my_charset_utf8mb3_general_ci)
3060+
m_library_charset(&my_charset_utf8mb4_general_ci)
30613061
{}
30623062
int default_regex_flags();
30633063
void init(CHARSET_INFO *data_charset, int extra_flags);

sql/log.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11886,14 +11886,21 @@ set_binlog_snapshot_file(const char *src)
1188611886
void
1188711887
TC_LOG_BINLOG::set_status_variables(THD *thd)
1188811888
{
11889-
binlog_cache_mngr *cache_mngr;
11889+
bool have_snapshot= false;
1189011890

1189111891
if (thd && opt_bin_log)
11892-
cache_mngr= thd->binlog_get_cache_mngr();
11893-
else
11894-
cache_mngr= 0;
11892+
{
11893+
mysql_mutex_lock(&thd->LOCK_thd_data);
11894+
auto cache_mngr= thd->binlog_get_cache_mngr();
11895+
have_snapshot= cache_mngr && cache_mngr->last_commit_pos_file[0];
11896+
if (have_snapshot)
11897+
{
11898+
set_binlog_snapshot_file(cache_mngr->last_commit_pos_file);
11899+
binlog_snapshot_position= cache_mngr->last_commit_pos_offset;
11900+
}
11901+
mysql_mutex_unlock(&thd->LOCK_thd_data);
11902+
}
1189511903

11896-
bool have_snapshot= (cache_mngr && cache_mngr->last_commit_pos_file[0] != 0);
1189711904
mysql_mutex_lock(&LOCK_commit_ordered);
1189811905
binlog_status_var_num_commits= this->num_commits;
1189911906
binlog_status_var_num_group_commits= this->num_group_commits;
@@ -11908,12 +11915,6 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
1190811915
binlog_status_group_commit_trigger_timeout= this->group_commit_trigger_timeout;
1190911916
binlog_status_group_commit_trigger_lock_wait= this->group_commit_trigger_lock_wait;
1191011917
mysql_mutex_unlock(&LOCK_prepare_ordered);
11911-
11912-
if (have_snapshot)
11913-
{
11914-
set_binlog_snapshot_file(cache_mngr->last_commit_pos_file);
11915-
binlog_snapshot_position= cache_mngr->last_commit_pos_offset;
11916-
}
1191711918
}
1191811919

1191911920

0 commit comments

Comments
 (0)