Issue
While updating to quarterly releases, an error is shown in the log and several modules do not start correctly.
IndexUpdaterUtil-BundleTrackerOpener][IndexUpdaterUtil] Skipped updating database indexes for com.liferay.document.library.service since it is not upgraded
Executing this query on the database returns '2' in the state_ column, which means that a problem occurred while updating the component: ReleaseConstants.STATE_VERIFY_FAILURE.
select * from Release_ where servletContextName like('com.liferay.document.library.service')
Environment
- Quarterly releases
Resolution
The probable reason for getting this value during the update might be a missing DLFileVersion linked to DLFile
2024-06-05 09:16:19.658 ERROR [main][VerifyProcessTrackerOSGiCommands:323] com.liferay.document.library.kernel.exception.NoSuchFileVersionException: No DLFileVersion exists with the key {fileEntryId=409124855, version=1.0}
com.liferay.portal.verify.VerifyException: com.liferay.document.library.kernel.exception.NoSuchFileVersionException: No DLFileVersion exists with the key {fileEntryId=409124855, version=1.0}
Executing this query on the database will return all missing DLFileVersion:
SELECT fileEntryId
FROM dlfileentry where fileEntryId not in (select fileEntryId from dlfileversion);
A workaround to get this module working again is to delete all inconsistent data with this Groovy script:
package com.liferay.support;
import com.liferay.document.library.kernel.service.DLFileEntryLocalServiceUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
public class CheckDLFileEntryVersions {
boolean _fix = false;
Log _log = LogFactoryUtil.getLog("LIFERAY_SUPPORT");
public CheckDLFileEntryVersions(boolean doUpdate) {
this._fix= doUpdate;
}
public void deleteDLFileEntries () {
List<Long> deleteFileEntryIds = new ArrayList<Long>();
deleteFileEntryIds.add(32879L); ///INCLUDE ALL fileEntryId returned by the previous query
long retValue = 0;
if (_fix) {
for (long fileEntryId : deleteFileEntryIds) {
try {
DLFileEntryLocalServiceUtil.deleteFileEntry(DLFileEntryLocalServiceUtil.getFileEntry(fileEntryId));
_log.error("DELETED fileEntry with fileEntryId " + fileEntryId);
retValue++;
} catch (Exception e) {
_log.error("!!!! ERROR", e)
}
}
}
_log.error("#### Deleted"+retValue);
}
}
// set to true for fixing errors
boolean FIX_ERRORS = true;
Thread.start({
(new CheckDLFileEntryVersions(FIX_ERRORS)).deleteDLFileEntries();
})
After executing these tasks on the original database, the issue will be resolved. An example of the steps executed is explained below:
- Plan to upgrade from Liferay 7.4.13-u60 to 2024.q1.11.
- Execute a query to get inconsistent DLFileVersion entries.
- Execute the Groovy script on u60 to clean the inconsistencies.
- Copy the sanitized database.
- Execute the upgrade to 2024.q1.11.
- No errors like the ones described before will be shown, and the modules will start correctly and state_ column in release_ table is "0"-ReleaseConstants.STATE_GOOD.