question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DB deadlocks during migration

See original GitHub issue

We 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:closed
  • Created 2 years ago
  • Comments:31 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
tirumaraiselvancommented, Dec 9, 2021

Closing this issue since #7711 is fixed and will be out in v2.1.0.

0reactions
tirumaraiselvancommented, Oct 25, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found