Uploaded image for project: 'mod-inventory'
  1. mod-inventory
  2. MODINV-610

D.I. UPDATE does not work when OL is enabled

    XMLWordPrintable

Details

    • 3
    • Folijet Support
    • Lotus R1 2022
    • Incomplete/missing requirements

    Description

      Overview:

      After enabling Optimistic locking in mod-inventory-storage (simply by using version mod-inventory-storage-22.0.2-optimistic-locking), data import UPDATEs don't work anymore, not even for one record because of the following error: 

      Cannot update record b2a9e44f-3448-4c02-b028-724b60feaf47 because it has been changed (optimistic locking): Stored _version is 3, _version of request is 2

       
      Steps to Reproduce:

      1. Log into https://pre-kiwi-cap1.int.aws.folio.org/data-import 
      2. Perform a CREATE import with the profile PTF - Create 2, which creates instances, holdings, and records
      3. Find their IDs and export them in Data Export using the profile Export for Data Import updates
      4. After export is completed, get the marc file that was exported to use in the next step.
      5. Go back to Data Import app, load the marc file (step 4) and import it using the profile PTF - Updates Success - 1
      6. The update will error out.

      Expected Results:
      Any update using the PTF - Updates Success - 1 profile would complete sucessfully.

      Actual Results:
      Error 

      Additional Information:
      We kept an eye on the _version field in the instance record throughout the whole import process.  After the record was created by D.I. (step 2), its version number is 2.  After going through data export, its version is still 2. When running the Update job, its version got changed to 3.  This suggests that the instance record was updated multiple times, but that the requested version was not updated in the code. 

      Full error message found in mod-inventory-storage

      2021-12-15T04:46:38.728Z 04:46:38 [] [] [] [] WARN DomainEventPublisher Record update failed, skipping event publishing2021-12-15T04:46:38.728Z 04:46:38 [] [] [] [] WARN DomainEventPublisher Record update failed, skipping event publishing2021-12-15T04:46:38.729Z 04:46:38 [] [] [] [] INFO LogUtil 127.0.0.1:46560 PUT /instance-storage/instances/0059b54d-a935-4db0-bed8-3d89980b8d30 null HTTP_1_1 409 415 5 tid=fs09000000 Conflict2021-12-15T04:46:38.729Z 04:46:38 [] [] [] [] ERROR Conn { "message": "Cannot update record b2a9e44f-3448-4c02-b028-724b60feaf47 because it has been changed (optimistic locking): Stored _version is 3, _version of request is 2", "severity": "ERROR", "code": "23F09", "where": "PL/pgSQL function instance_set_ol_version() line 8 at RAISE", "file": "pl_exec.c", "line": "3876", "routine": "exec_stmt_raise", "schema": "fs09000000_mod_inventory_storage", "table": "instance" }2021-12-15T04:46:38.729Z io.vertx.pgclient.PgException: { "message": "Cannot update record b2a9e44f-3448-4c02-b028-724b60feaf47 because it has been changed (optimistic locking): Stored _version is 3, _version of request is 2", "severity": "ERROR", "code": "23F09", "where": "PL/pgSQL function instance_set_ol_version() line 8 at RAISE", "file": "pl_exec.c", "line": "3876", "routine": "exec_stmt_raise", "schema": "fs09000000_mod_inventory_storage", "table": "instance" }2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.ErrorResponse.toException(ErrorResponse.java:31) ~[ms.jar:?]2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.QueryCommandBaseCodec.handleErrorResponse(QueryCommandBaseCodec.java:57) ~[ms.jar:?]2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.ExtendedQueryCommandCodec.handleErrorResponse(ExtendedQueryCommandCodec.java:90) ~[ms.jar:?]2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.PgDecoder.decodeError(PgDecoder.java:246) ~[ms.jar:?]2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.PgDecoder.decodeMessage(PgDecoder.java:132) [ms.jar:?]2021-12-15T04:46:38.729Z at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:112) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [ms.jar:?]2021-12-15T04:46:38.729Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [ms.jar:?]2021-12-15T04:46:38.729Z at java.lang.Thread.run(Thread.java:829) [?:?]
      

       

      Interested parties:

      abreaux Kateryna Senchenko

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                VRohach Volodymyr Rohach
                mtraneis Martin Tran
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases