edgedb / edgedb

A graph-relational database with declarative schema, built-in migration system, and a next-generation query language
https://edgedb.com
Apache License 2.0
12.93k stars 396 forks source link

In-place major version upgrades #6697

Open msullivan opened 7 months ago

msullivan commented 7 months ago

Currently, while we allow in-place upgrades between minor versions, upgrading between major versions requires a dump and restore. This is slow, and requires downtime.

Currently we use the patch system to make catalog changes during minor version upgrades, but using the patch system for major versions is probably unworkable:

  1. The number of patches needed would be much higher, which is problematic because they are a pain to develop and maintain. Currently we only need patches when a backported bugfix requires a catalog change. Now it would be needed for all features on the main branch.
  2. Worse, there is no good way with that approach to populate new fields in the reflection schema.

The plan then, is this:

Eventually we might need to actually change layout, in which case some major versions might not be upgradable. But also there's a good chance we could do it gradually, with some tables or functions or whatnot using the new layout and allowing gradual backfill migration.

Open questions (partial list):

msullivan commented 7 months ago

I've focused mostly on the compiler component, but there is also a lot of room for cleverness to make this truly in place. With appropriate setup, almost all of this can happen while the previous version is still running, and even serving write queries. (As long as no migrations are being done)

msullivan commented 3 months ago

Other design notes (will edit):

msullivan commented 1 week ago

Remaining TODOs: