<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: idx_alf_conturl_cr violated on document creation in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20774#M9135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, Axel, for your detailed analysis.&lt;/P&gt;&lt;P&gt;I totally agree in your stating one additional select is always preferable&amp;nbsp;to provoking a&amp;nbsp;duplicate key exception. Furthermore an insert in any case&amp;nbsp;binds more ressources in the database than an additional select which can be cached by the database if it has already similarly been executed some seconds before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Nov 2017 08:45:41 GMT</pubDate>
    <dc:creator>schorsch</dc:creator>
    <dc:date>2017-11-16T08:45:41Z</dc:date>
    <item>
      <title>idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20769#M9130</link>
      <description>Hi!On creation and even on deletion of any document I get a duplicate key exception in the postgresql-database:### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR:&amp;nbsp;duplicate key violatedUnique-Constraint „idx_alf_conturl_cr“2 calls (apparently retrying):insert into alf_conte</description>
      <pubDate>Tue, 14 Nov 2017 10:58:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20769#M9130</guid>
      <dc:creator>schorsch</dc:creator>
      <dc:date>2017-11-14T10:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20770#M9131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a new &lt;EM&gt;feature&lt;/EM&gt; added to Alfresco 5.1. It has been raised, but I don't know if it's going to be solved.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was looking for a public issue, but it's only at support level. Should be useful to raise also a public one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2017 17:37:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20770#M9131</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2017-11-14T17:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20771#M9132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found it:&amp;nbsp;&lt;A href="https://issues.alfresco.com/jira/browse/MNT-17060" rel="nofollow noopener noreferrer"&gt;https://issues.alfresco.com/jira/browse/MNT-17060&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally the classified this as "not a bug"...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For me it is a bug, specially when I was importing million of rows and the&amp;nbsp;database log&amp;nbsp;filled my disk &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2017 17:41:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20771#M9132</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2017-11-14T17:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20772#M9133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tagging &lt;A __default_attr="2030" __jive_macro_name="user" _jive_internal="true" data-id="2030" data-objecttype="3" data-type="person" href="https://community.alfresco.com/people/resplin" rel="nofollow noopener noreferrer"&gt;&lt;/A&gt;‌ for input!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 18:39:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20772#M9133</guid>
      <dc:creator>kgastaldo</dc:creator>
      <dc:date>2017-11-15T18:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20773#M9134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interestingly I have been seeing a similar issue with alf_qname table on Alfresco 5.0.d before.&amp;nbsp;Probably they did not check the cache before attempting to create the QName back then...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Totally agreed that this is a bug. There already is a&amp;nbsp;getOrCreateContentUrl in the AbstractContentDataDAOImpl, so I see no reason why they'd need to do a createOrGetByValue on the contentUrlCache in&amp;nbsp;createContentDataEntity directly instead of calling that&amp;nbsp;&lt;SPAN&gt;getOrCreateContentUrl&amp;nbsp; to reuse existing code. This&amp;nbsp;looks like a poor job on part of &lt;A class="link-titled" href="https://issues.alfresco.com/jira/browse/ACE-3948" title="https://issues.alfresco.com/jira/browse/ACE-3948" rel="nofollow noopener noreferrer"&gt;ACE-3948&lt;/A&gt;&amp;nbsp;-&amp;nbsp;they seem to have completely misunderstood the root cause.&amp;nbsp;Content URL re-use is extremely common, e.g. when copying around nodes referencing the same content.&amp;nbsp;Uploading a file via Share involves creating a new version which involves copying, so in that case a conflict is guaranteed using a createOrGet approach. The same can happen when copying a node to a different location - which may cause dozens or hundreds of key conflicts depending on how many children get recursively copied. Having one SELECT more (which they complain about in ACE-3948) is always preferable to consciously causing and not caring about a key conflict.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If they&amp;nbsp;really wanted to avoid the SELECT, they should have carried the content URL ID along inside the ContentData object, so they could check that against null when trying to determine if they can re-use an existing entity or have to create a new one. So when a new node is uploaded, they'd see content URL ID as null and create a new enttiy, but when it is copied as part of versioning, they'd see the content URL ID and just do the lookup in the cache (which should contain it, since it was created in that transaction).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 07:25:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20773#M9134</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-11-16T07:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20774#M9135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, Axel, for your detailed analysis.&lt;/P&gt;&lt;P&gt;I totally agree in your stating one additional select is always preferable&amp;nbsp;to provoking a&amp;nbsp;duplicate key exception. Furthermore an insert in any case&amp;nbsp;binds more ressources in the database than an additional select which can be cached by the database if it has already similarly been executed some seconds before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 08:45:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20774#M9135</guid>
      <dc:creator>schorsch</dc:creator>
      <dc:date>2017-11-16T08:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20775#M9136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the conversation. I shared it with the architects for this area of the product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As&amp;nbsp; described in&amp;nbsp;&lt;A href="https://issues.alfresco.com/jira/browse/MNT-17060" rel="nofollow noopener noreferrer"&gt;MNT-17060&lt;/A&gt;, we rely on the database to enforce the key constraint because it is the most performant way of doing bulk inserts of new data. When the database sees the violation, we pick that up and respond appropriately. This is a common pattern with our current architecture, and is a convenient optimization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We selected this architecture as a result of performance profiling in order to optimize new data creation because bulk import is a critical use case. As a result, there is one fewer select statement for every file. This is documented in&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://issues.alfresco.com/jira/browse/ACE-3948" style="color: #2989c5; text-decoration: none;" rel="nofollow noopener noreferrer"&gt;ACE-3948&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 13:48:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20775#M9136</guid>
      <dc:creator>resplin</dc:creator>
      <dc:date>2018-03-12T13:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: idx_alf_conturl_cr violated on document creation</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20776#M9137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/16045"&gt;@afaust&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/74255"&gt;@resplin&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got the same issue with duplicate key error on postgres DB, on each document creation.&lt;/P&gt;&lt;P&gt;As the ticket is not accessible anymore, how can we solved this problem?&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;UTC [962] ERROR: duplicate key value violates unique constraint "idx_alf_conturl_cr"

CDT STATEMENT: insert into alf_content_url (id, content_url, content_url_short, content_url_crc, content_size, orphan_time) values ($1, $2, $3, $4, $5, $6)
select * from alf_content_url order by id desc;&lt;/PRE&gt;&lt;P&gt;We are running Alfresco on docker with this versions from docker-compose :&lt;/P&gt;&lt;PRE&gt;postgres:13.3
alfresco/alfresco-acs-nginx:3.1.1
alfresco/alfresco-content-repository-community:7.1.1
alfresco/alfresco-search-services:2.0.2.1
alfresco/alfresco-transform-core-aio:2.5.6
alfresco/alfresco-share:7.1.1
alfresco/alfresco-activemq:5.16.1&lt;/PRE&gt;&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cordially&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 15:51:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/idx-alf-conturl-cr-violated-on-document-creation/m-p/20776#M9137</guid>
      <dc:creator>franck1436</dc:creator>
      <dc:date>2022-10-14T15:51:49Z</dc:date>
    </item>
  </channel>
</rss>

