diff --git a/bin/pt-archiver b/bin/pt-archiver index c868cbc4..7613ba3b 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -45,7 +45,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -3744,7 +3744,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-config-diff b/bin/pt-config-diff index 4ef5d6a3..b8735848 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -43,7 +43,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index 6c15fd99..196e9ad9 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -42,7 +42,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-diskstats b/bin/pt-diskstats index f26ac5ab..64935688 100755 --- a/bin/pt-diskstats +++ b/bin/pt-diskstats @@ -38,7 +38,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index e5f83d8f..ea4762a1 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -39,7 +39,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-find b/bin/pt-find index 1a1fbbb2..777e31fe 100755 --- a/bin/pt-find +++ b/bin/pt-find @@ -35,7 +35,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-fk-error-logger b/bin/pt-fk-error-logger index 497e7f3d..192bcf05 100755 --- a/bin/pt-fk-error-logger +++ b/bin/pt-fk-error-logger @@ -37,7 +37,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-heartbeat b/bin/pt-heartbeat index da52e9d2..4be206d7 100755 --- a/bin/pt-heartbeat +++ b/bin/pt-heartbeat @@ -44,7 +44,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -112,22 +112,22 @@ use warnings FATAL => 'all'; use English qw(-no_match_vars); use constant PTDEBUG => $ENV{PTDEBUG} || 0; -sub check_recursion_method { +sub check_recursion_method { my ($methods) = @_; - if ( @$methods != 1 ) { - if ( grep({ !m/processlist|hosts/i } @$methods) - && $methods->[0] !~ /^dsn=/i ) - { - die "Invalid combination of recursion methods: " - . join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". " - . "Only hosts and processlist may be combined.\n" - } - } - else { + if ( @$methods != 1 ) { + if ( grep({ !m/processlist|hosts/i } @$methods) + && $methods->[0] !~ /^dsn=/i ) + { + die "Invalid combination of recursion methods: " + . join(", ", map { defined($_) ? $_ : 'undef' } @$methods) . ". " + . "Only hosts and processlist may be combined.\n" + } + } + else { my ($method) = @$methods; - die "Invalid recursion method: " . ( $method || 'undef' ) - unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i; - } + die "Invalid recursion method: " . ( $method || 'undef' ) + unless $method && $method =~ m/^(?:processlist$|hosts$|none$|cluster$|dsn=)/i; + } } sub new { @@ -156,7 +156,7 @@ sub get_slaves { my $methods = $self->_resolve_recursion_methods($args{dsn}); return $slaves unless @$methods; - + if ( grep { m/processlist|hosts/i } @$methods ) { my @required_args = qw(dbh dsn); foreach my $arg ( @required_args ) { @@ -201,7 +201,7 @@ sub get_slaves { else { die "Unexpected recursion methods: @$methods"; } - + return $slaves; } @@ -320,7 +320,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } @@ -719,7 +719,7 @@ sub short_host { } sub is_replication_thread { - my ( $self, $query, %args ) = @_; + my ( $self, $query, %args ) = @_; return unless $query; my $type = lc($args{type} || 'all'); @@ -734,7 +734,7 @@ sub is_replication_thread { if ( !$match ) { if ( ($query->{User} || $query->{user} || '') eq "system user" ) { PTDEBUG && _d("Slave replication thread"); - if ( $type ne 'all' ) { + if ( $type ne 'all' ) { my $state = $query->{State} || $query->{state} || ''; if ( $state =~ m/^init|end$/ ) { @@ -747,7 +747,7 @@ sub is_replication_thread { |Reading\sevent\sfrom\sthe\srelay\slog |Has\sread\sall\srelay\slog;\swaiting |Making\stemp\sfile - |Waiting\sfor\sslave\smutex\son\sexit)/xi; + |Waiting\sfor\sslave\smutex\son\sexit)/xi; $match = $type eq 'slave_sql' && $slave_sql ? 1 : $type eq 'slave_io' && !$slave_sql ? 1 @@ -811,7 +811,7 @@ sub get_replication_filters { replicate_do_db replicate_ignore_db replicate_do_table - replicate_ignore_table + replicate_ignore_table replicate_wild_do_table replicate_wild_ignore_table ); @@ -822,7 +822,7 @@ sub get_replication_filters { $filters{slave_skip_errors} = $row->[1] if $row->[1] && $row->[1] ne 'OFF'; } - return \%filters; + return \%filters; } diff --git a/bin/pt-index-usage b/bin/pt-index-usage index d400fd07..2f2cf639 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -45,7 +45,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-kill b/bin/pt-kill index dc0b67df..7a5f17c2 100755 --- a/bin/pt-kill +++ b/bin/pt-kill @@ -47,7 +47,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -4026,7 +4026,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index 54c97e31..b27187f4 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -56,7 +56,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -4281,8 +4281,7 @@ sub recurse_to_slaves { PTDEBUG && _d('Connected to', $dp->as_string($slave_dsn)); }; if ( $EVAL_ERROR ) { - #TODO REMOVE DEBUG - print STDERR "1> Cannot connect to ", $dp->as_string($slave_dsn), "\n" + print STDERR "Cannot connect to ", $dp->as_string($slave_dsn), "\n" or die "Cannot print: $OS_ERROR"; return; } @@ -4349,7 +4348,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 90d31679..d22fdcf6 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -64,7 +64,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -10674,7 +10674,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay index 75793b48..a973bb70 100755 --- a/bin/pt-slave-delay +++ b/bin/pt-slave-delay @@ -40,7 +40,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-slave-find b/bin/pt-slave-find index 5c18448f..e9d08a45 100755 --- a/bin/pt-slave-find +++ b/bin/pt-slave-find @@ -2434,7 +2434,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-slave-restart b/bin/pt-slave-restart index dabb81b9..dcbca789 100755 --- a/bin/pt-slave-restart +++ b/bin/pt-slave-restart @@ -41,7 +41,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -2845,7 +2845,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 92c0edcd..a83b4cc9 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -58,7 +58,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -5298,7 +5298,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-table-sync b/bin/pt-table-sync index 036a449d..688cda5f 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -55,7 +55,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; @@ -6843,7 +6843,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 60d0ed85..dddb0181 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -61,7 +61,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/bin/pt-variable-advisor b/bin/pt-variable-advisor index 370a1eef..2ed6f586 100755 --- a/bin/pt-variable-advisor +++ b/bin/pt-variable-advisor @@ -44,7 +44,7 @@ BEGIN { { package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/lib/MasterSlave.pm b/lib/MasterSlave.pm index 5bb628d3..dea0636b 100644 --- a/lib/MasterSlave.pm +++ b/lib/MasterSlave.pm @@ -271,7 +271,7 @@ sub _find_slaves_by_processlist { } grep { $_ } map { - my ( $host ) = $_->{host} =~ m/^([^:]+):/; + my ( $host ) = $_->{host} =~ m/^(.*):\d+$/; if ( $host eq 'localhost' ) { $host = '127.0.0.1'; # Replication never uses sockets. } diff --git a/lib/Percona/Toolkit.pm b/lib/Percona/Toolkit.pm index d3759430..74daca35 100644 --- a/lib/Percona/Toolkit.pm +++ b/lib/Percona/Toolkit.pm @@ -18,7 +18,7 @@ # ########################################################################### package Percona::Toolkit; -our $VERSION = '3.0.13'; +our $VERSION = '3.0.14-dev'; use strict; use warnings FATAL => 'all'; diff --git a/t/lib/DSNParser.t b/t/lib/DSNParser.t index e80469bb..3a12e428 100644 --- a/t/lib/DSNParser.t +++ b/t/lib/DSNParser.t @@ -632,6 +632,20 @@ SKIP: { $dbh->disconnect(); } +is_deeply( + $dp->parse('h=f000::1,P=12345,u=msandbox,p=msandbox'), + { u => 'msandbox', + p => 'msandbox', + S => undef, + h => 'f000::1', + P => '12345', + F => undef, + D => undef, + A => undef, + }, + 'IPV6 support' +); + # ############################################################################# # Done. # #############################################################################