Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19486

Potential error related to XWV_COOKIE key during a migration of extremely old XWiki instance

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      It takes an instance which started its life before XWiki 1.2 to get this problem, so it's starting to be quite unlikely but possible.

      In such a case we can end up with the following error:

      Caused by: liquibase.exception.DatabaseException: (conn=115) BLOB/TEXT column 'XWV_COOKIE' used in key specification without a key length [Failed SQL: (1170) alter table xwikistatsvisit MODIFY XWV_COOKIE longtext not null]
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:392)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:81)
      at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:149)
      at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
      at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
      at liquibase.changelog.ChangeSet.execute(ChangeSet.java:660)
      ... 70 common frames omitted
      Caused by: java.sql.SQLSyntaxErrorException: (conn=115) BLOB/TEXT column 'XWV_COOKIE' used in key specification without a key length
      at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
      at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:158)
      at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:266)
      at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:366)
      at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:504)
      at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
      at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
      at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
      at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:388)
      ... 75 common frames omitted
      Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: BLOB/TEXT column 'XWV_COOKIE' used in key specification without a key length
      at org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException.of(MariaDbSqlException.java:34)
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:194)
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:262)
      at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:360)
      ... 80 common frames omitted
      Caused by: java.sql.SQLException: BLOB/TEXT column 'XWV_COOKIE' used in key specification without a key length
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1694)
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1556)
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1519)
      at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:256)
      ... 81 common frames omitted
      

      The workaround for this is to get rid of the old "xwv_cookie" key which wrongly does not have an explicit lengh despite the fact that XWV_COOKIE is way too big to have a KEY.

      The reason is that in XWIKI-1911 (1.2) the XWV_COOKIE became a varchar(8192) without a key while it used to be a varchar(255) with a key. No migration was implemented back then, so it remained like this forever until we try to change the type of XWV_COOKIE from varchar to longtext (for XWIKI-15215, but the actual migration was added in 13.2RC1 and 12.10.6).

      The workaround is to get rid of the key "xwv_cookie" in the "xwikistatsvisit" table.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            tmortagne Thomas Mortagne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: