Skip to content

OC 8.0.5 -> 8.1.0 -> master update key too long error with Mariadb #17619

Closed

Description

@PVince81

Steps

  1. Setup v8.0.5
  2. Create a folder "test"
  3. Share "test" with link and allow editing
  4. Open the link
  5. Upload a picture "test.jpg"
  6. Update the code to v8.1.0
  7. Refresh the public link page, the update prompt appears
  8. Click "Start update"
  9. Update the code to master (8.2)
  10. Run the update again in the web UI

Expected result

Successful update.

Actual result

{"reqId":"+Q2f7rZoXjSyoF7YZcqH","remoteAddr":"127.0.0.1","app":"update","message":"Exception: {\"Exception\":\"OC\\\\DB\\\\MigrationException\",\"Message\":\"An exception occurred while executing 'CREATE INDEX oc_qstjvjnerxxxi ON oc_oc_share_ill10p4z0s4zo (`file_target`)':\\n\\nSQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php(110): OC\\\\DB\\\\Migrator->checkTableMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Table))\\n
#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/mdb2schemamanager.php(133): OC\\\\DB\\\\Migrator->checkMigrate(Object(Doctrine\\\\DBAL\\\\Schema\\\\Schema))\\n
#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db.php(248): OC\\\\DB\\\\MDB2SchemaManager->simulateUpdateDbFromStructure('\\\/srv\\\/www\\\/htdocs...')\\n
#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/updater.php(319): OC_DB::simulateUpdateDbFromStructure('\\\/srv\\\/www\\\/htdocs...')\\n
#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/updater.php(286): OC\\\\Updater->checkCoreUpgrade()\\n
#5 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/updater.php(195): OC\\\\Updater->doUpgrade('8.2.0.1', '8.0.5.2')\\n
#6 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/core\\\/ajax\\\/update.php(88): OC\\\\Updater->upgrade()\\n
#7 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/db\\\/migrator.php\",\"Line\":152}","level":4,"time":"2015-07-13T16:02:22+00:00","method":"GET","url":"\/owncloud\/core\/ajax\/update.php?requesttoken=P3lDxfKIv1yPEMEk0Aefeb3yqkAm7Q"}
MariaDB [owncloud]> select * from oc_share;
+----+------------+------------+-----------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+-----------------+-----------+
| id | share_type | share_with | uid_owner | parent | item_type | item_source | item_target | file_source | file_target | permissions | stime      | accepted | expiration | token           | mail_send |
+----+------------+------------+-----------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+-----------------+-----------+
|  2 |          3 | NULL       | root      |   NULL | folder    | 8           | /8          |           8 | /fold       |           7 | 1436803256 |        0 | NULL       | y5u9ZPjCBnvleai |         0 |
+----+------------+------------+-----------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+-----------------+-----------+
1 row in set (0.01 sec)

Enabled apps

The default ones when checked out from git. (no third party)

Versions

v8.0.5 -> v8.1.0 -> master (1006ec5)
mariadb-10.0.13-2.6.1.x86_64

Happened twice. But the first time I upgraded directly from v8.0.5 to master.
And now happens too doing the three steps.

@DeepDiver1975 @icewind1991

Activity

  1. added this to the milestone on Jul 13, 2015
  2. PVince81 commented on Jul 13, 2015

    @PVince81
    ContributorAuthor

    Works properly with SQLite, must be MariaDB-specific

  3. PVince81 commented on Jul 13, 2015

    @PVince81
    ContributorAuthor

    Possibly related to the recent indices additions.

    @MorrisJobke did you really think it is that easy to add new indices ? 😉

  4. MorrisJobke commented on Jul 14, 2015

    @MorrisJobke
    Contributor

    An exception occurred while executing 'CREATE INDEX oc_qstjvjnerxxxi ON oc_oc_share_ill10p4z0s4zo (file_target)':\n\nSQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

    Why are such strange characters at the end?

  5. MorrisJobke commented on Jul 14, 2015

    @MorrisJobke
    Contributor

    I tried it multiple times (with both console and command line upgrade). I never experienced any problems.

    $ mysql --version
    mysql  Ver 15.1 Distrib 10.0.20-MariaDB, for Linux (x86_64) using readline 5.1
    
  6. PVince81 commented on Jul 14, 2015

    @PVince81
    ContributorAuthor

    No idea.

    I had this happening on two computers already. The one from my original report was mentioned above (it was on openSUSE 13.2), and I also had it on my laptop which has openSUSE Factory with mariadb-10.0.17-1.3.x86_64 (mysql Ver 15.1 Distrib 10.0.17-MariaDB, for Linux (x86_64) using EditLine wrapper)

    Maybe your mysql is too recent ? 😉

  7. PVince81 commented on Jul 14, 2015

    @PVince81
    ContributorAuthor

    Would be good if someone else could confirm this issue @icewind1991 @DeepDiver1975 ?

  8. DeepDiver1975 commented on Jul 14, 2015

    @DeepDiver1975
    Contributor

    There is nothing magic to this - the max key length with InnoDB is 767 bytes.
    Having a 3-byte charset a column with varchar(512) simply exceeds this max length
    512*3 = 1536

  9. MorrisJobke commented on Jul 14, 2015

    @MorrisJobke
    Contributor

    I will remove the index in a PR

  10. added a commit that references this issue on Jul 14, 2015
    ff5bd9d
  11. MorrisJobke commented on Jul 14, 2015

    @MorrisJobke
    Contributor
  12. locked as resolved and limited conversation to collaborators on Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions