Page MenuHomePhabricator

D19454.id.diff
No OneTemporary

D19454.id.diff

diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
--- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php
+++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
@@ -29,6 +29,7 @@
private $connectionLatency;
private $connectionStatus;
private $connectionMessage;
+ private $connectionException;
private $replicaStatus;
private $replicaMessage;
@@ -453,6 +454,7 @@
return false;
}
+ $this->connectionException = null;
try {
$connection->openConnection();
$reachable = true;
@@ -463,6 +465,7 @@
// yet.
throw $ex;
} catch (Exception $ex) {
+ $this->connectionException = $ex;
$reachable = false;
}
@@ -506,6 +509,10 @@
return $this->healthRecord;
}
+ public function getConnectionException() {
+ return $this->connectionException;
+ }
+
public static function getActiveDatabaseRefs() {
$refs = array();
diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
--- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
+++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
@@ -80,6 +80,8 @@
$master = PhabricatorDatabaseRef::getMasterDatabaseRefForApplication(
$application);
+ $master_exception = null;
+
if ($master && !$master->isSevered()) {
$connection = $master->newApplicationConnection($database);
if ($master->isReachable($connection)) {
@@ -91,6 +93,8 @@
PhabricatorEnv::setReadOnly(
true,
PhabricatorEnv::READONLY_UNREACHABLE);
+
+ $master_exception = $master->getConnectionException();
}
}
@@ -108,7 +112,7 @@
$this->raiseUnconfigured($database);
}
- $this->raiseUnreachable($database);
+ $this->raiseUnreachable($database, $master_exception);
}
private function raiseImproperWrite($database) {
@@ -136,13 +140,22 @@
$database));
}
- private function raiseUnreachable($database) {
- throw new PhabricatorClusterStrandedException(
- pht(
- 'Unable to establish a connection to any database host '.
- '(while trying "%s"). All masters and replicas are completely '.
- 'unreachable.',
- $database));
+ private function raiseUnreachable($database, Exception $proxy = null) {
+ $message = pht(
+ 'Unable to establish a connection to any database host '.
+ '(while trying "%s"). All masters and replicas are completely '.
+ 'unreachable.',
+ $database);
+
+ if ($proxy) {
+ $proxy_message = pht(
+ '%s: %s',
+ get_class($proxy),
+ $proxy->getMessage());
+ $message = $message."\n\n".$proxy_message;
+ }
+
+ throw new PhabricatorClusterStrandedException($message);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 2:42 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7381521
Default Alt Text
D19454.id.diff (2 KB)

Event Timeline