mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
WIP tests for MDEV-39838 to repro the failure
Co-authored-by: Roel’s AI. The final test should be nearly all my writing, with those AI parts barely distinguishable.
This commit is contained in:
28
mysql-test/main/log_slow_error.result
Normal file
28
mysql-test/main/log_slow_error.result
Normal file
@@ -0,0 +1,28 @@
|
||||
SET @save_slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@GLOBAL.slow_query_log= 1;
|
||||
SET @save_log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_verbosity= 'warnings';
|
||||
SET @save_log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
SET @@GLOBAL.log_slow_query_time= 0;
|
||||
SET @save_init_slave= @@GLOBAL.init_slave;
|
||||
SET GLOBAL init_slave= 'GARBAGE';
|
||||
CHANGE MASTER TO master_host= 'not important';
|
||||
START SLAVE SQL_THREAD;
|
||||
include/wait_for_slave_sql_error.inc [errno=1064]
|
||||
SET @@SESSION.slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@SESSION.log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@SESSION.log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
SELECT CAST('' AS INT);
|
||||
CAST('' AS INT)
|
||||
0
|
||||
GARBAGE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GARBAGE' at line 1
|
||||
NOT FOUND /Error 1064/ in mysqld-slow.log
|
||||
SET @@SESSION.log_slow_query_time= @save_log_slow_query_time;
|
||||
SET @@SESSION.slow_query_log= @save_slow_query_log;
|
||||
SET @@SESSION.log_slow_verbosity= @save_log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_query_time= @@SESSION.log_slow_query_time;
|
||||
SET @@GLOBAL.slow_query_log= @@SESSION.slow_query_log;
|
||||
SET @@GLOBAL.log_slow_verbosity= @@SESSION.log_slow_verbosity;
|
||||
RESET SLAVE ALL;
|
||||
SET GLOBAL init_slave= @save_init_slave;
|
||||
53
mysql-test/main/log_slow_error.test
Normal file
53
mysql-test/main/log_slow_error.test
Normal file
@@ -0,0 +1,53 @@
|
||||
# MDEV-32203 -> MDEV-39838: Test that the Slow Query Log with
|
||||
# `@@.log_slow_verbosity='warnings'` correctly ignores errors
|
||||
|
||||
--source include/not_embedded.inc # Testing replication thread
|
||||
|
||||
|
||||
# Setup
|
||||
SET @save_slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@GLOBAL.slow_query_log= 1;
|
||||
SET @save_log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_verbosity= 'warnings';
|
||||
SET @save_log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
SET @@GLOBAL.log_slow_query_time= 0;
|
||||
|
||||
SET @save_init_slave= @@GLOBAL.init_slave;
|
||||
SET GLOBAL init_slave= 'GARBAGE';
|
||||
CHANGE MASTER TO master_host= 'not important';
|
||||
|
||||
--let SEARCH_FILE= `SELECT @@slow_query_log_file`
|
||||
--let SEARCH_PATTERN= Error 1064
|
||||
|
||||
|
||||
# MDEV-39838: use-of-uninitialized-value in Replication
|
||||
# SQL Thread when the first `@@init_slave` statement fails.
|
||||
START SLAVE SQL_THREAD;
|
||||
--let $slave_sql_errno= 1064
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
|
||||
# TODO MDEV-41474: Errors are not warnings and so should not be logged
|
||||
SET @@SESSION.slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@SESSION.log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@SESSION.log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
|
||||
--disable_warnings
|
||||
# MDEV-39838: leftover warning makes the next statement log errors
|
||||
SELECT CAST('' AS INT);
|
||||
--error ER_PARSE_ERROR
|
||||
GARBAGE;
|
||||
--enable_warnings
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
|
||||
# Cleanup
|
||||
SET @@SESSION.log_slow_query_time= @save_log_slow_query_time;
|
||||
SET @@SESSION.slow_query_log= @save_slow_query_log;
|
||||
SET @@SESSION.log_slow_verbosity= @save_log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_query_time= @@SESSION.log_slow_query_time;
|
||||
SET @@GLOBAL.slow_query_log= @@SESSION.slow_query_log;
|
||||
SET @@GLOBAL.log_slow_verbosity= @@SESSION.log_slow_verbosity;
|
||||
|
||||
RESET SLAVE ALL;
|
||||
SET GLOBAL init_slave= @save_init_slave;
|
||||
23
mysql-test/suite/rpl/r/log_slow_error.result
Normal file
23
mysql-test/suite/rpl/r/log_slow_error.result
Normal file
@@ -0,0 +1,23 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection slave;
|
||||
SET @save_slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@GLOBAL.slow_query_log= 1;
|
||||
SET @save_log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_verbosity= 'warnings';
|
||||
SET @save_log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
SET @@GLOBAL.log_slow_query_time= 0;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
SET STATEMENT sql_log_bin=0 FOR CREATE TABLE t (a INT);
|
||||
INSERT INTO t VALUES (0);
|
||||
DROP TABLE t;
|
||||
connection slave;
|
||||
include/wait_for_slave_sql_error.inc [errno=1146]
|
||||
SET @@GLOBAL.log_slow_query_time= @save_log_slow_query_time;
|
||||
SET @@GLOBAL.slow_query_log= @save_slow_query_log;
|
||||
SET @@GLOBAL.log_slow_verbosity= @save_log_slow_verbosity;
|
||||
SET GLOBAL init_slave= @save_init_slave;
|
||||
SET @@GLOBAL.sql_slave_skip_counter= 1;
|
||||
START SLAVE SQL_THREAD;
|
||||
include/rpl_end.inc
|
||||
37
mysql-test/suite/rpl/t/log_slow_error.test
Normal file
37
mysql-test/suite/rpl/t/log_slow_error.test
Normal file
@@ -0,0 +1,37 @@
|
||||
# MDEV-39838 test, but with actual Replication
|
||||
--let $rpl_skip_start_slave= 1
|
||||
--source include/master-slave.inc
|
||||
--connection slave
|
||||
|
||||
SET @save_slow_query_log= @@GLOBAL.slow_query_log;
|
||||
SET @@GLOBAL.slow_query_log= 1;
|
||||
SET @save_log_slow_verbosity= @@GLOBAL.log_slow_verbosity;
|
||||
SET @@GLOBAL.log_slow_verbosity= 'warnings';
|
||||
SET @save_log_slow_query_time= @@GLOBAL.log_slow_query_time;
|
||||
SET @@GLOBAL.log_slow_query_time= 0;
|
||||
|
||||
--source include/start_slave.inc
|
||||
|
||||
|
||||
--connection master
|
||||
SET STATEMENT sql_log_bin=0 FOR CREATE TABLE t (a INT);
|
||||
INSERT INTO t VALUES (0);
|
||||
DROP TABLE t;
|
||||
--connection slave
|
||||
|
||||
# ER_NO_SUCH_TABLE
|
||||
--let $slave_sql_errno= 1146
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
|
||||
# Cleanup
|
||||
SET @@GLOBAL.log_slow_query_time= @save_log_slow_query_time;
|
||||
SET @@GLOBAL.slow_query_log= @save_slow_query_log;
|
||||
SET @@GLOBAL.log_slow_verbosity= @save_log_slow_verbosity;
|
||||
SET GLOBAL init_slave= @save_init_slave;
|
||||
|
||||
SET @@GLOBAL.sql_slave_skip_counter= 1;
|
||||
START SLAVE SQL_THREAD;
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
Reference in New Issue
Block a user