fix(dump): pass --column-statistics=0 for MySQL 8 mysqldump on MariaDB, release as 0.0.7 #17

Merged
haylan merged 2 commits from fix/0.0.7-column-statistics into main 2026-11-02 22:39:42 +00:00
Owner

User description

Backport for the Shopware 6.6 line. When the server is MariaDB but only
MySQL 8's mysqldump is installed (e.g. dockware/web), the dump aborted
with "Unknown table 'COLUMN_STATISTICS' in information_schema (1109)".

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com


PR Type

Bug fix, Tests


Description

  • Add --column-statistics=0 for MySQL 8 clients.

  • Detect MariaDB server and MySQL client version.

  • Apply flag only when needed.

  • Add tests and release 0.0.7.


Diagram Walkthrough

flowchart LR
  A["DumpService"] -- "builds command" --> B["DumpBinaryLocator"]
  B -- "runs --version" --> C["MySqlVariant"]
  C -- "decides flag" --> D["--column-statistics=0"]
  D -- "added to command" --> A

File Walkthrough

Relevant files
Bug fix
DumpBinaryLocator.php
Add binary-specific dump flags for clients                             

src/Service/DumpBinaryLocator.php

  • Adds extraArguments() to inspect binary version.
  • Returns --column-statistics=0 when needed.
  • Uses Process to run --version.
+14/-0   
DumpService.php
Include extra dump flags in command                                           

src/Service/DumpService.php

  • Spreads extraArguments() into dump command.
  • Includes client-specific flags before connection options.
+1/-0     
MySqlVariant.php
Detect MySQL 8 client compatibility                                           

src/Service/MySqlVariant.php

  • Adds needsColumnStatisticsOff() helper.
  • Detects MySQL 8+ client on MariaDB server.
  • Parses Distrib or Ver version numbers.
+14/-0   
Tests
MySqlVariantTest.php
Add column statistics flag tests                                                 

tests/Service/MySqlVariantTest.php

  • Adds tests for needsColumnStatisticsOff().
  • Covers MySQL 8, 5.7, and MariaDB clients.
+16/-0   
Documentation
CHANGELOG.md
Document version 0.0.7 dump fix                                                   

CHANGELOG.md

  • Adds 0.0.7 release entry.
  • Documents MariaDB COLUMN_STATISTICS dump fix.
+6/-0     
Configuration changes
composer.json
Bump plugin version to 0.0.7                                                         

composer.json

  • Bumps version from 0.0.6 to 0.0.7.
+1/-1     

<!-- pr-agent-generated --> ### **User description** Backport for the Shopware 6.6 line. When the server is MariaDB but only MySQL 8's mysqldump is installed (e.g. dockware/web), the dump aborted with "Unknown table 'COLUMN_STATISTICS' in information_schema (1109)". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Add `--column-statistics=0` for MySQL 8 clients. - Detect MariaDB server and MySQL client version. - Apply flag only when needed. - Add tests and release `0.0.7`. ___ ### Diagram Walkthrough ```mermaid flowchart LR A["DumpService"] -- "builds command" --> B["DumpBinaryLocator"] B -- "runs --version" --> C["MySqlVariant"] C -- "decides flag" --> D["--column-statistics=0"] D -- "added to command" --> A ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>DumpBinaryLocator.php</strong><dd><code>Add binary-specific dump flags for clients</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> src/Service/DumpBinaryLocator.php <ul><li>Adds <code>extraArguments()</code> to inspect binary version.<br> <li> Returns <code>--column-statistics=0</code> when needed.<br> <li> Uses <code>Process</code> to run <code>--version</code>.</ul> </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/src/Service/DumpBinaryLocator.php">+14/-0</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>DumpService.php</strong><dd><code>Include extra dump flags in command</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> src/Service/DumpService.php <ul><li>Spreads <code>extraArguments()</code> into dump command.<br> <li> Includes client-specific flags before connection options.</ul> </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/src/Service/DumpService.php">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>MySqlVariant.php</strong><dd><code>Detect MySQL 8 client compatibility</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> src/Service/MySqlVariant.php <ul><li>Adds <code>needsColumnStatisticsOff()</code> helper.<br> <li> Detects MySQL 8+ client on MariaDB server.<br> <li> Parses <code>Distrib</code> or <code>Ver</code> version numbers.</ul> </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/src/Service/MySqlVariant.php">+14/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>MySqlVariantTest.php</strong><dd><code>Add column statistics flag tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> tests/Service/MySqlVariantTest.php <ul><li>Adds tests for <code>needsColumnStatisticsOff()</code>.<br> <li> Covers MySQL 8, 5.7, and MariaDB clients.</ul> </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/tests/Service/MySqlVariantTest.php">+16/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Documentation</strong></td><td><table> <tr> <td> <details> <summary><strong>CHANGELOG.md</strong><dd><code>Document version 0.0.7 dump fix</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> CHANGELOG.md <ul><li>Adds <code>0.0.7</code> release entry.<br> <li> Documents MariaDB <code>COLUMN_STATISTICS</code> dump fix.</ul> </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/CHANGELOG.md">+6/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>composer.json</strong><dd><code>Bump plugin version to 0.0.7</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> composer.json - Bumps version from `0.0.6` to `0.0.7`. </details> </td> <td><a href="https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/composer.json">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
haylan added 1 commit 2026-11-02 22:30:12 +00:00
fix(dump): pass --column-statistics=0 for MySQL 8 mysqldump on MariaDB, release as 0.0.7
plugin-checks / version-changelog (pull_request) Successful in 20s
plugin-checks / phpunit (pull_request) Failing after 37s
plugin-checks / package (pull_request) Successful in 1m27s
6b7ba3bc47
Backport for the Shopware 6.6 line. When the server is MariaDB but only
MySQL 8's mysqldump is installed (e.g. dockware/web), the dump aborted
with "Unknown table 'COLUMN_STATISTICS' in information_schema (1109)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
haylan added 1 commit 2026-11-02 22:34:04 +00:00
ci(phpunit): install core patches that have no shopware/production tag
plugin-checks / version-changelog (pull_request) Successful in 19s
plugin-checks / package (pull_request) Successful in 1m3s
plugin-checks / phpunit (pull_request) Successful in 5m35s
fa50fa3343
The newest shopware/core in ~6.6.0 is 6.6.10.31, but shopware/production
is only tagged up to 6.6.10.30, so create-project failed. Install the newest
template inside the constraint and require the resolved core version on top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
haylan scheduled this pull request to auto merge when all checks succeed 2026-11-02 22:37:33 +00:00
haylan merged commit 00d959e661 into main 2026-11-02 22:39:42 +00:00
haylan deleted branch fix/0.0.7-column-statistics 2026-11-02 22:39:42 +00:00

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The flag is added for any MySQL client major version >= 8, but --column-statistics=0 is only available from MySQL 8.0.13 onward. On a MariaDB server with a MySQL 8.0.0-8.0.12 client, mysqldump may reject the unknown option and the dump will fail. Consider requiring 8.0.13+ or checking the full version.

&& (preg_match('/Distrib (\d+)\./', $clientVersion, $m) === 1 || preg_match('/\bVer (\d+)\./', $clientVersion, $m) === 1)
&& (int) $m[1] >= 8;
## PR Reviewer Guide 🔍 <!-- pr-agent:review:full --> Here are some key observations to aid the review process: <table> <tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 2 🔵🔵⚪⚪⚪</td></tr> <tr><td>🧪&nbsp;<strong>PR contains tests</strong></td></tr> <tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr> <tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br> <details><summary><a href='https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/src/Service/MySqlVariant.php#L28-L29'><strong>Possible Issue</strong></a> The flag is added for any MySQL client major version >= 8, but --column-statistics=0 is only available from MySQL 8.0.13 onward. On a MariaDB server with a MySQL 8.0.0-8.0.12 client, mysqldump may reject the unknown option and the dump will fail. Consider requiring 8.0.13+ or checking the full version. </summary> ```php && (preg_match('/Distrib (\d+)\./', $clientVersion, $m) === 1 || preg_match('/\bVer (\d+)\./', $clientVersion, $m) === 1) && (int) $m[1] >= 8; ``` </details> </td></tr> </table>

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Require MySQL 8.0.11 or newer

The --column-statistics=0 option is only available from MySQL 8.0.11 onward, so a
major-version check can pass it to earlier 8.0 clients. Parse the full client
version and compare against 8.0.11 before enabling the flag. Also avoid treating a
bare Ver 10.x protocol string as a release version.

src/Service/MySqlVariant.php [25-29]

-        return $serverIsMariaDb
-            && !self::isMariaDb($clientVersion)
-            // MySQL < 8 prints "Ver 10.13 Distrib 5.7.x": the Distrib number is the real version.
-            && (preg_match('/Distrib (\d+)\./', $clientVersion, $m) === 1 || preg_match('/\bVer (\d+)\./', $clientVersion, $m) === 1)
-            && (int) $m[1] >= 8;
+        if (! $serverIsMariaDb || self::isMariaDb($clientVersion)) {
+            return false;
+        }
 
+        $version = null;
+        $hasDistrib = preg_match('/Distrib\s+(\d+(?:\.\d+){1,2})/', $clientVersion, $m) === 1;
+        if ($hasDistrib) {
+            $version = $m[1];
+        } elseif (preg_match('/\bVer\s+(\d+(?:\.\d+){1,2})/', $clientVersion, $m) === 1) {
+            $version = $m[1];
+        }
+
+        if ($version === null) {
+            return false;
+        }
+
+        // Without "Distrib", "Ver 10.x" is the client protocol version, not a MySQL release.
+        if (! $hasDistrib && (int) explode('.', $version)[0] >= 10) {
+            return false;
+        }
+
+        while (substr_count($version, '.') < 2) {
+            $version .= '.0';
+        }
+
+        return version_compare($version, '8.0.11', '>=');
+
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly tightens the check to 8.0.11, avoiding an unsupported --column-statistics=0 on early MySQL 8 clients, and the improved parsing handles Distrib and protocol Ver strings. It is a meaningful correctness improvement, though it mainly affects older 8.0 clients.

Medium
## PR Code Suggestions ✨ <!-- pr-agent:improve:summary --> <!-- 6b7ba3b --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Require MySQL 8.0.11 or newer</summary> ___ **The <code>--column-statistics=0</code> option is only available from MySQL 8.0.11 onward, so a <br>major-version check can pass it to earlier 8.0 clients. Parse the full client <br>version and compare against <code>8.0.11</code> before enabling the flag. Also avoid treating a <br>bare <code>Ver 10.x</code> protocol string as a release version.** [src/Service/MySqlVariant.php [25-29]](https://git.arthurerlich.de/haylan/AeonDumpManager/src/branch/fix/0.0.7-column-statistics/src/Service/MySqlVariant.php#L25-L29) ```diff - return $serverIsMariaDb - && !self::isMariaDb($clientVersion) - // MySQL < 8 prints "Ver 10.13 Distrib 5.7.x": the Distrib number is the real version. - && (preg_match('/Distrib (\d+)\./', $clientVersion, $m) === 1 || preg_match('/\bVer (\d+)\./', $clientVersion, $m) === 1) - && (int) $m[1] >= 8; + if (! $serverIsMariaDb || self::isMariaDb($clientVersion)) { + return false; + } + $version = null; + $hasDistrib = preg_match('/Distrib\s+(\d+(?:\.\d+){1,2})/', $clientVersion, $m) === 1; + if ($hasDistrib) { + $version = $m[1]; + } elseif (preg_match('/\bVer\s+(\d+(?:\.\d+){1,2})/', $clientVersion, $m) === 1) { + $version = $m[1]; + } + + if ($version === null) { + return false; + } + + // Without "Distrib", "Ver 10.x" is the client protocol version, not a MySQL release. + if (! $hasDistrib && (int) explode('.', $version)[0] >= 10) { + return false; + } + + while (substr_count($version, '.') < 2) { + $version .= '.0'; + } + + return version_compare($version, '8.0.11', '>='); + ``` <details><summary>Suggestion importance[1-10]: 7</summary> __ Why: The suggestion correctly tightens the check to `8.0.11`, avoiding an unsupported `--column-statistics=0` on early MySQL 8 clients, and the improved parsing handles `Distrib` and protocol `Ver` strings. It is a meaningful correctness improvement, though it mainly affects older 8.0 clients. </details></details></td><td align=center>Medium </td></tr></tr></tbody></table>
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/AeonDumpManager#17