High severityexecution
Power BI Refresh Error:
DEADLOCK_DETECTED
What does this error mean?
Two or more concurrent Databricks transactions entered a deadlock state where each holds a lock the other needs, causing both to be blocked indefinitely until the system resolves the conflict by aborting one.
Common causes
- 1Two concurrent MERGE or UPDATE operations on the same Delta table acquire conflicting row-level locks in opposite orders
- 2A pipeline reads from table A and writes to table B while a concurrent pipeline reads from B and writes to A, creating a circular lock dependency
- 3Concurrent DML operations on tables with aggressive locking modes enabled via Delta table properties
How to fix it
- 1Step 1: Identify the two operations involved using the Databricks query history and job run timestamps.
- 2Step 2: Refactor the write order so that all pipelines acquire locks on shared tables in a consistent sequence.
- 3Step 3: Use partition pruning in MERGE predicates to narrow the lock scope, reducing the chance of lock overlap.
- 4Step 4: Retry the aborted transaction automatically — Databricks aborts one side of the deadlock, and re-running it after a short delay is usually sufficient.