Donate Share December 2003: Project of the Month

PhpGedView

Subscribe

PGV4.1.5->4.2.2 Upgrade Error

  1. 2009-11-07 22:32:26 UTC

    I am a long time (since v3.3) PGV user with a hosted v4.1.5 website using a MySQL database. I also keep a copy of the website on my desktop and do site experimenting/upgrading/etc. there before making configuration alterations to my hosted site. I have spent several days unsuccessfully trying to get my desktop copy upgraded to 4.2.2, faithfully following the cookbook at the Wiki upgrade instructions page. I don't get past the initial browser access, with "PDOException" "Can't create table '.\phpgedview\pgvsitesetting.frm' " errors. The DB name/user/password are all unchanged and are hard coded in the config.php file (which was retained when the 4.2.2 code was moved into place, in accordance with the upgrade instructions) and the DB user account has all priviliges (including CREATE) assigned for the DB. I can readily create/drop/etc. tables in the PGV database via MySql Administrator using the PGV user account credentials.

    Vitals: Windows XP Pro with SP3. IIS 5.1. PHP 5.2.11 with PDO and PDO MySql extensions enabled. MySQL Server 5.0.67.

    Can anyone help? Thanks.

  2. 2009-11-07 22:59:38 UTC

    (FYI - I wrote both the relevant code and the wiki instructions)

    This is interesting. PGV should only try to create this table if it doesn't already exist. If you care to look in the file includes/dbschema0_1.php, you'll see the relevant code. Even if you don't understand PHP, it should be pretty obvious what it is doing.

    From v4.2.2 onwards, PGV uses a row in this table to indicate the current state of the database. Previously, it tried to introspect the existing structure, which is both slow, and hard to do in a platform independent way.

    So, it should only be created if it is not present. This suggests that it doesn't already exist, or that PGV is wrongly detecting that it doesn't exist.

    As a starting point, please confirm whether this table exists.

  3. 2009-11-07 23:42:37 UTC

    The table does not exist in my 4.1.5 database. I assumed that it is something new, post 4.2.

  4. 2009-11-07 23:52:07 UTC

    <>

    If PGV is trying to create the table with the same credentials, but failing, then perhaps there is something in the table definition that is causing an issue.

    Copy/Paste the CREATE TABLE code from the script referenced above into PhpMyAdmin, substituting definitions found in classpgvdb.php as necessary, and try to create it manually.

    Maybe your MySQL installation is missing collation definitions or something??

  5. 2009-11-07 23:54:10 UTC

    Gah! What is the point of having a preview facility on the forum if it looks nothing like the text that eventually appears.

    The initial less-than greater-than should be me quoting your original post as follows...

    I can readily create/drop/etc. tables in the PGV database via MySql Administrator using the PGV user account credentials.

  6. 2009-11-08 00:10:26 UTC

    Can you give me the SQL command to create the pgvsitesetting table? It will take me a week to track down all of the variable values to substitute, and the chances of me getting it correct are small.

  7. 2009-11-08 16:47:34 UTC

    In the file dbschema0_1.php, temporaily replace "self::exec" with "die".

    When you try to load PGV, this will show you exactly what SQL it is trying to execute.

  8. 2009-11-09 12:20:55 UTC

    Used the dbschema0_1 mod to obtain the SQL command. Create table attempt failed initially. Next, backed up the pgv database via MySQL Administrator (to SQL Script), dropped the database and restored it from the backup. Create command worked that time. Dropped all tables, restored again from the backup and tried the pgv upgrade. Got past the site settings create table step but eventually failed with -

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Inetpub\wwwroot\PhpGedView\includes\classes\classpgvdb.php on line 698

    Examined database and found new pgvlink, pgvname and pgvsitesetting Innodb tables (all of the 4.1.5 tables are MyISAM). First two are empty but site setting table has 1 row, "PGVSCHEMAVERSION 3". Repeating results in the same error and database state. MySQL server process grinds at 50% of CPU until the timeout occurs.

    I note that the new tables are InnoDB, even though my server configuration uses MyISAM as default storage engine. The 4.1.5 tables are MyISAM. Is mixing OK?

  9. 2009-11-09 12:44:14 UTC

    PGV doesn't specify database engines. If you have a mix of MyISAM and InnoDB, then this because those were the defaults when the tables were created. A mix of engines isn't a problem.

    The update scripts are designed to fail safe, so that if they time out, you can resume by refreshing the page. Have you confirmed that refreshing (and hitting your timeout) doesn't advance the version number?

    If you at schema version 3, then the next step (3 to 4) simply modifies some column definitions in the pgv_dates table.

    30 seconds should be plenty for this. Do you have a very large DB or a very slow server?

    If you have an up-to-date copy of your gedcom file (i.e. you followed the instructions about syncing your file/db before the backup), then you can truncate this table. The contents will be recreated when you import, and the structure modifications should work a lot faster.

  10. 2009-11-09 19:53:40 UTC

    Following the timeout, re-executed several times with same timeout error on schema 3. Examined the dates table and it had 167180 rows. Deleter all rows and re-executed with success.

    The timeouts were occurring with my desktop unloaded and about 50% of the cpu used by the MySQL server process. The system is not unexpectedly slow. After getting past this issue, import of a ~10Mb GEDCOM takes maybe 120 seconds, and is very comparable to the v4.1.5 performance.

    Still have a handfull of upgrade glitches, but none appear to be DB related. Thanks for the help.

    BTW. I am toying with the idea of switching to SQLite but want to retain the current database state (i.e. user accounts/last login time/etc.) Is there a straightforward way? I have SQLite tools, and can write SQLite DB code if necessary.

    Thanks again.

    Tom

  11. 2009-11-09 20:28:20 UTC

    <BTW. I am toying with the idea of switching to SQLite >
    You can't be serious? Why would you wish to take a performance hit like that?
    -Stephen

  12. 2009-11-09 20:28:39 UTC
    BTW. I am toying with the idea of switching to SQLite 
    

    Tom, think very hard before you do that. Its OK as an alternative if you have (and intend to stay with) a small GEDCOM. But for any reasonable size, stick to MySQL.

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.