Opened 15 years ago

Closed 15 years ago

#6013 closed patch (fixed)

restore script--fix partial restore to account for character set

Reported by: sphery <mtdean@…> Owned by: Rob Smith
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The partial/"new host" restore needs to account for the character set used in the backup file to prevent data corruption. The attached patch simply adds a new condition to the filter for a "white-listed" partial restore to ensure the line:

/*!40101 SET NAMES utf8 */;

is included, to properly set the character set for the restore. It will work even if the backup uses a different character set--it doesn't have to be utf8--so it should work for any backup file (even one created by a user who explicily specifies a different character set). Note that --partial_restore --with_plugin_data (a blacklisted restore) works before the patch as the SET NAMES line is not excluded.

Since both this patch and the patch in #5975, update the script version in the restore script to 1.0.3, please either commit them together or give me time to update the other patch to get a new script version or update the script version when committing the other. Thanks.

Background information:

mysqldump (from MySQL 5.0 and above, at least) always uses UTF-8 for the dump unless otherwise instructed. Therefore, since a MySQL server may be configured with a server-default character set (which would cause client connections to use that character set) that differs from the character set used in the backup data could be corrupted (twice-converted). Likewise, on a system without a specified server-default character set, the connection will use the database-default character set. Therefore, on any 0.21-fixes and below system that's properly configured for Myth (using either a server default charset of latin1 or without a specified charset), a partial restore that does not include the SET NAMES line will cause data corruption. The same issue could happen on trunk/post-0.21-fixes systems, depending on configuration.

In addition, any partial restore using the instructions at http://mythtv.org/docs/mythtv-HOWTO-23.html#ss23.7 on a system properly-configured for 0.21-fixes and below (i.e. using a latin1 charset) will cause data corruption. I left a note in the already-open ticket at #3762.

Attachments (4)

mythtv-6013-restore-handle_character_set_for_partial_restore.patch (1.1 KB) - added by sphery <mtdean@…> 15 years ago.
mythtv-6013-restore-handle_character_set_for_partial_restore.2.patch (1.3 KB) - added by sphery <mtdean@…> 15 years ago.
Updated patch to allow partial restores with MySQL 4.x (and below) backups.
mythtv-6013-restore-handle_character_set_for_partial_restore.3.patch (1.3 KB) - added by sphery <mtdean@…> 15 years ago.
Updated patch for recent changes to trunk.
mythtv-5975_and_6013-combined.patch (2.2 KB) - added by sphery <mtdean@…> 15 years ago.
Combined version of #5975 and #6013 patches (to work around patch collisions). Can be used instead if both are applied/committed together.

Download all attachments as: .zip

Change History (7)

Changed 15 years ago by sphery <mtdean@…>

Changed 15 years ago by sphery <mtdean@…>

Updated patch to allow partial restores with MySQL 4.x (and below) backups.

comment:1 Changed 15 years ago by sphery <mtdean@…>

mythtv-6013-restore-handle_character_set_for_partial_restore.2.patch is an updated version of the patch that allows partial restore with MySQL 4.x (and below) backups (by making the backticks around the table name optional).

comment:2 Changed 15 years ago by Rob Smith

Owner: changed from Isaac Richards to Rob Smith
Status: newaccepted

Changed 15 years ago by sphery <mtdean@…>

Updated patch for recent changes to trunk.

Changed 15 years ago by sphery <mtdean@…>

Combined version of #5975 and #6013 patches (to work around patch collisions). Can be used instead if both are applied/committed together.

comment:3 Changed 15 years ago by Rob Smith

Resolution: fixed
Status: acceptedclosed

(In [20607]) Fixes #5975 and Fixes #6013, a few more patches by Mr. Dean for the db restore script

Note: See TracTickets for help on using tickets.