[mythtv-commits] Ticket #4625: Verify TV Database Schema Version on startup

MythTV mythtv at cvs.mythtv.org
Sun Feb 10 00:06:41 UTC 2008


#4625: Verify TV Database Schema Version on startup
----------------------------------------------+-----------------------------
 Reporter:  sphery <mtdean at thirdcontact.com>  |       Owner:  ijr    
     Type:  patch                             |      Status:  new    
 Priority:  minor                             |   Milestone:  unknown
Component:  mythtv                            |     Version:  unknown
 Severity:  medium                            |     Mlocked:  0      
----------------------------------------------+-----------------------------
 The attached patch, mythtv-verify_schema_version.patch , prevents
 mythfrontend from upgrading the schema version and prevents an "old"
 mythbackend or mythtv-setup from running against a newer schema version
 than it understands.  With the new autodetection code, allowing
 mythfrontend to upgrade the schema version could have undesired
 consequences.  Also, allowing mythbackend or mythtv-setup to change data
 in a database with a different schema than expected could result in
 corrupted data.

 Rather than modify UpgradeTVDatabaseSchema() to accept a bool
 upgradeAllowed (default true) and call it from mythfrontend as
 UpgradeTVDatabaseSchema(false), which would only handle preventing
 mythfrontend from upgrading the schema, I added a new function,
 CheckTVDatabaseSchema() in libs/libmythtv/dbcheck.cpp.  A separate call to
 this new function before calling UpgradeTVDatabaseSchema() allows
 preventing old backends and mythtv-setup (which are allowed to upgrade the
 schema) from running when they don't understand the schema version (i.e.
 old backend/mythtv-setup shouldn't modify data in the DB if they don't
 know about future changes to the schema).

 To allow frontend-only users (i.e. those using MythVideo/MythMusic, but
 not using any TV functionality) to upgrade the schema, there is a new
 command-line argument for mythfrontend, --upgrade-schema, that allows it
 to upgrade the schema.  Alternatively, those users may simply run mythtv-
 setup or mythbackend to upgrade the database.

 The patch supports MythContext::PromptForSchemaUpgrade()'s "expertMode"
 (DBSchemaAutoUpgrade=-1).  In this mode, it will allow running an old
 mythbackend/mythtv-setup/mythfrontend against a newer schema version.
 Since the patch doesn't prevent mythbackend or mythtv-setup from upgrading
 the database, it would still be possible to run them against an old schema
 version with expertMode.  However, since it tries to prevent mythfrontend
 from upgrading the schema version, enabling expertMode explicitly enables
 mythfrontend to upgrade the schema version (and, therefore, would also
 allow mythfrontend to run against and old schema version).

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4625>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list