Homec4science

Make SQL patch management DAG-based and provide namespace support

Authored by epriestley <git@epriestley.com> on Apr 30 2012, 16:54.

Description

Make SQL patch management DAG-based and provide namespace support

Summary:
This addresses three issues with the current patch management system:

  1. Two people developing at the same time often pick the same SQL patch number, and then have to go rename it. The system catches this, but it's silly.
  2. Second/third-party developers can't use the same system to manage auxiliary storage they may want to add.
  3. There's no way to build mock databases for unit tests that need to do reads.

To resolve these things, you can now name your patches whatever you want and conflicts are just merge conflicts, which are less of a pain to fix than filename conflicts.

Dependencies are now a DAG, with implicit dependencies created on the prior patch if no dependencies are specified. Developers can add new concrete subclasses of PhabricatorSQLPatchList to add storage management, and define the dependency branchpoint of their patches so they apply in the correct order (although, generally, they should not depend on the mainline patches, presumably).

The commands storage upgrade --namespace test1234 and storage destroy --namespace test1234 will allow unit tests to build and destroy MySQL storage.

A "quickstart" mode allows an upgrade from scratch in ~1200ms. Destruction takes about 200ms. These seem like fairily reasonable costs to actually use in tests. Building from scratch patch-by-patch takes about 6000ms.

Test Plan:

  • Created new databases from scratch with and without quickstart in a separate test namespace. Pointed the webapp at the test namespaces, browsed around, everything looked good.
  • Compared quickstart and no-quickstart dump states, they're identical except for mysqldump timestamps and a few similar things.
  • Upgraded a legacy database to the new storage format.
  • Destroyed / dumped storage.

Reviewers: edward, vrana, btrahan, jungejason

Reviewed By: btrahan

CC: aran, nh

Maniphest Tasks: T140, T345

Differential Revision: https://secure.phabricator.com/D2323

Details

Committed
epriestley <git@epriestley.com>Apr 30 2012, 16:54
Pushed
aubortJan 31 2017, 17:16
Parents
rPH68b597ff75a6: SQL Patch Management: SQL Changes
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH087cc0808a34: Make SQL patch management DAG-based and provide namespace support (authored by epriestley <git@epriestley.com>).Apr 30 2012, 16:54