Uploaded image for project: 'mod-inventory-storage'
  1. mod-inventory-storage
  2. MODINVSTOR-516

Cannot safely update holdings and items concurrently for any given instance

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: P2
    • Resolution: Won't Do
    • Affects Version/s: 19.3.2
    • Fix Version/s: None
    • Labels:
    • Template:
      Standard Bug Write-Up Format
    • Development Team:
      Core: Platform
    • Affected Institution:
      Cornell, Lehigh, MO State, Simmons
    • Epic Link:

      Description

      When attempting to update holdings and their items concurrently the holdings updates will ever so often interfere with the item updates, effectively nullifying the latter.

      Update: The module with the code that surfaced/illustrated the problem in mod-inventory-storage now exists under a new name: mod-inventory-update. The example code to reveal the problem in mod-inventory-storage no longer exists, except for in this somewhat historic commit to the module under its previous name. The mod-inventory-match/mod-inventory-update has worked around the issue in mod-inventory-storage ever since this ticket was filed, simply by refraining from updating holdings and items concurrently (and instead update first holdings, then items, sequentially that is).

      The dis-enabled code here would show that

      https://github.com/openlibraryenvironment/mod-inventory-match/blob/hrid-upsert/src/main/java/org/folio/inventorymatch/UpdatePlan.java#L46

      Where as the currently enabled code works:

      https://github.com/openlibraryenvironment/mod-inventory-match/blob/hrid-upsert/src/main/java/org/folio/inventorymatch/UpdatePlan.java#L69

      With mod-inventory-match (branch `hrid-upsert`) and inventory storage running in a FOLIO installation and executing this curl command

      curl -X PUT -D - \
        -H "Content-type: application/json" \
        -H "X-Okapi-Tenant: $tenant" \
        -H "X-Okapi-Token: $token" \
        -d @$file $protocol://$host/inventory-upsert-hrid
      

      to push this record set:

      {
          "instance": {
            "title": "Instance 1",
            "source": "Local",
            "instanceTypeId": "6312d172-f0cf-40f6-b27d-9fa8feaf332f",
            "hrid": "ins001",
            "identifiers": [
              {
                "identifierTypeId": "8261054f-be78-422d-bd51-4ed9f33c3422",
                "value": "9781466636897"
              }
            ]
          },
          "holdingsRecords": [
            {
              "callNumber": "Holdings 1",
              "permanentLocationId": "53cf956f-c1df-410b-8bea-27f712cca7c0",
              "hrid": "hol001",
              "items": [
                {
                  "itemIdentifier": "it001",
                  "hrid": "it001",
                  "barcode": "Item 1",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Available"
                  }
                },
                {
                  "itemIdentifier": "it002",
                  "hrid": "it002",
                  "barcode": "Item 2",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Available"
                  }
                }
              ]
            },
            {
              "callNumber": "Holdings 2",
              "permanentLocationId": "fcd64ce1-6995-48f0-840e-89ffa2288371",
              "hrid": "hol002",
              "items": [
                {
                  "itemIdentifier": "it003",
                  "hrid": "it003",
                  "barcode": "Item 3",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Available"
                  }
                },
                {
                  "itemIdentifier": "it004",
                  "hrid": "it004",
                  "barcode": "Item 4",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Available"
                  }
                }
      
              ]
            }
          ]
      }
        
      

      followed by this record set

      {
          "instance": {
            "title": "Instance 1 plain-update",
            "source": "Local",
            "instanceTypeId": "6312d172-f0cf-40f6-b27d-9fa8feaf332f",
            "hrid": "ins001",
            "identifiers": [
              {
                "identifierTypeId": "8261054f-be78-422d-bd51-4ed9f33c3422",
                "value": "9781466636897"
              }
            ]
          },
          "holdingsRecords": [
            {
              "callNumber": "Holdings 1 plain-update",
              "permanentLocationId": "53cf956f-c1df-410b-8bea-27f712cca7c0",
              "hrid": "hol001",
              "items": [
                {
                  "itemIdentifier": "it001",
                  "hrid": "it001",
                  "barcode": "Item 1",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Awaiting pickup"
                  }
                },
                {
                  "itemIdentifier": "it002",
                  "hrid": "it002",
                  "barcode": "Item 2",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Awaiting pickup"
                  }
                }
              ]
            },
            {
              "callNumber": "Holdings 2 plain-update",
              "permanentLocationId": "fcd64ce1-6995-48f0-840e-89ffa2288371",
              "hrid": "hol002",
              "items": [
                {
                  "itemIdentifier": "it003",
                  "hrid": "it003",
                  "barcode": "Item 3",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Awaiting pickup"
                  }
                },
                {
                  "itemIdentifier": "it004",
                  "hrid": "it004",
                  "barcode": "Item 4",
                  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                  "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
                  "status": {
                    "name": "Awaiting pickup"
                  }
                }
      
              ]
            }
          ]
      }
        
      

      then the second PUT attempts to update the Item status for all items created in the first but often only 2 or 3 items appear to update:

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                Unassigned Unassigned
                Reporter:
                nielserik Niels Erik Gilvad Nielsen
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases