Page MenuHomePhabricator

Misleading "No valid databases are configured!" error can arise from newClusterConnection()
Closed, ResolvedPublic

Description

This error is reachable if no replicas are configured and we sever from the master:

private function newClusterConnection($database, $mode) {
  $master = PhabricatorDatabaseRef::getMasterDatabaseRef();

  if ($master && !$master->isSevered()) {
    $connection = $master->newApplicationConnection($database);
    if ($master->isReachable($connection)) {
      return $connection;
    } else {
      if ($mode == 'w') {
        $this->raiseImpossibleWrite($database);
      }
      PhabricatorEnv::setReadOnly(
        true,
        PhabricatorEnv::READONLY_UNREACHABLE);
    }
  }

  $replica = PhabricatorDatabaseRef::getReplicaDatabaseRef();
  if (!$replica) {
    throw new Exception(
      pht('No valid databases are configured!'));
  }

  ...

In this case, it is misleading and suggests a configuration problem when the real issue is likely operational.

Revisions and Commits

Restricted Differential Revision

Event Timeline

epriestley added a revision: Restricted Differential Revision.Aug 10 2016, 7:04 PM
epriestley closed this task as Resolved by committing Restricted Diffusion Commit.Aug 10 2016, 8:06 PM
epriestley added a commit: Restricted Diffusion Commit.

@jmeador, this error should no longer be misleading in HEAD of master. Let us know if you run into more stuff, and thanks for the report!