Merge branch 'percona:3.x' into PT-2465_patch_fix_for_mariadb_10.5_above

This commit is contained in:
Nyele
2025-08-18 14:44:30 +03:00
committed by GitHub
68 changed files with 2783 additions and 77 deletions

View File

@@ -20,14 +20,14 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.24'
- name: Build
run: cd src/go; make linux-amd64; cd ../../
- name: Build the Docker image
run: echo "FROM oraclelinux:9-slim" > Dockerfile; echo "RUN microdnf -y update" >> Dockerfile; echo "COPY bin/* /usr/bin/" >> Dockerfile; docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.31.0
uses: aquasecurity/trivy-action@0.32.0
with:
image-ref: 'percona-toolkit:${{ github.sha }}'
format: 'table'

View File

@@ -362,7 +362,7 @@ v3.0.5 released 2017-11-20
* Fixed bug PT-200: Index with keyword 'unique' as prefix/suffix considered as unique
* Fixed bug PT-199: pt-table-checksum does not make the session statement based when using row based replication
* Fixed bug PT-196: pt-onine-schema-change is pausing because {some_status_variable}=0
* Fixed bug PT-193: pt-table-checksum reports misleading error if comment has apostroph
* Fixed bug PT-193: pt-table-checksum reports misleading error if comment has apostrophe
* Fixed bug PT-187: pt-table-checksum not able to get differences for columns
* Fixed bug PT-186: pt-online-schema-change --alter fails if fields are using mixed case
* Fixed bug PT-183: pt-mongodb-query-digest cannot connect to a db using authentication

View File

@@ -319,7 +319,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -526,6 +528,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -1264,6 +1270,13 @@ L<"SYNOPSIS"> and usage information for details.
=over
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --help
Show help and exit.

View File

@@ -1048,7 +1048,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1255,6 +1257,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -7767,6 +7773,13 @@ The danger is that a crash might cause lost data.
The performance increase I have seen from using L<"--buffer"> is around 5 to 15
percent. Your mileage may vary.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --bulk-delete
Delete each chunk with a single statement (implies L<"--commit-each">).
@@ -8106,6 +8119,12 @@ until the replica is caught up, then proceeds to fetch and archive the row.
This option may eliminate the need for L<"--sleep"> or L<"--sleep-coef">.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --no-ascend
Do not use ascending index optimization.

View File

@@ -1046,7 +1046,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1253,6 +1255,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -5736,6 +5742,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -5789,6 +5802,12 @@ type: array
Ignore, do not compare, these variables.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -396,7 +396,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -603,6 +605,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -5334,6 +5340,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -5547,6 +5560,12 @@ type: string
Print all output to this file when daemonized.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --numeric-ip
Express IP addresses as integers.

View File

@@ -392,7 +392,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -599,6 +601,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -5472,6 +5478,13 @@ L<"SYNOPSIS"> and usage information for details.
=over
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --columns-regex
type: string; default: .

View File

@@ -1451,7 +1451,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1658,6 +1660,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -5449,6 +5455,13 @@ as a FULLTEXT index is not really a duplicate, for example.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -5559,6 +5572,12 @@ type: string; default: fk
Check for duplicate f=foreign keys, k=keys or fk=both.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -320,7 +320,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -527,6 +529,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -1565,6 +1571,13 @@ L<"SYNOPSIS"> and usage information for details.
=over
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --config
type: Array

View File

@@ -839,7 +839,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1046,6 +1048,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -4560,6 +4566,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --case-insensitive
Specifies that all regular expression searches are case-insensitive.

View File

@@ -321,7 +321,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -528,6 +530,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -2135,6 +2141,13 @@ L<"SYNOPSIS"> and usage information for details.
=over
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --config
type: Array

View File

@@ -391,7 +391,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -598,6 +600,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -4457,6 +4463,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -4544,6 +4557,12 @@ type: string
Print all output to this file when daemonized.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -1349,7 +1349,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1556,6 +1558,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -7100,6 +7106,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -7320,6 +7333,12 @@ type: int
If specified, pt-heartbeat will fail after given number of successive DBI errors
(failure to connect to server or issue a query).
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -1005,7 +1005,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1212,6 +1214,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -7198,6 +7204,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string

View File

@@ -401,7 +401,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -608,6 +610,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -8003,6 +8009,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -8741,6 +8754,12 @@ This option makes pt-kill kill matching queries. This requires MySQL 5.0 or
newer. Unlike L<"--kill"> which kills the connection for matching queries,
this option only kills the query, not its connection.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --print
group: Actions

View File

@@ -458,7 +458,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -665,6 +667,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -11226,6 +11232,8 @@ sub find_renamed_cols {
my $alter_change_col_re = qr/\bCHANGE \s+ (?:COLUMN \s+)?
($table_ident) \s+ ($table_ident)/ix;
my $alter_rename_col_re = qr/\bRENAME \s+ COLUMN \s+
($table_ident) \s+ TO \s+ ($table_ident)/ix;
my %renames;
while ( $alter =~ /$alter_change_col_re/g ) {
@@ -11237,6 +11245,17 @@ sub find_renamed_cols {
next if lc($orig_tbl) eq lc($new_tbl);
$renames{lc($orig_tbl)} = $new_tbl;
}
# Also handle RENAME COLUMN syntax (MySQL 8.0+)
while ( $alter =~ /$alter_rename_col_re/g ) {
my ($orig, $new) = map { $tp->ansi_to_legacy($_) } $1, $2;
next unless $orig && $new;
my (undef, $orig_tbl) = Quoter->split_unquote($orig);
my (undef, $new_tbl) = Quoter->split_unquote($new);
# Silly but plausible: RENAME COLUMN same_name TO same_name ...
next if lc($orig_tbl) eq lc($new_tbl);
$renames{lc($orig_tbl)} = $new_tbl;
}
PTDEBUG && _d("Renamed columns (old => new): ", Dumper(\%renames));
return \%renames;
}
@@ -11400,6 +11419,10 @@ sub create_new_table {
$sql =~ s/DATA DIRECTORY\s*=\s*'.*?'//;
PTDEBUG && _d("removing data dir");
}
if ( $o->got('remove-tablespace') ) {
$sql =~ s/TABLESPACE\s+`[^`]+`\s*//;
PTDEBUG && _d("removing tablespace");
}
PTDEBUG && _d($sql);
eval {
$cxn->dbh()->do($sql);
@@ -12459,7 +12482,7 @@ sub exec_nibble {
#
# Required Arguments:
# * tbl - Standard tbl hashref
# * sth - Sth with EXLAIN <statement>
# * sth - Sth with EXPLAIN <statement>
# * vals - Values for sth, if any
#
# Returns:
@@ -12904,6 +12927,13 @@ This is useful when you change large tables with keys that include a binary
data type or that have non-standard character sets.
See L<"--history"> and L<"--resume">.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --channel
type: string
@@ -13170,7 +13200,14 @@ than remove-data-dir.
default: no
If the original table was created using the DATA DIRECTORY feature, remove it and create
the new table in MySQL default directory without creating a new isl file.
the new table in MySQL directory without creating a new isl file.
=item --remove-tablespace
default: no
If the original table was created using the TABLESPACE feature, remove it and create
the new table without the TABLESPACE specification.
=item --defaults-file
@@ -13357,6 +13394,12 @@ until queries are running normally again. This will not prevent queueing,
however; it will only give the server a chance to recover from the queueing. If
you notice queueing, it is best to decrease the chunk time.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --preserve-triggers
Preserves old triggers when specified.

View File

@@ -1673,7 +1673,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1880,6 +1882,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -15697,6 +15703,13 @@ values for attributes. If the attribute's value is bigger than this, the
last-seen value for that class of query is used instead.
Disabled by default.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -16192,6 +16205,12 @@ type: int; default: 74
Trim lines to this length. 0=Do not trim lines.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --order-by
type: Array; default: Query_time:sum

View File

@@ -329,7 +329,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -536,6 +538,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -4402,6 +4408,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -4442,6 +4455,12 @@ short form: -h; type: string
Connect to host.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -551,7 +551,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -758,6 +760,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -5908,6 +5914,13 @@ pt-replica-restart will not let you stop the replica manually if you want to!
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -6034,6 +6047,12 @@ See L<"SLEEP">.
Whether to monitor the replica (default). Unless you specify --monitor
explicitly, L<"--stop"> will disable it.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -322,7 +322,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -529,6 +531,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -2400,6 +2406,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -2469,6 +2482,12 @@ type: array
Ignore this comma-separated list of users.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --only
type: array

View File

@@ -395,7 +395,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -602,6 +604,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}

View File

@@ -1013,8 +1013,13 @@ collect_system_data() {
}
collect_mysql_data_loop() {
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
>> "$d/$p-processlist" &
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SELECT * FROM performance_schema.threads\G") \
>> "$d/$p-threads" &
if [ "$have_lock_waits_table" ]; then
(echo $ts; lock_waits "$d/lock_waits.running") >>"$d/$p-lock-waits" &
(echo $ts; transactions) >>"$d/$p-transactions" &

View File

@@ -2155,7 +2155,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -2362,6 +2364,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -13304,6 +13310,13 @@ group: Connection
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --channel
type: string
@@ -13334,6 +13347,16 @@ This is useful in cases where you have trouble checksumming tables with keys tha
include a binary data type or that have non-standard character sets.
See L<"--replicate">.
=item --charset
short form: -A; type: string
Default character set. If the value is utf8, sets Perl's binmode on
STDOUT to utf8, passes the mysql_enable_utf8 option to DBD::mysql, and
runs SET NAMES UTF8 after connecting to MySQL. Any other value sets
binmode on STDOUT without the utf8 layer, and runs SET NAMES after
connecting to MySQL.
=item --check-interval
type: time; default: 1; group: Throttle
@@ -13759,6 +13782,12 @@ wait until queries are running normally again. This will not prevent queueing,
however; it will only give the server a chance to recover from the queueing. If
you notice queueing, it is best to decrease the chunk time.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string; group: Connection

View File

@@ -409,7 +409,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -616,6 +618,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -12490,6 +12496,13 @@ For most non-trivial data sizes, you want to leave this option enabled.
This option is disabled when L<"--bidirectional"> is used.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --channel
type: string
@@ -12907,6 +12920,12 @@ dump and reload or even something like L<pt-archiver>). It requires exactly two
DSNs and assumes they are on the same server, so it does no waiting for
replication or the like. Tables are locked with LOCK TABLES.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -1441,7 +1441,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1648,6 +1650,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -8257,6 +8263,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -8370,6 +8383,12 @@ type: string
Print all output to this file when daemonized.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -1670,7 +1670,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1877,6 +1879,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -11089,6 +11095,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -11196,6 +11209,12 @@ Max number of examples to list for each L<"QUERY DIFFERENCES">. A query
class is reported as soon as this many examples for any type of query
difference are found.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -398,7 +398,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -605,6 +607,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -6098,6 +6104,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string
@@ -6152,6 +6165,12 @@ Ignore these rule IDs.
Specify a comma-separated list of rule IDs (e.g. LIT.001,RES.002,etc.)
to ignore.
=item --mysql_ssl
short form: -s; type: int
Create SSL MySQL connection.
=item --password
short form: -p; type: string

View File

@@ -1008,7 +1008,9 @@ sub _parse_specs {
$opt->{spec} =~ s/=./=s/ if ( $type && $type =~ m/[HhAadzm]/ );
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -1215,6 +1217,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}
@@ -3944,6 +3950,13 @@ L<"SYNOPSIS"> and usage information for details.
Prompt for a password when connecting to MySQL.
=item --[no]buffer-stdout
default: yes
Enables STDOUT buffering. Disable this option if you want to see live progress
when using output post-processing tools such as C<tee> or C<kubectl logs>.
=item --charset
short form: -A; type: string

18
go.mod
View File

@@ -9,7 +9,7 @@ require (
github.com/Ladicle/tabwriter v1.0.0
github.com/Masterminds/semver v1.5.0
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/alecthomas/kong v1.11.0
github.com/alecthomas/kong v1.12.1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/go-ini/ini v1.67.0
github.com/golang/mock v1.6.0
@@ -29,11 +29,11 @@ require (
github.com/stretchr/testify v1.10.0
github.com/xlab/treeprint v1.2.0
go.mongodb.org/mongo-driver v1.17.4
golang.org/x/crypto v0.39.0
golang.org/x/crypto v0.40.0
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.33.1
k8s.io/api v0.33.3
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
)
@@ -61,14 +61,14 @@ require (
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.34.0 // indirect
golang.org/x/term v0.33.0 // indirect
golang.org/x/text v0.27.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.33.1 // indirect
k8s.io/apimachinery v0.33.3 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect

36
go.sum
View File

@@ -8,8 +8,8 @@ github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8v
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI=
github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE=
github.com/alecthomas/kong v1.11.0 h1:y++1gI7jf8O7G7l4LZo5ASFhrhJvzc+WgF/arranEmM=
github.com/alecthomas/kong v1.11.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
github.com/alecthomas/kong v1.12.1 h1:iq6aMJDcFYP9uFrLdsiZQ2ZMmcshduyGv4Pek0MQPW0=
github.com/alecthomas/kong v1.12.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
@@ -129,8 +129,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -144,15 +144,15 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -168,18 +168,18 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -203,10 +203,10 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.33.1 h1:tA6Cf3bHnLIrUK4IqEgb2v++/GYUtqiu9sRVk3iBXyw=
k8s.io/api v0.33.1/go.mod h1:87esjTn9DRSRTD4fWMXamiXxJhpOIREjWOSjsW1kEHw=
k8s.io/apimachinery v0.33.1 h1:mzqXWV8tW9Rw4VeW9rEkqvnxj59k1ezDUl20tFK/oM4=
k8s.io/apimachinery v0.33.1/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/api v0.33.3 h1:SRd5t//hhkI1buzxb288fy2xvjubstenEKL9K51KBI8=
k8s.io/api v0.33.3/go.mod h1:01Y/iLUjNBM3TAvypct7DIj0M0NIZc+PzAHCIo0CYGE=
k8s.io/apimachinery v0.33.3 h1:4ZSrmNa0c/ZpZJhAgRdcsFcZOw1PQU1bALVQ0B3I5LA=
k8s.io/apimachinery v0.33.3/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=

View File

@@ -406,7 +406,9 @@ sub _parse_specs {
# These defaults from the POD may be overridden by later calls
# to set_defaults().
if ( (my ($def) = $opt->{desc} =~ m/default\b(?: ([^)]+))?/) ) {
$self->{defaults}->{$long} = defined $def ? $def : 1;
$def = defined $def ? $def : 1;
$def = $def eq 'yes' ? 1 : $def eq 'no' ? 0 : $def;
$self->{defaults}->{$long} = $def;
PTDEBUG && _d($long, 'default:', $def);
}
@@ -666,6 +668,10 @@ sub get_opts {
}
}
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
}
if ( @ARGV && $self->{strict} ) {
$self->save_error("Unrecognized command-line options @ARGV");
}

View File

@@ -286,8 +286,15 @@ collect_system_data() {
}
collect_mysql_data_loop() {
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
# SHOW FULL PROCESSLIST duplicates information in performance_schema.threads we collecting now
# Keeping it for backward compatibility and may remove in the future
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SHOW FULL PROCESSLIST\G") \
>> "$d/$p-processlist" &
(echo $ts; $CMD_MYSQL $EXT_ARGV -e "SELECT * FROM performance_schema.threads\G") \
>> "$d/$p-threads" &
if [ "$have_lock_waits_table" ]; then
(echo $ts; lock_waits "$d/lock_waits.running") >>"$d/$p-lock-waits" &
(echo $ts; transactions) >>"$d/$p-transactions" &

View File

@@ -201,6 +201,26 @@ var ApplicativeMap = types.RegexMap{
},
Verbosity: types.DebugMySQL,
},
"RegexInconsistencyVoteRecomputed": &types.LogRegex{
Regex: regexp.MustCompile("Recomputed vote based on error codes"),
InternalRegex: regexp.MustCompile("New vote " + regexErrorMD5 + " will be used.*Old Vote: (?P<" + groupErrorMD5 + "2" + ">[a-z0-9]*)"),
Handler: func(submatches map[string]string, logCtx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) {
oldMD5 := submatches[groupErrorMD5+"2"]
md5 := submatches[groupErrorMD5]
for _, conflict := range logCtx.Conflicts {
for node, vote := range conflict.VotePerNode {
if vote.MD5 == oldMD5 {
vote.MD5 = md5
conflict.VotePerNode[node] = vote
}
}
}
return logCtx, types.SimpleDisplayer("vote md5 recomputed from " + oldMD5 + " to " + md5)
},
Verbosity: types.DebugMySQL,
},
}
func voteResponse(vote types.ConflictVote, conflict types.Conflict) string {

View File

@@ -159,6 +159,18 @@ func TestApplicativeRegex(t *testing.T) {
expectedOut: "vote (success) inconsistent, leaving cluster",
key: "RegexInconsistencyVoteInconsistentWithGroup",
},
{
log: "2001-01-01T01:01:01.000000Z 16 [ERROR] [MY-000000] [Galera] Recomputed vote based on error codes: 3638. New vote c4915064add984b1 will be used for further steps. Old Vote: b3be677140613e7",
input: regexTestState{
LogCtx: types.LogCtx{OwnNames: []string{"node2"}, Conflicts: types.Conflicts{&types.Conflict{InitiatedBy: []string{"node1"}, Seqno: "20", VotePerNode: map[string]types.ConflictVote{"node1": types.ConflictVote{MD5: "b3be677140613e7", Error: "some error"}, "node2": types.ConflictVote{MD5: "b3be677140613e7", Error: "some error"}}}}},
},
expected: regexTestState{
LogCtx: types.LogCtx{OwnNames: []string{"node2"}, Conflicts: types.Conflicts{&types.Conflict{InitiatedBy: []string{"node1"}, Seqno: "20", VotePerNode: map[string]types.ConflictVote{"node1": types.ConflictVote{MD5: "c4915064add984b1", Error: "some error"}, "node2": types.ConflictVote{MD5: "c4915064add984b1", Error: "some error"}}}}},
},
expectedOut: "vote md5 recomputed from b3be677140613e7 to c4915064add984b1",
key: "RegexInconsistencyVoteRecomputed",
},
}
iterateRegexTest(t, ApplicativeMap, tests)

View File

@@ -0,0 +1,5 @@
[client]
user=msandbox
ssl-ca=/tmp/12345/data/ca.pem
ssl-cert=/tmp/12345/data/server-cert.pem
ssl-key=/tmp/12345/data/client-key.pem

View File

@@ -0,0 +1,4 @@
[client]
ssl-ca=/tmp/12346/data/ca.pem
ssl-cert=/tmp/12346/data/client-cert.pem
ssl-key=/tmp/12346/data/client-key.pem

View File

@@ -0,0 +1,4 @@
[client]
ssl-ca=/tmp/12347/data/ca.pem
ssl-cert=/tmp/12347/data/client-cert.pem
ssl-key=/tmp/12347/data/client-key.pem

View File

@@ -0,0 +1,4 @@
[client]
ssl-ca=/tmp/12345/data/ca.pem
ssl-cert=/tmp/12345/data/client-cert.pem
ssl-key=/tmp/12345/data/client-key.pem

View File

@@ -83,6 +83,77 @@ like(
'Queries printed'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_archiver::main('--source=t=film',
qw(--host 127.1 --port 12345 -D sakila),
qw(--user sha256_user --password sha256_user%password --mysql_ssl 1),
qw(--no-check-charset --purge --dry-run --port 12345),
"--where", "film_id < 100")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password and option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/DELETE FROM `sakila`.`film` WHERE/,
'Queries printed with option --mysql_ssl'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_archiver::main('--source', "F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1",
qw(--no-check-charset --purge --dry-run --port 12345),
"--where", "film_id < 100")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_archiver::main('--source', "F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1",
qw(--no-check-charset --purge --dry-run --port 12345),
"--where", "film_id < 100")
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -80,6 +80,71 @@ is(
"No output when no diff"
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_config_diff::main(
qw(--host 127.1 --port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1),
'h=127.1')
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password and option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
is(
$output,
"",
"No output when no diff and option --mysql_ssl"
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_config_diff::main("F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1", 'h=127.1')
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_config_diff::main("F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1", 'h=127.1')
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -165,6 +165,73 @@ like(
'Deadlock logger prints the output'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_deadlock_logger::main(
qw(--host 127.1 --port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1),
qw(--iterations 1));
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/127\.1.+msandbox.+GEN_CLUST_INDEX/,
'Deadlock logger prints the output with option --mysql_ssl'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_deadlock_logger::main("F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1",
qw(--iterations 1));
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_deadlock_logger::main("F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1",
qw(--iterations 1));
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -93,6 +93,61 @@ if ($sandbox_version ge '8.0') {
);
}
$output = `$cmd -d mysql -t columns_priv -v --host 127.1 --port 12345 --user sha256_user --password=sha256_user%password --mysql_ssl=1`;
is(
$?,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl=1"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl=1'
) or diag($output);
# In version 8.0 order of columns in the index changed
if ($sandbox_version ge '8.0') {
like($output,
qr/PRIMARY \(`Host`,`User`,`Db`,`Table_name`,`Column_name`\)/,
'Finds mysql.columns_priv PK with option --mysql_ssl=1'
);
} else {
like($output,
qr/PRIMARY \(`Host`,`Db`,`User`,`Table_name`,`Column_name`\)/,
'Finds mysql.columns_priv PKi with option --mysql_ssl=1'
);
}
$output = `$cmd -d mysql -t columns_priv -v F=t/pt-archiver/samples/pt-191.cnf,P=12345,u=sha256_user,p=sha256_user%password,s=1 2>&1`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$cmd -d mysql -t columns_priv -v F=t/pt-archiver/samples/pt-191-error.cnf,P=12345,u=sha256_user,p=sha256_user%password,s=1 2>&1`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -29,7 +29,7 @@ elsif ( $sandbox_version lt '8.0' ) {
my $output;
my $cnf = '/tmp/12345/my.sandbox.cnf';
my $cmd = "$trunk/bin/pt-find -F $cnf ";
my $cmd = "$trunk/bin/pt-find";
$sb->do_as_root(
'source',
@@ -37,7 +37,7 @@ $sb->do_as_root(
q/GRANT ALL ON *.* TO sha256_user@'%'/,
);
$output = `$cmd mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=0 2>&1`;
$output = `$cmd -F $cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=0 2>&1`;
isnt(
$?,
@@ -47,26 +47,80 @@ isnt(
like(
$output,
qr/Access denied/,
'Secure connection error raised when no SSL connection used'
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error raised when SSL connection used'
) or diag($output);
$output = `$cmd mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
$output = `$cmd -F $cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
is(
$?,
0,
"Error raised when SSL connection is not used"
"Error not raised when SSL connection is used"
) or diag($output);
unlike(
$output,
qr/Access denied/,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'Secure connection error raised when no SSL connection used'
) or diag($output);
like($output, qr/`mysql`.`columns_priv`/, 'Found mysql.columns_priv');
$dbh->do('CREATE DATABASE IF NOT EXISTS test');
$dbh->do('CREATE TABLE test.pt_find_ssl(cnt INT)');
$output = `$cmd -F $cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 --exec-dsn=h=127.1,P=12346,u=sha256_user,p=sha256_user%password,s=1 --exec-plus "INSERT INTO test.pt_find_ssl() SELECT COUNT(*) FROM %s" 2>&1`;
is(
$?,
0,
"Error not raised when SSL connection is used with DSN"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error raised when SSL connection used with DSN'
) or diag($output);
$output = `/tmp/12346/use -N -e "SELECT COUNT(*) FROM test.pt_find_ssl"`;
chomp($output);
is(
$output,
1,
'DSN option s works with pt-find'
) or diag($output);
$output = `$cmd -F t/pt-archiver/samples/pt-191.cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$cmd -F t/pt-archiver/samples/pt-191-error.cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -95,6 +95,71 @@ like(
"Prints fk error by default"
);
($output, $exit_code) = full_output(
sub {
pt_fk_error_logger::main(@args, 'h=127.1',
qw(--port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1))
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option mysql_ssl'
) or diag($output);
like(
$output,
qr/Foreign key constraint fails/,
"Prints fk error by default with option mysql_ssl"
);
($output, $exit_code) = full_output(
sub {
pt_fk_error_logger::main(@args, 'F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1'),
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_fk_error_logger::main(@args, 'F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1'),
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -53,7 +53,7 @@ $sb->do_as_root(
);
isnt(
$?,
$exit_code,
0,
"Error raised when SSL connection is not used"
) or diag($output);
@@ -71,7 +71,7 @@ like(
);
is(
$?,
$exit_code,
0,
"No error for user, identified with caching_sha2_password"
) or diag($output);
@@ -89,6 +89,69 @@ is(
"Automatically inserts heartbeat row (issue 1292)"
);
($output, $exit_code) = full_output(
sub { pt_heartbeat::main(
qw(--host 127.1 --port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl=1),
qw(-D test --check)) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
$row = $dbh->selectall_hashref('select * from test.heartbeat', 'id');
is(
$row->{1}->{id},
1,
"Automatically inserts heartbeat row (issue 1292) with option --mysql_ssl"
);
($output, $exit_code) = full_output(
sub { pt_heartbeat::main("F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1",
qw(-D test --check)) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_heartbeat::main("F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1",
qw(-D test --check)) },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -39,6 +39,7 @@ $sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT ALL ON sakila.* TO sha256_user@'%'/,
q/GRANT ALL ON test.* TO sha256_user@'%'/,
);
# This query doesn't use indexes so there's an unused PK and
@@ -95,6 +96,92 @@ like(
'A simple query that does not use any indexes',
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_index_usage::main(
@args,
qw(--host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1),
qw(--create-save-results-database),
'--save-results-database=h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1,D=test',
"$trunk/$samples/slow001.txt")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password via DSN"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with DSN'
) or diag($output);
$output = `/tmp/12345/use -N -e "SHOW TABLES FROM test"`;
my $expected = <<EOF;
index_alternatives
index_usage
indexes
queries
tables
EOF
is(
$output,
$expected,
'Results are saved'
) or diag($output);
@args = ('-F', "$trunk/t/pt-archiver/samples/pt-191.cnf");
($output, $exit_code) = full_output(
sub {
pt_index_usage::main(
@args,
qw(--host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1),
"$trunk/$samples/slow001.txt")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
@args = ('-F', "$trunk/t/pt-archiver/samples/pt-191-error.cnf");
($output, $exit_code) = full_output(
sub {
pt_index_usage::main(
@args,
qw(--host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1),
"$trunk/$samples/slow001.txt")
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -30,12 +30,12 @@ elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
else {
plan tests => 6;
plan tests => 13;
}
my ($output, $exit_code);
my $cnf = '/tmp/12345/my.sandbox.cnf';
my $cmd = "$trunk/bin/pt-kill -F $cnf";
my $cmd = "$trunk/bin/pt-kill";
$sb->do_as_root(
'source',
@@ -43,7 +43,7 @@ $sb->do_as_root(
q/GRANT PROCESS ON *.* TO sha256_user@'%'/,
);
$output = `$cmd h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0 --busy-time 1s --print --run-time 10 2>&1`;
$output = `$cmd F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0 --busy-time 1s --print --run-time 10 2>&1`;
isnt(
$?,
@@ -61,7 +61,7 @@ like(
# Backticks don't work here.
system("/tmp/12345/use -e 'select sleep(5)' >/dev/null &");
$output = `$cmd h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
$output = `$cmd F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
is(
$?,
@@ -91,6 +91,68 @@ ok(
"There were 2 to 5 captures"
) or diag($output);
# Shell out to a sleep(10) query and try to capture the query.
# Backticks don't work here.
system("/tmp/12345/use -e 'select sleep(5)' >/dev/null &");
$output = `$cmd --host 127.1 --port 12345 --user sha256_user --password=sha256_user%password --mysql_ssl 1 --busy-time 1s --print --run-time 10 2>&1`;
is(
$?,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
# $output ought to be something like
# 2009-05-27T22:19:40 KILL 5 (Query 1 sec) select sleep(10)
# 2009-05-27T22:19:41 KILL 5 (Query 2 sec) select sleep(10)
# 2009-05-27T22:19:42 KILL 5 (Query 3 sec) select sleep(10)
# 2009-05-27T22:19:43 KILL 5 (Query 4 sec) select sleep(10)
# 2009-05-27T22:19:44 KILL 5 (Query 5 sec) select sleep(10)
# 2009-05-27T22:19:45 KILL 5 (Query 6 sec) select sleep(10)
# 2009-05-27T22:19:46 KILL 5 (Query 7 sec) select sleep(10)
# 2009-05-27T22:19:47 KILL 5 (Query 8 sec) select sleep(10)
# 2009-05-27T22:19:48 KILL 5 (Query 9 sec) select sleep(10)
@times = $output =~ m/\(Query (\d+) sec\)/g;
ok(
@times > 2 && @times < 7,
"There were 2 to 5 captures with option --mysql_ssl"
) or diag($output);
$output = `$cmd F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$cmd F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -29,7 +29,7 @@ elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
else {
plan tests => 6;
plan tests => 10;
}
my ($tool) = 'pt-mysql-summary';
@@ -74,6 +74,34 @@ like(
"Authentication with caching_sha2_password works"
);
$output = `$trunk/bin/$tool --host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password 2>&1 -- --defaults-file=t/pt-archiver/samples/pt-191.cnf --ssl-mode=required`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$trunk/bin/$tool --host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password 2>&1 -- --defaults-file=t/pt-archiver/samples/pt-191-error.cnf --ssl-mode=required`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL error: Unable to get private key from/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -0,0 +1,182 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use Data::Dumper;
use PerconaTest;
use Sandbox;
require "$trunk/bin/pt-online-schema-change";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $source_dbh = $sb->get_dbh_for('source');
if ($sandbox_version lt '8.0') {
plan skip_all => 'This test needs MySQL 8.0+';
} elsif ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
# tool will die.
my $source_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
my @args = (qw(--set-vars innodb_lock_wait_timeout=3));
my $output;
my $exit_status;
my $sample = "t/pt-online-schema-change/samples/";
# ############################################################################
# Test for timestamp NULL issue during column rename
# This reproduces the issue where 't' column values become NULL after CHANGE COLUMN
# ############################################################################
$sb->load_file('source', "$sample/PT-2418-timestamp_null_issue.sql");
# Get the original data before the rename operation
my $orig_data = $source_dbh->selectall_arrayref(
"SELECT i, s, t1, g FROM test.joinit ORDER BY i"
);
# Verify we have data with non-NULL timestamps
ok(
scalar(@$orig_data) > 0,
"Table has data before rename operation"
);
# Check that timestamps are not NULL
my $null_timestamps = 0;
foreach my $row (@$orig_data) {
$null_timestamps++ if !defined($row->[2]); # column 't' is at index 2
}
is(
$null_timestamps,
0,
"All timestamp values are non-NULL before rename operation"
) or diag("Found $null_timestamps NULL timestamps out of " . scalar(@$orig_data) . " rows");
# Test if --check-alter works correctly
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=joinit",
"--alter", "RENAME COLUMN t1 TO t2",
qw(--execute --check-alter)) },
);
is(
$exit_status,
17,
"Column rename operation rejected correctly"
) or diag($output);
like(
$output,
qr/`test`.`joinit` was not altered./,
"Table was not altered"
);
# Perform the column rename operation
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=joinit",
"--alter", "RENAME COLUMN t1 TO t2",
qw(--execute --no-check-alter)) },
);
is(
$exit_status,
0,
"Column rename operation completed successfully"
) or diag($output);
# Get the data after the rename operation
my $new_data = $source_dbh->selectall_arrayref(
"SELECT i, s, t2, g FROM test.joinit ORDER BY i"
);
# Verify the data structure is the same
is(
scalar(@$new_data),
scalar(@$orig_data),
"Same number of rows after rename operation"
);
# Check that timestamps are preserved (not NULL)
$null_timestamps = 0;
foreach my $row (@$new_data) {
$null_timestamps++ if !defined($row->[2]); # column 't1' is now at index 2
}
is(
$null_timestamps,
0,
"All timestamp values are preserved (non-NULL) after rename operation"
) or diag("Found $null_timestamps NULL timestamps out of " . scalar(@$new_data) . " rows");
# Compare the actual timestamp values (ignoring the column name change)
for (my $i = 0; $i < scalar(@$orig_data); $i++) {
is(
$new_data->[$i]->[2], # t1 column value
$orig_data->[$i]->[2], # original t column value
"Timestamp value preserved for row " . ($i + 1)
) or diag("Row " . ($i + 1) . ": Original=" .
(defined($orig_data->[$i]->[2]) ? $orig_data->[$i]->[2] : "NULL") .
", New=" . (defined($new_data->[$i]->[2]) ? $new_data->[$i]->[2] : "NULL"));
}
# Test the reverse rename operation
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=joinit",
"--alter", "CHANGE COLUMN t2 t1 time NOT NULL",
qw(--execute --no-check-alter)) },
);
is(
$exit_status,
0,
"Reverse column rename operation completed successfully"
) or diag($output);
# Get the data after the reverse rename
my $final_data = $source_dbh->selectall_arrayref(
"SELECT i, s, t1, g FROM test.joinit ORDER BY i"
);
# Verify timestamps are still preserved
$null_timestamps = 0;
foreach my $row (@$final_data) {
$null_timestamps++ if !defined($row->[2]); # column 't' is back at index 2
}
is(
$null_timestamps,
0,
"All timestamp values are preserved (non-NULL) after reverse rename operation"
) or diag("Found $null_timestamps NULL timestamps out of " . scalar(@$final_data) . " rows");
# Compare with original data
for (my $i = 0; $i < scalar(@$orig_data); $i++) {
is(
$final_data->[$i]->[2], # t column value
$orig_data->[$i]->[2], # original t column value
"Timestamp value preserved after reverse rename for row " . ($i + 1)
) or diag("Row " . ($i + 1) . ": Original=" .
(defined($orig_data->[$i]->[2]) ? $orig_data->[$i]->[2] : "NULL") .
", Final=" . (defined($final_data->[$i]->[2]) ? $final_data->[$i]->[2] : "NULL"));
}
$sb->wipe_clean($source_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

View File

@@ -0,0 +1,173 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use Data::Dumper;
use PerconaTest;
use Sandbox;
use SqlModes;
require "$trunk/bin/pt-online-schema-change";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
if ($sandbox_version lt '5.7') {
plan skip_all => 'This test needs MySQL 5.7+ for general tablespace support';
} else {
plan tests => 10;
}
my $source_dbh = $sb->get_dbh_for('source');
my $replica_dbh = $sb->get_dbh_for('replica1');
if ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
elsif ( !$replica_dbh ) {
plan skip_all => 'Cannot connect to sandbox replica';
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
# tool will die.
my @args = qw(--set-vars innodb_lock_wait_timeout=3);
my $output;
my $exit_status;
my $dsn = "h=127.1,P=12345,u=msandbox,p=msandbox";
my $sample = "t/pt-online-schema-change/samples";
# #############################################################################
# Test 1: Basic functionality - remove tablespace from table
# #############################################################################
$sb->load_file('source', "$sample/remove_tablespace.sql");
# Verify the table was created with tablespace
my $ddl = $source_dbh->selectrow_arrayref("SHOW CREATE TABLE test_ts.test_table");
like(
$ddl->[1],
qr/TABLESPACE `test_tablespace`/,
"Table created with tablespace"
);
# Get original row count
my $orig_rows = $source_dbh->selectall_arrayref(
"SELECT * FROM test_ts.test_table ORDER BY id"
);
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, "$dsn,D=test_ts,t=test_table",
'--execute',
'--alter', "ADD COLUMN new_col INT DEFAULT 42",
'--remove-tablespace',
)},
stderr => 1,
);
is(
$exit_status,
0,
"Successfully altered table with --remove-tablespace"
);
like(
$output,
qr/Successfully altered/s,
"Got successfully altered message"
);
# Verify tablespace was removed from the table
$ddl = $source_dbh->selectrow_arrayref("SHOW CREATE TABLE test_ts.test_table");
unlike(
$ddl->[1],
qr/TABLESPACE `test_tablespace`/,
"Tablespace removed from table definition"
);
# Verify data integrity
my $new_rows = $source_dbh->selectall_arrayref(
"SELECT id, name, created_at FROM test_ts.test_table ORDER BY id"
);
is_deeply(
$new_rows,
$orig_rows,
"Data integrity maintained after removing tablespace"
);
# #############################################################################
# Test 3: Test with second table
# #############################################################################
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, "$dsn,D=test_ts,t=test_table2",
'--execute',
'--alter', "ADD COLUMN second_col BOOLEAN DEFAULT FALSE",
'--remove-tablespace',
)},
stderr => 1,
);
is(
$exit_status,
0,
"Successfully altered second table with --remove-tablespace"
);
# Verify tablespace was removed from the second table
$ddl = $source_dbh->selectrow_arrayref("SHOW CREATE TABLE test_ts.test_table2");
unlike(
$ddl->[1],
qr/TABLESPACE `test_tablespace`/,
"Tablespace removed from second table definition"
);
# #############################################################################
# Test 4: Test without --remove-tablespace (control test)
# #############################################################################
$sb->load_file('source', "$sample/remove_tablespace.sql");
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, "$dsn,D=test_ts,t=test_table",
'--execute',
'--alter', "ADD COLUMN control_col INT DEFAULT 0",
)},
stderr => 1,
);
is(
$exit_status,
0,
"Successfully altered table without --remove-tablespace"
);
# Verify tablespace is preserved when not using --remove-tablespace
$ddl = $source_dbh->selectrow_arrayref("SHOW CREATE TABLE test_ts.test_table");
like(
$ddl->[1],
qr/TABLESPACE `test_tablespace`/,
"Tablespace preserved when not using --remove-tablespace"
);
# #############################################################################
# Cleanup
# #############################################################################
$source_dbh->do("DROP DATABASE IF EXISTS test_ts");
$source_dbh->do("DROP TABLESPACE test_tablespace");
$sb->wipe_clean($source_dbh);
$sb->wipe_clean($replica_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

View File

@@ -0,0 +1,19 @@
-- Test case for timestamp NULL issue during column rename
-- This reproduces the issue where 't' column values become NULL after CHANGE COLUMN
DROP DATABASE IF EXISTS test;
CREATE DATABASE test;
USE test;
CREATE TABLE `joinit` (
`i` int(11) NOT NULL AUTO_INCREMENT,
`s` varchar(64) DEFAULT NULL,
`t1` time DEFAULT NULL,
`g` int(11) NOT NULL,
PRIMARY KEY (`i`)
);
-- Insert initial data with timestamps
INSERT INTO joinit VALUES (NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )));
INSERT INTO joinit SELECT NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )) FROM joinit;
INSERT INTO joinit SELECT NULL, uuid(), time(now()), (FLOOR( 1 + RAND( ) *60 )) FROM joinit;

View File

@@ -0,0 +1,62 @@
-- Sample table with tablespace for testing --remove-tablespace functionality
-- This requires MySQL 5.7+ for general tablespace support
-- Clean
-- Drop the database if it exists
DROP DATABASE IF EXISTS test_ts;
CREATE DATABASE IF NOT EXISTS test_ts;
USE test_ts;
DELIMITER $$
-- Procedure to delete tablespace as there is no IF EXIST for tablespace
CREATE PROCEDURE drop_tablespace_if_exists()
BEGIN
DECLARE ts_count INT;
SELECT COUNT(*) INTO ts_count
FROM information_schema.FILES
WHERE tablespace_name = 'test_tablespace';
IF ts_count > 0 THEN
SET @stmt := 'DROP TABLESPACE test_tablespace';
DROP TABLESPACE test_tablespace;
END IF;
END$$
DELIMITER ;
-- Call the procedure
CALL drop_tablespace_if_exists();
-- Create a general tablespace first (MySQL 5.7+)
CREATE TABLESPACE test_tablespace ADD DATAFILE 'test_tablespace.ibd';
-- Create table with tablespace
CREATE TABLE test_table (
id INT PRIMARY KEY,
name VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) TABLESPACE test_tablespace;
-- Insert some test data
INSERT INTO test_table (id, name) VALUES
(1, 'Alice'),
(2, 'Bob'),
(3, 'Charlie'),
(4, 'David'),
(5, 'Eve');
-- Create another table with tablespace for testing multiple tables
CREATE TABLE test_table2 (
id INT PRIMARY KEY,
description TEXT,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) TABLESPACE test_tablespace;
INSERT INTO test_table2 (id, description) VALUES
(1, 'First record'),
(2, 'Second record'),
(3, 'Third record');

View File

@@ -0,0 +1,13 @@
CREATE DATABASE IF NOT EXISTS test_ssl;
USE test_ssl;
DROP TABLE IF EXISTS `dsns`;
CREATE TABLE `dsns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`dsn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
INSERT INTO `dsns` VALUES (1, NULL, "F=/home/sveta/src/percona/percona-toolkit/t/pt-archiver/samples/pt-191-replica1.cnf,P=12346,h=127.0.0.1,u=root,p=msandbox,s=1");
INSERT INTO `dsns` VALUES (2, NULL, "F=/home/sveta/src/percona/percona-toolkit/t/pt-archiver/samples/pt-191-replica2.cnf,P=12347,h=127.0.0.1,u=root,p=msandbox,s=1");

View File

@@ -45,6 +45,7 @@ $sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT ALL ON test.* TO sha256_user@'%'/,
q/GRANT SELECT ON test_ssl.* TO sha256_user@'%'/,
q/GRANT REPLICATION SLAVE ON *.* TO sha256_user@'%'/,
q/GRANT SUPER ON *.* TO sha256_user@'%'/,
);
@@ -54,6 +55,7 @@ $sb->do_as_root(
# #############################################################################
$sb->load_file('source', "$sample/del-trg-bug-1103672.sql");
$sb->load_file('source', "$sample/ssl_dsns.sql");
($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
@@ -101,6 +103,82 @@ like(
"DROP PRIMARY KEY"
);
# Restoring environment for the new test
$sb->load_file('source', "$sample/del-trg-bug-1103672.sql");
($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=t1",
qw(--user sha256_user --password sha256_user%password --mysql_ssl 1),
"--alter", "drop primary key, add column _id int unsigned not null primary key auto_increment FIRST",
qw(--execute --no-check-alter)),
},
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/Successfully altered `test`.`t1`/,
"DROP PRIMARY KEY with option --mysql_ssl"
);
# Restoring environment for the new test
$sb->load_file('source', "$sample/del-trg-bug-1103672.sql");
($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,F=t/pt-archiver/samples/pt-191.cnf,D=test,t=t1,u=sha256_user,p=sha256_user%password,s=1",
"--alter", "drop primary key, add column _id int unsigned not null primary key auto_increment FIRST",
qw(--execute --no-check-alter),
"--recursion-method=dsn=F=t/pt-archiver/samples/pt-191.cnf,D=test_ssl,t=dsns,h=127.0.0.1,P=12345,u=sha256_user,p=sha256_user%password,s=1"),
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
"F=$trunk/t/pt-archiver/samples/pt-191-error.cnf,$source_dsn,D=test,t=t1,u=sha256_user,p=sha256_user%password,s=1",
"--alter", "drop primary key, add column _id int unsigned not null primary key auto_increment FIRST",
qw(--execute --no-check-alter)),
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

161
t/pt-query-digest/ssl.t Normal file
View File

@@ -0,0 +1,161 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use Sandbox;
require "$trunk/bin/pt-query-digest";
require VersionParser;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('source');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
my ($output, $exit_code);
my $cnf = "/tmp/12345/my.sandbox.cnf";
my $samples = "$trunk/t/pt-query-digest/samples";
$sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT ALL ON sakila.* TO sha256_user@'%'/,
);
($output, $exit_code) = full_output(
sub {
pt_query_digest::main("--explain=F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0",
"$samples/slow028.txt")
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error raised when SSL connection is not used"
) or diag($output);
like(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'Secure connection error raised when no SSL connection used'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_query_digest::main("--explain='F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1'",
"$samples/slow028.txt")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error'
) or diag($output);
like(
$output,
qr/Query size 24 24 24 24 24 0 24/,
'Analysis printed'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_query_digest::main("--explain=h=127.1,P=12345,u=sha256_user,p=sha256_user%password",
qw(--mysql_ssl 1),
"$samples/slow028.txt")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/Query size 24 24 24 24 24 0 24/,
'Analysis printed with option --mysql_ssl'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_query_digest::main("--explain=F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1",
"$samples/slow028.txt")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_query_digest::main("--explain=F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1",
"$samples/slow028.txt")
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################
$sb->do_as_root('source', q/DROP USER 'sha256_user'@'%'/);
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

152
t/pt-replica-find/ssl.t Normal file
View File

@@ -0,0 +1,152 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use Sandbox;
require "$trunk/bin/pt-replica-find";
if ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $source_dbh = $sb->get_dbh_for('source');
my $replica1_dbh = $sb->get_dbh_for('replica1');
my $replica2_dbh = $sb->get_dbh_for('replica2');
my $output;
# This test is sensitive to ghost/old replicas created/destroyed by other
# tests. So we stop the replicas, restart the source, and start everything
# again. Hopefully this will return the env to its original state.
$replica2_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("STOP ${replica_name}");
diag(`/tmp/12345/stop >/dev/null`);
diag(`/tmp/12345/start >/dev/null`);
$replica1_dbh->do("START ${replica_name}");
$replica2_dbh->do("START ${replica_name}");
if ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
elsif ( !$replica1_dbh ) {
plan skip_all => 'Cannot connect to sandbox replica';
}
elsif ( !$replica2_dbh ) {
plan skip_all => 'Cannot connect to second sandbox replica';
}
$sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT REPLICATION SLAVE, PROCESS ON *.* TO sha256_user@'%'/,
);
# Start an instance
$output = `$trunk/bin/pt-replica-find h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0 --report-format hostname 2>&1`;
isnt(
$?,
0,
"Error raised when SSL connection is not used"
) or diag($output);
like(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'Secure connection error raised when no SSL connection used'
) or diag($output);
$output = `$trunk/bin/pt-replica-find h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --report-format hostname 2>&1`;
is(
$?,
0,
"No error for user, identified with caching_sha2_password"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error'
) or diag($output);
my $expected = <<EOF;
127.1:12345
+- 127.0.0.1:12346
+- 127.0.0.1:12347
EOF
is($output, $expected, 'Source with replica and replica of replica');
$output = `$trunk/bin/pt-replica-find --host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1 --report-format hostname 2>&1`;
is(
$?,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
$expected = <<EOF;
127.1:12345
+- 127.0.0.1:12346
+- 127.0.0.1:12347
EOF
is(
$output,
$expected,
'Source with replica and replica of replica with option --mysql_ssl'
);
$output = `$trunk/bin/pt-replica-find F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --report-format hostname --recurse 0 2>&1`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$trunk/bin/pt-replica-find F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --report-format hostname --recurse 0 2>&1`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################
$sb->do_as_root('source', q/DROP USER 'sha256_user'@'%'/);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

View File

@@ -95,6 +95,54 @@ unlike(
'--error-text works (issue 459)'
);
$output = `$trunk/bin/pt-replica-restart --max-sleep 0.25 --host=127.1 --port=12346 --user=sha256_user --password=sha256_user%password --mysql_ssl=1 --error-text "doesn't exist" --run-time 1s 2>&1`;
is(
$?,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
unlike(
$output,
qr/Error does not match/,
'--error-text works (issue 459) with option --mysql_ssl'
);
$output = `$trunk/bin/pt-replica-restart --max-sleep 0.25 F=t/pt-archiver/samples/pt-191-replica1.cnf,h=127.1,P=12346,u=sha256_user,p=sha256_user%password,s=1 --error-text "doesn't exist" --run-time 1s 2>&1`;
is(
$?,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
$output = `$trunk/bin/pt-replica-restart --max-sleep 0.25 F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12346,u=sha256_user,p=sha256_user%password,s=1 --error-text "doesn't exist" --run-time 1s 2>&1`;
isnt(
$?,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -88,6 +88,76 @@ like(
'It lives',
);
($output, $exit_code) = full_output(
sub { pt_show_grants::main(
'-F', $cnf,
qw(--host 127.1 --port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1),
qw(--drop --flush --revoke --separate)
); },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/Grants dumped by/,
'It lives with option --mysql_ssl',
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_show_grants::main(
'-F', 't/pt-archiver/samples/pt-191.cnf',
'h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1',
qw(--drop --flush --revoke --separate)
); },
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_show_grants::main(
'-F', 't/pt-archiver/samples/pt-191-error.cnf',
'h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1',
qw(--drop --flush --revoke --separate)
); },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use PerconaTest;
use DSNParser;
use Sandbox;
require VersionParser;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('source');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
my $cnf = "/tmp/12345/my.sandbox.cnf";
my $pid_file = "/tmp/pt-stalk.pid.$PID";
my $log_file = "/tmp/pt-stalk.log.$PID";
my $dest = "/tmp/pt-stalk.collect.$PID";
my $int_file = "/tmp/pt-stalk-after-interval-sleep";
my $pid;
sub cleanup {
diag(`rm $pid_file $log_file $int_file 2>/dev/null`);
diag(`rm -rf $dest 2>/dev/null`);
}
my $retval = system("$trunk/bin/pt-stalk -- --no-defaults --protocol socket --socket /dev/null >$log_file 2>&1");
my $output = `cat $log_file`;
# ###########################################################################
# Test if threads collection works
# ###########################################################################
cleanup();
$retval = system("$trunk/bin/pt-stalk --no-stalk --dest $dest --pid $pid_file --iterations 1 -- --defaults-file=$cnf >$log_file 2>&1");
PerconaTest::wait_until(sub { !-f $pid_file });
$output = `ls $dest`;
like(
$output,
qr/threads/,
"threads data collected"
);
$output = `cat $dest/*-threads`;
like(
$output,
qr/(threads)/,
"threads collection has data"
);
cleanup();
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing()

View File

@@ -112,6 +112,46 @@ or diag(
'collector', `cat $dest/*-output 2>/dev/null`,
);
cleanup();
$exit_code = system("$trunk/bin/pt-stalk --host=127.1 --port=12345 --no-stalk --run-time 2 --dest $dest --prefix nostalk --pid $pid_file --iterations 1 --user=sha256_user --password=sha256_user%password -- --defaults-file=t/pt-archiver/samples/pt-191.cnf --ssl-mode=required >$log_file 2>&1");
PerconaTest::wait_until(sub { !-f $pid_file });
$output = `cat $log_file 2>/dev/null`;
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
cleanup();
$exit_code = system("$trunk/bin/pt-stalk --host=127.1 --port=12345 --no-stalk --run-time 2 --dest $dest --prefix nostalk --pid $pid_file --iterations 1 --user=sha256_user --password=sha256_user%password -- --defaults-file=t/pt-archiver/samples/pt-191-error.cnf --ssl-mode=required >$log_file 2>&1");
PerconaTest::wait_until(sub { !-f $pid_file });
$output = `cat $log_file 2>/dev/null`;
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL error: Unable to get private key from/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -0,0 +1,112 @@
#!/usr/bin/env perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use Time::Local;
use PerconaTest;
use Sandbox;
require "$trunk/bin/pt-table-checksum";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('source');
my $output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --buffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
my @lines = split(/\n/, $output);
my @times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
is(
scalar(@times),
2,
"Expected number of timestamp values"
) or diag($output);
my ($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
my $time_ts = timelocal($sec, $min, $hour, $day, $month);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
my $time_tool = timelocal($sec, $min, $hour, $day, $month);
cmp_ok(
$time_ts - $time_tool, 'gt', 1,
"Print delay is expected for the buffered output"
) or diag($output);
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
@lines = split(/\n/, $output);
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
is(
scalar(@times),
2,
"Expected number of timestamp values"
) or diag($output);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
$time_ts = timelocal($sec, $min, $hour, $day, $month);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
$time_tool = timelocal($sec, $min, $hour, $day, $month);
cmp_ok(
$time_ts - $time_tool, 'gt', 1,
"STDOUT is buffered by default"
) or diag($output);
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --no-buffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
@lines = split(/\n/, $output);
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
is(
scalar(@times),
2,
"Expected number of timestamp values"
) or diag($output);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
$time_ts = timelocal($sec, $min, $hour, $day, $month);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
$time_tool = timelocal($sec, $min, $hour, $day, $month);
cmp_ok(
$time_ts - $time_tool, 'le', 1,
"Print delay is not expected when buffering is disabled"
) or diag($output);
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --nobuffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
@lines = split(/\n/, $output);
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
is(
scalar(@times),
2,
"Expected number of timestamp values"
) or diag($output);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
$time_ts = timelocal($sec, $min, $hour, $day, $month);
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
$time_tool = timelocal($sec, $min, $hour, $day, $month);
cmp_ok(
$time_ts - $time_tool, 'le', 1,
"Test 2: Print delay is not expected when buffering is disabled"
) or diag($output);
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

View File

@@ -26,7 +26,7 @@ elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
else {
plan tests => 7;
plan tests => 15;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
@@ -47,11 +47,13 @@ $sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT ALL ON test.* TO sha256_user@'%'/,
q/GRANT SELECT ON test_ssl.* TO sha256_user@'%'/,
q/GRANT ALL ON percona.* TO sha256_user@'%'/,
q/GRANT REPLICATION SLAVE ON *.* TO sha256_user@'%'/,
q/GRANT REPLICATION CLIENT ON *.* TO sha256_user@'%'/,
);
$sb->load_file('source', "t/pt-online-schema-change/samples/ssl_dsns.sql");
$dbh->do("insert into test.foo values (null, 'john, smith')");
($output, $exit_code) = full_output(
@@ -100,6 +102,79 @@ like(
'Checksums the table (issue 388)'
);
($output, $exit_code) = full_output(
sub { pt_table_checksum::main(
@args,
qw(--host 127.1 --port 12345 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1),
qw(-d test)) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
unlike(
$output,
qr/Use of uninitialized value/,
'No error (issue 388) with option --mysql_ssl'
);
like(
$output,
qr/^\S+\s+0\s+0\s+1\s+0\s+1\s+/m,
'Checksums the table (issue 388) with option --mysql_ssl'
);
($output, $exit_code) = full_output(
sub {
pt_table_checksum::main(
@args,
'F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1',
qw(-d test),
"--recursion-method=dsn=F=t/pt-archiver/samples/pt-191.cnf,D=test_ssl,t=dsns,h=127.0.0.1,P=12345,u=sha256_user,p=sha256_user%password,s=1")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_table_checksum::main(@args, 'F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1', qw(-d test)) },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -30,7 +30,7 @@ elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
else {
plan tests => 6;
plan tests => 13;
}
my ($output, $exit_code);
@@ -40,10 +40,14 @@ $sb->do_as_root(
'source',
q/CREATE USER IF NOT EXISTS sha256_user@'%' IDENTIFIED WITH caching_sha2_password BY 'sha256_user%password' REQUIRE SSL/,
q/GRANT ALL ON sakila.* TO sha256_user@'%'/,
q/GRANT ALL ON percona.* TO sha256_user@'%'/,
q/GRANT SELECT ON test_ssl.* TO sha256_user@'%'/,
q/GRANT REPLICATION CLIENT ON *.* TO sha256_user@'%'/,
q/GRANT PROCESS ON *.* TO sha256_user@'%'/,
);
$sb->load_file('source', "t/pt-online-schema-change/samples/ssl_dsns.sql");
($output, $exit_code) = full_output(
sub { pt_table_sync::main('h=127.1,P=12346,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=0', @args) },
stderr => 1,
@@ -84,6 +88,79 @@ like(
"Zero chunk"
);
($output, $exit_code) = full_output(
sub { pt_table_sync::main('D=sakila,t=film',
qw(--host 127.1 --port 12346 --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1), @args) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
like(
$output,
qr/WHERE \(`film_id` = 0\)/,
"Zero chunk with option --mysql_ssl"
);
# Prepare checksums table
diag(`$trunk/bin/pt-table-checksum F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 -d sakila --recursion-method=dsn=F=t/pt-archiver/samples/pt-191.cnf,D=test_ssl,t=dsns,h=127.0.0.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 2>&1 >/dev/null`);
@args = (qw(--recursion-method=dsn --replicate=percona.checksums -t sakila.actor -v -v --print --chunk-size 100));
($output, $exit_code) = full_output(
sub {
pt_table_sync::main(
'F=t/pt-archiver/samples/pt-191,h=127.1,P=12346,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1',
@args,
"--recursion-method=dsn=F=t/pt-archiver/samples/pt-191-replica1.cnf,D=test_ssl,t=dsns,h=127.0.0.1,P=12345,u=sha256_user,p=sha256_user%password,s=1"
) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_table_sync::main(
'F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,D=sakila,t=film,u=sha256_user,p=sha256_user%password,s=1',
@args,
"--recursion-method=dsn=F=t/pt-archiver/samples/pt-191.cnf,D=test_ssl,t=dsns,h=127.0.0.1,P=12345,u=sha256_user,p=sha256_user%password,s=1"
) },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -26,7 +26,7 @@ elsif ( $sandbox_version lt '8.0' ) {
plan skip_all => "Requires MySQL 8.0 or newer";
}
else {
plan tests => 6;
plan tests => 13;
}
my ($output, $exit_code);
@@ -82,6 +82,69 @@ is(
"",
"No error if table doesn't exist"
);
($output, $exit_code) = full_output(
sub { pt_table_usage::main('--explain-extended',
qw(127.1 --port 12345 --database sakila --user sha256_user),
qw(--password sha256_user%password --mysql_ssl 1),
'--query', 'select * from foo, bar where id=1') },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
is(
$output,
"",
"No error if table doesn't exist with option --mysql_ssl"
);
($output, $exit_code) = full_output(
sub { pt_table_usage::main('--explain-extended', "F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,D=sakila,u=sha256_user,p=sha256_user%password,s=1",
'--query', 'select * from foo, bar where id=1') },
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_table_usage::main('--explain-extended', "F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,D=sakila,u=sha256_user,p=sha256_user%password,s=1",
'--query', 'select * from foo, bar where id=1') },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -98,6 +98,77 @@ is(
"Does not fail on SELECT...INTO statements"
);
($output, $exit_code) = full_output(
sub {
pt_upgrade::main("${host1_dsn}",
qw(--user sha256_user --password sha256_user%password --mysql_ssl 1),
'--save-results', $tmpdir,
qw(--type rawlog),
"$samples/select_into.log",
)},
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
is(
$exit_code,
0,
"Does not fail on SELECT...INTO statements with option --mysql_ssl"
);
($output, $exit_code) = full_output(
sub {
pt_upgrade::main("F=t/pt-archiver/samples/pt-191.cnf,${host1_dsn},u=sha256_user,p=sha256_user%password,s=1", '--save-results', $tmpdir,
qw(--type rawlog),
"$samples/select_into.log")
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_upgrade::main("F=t/pt-archiver/samples/pt-191-error.cnf,${host1_dsn},u=sha256_user,p=sha256_user%password,s=1", '--save-results', $tmpdir,
qw(--type rawlog),
"$samples/select_into.log")
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -81,6 +81,64 @@ unlike(
"No innodb_max_dirty_pages_pct warning (bug 1168106)"
);
($output, $exit_code) = full_output(
sub { pt_variable_advisor::main("${dsn}",
qw(--user sha256_user --password sha256_user%password --mysql_ssl 1)) },
stderr => 1,
);
is(
$exit_code,
0,
"No error for user, identified with caching_sha2_password with option --mysql_ssl"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with option --mysql_ssl'
) or diag($output);
unlike(
$output,
qr/innodb_max_dirty_pages_pct/,
"No innodb_max_dirty_pages_pct warning (bug 1168106) with option --mysql_ssl"
);
($output, $exit_code) = full_output(
sub { pt_variable_advisor::main("F=t/pt-archiver/samples/pt-191.cnf,${dsn},u=sha256_user,p=sha256_user%password,s=1") },
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub { pt_variable_advisor::main("F=t/pt-archiver/samples/pt-191-error.cnf,${dsn},u=sha256_user,p=sha256_user%password,s=1") },
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -80,6 +80,51 @@ unlike(
'No secure connection error'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_visual_explain::main(
'--connect',
't/pt-visual-explain/samples/query.sql',
qw(-F t/pt-archiver/samples/pt-191.cnf --host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1)
)
},
stderr => 1,
);
is(
$exit_code,
0,
"No error for SSL options in the configuration file"
) or diag($output);
unlike(
$output,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'No secure connection error with correct SSL options in the configuration file'
) or diag($output);
($output, $exit_code) = full_output(
sub {
pt_visual_explain::main(
'--connect',
't/pt-visual-explain/samples/query.sql',
qw(-F t/pt-archiver/samples/pt-191-error.cnf --host=127.1 --port=12345 --user=sha256_user --password=sha256_user%password --mysql_ssl=1)
)
},
stderr => 1,
);
isnt(
$exit_code,
0,
"Error for invalid SSL options in the configuration file"
) or diag($output);
like(
$output,
qr/SSL connection error: Unable to get private key at/,
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);
# #############################################################################
# Done.

Binary file not shown.