Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-684

GET query returns no records when offset value > estimated totalRecords

    XMLWordPrintable

Details

    • CP: sprint 94, CP: sprint 95
    • 2
    • Core: Platform
    • Q2 2020 Hot Fix #1
    • Chalmers

    Description

      Overview: Given a query that matches >= 1000 rows, it is not possible to use limit and offset together to retrieve rows after the 999th because when limit is greater than 999, the result array is always empty. This makes it impossible to retrieve paged data beyond the 999th record.

      Steps to reproduce:

      1. One way or another, find out the actual number of loans with Status "Open". In our case, it is 6023.
      2. Make this request to find out the estimated totalRecords count:
        {{okapi-url}}/loan-storage/loans?limit=0&query=(status.name="Open")
        

        Make a note that totalRecords: 1000.

      3. Attempt to retrieve these 6023 loans by making the 7 times, incrementing offset by 1000 for each iteration:
        {{okapi-url}}/loan-storage/loans?limit=1000&offset=0&query=(status.name="Open") 
        

      Expected result:
      The first 6 requests return 1000 loans each. The 7th request returns 23 loan objects.

      Actual result:
      The first request returns 1000. The subsequent requests return [] loans.

      Additional information:
      The same behaviour can be observed in the bugfest tenant as well.

      If the offset parameter > than totalRecords, no records are returned. This can be demonstrated by the following steps:

      1. Make the following request:
        {{okapi-url}}/loan-storage/loans?limit=1000&offset=1000&query=(status.name="Open"). 
        

      This should return loans 1000 loans, but actually returns [] – ie no loans past totalRecords.

      1. Now change the offset to be < totalRecords:
        {{okapi-url}}/loan-storage/loans?limit=200&offset=900&query=(status.name="Open") 
        

      After the last request, we might expect this to return 100 loans, stopping at the totalRecords. However, this actually returns 200 loans – ie the correct result, and 100 loans past the totalRecords.

      This issue has also been observed in Inventory, see https://issues.folio.org/browse/CHAL-294

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                julianladisch Julian Ladisch
                ttolstoy Theodor Tolstoy
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases