# # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. # # This test is executed once after each test to check the servers # for unexpected warnings found in the servers error log # # NOTE! mysql-test-run.pl has already done a rough filtering # of the file and written any suspicious lines # to $error_log.warnings file # --disable_query_log # Don't write these queries to binlog SET SQL_LOG_BIN = 0; # Turn off any debug crashes, allow the variable to be # non existent in release builds --error 0,1193 SET DEBUG = ""; USE mtr; # Allow this session to read-write even if server is started with # --transaction-read-only. And set autocommit mode for the session # irrespective of server --autocommit setting. SET SESSION TRANSACTION READ WRITE; # Due to the lack of WL#7828 / WL#8003 now, we might have a pending # Data Dictionary read-only transaction at this point. Even though # DD-RO-transactions are usually committed in the end, there are cases # when it does not happen. It will be changed when WL#7828 / WL#8003 # are merged in. # # Until that happens, we do 'SET SESSION AUTOCOMMIT = 1' here in order # to commit that DD-RO-transaction that might be pending. Otherwise, # the following statements will fail. By turning autocommit ON we # achieve two effects: # 1. Ensure there is no loose DD-RO-transaction (i.e. the effect of # COMMIT statement); # 2. Make sure all future DD-RO-transactions that might happen below # will be properly committed. # # We set session variable to not affect other tests. SET SESSION AUTOCOMMIT = 1; CREATE TEMPORARY TABLE error_log ( `row` INT AUTO_INCREMENT PRIMARY KEY, suspicious INT DEFAULT 1, file_name VARCHAR(255), line VARCHAR(2500) CHARSET latin1 DEFAULT NULL ); COMMIT; # Get the name of servers error log --let $log_error = $MTR_LOG_ERROR --let $log_warning = $log_error.warnings # Try to load the warnings into a temporary table, it might fail with # error saying "The MySQL server is running with the # --secure-file-priv" in which case an attempt to load the file using # LOAD DATA LOCAL is made. --error 0,1290 eval LOAD DATA INFILE '$log_warning' INTO TABLE error_log CHARACTER SET latin1 FIELDS TERMINATED BY 'xykls37' ESCAPED BY '' ignore 1 lines (line) SET file_name = '$log_error'; if ($mysql_errno) { # Try LOAD DATA LOCAL eval LOAD DATA LOCAL INFILE '$log_warning' INTO TABLE error_log CHARACTER SET latin1 FIELDS TERMINATED BY 'xykls37' ESCAPED BY '' ignore 1 lines (line) SET file_name = '$log_error'; } # Call check_warnings to filter out any warning in the error_log table. CALL mtr.check_warnings(@result); --enable_query_log if (`SELECT @result = 0`) { --skip OK } --echo ^ Found warnings in $log_error --exit