DB deadlocks during migration
See original GitHub issueWe are attempting to upgrade our hasura engine from v1 to v2 - but we are noticing timeouts and deadlocks when applying migrations in our prod environment. The statement that hangs the DB is the one that drops all the tables storing hasura metadata:
-- This migration enables metadata separation
-- Drops all tables which stores hasura metadata
DROP VIEW hdb_catalog.hdb_role;
DROP TABLE hdb_catalog.hdb_custom_types;
DROP TABLE hdb_catalog.hdb_action_permission
...
The timeouts/deadlocks aren’t an issue in our dev and test environments; we think that it’s our normal prod traffic that is causing the hangups. Do you have any recommendations for how we can avoid these issues without needing a planned outage? And a followup question - once we apply the migration that upgrades to hasura v2, will future migrations need to drop and re-create all the hasura metadata tables? Or is it a one-time thing?
Thanks in advance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:31 (15 by maintainers)
Top Results From Across the Web
deadlock issue post migrations - Microsoft Q&A
Hi All, We are seeing this deadlock quite often after migrating from sql 2012 EE to sql 2017 RTM CU22. Deadlock is happening...
Read more >How to resolve deadlocks in SQL Server - SQLShack
A deadlock problem occurs when two (or more than two) operations already want to access resources locked by the other one. In this...
Read more >Handling locks during database schema updates
This exposes us to the same risk of deadlock. The trick here is that when we perform a schema migration on a table...
Read more >SQL Server Deadlocks: What They Are and How to Avoid Them
Some of the best ways to eliminate deadlocks are by creating an index, applying application code changes or carefully inspecting the resources ......
Read more >Super Weird Laravel Migration Deadlock Problem - Laracasts
A deadlock only happens if something is still using the table from another place. So make sure no connections are established for the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing this issue since #7711 is fixed and will be out in v2.1.0.
@matty-v Yes, #7711 should fix this behaviour and there should not be any DDLs if there are no changes to the database (unless explicitly asked to recreate the triggers)
Nevertheless, it is indeed perplexing that the whole DB should freeze because of running that (unnecessary) DDL, maybe dropping trigger functions with cascade is very heavy during concurrent activity.