Skip to content

Commit

Permalink
Fix bug where a cascading delete of an environment causes a deadlock …
Browse files Browse the repository at this point in the history
…because it acquires a table-level lock on an incorrect database table. (Issue #4834, PR #4863)

Pull request opened by the merge tool on behalf of #4863
  • Loading branch information
arnaudsjs authored and inmantaci committed Sep 20, 2022
1 parent bfed252 commit 9857e1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
description: Fix bug where a cascading delete of an environment causes a deadlock because it acquires a table-level lock on an incorrect database table.
issue-nr: 4834
issue-repo: inmanta-core
change-type: patch
destination-branches: [master, iso5]
2 changes: 1 addition & 1 deletion src/inmanta/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5547,7 +5547,7 @@ async def delete_cascade(self) -> None:
await Code.delete_all(connection=con, environment=self.environment, version=self.version)

# Acquire explicit lock to avoid deadlock. See ConfigurationModel docstring
await self.lock_table(TableLockMode.SHARE, connection=con)
await ResourceAction.lock_table(TableLockMode.SHARE, connection=con)
await Resource.delete_all(connection=con, environment=self.environment, model=self.version)

# Delete facts when the resources in this version are the only
Expand Down

0 comments on commit 9857e1b

Please sign in to comment.