pt-osc aborts in 8.0.15 even if no FK exists

Description

There is a known bug in earlier MySQL 8.0 versions about renaming a table with FKs so pt-osc should not run if the tables involved have FK.

However, the current logic inside pt-osc is only checking for these problematic versions without actually confirming the tables have FK:

https://github.com/percona/percona-toolkit/blob/3.4.0/bin/pt-online-schema-change#L9136

if (($vp->cmp('8.0.14') >= 0 && $vp->cmp('8.0.17') <= 0) && $vp->flavor() !~ m/maria/i) { my $msg = "There is an error in MySQL that makes the server to die when trying to ". "rename a table with FKs. See https://bugs.mysql.com/bug.php?id=96145\n". "Since pt-online-schema change needs to rename the old <-> new tables as the final " . "step, and the requested table has FKs, it cannot be executed under the current MySQL version"; _die($msg, NO_MINIMUM_REQUIREMENTS); }

My understanding is pt-osc should check if there are actually any FKs before aborting, e.g.

if ( $have_child_tables && ($vp->cmp('8.0.14') >= 0 && $vp->cmp('8.0.17') <= 0) && $vp->flavor() !~ m/maria/i) { my $msg = "There is an error in MySQL that makes the server to die when trying to ". "rename a table with FKs. See https://bugs.mysql.com/bug.php?id=96145\n". "Since pt-online-schema change needs to rename the old <-> new tables as the final " . "step, and the requested table has FKs, it cannot be executed under the current MySQL version"; _die($msg, NO_MINIMUM_REQUIREMENTS); }

Environment

None

Smart Checklist

Activity

Aaditya Dubey November 1, 2022 at 12:42 PM

Hi ,

Thank you for the report.
Verified as described.

Done

Details

Assignee

Reporter

Priority

Affects versions

Fix versions

Needs QA

Yes

Smart Checklist

Created October 27, 2022 at 5:32 PM
Updated June 12, 2024 at 5:29 PM
Resolved April 8, 2024 at 7:13 PM

Flag notifications