Opened 16 years ago

Closed 16 years ago

#5314 closed patch (fixed)

Use GetSetting() to retrieve DBSchemaVer

Reported by: sphery <mtdean@…> Owned by: greg
Priority: minor Milestone: unknown
Component: mythtv Version: 0.21-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The attached patch modifies CompareTVDatabaseSchemaVersion() to use GetSetting?() rather than GetNumSetting?() to retrieve DBSchemaVer.

The patch should be applied against both 0.21-fixes and trunk. I tested/verified it with both.

When applied to 0.21-fixes, it will prevent the change to the default value of DBSchemaVer mentioned in #5286, so even without [17165] and [17166], the check for an "empty" DB in PromptForSchemaUpgrade?() would succeed after this patch.

Note that even with the change of default value for DBSchemaVer, the check 'if (dbver == "")' in doUpgradeTVDatabaseSchema() will always succeed as the settings cache is deactivated before the call to UpgradeTVDatabaseSchema() by main.cpp in mythtv-setup, mythbackend, and mythfrontend (so doUpgradeTVDatabaseSchema() will get the default it specifies when the value is not found in the database).

Therefore, no behavior will change as a result of this patch (with the exception of a change to the log output from "Current Schema Version: 0" to "Current Schema Version: "). Both before and after this patch, Myth was able to properly initialize the database schema.

Attachments (2)

mythtv-5314-use_GetSetting_in_CompareTVDatabaseSchemaVersion.patch (481 bytes) - added by sphery <mtdean@…> 16 years ago.
mythtv-5314-no_blank_current_schema_version_in_log.patch (622 bytes) - added by sphery <mtdean@…> 16 years ago.
Simple patch to put something in the logs for Current Schema Version for a new database

Download all attachments as: .zip

Change History (9)

Changed 16 years ago by sphery <mtdean@…>

Changed 16 years ago by sphery <mtdean@…>

Simple patch to put something in the logs for Current Schema Version for a new database

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

mythtv-5314-no_blank_current_schema_version_in_log.patch is a simple patch to put something in the logs for "Current Schema Version" when setting up a new database. I chose "(none)" rather than "(new database)" as the former is always correct, even in the event of a corrupted database that's missing a DBSchemaVer.

comment:2 Changed 16 years ago by greg

Owner: changed from Isaac Richards to greg
Status: newassigned

comment:3 Changed 16 years ago by sphery <mtdean@…>

BTW, mythtv-5314-no_blank_current_schema_version_in_log.patch is obsoleted by the Nigel's addition of the schema wizard (which included similar functionality).

mythtv-5314-use_GetSetting_in_CompareTVDatabaseSchemaVersion.patch should still be applied to trunk and -fixes. In -fixes, its sole purpose is to prevent a number of errors (which don't hurt anything) from occurring and being logged on initial database creation--thus making the log output much more friendly for a user just starting with Myth.

comment:4 Changed 16 years ago by Nigel

Michael, not sure either one is needed now. dbcheck.cpp seems to use GetSetting?("DBSchemaVer"), as does SchemaUpgradeWizard::Compare:

    DBver = gContext->GetSetting(m_schemaSetting);

    // No current schema? Investigate further:
    if (DBver.isEmpty() || DBver == "0")
    {
        VERBOSE(VB_GENERAL, "No current database version?");

and the "no_blank" is not needed, because of the verbose line above?

comment:5 Changed 16 years ago by sphery <mtdean@…>

You're right about trunk. I didn't notice this disappearing, sorry.

However, it would be nice to apply mythtv-5314-use_GetSetting_in_CompareTVDatabaseSchemaVersion.patch to -fixes to prevent the slew of errors that occur on DB creation. I just tested it there, yesterday, and it works as advertised.

comment:6 Changed 16 years ago by sphery <mtdean@…>

nvm. The root of the problem was fixed by [17637] , so the workaround here doesn't need to be applied. I didn't expect the change in [17637] to go into -fixes. Ticket should be closed.

comment:7 Changed 16 years ago by Nigel

Resolution: fixed
Status: assignedclosed

(In [18022]) If database (SchemaVer?) is empty, log that. Idea from Michael Dean's patch. Closes #5314.

Note: See TracTickets for help on using tickets.