olivere / deadlocks

Experimenting with deadlocks on MySQL and PostgreSQL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MySQL vs PostgreSQL

$ docker-compose up -d
$ make build
go build
$ ls deadlocks
deadlocks

See how MySQL fails ...

$ make mysql
.EEE.EE.E. ✗
$ make mysql
EEEEE..EE. ✗
$ make mysql
...EE.E... ✗

... and PostgreSQL succeeds:

$ make postgres
.......... ✔
$ make postgres
.......... ✔
$ make postgres
.......... ✔

Now, start MySQL with retry on failure (will retry only on Error 1213: Deadlock found when trying to get lock; try restarting transaction):

$ make mysql-retry
.......... ✔
$ make mysql-retry
.......... ✔
$ make mysql-retry
.......... ✔

PostgreSQL, again, will make no difference:

$ make postgres-retry
.......... ✔
$ make postgres-retry
.......... ✔
$ make postgres-retry
.......... ✔

Prior art

This code just changes github.com/mlomnicki/mysql-vs-postgres-deadlock slightly.

About

Experimenting with deadlocks on MySQL and PostgreSQL.


Languages

Language:Go 89.8%Language:Makefile 7.2%Language:Shell 3.0%