<?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: Concurrent Writes to the same DELTA TABLE in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107833#M42928</link>
    <description>&lt;P&gt;are you using&amp;nbsp;&lt;SPAN&gt;Databricks Runtime 14.2 and above, if not can you switch and try/&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2025 14:38:49 GMT</pubDate>
    <dc:creator>saurabh18cs</dc:creator>
    <dc:date>2025-01-30T14:38:49Z</dc:date>
    <item>
      <title>Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107617#M42862</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi Community,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;My team and I have written some workflows that write to the same table. One of my workflows performs a &lt;STRONG&gt;MERGE&amp;nbsp;&lt;/STRONG&gt;operation on the table, while another workflow performs an &lt;STRONG&gt;append&lt;/STRONG&gt;. However, these operations can occur simultaneously, leading to conflicts.&lt;/P&gt;&lt;P&gt;As a result, one of my workflows fails with the following error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;STRONG&gt;ConcurrentAppendException: [DELTA_CONCURRENT_APPEND]&lt;/STRONG&gt;&lt;BR /&gt;ConcurrentAppendException: Files were added to the root of the table by a concurrent update. Please try the operation again.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;How can I resolve this issue?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 15:13:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107617#M42862</guid>
      <dc:creator>jeremy98</dc:creator>
      <dc:date>2025-01-29T15:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107630#M42870</link>
      <description>&lt;P&gt;is your delta partitioned? if yes then you cannot make use of row level concurrency but with default writeserializable isolation level , append and merge can work together. have you changed your isloation level from writeserializable to&amp;nbsp;serializable? how are you doing your merges?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 15:46:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107630#M42870</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-01-29T15:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107631#M42871</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Thanks for your answer. The Delta Table is not partitioned right now. Could be partitioned by the type of topic. And if I'll do the partitioning one workflow will write only to one partition, and another workflow only to another partition.&lt;BR /&gt;&lt;BR /&gt;Maybe this could solved directly the problem?&lt;BR /&gt;&lt;BR /&gt;The table has only those properties:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;USING delta
TBLPROPERTIES (
  'delta.enableChangeDataFeed' = 'true',
  'delta.enableDeletionVectors' = 'true',
  'delta.feature.appendOnly' = 'supported',
  'delta.feature.changeDataFeed' = 'supported',
  'delta.feature.deletionVectors' = 'supported',
  'delta.feature.invariants' = 'supported',
  'delta.minReaderVersion' = '3',
  'delta.minWriterVersion' = '7',
  'description' = 'Inference result for a given UP')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One workflow is working with UPSERT operations, instead the other workflow only with APPEND mode directly to that table.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 15:51:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107631#M42871</guid>
      <dc:creator>jeremy98</dc:creator>
      <dc:date>2025-01-29T15:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107709#M42895</link>
      <description>&lt;P&gt;To resolve the issue of concurrent write conflicts, specifically the `ConcurrentAppendException: [DELTA_CONCURRENT_APPEND]`, you can consider the following strategies:&lt;/P&gt;
&lt;P&gt;1. **Isolation Levels**:&lt;BR /&gt;- **WriteSerializable**: This is the default isolation level in Delta Lake, which allows certain pairs of concurrent writes to proceed without conflicts. However, if you need stricter isolation, you can set the isolation level to `Serializable` to prevent any reordering of transactions.&lt;BR /&gt;- To change the isolation level, use the following command:&lt;BR /&gt;```sql&lt;BR /&gt;ALTER TABLE &amp;lt;table-name&amp;gt; SET TBLPROPERTIES ('delta.isolationLevel' = 'Serializable')&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;2. **Row-Level Concurrency**:&lt;BR /&gt;- Ensure that row-level concurrency is enabled, which reduces conflicts by detecting changes at the row level. This is generally available on Databricks Runtime 14.2 and above.&lt;BR /&gt;- For tables with deletion vectors enabled and without partitioning, row-level concurrency is supported by default. If your table has partitions, it may not support row-level concurrency but can still avoid conflicts between `OPTIMIZE` and other write operations when deletion vectors are enabled.&lt;/P&gt;
&lt;P&gt;3. **Retry Policy**:&lt;BR /&gt;- Implement a retry policy to handle instances of `ConcurrentAppendException`. This involves retrying the operation after a short delay, which can help in resolving transient conflicts.&lt;/P&gt;
&lt;P&gt;4. **Avoiding Conflicts with Partitioning**:&lt;BR /&gt;- Partition your table by columns that are commonly used in the conditions of your operations. This can make the sets of files disjoint and reduce the likelihood of conflicts.&lt;BR /&gt;- For example, if your operations frequently filter by date, partitioning the table by date can help avoid conflicts.&lt;/P&gt;
&lt;P&gt;5. **Explicit Conditions in Operations**:&lt;BR /&gt;- Ensure that the conditions in your `MERGE`, `UPDATE`, or `DELETE` operations are explicit enough to avoid scanning the entire table. This can help in reducing conflicts with concurrent operations.&lt;BR /&gt;- For example, if your table is partitioned by date and country, include these columns in the merge condition:&lt;BR /&gt;```python&lt;BR /&gt;deltaTable.as("t").merge(&lt;BR /&gt;source.as("s"),&lt;BR /&gt;"s.user_id = t.user_id AND s.date = t.date AND s.country = t.country AND t.date = '&amp;lt;date&amp;gt;' AND t.country = '&amp;lt;country&amp;gt;'"&lt;BR /&gt;).whenMatched().updateAll().whenNotMatched().insertAll().execute()&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;By following these strategies, you can mitigate the conflicts arising from concurrent write operations and reduce the occurrence of `ConcurrentAppendException`.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 07:35:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107709#M42895</guid>
      <dc:creator>Sidhant07</dc:creator>
      <dc:date>2025-01-30T07:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107833#M42928</link>
      <description>&lt;P&gt;are you using&amp;nbsp;&lt;SPAN&gt;Databricks Runtime 14.2 and above, if not can you switch and try/&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2025 14:38:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/107833#M42928</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-01-30T14:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/144727#M52378</link>
      <description>&lt;P&gt;I'm sorry, but wouldn't the "&lt;SPAN&gt;Serializable" isolation level make it worse?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 09:47:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/144727#M52378</guid>
      <dc:creator>tariqueanwer</dc:creator>
      <dc:date>2026-01-21T09:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Concurrent Writes to the same DELTA TABLE</title>
      <link>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/148746#M52962</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/164662"&gt;@tariqueanwer&lt;/a&gt;&amp;nbsp;Exactly! I have a hard time following the discussion or solution regarding isolationLevel: Serializable!&lt;/P&gt;&lt;P&gt;Serializable is stricter, and an exception is thrown to the client straight away!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Feb 2026 20:37:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/concurrent-writes-to-the-same-delta-table/m-p/148746#M52962</guid>
      <dc:creator>Kirankumarbs</dc:creator>
      <dc:date>2026-02-18T20:37:05Z</dc:date>
    </item>
  </channel>
</rss>

