core icon indicating copy to clipboard operation
core copied to clipboard

Error on update to 5.0.2 - Integrity constraint violation

Open zeppelinlg opened this issue 13 years ago • 45 comments

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

zeppelinlg avatar Apr 02 '13 13:04 zeppelinlg

@icewind1991 probably \OC\Files\Cache::getNewData() does not get the mimetype?

blizzz avatar Apr 02 '13 14:04 blizzz

I can confirm this, I get exactly the same error upgrading from 5.0.0 to 5.0.3

torlasz avatar Apr 03 '13 09:04 torlasz

Confirmed:

  1. Clean update from 4.5.6 to 5.0.3 -> SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mimetype' cannot be null

  2. Clean update from 4.5.6 to 5.0.0 -> OK

  3. 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

soulianis avatar Apr 03 '13 15:04 soulianis

@icewind1991 @Raydiation @bartv2 Could you look into that?

karlitschek avatar Apr 03 '13 16:04 karlitschek

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

smiddy avatar Apr 03 '13 17:04 smiddy

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}

ernstae avatar Apr 03 '13 17:04 ernstae

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

alyarmak avatar Apr 03 '13 19:04 alyarmak

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) ?

felixgilles avatar Apr 03 '13 20:04 felixgilles

The excact same thing happened to me: Update from 5.0.0 to 5.0.3 leads to Integrity constraint violation.

sesceu avatar Apr 04 '13 08:04 sesceu

@icewind1991 @blizzz @bartv2 can you have a look?

karlitschek avatar Apr 04 '13 08:04 karlitschek

@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?

blizzz avatar Apr 04 '13 09:04 blizzz

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;
}

blizzz avatar Apr 04 '13 09:04 blizzz

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

sesceu avatar Apr 04 '13 09:04 sesceu

Did you also change what I suggested in https://github.com/owncloud/core/issues/2650#issuecomment-15886954 ?

blizzz avatar Apr 04 '13 09:04 blizzz

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.

sesceu avatar Apr 04 '13 09:04 sesceu

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

cnlpete avatar Apr 04 '13 10:04 cnlpete

How did you rerun the update? Did you just reload the page, or did you reinstall the updated files?

sesceu avatar Apr 04 '13 10:04 sesceu

Remove the maintenance mode line in config/config.php and refresh the browser.

blizzz avatar Apr 04 '13 10:04 blizzz

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.

sesceu avatar Apr 04 '13 11:04 sesceu

@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}

torlasz avatar Apr 04 '13 11:04 torlasz