Issue
- I am performing an upgrade to 7.4 and it fails with errors like these:
com.liferay.portal.kernel.log.LogSanitizerException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.BatchUpdateException:
Batch entry 155 insert into DDMFieldAttribute (mvccVersion, ctCollectionId, fieldAttributeId, companyId, fieldId, storageId, attributeName, languageId, largeAttributeValue, smallAttributeValue)
values (0, 0, 221906, 10108, 197794, 15585405, '', '', NULL, 'Optimized by JPEGmini 3.18.2.210033067-TBTBLN 0xa358ba22Optimized by JPEGmini 3.18.2.210033067-TBTBLN 0xa358ba22_')
was aborted: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Call getNextException to see other errors in the batch. [Sanitized]
Environment
- Upgrades to 7.4+
Resolution
- The problem is that in your database there are some (or there is a) record with the data containing the "\u0000" literal string (e.g. findable with a command like
SELECT * FROM DDMContent WHERE data_ like '%\\u0000%'
). Such records cause that error at upgrade. - As of writing this article, no deeper root cause has been determined yet: e.g. how these parts, these characters are added to the database with normal operation
- This can be handled through a groovy script that needs to be run in your original pre-upgrade database. The script will scan the DDMContent table and remove any instances of the "\u0000" literal string (note: It does not remove the entire DDMContent, it just removes the "\u0000" string from the DDMContent's data).
- You can find the script RemoveUnicodeNullValuesFromDDMContentData.groovy for 7.2 attached in this article (it should work for 7.3 too).
To summarize:
- Get back to your original database (or a copy of it). You can drop the one on which you ran the failed upgrade script.
- Make sure to have a backup of it.
- Run the groovy script on it. (from the UI, in Server Administration/Script)
- Then try to run again the upgrade.sh on this database.
Since the offending characters have been removed by the script (step 3), the upgrade should not run anymore into this issue.