Opened 16 years ago
Closed 16 years ago
#4625 closed patch (fixed)
Verify TV Database Schema Version on startup
Reported by: | Owned by: | cpinkham | |
---|---|---|---|
Priority: | critical | Milestone: | 0.21 |
Component: | mythtv | Version: | unknown |
Severity: | high | Keywords: | |
Cc: | Ticket locked: | no |
Description
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).
Attachments (1)
Change History (4)
Changed 16 years ago by
Attachment: | mythtv-verify_schema_version.patch added |
---|
comment:1 Changed 16 years ago by
Owner: | changed from Isaac Richards to cpinkham |
---|---|
Status: | new → assigned |
comment:2 Changed 16 years ago by
Milestone: | unknown → 0.21 |
---|---|
Priority: | minor → critical |
Severity: | medium → high |
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [15902]) Add some additional DB Schema version checking.
mythbackend
mythtv-setup
mythfrontend
This means that you now need to startup mythbackend or mythtv-setup first whenever the schema needs to be upgraded, or you can run mythfrontend with the -u command line argument.
Closes #4625 using patch by Michael T. Dean.