1# ==== Purpose ==== 2# 3# Test verifies that when RESET MASTER TO # command is supplied with binlog 4# extension number greater than 2147483647 the command should report 5# appropriate error and binary log should be disabled. It should not result in 6# a crash. 7# 8# ==== Implementation ==== 9# 10# Steps: 11# 0 - Verify case with max binary log extension. Max value is '2147483647' 12# 1 - Confirm that SHOW BINARY LOGS displays a binary log with '2147483647' 13# 2 - Verify that events are successfully written into max extension file. 14# 3 - Try to create a binary log with extension greater than max allowed 15# value '2147483648', verify ER_NO_UNIQUE_LOGFILE error is reported. 16# 4 - Execute CREATE DATABASE db2 statement and verify server dosn't crash. 17# 5 - Execute SHOW BINARY LOG command and verify that it reports 18# ER_NO_BINARY_LOGGING error. 19# 6 - Restart the server and verify that databse 'db2' exists and it it not 20# present in the binary log. 21# 22# ==== References ==== 23# 24# MDEV-22451: SIGSEGV in __memmove_avx_unaligned_erms/memcpy from 25# _my_b_write on CREATE after RESET MASTER 26# 27--source include/have_log_bin.inc 28 29call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0"); 30call mtr.add_suppression("Log filename extension number exhausted:."); 31call mtr.add_suppression("Can't generate a unique log-filename"); 32call mtr.add_suppression("MYSQL_BIN_LOG::open failed to generate new file name."); 33call mtr.add_suppression("Could not use master-bin for logging"); 34 35 36--echo "Test case verifies creation of binary log with max entension value." 37RESET MASTER TO 2147483647; 38--source include/show_binary_logs.inc 39 40# Check error log for correct messages. 41let $log_error_= `SELECT @@GLOBAL.log_error`; 42if(!$log_error_) 43{ 44 # MySQL Server on windows is started with --console and thus 45 # does not know the location of its .err log, use default location 46 let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; 47} 48 49--let SEARCH_FILE=$log_error_ 50--let SEARCH_PATTERN=Next log extension: 2147483647. Remaining log filename extensions: 0. 51--source include/search_pattern_in_file.inc 52 53CREATE DATABASE db1; 54--source include/show_binlog_events.inc 55 56--error ER_NO_UNIQUE_LOGFILE 57RESET MASTER TO 2147483648; 58 59--let SEARCH_FILE=$log_error_ 60--let SEARCH_PATTERN=Turning logging off for the whole duration of the MariaDB server process 61--source include/search_pattern_in_file.inc 62 63--echo "Following CREATE DATABSE db2 command will not be present in binary log" 64--echo "as binary log got closed due to ER_NO_UNIQUE_LOGFILE error." 65CREATE DATABASE db2; 66 67 68--echo "RESET MASTER command fails to generate a new binary log" 69--echo "log-bin will be disabled and server needs to be restarted to" 70--echo "re-enable the binary log." 71--error ER_NO_BINARY_LOGGING 72SHOW BINARY LOGS; 73 74--source include/restart_mysqld.inc 75 76--source include/show_binary_logs.inc 77SHOW DATABASES LIKE 'db%'; 78--source include/show_binlog_events.inc 79 80# Cleanup 81DROP DATABASE db1; 82DROP DATABASE db2; 83--source include/show_binlog_events.inc 84