Problem On HSQLDB and Oracle, the migration that increases the size of the columns to 768 characters (introduced by XWIKI-18429 and XWIKI-18497, currently executed by R140200010XWIKI19207DataMigration through AbstractResizeMigration) silently skips every column whose Hibernate mapping declares a lowercase column name. Those columns keep their old size of 255 characters on instances created before XWiki 13.2. As a consequence, saving a value longer than 255 characters in one of those columns fails. For example, with the legacy activity stream store, an event about a page whose reference is longer than 255 characters cannot be saved:
This happens on every upgrade functional test starting from data that contains the legacy activity stream table (Upgrade84Test, Upgrade84FileStoreTest, Upgrade911Test, Upgrade1011Test, Upgrade1110Test, Upgrade1210CustomTest). Cause AbstractResizeMigration reads the current size of each column with DatabaseMetaData#getColumns, using HibernateStore#getConfiguredColumnName(Column) for the column name. That method only adjusts the case for PostgreSQL. The table name goes through HibernateAdapter#getTableName, which uppercases it for HSQLDB and Oracle, but the column name is passed as written in the mapping. HSQLDB and Oracle store unquoted identifiers in uppercase, so a lowercase column name such as ase_page is not found, the migration considers that the column does not exist, and skips it. Columns declared in uppercase (for example all the xwiki.hbm.xml columns like XWD_FULLNAME) are found and resized, which is why the problem only affects some tables. The mappings using lowercase column names are:
- eventstream.hbm.xml / eventstream.oracle.hbm.xml (legacy activity stream)
- notification-filter-preferences.hbm.xml
- mailsender.hbm.xml / mailsender.oracle.hbm.xml
- feeds.hbm.xml / feeds.oracle.hbm.xml
Confirmed by running Upgrade1210CustomTest with extra logging in AbstractResizeMigration: the LegacyEvent entity is found (ACTIVITYSTREAM_EVENTS exists) but the database size of all its columns is null. MySQL/MariaDB (case-insensitive column lookup) and PostgreSQL (lowercased explicitly) are not affected. Expected The column names are resolved with the same case rules as the table names, and a new migration resizes the columns that were skipped on instances which already executed R140200010XWIKI19207. |