Skip to content

Fix ALTER lock order on continuous aggregates#10077

Open
melihmutlu wants to merge 2 commits into
timescale:mainfrom
melihmutlu:cagg_alter_lock_order
Open

Fix ALTER lock order on continuous aggregates#10077
melihmutlu wants to merge 2 commits into
timescale:mainfrom
melihmutlu:cagg_alter_lock_order

Conversation

@melihmutlu

Copy link
Copy Markdown
Member

Concurrent ALTER operations on a continuous aggregate could deadlock
with each other and with DROP because they acquired locks on the cagg's
relations (user view, mat hypertable, partial view, direct view) in
inconsistent orders

Establish a canonical lock order and route every ALTER through a shared
ts_continuous_agg_lock_relations() helper that takes the locks it needs
upfront in that order, which removes the deadlock.

Concurrent ALTER operations on a continuous aggregate could deadlock
with each other and with DROP because they acquired locks on the cagg's
relations (user view, mat hypertable, partial view, direct view) in
inconsistent orders

Establish a canonical lock order and route every ALTER through a shared
ts_continuous_agg_lock_relations() helper that takes the locks it needs
upfront in that order, which removes the deadlock.
@melihmutlu melihmutlu requested a review from a team June 17, 2026 12:48
@github-actions

Copy link
Copy Markdown

@pnthao, @natalya-aksman: please review this pull request.

Powered by pull-review

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant