Commit e167d79e authored by unknown's avatar unknown

Implement mysql-test-run.pl option to limit the number of saved core

files. This helps stability of multiple parallel automated test runs,
avoiding the situation where one bad build fills up disk with 1000s of
core files, causing failures in other test runs.

parent 4fda992b
...@@ -300,6 +300,8 @@ our %mysqld_variables; ...@@ -300,6 +300,8 @@ our %mysqld_variables;
my $source_dist= 0; my $source_dist= 0;
our $opt_max_save_core= 5;
my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
###################################################################### ######################################################################
# #
...@@ -588,6 +590,7 @@ sub command_line_setup () { ...@@ -588,6 +590,7 @@ sub command_line_setup () {
'strace-client' => \$opt_strace_client, 'strace-client' => \$opt_strace_client,
'master-binary=s' => \$exe_master_mysqld, 'master-binary=s' => \$exe_master_mysqld,
'slave-binary=s' => \$exe_slave_mysqld, 'slave-binary=s' => \$exe_slave_mysqld,
'max-save-core=i' => \$opt_max_save_core,
# Coverage, profiling etc # Coverage, profiling etc
'gcov' => \$opt_gcov, 'gcov' => \$opt_gcov,
...@@ -3295,10 +3298,12 @@ sub save_files_before_restore($$) { ...@@ -3295,10 +3298,12 @@ sub save_files_before_restore($$) {
# Look for core files # Look for core files
foreach my $core_file ( glob("$data_dir/core*") ) foreach my $core_file ( glob("$data_dir/core*") )
{ {
last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
my $core_name= basename($core_file); my $core_name= basename($core_file);
mtr_report("Saving $core_name"); mtr_report("Saving $core_name");
mkdir($save_name) if ! -d $save_name; mkdir($save_name) if ! -d $save_name;
rename("$core_file", "$save_name/$core_name"); rename("$core_file", "$save_name/$core_name");
++$num_saved_cores;
} }
} }
...@@ -4891,6 +4896,9 @@ Options for debugging the product ...@@ -4891,6 +4896,9 @@ Options for debugging the product
master-binary=PATH Specify the master "mysqld" to use master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use slave-binary=PATH Specify the slave "mysqld" to use
strace-client Create strace output for mysqltest client strace-client Create strace output for mysqltest client
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
$opt_max_save_core, set to 0 for no limit.
Options for coverage, profiling etc Options for coverage, profiling etc
......
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