Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading from 0.2.7 to 0.4.0 fails #506

Closed
mehlkopf opened this issue Mar 17, 2016 · 25 comments
Closed

Upgrading from 0.2.7 to 0.4.0 fails #506

mehlkopf opened this issue Mar 17, 2016 · 25 comments
Labels

Comments

@mehlkopf
Copy link

Hi there,

I just tried upgrading from 0.2.7 to 0.4.0, but the upgrading process fails with the error message:
Uncaught exception during upgrade: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 duplicate column name: synctoken' in /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php:255 Stack trace: #0 /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(255): PDO->exec('ALTER TABLE cal...') #1 /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(61): BaikalAdmin\Controller\Install\VersionUpgrade->upgrade('0.2.7', '0.4.0') #2 /var/www/bk/Core/Frameworks/Flake/Core/Render/Container.php(71): BaikalAdmin\Controller\Install\VersionUpgrade->render() #3 /var/www/bk/Core/Frameworks/Flake/Controller/Page.php(85): Flake\Core\Render\Container->renderBlocks() #4 /var/www/bk/html/admin/install/index.php(80): Flake\Controller\Page->render() #5 {main}

I'm using SQLite ...

Thanks for help!

@evert
Copy link
Member

evert commented Mar 17, 2016

If your 0.2.7 database had a synctoken, then it was not a 0.2.7 database. Can you start the upgrade over?

@mehlkopf
Copy link
Author

Yes, I tried a second time and got the same error message ... Running version is 0.2.7, I'm quite sure ;)

@evert
Copy link
Member

evert commented Mar 17, 2016

The problem is that your old database is not supposed to have a synctoken column. Any idea why that might be in there?

@mehlkopf
Copy link
Author

No, I'm sorry - I've only used this version until today and never upgraded before …

@staabm
Copy link
Member

staabm commented Mar 17, 2016

did you create a backup before the upgrade? if so, did the db schema before the upgrade contain the synctoken column?

@evert
Copy link
Member

evert commented Mar 17, 2016

Could you go into your sqlite database (on your old database, before attempting the upgrade):

sqlite3 Specific/db/db.sqlite

And then type:

.schema

And share the result? That should provide some insight I hope.

@mehlkopf
Copy link
Author

This is the result:

CREATE TABLE addressbooks (
id integer primary key asc,
principaluri text,
displayname text,
uri text,
description text,
ctag integer
);
CREATE TABLE cards (
id integer primary key asc,
addressbookid integer,
carddata blob,
uri text,
lastmodified integer
);
CREATE TABLE calendarobjects (
id integer primary key asc,
calendardata blob,
uri text,
calendarid integer,
lastmodified integer
, etag text, size integer, componenttype text, firstoccurence integer, lastoccurence integer);
CREATE TABLE calendars (
id integer primary key asc,
principaluri text,
displayname text,
uri text,
ctag integer,
description text,
calendarorder integer,
calendarcolor text,
timezone text,
components text
, transparent bool);
CREATE TABLE locks (
id integer primary key asc,
owner text,
timeout integer,
created integer,
token text,
scope integer,
depth integer,
uri text
);
CREATE TABLE groupmembers (
id INTEGER PRIMARY KEY ASC,
principal_id INTEGER,
member_id INTEGER,
UNIQUE(principal_id, member_id)
);
CREATE TABLE users (
id integer primary key asc,
username TEXT,
digesta1 TEXT,
UNIQUE(username)
);
CREATE TABLE principals (
id INTEGER PRIMARY KEY ASC,
uri TEXT,
email TEXT,
displayname TEXT,
vcardurl TEXT,
UNIQUE(uri)
);

@evert
Copy link
Member

evert commented Mar 17, 2016

Interesting. There's no synctoken in there. I'm going to run the upgrade from 0.2.7 to 0.4.0 and see if there's a reproducible error.

@glasen
Copy link

glasen commented Mar 17, 2016

Hi,

i'm currently stuck at the same problem with the same error message. I copied the db-file from my old 0.2.7-installation. The admin-Interface shows my old calendar and adressbook but accessing through "dav.php" fails with the "synctoken"-error.

@evert
Copy link
Member

evert commented Mar 17, 2016

Confirmed that there is a problem, but the synctoken problem is actually not the first issue. During upgrade there's a different sql error. Then trying to run the update again yields the synctoken problem (which makes sense because the first attempt to an upgrade was half completed).

@evert evert added the bug label Mar 17, 2016
@evert
Copy link
Member

evert commented Mar 17, 2016

This is the first error:

Uncaught exception during upgrade: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 table calendars has 11 columns but 12 values were supplied' in /Users/evert/code/baikal/test/baikal/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php:422 Stack trace: #0 /Users/evert/code/baikal/test/baikal/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(422): PDO->exec('INSERT INTO cal...') #1 /Users/evert/code/baikal/test/baikal/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(61): BaikalAdmin\Controller\Install\VersionUpgrade->upgrade('0.2.7', '0.4.0') #2 /Users/evert/code/baikal/test/baikal/Core/Frameworks/Flake/Core/Render/Container.php(71): BaikalAdmin\Controller\Install\VersionUpgrade->render() #3 /Users/evert/code/baikal/test/baikal/Core/Frameworks/Flake/Controller/Page.php(85): Flake\Core\Render\Container->renderBlocks() #4 /Users/evert/code/baikal/test/baikal/html/admin/install/index.php(80): Flake\Controller\Page->render() #5 {main}

@evert
Copy link
Member

evert commented Mar 17, 2016

This definitely just affects upgrades from 0.2.7 and earlier, a path I didn't test. But I have a solution

@evert evert closed this as completed in b00c2f3 Mar 17, 2016
@evert
Copy link
Member

evert commented Mar 17, 2016

Ok guys, I just uploaded 0.4.1. Upgrading to 0.4.1 will only work from your original 0.2.7 database.

@mehlkopf
Copy link
Author

Thank you very much - but I tried it and still get the same message when reloading the admin page ...

@glasen
Copy link

glasen commented Mar 18, 2016

How did you make the upgrade? You have to make the following steps after installing/unzipping baikal:

  1. Copy your old database-file (When using sqlite) to the "Specific/db"-folder
  2. Don't open the admin-interface. Instead just open the normal URL of your Baikal-installation (e.g. "http://baikal-server.com" instead of "http://baikal-server.com/admin").
  3. Baikal will show a "Upgrade"-screen and will apply the needed changes to the database.
  4. Now you can use the admin-interface.

@ErikBasalt
Copy link

This contradicts the upgrade instructions here:
http://sabre.io/baikal/upgrade/

@evert
Copy link
Member

evert commented Mar 18, 2016

yea the upgrade instructions are actually a bit better. Basically, you only need to keep the Specific directory. But the main point is that if @mehlkopf is still getting an error, it means that he/she is not running the upgrade from the old 0.2.7 sqlite backup.

@mehlkopf
Copy link
Author

So, just to clarify: I extract the zip, name it the way my Baikal server is configured, delete the Specific folder inside and copy the old one in the new directory. Then I go to my server address which immediately redirects to /html/admin which immediately redirects to /html/admin/install - the page takes some minutes to load, then it appears completely blank (tried it with several browsers). After that, nothing happens (I've waited for half an hour, no related processes show any CPU activity) - when I try to reload the page, I get the well-known synctoken error ...

@evert
Copy link
Member

evert commented Mar 18, 2016

That's interesting. The reason you get the error though is because you run an incomplete upgrade twice. The real problem is : why does the initial upgrade not complete?

How big is your database? I'm wondering if it simply never completes because it's just taking a very long time to upgrade.

@mehlkopf
Copy link
Author

I'd say not really big, it's 2 users, 9 calendars, 3000 events, 2 address books, 400 contacts ... After the page is shown as loaded in the browser (although blank), there is no more PHP/web server process activity on my server, so it's somehow completely stuck as it seems.

@evert
Copy link
Member

evert commented Mar 19, 2016

So I'm thinking this is still the cause of your problem. Even though 3000 events might not sound that big, in order to upgrade the script actually has to parse every single event in order to extract some information from it. I suspect that if you check your PHP or webserver log, you will either see an out of memory, or a maximum execution time-related error. If it's either of those, you can just increase those numbers and wait longer.

If none of that is an option, there is a way to do a manual upgrade on the command line. It's not super easy, but I can definitely write step-by-step instructions for it. Let me know what you would like me to do!

@mehlkopf
Copy link
Author

Thank you so much for your help - the solution really was to increase the execution limit (and it didn't take much longer than the previous limit of 30 seconds ^^). Thanks for the great support!

@bjo81
Copy link

bjo81 commented Apr 8, 2016

I have the same issue as @mehlkopf
Uncaught exception during upgrade: exception 'PDOException' with message 'SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'synctoken'' in /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php:167 Stack trace: #0 /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(167): PDO->exec('ALTER TABLE cal...') #1 /var/www/bk/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php(61): BaikalAdmin\Controller\Install\VersionUpgrade->upgrade('0.2.7', '0.4.4') #2 /var/www/bk/Core/Frameworks/Flake/Core/Render/Container.php(71): BaikalAdmin\Controller\Install\VersionUpgrade->render() #3 /var/www/bk/Core/Frameworks/Flake/Controller/Page.php(85): Flake\Core\Render\Container->renderBlocks() #4 /var/www/bk/html/admin/install/index.php(83): Flake\Controller\Page->render() #5 {main}

I'm really sure it's 0.2.7 running there and to prevent the issue being caused by a failed upgrade I dropped the database and used a backup from the morning before the upgrade.

@evert
Copy link
Member

evert commented Apr 9, 2016

Hi @bjo81 ,

Please re-read this thread and go over the troubleshooting steps we've already done. I can ask you all the same questions again, but it wouldn't be a very good use of my time.

@Bibo-Joshi
Copy link

Bibo-Joshi commented Mar 31, 2017

Heyho!

the solution really was to increase the execution limit

For all my fellow noobs: Here is how to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants