Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-20584

Fix ElasticSearch ResultSet Size calculation when Offsets and Limits are in use

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 8.3
    • Fix Version/s: 9.1
    • Component/s: Elasticsearch
    • Tags:
    • Backlog priority:
      700
    • Upgrade notes:
      Hide

      EsResultSetImpl#size now returns the available number of results in the iterator. Previously it was retruning the total number of results that match the query, you can use EsResultSetImpl#totalSize for backward compatibility.

      Show
      EsResultSetImpl#size now returns the available number of results in the iterator. Previously it was retruning the total number of results that match the query, you can use EsResultSetImpl#totalSize for backward compatibility.
    • Sprint:
      nxBD 8.10.2, nxBD 9.1.3
    • Story Points:
      2

      Description

      The calculation performed in method EsResultSetImpl.size() is currently broken in the 8.3 release and on the master branch. The patch below to test method TestCompareQueryAndFetch.testPagingOffsetsAndLimits() exposes the bug.
      In order to fix the problem, I suggest that this method calculate the result set size from either variable EsResultSetImpl.size or EsResultSetImpl.response.getHits().getHits().length.

      see failedTest.patch attached

      This gives the following output:

      Results :
      
      Failed tests: 
        TestCompareQueryAndFetch.testSimpleSearchWithSort:196->compareESAndCore:186->assertSameDocumentLists:179 expected:<..., file:content/data=[450cf8f828c6e3d75236f87fc690cba2, file:content/length=8, file:content/name=null]
      [ecm:uuid=467ef3c8-8524-46e9-af29-94256054cbf7, file:content/data=5cbee8da73bc276ae6e68e049392fe93, file:content/length=8, file:content/name=null]
      [ecm:uuid=756f89ee-279b-4af1-8ac8-813e5d7caed0, file:content/data=9cf09c4d99640f6016187083df59162a, file:content/length=8, file:content/name=null]
      [ecm:uuid=96ade73e-abf0-49e3-9328-8fe5f6ab59b3, file:content/data=fa24d6cd699ee300f6a7a5c9e8a89c2b, file:content/length=8, file:content/name=null]
      [ecm:uuid=9f481ed1-b01c-49d2-ad6a-004b30ff8d46, file:content/data=164f329200948fdbe11e263ee3b2922b, file:content/length=8, file:content/name=null]
      [ecm:uuid=c652ed6a-9275-40b3-bffe-b59a7ca4cb20, file:content/data=9cf09c4d99640f6016187083df59162a, file:content/length=8, file:content/name=null]
      [ecm:uuid=d18f7b06-1a7e-40fb-b4de-9923d0effee8, file:content/data=5cbee8da73bc276ae6e68e049392fe93, file:content/length=8, file:content/name=null]
      [ecm:uuid=dde6b9d5-366b-47a3-8a95-448262b49620, file:content/data=5cbee8da73bc276ae6e68e049392fe93, file:content/length=8], file:content/name=...> but was:<..., file:content/data=[null, file:content/length=null, file:content/name=null]
      [ecm:uuid=467ef3c8-8524-46e9-af29-94256054cbf7, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=756f89ee-279b-4af1-8ac8-813e5d7caed0, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=96ade73e-abf0-49e3-9328-8fe5f6ab59b3, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=9f481ed1-b01c-49d2-ad6a-004b30ff8d46, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=c652ed6a-9275-40b3-bffe-b59a7ca4cb20, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=d18f7b06-1a7e-40fb-b4de-9923d0effee8, file:content/data=null, file:content/length=null, file:content/name=null]
      [ecm:uuid=dde6b9d5-366b-47a3-8a95-448262b49620, file:content/data=null, file:content/length=null], file:content/name=...>
        TestCompareQueryAndFetch.testPagingOffsetsAndLimits:215 expected:<2> but was:<8>
        RestESDocumentsTest.iCanPerformESQLPageProviderOnRepository:124 expected:<15> but was:<4>
      
      Tests run: 170, Failures: 3, Errors: 0, Skipped: 2
      
      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO] 
      [INFO] Nuxeo Elasticsearch Parent ......................... SUCCESS [ 12.769 s]
      [INFO] Elasticsearch Connector implementation ............. FAILURE [ 57.477 s]
      [INFO] Elasticsearch WebApp integration ................... SKIPPED
      [INFO] Elasticsearch based Sequence generator ............. SKIPPED
      [INFO] Elasticsearch based Audit backend implementation ... SKIPPED
      [INFO] Nuxeo Elasticsearch HTTP Read Only ................. SKIPPED
      [INFO] Nuxeo Elasticsearch Automation Module .............. SKIPPED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 01:11 min
      [INFO] Finished at: 2016-10-04T11:36:47+02:00
      [INFO] Final Memory: 103M/899M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project nuxeo-elasticsearch-core: There are test failures.
      [ERROR] 
      [ERROR] Please refer to /Users/ffischer/nuxeo-master/nuxeo-features/nuxeo-elasticsearch/nuxeo-elasticsearch-core/target/surefire-reports for the individual test results.
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
      [ERROR] 
      [ERROR] After correcting the problems, you can resume the build with the command
      [ERROR]   mvn <goals> -rf :nuxeo-elasticsearch-core
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m