Affects Version/s: 7.0.X EE, Master
The persistence classes allow for a "literal unique finder" and a "conceptual unique finder", The literal unique finder is enforced by a unique index in the database, whereas the conceptual unique finder is not. See https://github.com/mbowerman/liferay-portal/blob/master/modules/util/portal-tools-service-builder/src/main/resources/com/liferay/portal/tools/service/builder/dependencies/persistence_impl_finder_find.ftl#L63-L66 for more information.
There is no reason to have LayoutRevision.fetchByL_H_P as a unique finder, since it is expected that there will be many revisions of the same page for which head is false. Because we will occasionally call LayoutRevisionPersistence.fetchByL_H_P with head = false from the code, this will result in nonsensical warning messages in the logs falsely claiming that a unique restriction was violated.
Steps to Reproduce
- Add the line value.object.finder.cache.enabled.com.liferay.portal.kernel.model.LayoutRevision=false to your portal-ext.properties file.
- Start up the portal and log in as the admin user.
- Enable local live staging with page versioning enabled on public pages.
- Go to the welcome page and add a few portlets (you must add multiple portlets after enabling staging).
- Refresh the page and expand the left-hand menu > Liferay - Staging > Navigation (if it isn't expanded already).
Expected Result: No messages would appear in the logs.
Actual Result: A warning message appears in the logs as follows: 21:37:50,969 WARN [http-nio-8080-exec-13][LayoutRevisionPersistenceImpl:5157] LayoutRevisionPersistenceImpl.fetchByL_H_P(long, boolean, long, boolean) with parameters (34430,false,34421) yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.
If you have lots of pages, many instances of this message will appear in the logs.
Reproduced in master (c2cc5f1769c1a33db7d1a2ce50e14d46b48afa42)
Reproduced in ee-7.0.x (45366dc4221eb34df56ce403dccc82c457ae80e5)