Error on update to 5.0.2 - Integrity constraint violation
On update from 5.0.0, I have this error.
Updated database Updating filecache, this may take really long... ... 20% done ... ... 40% done ... SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
@icewind1991 probably \OC\Files\Cache::getNewData() does not get the mimetype?
I can confirm this, I get exactly the same error upgrading from 5.0.0 to 5.0.3
Confirmed:
-
Clean update from 4.5.6 to 5.0.3 -> SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
-
Clean update from 4.5.6 to 5.0.0 -> OK
-
Clean update from 5.0.0 to 5.0.3 -> SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
Checking the contents of the oc_filecache and oc_fscache and oc_mimetypes tables, I don't have any NULL values in any mimetype column.
These are the warnings I find in the log:
Warning PHP Undefined index: mimetype at owncloud/lib/files/cache/upgrade.php#137 03.04.2013 17:35 Warning PHP Undefined index: writable at owncloud/lib/files/cache/upgrade.php#135 03.04.2013 17:35 Warning PHP Undefined index: parent at owncloud/lib/files/cache/upgrade.php#134 03.04.2013 17:35 Warning PHP Undefined index: path at owncloud/lib/files/cache/upgrade.php#128 03.04.2013 17:35 Warning PHP Undefined offset: 1 at owncloud/lib/files/cache/legacy.php#88 03.04.2013 17:35 Warning PHP Undefined offset: 3 at owncloud/lib/files/cache/legacy.php#88 03.04.2013 17:35
@icewind1991 @Raydiation @bartv2 Could you look into that?
I have a similar problem.
When updating from 4.5.8 to 5.0.3 I get:
Turned on maintenance mode Updated database SQLSTATE[23000]: Integrity constraint violation: 19 oc_mimetypes.mimetype may not be NULL
I'm seeing the same things upon a 5.0.0 --> 5.0.3:
... 34% done ... ... 35% done ... ... 36% done ... ... 37% done ... ... 38% done ... SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
The update was unsuccessful. Please report this issue to the ownCloud community.
owncloud.log:
{"app":"PHP","message":"Undefined offset: 3 at /WEBSFTP/WEB/owncloud/lib/files/cache/legacy.php#88","level":2,"time":1365011435} {"app":"PHP","message":"Undefined offset: 1 at /WEBSFTP/WEB/owncloud/lib/files/cache/legacy.php#88","level":2,"time":1365011435} {"app":"PHP","message":"Undefined index: path at /WEBSFTP/WEB/owncloud/lib/files/cache/upgrade.php#128","level":2,"time":1365011435} {"app":"PHP","message":"Undefined index: parent at /WEBSFTP/WEB/owncloud/lib/files/cache/upgrade.php#134","level":2,"time":1365011435} {"app":"PHP","message":"Undefined index: writable at /WEBSFTP/WEB/owncloud/lib/files/cache/upgrade.php#135","level":2,"time":1365011435} {"app":"PHP","message":"Undefined index: mimetype at /WEBSFTP/WEB/owncloud/lib/files/cache/upgrade.php#137","level":2,"time":1365011435}
I have the same problem 5.0.0 --> 5.0.3
Turned on maintenance mode Updated database Updating filecache, this may take really long... ... 16% done ... SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
Hi,
Same issue, from 5.0.0 to 5.0.3
Turned on maintenance mode Updated database Updating filecache, this may take really long... ... 25% done ... ... 50% done ... SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
Can I help (give you an error log file) ?
The excact same thing happened to me: Update from 5.0.0 to 5.0.3 leads to Integrity constraint violation.
@icewind1991 @blizzz @bartv2 can you have a look?
@icewind1991 In https://github.com/owncloud/core/blob/stable5/lib/files/cache/upgrade.php#L137 and https://github.com/owncloud/core/blob/stable5/lib/files/cache/upgrade.php#L138 should not $newData['mimetype'] and $newData['mimepart'] be $data['mimetype'] and $data['mimepart'] instead?
Could the others try with that change?
As I am absolutely not unable to reproduce this, let us shoot a bit more into the blue.
Those with the issue, could you try add following code before https://github.com/owncloud/core/blob/stable5/lib/files/cache/upgrade.php#L202
if(!$user) {
return;
}
I added the ReturnIfUserNotDefined-Code and changed config/config.php:maintenance to false.
When I now reload the page I see no difference:
Turned on maintenance mode
Updated database
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
Did you also change what I suggested in https://github.com/owncloud/core/issues/2650#issuecomment-15886954 ?
Not when I posted this: https://github.com/owncloud/core/issues/2650#issuecomment-15887417
But I tried again with all your suggestions, but still no difference.
hm, i had this issue as well, applying the !user fix in https://github.com/owncloud/core/issues/2650#issuecomment-15887040 , turning off maintenance and rerunning the update turned out ok
How did you rerun the update? Did you just reload the page, or did you reinstall the updated files?
Remove the maintenance mode line in config/config.php and refresh the browser.
Ok, that's what I did in https://github.com/owncloud/core/issues/2650#issuecomment-15887417 and didn't work. Anyways, I tried it again right now, but I'm still seeing the same error message.
@blizz you mean like this, right? $newData['mimetype'] = $this->getMimetypeId($data['mimetype'], $storage); $newData['mimepart'] = $this->getMimetypeId($data['mimepart'], $storage); That's what I did in /lib/files/cache/upgrade.php, plus inserting the !$user part at the right place. Doesn't matter if I do the changes before attempting the upgrade or after that, the error just stays the same, cannot finish the upgrade: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null
Here is the owncloud log: {"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1365075733} {"app":"core","message":"starting upgrade from 5.0.0 to 5.0.3","level":0,"time":1365075733} {"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1365075733} {"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1365075733} {"app":"PHP","message":"Undefined offset: 3 at /var/www/oc2/lib/files/cache/legacy.php#88","level":2,"time":1365075734} {"app":"PHP","message":"Undefined offset: 1 at /var/www/oc2/lib/files/cache/legacy.php#88","level":2,"time":1365075734} {"app":"PHP","message":"Undefined index: path at /var/www/oc2/lib/files/cache/upgrade.php#128","level":2,"time":1365075734} {"app":"PHP","message":"Undefined index: parent at /var/www/oc2/lib/files/cache/upgrade.php#134","level":2,"time":1365075734} {"app":"PHP","message":"Undefined index: writable at /var/www/oc2/lib/files/cache/upgrade.php#135","level":2,"time":1365075734} {"app":"PHP","message":"Undefined index: mimetype at /var/www/oc2/lib/files/cache/upgrade.php#137","level":2,"time":1365075734} {"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1365075734} {"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1365075734}