[mythtv] mythtv commit: r15901 - in trunk/mythtv/libs by cpinkham

Nigel Pearson nigel at ind.tansu.com.au
Mon Feb 11 10:25:46 UTC 2008

> Log: Add code to backup the database before any schema upgrade.

Just tried Mac frontend and was surprised by a
DBUtil ... mysqldump error (in fact. I'm amazed
that my Mac had mysqldump in its path :-)

2008-02-11 16:40:32.512 SG(Default) Error: FindNextDirMostFree: '/ 
myth/tv' does not exist!
2008-02-11 16:40:32.513 Backing up database to file: /myth/tv/ 
sh: line 1: /myth/tv/mythconverg-1208-20080211164032.sql.gz: No such  
file or directory
mysqldump: Got errno 32 on write
2008-02-11 16:40:32.720 DBUtil Error: Error backing up database:  
mysqldump --defaults-extra-file='/tmp/mythtv_db_backup_conf_nkYIFL' -- 
host='' --user='mythtv' --add-drop-table --add-locks -- 
allow-keywords --complete-insert --extended-insert --lock-tables --no- 
create-db --quick 'mythconverg' | /usr/bin/gzip > '/myth/tv/ 
mythconverg-1208-20080211164032.sql.gz' 2>/dev/null (1)
2008-02-11 16:40:32.723 Unable to backup your database.  If you have  
not already created a backup, you may want to exit before the  
database upgrade and backup your database.

1) GetBackupDirectory() should check directory exists?

2) Calling BackupDB() before PromptForSchemaUpgrade()
means backup is always attempted if the schemas differ,
but has the disadvantage of needlessly doing a backup
(e.g. user selects "Use Existing Schema" or Exit,
  or DB schema is newer than the connecting client?)

It might be better to either:

A) Pass a flag into PromptForSchemaUpgrade()
if the caller can attempt a backup, and replace the
"You really should have a backup" buttons with a
"Backup, then upgrade" button and exit type, or

B) Pass a flag into PromptForSchemaUpgrade()
if a backup was done and was successful, so the
"You really should have a backup" buttons are not shown.

C) B) plus a check to disable BackupDB()
if the schema is newer than expected.

Nigel Pearson, nigel at ind.tansu.com.au|"People say I'm strange,
Telstra Net. Eng., Sydney, Australia | does it make me a stranger?
Office: 9202 3900    Fax:  9261 3912 | My best friend was born...
Mobile: 0408 664435  Home: 9792 6998 |     in a manger"   -DC Talk

More information about the mythtv-dev mailing list