pt-online-schema-change: Use of uninitialized value $host in string
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
New
|
Undecided
|
Unassigned |
Bug Description
We tried to run on a customer's side identically like the command below:
pt-online-
and we encountered this error:
Use of uninitialized value $host in string eq at /usr/bin/
Upon checking with the PTDEBUG=1, it shows the following:
# Cxn:3886 18596 DBI::db=
# Cxn:3891 18596 DBI::db=
# Cxn:3893 18596 DBI::db=
# Cxn:3874 18596 DBI::db=
# MasterSlave:4218 18596 Looking for slaves on D=somedb,
# MasterSlave:4225 18596 Finding slaves with _find_slaves_
# MasterSlave:4287 18596 DBI::db=
# MasterSlave:4317 18596 DBI::db=
Use of uninitialized value $host in string eq at /usr/bin/
# Cxn:4012 18596 Destroying cxn
# Cxn:4021 18596 DBI::db=
# Cxn:4012 18596 Destroying cxn
# Cxn:4021 18596 DBI::db=
# Cxn:4012 18596 Destroying cxn
# Cxn:4021 18596 DBI::db=
# Cxn:4012 18596 Destroying cxn
# Cxn:4021 18596 DBI::db=
Upon checking the line, I got this line of code (based on the line from error: Use of uninitialized value $host in string eq at /usr/bin/
$ vim /usr/bin/
4234 sub _find_slaves_
4235 my ( $self, $dsn_parser, $dbh, $dsn ) = @_;
4236
4237 my @slaves = map {
4238 my $slave = $dsn_parser-
4239 $slave->{source} = 'processlist';
4240 $slave;
4241 }
4242 grep { $_ }
4243 map {
4244 my ( $host ) = $_->{host} =~ m/^([^:]+):/;
4245 if ( $host eq 'localhost' ) {
4246 $host = '127.0.0.1'; # Replication never uses sockets.
4247 }
4248 $host;
4249 } $self->
4250
4251 return @slaves;
4252 }
The bug occurs there as it seems that the host it tries to detect is empty or null as it seems that it fails here -> my ( $host ) = $_->{host} =~ m/^([^:]+):/;
but it founds a host that has no "semi-colon", for example "localhost"
Based on the processlist, I see this:
| 1 | event_scheduler | localhost | NULL | Daemon | 40041 | Waiting for next activation | NULL |
| 9 | someuser | 10.15.11.23:50630 | NULL | Binlog Dump | 1031379 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL |
| 17 | someuser | 10.15.11.52:57571 | NULL | Binlog Dump | 1031369 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL |
| 18 | someuser | 10.19.11.31:54500 | NULL | Binlog Dump | 1031369 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL |
| 284044 | someuser | 10.15.11.145:55431 | NULL | Binlog Dump | 843843 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL |
So the bug occurs there.
The work-around on this is to use --recursion-
Version:
~ #> pt-online-
pt-online-
description: | updated |
Percona now uses JIRA for bug reports so this bug report is migrated to: https:/ /jira.percona. com/browse/ PT-1344