Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of in-place upgrades (#7689)
This builds on all of the work done to put the standard library into versioned namespaces. The components currently are: * A new `ADMINISTER prepare_upgrade()` command that returns the metadata about the schema necessary to perform the upgrade. Currently a user script runs this on every database and aggregates it, and we pass that to the server. * An `--inplace-upgrade <json file>` flag is added to the server, which tells it to do an inplace upgrade using the `prepare_upgrade` information in the file. It does this by running the a partial standard library tpldbdump on each database, and then rebuilding the schema tables for each database. * Trampoline swapping, which requires some subtlety: we can't drop or reorder columns on views, so I wrote some pl/pgsql that regenerates a view preserving the order of previously existing fields and inserting NULL for removed ones. * Testing: I've added an initial testing script that runs `inittestdb`, collects the `prepare_upgrade` results, applies a patch that adds and removes some stuff to the std schema and bumps the version number, upgrades the database in place, and then runs the full test suite. Major progress on #6697. Remaining TODOs (can largely be in follow ups): - [ ] Extension upgrade support - [ ] Parallelize upgrade (by using compiler pool)? - [ ] Support upgrade while old version is running - [ ] Better fault tolerance - [ ] Extension triggers and user functions: regenerate them if a user type points to schema object that has grown a new subtype
- Loading branch information