Bug #103866 Provide an option to make native cloning fail if it will lose user data
Submitted: 31 May 2021 13:43 Modified: 11 Jun 2021 16:54
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: csv, data loss, myisam, native cloning

[31 May 2021 13:43] Simon Mudd
Description:
Native cloning has some limitations which are documented: https://dev.mysql.com/doc/refman/8.0/en/clone-plugin-limitations.html

The most notable being that MyISAM tables will be cloned "empty". For anyone using  MySQL 8.0 and perhaps not realising they may have MyISAM tables.

If using native cloning the MyISAM data will simply be lost (as documented) but this will not be visible to the user unless they check. This is very dangerous.

A lot of recipes/blogs and applications still use MyISAM tables even if it might not be the most appropriate choice and they may not be aware of the risks.

I think it would be safer for native cloning to fail under such circumstances by default for "user data". mysqld may be able to or need to handle this with it's own metadata, but user data is different.

How to repeat:
See the docs.
Use native cloning to clone an instance with MyISAM user tables and data and check if the data is present on the destination instance.

Suggested fix:
It seems from documentation that 2 engines are treated specially: MyISAM and CSV and really this is for internal mysqld tables.

Ideally I'd like to see an option clone_user_tables_safely whose default is YES/TRUE/1 but which can be set to 0/no/false to maintain current behaviour.

If set this setting should make native cloning fail if it find a user table that is of type CSV or MyISAM or anything other than those engines supported by native cloning.  Ideally it would probably be better to fail before starting the cloning process but if this happens when "finding" such a table that's also acceptable. The main thing here is being sure that the content of user data on the destination matches that on the source it was copied from.

Related to: bug#103865.
[31 May 2021 13:45] Simon Mudd
Adjust as feature request as current behaviour is documented.
[31 May 2021 14:18] MySQL Verification Team
Hello Simon,

Thank you for the reasonable feature request!

regards,
Umesh
[11 Jun 2021 16:54] Simon Mudd
Related: bug#103983