Skip to content

Commit

Permalink
Merge 11.3 into 11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jan 10, 2024
2 parents c0c1c80 + af4f9da commit d136169
Show file tree
Hide file tree
Showing 30 changed files with 358 additions and 408 deletions.
45 changes: 0 additions & 45 deletions mysql-test/main/delete.result
Original file line number Diff line number Diff line change
Expand Up @@ -610,49 +610,4 @@ c1 c2 c3
2 1 4
2 2 5
drop table t1;
#
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
c1
1
3
4
5
6
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
select * from t1;
c1
1
3
4
5
6
truncate t2;
INSERT INTO t2 values (3);
disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
select * from t1;
c1
1
4
5
6
DROP TABLE t1, t2;
End of 11.1 tests
27 changes: 0 additions & 27 deletions mysql-test/main/delete.test
Original file line number Diff line number Diff line change
Expand Up @@ -667,31 +667,4 @@ select *from t1;

drop table t1;

--echo #
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
--echo #
--source include/have_innodb.inc

CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);

DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
--echo check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
select * from t1;
truncate t2;
INSERT INTO t2 values (3);
--echo disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
select * from t1;

DROP TABLE t1, t2;

--echo End of 11.1 tests
46 changes: 46 additions & 0 deletions mysql-test/main/delete_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,49 @@ SELECT * FROM t1;
c1
SET sort_buffer_size=@save_sort_buffer_size;
DROP TABLE t1;
#
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
c1
1
3
4
5
6
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
select * from t1;
c1
1
3
4
5
6
truncate t2;
INSERT INTO t2 values (3);
disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
select * from t1;
c1
1
4
5
6
DROP TABLE t1, t2;
End of 11.1 tests
30 changes: 30 additions & 0 deletions mysql-test/main/delete_innodb.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--source include/have_innodb.inc
--source include/have_sequence.inc

--source include/innodb_stable_estimates.inc

--echo # Tests for delete with INNODB

--echo #
Expand All @@ -20,3 +22,31 @@ SELECT * FROM t1;

SET sort_buffer_size=@save_sort_buffer_size;
DROP TABLE t1;

--echo #
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
--echo #
--source include/have_innodb.inc

CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);

DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
--echo check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
select * from t1;
truncate t2;
INSERT INTO t2 values (3);
--echo disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
select * from t1;

DROP TABLE t1, t2;
--echo End of 11.1 tests
9 changes: 9 additions & 0 deletions mysql-test/main/func_regexp_pcre.result
Original file line number Diff line number Diff line change
Expand Up @@ -895,3 +895,12 @@ REGEXP_INSTR('a_kollision', 'o([lm])\\1')
4
SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
a
#
# MDEV-11777 REGEXP_REPLACE converts utf8mb4 supplementary characters to '?'
#
select hex(regexp_replace(cast(x'F09F9881' as char character set 'utf8mb4'), _utf8mb4'a', _utf8mb4'b')) as Text;
Text
F09F9881
#
# End of 10.6 tests
#
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/main/func_regexp_pcre.test
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,11 @@ SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
#
SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
--enable_service_connection

--echo #
--echo # MDEV-11777 REGEXP_REPLACE converts utf8mb4 supplementary characters to '?'
--echo #
select hex(regexp_replace(cast(x'F09F9881' as char character set 'utf8mb4'), _utf8mb4'a', _utf8mb4'b')) as Text;
--echo #
--echo # End of 10.6 tests
--echo #
11 changes: 0 additions & 11 deletions mysql-test/suite/innodb/t/doublewrite_debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;

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

--source ../include/no_checkpoint_end.inc

--echo # Make the 1st page (page_no=0) and 2nd page (page_no=1)
Expand Down
20 changes: 20 additions & 0 deletions mysql-test/suite/perfschema/r/misc_session_status.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
#
set @old_innodb_io_capacity=@@global.innodb_io_capacity;
set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
select * from performance_schema.session_status limit 0;
VARIABLE_NAME VARIABLE_VALUE
set max_session_mem_used=32768;
select * from performance_schema.session_status;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement
set global innodb_io_capacity_max=100;
Warnings:
Warning 1210 Setting innodb_io_capacity_max 100 lower than innodb_io_capacity 200.
Warning 1210 Setting innodb_io_capacity to 100
set max_session_mem_used=default;
set global innodb_io_capacity=@old_innodb_io_capacity;
Warnings:
Warning 1210 Setting innodb_io_capacity to 200 higher than innodb_io_capacity_max 100
Warning 1210 Setting innodb_max_io_capacity to 400
set global innodb_io_capacity_max=@old_innodb_io_capacity_max;
6 changes: 6 additions & 0 deletions mysql-test/suite/perfschema/r/rpl_threads.result
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
from performance_schema.threads
where PROCESSLIST_ID = @slave_sql_pid;
NAME TYPE PROCESSLIST_COMMAND PROCESSLIST_STATE
#
# MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
#
select variable_name, variable_value from performance_schema.status_by_thread
where variable_name like '%impossible%';
variable_name variable_value
include/rpl_end.inc
18 changes: 18 additions & 0 deletions mysql-test/suite/perfschema/t/misc_session_status.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
--echo #
--echo # MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
--echo #
source include/have_innodb.inc;
set @old_innodb_io_capacity=@@global.innodb_io_capacity;
set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max;
select * from performance_schema.session_status limit 0; # discover the table
set max_session_mem_used=32768;
--error ER_OPTION_PREVENTS_STATEMENT
# this used to crash, when OOM happened under LOCK_thd_kill
select * from performance_schema.session_status;
# this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables
set global innodb_io_capacity_max=100;
set max_session_mem_used=default;
set global innodb_io_capacity=@old_innodb_io_capacity;
set global innodb_io_capacity_max=@old_innodb_io_capacity_max;
6 changes: 6 additions & 0 deletions mysql-test/suite/perfschema/t/rpl_threads.test
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
from performance_schema.threads
where PROCESSLIST_ID = @slave_sql_pid;

--echo #
--echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
--echo #
select variable_name, variable_value from performance_schema.status_by_thread
where variable_name like '%impossible%'; # should not crash

--source include/rpl_end.inc

2 changes: 1 addition & 1 deletion sql/item_cmpfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6090,7 +6090,7 @@ void Regexp_processor_pcre::init(CHARSET_INFO *data_charset, int extra_flags)

// Convert text data to utf-8.
m_library_charset= data_charset == &my_charset_bin ?
&my_charset_bin : &my_charset_utf8mb3_general_ci;
&my_charset_bin : &my_charset_utf8mb4_general_ci;

m_conversion_is_needed= (data_charset != &my_charset_bin) &&
!my_charset_same(data_charset, m_library_charset);
Expand Down
2 changes: 1 addition & 1 deletion sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,7 @@ class Regexp_processor_pcre
m_pcre(NULL), m_pcre_match_data(NULL),
m_conversion_is_needed(true), m_is_const(0),
m_library_flags(0),
m_library_charset(&my_charset_utf8mb3_general_ci)
m_library_charset(&my_charset_utf8mb4_general_ci)
{}
int default_regex_flags();
void init(CHARSET_INFO *data_charset, int extra_flags);
Expand Down
23 changes: 12 additions & 11 deletions sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11894,14 +11894,21 @@ set_binlog_snapshot_file(const char *src)
void
TC_LOG_BINLOG::set_status_variables(THD *thd)
{
binlog_cache_mngr *cache_mngr;
bool have_snapshot= false;

if (thd && opt_bin_log)
cache_mngr= thd->binlog_get_cache_mngr();
else
cache_mngr= 0;
{
mysql_mutex_lock(&thd->LOCK_thd_data);
auto cache_mngr= thd->binlog_get_cache_mngr();
have_snapshot= cache_mngr && cache_mngr->last_commit_pos_file[0];
if (have_snapshot)
{
set_binlog_snapshot_file(cache_mngr->last_commit_pos_file);
binlog_snapshot_position= cache_mngr->last_commit_pos_offset;
}
mysql_mutex_unlock(&thd->LOCK_thd_data);
}

bool have_snapshot= (cache_mngr && cache_mngr->last_commit_pos_file[0] != 0);
mysql_mutex_lock(&LOCK_commit_ordered);
binlog_status_var_num_commits= this->num_commits;
binlog_status_var_num_group_commits= this->num_group_commits;
Expand All @@ -11916,12 +11923,6 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
binlog_status_group_commit_trigger_timeout= this->group_commit_trigger_timeout;
binlog_status_group_commit_trigger_lock_wait= this->group_commit_trigger_lock_wait;
mysql_mutex_unlock(&LOCK_prepare_ordered);

if (have_snapshot)
{
set_binlog_snapshot_file(cache_mngr->last_commit_pos_file);
binlog_snapshot_position= cache_mngr->last_commit_pos_offset;
}
}


Expand Down

0 comments on commit d136169

Please sign in to comment.