pt-table-sync fail to connect to IPv6 slaves

Bug #1539500 reported by MihVan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

In _find_slaves_by_processlist subroutine, a regular expression is used to split port from host.
It does not work correctly for IPv6 addresses.

For example:
the original Host value, returned by MySQL is 2a00:f100:400:2:44a:acff:fe00:33f:36232
After parsing with "$_->{host} =~ m/^([^:]+):/" (line 6746) - only "2a00" is left.

The possibly correct regex is "m/^(.+):\d+$/".
Also, square brackets must be added before and after IPv6 address, so that DBD::MySQL parses DSN correctly.
So "[2a00:f100:400:2:44a:acff:fe00:33f]" in above example.

Required info:
Command line: pt-table-sync --execute localhost --replicate filter._checksums --verbose --noversion-check --lock=0
Version: pt-table-sync 2.2.15
MySQL: MariaDB 10.0.21

Relevant part of output:
# MasterSlave:6732 16423 Found 6 slaves
# MasterSlave:6709 16423 Recursing from h=localhost to h=2a00
# MasterSlave:6666 16423 Recursion methods: processlist hosts
# DSNParser:2169 16423 DBI:mysql:;host=2a00;mysql_read_default_group=client
# DSNParser:2218 16423 DBI:mysql:;host=2a00;mysql_read_default_group=client undef undef ShowErrorStatement=>1, RaiseError=>1, AutoCommit=>1, mysql_enable_utf8=>0, PrintError=>0
# DSNParser:2218 16423 DBI:mysql:;host=2a00;mysql_read_default_group=client undef undef ShowErrorStatement=>1, RaiseError=>1, AutoCommit=>1, mysql_enable_utf8=>0, PrintError=>0
Cannot connect to h=2a00

Tags: ipv6
Revision history for this message
MihVan (spir-sp) wrote :

You can check my fix here: https://github.com/miihael/percona-toolkit/commit/407d94fec12730742c85a0687ad6c6de4599b99e

Also, DBD:MySQL version 4.033 is the requirement for IPv6 addresses to work correctly.

Revision history for this message
Nickolay Ihalainen (ihanick) wrote :

In addition to ':' ipv6 addresses could be link local (e.g. contain %eth0 )

root@9e8221561c7d:/# ./pt-table-sync --user=root --password=123456 --execute localhost --replicate filter._checksums --verbose --noversion-check --lock=0
Cannot connect to h=fe80,p=...,u=root
root@9e8221561c7d:/# mysql -p123456 -e 'show processlist'
Warning: Using a password on the command line interface can be insecure.
+----+------+---------------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
| Id | User | Host | db | Command | Time | State | Info | Rows_sent | Rows_examined |
+----+------+---------------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
| 5 | root | fe80::42:acff:fe11:7%eth0:42542 | NULL | Binlog Dump | 435 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL | 0 | 0 |
| 11 | root | localhost | NULL | Query | 0 | init | show processlist | 0 | 0 |
+----+------+---------------------------------+------+-------------+------+-----------------------------------------------------------------------+------------------+-----------+---------------+
root@9e8221561c7d:/# mysql --host='fe80::42:acff:fe11:7%eth0' -p123456 -e 'select 1'
Warning: Using a password on the command line interface can be insecure.
+---+
| 1 |
+---+
| 1 |

Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1324

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.