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

6.2.x - Objects are indexed more than once in the same transaction

    Details

      Description

      Some services are indexing more than once the same object in the same transaction, just because they call to other methods that indexing the same object again, this should be avoided and only indexing the object at the end of the transaction.

      For example, in JournalArticle index operation, there are 4 request to indexer.reindex()

      • Three updates with status=draft (the three request are done in different points of JournalArticleLocalServiceImpl and AssetEntry framework)
      • A last update with status=published (this last update is done in updateStatus call, that is done at the end)

      As write to index is an asynchronous process, Indexing a object more than once can cause race condition problems in case of having first indexation request to be executed the last.

      Steps to reproduce:

      1. Activate debug traces for com.liferay.portal.search.lucene.LuceneIndexWriter
      2. Create a new webcontent and save it
      3. Check log for DefaultIndexerRequestBufferExecutor traces:
        • Expected behavior: only index request is executed and there are no duplicated indexation lines
          10:19:06,622 DEBUG [liferay/search_writer/SYSTEM_ENGINE-1][LuceneIndexWriter:124] Updated document 15_PORTLET_472816
          
        • Wrong behavior: 4 or 5 index request are executed and there are duplicated indexation lines
          10:19:06,622 DEBUG [liferay/search_writer/SYSTEM_ENGINE-1][LuceneIndexWriter:124] Updated document 15_PORTLET_472816
          10:19:06,800 DEBUG [liferay/search_writer/SYSTEM_ENGINE-3][LuceneIndexWriter:124] Updated document 15_PORTLET_472816
          10:19:06,800 DEBUG [liferay/search_writer/SYSTEM_ENGINE-4][LuceneIndexWriter:124] Updated document 15_PORTLET_472816
          10:19:06,801 DEBUG [liferay/search_writer/SYSTEM_ENGINE-2][LuceneIndexWriter:124] Updated document 15_PORTLET_472816
          

      Important: check only lines with 15_PORTLET fragment. Other lines with 19_PORTLET and similar doesn't belong to updated JournalArticle


      Note: Index Buffer is enabled by default since Liferay 6.2 fixpack 134. If you want to disable it, in 6.2 version you can deactivate it adding following property to portal-ext.properties file:

      index.request.buffer.enabled=false

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joyce.wang Joyce Wang
                Reporter:
                jorge.diaz Jorge Diaz
                Participants of an Issue:
                Recent user:
                Jorge Diaz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 43 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.X EE