# Pt-table-sync "unitialized value in concatenation" error

**URL:** https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710
**Category:** Percona Toolkit
**Created:** [February 14, 2025, 5:59am UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710 "2025-02-14T05:59:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nstretch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nstretch/32/20148_2.png) [@nstretch](https://forums.percona.com/u/nstretch)
#### Post date: [February 14, 2025, 5:59am UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/1 "2025-02-14T05:59:44Z")

</div>

I’ve been using pt-table-sync for a number of years to recover from database sync issues in MySQL and more recently MariaDB. It has been working without issue on our current servers for some time. No when I try to use it though, I always get the same error:

```auto
[root@host1 ~]# pt-table-sync --execute --databases=my_database --sync-to-source host1
Use of uninitialized value in concatenation (.) or string at /usr/bin/pt-table-sync line 7086.

[root@host1 ~]# pt-table-sync --version
pt-table-sync 3.7.0

```

I’m guessing this is a result from updating to 3.7.0, though I’m not sure how long we’ve been on that version, so couldn’t say for sure. Is this a bug, or am I doing something wrong here?

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [February 14, 2025, 11:07pm UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/2 "2025-02-14T23:07:14Z")

</div>

Hi @nstretch ,  
Have you looked at the source code at line 7086? Perhaps that can give you some insight as to the issue?

---

<div class="post-metadata">

### Author: ![nstretch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nstretch/32/20148_2.png) [@nstretch](https://forums.percona.com/u/nstretch)
#### Post date: [February 15, 2025, 12:40am UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/3 "2025-02-15T00:40:15Z")

</div>

Line 7086 is the last line of this function before the return:

```auto
sub get_source_dsn {
   my ( $self, $dbh, $dsn, $dsn_parser ) = @_;

   my $vp = VersionParser->new($dbh);
   my $source_host = 'source_host';
   my $source_port = 'source_port';
   if ( $vp lt '8.1' || $vp->flavor() =~ m/maria/ ) {
      $source_host = 'master_host';
      $source_port = 'master_port';
   }

   my $source = $self->get_replica_status($dbh) or return undef;
   my $spec = "h=$source->{${source_host}},P=$source->{${source_port}}";
   return $dsn_parser->parse($spec, $dsn);
}

```

I added some debugging printouts, and it appears the problem is that it’s looking for source\_host and source\_port in $source, but these don’t exist; instead master\_host and master\_port are present. But the ($vp lt ‘8.1’ || $vp-\>flavor() =~ m/maria/) test is returning false.

Looks like that’s because flavor() returns “MariaDB Server”, which doesn’t match because the test is case sensitive. Changing to m/maria/i fixes that. There are several other places throughout the script where the same check for MariaDB is done (maybe it would be better for it just to be checked once and saved?) so I needed to update all of them.

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [February 15, 2025, 12:50am UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/4 "2025-02-15T00:50:27Z")

</div>

Good diagnosis. Please open a bug report and provide this info at [https://jira.percona.com/](https://jira.percona.com/)  
CC: @svetasmirnova

---

<div class="post-metadata">

### Author: ![nstretch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nstretch/32/20148_2.png) [@nstretch](https://forums.percona.com/u/nstretch)
#### Post date: [February 15, 2025, 2:23am UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/5 "2025-02-15T02:23:56Z")

</div>

I would, but I can’t seem to log in to the Percona Jira, just keep getting redirected back to the login screen. Anyway, hopefully the report here helps.

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [February 15, 2025, 4:00pm UTC](https://forums.percona.com/t/pt-table-sync-unitialized-value-in-concatenation-error/36710/6 "2025-02-15T16:00:27Z")

</div>

I filed the bug for you since you were having login issues.  
[https://perconadev.atlassian.net/browse/PT-2425](https://perconadev.atlassian.net/browse/PT-2425)
