Support multiple database masters and convert easy callers

Summary:
Ref T11044. This moves toward partitioned application databases:

  - You can define multiple masters.
  - Convert all the easily-convertible code to become multi-master aware.

This doesn't convert most of `bin/storage` or "Config > Database (Stuff)" yet, as both are quite involved. They still work for now, but only operate on the first master instead of all masters.

Test Plan: Configured multiple masters, browsed around, ran `bin/storage` commands, ran `bin/storage --host ...`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11044

Differential Revision: https://secure.phabricator.com/D16115
This commit is contained in:
epriestley
2016-06-14 06:56:12 -07:00
parent 745429aac1
commit ecc598f18d
6 changed files with 155 additions and 114 deletions

View File

@@ -90,7 +90,9 @@ if (strlen($host)) {
// Include the master in case the user is just specifying a redundant
// "--host" flag for no reason and does not actually have a database
// cluster configured.
$refs[] = PhabricatorDatabaseRef::getMasterDatabaseRef();
foreach (PhabricatorDatabaseRef::getMasterDatabaseRefs() as $master_ref) {
$refs[] = $master_ref;
}
foreach ($refs as $possible_ref) {
if ($possible_ref->getHost() == $host) {