<?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 Concurrency issue with append only writed in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/65166#M32748</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;We have a pyspark streaming job (DBR: 14.3) that continuously writes new data on a Delta Table (TableA).&lt;/P&gt;&lt;P&gt;On this table, there is a pyspark batch job (DBR: 14.3) that operates every 15 minuted and in some cases it may delete some records from TableA using a merge statement (WhenMatchedDelete construct with a business related condition). This condition identifies specific records that are already present in TableA and it is impossible to match with records that are written during query execution.&lt;/P&gt;&lt;P&gt;Periodically, we get exceptions due to concurrency issues with the following trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "timestamp":1711718436569,
  "userId":"xxx",
  "userName":"xxx",
  "operation":"STREAMING UPDATE",
  "operationParameters":{
    "outputMode":"Append",
    "queryId":xxx,
    "epochId":xxx,
    "statsOnLoad":false
  },
  "job":{
  "jobId":"xxx",
  "jobName":"xxx",
  "jobRunId":"xxx",
  "runId":"xxx",
  "jobOwnerId":"xxx",
  "triggerType":"manual"
  },
  "notebook":{
    "notebookId":"xxx"
  },
  "clusterId":"xxx",
  "readVersion":21835,
  "isolationLevel":"WriteSerializable",
  "isBlindAppend":true,
  "operationMetrics":{
    "numRemovedFiles":"0",
    "numOutputRows":"50",
    "numOutputBytes":"25199",
    "numAddedFiles":"1"
  },
  "tags":{
    "restoresDeletedRows":"false",
    "delta.rowTracking.preserved":"true"
  },
  "engineInfo":"Databricks-Runtime/14.3.x-scala2.12",
  "txnId":"1eb445f1-2abd-4b6c-a8f0-3ccc1f2474f2"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in this page: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level," target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level,&lt;/A&gt; there should be no concurrency issue. Even after checking the limitations page (&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level#rlc-limitations" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level#rlc-limitations&lt;/A&gt;) we follow all conditions&lt;BR /&gt;- No complex conditional clauses&lt;BR /&gt;- Explicit predicates that uniquely identify each record to be deleted&lt;/P&gt;&lt;P&gt;We suspect that this may have to do with this option: &lt;SPAN class=""&gt;"delta.rowTracking.preserved":"true" but we were not able to locate any documentation about what this by default True configuration does. (only some github requests)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Please propose any mitigation actions for solving this concurrency issues as there may be some data inconsistencies to our ETL pipelines due to the aforementioned failures. Furthermore, this issue is not highlighted in the documentation per our understanding.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks a-priori for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Kind regards,&lt;BR /&gt;the European Dynamics team&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Apr 2024 09:30:30 GMT</pubDate>
    <dc:creator>EDDatabricks</dc:creator>
    <dc:date>2024-04-01T09:30:30Z</dc:date>
    <item>
      <title>Concurrency issue with append only writed</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/65166#M32748</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;We have a pyspark streaming job (DBR: 14.3) that continuously writes new data on a Delta Table (TableA).&lt;/P&gt;&lt;P&gt;On this table, there is a pyspark batch job (DBR: 14.3) that operates every 15 minuted and in some cases it may delete some records from TableA using a merge statement (WhenMatchedDelete construct with a business related condition). This condition identifies specific records that are already present in TableA and it is impossible to match with records that are written during query execution.&lt;/P&gt;&lt;P&gt;Periodically, we get exceptions due to concurrency issues with the following trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "timestamp":1711718436569,
  "userId":"xxx",
  "userName":"xxx",
  "operation":"STREAMING UPDATE",
  "operationParameters":{
    "outputMode":"Append",
    "queryId":xxx,
    "epochId":xxx,
    "statsOnLoad":false
  },
  "job":{
  "jobId":"xxx",
  "jobName":"xxx",
  "jobRunId":"xxx",
  "runId":"xxx",
  "jobOwnerId":"xxx",
  "triggerType":"manual"
  },
  "notebook":{
    "notebookId":"xxx"
  },
  "clusterId":"xxx",
  "readVersion":21835,
  "isolationLevel":"WriteSerializable",
  "isBlindAppend":true,
  "operationMetrics":{
    "numRemovedFiles":"0",
    "numOutputRows":"50",
    "numOutputBytes":"25199",
    "numAddedFiles":"1"
  },
  "tags":{
    "restoresDeletedRows":"false",
    "delta.rowTracking.preserved":"true"
  },
  "engineInfo":"Databricks-Runtime/14.3.x-scala2.12",
  "txnId":"1eb445f1-2abd-4b6c-a8f0-3ccc1f2474f2"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As mentioned in this page: &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level," target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level,&lt;/A&gt; there should be no concurrency issue. Even after checking the limitations page (&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level#rlc-limitations" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level#rlc-limitations&lt;/A&gt;) we follow all conditions&lt;BR /&gt;- No complex conditional clauses&lt;BR /&gt;- Explicit predicates that uniquely identify each record to be deleted&lt;/P&gt;&lt;P&gt;We suspect that this may have to do with this option: &lt;SPAN class=""&gt;"delta.rowTracking.preserved":"true" but we were not able to locate any documentation about what this by default True configuration does. (only some github requests)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Please propose any mitigation actions for solving this concurrency issues as there may be some data inconsistencies to our ETL pipelines due to the aforementioned failures. Furthermore, this issue is not highlighted in the documentation per our understanding.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks a-priori for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Kind regards,&lt;BR /&gt;the European Dynamics team&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 09:30:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/65166#M32748</guid>
      <dc:creator>EDDatabricks</dc:creator>
      <dc:date>2024-04-01T09:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrency issue with append only writed</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/65306#M32777</link>
      <description>&lt;P&gt;Thanks for the fast reply &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt; .&lt;/P&gt;&lt;P&gt;What we are unable to understand is that in the documentation it is specifically mentioned that&lt;BR /&gt;writes can not have issues in write serializable.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EDDatabricks_0-1712060583490.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/6882i832998ABB93033B1/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="EDDatabricks_0-1712060583490.png" alt="EDDatabricks_0-1712060583490.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level)" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;The European Dynamics team&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 12:24:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/65306#M32777</guid>
      <dc:creator>EDDatabricks</dc:creator>
      <dc:date>2024-04-02T12:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrency issue with append only writed</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/76520#M35241</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/63237"&gt;@EDDatabricks&lt;/a&gt;&amp;nbsp; - were you able to find the fix for this? I am also facing a similar issue. Added more details here&amp;nbsp; -&amp;nbsp;&lt;A href="https://community.databricks.com/t5/data-engineering/getting-concurrent-append-exception-after-upgrading-to-14-3/m-p/76521#M35242" target="_blank"&gt;Getting concurrent Append exception after upgradin... - Databricks Community - 76521&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 14:12:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrency-issue-with-append-only-writed/m-p/76520#M35241</guid>
      <dc:creator>Dilisha</dc:creator>
      <dc:date>2024-07-02T14:12:37Z</dc:date>
    </item>
  </channel>
</rss>

