Commit 6a031406 authored by Monty's avatar Monty

Make install.db read only in mtr

This ensures that no mtr test can change install.db after it's initial
creation as changing it while as another thread is coping it will lead to
failures in at least InnoDB and Aria recovery.

Fixed spider/bugfix.mdev_30370 that was wrongly used install.db
parent 16258677
......@@ -34,7 +34,7 @@ use strict;
use Exporter;
use base "Exporter";
our @EXPORT= qw /rmtree mkpath copytree/;
our @EXPORT= qw /rmtree mkpath copytree make_readonly/;
use File::Find;
use File::Copy;
......@@ -184,6 +184,10 @@ sub copytree {
# Only copy plain files
next unless -f "$from_dir/$_";
copy("$from_dir/$_", "$to_dir/$_");
if (!$use_umask)
{
chmod(0666, "$to_dir/$_");
}
}
closedir(DIR);
......@@ -193,4 +197,29 @@ sub copytree {
}
}
sub make_readonly {
my ($dir) = @_;
die "Usage: make_readonly(<dir>])"
unless @_ == 1;
opendir(DIR, "$dir")
or croak("Can't find $dir$!");
for(readdir(DIR)) {
next if "$_" eq "." or "$_" eq "..";
if ( -d "$dir/$_" )
{
make_readonly("$dir/$_");
next;
}
# Only copy plain files
next unless -f "$dir/$_";
chmod 0444, "$dir/$_";
}
closedir(DIR);
}
1;
......@@ -40,7 +40,7 @@ our @EXPORT= qw(create_process);
# Retry a couple of times if fork returns EAGAIN
#
sub _safe_fork {
my $retries= 5;
my $retries= 100;
my $pid;
FORK:
......
......@@ -401,8 +401,11 @@ sub main {
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
mark_time_used('collect');
mysql_install_db(default_mysqld(), "$opt_vardir/install.db") unless using_extern();
if (!using_extern())
{
mysql_install_db(default_mysqld(), "$opt_vardir/install.db");
make_readonly("$opt_vardir/install.db");
}
if ($opt_dry_run)
{
for (@$tests) {
......
......@@ -2,4 +2,7 @@
--echo # MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so
--echo #
--exec $MYSQLD_BOOTSTRAP_CMD --wsrep-recover --plugin-load-add=ha_spider.so
let $MYSQLD_DATADIR=$MYSQLTEST_VARDIR/mdev_30370;
--mkdir $MYSQLD_DATADIR
--exec $MYSQLD_BOOTSTRAP_CMD --wsrep-recover --plugin-load-add=ha_spider.so --datadir=$MYSQLD_DATADIR
--rmdir $MYSQLD_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