Commit aa2e1ade authored by Sergey Vojtovich's avatar Sergey Vojtovich

(almost) sane core handling in mtr

Analyze core independently of max-save-datadir and max-save-core setting.

Increment $num_saved_cores only if core was actually saved.

"Move any core files from e.g. mysqltest" independently of
max-save-datadir setting. Note: it may overwrite core from mysqld, which
might not be desired (it did work this way even before).
parent 2b749a7b
......@@ -637,50 +637,59 @@ sub run_test_server ($$$) {
my $worker_savename= basename($worker_savedir);
my $savedir= "$opt_vardir/log/$worker_savename";
if ($opt_max_save_datadir > 0 &&
$num_saved_datadir >= $opt_max_save_datadir)
{
mtr_report(" - skipping '$worker_savedir/'");
rmtree($worker_savedir);
}
else {
mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
rename($worker_savedir, $savedir);
# Move any core files from e.g. mysqltest
foreach my $coref (glob("core*"), glob("*.dmp"))
{
mtr_report(" - found '$coref', moving it to '$savedir'");
move($coref, $savedir);
mtr_report(" - found '$coref', moving it to '$worker_savedir'");
move($coref, $worker_savedir);
}
if ($opt_max_save_core > 0) {
# Limit number of core files saved
find({ no_chdir => 1,
wanted => sub {
find(
{
no_chdir => 1,
wanted => sub
{
my $core_file= $File::Find::name;
my $core_name= basename($core_file);
# Name beginning with core, not ending in .gz
if (($core_name =~ /^core/ and $core_name !~ /\.gz$/)
or (IS_WINDOWS and $core_name =~ /\.dmp$/)){
or (IS_WINDOWS and $core_name =~ /\.dmp$/))
{
# Ending with .dmp
mtr_report(" - found '$core_name'",
"($num_saved_cores/$opt_max_save_core)");
My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel);
if ($num_saved_cores >= $opt_max_save_core) {
# Limit number of core files saved
if ($opt_max_save_core > 0 &&
$num_saved_cores >= $opt_max_save_core)
{
mtr_report(" - deleting it, already saved",
"$opt_max_save_core");
unlink("$core_file");
} else {
mtr_compress_file($core_file) unless @opt_cases;
}
else
{
mtr_compress_file($core_file) unless @opt_cases;
++$num_saved_cores;
}
}
}
},
$savedir);
$worker_savedir);
if ($opt_max_save_datadir > 0 &&
$num_saved_datadir >= $opt_max_save_datadir)
{
mtr_report(" - skipping '$worker_savedir/'");
rmtree($worker_savedir);
}
else
{
mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
rename($worker_savedir, $savedir);
}
resfile_print_test();
$num_saved_datadir++;
......
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