Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15406854
D19454.id46535.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19454.id46535.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 2:17 PM (2 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7381521
Default Alt Text
D19454.id46535.diff (2 KB)
Attached To
Mode
D19454: When database connection exceptions occur, raise them to the setup layer
Attached
Detach File
Event Timeline
Log In to Comment