Cleanup Orphaned Temporary Databases

Open
#41 0 comments 1 reaction 1 assignee View on GitHub

@alexaub-stripe is already working on this.

Since Jul 12, 2023.

Assessment

This issue has not been assessed yet.

Description

enhancement

If a migration is canceled, temporary databases will be orphaned. This problem should be pretty rare.

Temp db factories should clean up (some) orphaned databases each time they create a new database. This will ensure that # of orphaned temporary databases inevitably reaches 0.

Cleanup safety checks:

  1. Make sure temp database matches expected name
  2. Make sure metadata table is present
  3. Attempt to validate the database contains no data

Additional thought:
It might be worth splitting the context in the temp database cleanup code and giving it a strict timeout to reduce the likelihood a temporary database becomes orphaned.

Dominant language
Go
Stars
884
Forks
82
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stripe/pg-schema-diff

All issues in stripe/pg-schema-diff

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.