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.

Migrate lock timeout on PlanetScale

See original GitHub issue

When using Migrate with PlanetScale, sometimes you get an error message like this:

Error querying the database: Server error: `ERROR 70100 (1317): held locks released: vttablet: rpc error: code = Aborted desc = transaction 1621634564893708666: ended at 2021-05-21 23:54:48.118 UTC (exceeded timeout: 20s) (CallerID: unsecure_grpc_client)'

Also see all the related reports here: https://github.com/planetscale/beta/discussions/34

Two possible causes we can think of:

  1. Wait to long when CLI prompts your for migration name
  2. Migrations take “to long” to run (Reproducible easily with https://stackoverflow.com/questions/4284524/how-and-when-to-use-sleep-correctly-in-mysql)

We should try to reproduce both so we know if we have something that needs fixing. It might also be worth to investigate if something like this could happen on other database providers as well or if this is PlanetScale/Vitess specific.

(Potential solutions: Only lock after migration name is known, do not lock on PlanetScale at all, etc)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
obibringcommented, May 3, 2022

Sure, thanks for the quick reply @janpio

3reactions
jdecommented, Jan 7, 2022

I used prisma migrate dev as my primary workflow through the bootstrapping of my app and saw a gradual increase in the time it took.

When I reached 64 migrations (most of these were attempts to debug #10758 issues) my migrate flow hit the 20s Planetscale timeout and I got the error above.

This happened even if I pre-typed my migration name as the process started so that it immediately filled and didn’t add any real time to the process.

I’m using prisma db push now, which executes in 1.1s.

I will create fresh dbs locally and on planetscale and run a single initial migration soon. If this jumps me back into the timeout I’ll report back here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic Rails migrations - PlanetScale
In this tutorial, you're going to learn how Rails migrations work with ... to your production databases without downtime or locking tables.
Read more >
Stop worrying about PostgreSQL locks in your Rails migrations
Our best option here is to add a lock timeout, which will abort the migration if the lock is not acquired after a...
Read more >
Transactions - Prisma
Optimistic concurrency control (OCC) is a model for handling concurrent operations on a single entity that does not rely on locking. Instead, we ......
Read more >
What database are you using and why? - Indie Hackers
I only once so far on my app got a timeout error as the whole DB is locked for writes and I guess...
Read more >
OnlineMigrations Alternatives - Ruby Database Tools | LibHunt
Catch unsafe PostgreSQL migrations in development and run them easier in ... def change # Lower PostgreSQL's lock timeout to avoid statement ...
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