stripe / pg-schema-diff

Go library for diffing Postgres schemas and generating SQL migrations
MIT License
270 stars 20 forks source link

Fix potential deadlock bug #92

Closed bplunkett-stripe closed 5 months ago

bplunkett-stripe commented 5 months ago

Description

We fetch schema objects in a hierarchy (hopefully we can optimize this away in the future). A dead lock could occur if:

  1. Layer 1 of hierarchy submits (all workers taken)
  2. Layer 2 of hierarchy submits (all workers taken, so they block)
  3. Dead lock. Layer 1 cannot complete till Layer 2 completes. Layer 2 cannot complete until Layer 1 completes.

Motivation

Bug fix

Testing

Tested via unit tests