pt-table-checksum: Use of uninitialized value $host in concatenation (.) or string

Hi there,

I am trying to learn Percona Toolkit and I stuck with an error when running “pt-table-checksum” command. I already have a 3 node cluster (1 garbd + 2 percona “real” nodes) and I get an error while trying to run the following command:

root@draco01:~# pt-table-checksum --recursion-method=cluster --replicate-check-only
Use of uninitialized value $host in concatenation (.) or string at /usr/bin/pt-table-checksum line 3765.

I ran the same with debugging to try to get some clue with no luck:

root@draco01:~# PTDEBUG=1 pt-table-checksum --recursion-method=cluster --replicate-check-only
# /usr/bin/perl 5.014002
# Linux draco01 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
# Arguments: _[--recursion-method=cluster]_ _[--replicate-check-only]_
(...)
# $DBD::mysql::VERSION: 4.021 $DBI::VERSION: 1.622
# Cxn:3578 1152 DBI::db=HASH(0x24e8530) Setting dbh
# Cxn:3583 1152 DBI::db=HASH(0x24e8530) SELECT @@server_id /*!50038 , @@hostname*/
# Cxn:3585 1152 DBI::db=HASH(0x24e8530) hostname: draco01 0
# VersionParser:4139 1152 VersionParser got a dbh, trying to get the version
# VersionParser:4187 1152 InnoDB support: DEFAULT
# VersionParser:4199 1152 InnoDB version: 5.5.34-rel32.0
# pt_table_checksum:9094 1152 DBI::db=HASH(0x24e8530) SELECT @@binlog_format
# pt_table_checksum:9096 1152 Original binlog_format: ROW
# pt_table_checksum:9100 1152 DBI::db=HASH(0x24e8530) /*!50108 SET @@binlog_format := 'STATEMENT'*/
# pt_table_checksum:9127 1152 DBI::db=HASH(0x24e8530) SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
# Cxn:3566 1152 DBI::db=HASH(0x24e8530) Connected dbh to draco01 h=localhost
# Percona::XtraDB::Cluster:3720 1152 draco01 SHOW VARIABLES LIKE 'wsrep_on'
# Percona::XtraDB::Cluster:3722 1152 $VAR1 = [
# 'wsrep_on',
# 'ON'
# ];
#
# Percona::XtraDB::Cluster:3711 1152 draco01 SHOW VARIABLES LIKE 'wsrep_cluster_name'
# VersionParser:4139 1152 VersionParser got a dbh, trying to get the version
# VersionParser:4187 1152 InnoDB support: DEFAULT
# VersionParser:4199 1152 InnoDB version: 5.5.34-rel32.0
# pt_table_checksum:9256 1152 Cxn=HASH(0x24def80) DBI::db=HASH(0x24e8530) SELECT @@server_id
# Percona::XtraDB::Cluster:3754 1152 SHOW STATUS LIKE 'wsrep\_incoming\_addresses'
# Percona::XtraDB::Cluster:3756 1152 Cluster nodes found: 192.168.10.210:3306,,192.168.10.211:3306
# DSNParser:1405 1152 Parsing h=192.168.10.210,P=3306
(...)
# DSNParser:1518 1152 DBI:mysql:;host=192.168.10.210;port=3306;mysql_read_default_group=client
# DSNParser:1567 1152 DBI:mysql:;host=192.168.10.210;port=3306;mysql_read_default_group=client undef undef mysql_enable_utf8=>0, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0
# DSNParser:1595 1152 DBI::db=HASH(0x24f00a8) SELECT @@SQL_MODE
# DSNParser:1726 1152 DBI::db=HASH(0x24f00a8) SET SESSION innodb_lock_wait_timeout=1
# DSNParser:1726 1152 DBI::db=HASH(0x24f00a8) SET SESSION wait_timeout=10000
# DSNParser:1626 1152 DBI::db=HASH(0x24f00a8) SET @@SQL_QUOTE_SHOW_CREATE = 1/*!40101, @@SQL_MODE='NO_AUTO_VALUE_ON_ZERO'*/
# DSNParser:1635 1152 DBH info: DBI::db=HASH(0x24f00a8) $VAR1 = {
# '@@hostname' => 'draco01',
# 'CONNECTION_ID()' => '154',
# 'DATABASE()' => undef,
# 'VERSION()' => '5.5.34-31.1-log'
# };
(...)
# $DBD::mysql::VERSION: 4.021 $DBI::VERSION: 1.622
# Percona::XtraDB::Cluster:3779 1152 Connected to P=3306,h=192.168.10.210
(...)
# DSNParser:1518 1152 DBI:mysql:;host=192.168.10.210;port=3306;mysql_read_default_group=client
# DSNParser:1567 1152 DBI:mysql:;host=192.168.10.210;port=3306;mysql_read_default_group=client undef undef mysql_enable_utf8=>0, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0
# DSNParser:1595 1152 DBI::db=HASH(0x24ef970) SELECT @@SQL_MODE
# DSNParser:1726 1152 DBI::db=HASH(0x24ef970) SET SESSION innodb_lock_wait_timeout=1
# DSNParser:1726 1152 DBI::db=HASH(0x24ef970) SET SESSION wait_timeout=10000
# DSNParser:1626 1152 DBI::db=HASH(0x24ef970) SET @@SQL_QUOTE_SHOW_CREATE = 1/*!40101, @@SQL_MODE='NO_AUTO_VALUE_ON_ZERO'*/
# DSNParser:1635 1152 DBH info: DBI::db=HASH(0x24ef970) $VAR1 = {
# '@@hostname' => 'draco01',
# 'CONNECTION_ID()' => '155',
# 'DATABASE()' => undef,
# 'VERSION()' => '5.5.34-31.1-log'
# };
(...)
# $DBD::mysql::VERSION: 4.021 $DBI::VERSION: 1.622
# Cxn:3578 1152 DBI::db=HASH(0x24ef970) Setting dbh
# Cxn:3583 1152 DBI::db=HASH(0x24ef970) SELECT @@server_id /*!50038 , @@hostname*/
# Cxn:3585 1152 DBI::db=HASH(0x24ef970) hostname: draco01 0
# Cxn:3566 1152 DBI::db=HASH(0x24ef970) Connected dbh to draco01 h=192.168.10.210,P=3306
# Percona::XtraDB::Cluster:3720 1152 draco01 SHOW VARIABLES LIKE 'wsrep_on'
# Percona::XtraDB::Cluster:3722 1152 $VAR1 = [
# 'wsrep_on',
# 'ON'
# ];
#
# Percona::XtraDB::Cluster:3711 1152 draco01 SHOW VARIABLES LIKE 'wsrep_cluster_name'
Use of uninitialized value $host in concatenation (.) or string at /usr/bin/pt-table-checksum line 3765.
# Cxn:3656 1152 Destroying cxn
# Cxn:3665 1152 DBI::db=HASH(0x24ef970) Disconnecting dbh on draco01 h=192.168.10.210,P=3306
# Cxn:3656 1152 Destroying cxn
# Cxn:3665 1152 DBI::db=HASH(0x24e8530) Disconnecting dbh on draco01 h=localhost

I did check that cluster nodes get listed in order for the “–recursion-method=cluster” to work:

mysql> SHOW STATUS LIKE 'wsrep\_incoming\_addresses';
+--------------------------+------------------------------------------+
| Variable_name | Value |
+--------------------------+------------------------------------------+
| wsrep_incoming_addresses | 192.168.10.210:3306,,192.168.10.211:3306 |
+--------------------------+------------------------------------------+
1 row in set (0.00 sec)

I don’t know if I am missing something. Any help is appreciated.

PS. Had to cut some output (…) due to forum restrictions.

Kind regards.

Some days ago I had the same experience with a similar error message:

Use of uninitialized value $host in string eq at /usr/bin/pt-table-checksum line 5094.

I started first looking at the Father Google to check if someone else has registered something related to it. I found some pages speaking about the same problem but not too many answers. So, I decided to hack the code and commented the following lines to make it to work in my scenario in which I was using [COLOR=#FF0000]–recursion-method=none. So, this way I’m not checking slaves to run checksum…

Commented lines for /usr/bin/pt-table-checksum

5092 map {
5093 my ( $host ) = $_->{host} =~ m/^([^:]+):/;
5094 # if ( $host eq 'localhost' ) {
5095 # $host = '127.0.0.1'; # Replication never uses sockets.
5096 # }
5097 #$host;
5098 } $self->get_connected_slaves($dbh);

pt-table-checksum version

[wb@box19875467 ~] pt-table-checksum --version
pt-table-checksum 2.2.11

Checksum command

pt-table-checksum --host=10.1.1.215 --no-check-binlog-format --no-check-replication-filters --replicate percona.checksum --recursion-method=none --float-precision 6 --max-load="Threads_running=600"

I have to add here there when following what I did, you’re doing that on you own risk.

Cheers,