Repository navigation
Closed
Labels
Description
I attempted an auto upgrade from the admin interface which has resulted in the below error. I didn't see any other similar issues out there and I am not certain how I should proceed to resolve this - possibly something to do with with calendar app.
Workaround methods listed in comments
Expected behaviour
A successful update to version 5.0.8
Actual behaviour
Upgrade fails and error displayed.
Steps to reproduce
Unknown - I did modify a couple files to make the files sizes display better a while back but have had no issues until this update.
https://github.com/owncloud/core/issues/633
Displaying human readable file sizes is more useful for me, and a number of other users. I understand the reasoning behind not displaying the human readable size by default, but could it the change be implemented as an option to switch between the two options globally or per user?
I made a couple small changes on my install to display the human readable sizes that worked well.
edit core/js/js.js
comment out the existing simpleFileSize function (line ~642) using // on each line or /** on first line and **/ on last line
Add your own function as follows:
function simpleFileSize(size) {
return humanFileSize(size);
}
edit lib/template.php
comment out the existing simple_file_size function (line ~71)
Add your own function as follows:
function simple_file_size( $bytes ) {
return OC_Helper::humanFileSize( $bytes );
}
Server configuration
Operating system: Ubuntu 13.04
Web server: Apache 2.2.22 (Ubuntu)
Database: MySQL 5.5.31
PHP version: PHP Version 5.4.9
ownCloud version: Should be 5.0.8 (config.php: 'version' => '5.0.12',)
Client configuration
Browser: Firefox v22.0
Operating system: Windows 7 x64
Logs
Web server error log
No Output Generated
ownCloud log (data/owncloud.log) - Set to Debug Level
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1373988159}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1373988159}
{"app":"calendar","message":"starting app upgrade from 0.6.1 to 0.6.3","level":0,"time":1373988159}
{"app":"core","message":"Failed to update database structure (MDB2 Error: unknown error, _doQuery: [Error message: Could not execute statement]\n[Last executed query: ALTER TABLE `oc_calendar_objects` RENAME TO `oc_clndr_objects`, CHANGE `id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGE `calendarid` `calendarid` INT UNSIGNED DEFAULT 0 NOT NULL, CHANGE `startdate` `startdate` DATETIME DEFAULT '1970-01-01 00:00:00', CHANGE `enddate` `enddate` DATETIME DEFAULT '1970-01-01 00:00:00']\n[Native code: 1068]\n[Native message: Multiple primary key defined]\n)","level":4,"time":1373988160}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1373988160}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1373988160}
{"app":"core","message":"starting upgrade from 5.0.12 to 5.0.14","level":2,"time":1373988160}
{"app":"core","message":"Failed to update database structure (MDB2 Error: unknown error, _doQuery: [Error message: Could not execute statement]\n[Last executed query: ALTER TABLE `oc_locks` CHANGE `id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGE `timeout` `timeout` INT UNSIGNED DEFAULT 0, CHANGE `created` `created` BIGINT DEFAULT 0, CHANGE `scope` `scope` TINYINT DEFAULT 0, CHANGE `depth` `depth` TINYINT DEFAULT 0]\n[Native code: 1068]\n[Native message: Multiple primary key defined]\n)","level":4,"time":1373988161}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1373988161}
Browser log
N/A
Activity
Niduroki commentedon Jul 16, 2013
@RealRancor it's not exactly the same issue though … #4084 is 5.0.8->5.0.9.
This is 5.0.7->5.0.8.
The error message is the same though.
ValleyGeek commentedon Jul 16, 2013
Ha, well I sure feel blind now, they are indeed the same error. Although I can see an argument for the version making them two separate issues. If it is decided to merge them, I have no issues with that. In any case, any advice is appreciated. I thought I should report it here before I begin hacking at it.
ValleyGeek commentedon Jul 17, 2013
@RealRancor Thanks for the followup on the calendar. I took the steps outlined by @georgehrke #4013 (comment)
Upon refresh of my installation I am presented with the same UI output as pictured in my OP but my owncloud.log output is shorter as follows:
For reference, here is the schema for my oc_locks table:
I am happy to try and test any suggestions or provide further information as able. I would like to get my installation back up soon, but I don't have an urgent need.
On a semi-related note, I notice that I now have Apache and PHP updates available. I have not installed them yet so that my environment would be consistent for troubleshooting. However, I can and will install them if asked to.
brotkastn commentedon Jul 21, 2013
I can confirm problems with the upgrade to 5.0.9, this is what i am getting:
{"app":"core","message":"starting upgrade from 5.0.12 to 5.0.15","level":2,"time":1374433237}{"app":"core","message":"Failed to update database structure (MDB2 Error: unknown error, _doQuery: [Error message: Could not execute statement]\n[Last executed query: ALTER TABLE
oc_locksCHANGEididINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGEtimeouttimeoutINT UNSIGNED DEFAULT 0, CHANGEcreatedcreatedBIGINT DEFAULT 0, CHANGEscopescopeTINYINT DEFAULT 0, CHANGEdepthdepthTINYINT DEFAULT 0]\n[Native code: 1068]\n[Native message: Multiple primary key defined]\n)","level":4,"time":1374433240}This is on a debian-vm, using PostgreSQL (9.3) as the DB-Backend
tanatospl commentedon Jul 23, 2013
I had this problem too (Multiple primary key defined).
The problem here is that mysql does not allow to alter primary key of a table without deleting that key first.
I fixed this problem by going to phpmyadmin and manually deleting primary keys for tables like: locks, queuedtasks, vcategory, calendar* etc... and then refreshing my owncloud page. This restarted the update procedure and fixed the problem.
The long term fix would be to change the owncloud updater code to always add "ALTER TABLE tablename DROP PRIMARY KEY" before executing any primary key altering on mysql.
ValleyGeek commentedon Jul 24, 2013
Following the advice of @tanatospl I ran the commands below against my database (one at a time) refreshing my ownCloud root page after each table change and have successfully completed the update with no changes other than what has been mentioned in this issue.
The first line in each pair was to remove the "Auto Increment" from the id fields (MySQL error: "ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key") and the second is to remove the primary key attribute.
At this time I am no longer affected by this issue. I proceeded to immediately run the auto update from 5.0.8 to 5.0.9 and it ran without issue. I didn't close this issue in the event that others are still receiving this and it should be left open but I have no personal reason for it to be left open.
brotkastn commentedon Jul 28, 2013
So, what is the official way to upgrade then? Since i guess it shouldnt involve the users to execute own statements like @ValleyGeek , i guess the upgrade script should check which db it runs on and try to do the right thing.
karlitschek commentedon Jul 28, 2013
Could you try to upgrade to 5.0.9 please? We fixed a few bugs here.
brotkastn commentedon Jul 28, 2013
As stated before, this was while trying to upgrade to 5.0.9.
brotkastn commentedon Aug 21, 2013
After trying to upgrade to 5.0.10, this is what the owncloud.log contains.
{"app":"core","message":"Failed to update database structure (MDB2 Error: unknown error, _doQuery: [Error message: Could not execute statement] \n[Last executed query: ALTER TABLEoc_calendar_objectsRENAME TOoc_clndr_objects, CHANGEididINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, CHANGEcalendaridcalendaridINT UNSIGNED DEFAULT 0 NOT NULL, CHANGEstartdatestartdateDATETIME DEFAULT '1970-01-01 00:00:00', CHANGEenddateenddateDATETIME DEFAULT '1970-01-01 00:00:00'] \n[Native code: 1068] \n[Native message: Multiple primary key defined]\n)","level":4,"time":"2013-08-21T22:26:08+00:00"}12 remaining items
StrangeNoises commentedon Nov 29, 2013
every time there's a minor upgrade, it's a different table that needs fixing; but it's always the same problem; the fix being to remove the primary key index and then try the command listed in the error message again. it seems odd to me that it only errors on one table per upgrade and then is seemingly happy with the rest, until the next upgrade, when the next table needs it done...
StrangeNoises commentedon Nov 29, 2013
I first encountered this on 5.0.11 (before which I switched to mysql) (reported originally in my now-closed dupe bug #4809, now on 5.0.13 so actually it's only happened 3 times for me. FYI my entire .mysql_history from that time:
... which reminds me I did have some extra problem with the most recent time, with oc_vcategory.
But mostly included in case the order in which the tables are failing is illuminating...
ayedoit commentedon Dec 5, 2013
So you're saying, you already had the problem before the migration?
StrangeNoises commentedon Dec 5, 2013
before the migration to mysql? no, only had this problem since.
StrangeNoises commentedon Dec 5, 2013
that 'before which'... means that up until 5.0.10 I had been running it on the default sqlite db; but i was having extreme problems when trying to sync lots of files to multiple clients (that was the point at which i finally switched everything from dropbox, so everything got dropped in at once), so that's when I did the migration, as described, to mysql.
Then later than that, 5.0.11 came out and I upgraded... and this happened; and since then, with each minor-version upgrade, ie: from 5.0.10 to 5.0.11, to 5.0.12, to 5.0.13. Hence my rather dreading what's going to happen going up to version 6. :-}
karlitschek commentedon Dec 5, 2013
Awesome. This makes me really angry. This howto/conversion script that was publish on some 3rd party website killed another instance. Sorry @StrangeNoises but there is nothing we can do here. This db conversion changed your db structure in a way so that it can't be upgraded again.
:-(
StrangeNoises commentedon Dec 5, 2013
right well, i'm the only user of my instance. I'm in principle ok with starting afresh, but is there a better solution to the reason i did that migration anyway? which seems to have been that the sqlite implementation just gets hopelessly bogged down with any kind of concurrency requirements?
For my part, I'm actually more comfortable with postgresql, which I use in my day job, as being much more like a proper DB. I only didn't do it that way at the time as there wasn't a howto for the migration that came up in my searches...
Wikinaut commentedon Dec 5, 2013
Can someone (of you experts in commenting) please develop a clean ownCloud-SQlite-starter to MySQL-professional-user database converter, and also a Database-First-Aid-kit ?
I mean, a robust and error-resistant piece of maintenance software which repairs an ownCloud database. This is really needed. Unfortunately, I am not familiar with the ownCloud database table schema.
ayedoit commentedon Dec 5, 2013
Then maybe you should get familiar with it, you expert in commenting...
karlitschek commentedon Dec 6, 2013
Could you please calm down guys?
ownCloud is a volunteer project so we have to see if someone writes a working conversion script.
Someone should also work on a fix-broken-converted-databases routine. Are you interested @ayedoit ?
StrangeNoises commentedon Dec 13, 2013
FWIW, resolved my issues by nuking the site from orbit and installing owncloud 6 from scratch, configuring it from the outset (as opposed to trusting a future migration is possible) to use postgresql, using the information in the owncloud 6 admin manual to do so. All seems to be progressing smoothly (still re-syncing content which I'd thankfully backed up locally).
This wasn't too painful for me as I'm the only user of my owncloud install, and I had only been using it for basic file storage, no app use. Others might not be in that situation, so I'd say there probably is still an audience for migration guides/utilities; mainly because it may not be obvious at the outset (wasn't for me when I first installed it) that an sqlite-based install will have some severe performance limitations even for a single user (albeit with multiple client devices).
(Using postgresql rather than mysql because that's what I work with in my day job, so if I have to hack at it to fix stuff later, I can do so with a lot more confidence than I could with mysql. No need for any such hacking-at yet, so far; just gone by the admin manual.)
minor notelets:
1: The only postgresql dependencies I used (on Ubuntu 12.04) were postgresql-9.1 and php5-pgsql (and obviously the dependencies they bring in). Might be nice to add an owncloud-pgsql meta package to do that, like I see there now is for sqlite and mysql. :)
2: I didn't need to worry about writing the db connection params into config.php as the initial configuration wizard does that now. Might be reassuring to say so. :)
3: "sudo -u postgres psql" won't ask the user for an unknown (and in fact unset) password.
prologic commentedon Dec 14, 2013
Is this related: http://serverfault.com/questions/560836/owncloud-6-upgrade-lucene ?
VicDeo commentedon Feb 8, 2014
Closing as a duplicate of #999
IICR All instances that migrated from sqlite to Mysql are affected