<!-- 
RSS generated by JIRA (1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d) at Thu Feb 08 22:22:29 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>FOLIO Jira</title>
    <link>https://folio-org.atlassian.net</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>1001.0.0-SNAPSHOT</version>
        <build-number>100246</build-number>
        <build-date>07-02-2024</build-date>
    </build-info>

<item>
            <title>[MODINVSTOR-910] Optimistic locking makes Inventory-Batch APIs upsert loads fail </title>
                <link>https://folio-org.atlassian.net/browse/MODINVSTOR-910</link>
                <project id="10139" key="MODINVSTOR">mod-inventory-storage</project>
                    <description>&lt;p&gt;&lt;b&gt;Overview:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Inventory has a set of API:s allowing you to post records to FOLIO In batch. These API:s also allows for the same data to be overlaid (Upserted) by adding the parameter&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
upsert=&lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;to the request. Documentation is here: &lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it seems like this upsert functionality is broken, by the Optimistic Locking functionality.&#160;&lt;/p&gt;

&lt;p&gt;This has been verified in Lotus Bugfest.&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Steps to Reproduce:&lt;/b&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;POST a batch of records to&#160;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html#item_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;/item-storage/batch/synchronous&lt;/a&gt;&#160;according to the documentation. The records does not have the _version property.&lt;/li&gt;
	&lt;li&gt;Post the same batch again to&#160;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html#item_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;/item-storage/batch/synchronous&lt;/a&gt;?upsert=true&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;b&gt;Expected Results:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Records are successfully posted twice.&#160;&lt;br/&gt;
**&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Actual Results:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;An HTTP 409 Optimistic locking conflict is being raised.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The batch sync APIs work as designed. However, the API documentation had been quite incomplete. This has been fixed in scope of this Jira.&lt;/p&gt;</description>
                <environment></environment>
        <key id="56447">MODINVSTOR-910</key>
            <summary>Optimistic locking makes Inventory-Batch APIs upsert loads fail </summary>
                <type id="10001" iconUrl="https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium">Bug</type>
                                            <priority id="10001" iconUrl="https://dev.folio.org/assets/jira-priority/jira-p2.svg">P2</priority>
                        <status id="6" iconUrl="https://folio-org.atlassian.net/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10003">Done</resolution>
                                                        <assignee accountid="5ee89462f7aa140abd82d11d">Julian Ladisch</assignee>
                                                                <reporter accountid="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2">Theodor Tolstoy (One-Group.se)</reporter>
                                    <labels>
                            <label>support</label>
                    </labels>
                <created>Wed, 18 May 2022 12:23:34 +0000</created>
                <updated>Tue, 21 Jun 2022 19:27:41 +0000</updated>
                            <resolved>Tue, 21 Jun 2022 19:06:25 +0000</resolved>
                                                    <fixVersion>24.0.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>10</watches>
                                                                <comments>
                                                            <comment id="133332" author="557058:f80403de-e149-421e-8750-af45c853402f" created="Wed, 18 May 2022 12:27:32 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=62a96ae7192edb006f9f1bf9&quot; class=&quot;user-hover&quot; rel=&quot;62a96ae7192edb006f9f1bf9&quot; data-account-id=&quot;62a96ae7192edb006f9f1bf9&quot; accountid=&quot;62a96ae7192edb006f9f1bf9&quot; rel=&quot;noreferrer&quot;&gt;Khalilah Gambrell&lt;/a&gt; - I labelled this ticket with RCA: Incomplete/missing requirements&lt;/p&gt;</comment>
                                                            <comment id="133334" author="557058:f80403de-e149-421e-8750-af45c853402f" created="Wed, 18 May 2022 12:32:15 +0000"  >&lt;p&gt;Charlotte Whitt: 1 minute ago&lt;br/&gt;
Which libraries are affected by this @Theodor?&lt;/p&gt;

&lt;p&gt;Theodor Tolstoy  &amp;lt; 1 minute ago&lt;br/&gt;
All that are not live yet....&lt;/p&gt;</comment>
                                                            <comment id="133335" author="557058:c4306e07-a760-40bc-81e1-af8498c1bcd2" created="Thu, 19 May 2022 07:23:58 +0000"  >&lt;p&gt;Why is the _version field not included in the initial POST ?&lt;/p&gt;</comment>
                                                            <comment id="133337" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 08:09:13 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ac4306e07-a760-40bc-81e1-af8498c1bcd2&quot; class=&quot;user-hover&quot; rel=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; data-account-id=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; accountid=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; rel=&quot;noreferrer&quot;&gt;Ingolf Kuss&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Why is the _version field not included in the initial POST ?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Are you asking about the representation sent by the client or the one sent back by the server?&lt;/p&gt;

&lt;p&gt;I believe you are asking about the representation sent by the client. In which case, it should not be (and if it is, it should be ignored) because it is a server controlled property.&lt;/p&gt;

&lt;p&gt;(As FOLIO tends to use the same schema for creation, update and read these expectations tend not to be expressed explicitly in the interface).&lt;/p&gt;</comment>
                                                            <comment id="133339" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 08:10:16 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Af80403de-e149-421e-8750-af45c853402f&quot; class=&quot;user-hover&quot; rel=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; data-account-id=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; accountid=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; rel=&quot;noreferrer&quot;&gt;Charlotte Whitt&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=62a96ae7192edb006f9f1bf9&quot; class=&quot;user-hover&quot; rel=&quot;62a96ae7192edb006f9f1bf9&quot; data-account-id=&quot;62a96ae7192edb006f9f1bf9&quot; accountid=&quot;62a96ae7192edb006f9f1bf9&quot; rel=&quot;noreferrer&quot;&gt;Khalilah Gambrell&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The optimistic concurrency work was done by the Core Platform team. I think this work would be better picked up by that team.&lt;/p&gt;</comment>
                                                            <comment id="133341" author="557058:c4306e07-a760-40bc-81e1-af8498c1bcd2" created="Thu, 19 May 2022 08:42:07 +0000"  >&lt;p&gt;&amp;gt;&#160;Are you asking about the representation sent by the client or the one sent back by the server?&lt;/p&gt;

&lt;p&gt;Yes, I was asking about the representation sent by the client. I now understand that, if I do an upsert, the record is read, enriched (by the API) by a _version field (if it is not present, yet), and then send back to item-storage with that version field. From then on, optimistic locking will work for that record.&lt;/p&gt;</comment>
                                                            <comment id="133342" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 08:44:31 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ac4306e07-a760-40bc-81e1-af8498c1bcd2&quot; class=&quot;user-hover&quot; rel=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; data-account-id=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; accountid=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; rel=&quot;noreferrer&quot;&gt;Ingolf Kuss&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I now understand that, if I do an upsert, the record is read, enriched (by the API) by a _version field (if it is not present, yet), and then send back to item-storage with that version field. From then on, optimistic locking will work for that record.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;What are you referring to as an upsert? An API request or a database operation?&lt;/p&gt;</comment>
                                                            <comment id="133343" author="557058:c4306e07-a760-40bc-81e1-af8498c1bcd2" created="Thu, 19 May 2022 08:48:37 +0000"  >&lt;p&gt;This API request&#160;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html#item_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;/item-storage/batch/synchronous&lt;/a&gt;?upsert=true&lt;/p&gt;</comment>
                                                            <comment id="133345" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 09:31:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ac4306e07-a760-40bc-81e1-af8498c1bcd2&quot; class=&quot;user-hover&quot; rel=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; data-account-id=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; accountid=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; rel=&quot;noreferrer&quot;&gt;Ingolf Kuss&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;This API request /item-storage/batch/synchronous?upsert=true&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Oh yeah, I&apos;m not very familiar with the batch APIs.&lt;/p&gt;

&lt;p&gt;I imagine that is a challenge because a create SHOULD not have a version at all and an update MUST not have a version. Thus the client needs to know which is which.&lt;/p&gt;

&lt;p&gt;I think that might be one for the folks who were involved in both of these areas to ponder.&lt;/p&gt;

&lt;p&gt;cc: &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; class=&quot;user-hover&quot; rel=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; data-account-id=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; accountid=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; rel=&quot;noreferrer&quot;&gt;Jakub Skoczen&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ff8d61da9d0300107f0afe2&quot; class=&quot;user-hover&quot; rel=&quot;5ff8d61da9d0300107f0afe2&quot; data-account-id=&quot;5ff8d61da9d0300107f0afe2&quot; accountid=&quot;5ff8d61da9d0300107f0afe2&quot; rel=&quot;noreferrer&quot;&gt;Ian Walls&lt;/a&gt;&lt;/p&gt;</comment>
                                                            <comment id="133347" author="557058:c4306e07-a760-40bc-81e1-af8498c1bcd2" created="Thu, 19 May 2022 09:46:13 +0000"  >&lt;p&gt;I agree. I was not aware that a CREATE should not have a version when I wrote my initial comment.&lt;/p&gt;</comment>
                                                            <comment id="133349" author="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2" created="Thu, 19 May 2022 12:35:47 +0000"  >&lt;p&gt;Does anyone know if there is any temporary workaround for this? Like putting a -1 in the version property or something similar&lt;/p&gt;</comment>
                                                            <comment id="133351" author="5ee89462f7aa140abd82d11d" created="Thu, 19 May 2022 13:50:01 +0000"  >&lt;p&gt;Documentation about Optimistic Locking: &lt;a href=&quot;https://folio-org.atlassian.net/wiki/display/DD/Optimistic+locking+proposal&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/wiki/display/DD/Optimistic+locking+proposal&lt;/a&gt;&lt;/p&gt;</comment>
                                                            <comment id="133353" author="5ee89462f7aa140abd82d11d" created="Thu, 19 May 2022 14:03:26 +0000"  >&lt;p&gt;The POST /item-storage/batch/synchronous API works exactly as specified.&lt;/p&gt;

&lt;p&gt;When creating a new record the client sends the record without _version property.&lt;/p&gt;

&lt;p&gt;When updating a record the client needs to send the record with the _version property as stored in the DB:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;If no _version property is stored in the DB the new record must not have a _version.&lt;/li&gt;
	&lt;li&gt;If a _version property is stored in the DB because the record has been created or updated after optimistic locking was enabled then the new record must have the _version value as stored. Otherwise it is an optimistic locking conflict and the record to be rejected.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In step 2. the _version property is missing.&lt;/p&gt;

&lt;p&gt;In step 2. the record is rejected to prevent overwriting the record that was created by someone else.&lt;/p&gt;

&lt;p&gt;I suggest to close this Jira as &quot;Won&apos;t do&quot; because it&apos;s not a bug.&lt;/p&gt;</comment>
                                                            <comment id="133354" author="557058:c4306e07-a760-40bc-81e1-af8498c1bcd2" created="Thu, 19 May 2022 15:36:18 +0000"  >&lt;p&gt;&amp;gt;&#160;Does anyone know if there is any temporary workaround for this? Like putting a -1 in the version property or something similar&lt;/p&gt;

&lt;p&gt;Reading Julians comment carefully I conclude that&#160;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;in step 1. a _version property has been stored in the DB because the record has been created after optimistic locking was enabled.&lt;/li&gt;
	&lt;li&gt;in step 2. you must provide the same _version property as stored in the DB in order to avoid the locking conflict.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;I further conclude that there are two alternative ways to avoid the error:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;enable optimistic locking only after you have performed step 1.&lt;/li&gt;
	&lt;li&gt;use a _version property in all record representations sent in step 2. by the client. The question is just which value to use here. In other words, what is the initial value that the DB assigns when it creates a new record that is subject to optimistic locking. Probably &quot;1&quot; ?&lt;/li&gt;
&lt;/ol&gt;
</comment>
                                                            <comment id="133356" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 15:38:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The POST /item-storage/batch/synchronous API works exactly as specified.&lt;/p&gt;

&lt;p&gt;When creating a new record the client sends the record without _version property.&lt;/p&gt;

&lt;p&gt;When updating a record the client needs to send the record with the _version property as stored in the DB.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I disagree with this.&lt;/p&gt;

&lt;p&gt;As I understand it, the intention of an &lt;a href=&quot;https://wiki.postgresql.org/wiki/UPSERT#.22UPSERT.22_definition&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;upsert operation&lt;/a&gt; is that the client is ignorant of whether a record already exists:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;UPSERT&quot; is a DBMS feature that allows a DML statement&apos;s author to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead, while safely giving little to no further thought to concurrency&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The clients expects that the resulting state is that a record exists with those properties in &lt;/p&gt;

&lt;p&gt;I think expecting the client to know whether a record exists or not (to decide whether to provide certain properties or not) rather contradicts the intention of an API that states it is performing an &lt;tt&gt;upsert&lt;/tt&gt;.&lt;/p&gt;</comment>
                                                            <comment id="133358" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 15:55:16 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ac4306e07-a760-40bc-81e1-af8498c1bcd2&quot; class=&quot;user-hover&quot; rel=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; data-account-id=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; accountid=&quot;557058:c4306e07-a760-40bc-81e1-af8498c1bcd2&quot; rel=&quot;noreferrer&quot;&gt;Ingolf Kuss&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;enable optimistic locking only after you have performed step 1.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Enabling / disabling optimistic concurrency can only be done by releasing a new version of the module. I think that makes this not a practical approach for general continued use of the API.&lt;/p&gt;</comment>
                                                            <comment id="133360" author="5ee89462f7aa140abd82d11d" created="Thu, 19 May 2022 16:24:22 +0000"  >&lt;blockquote&gt;&lt;p&gt;the client is ignorant of whether a record already exists&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Upsert is about concurrency.&lt;/p&gt;

&lt;p&gt;In some use cases the client is ignorant about the record existence, in other use cases the client isn&apos;t. Here we have the latter.&lt;/p&gt;

&lt;p&gt;Instead of the /item-storage/batch/synchronous?upsert=true API we could have provided these two APIs:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;/item-storage/batch/synchronous-insert&lt;/li&gt;
	&lt;li&gt;/item-storage/batch/synchronous-update&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The implementation for them is almost the same, therefore they have been combined so that clients can mix inserts and updates in a single request.&lt;/p&gt;

&lt;p&gt;Note that /item-storage/batch/synchronous-update requires a correct _version property.&lt;/p&gt;</comment>
                                                            <comment id="133361" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 17:37:47 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;In some use cases the client is ignorant about the record existence, in other use cases the client isn&apos;t. Here we have the latter.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;If the client knows whether a record exists, what is the purpose of using upsert instead of a dedicated insert or update?&lt;/p&gt;
</comment>
                                                            <comment id="133363" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 17:45:51 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Upsert is about concurrency.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I don&apos;t understand what this means. It seems to directly contradict the statement in the PostgreSQL documentation I quoted. Please can you explain what you mean by this.&lt;/p&gt;</comment>
                                                            <comment id="133364" author="632e148361dbef2805be710f" created="Thu, 19 May 2022 18:07:34 +0000"  >&lt;p&gt;The use case here is: I have a bunch of records I&#8217;ve just transformed from a previous system, with deterministic UUIDs, and I need to post them to FOLIO. If they don&#8217;t exist, create them, but if they do, replace that old record with the one I&#8217;m providing, and don&#8217;t bother me about it, I&#8217;m right, the database is wrong, just do what I say. ��&lt;/p&gt;</comment>
                                                            <comment id="133366" author="5ee89462f7aa140abd82d11d" created="Thu, 19 May 2022 19:00:02 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=63e2a2771b13d42998e4e706&quot; class=&quot;user-hover&quot; rel=&quot;63e2a2771b13d42998e4e706&quot; data-account-id=&quot;63e2a2771b13d42998e4e706&quot; accountid=&quot;63e2a2771b13d42998e4e706&quot; rel=&quot;noreferrer&quot;&gt;Marc Johnson&lt;/a&gt;&lt;br/&gt;
 Upsert is about concurrency.&lt;/p&gt;

&lt;p&gt;From the &lt;a href=&quot;https://wiki.postgresql.org/wiki/UPSERT#.22UPSERT.22_definition&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;PostgreSQL wiki&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&quot;UPSERT&quot; is a DBMS feature that allows a DML statement&apos;s author to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead, while safely giving little to no further thought to concurrency&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;From the &lt;a href=&quot;https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;PostgreSQL documenation&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;tt&gt;ON CONFLICT DO UPDATE&lt;/tt&gt; guarantees an atomic &lt;tt&gt;INSERT&lt;/tt&gt; or &lt;tt&gt;UPDATE&lt;/tt&gt; outcome; provided there is no independent error, one of those two outcomes is guaranteed, even under high concurrency. This is also known as &lt;em&gt;UPSERT&lt;/em&gt; &#8212; &#8220;UPDATE or INSERT&#8221;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Upsert is an &lt;em&gt;atomic&lt;/em&gt; operation. This avoids difficulties arising from concurrency.&lt;/p&gt;

&lt;p&gt;Upsert is usually easier than executing an INSERT and an UPDATE operation in sequence. Example: Insert 2 records and update 2 record, if the insert succeeds but the update fails because of missing foreign key one needs to manually roll back the insert.&lt;/p&gt;

&lt;p&gt;An &quot;independent error&quot; mentioned in the documentation can be a foreign key violation or an optimistic locking violation.&lt;/p&gt;</comment>
                                                            <comment id="133369" author="5ee89462f7aa140abd82d11d" created="Thu, 19 May 2022 19:19:29 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=632e148361dbef2805be710f&quot; class=&quot;user-hover&quot; rel=&quot;632e148361dbef2805be710f&quot; data-account-id=&quot;632e148361dbef2805be710f&quot; accountid=&quot;632e148361dbef2805be710f&quot; rel=&quot;noreferrer&quot;&gt;Brooks Travis&lt;/a&gt;: This issue is not a bug report but a feature request. You request a bulk API with optimistic locking disabled. Please create a Jira with detailed spec.&lt;/p&gt;

&lt;p&gt;Providing an API with optimistic locking disabled has been discussed in length and detail (part of that in 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;RMB-727&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/RMB-727&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Implement support for optimistic locking&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10322?size=medium&quot; /&gt;
            RMB-727
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
, 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;RMB-719&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/RMB-719&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;SPIKE: design protocol and implementation for optimistic locking&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            RMB-719
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
) and rejected. Instead the existing record should be fetched to get the _version property &#8211; then the bulk API can be invoked with correct _version property.&lt;/p&gt;</comment>
                                                            <comment id="133370" author="63e2a2771b13d42998e4e706" created="Thu, 19 May 2022 21:48:02 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Upsert is about concurrency.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I agree that an atomic upsert operation reduces the impact of concurrency compared to using a combination of statements to (try to) achieve the same outcome.&lt;/p&gt;

&lt;p&gt;I disagree with your assertion  the idea of an &lt;tt&gt;upsert&lt;/tt&gt; is fundamentally only about concurrency.&lt;/p&gt;

&lt;p&gt;I don&apos;t think we are going to agree.&lt;/p&gt;

&lt;p&gt;I think this conversation is distracting from the (what I personally think is the) more important one about the clients expectations (that the request should be the same regardless of whether the record exists or not).&lt;/p&gt;
</comment>
                                                            <comment id="133372" author="557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d" created="Fri, 20 May 2022 09:59:02 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=632e148361dbef2805be710f&quot; class=&quot;user-hover&quot; rel=&quot;632e148361dbef2805be710f&quot; data-account-id=&quot;632e148361dbef2805be710f&quot; accountid=&quot;632e148361dbef2805be710f&quot; rel=&quot;noreferrer&quot;&gt;Brooks Travis&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=712020%3A0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; class=&quot;user-hover&quot; rel=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; data-account-id=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; accountid=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; rel=&quot;noreferrer&quot;&gt;Theodor Tolstoy (One-Group.se)&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I agree with Julian that this is not a bug but a new feature. The process of rolling out OL took around 2 years which included communication with POs and individual teams. According to &lt;a href=&quot;https://folio-org.atlassian.net/wiki/display/DD/Optimistic+locking+proposal&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/wiki/display/DD/Optimistic+locking+proposal&lt;/a&gt; the &quot;logOnConflict&quot; setting has been introduced on 2021-02-01 which provided warning in the logfiles.&lt;/p&gt;

&lt;p&gt;In the existing implementation, Batch APIs are subject to the same OL mechanism as regular APIs. What this means in practice is that the usage of existing batch APIs remain the same for initial load but require &quot;version&quot; handling for subsequent updates. My understanding is that subsequent updates should be handled for Data Import. If this is not the case, I agree that functionality to explicitly disable OL for batch APIs should be defined and implemented.&lt;/p&gt;</comment>
                                                            <comment id="133374" author="63e2a2771b13d42998e4e706" created="Tue, 24 May 2022 10:24:57 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Af80403de-e149-421e-8750-af45c853402f&quot; class=&quot;user-hover&quot; rel=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; data-account-id=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; accountid=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; rel=&quot;noreferrer&quot;&gt;Charlotte Whitt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This has been added to Prokopovych&apos;s sprint. What are your expectations for the team when they pick up this issue?&lt;/p&gt;

&lt;p&gt;As I understand it, both &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ee89462f7aa140abd82d11d&quot; class=&quot;user-hover&quot; rel=&quot;5ee89462f7aa140abd82d11d&quot; data-account-id=&quot;5ee89462f7aa140abd82d11d&quot; accountid=&quot;5ee89462f7aa140abd82d11d&quot; rel=&quot;noreferrer&quot;&gt;Julian Ladisch&lt;/a&gt; and &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; class=&quot;user-hover&quot; rel=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; data-account-id=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; accountid=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; rel=&quot;noreferrer&quot;&gt;Jakub Skoczen&lt;/a&gt; have stated that this isn&apos;t a bug and the API is working as intended.&lt;/p&gt;</comment>
                                                            <comment id="133376" author="5ff8d61da9d0300107f0afe2" created="Tue, 24 May 2022 19:46:44 +0000"  >&lt;p&gt;From the perspective of a repeat-implementer, losing the ability to upsert records to gain optimistic locking is a regression.&#160; When doing an implementation, iterative loads are the norm, as there can be numerous cases of record loading failure.&#160; Having to wipe out everything in Inventory between each load is wasteful, and may be outright untenable if the incoming record load is a partial list (say, in the case of building a union catalog from multiple data sources).&lt;/p&gt;

&lt;p&gt;I feel like we&apos;ve made a bad trade off: protecting against a theoretic possibility of record update conflicts (exceedingly rare in all my practical experience) at the cost of being able to do effective data migrations.&lt;/p&gt;</comment>
                                                            <comment id="133378" author="63e2a2771b13d42998e4e706" created="Tue, 24 May 2022 20:19:10 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Af80403de-e149-421e-8750-af45c853402f&quot; class=&quot;user-hover&quot; rel=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; data-account-id=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; accountid=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; rel=&quot;noreferrer&quot;&gt;Charlotte Whitt&lt;/a&gt; I don&apos;t think the Prokopovych team can pick this up until folks can agree what change should be.&lt;/p&gt;

&lt;p&gt;I also think we could consider the Core Platform team picking this issue up, as I believe they implemented both these APIs and the optimistic concurrency controls.&lt;/p&gt;

&lt;p&gt;I&apos;ve put the issue into draft and removed it from the sprint.&lt;/p&gt;</comment>
                                                            <comment id="133380" author="5ee89462f7aa140abd82d11d" created="Tue, 24 May 2022 21:09:22 +0000"  >&lt;blockquote&gt;&lt;p&gt;theoretic possibility of record update conflicts&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;May I draw your attention to the &quot;Use cases collected from community&quot; listed in the description section of &lt;a href=&quot;https://folio-org.atlassian.net/browse/UXPROD-3058&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/UXPROD-3058&lt;/a&gt; &quot;Optimistic Locking&quot;?&lt;/p&gt;

&lt;p&gt;Practical experience of many libraries showed a high demand for optimistic locking lifting it to the 3rd place in the Kiwi pointing process: &lt;a href=&quot;https://folio-org.atlassian.net/wiki/display/COMMUNITY/Pointing+Results+for+Kiwi+Release&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/wiki/display/COMMUNITY/Pointing+Results+for+Kiwi+Release&lt;/a&gt;&lt;/p&gt;</comment>
                                                            <comment id="133382" author="5ee89462f7aa140abd82d11d" created="Tue, 24 May 2022 21:16:15 +0000"  >&lt;p&gt;Your use case is supported by the DELETE by CQL API that allows you to delete records in batches of 100: &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-576&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/MODINVSTOR-576&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Therefore there is no need to disable optimistic locking in the POST bulk APIs.&lt;/p&gt;</comment>
                                                            <comment id="133383" author="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2" created="Wed, 8 Jun 2022 09:00:45 +0000"  >&lt;p&gt;Late to the game, but to me this is a regression bug that needs to get fixed. There is nothing in the schemas, or documentation, or release notes indicating that the version property is required, and it seems like a oversight from both the implementing parties and the parties that use this enpoint to communicate the matter (guilty ��&#8205;&#9794;&#65039;).&lt;/p&gt;

&lt;p&gt;Pointing to library use cases here is not relevant since this is used for initial data migration and performing large-scale corrections by service providers.&lt;/p&gt;

&lt;p&gt;Pointing to DELETE APIs is not a valid argument either, because FOLIO is terrible at deleting things at scale, both at the database and the API level, often leading to unresponsiveness.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                                                            <comment id="133385" author="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2" created="Wed, 8 Jun 2022 09:06:27 +0000"  >&lt;p&gt;An unobtrusive propasal for a fix is to add a new parameter, like &lt;em&gt;sidestepOptimisticLocking,&lt;/em&gt; to do just that, and not risk breaking the code for someone that been waiting and worked on implementing the optimisticLocking in their calls to the Batch API for the last two years...��&lt;/p&gt;</comment>
                                                            <comment id="133389" author="63e2a2771b13d42998e4e706" created="Wed, 8 Jun 2022 09:12:06 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=712020%3A0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; class=&quot;user-hover&quot; rel=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; data-account-id=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; accountid=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; rel=&quot;noreferrer&quot;&gt;Theodor Tolstoy (One-Group.se)&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;to me this is a regression bug that needs to get fixed&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;How do you think it should be fixed?&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;There is nothing in the schemas&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;It is unfortunate that this isn&apos;t explicit. This is a general limitation with how FOLIO uses JSON schema. We use a single schema for create and update, meaning that there is no explicit way to describe when a property becomes required for updates.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Af80403de-e149-421e-8750-af45c853402f&quot; class=&quot;user-hover&quot; rel=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; data-account-id=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; accountid=&quot;557058:f80403de-e149-421e-8750-af45c853402f&quot; rel=&quot;noreferrer&quot;&gt;Charlotte Whitt&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=62a96ae7192edb006f9f1bf9&quot; class=&quot;user-hover&quot; rel=&quot;62a96ae7192edb006f9f1bf9&quot; data-account-id=&quot;62a96ae7192edb006f9f1bf9&quot; accountid=&quot;62a96ae7192edb006f9f1bf9&quot; rel=&quot;noreferrer&quot;&gt;Khalilah Gambrell&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Ab8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; class=&quot;user-hover&quot; rel=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; data-account-id=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; accountid=&quot;557058:b8e64633-1f7c-402d-9caf-9959a5ba5d0d&quot; rel=&quot;noreferrer&quot;&gt;Jakub Skoczen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;m going to move this to Core Platform, as both the batch APIs and optimistic concurrency control were implemented by that team.&lt;/p&gt;</comment>
                                                            <comment id="133391" author="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2" created="Wed, 8 Jun 2022 09:29:01 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=63e2a2771b13d42998e4e706&quot; class=&quot;user-hover&quot; rel=&quot;63e2a2771b13d42998e4e706&quot; data-account-id=&quot;63e2a2771b13d42998e4e706&quot; accountid=&quot;63e2a2771b13d42998e4e706&quot; rel=&quot;noreferrer&quot;&gt;Marc Johnson&lt;/a&gt; i added a propsal in a subsequent comment above. If you are asking me for the inner implementation, I must admit I do not have a clue....&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                                                            <comment id="133392" author="63e2a2771b13d42998e4e706" created="Wed, 8 Jun 2022 09:32:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=712020%3A0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; class=&quot;user-hover&quot; rel=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; data-account-id=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; accountid=&quot;712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2&quot; rel=&quot;noreferrer&quot;&gt;Theodor Tolstoy (One-Group.se)&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;i added a propsal in a subsequent comment above.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Thank you for expanding the description of your expectations.&lt;/p&gt;</comment>
                                                            <comment id="133394" author="5c48911b54e1e6466b11f38c" created="Mon, 13 Jun 2022 18:10:49 +0000"  >&lt;p&gt;Duke reported something that I believe is related - &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-846&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/MODINVSTOR-846&lt;/a&gt; - though that jira still shows as blocked.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=626c2725c72f140069fd0e20&quot; class=&quot;user-hover&quot; rel=&quot;626c2725c72f140069fd0e20&quot; data-account-id=&quot;626c2725c72f140069fd0e20&quot; accountid=&quot;626c2725c72f140069fd0e20&quot; rel=&quot;noreferrer&quot;&gt;Stewart Engart&lt;/a&gt; &lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A14dcd038-6502-4431-8fea-fef8b17b4dab&quot; class=&quot;user-hover&quot; rel=&quot;557058:14dcd038-6502-4431-8fea-fef8b17b4dab&quot; data-account-id=&quot;557058:14dcd038-6502-4431-8fea-fef8b17b4dab&quot; accountid=&quot;557058:14dcd038-6502-4431-8fea-fef8b17b4dab&quot; rel=&quot;noreferrer&quot;&gt;Jeff Fleming&lt;/a&gt;&lt;/p&gt;</comment>
                                                            <comment id="133395" author="5ee89462f7aa140abd82d11d" created="Tue, 14 Jun 2022 08:18:06 +0000"  >&lt;blockquote&gt;&lt;p&gt;There is nothing in the schemas, or documentation, or release notes indicating that the version property is required&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/wiki/display/REL/Lotus+%28R1+2022%29+Release+Notes#Lotus(R12022)ReleaseNotes-Notesonfunctionality&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/wiki/display/REL/Lotus+%28R1+2022%29+Release+Notes#Lotus(R12022)ReleaseNotes-Notesonfunctionality&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Optimistic locking has been enabled for inventory instances, holdings records, and items (&lt;a href=&quot;https://folio-org.atlassian.net/wiki/display/DD/Optimistic+locking+proposal&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimistic locking proposal&lt;/a&gt;, 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;UXPROD-1752&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/UXPROD-1752&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Prevent update conflicts (via optimistic locking): platform support for detection&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10322?size=medium&quot; /&gt;
            UXPROD-1752
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
, 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;MODINVSTOR-845&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-845&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Re-enable OL on mod-inventory-storage master branch&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10318?size=medium&quot; /&gt;
            MODINVSTOR-845
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
).&lt;/p&gt;&lt;/blockquote&gt;</comment>
                                                            <comment id="133397" author="5ee89462f7aa140abd82d11d" created="Tue, 14 Jun 2022 08:29:19 +0000"  >&lt;blockquote&gt;&lt;p&gt;FOLIO is terrible at deleting things at scale, both at the database and the API level, often leading to unresponsiveness.&#160;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Please create new Jira explaining in more detail why the delete-by-cql API &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-576&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/MODINVSTOR-576&lt;/a&gt; is terrible.&lt;/p&gt;</comment>
                                                            <comment id="133399" author="5ee89462f7aa140abd82d11d" created="Tue, 14 Jun 2022 08:56:55 +0000"  >&lt;p&gt;The batch synchronous implementations got the same optimistic locking implementation as the single record APIs. There were long discussions that changing an existing record always requires the correct _version property. It was intended that introducing optimistic locking is a breaking change for both batch and single record APIs.&lt;/p&gt;

&lt;p&gt;The incomplete API documentation &lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/p/item-sync.html&lt;/a&gt; has been expanded:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;POST /item-storage/batch/synchronous&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;Create or update a collection of items in a single synchronous request; if any item fails the complete batch will be rejected (all or nothing)&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;POST /item-storage/batch/synchronous&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;Query Parameters&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;upsert: (boolean - default: false)&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;When a record with the same id already exists upsert=true will update it, upsert=false will fail the complete batch. The _version property of each item to be updated must match the stored _version property (optimistic locking).&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Do you have more suggestions how to improve this API documentation? Otherwise I suggest to close this documentation bug report as done. There is a new story 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;MODINVSTOR-924&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-924&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Batch update with optimistic locking disabled&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10309?size=medium&quot; /&gt;
            MODINVSTOR-924
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
 &quot;Batch update with optimistic locking disabled&quot; to discuss the feature request.&lt;/p&gt;</comment>
                                                            <comment id="133401" author="5ff8d61da9d0300107f0afe2" created="Tue, 14 Jun 2022 10:31:33 +0000"  >&lt;p&gt;The fundamental problem here is that optimistic locking has negatively impacted data migration.&#160; We&apos;re prioritizing the prevention of theoretical data loss, based on the worries of librarians in response to their previous systems, over the necessity of data migrators to be able to iteratively load large amounts of inventory data in order to bring FOLIO live within a timeframe.&lt;/p&gt;

&lt;p&gt;The very nature of &apos;upsert&apos; is that we don&apos;t know whether a record we&apos;re POSTing is already in the system or not.&#160; It&apos;s current _version, according to FOLIO, is a mystery.&#160; Looking up each record&apos;s FOLIO _version is tantamount to updating each record individually, thereby negating the value of the batch API.&lt;/p&gt;

&lt;p&gt;This is not a documentation issue; this is an instance of one feature being implemented at the cost of another.&lt;/p&gt;

&lt;p&gt;I believe the correct solution is to make optimistic locking optional, either at the API level, or universally.&lt;/p&gt;</comment>
                                                            <comment id="133403" author="712020:0a02d059-b8b9-48b3-8a58-727ec44d05d2" created="Tue, 14 Jun 2022 13:18:24 +0000"  >&lt;blockquote&gt;&lt;p&gt;Please create new Jira explaining in more detail why the delete-by-cql API&#160;&lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-576&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/MODINVSTOR-576&lt;/a&gt;&#160;is terrible&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I have no reason for doing so, since I was referring to current and past experiences deleting inventory records at scale. If the much-awaited 
    &lt;span class=&quot;jira-issue-macro resolved&quot; data-jira-key=&quot;MODINVSTOR-576&quot; &gt;
                &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-576&quot; class=&quot;jira-issue-macro-key issue-link&quot;  title=&quot;Bulk delete of instance/holdings/items using CQL&quot; &gt;
            &lt;img class=&quot;icon&quot; src=&quot;https://folio-org.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10309?size=medium&quot; /&gt;
            MODINVSTOR-576
        &lt;/a&gt;
                                                    &lt;span class=&quot;aui-lozenge aui-lozenge-subtle aui-lozenge-success jira-macro-single-issue-export-pdf&quot;&gt;Closed&lt;/span&gt;
            &lt;/span&gt;
 passes code review and turns out to be terrible, I will of course file Jiras.&#160;&lt;/p&gt;</comment>
                                                            <comment id="133405" author="63e2a2771b13d42998e4e706" created="Tue, 14 Jun 2022 14:52:09 +0000"  >&lt;p&gt;&lt;a href=&quot;https://folio-org.atlassian.net/secure/ViewProfile.jspa?accountId=5ff8d61da9d0300107f0afe2&quot; class=&quot;user-hover&quot; rel=&quot;5ff8d61da9d0300107f0afe2&quot; data-account-id=&quot;5ff8d61da9d0300107f0afe2&quot; accountid=&quot;5ff8d61da9d0300107f0afe2&quot; rel=&quot;noreferrer&quot;&gt;Ian Walls&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;The very nature of &apos;upsert&apos; is that we don&apos;t know whether a record we&apos;re POSTing is already in the system or not.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Unfortunately, that conflicts (no pun intended) with the design of some of these records, where the expectations around some fields are different depending upon whether the record is new or not.&lt;/p&gt;

&lt;p&gt;I believe there is another issue around this topic relating to HRIDs. There may well be other fields that are affected by this.&lt;/p&gt;

&lt;p&gt;This is a challenge that may well come up repeatedly for this style of API, given the mismatch in design considerations.&lt;/p&gt;</comment>
                                                            <comment id="133407" author="5ee89462f7aa140abd82d11d" created="Tue, 21 Jun 2022 19:10:14 +0000"  >&lt;p&gt;The feature request for disabling optimistic locking has been split off to &lt;a href=&quot;https://folio-org.atlassian.net/browse/MODINVSTOR-924&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://folio-org.atlassian.net/browse/MODINVSTOR-924&lt;/a&gt; &quot;Batch update with optimistic locking disabled&quot;&lt;/p&gt;

&lt;p&gt;The documentation for the existing batch sync APIs has been extended to explain in detail how the APIs were designed and implemented:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/instance-sync.html#instance_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/instance-sync.html#instance_storage_batch_synchronous_post&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/holdings-sync.html#holdings_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/holdings-sync.html#holdings_storage_batch_synchronous_post&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/item-sync.html#item_storage_batch_synchronous_post&quot; class=&quot;external-link&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://s3.amazonaws.com/foliodocs/api/mod-inventory-storage/r/item-sync.html#item_storage_batch_synchronous_post&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Therefore this Jira is done and closed.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10008">
                    <name>Defines</name>
                                            <outwardlinks description="defines">
                                        <issuelink>
            <issuekey id="12496">UXPROD-3691</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="78945">SUP-74</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="56460">MODINVSTOR-924</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummarycf">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10057" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Development Team</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10144"><![CDATA[Core: Platform]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10063" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>PO Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10106" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>RCA Group</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10374"><![CDATA[Incomplete/missing requirements]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10019" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|hzx4tm:umze</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10046" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Release</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10057"><![CDATA[Morning Glory (R2 2022)]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10020" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10024" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>[CHART] Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 18 May 2022 12:27:32 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10025" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>[CHART] Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>