<?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 Qlik Replicate Task is not working with Insert Update Conflict Error in Qlik Replicate</title>
    <link>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417223#M9370</link>
    <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;We are trying to replicate tables from Source (Postgres SQL) to Target (Snowflake) using Qlik Replicate. Full load gets completed successfully and suddenly we start seeing conflict error of insert update in CDC.&lt;BR /&gt;Here Replication Task tries to update the record before inserting it and this conflict being written to attrep_exception_table. All the pending transactions are stored in disk/memory as a result there is very high latency for CDC. This increases PostgreSQL slot size&amp;nbsp; drastically. We have to stop the task and drop the slot to bring the vitals back to normal w.r.t. Postgres Database.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;P.S. We have soft delete column defined as part of Global Transformation&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;Logs from the task are as below&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;00617923: 2024-01-24T06:39:08:155453 [ASSERTION&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]W:&amp;nbsp; The 'INSERT' event received for table 20 after 'UPDATE (3)' event with the same primary key at stream position '00009516/BC076AD8.115.00009516/BC0FC048'&amp;nbsp; (bulk_apply.c:1710)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;When we check the CT table transaction for the timestamp - we see insert and update as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrabhaAnde_0-1707485695523.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159466i0123F20889E3782A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrabhaAnde_0-1707485695523.png" alt="PrabhaAnde_0-1707485695523.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can someone help us understand the issue and suggest resolution?&lt;/P&gt;
&lt;P&gt;#Qlikreplicate#Dataintegration#Upsertissue#applyconflict#attrepexception#softdelete&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2024 13:38:45 GMT</pubDate>
    <dc:creator>Prabha-Ande</dc:creator>
    <dc:date>2024-02-09T13:38:45Z</dc:date>
    <item>
      <title>Qlik Replicate Task is not working with Insert Update Conflict Error</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417223#M9370</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;We are trying to replicate tables from Source (Postgres SQL) to Target (Snowflake) using Qlik Replicate. Full load gets completed successfully and suddenly we start seeing conflict error of insert update in CDC.&lt;BR /&gt;Here Replication Task tries to update the record before inserting it and this conflict being written to attrep_exception_table. All the pending transactions are stored in disk/memory as a result there is very high latency for CDC. This increases PostgreSQL slot size&amp;nbsp; drastically. We have to stop the task and drop the slot to bring the vitals back to normal w.r.t. Postgres Database.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;P.S. We have soft delete column defined as part of Global Transformation&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;Logs from the task are as below&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="ui-provider dz bfa bbh bpt bpu bpv bpw bpx bpy bpz bqa bqb bqc bqd bqe bqf bqg bqh bqi bqj bqk bql bqm bqn bqo bqp bqq bqr bqs bqt bqu bqv bqw bqx bqy"&gt;00617923: 2024-01-24T06:39:08:155453 [ASSERTION&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]W:&amp;nbsp; The 'INSERT' event received for table 20 after 'UPDATE (3)' event with the same primary key at stream position '00009516/BC076AD8.115.00009516/BC0FC048'&amp;nbsp; (bulk_apply.c:1710)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;When we check the CT table transaction for the timestamp - we see insert and update as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PrabhaAnde_0-1707485695523.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159466i0123F20889E3782A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PrabhaAnde_0-1707485695523.png" alt="PrabhaAnde_0-1707485695523.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Can someone help us understand the issue and suggest resolution?&lt;/P&gt;
&lt;P&gt;#Qlikreplicate#Dataintegration#Upsertissue#applyconflict#attrepexception#softdelete&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 13:38:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417223#M9370</guid>
      <dc:creator>Prabha-Ande</dc:creator>
      <dc:date>2024-02-09T13:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Replicate Task is not working with Insert Update Conflict Error</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417267#M9372</link>
      <description>&lt;P&gt;Dear &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/254902"&gt;@Prabha-Ande&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to us on Qlik Community.&lt;/P&gt;
&lt;P&gt;It seems like you’re encountering an&lt;STRONG&gt; “Insert Update Conflict Error”&lt;/STRONG&gt; during the Change Data Capture (CDC) process.&amp;nbsp;This error typically occurs when the Replication Task tries to update a record before inserting it&lt;/P&gt;
&lt;P&gt;The root cause of this issue could be related to the ‘Store Changes’ option you’re using for capturing changes from the source database.&amp;nbsp;This option treats any change as an INSERT, regardless of the actual operation.&amp;nbsp;Therefore, when you enable the UPSERT mode for resolving apply conflicts, you may encounter errors like ‘No record found for applying an UPDATE’ or ‘The INSERT event received for table 20 after UPDATE event with the same primary key’.&lt;/P&gt;
&lt;P&gt;One possible solution is to use the ‘Apply Changes’ option instead of the ‘Store Changes’ option.&amp;nbsp;This way, Qlik Replicate will capture the actual operations (INSERT, UPDATE, DELETE) from the source database and apply them accordingly to the target database.&amp;nbsp;You can also configure the apply conflict settings to suit your business needs, such as ignoring errors, skipping changes, or using UPSERT mode.&lt;/P&gt;
&lt;P&gt;Additionally, if you’re using a soft delete column as part of Global Transformation, you might want to ensure that the global expressions are propagated to all tables.&amp;nbsp;If not, you might need to define a soft delete transformation on each individual table as needed.&lt;/P&gt;
&lt;P&gt;Lastly, high latency for CDC and increased PostgreSQL slot size could be due to excessive manipulations/transformations&amp;nbsp;or due to the storage of pending transactions in disk/memory.&amp;nbsp;You might want to check the performance and tuning of your Replicate task.&lt;/P&gt;
&lt;P&gt;I hope this helps you troubleshoot and resolve the issue.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If our response has been helpful, please consider clicking "Accept as Solution". This will assist other users in easily finding the answer.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We appreciate your cooperation and feedback. &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Deepak&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 03:48:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417267#M9372</guid>
      <dc:creator>deepaksahirwar</dc:creator>
      <dc:date>2024-02-15T03:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Replicate Task is not working with Insert Update Conflict Error</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417415#M9380</link>
      <description>&lt;P&gt;Whenever Replicate uses "&lt;SPAN&gt;[ASSERTION&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]" in the log it really means BUG!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It indicates that Replicate encountered a situation it did not expect to ever happen (but it checked anyway)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The task is using CDC in BATCH OPTIMIZED APPLY right? - that's required for Snowflake.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this case the expected Replicate bulk apply behavior is to 'see' the Insert and Update and combine it into a single Insert with the updated columns.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The timestamp on the the update seems to be earlier then the insert - good catch. This is very strange and needs to be explained. Maybe someone handy with reporting on the&amp;nbsp;PostgreSQL&amp;nbsp;transaction log can help?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;As workaround you could try to enable the exception handling as 'insert record when not found for update' and 'update if already exists for insert'. However, there is some change the insert value may 'win' and the result in the target will be stale.&lt;/P&gt;
&lt;P&gt;At any rate, this issue should be reported through a support case for proper attention. "ASSERTIONS" just should not be happening. Please provide as much details as you can with the case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Hein&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 08:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417415#M9380</guid>
      <dc:creator>Heinvandenheuvel</dc:creator>
      <dc:date>2024-02-10T08:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Replicate Task is not working with Insert Update Conflict Error</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417421#M9381</link>
      <description>&lt;P&gt;Totally agree with&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/110970"&gt;@Heinvandenheuvel&lt;/a&gt;&amp;nbsp;, please open a support ticket , we need deeper investigation on this issue.&lt;/P&gt;
&lt;P&gt;I'm not sure it's bug or not at present however this issue related with some special behaviors:&lt;/P&gt;
&lt;P&gt;1- Qlik Replicate supports PostgreSQL "&lt;FONT face="courier new,courier"&gt;REPLICA IDENTITY&lt;/FONT&gt;" set to &lt;FONT face="courier new,courier"&gt;DEFAULT&lt;/FONT&gt; only&lt;/P&gt;
&lt;P&gt;2- The &lt;FONT face="courier new,courier"&gt;SOFT DELETE&lt;/FONT&gt; is used in the task&lt;/P&gt;
&lt;P&gt;3- Snowflake special behavior with&amp;nbsp;&lt;SPAN&gt;soft delete: it first triggers a physical &lt;FONT face="courier new,courier"&gt;delete&lt;/FONT&gt; on the record and then using using&amp;nbsp;attrep_changes table triggers an &lt;FONT face="courier new,courier"&gt;insert&lt;/FONT&gt; statement&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;While all the above behaviors combine into one task, maybe some additional settings need to be considered.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;John.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 11:52:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/Qlik-Replicate-Task-is-not-working-with-Insert-Update-Conflict/m-p/2417421#M9381</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2024-02-10T11:52:12Z</dc:date>
    </item>
  </channel>
</rss>

