phacility/phabricator · critical · Exception

Multiple masters (databases "%s" and "%s") specify that they

Error message

Multiple masters (databases "%s" and "%s") specify that they are the partition for application "%s". Each application may be allocated to only one partition.

What it means

Each application database may be allocated to exactly one partition in a multi-master cluster. The parser tracks applications in $partition_map and throws when a second master's 'partition' list names an application that another master already owns.

Source

Thrown at src/infrastructure/cluster/PhabricatorDatabaseRefParser.php:115

        }

        $application_map = array();
        foreach ($partition as $application) {
          if ($application === 'default') {
            if ($default_ref) {
              throw new Exception(
                pht(
                  'Multiple masters (databases "%s" and "%s") specify that '.
                  'they are the "default" partition. Only one master may be '.
                  'the default.',
                  $ref->getRefKey(),
                  $default_ref->getRefKey()));
            } else {
              $default_ref = $ref;
              $ref->setIsDefaultPartition(true);
            }
          } else if (isset($partition_map[$application])) {
            throw new Exception(
              pht(
                'Multiple masters (databases "%s" and "%s") specify that '.
                'they are the partition for application "%s". Each '.
                'application may be allocated to only one partition.',
                $partition_map[$application]->getRefKey(),
                $ref->getRefKey(),
                $application));
          } else {
            // TODO: We should check that the application is valid, to
            // prevent typos in application names. However, we do not
            // currently have an efficient way to enumerate all of the valid
            // application database names.

            $partition_map[$application] = $ref;
            $application_map[$application] = $application;
          }
        }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Assign each application name to exactly one master's 'partition' list and delete duplicates.
  2. If you wanted replication rather than partitioning, keep one master and configure the second host as a replica ('master' => false).
  3. Re-check that every application still lands somewhere (or on 'default') after the edit.

Example fix

// before
["partition" => ["maniphest", "differential"]] // db1
["partition" => ["differential"]]                // db2

// after
["partition" => ["maniphest"]] // db1
["partition" => ["differential"]] // db2
Defensive patterns

Strategy: validation

Validate before calling

// Each application may appear in only one partition list
$seen = array();
foreach ($cluster_database_config as $server) {
  foreach (idx($server, 'partition', array()) as $application) {
    if ($application === 'default') { continue; }
    if (isset($seen[$application])) {
      // reject: application allocated to two masters
    }
    $seen[$application] = true;
  }
}

Prevention

When it happens

Trigger: Two cluster.databases masters both include the same application name (e.g. 'maniphest') in their 'partition' arrays.

Common situations: Overlapping partition lists after splitting by team; a renamed copy of a master block that still carries the old application list; intending a master/replica setup but configuring two masters with identical partitions instead.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/e4847583f40e370e. Report an issue: GitHub.