Merge pull request #769 from percona/PT-2295_Fix_tests_on_distributions

PT-2295 - fix tests on distributions
This commit is contained in:
Sveta Smirnova
2024-03-15 16:24:29 +03:00
committed by GitHub
29 changed files with 152 additions and 39 deletions

View File

@@ -4076,8 +4076,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};
@@ -4728,7 +4734,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}

View File

@@ -2433,7 +2433,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}

View File

@@ -2777,7 +2777,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}

View File

@@ -1931,7 +1931,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}

View File

@@ -553,8 +553,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -4353,8 +4353,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};
@@ -5543,7 +5549,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}
@@ -7177,6 +7185,8 @@ sub main {
# The 1st pattern means that MySQL itself died or was stopped.
# The 2nd pattern means that our cxn was killed (KILL <id>).
if ( $error =~ m/MySQL server has gone away/
|| $error =~ m/Server has gone away/
|| $error =~ m/Lost connection to server/
|| $error =~ m/Lost connection to MySQL server/ ) {
eval {
$dbh = $cxn->connect();
@@ -7210,6 +7220,8 @@ sub main {
# The 1st pattern means that MySQL itself died or was stopped.
# The 2nd pattern means that our cxn was killed (KILL <id>).
if ( $error =~ m/MySQL server has gone away/
|| $error =~ m/Server has gone away/
|| $error =~ m/Lost connection to server/
|| $error =~ m/Lost connection to MySQL server/ ) {
eval {
$dbh = $cxn->connect();
@@ -7299,6 +7311,8 @@ sub main {
# The 1st pattern means that MySQL itself died or was stopped.
# The 2nd pattern means that our cxn was killed (KILL <id>).
if ( $error =~ m/MySQL server has gone away/
|| $error =~ m/Server has gone away/
|| $error =~ m/Lost connection to server/
|| $error =~ m/Lost connection to MySQL server/ ) {
eval {
$log_dbh = $log_cxn->connect();

View File

@@ -2571,7 +2571,7 @@ report_mysql_summary () {
fi
fi
local has_rocksdb=$(cat $dir/mysql-plugins | grep -i 'rocksdb.*active.*storage engine')
local has_rocksdb="$(cat $dir/mysql-plugins | grep -i 'rocksdb.*active.*storage engine')"
if [ ! -z "$has_rocksdb" ]; then
section "RocksDB"
section_rocksdb "$dir/mysql-variables" "$dir/mysql-status"

View File

@@ -4039,7 +4039,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}
@@ -4639,8 +4641,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};
@@ -9364,6 +9372,7 @@ sub main {
# and the mentioned test error doesn't arise
my $original_error = $EVAL_ERROR;
my $original_error_code = $?;
foreach my $task ( reverse @cleanup_tasks ) {
eval {
@@ -9373,7 +9382,14 @@ sub main {
warn "Error cleaning up: $EVAL_ERROR\n";
}
}
die $original_error if $original_error; # rethrow original error
# rethrow original error
# we do not call _die here, because it prints messages to STDOUT
if ($original_error) {
print STDERR $original_error;
exit $original_error_code;
}
return;
}
);

View File

@@ -10947,8 +10947,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -2689,8 +2689,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -3100,8 +3100,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -3738,7 +3738,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}
@@ -5602,8 +5604,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -7118,8 +7118,14 @@ sub get_master_status {
return;
}
my $sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
my $sth;
if ( $self->{sths}->{$dbh} && $dbh && $self->{sths}->{$dbh} == $dbh ) {
$sth = $self->{sths}->{$dbh}->{MASTER_STATUS}
||= $dbh->prepare('SHOW MASTER STATUS');
}
else {
$sth = $dbh->prepare('SHOW MASTER STATUS');
}
PTDEBUG && _d($dbh, 'SHOW MASTER STATUS');
$sth->execute();
my ($ms) = @{$sth->fetchall_arrayref({})};

View File

@@ -2604,7 +2604,9 @@ sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Server has gone away/
|| $e =~ m/Lost connection to MySQL server/
|| $e =~ m/Lost connection to server/
|| $e =~ m/Server shutdown in progress/;
}