# Pt-table-checksum 3.7.1: SHOW REPLICAS issued against MariaDB on builds with non-default version\_comment

**URL:** <https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774>\
**Category:** Percona Toolkit\
**Created:** [May 10, 2026, 11:25pm UTC](https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774 "2026-05-10T23:25:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samjvaughan](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@samjvaughan](https://forums.percona.com/u/samjvaughan)\
**Post date:** [May 10, 2026, 11:25pm UTC](https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774/1 "2026-05-10T23:25:20Z")

</div>

(apologies - tried to submit on Jira but I get persistent “you are not authorised” errors)

# pt-table-checksum 3.7.1: `SHOW REPLICAS` issued against MariaDB on builds with non-default `version_comment`

## Summary

`pt-table-checksum` 3.7.1 crashes with a `SHOW REPLICAS` syntax error against MariaDB when replica discovery falls through to the `hosts` recursion method. The MariaDB-flavor detection in `_find_replicas_by_hosts` regex-matches `m/maria/i` against the `version_comment` system variable, but distribution builds that override `version_comment` defeat this check. The FreeBSD ports build of MariaDB sets `version_comment` to `FreeBSD Ports` (not `MariaDB Server`), so detection fails and the tool issues `SHOW REPLICAS` — a MySQL 8.1+ statement that doesn’t exist in MariaDB.

3.5.2 was unaffected because it issued `SHOW SLAVE HOSTS` unconditionally.

## Affected versions

- pt-table-checksum 3.7.1 (3.7.0 likely also affected)
- Not present in 3.5.2

## Environment

- MariaDB 10.11.16 (`mariadb1011-server` from FreeBSD ports)
- FreeBSD 14.3
- percona-toolkit 3.7.1 from FreeBSD ports
- `version` = `10.11.16-MariaDB-log`
- `version_comment` = `FreeBSD Ports`

## Reproduction

On a master with at least one connected replica, against a MariaDB build whose `version_comment` does not contain the string “MariaDB”:

```auto
$ mysql -e "SHOW VARIABLES LIKE 'version%'"
+-------------------------+----------------------+
| Variable_name | Value |
+-------------------------+----------------------+
| version | 10.11.16-MariaDB-log |
| version_comment | FreeBSD Ports |
...

$ pt-table-checksum --replicate-check-only
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version
for the right syntax to use near 'REPLICAS' at line 1
[for Statement "SHOW REPLICAS"]
at /usr/local/bin/pt-table-checksum line 5463.

```

## Observed behaviour

Crash with `SHOW REPLICAS` syntax error from the leaf-level replica during recursive discovery.

## Expected behaviour

The tool should detect the server as MariaDB and issue `SHOW SLAVE HOSTS`.

## Root cause

In `_find_replicas_by_hosts` (`bin/pt-table-checksum`, around line 5449 in v3.7.1):

```perl
my $vp = VersionParser->new($dbh);
my $sql = 'SHOW REPLICAS';
my $source_name = 'source';
if ( $vp lt '8.1' || $vp->flavor() =~ m/maria/i ) {
   $sql = 'SHOW SLAVE HOSTS';
   $source_name='master';
}

```

`VersionParser::BUILDARGS` populates `flavor` from the `version_comment` MySQL variable. Detection therefore only succeeds for builds that include “MariaDB” in `version_comment` — typically `MariaDB Server` from upstream. Any downstream build that overrides `version_comment` (FreeBSD ports uses `FreeBSD Ports`; other distributions/vendors may do similar) fails the regex even though the server is unambiguously MariaDB.

Two things make the bug worse in practice:

1. The `version` variable (`10.11.16-MariaDB-log`) reliably contains the string `MariaDB` regardless of distribution branding, but it isn’t consulted.
2. Level-0 replica discovery uses `processlist` by default and succeeds, hiding the bug from casual inspection. `pt-table-checksum` then recurses into each discovered replica looking for further replicas; at the leaf level `processlist` returns empty and the tool falls through to the `hosts` method, which is where the crash occurs. On a two-node topology (one master, one replica) the recursion into the replica is what trips the bug; users on this topology may believe `hosts` is never used.

## Suggested fix

Also test the `version` string for “MariaDB”:

```diff
    my $vp = VersionParser->new($dbh);
    my $sql = 'SHOW REPLICAS';
    my $source_name = 'source';
- if ( $vp lt '8.1' || $vp->flavor() =~ m/maria/i ) {
+ if ( $vp lt '8.1'
+ || $vp->flavor() =~ m/maria/i
+ || $vp->version() =~ m/maria/i ) {
       $sql = 'SHOW SLAVE HOSTS';
       $source_name='master';
    }

```

`version` is server-side and reliable across distribution rebrands. The same gap likely exists in other tools that use `VersionParser->flavor()` for MariaDB detection; a more thorough fix would be to make `VersionParser` itself fall back to `version` when `version_comment` doesn’t disambiguate.

## Workaround

Pass `--recursion-method=processlist` so that `_find_replicas_by_hosts` is never reached. Documented behaviour of this option already calls out that `hosts`-based discovery is unreliable, but the failure mode in this case is a hard crash rather than missed replicas.

---

<div class="post-metadata">

**Author:** ![svetasmirnova](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/svetasmirnova/32/21_2.png) [@svetasmirnova](https://forums.percona.com/u/svetasmirnova)\
**Post date:** [May 11, 2026, 4:11pm UTC](https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774/2 "2026-05-11T16:11:24Z")

</div>

Thank you for reporting the issue. Please report it also at [jira.percona.com](http://jira.percona.com)

---

<div class="post-metadata">

**Author:** ![samjvaughan](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@samjvaughan](https://forums.percona.com/u/samjvaughan)\
**Post date:** [May 11, 2026, 10:13pm UTC](https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774/3 "2026-05-11T22:13:51Z")

</div>

I tried to but it won’t let me. No matter what I try I get persistent “you are not authorised” errors.

---

<div class="post-metadata">

**Author:** ![samjvaughan](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@samjvaughan](https://forums.percona.com/u/samjvaughan)\
**Post date:** [May 14, 2026, 10:58pm UTC](https://forums.percona.com/t/pt-table-checksum-3-7-1-show-replicas-issued-against-mariadb-on-builds-with-non-default-version-comment/40774/4 "2026-05-14T22:58:52Z")

</div>

Now reported on Jira with updated notes.

[https://perconadev.atlassian.net/browse/DISTMYSQL-595?atlOrigin=eyJpIjoiYmU5YWViMmE0ODM4NGYxYWJkNTYxMzVlY2MwYzMzYWYiLCJwIjoiaiJ9](https://perconadev.atlassian.net/browse/DISTMYSQL-595?atlOrigin=eyJpIjoiYmU5YWViMmE0ODM4NGYxYWJkNTYxMzVlY2MwYzMzYWYiLCJwIjoiaiJ9)
