Commit 3f15c920 authored by Magnus Svensson's avatar Magnus Svensson

WL#4189 mtr.pl v2

 - Rewrite "check testcase" to use LOAD DATA INFILE instead of 'load_file'
   in order to speed up the reading of the servers error log.
parent 9453c4f0
...@@ -4,6 +4,44 @@ ...@@ -4,6 +4,44 @@
# for unexpected warnings found in the servers error log # for unexpected warnings found in the servers error log
# #
--disable_query_log --disable_query_log
# Turn off any debug crashes, allow the variable to be
# non existent in release builds
--error 0,1193
set debug="";
use mtr;
create temporary table error_log (
row int auto_increment primary key,
line varchar(1024) null
) engine=myisam;
# Get the name of servers error log
let $log_error= query_get_value(show variables like 'log_error', Value, 1);
# Try to load the error log into the temporary table
--error 0,1085
eval load data infile '$log_error' into table error_log (line);
if ($mysql_errno)
{
# The error log was not world readable, this is normally
# caused by a "flush logs" in the test program. mysqld
# will then rename the error log to .err-old and open
# a new error log file that is not world readable.
# chmod the error log file and try to open it again
chmod 0644 $log_error;
eval load data infile '$log_error' into table error_log (line);
# Also load the .err-old file where there might be
# additional warnings
let $old_log_error = $log_error-old;
chmod 0644 $old_log_error;
eval load data infile '$old_log_error' into table error_log (line);
}
# Call check_warnings to filter out any warning in
# the error_log table
call mtr.check_warnings(@result); call mtr.check_warnings(@result);
if (`select @result = 0`){ if (`select @result = 0`){
skip OK; skip OK;
......
...@@ -219,40 +219,10 @@ INSERT INTO global_suppressions VALUES ...@@ -219,40 +219,10 @@ INSERT INTO global_suppressions VALUES
-- --
CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT) CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
BEGIN BEGIN
DECLARE `text` mediumtext charset utf8;
DECLARE `pos` bigint unsigned; DECLARE `pos` bigint unsigned;
-- Don't write these queries to binlog -- Don't write these queries to binlog
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
--
-- Load the server .err file into "error_log" table
--
CREATE TEMPORARY TABLE error_log (
row INT AUTO_INCREMENT PRIMARY KEY,
line mediumtext NULL
) ENGINE=MyISAM;
SELECT variable_value INTO @log_error
FROM information_schema.global_variables
WHERE variable_name='LOG_ERROR';
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet= 1024*1024*1024;
SET text= load_file(@log_error);
SET @@global.max_allowed_packet= @old_max_allowed_packet;
-- select text;
SET pos= LOCATE('\n', text);
WHILE pos DO
INSERT error_log (line)
VALUES (
SUBSTR(text, 1, pos-1)
);
SET text= SUBSTR(text FROM pos+1);
SET pos= LOCATE('\n', text);
END WHILE;
-- select * from error_log;
-- --
-- Remove all lines belonging to previous tests -- Remove all lines belonging to previous tests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment