Skip to content

postgres: alias insertion deadlock#1891

Draft
hdonnay wants to merge 2 commits into
quay:mainfrom
hdonnay:bug/sql-concurrent-alias
Draft

postgres: alias insertion deadlock#1891
hdonnay wants to merge 2 commits into
quay:mainfrom
hdonnay:bug/sql-concurrent-alias

Conversation

@hdonnay

@hdonnay hdonnay commented May 21, 2026

Copy link
Copy Markdown
Member

This fixes a transaction conflict where concurrent updaters could attempt to insert the same alias namespaces and cause the entire update to abort.

Hold: Needs a test.

@hdonnay hdonnay requested a review from crozzy May 21, 2026 00:25
@hdonnay hdonnay force-pushed the bug/sql-concurrent-alias branch 2 times, most recently from b8d0c0b to da65def Compare May 27, 2026 19:49
@hdonnay hdonnay force-pushed the bug/sql-concurrent-alias branch from da65def to a43e074 Compare May 28, 2026 18:46
@hdonnay hdonnay force-pushed the bug/sql-concurrent-alias branch from a43e074 to 136e223 Compare May 29, 2026 15:25
hdonnay added 2 commits May 29, 2026 10:38
Adds a test that trips an Alias insertion deadlock.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I4f7f613f17e47c7cbcff82fbbb7674a06a6a6964
This fixes a transaction conflict where concurrent updaters could
attempt to insert the same alias namespaces and cause the entire update
to abort.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Change-Id: I4f7f613f17e47c7cbcff82fbbb7674a06a6a6964
@crozzy

crozzy commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This appears to stop the deadlocks but causes the time to insert to increase considerably. Since we are inserting the aliases and namespaces outside of the transaction (so IIUC deadlocking is not an issue), would it be possible to collect all the aliases to be inserted using the dedupe maps that already exist and fire two bulk statements for the alias and the namespace?

@hdonnay

hdonnay commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

I'll take a look and try structuring it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants