Uploaded image for project: 'mod-circulation-storage'
  1. mod-circulation-storage
  2. CIRCSTORE-226

Missing records when offset >= totalRecords

    XMLWordPrintable

    Details

    • Template:
      Standard Bug Write-Up Format
    • Sprint:
      CP: sprint 94, CP: sprint 95
    • Story Points:
      0
    • Development Team:
      Core: Platform
    • Release:
      Q2 2020 Hot Fix #2
    • Affected Institution:
      Chalmers

      Description

      Overview:

      When offset >= totalRecords then no more records are returned, even if there are more (when totalRecords estimation is smaller than actual number of records).

      Steps to Reproduce:

      Locally run mod-circulation-storage 12.0.1 (this is based on RMB 30.2.4).

      Create 2000 open loans:

      OKAPI="${OKAPI:-http://localhost:8081}"
      
      TOKEN=$( curl -s -S -D - -H "X-Okapi-Tenant: diku" -H "Content-type: application/json" -H "Accept: application/json" \
        -d '{"tenant":"diku","username":"diku_admin","password":"admin"}' $OKAPI/authn/login \
        | grep -i "^x-okapi-token: " )
      
      OPT=(-w"\n" --http1.1 -s -S -D - -H "$TOKEN" -H "X-Okapi-Tenant: diku" -H "Content-type: application/json" -H "Accept: application/json")
      
      for i in `seq 90001 92000`
      do
        REQUEST="{
          \"id\":     \"000${i}-f5be-41ea-8665-5c810246757e\",
          \"itemId\": \"000${i}-f5be-41ea-8665-5c810246757e\",
          \"userId\": \"ceecd8ee-9586-4024-b107-d368b58a1025\",
          \"loanDate\": \"2020-02-02T20:02:02\",
          \"status\": {
            \"name\": \"Open\"
          },
          \"action\": \"checkedout\",
          \"itemStatus\": \"Checked out\"
        }"
        curl "${OPT[@]}" -d "$REQUEST" $OKAPI/loan-storage/loans
      done
      

      GET /loan-storage/loans?offset=999&limit=2&query=status.name=Open
      correctly returns 2 records:

      {
        "loans" : [ {
          "id" : "00090997-f5be-41ea-8665-5c810246757e",
          "userId" : "ceecd8ee-9586-4024-b107-d368b58a1025",
          "itemId" : "00090997-f5be-41ea-8665-5c810246757e",
          "status" : {
            "name" : "Open"
          },
          "loanDate" : "2020-02-02T20:02:02",
          "action" : "checkedout",
          "itemStatus" : "Checked out",
          "metadata" : {
            "createdDate" : "2020-07-27T17:13:38.765+0000",
            "updatedDate" : "2020-07-27T17:13:38.765+0000"
          }
        }, {
          "id" : "00090998-f5be-41ea-8665-5c810246757e",
          "userId" : "ceecd8ee-9586-4024-b107-d368b58a1025",
          "itemId" : "00090998-f5be-41ea-8665-5c810246757e",
          "status" : {
            "name" : "Open"
          },
          "loanDate" : "2020-02-02T20:02:02",
          "action" : "checkedout",
          "itemStatus" : "Checked out",
          "metadata" : {
            "createdDate" : "2020-07-27T17:13:38.782+0000",
            "updatedDate" : "2020-07-27T17:13:38.782+0000"
          }
        } ],
        "totalRecords" : 1001
      }
      

      GET /loan-storage/loans?offset=1000&limit=2&query=status.name=Open
      incorrectly returns none:

      {
        "loans" : [ ],
        "totalRecords" : 1000
      }
      

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                julianladisch Julian Ladisch
                Reporter:
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases