Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-72900

Nonsensical warning messages when calling LayoutPersistence.fetchByL_H_P



      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

      1. Add the line value.object.finder.cache.enabled.com.liferay.portal.kernel.model.LayoutRevision=false to your portal-ext.properties file.
      2. Start up the portal and log in as the admin user.
      3. Enable local live staging with page versioning enabled on public pages.
      4. Go to the welcome page and add a few portlets (you must add multiple portlets after enabling staging).
      5. 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)


        1. 7.0 pass.png
          7.0 pass.png
          63 kB
        2. master pass.png
          master pass.png
          124 kB



            steven.gao Steven Gao (Inactive)
            michael.bowerman Michael Bowerman
            Participants of an Issue:
            Recent user:
            Marta Elicegui
            0 Vote for this issue
            1 Start watching this issue


              Days since last comment:
              5 years, 5 days ago


                Version Package
                7.0.0 DXP FP23
                7.0.X EE
                7.0.4 CE GA5