This issue has been created
There are 2 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-a2a6d7db-fa86-4612-bbf4-6e109828f8ad XWIKI-25211 Open

The migration increasing the columns size to 768 skips the columns declared in lowercase on HSQLDB and Oracle

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-9006bcc9-2dae-4f90-9ed7-9243c1863f76 Simon Urli created this issue on 08/Oct/26 11:12
 
Summary: The migration increasing the columns size to 768 skips the columns declared in lowercase on HSQLDB and Oracle
Issue Type: cid:jira-generated-image-avatar-a2a6d7db-fa86-4612-bbf4-6e109828f8ad Bug
Affects Versions: 13.2-rc-1
Assignee: Unassigned
Components: Old Core
Created: 08/Oct/26 11:12
Priority: cid:jira-generated-image-static-major-b66e0d64-5835-497f-a104-187c44b1d2cc Major
Reporter: Simon Urli
Description:

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:

ERROR o.h.e.j.s.SqlExceptionHelper - data exception: string data, right truncation ; size limit: 255 table: ACTIVITYSTREAM_EVENTS column: ASE_PAGE
ERROR .x.x.s.XWikiHibernateBaseStore - Exception while closing the transaction
javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute statement
	at org.xwiki.eventstream.store.internal.LegacyEventSaver.saveLegacyEvent(LegacyEventSaver.java:94)

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.

 
 

2 updates

 
cid:jira-generated-image-avatar-9006bcc9-2dae-4f90-9ed7-9243c1863f76 Changes by Simon Urli on 08/Oct/26 11:12
 
Fix Version: 18.9.0-rc-1
Assignee: Simon Urli