Concurrency issue with append only writed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2024 02:30 AM
Dear all,
We have a pyspark streaming job (DBR: 14.3) that continuously writes new data on a Delta Table (TableA).
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.
Periodically, we get exceptions due to concurrency issues with the following trace:
{
"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"
}
As mentioned in this page: https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level, there should be no concurrency issue. Even after checking the limitations page (https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level#rlc-limitations) we follow all conditions
- No complex conditional clauses
- Explicit predicates that uniquely identify each record to be deleted
We suspect that this may have to do with this option: "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)
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.
Thanks a-priori for your help.
Kind regards,
the European Dynamics team
- Labels:
-
Delta Lake
-
Spark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 05:24 AM
Thanks for the fast reply @Retired_mod .
What we are unable to understand is that in the documentation it is specifically mentioned that
writes can not have issues in write serializable.
(https://learn.microsoft.com/en-us/azure/databricks/optimizations/isolation-level)
Kind regards,
The European Dynamics team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 07:09 AM - edited 07-02-2024 07:12 AM
Hi @EDDatabricks - were you able to find the fix for this? I am also facing a similar issue. Added more details here - Getting concurrent Append exception after upgradin... - Databricks Community - 76521

