Merge pull request #947 from percona/PT-2129_pt-online-schem-change_fails_on_non-readable_version_check_file

PT-2129 - pt-online-schem-change and other tools fail on non-readable…
This commit is contained in:
Sveta Smirnova
2025-06-13 02:09:35 +03:00
committed by GitHub
20 changed files with 37 additions and 26 deletions

View File

@@ -5761,7 +5761,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4934,7 +4934,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -3984,7 +3984,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4431,7 +4431,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4548,7 +4548,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -3310,7 +3310,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -3491,7 +3491,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -5352,7 +5352,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -5947,7 +5947,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -6575,7 +6575,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -7858,7 +7858,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -12792,7 +12792,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4656,7 +4656,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -3790,7 +3790,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -899,7 +899,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -9604,7 +9604,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4297,7 +4297,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -4729,7 +4729,7 @@ sub version_check {
PTDEBUG && _d('Version check failed:', $EVAL_ERROR);
}
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
update_check_times(
instances => $instances_to_check,

View File

@@ -181,7 +181,7 @@ sub version_check {
}
# Always update the vc file, even if the version check fails.
if ( @$instances_to_check ) {
if ( $instances_to_check and @$instances_to_check ) {
eval {
# Update the check time for things we checked. I.e. if we
# didn't check it, do _not_ update its time.

View File

@@ -17,12 +17,6 @@ use PerconaTest;
use Sandbox;
require "$trunk/bin/pt-query-digest";
ok (1,
"version checking site offline for now"
);
done_testing;
exit 0;
my $output;
my $cmd = "$trunk/bin/pt-query-digest --limit 1 $trunk/t/lib/samples/slowlogs/slow001.txt";
@@ -49,7 +43,7 @@ ok(
like(
$output,
qr/# Query 1: 0 QPS, 0x concurrency, ID 0x7F7D57ACDD8A346E at byte 0/,
qr/# Query 1: 0 QPS, 0x concurrency, ID 0xA853B50CDEB4866B3A99CC42AEDCCFCD at byte 359/,
"Tool ran after version-check"
) or diag(Dumper($output));
@@ -172,6 +166,23 @@ ok(
unlink "/tmp/pt-query-digest.$PID" if "/tmp/pt-query-digest.$PID";
# #############################################################################
# # PT-2129 - tools fail on non-readable version check file
# #############################################################################
system("touch $vc_file");
chmod 0000, $vc_file;
$output = `$cmd --version-check 2>&1`;
unlike(
$output,
qr/Can't use an undefined value as an ARRAY reference/,
'No undefined value error'
) or diag($output);
chmod 0664, $vc_file;
# #############################################################################
# Done.
# #############################################################################