mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@ -138,6 +138,10 @@ my $opt_start_dirty;
|
||||
my $opt_start_exit;
|
||||
my $start_only;
|
||||
my $file_wsrep_provider;
|
||||
my $extra_path;
|
||||
my $mariabackup_path;
|
||||
my $mariabackup_exe;
|
||||
my $garbd_exe;
|
||||
|
||||
our @global_suppressions;
|
||||
|
||||
@ -373,8 +377,162 @@ $| = 1; # Automatically flush STDOUT
|
||||
|
||||
main();
|
||||
|
||||
sub have_wsrep() {
|
||||
my $wsrep_on= $mysqld_variables{'wsrep-on'};
|
||||
return defined $wsrep_on
|
||||
}
|
||||
|
||||
sub have_wsrep_provider() {
|
||||
return $file_wsrep_provider ne "";
|
||||
}
|
||||
|
||||
sub have_mariabackup() {
|
||||
return $mariabackup_path ne "";
|
||||
}
|
||||
|
||||
sub have_garbd() {
|
||||
return $garbd_exe ne "";
|
||||
}
|
||||
|
||||
sub check_wsrep_version() {
|
||||
if ($My::SafeProcess::wsrep_check_version ne "") {
|
||||
system($My::SafeProcess::wsrep_check_version);
|
||||
return ($? >> 8) == 0;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sub wsrep_version_message() {
|
||||
if ($My::SafeProcess::wsrep_check_version ne "") {
|
||||
my $output= `$My::SafeProcess::wsrep_check_version -p`;
|
||||
if (($? >> 8) == 0) {
|
||||
$output =~ s/\s+\z//;
|
||||
return "Wsrep provider version mismatch (".$output.")";
|
||||
}
|
||||
else {
|
||||
return "Galera library does not contain a version symbol";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "Unable to find a wsrep version check utility";
|
||||
}
|
||||
}
|
||||
|
||||
sub which($) { return `sh -c "command -v $_[0]"` }
|
||||
|
||||
sub check_garbd_support() {
|
||||
if (defined $ENV{'MTR_GARBD_EXE'}) {
|
||||
if (mtr_file_exists($ENV{'MTR_GARBD_EXE'}) ne "") {
|
||||
$garbd_exe= $ENV{'MTR_GARBD_EXE'};
|
||||
} else {
|
||||
mtr_error("MTR_GARBD_EXE env set to an invalid path");
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $wsrep_path= dirname($file_wsrep_provider);
|
||||
$garbd_exe=
|
||||
mtr_file_exists($wsrep_path."/garb/garbd",
|
||||
$wsrep_path."/../../bin/garb/garbd");
|
||||
if ($garbd_exe ne "") {
|
||||
$ENV{MTR_GARBD_EXE}= $garbd_exe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_wsrep_support() {
|
||||
$garbd_exe= "";
|
||||
if (have_wsrep()) {
|
||||
mtr_report(" - binaries built with wsrep patch");
|
||||
|
||||
# ADD scripts to $PATH to that wsrep_sst_* can be found
|
||||
my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$bindir/scripts", $path_client_bindir;
|
||||
mtr_error("No SST scripts") unless $spath;
|
||||
$ENV{PATH}="$spath:$ENV{PATH}";
|
||||
|
||||
# ADD mysql client library path to path so that wsrep_notify_cmd can find mysql
|
||||
# client for loading the tables. (Don't assume each machine has mysql install)
|
||||
my ($cpath) = grep { -f "$_/mysql"; } "$bindir/scripts", $path_client_bindir;
|
||||
mtr_error("No scritps") unless $cpath;
|
||||
$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
|
||||
|
||||
# ADD my_print_defaults script path to path so that SST scripts can find it
|
||||
my ($epath) = grep { -f "$_/my_print_defaults"; } "$bindir/extra", $path_client_bindir;
|
||||
mtr_error("No my_print_defaults") unless $epath;
|
||||
$ENV{PATH}="$epath:$ENV{PATH}" unless ($epath eq $spath) or
|
||||
($epath eq $cpath);
|
||||
|
||||
$extra_path= $epath;
|
||||
|
||||
if (which("socat")) {
|
||||
$ENV{MTR_GALERA_TFMT}="socat";
|
||||
} elsif (which("nc")) {
|
||||
$ENV{MTR_GALERA_TFMT}="nc";
|
||||
}
|
||||
|
||||
# Check whether WSREP_PROVIDER environment variable is set.
|
||||
if (defined $ENV{'WSREP_PROVIDER'}) {
|
||||
$file_wsrep_provider= "";
|
||||
if ($ENV{'WSREP_PROVIDER'} ne "none") {
|
||||
if (mtr_file_exists($ENV{'WSREP_PROVIDER'}) ne "") {
|
||||
$file_wsrep_provider= $ENV{'WSREP_PROVIDER'};
|
||||
} else {
|
||||
mtr_error("WSREP_PROVIDER env set to an invalid path");
|
||||
}
|
||||
check_garbd_support();
|
||||
}
|
||||
# WSREP_PROVIDER is valid; set to a valid path or "none").
|
||||
mtr_verbose("WSREP_PROVIDER env set to $ENV{'WSREP_PROVIDER'}");
|
||||
} else {
|
||||
# WSREP_PROVIDER env not defined. Lets try to locate the wsrep provider
|
||||
# library.
|
||||
$file_wsrep_provider=
|
||||
mtr_file_exists("/usr/lib64/galera-4/libgalera_smm.so",
|
||||
"/usr/lib64/galera/libgalera_smm.so",
|
||||
"/usr/lib/galera-4/libgalera_smm.so",
|
||||
"/usr/lib/galera/libgalera_smm.so");
|
||||
if ($file_wsrep_provider ne "") {
|
||||
# wsrep provider library found !
|
||||
mtr_verbose("wsrep provider library found : $file_wsrep_provider");
|
||||
$ENV{'WSREP_PROVIDER'}= $file_wsrep_provider;
|
||||
check_garbd_support();
|
||||
} else {
|
||||
mtr_verbose("Could not find wsrep provider library, setting it to 'none'");
|
||||
$ENV{'WSREP_PROVIDER'}= "none";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$file_wsrep_provider= "";
|
||||
$extra_path= "";
|
||||
}
|
||||
}
|
||||
|
||||
sub check_mariabackup_support() {
|
||||
$mariabackup_path= "";
|
||||
$mariabackup_exe=
|
||||
mtr_exe_maybe_exists(
|
||||
"$bindir/extra/mariabackup$opt_vs_config/mariabackup",
|
||||
"$path_client_bindir/mariabackup");
|
||||
if ($mariabackup_exe ne "") {
|
||||
my ($bpath) = grep { -f "$_/mariabackup"; } "$bindir/extra/mariabackup$opt_vs_config", $path_client_bindir;
|
||||
$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $extra_path;
|
||||
|
||||
$mariabackup_path= $bpath;
|
||||
|
||||
$ENV{XTRABACKUP}= $mariabackup_exe;
|
||||
|
||||
$ENV{XBSTREAM}= mtr_exe_maybe_exists(
|
||||
"$bindir/extra/mariabackup/$opt_vs_config/mbstream",
|
||||
"$path_client_bindir/mbstream");
|
||||
|
||||
$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
|
||||
}
|
||||
}
|
||||
|
||||
sub main {
|
||||
$ENV{MTR_PERL}=$^X;
|
||||
|
||||
# Default, verbosity on
|
||||
report_option('verbose', 0);
|
||||
|
||||
@ -416,6 +574,8 @@ sub main {
|
||||
}
|
||||
check_ssl_support();
|
||||
check_debug_support();
|
||||
check_wsrep_support();
|
||||
check_mariabackup_support();
|
||||
|
||||
if (!$opt_suites) {
|
||||
$opt_suites= join ',', collect_default_suites(@DEFAULT_SUITES);
|
||||
@ -849,6 +1009,8 @@ sub run_test_server ($$$) {
|
||||
next if (defined $t->{reserved} and $t->{reserved} != $wid);
|
||||
if (! defined $t->{reserved})
|
||||
{
|
||||
# Force-restart not relevant when comparing *next* test
|
||||
$t->{criteria} =~ s/force-restart$/no-restart/;
|
||||
my $criteria= $t->{criteria};
|
||||
# Reserve similar tests for this worker, but not too many
|
||||
my $maxres= (@$tests - $i) / $opt_parallel + 1;
|
||||
@ -1887,7 +2049,10 @@ sub collect_mysqld_features {
|
||||
if (/Copyright/ .. /^-{30,}/) {
|
||||
# here we want to detect all not mandatory plugins
|
||||
# they are listed in the --help output as
|
||||
# --archive[=name] Enable or disable ARCHIVE plugin. Possible values are ON, OFF, FORCE (don't start if the plugin fails to load).
|
||||
# --archive[=name]
|
||||
# Enable or disable ARCHIVE plugin. Possible values are ON, OFF,
|
||||
# FORCE (don't start if the plugin fails to load),
|
||||
# FORCE_PLUS_PERMANENT (like FORCE, but the plugin can not be uninstalled).
|
||||
push @optional_plugins, $1
|
||||
if /^ --([-a-z0-9]+)\[=name\] +Enable or disable \w+ plugin. One of: ON, OFF, FORCE/;
|
||||
next;
|
||||
@ -2581,82 +2746,72 @@ sub setup_vardir() {
|
||||
copytree("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data", "0022");
|
||||
|
||||
# create a plugin dir and copy or symlink plugins into it
|
||||
if ($source_dist)
|
||||
unless($plugindir)
|
||||
{
|
||||
$plugindir="$opt_vardir/plugins";
|
||||
mkpath($plugindir);
|
||||
if (IS_WINDOWS)
|
||||
if ($source_dist)
|
||||
{
|
||||
if (!$opt_embedded_server)
|
||||
$plugindir="$opt_vardir/plugins";
|
||||
mkpath($plugindir);
|
||||
if (IS_WINDOWS)
|
||||
{
|
||||
for (<$bindir/storage/*$opt_vs_config/*.dll>,
|
||||
<$bindir/plugin/*$opt_vs_config/*.dll>,
|
||||
<$bindir/libmariadb$opt_vs_config/*.dll>,
|
||||
<$bindir/sql$opt_vs_config/*.dll>)
|
||||
if (!$opt_embedded_server)
|
||||
{
|
||||
for (<$bindir/storage/*$opt_vs_config/*.dll>,
|
||||
<$bindir/plugin/*$opt_vs_config/*.dll>,
|
||||
<$bindir/libmariadb$opt_vs_config/*.dll>,
|
||||
<$bindir/sql$opt_vs_config/*.dll>)
|
||||
{
|
||||
my $pname=basename($_);
|
||||
copy rel2abs($_), "$plugindir/$pname";
|
||||
set_plugin_var($pname);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my $opt_use_copy= 1;
|
||||
if (symlink "$opt_vardir/run", "$plugindir/symlink_test")
|
||||
{
|
||||
$opt_use_copy= 0;
|
||||
unlink "$plugindir/symlink_test";
|
||||
}
|
||||
|
||||
for (<$bindir/storage/*/*.so>,
|
||||
<$bindir/plugin/*/*.so>,
|
||||
<$bindir/plugin/*/auth_pam_tool_dir>,
|
||||
<$bindir/libmariadb/plugins/*/*.so>,
|
||||
<$bindir/libmariadb/*.so>,
|
||||
<$bindir/sql/*.so>)
|
||||
{
|
||||
my $pname=basename($_);
|
||||
copy rel2abs($_), "$plugindir/$pname";
|
||||
if ($opt_use_copy)
|
||||
{
|
||||
copy rel2abs($_), "$plugindir/$pname";
|
||||
}
|
||||
else
|
||||
{
|
||||
symlink rel2abs($_), "$plugindir/$pname";
|
||||
}
|
||||
set_plugin_var($pname);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my $opt_use_copy= 1;
|
||||
if (symlink "$opt_vardir/run", "$plugindir/symlink_test")
|
||||
{
|
||||
$opt_use_copy= 0;
|
||||
unlink "$plugindir/symlink_test";
|
||||
}
|
||||
|
||||
for (<$bindir/plugin/auth_pam/auth_pam_tool>)
|
||||
{
|
||||
mkpath("$plugindir/auth_pam_tool_dir");
|
||||
if ($opt_use_copy)
|
||||
{
|
||||
copy rel2abs($_), "$plugindir/auth_pam_tool_dir/auth_pam_tool"
|
||||
}
|
||||
else
|
||||
{
|
||||
symlink rel2abs($_), "$plugindir/auth_pam_tool_dir/auth_pam_tool";
|
||||
}
|
||||
}
|
||||
|
||||
for (<$bindir/storage/*/*.so>,
|
||||
<$bindir/plugin/*/*.so>,
|
||||
<$bindir/plugin/*/auth_pam_tool_dir>,
|
||||
<$bindir/libmariadb/plugins/*/*.so>,
|
||||
<$bindir/libmariadb/*.so>,
|
||||
<$bindir/sql/*.so>)
|
||||
# hm, what paths work for debs and for rpms ?
|
||||
for (<$bindir/lib64/mysql/plugin/*.so>,
|
||||
<$bindir/lib/mysql/plugin/*.so>,
|
||||
<$bindir/lib64/mariadb/plugin/*.so>,
|
||||
<$bindir/lib/mariadb/plugin/*.so>,
|
||||
<$bindir/lib/plugin/*.so>, # bintar
|
||||
<$bindir/lib/plugin/*.dll>)
|
||||
{
|
||||
my $pname=basename($_);
|
||||
if ($opt_use_copy)
|
||||
{
|
||||
copy rel2abs($_), "$plugindir/$pname";
|
||||
}
|
||||
else
|
||||
{
|
||||
symlink rel2abs($_), "$plugindir/$pname";
|
||||
}
|
||||
set_plugin_var($pname);
|
||||
$plugindir=dirname($_) unless $plugindir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugindir= $mysqld_variables{'plugin-dir'} || '.';
|
||||
# hm, what paths work for debs and for rpms ?
|
||||
for (<$bindir/lib64/mysql/plugin/*.so>,
|
||||
<$bindir/lib/mysql/plugin/*.so>,
|
||||
<$bindir/lib64/mariadb/plugin/*.so>,
|
||||
<$bindir/lib/mariadb/plugin/*.so>,
|
||||
<$bindir/lib/plugin/*.so>, # bintar
|
||||
<$bindir/lib/plugin/*.dll>)
|
||||
{
|
||||
my $pname=basename($_);
|
||||
set_plugin_var($pname);
|
||||
}
|
||||
}
|
||||
|
||||
# Remove old log files
|
||||
foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
|
||||
@ -3750,6 +3905,25 @@ sub find_analyze_request
|
||||
return $analyze;
|
||||
}
|
||||
|
||||
# The test can leave a file in var/tmp/ to signal
|
||||
# that all servers should be restarted
|
||||
sub restart_forced_by_test($)
|
||||
{
|
||||
my $file = shift;
|
||||
my $restart = 0;
|
||||
foreach my $mysqld ( mysqlds() )
|
||||
{
|
||||
my $datadir = $mysqld->value('datadir');
|
||||
my $force_restart_file = "$datadir/mtr/$file";
|
||||
if ( -f $force_restart_file )
|
||||
{
|
||||
mtr_verbose("Restart of servers forced by test");
|
||||
$restart = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $restart;
|
||||
}
|
||||
|
||||
# Return timezone value of tinfo or default value
|
||||
sub timezone {
|
||||
@ -4110,8 +4284,12 @@ sub run_testcase ($$) {
|
||||
if ( $res == 0 )
|
||||
{
|
||||
my $check_res;
|
||||
if ( $opt_check_testcases and
|
||||
$check_res= check_testcase($tinfo, "after"))
|
||||
if ( restart_forced_by_test('force_restart') )
|
||||
{
|
||||
stop_all_servers($opt_shutdown_timeout);
|
||||
}
|
||||
elsif ( $opt_check_testcases and
|
||||
$check_res= check_testcase($tinfo, "after"))
|
||||
{
|
||||
if ($check_res == 1) {
|
||||
# Test case had sideeffects, not fatal error, just continue
|
||||
@ -4146,7 +4324,8 @@ sub run_testcase ($$) {
|
||||
find_testcase_skipped_reason($tinfo);
|
||||
mtr_report_test_skipped($tinfo);
|
||||
# Restart if skipped due to missing perl, it may have had side effects
|
||||
if ( $tinfo->{'comment'} =~ /^perl not found/ )
|
||||
if ( restart_forced_by_test('force_restart_if_skipped') ||
|
||||
$tinfo->{'comment'} =~ /^perl not found/ )
|
||||
{
|
||||
stop_all_servers($opt_shutdown_timeout);
|
||||
}
|
||||
@ -5298,6 +5477,11 @@ sub server_need_restart {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( $tinfo->{'force_restart'} ) {
|
||||
mtr_verbose_restart($server, "forced in .opt file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( $opt_force_restart ) {
|
||||
mtr_verbose_restart($server, "forced restart turned on");
|
||||
return 1;
|
||||
@ -6392,6 +6576,7 @@ Misc options
|
||||
servers to exit before finishing the process
|
||||
fast Run as fast as possible, don't wait for servers
|
||||
to shutdown etc.
|
||||
force-restart Always restart servers between tests
|
||||
parallel=N Run tests in N parallel threads (default 1)
|
||||
Use parallel=auto for auto-setting of N
|
||||
repeat=N Run each test N number of times
|
||||
|
Reference in New Issue
Block a user