@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Distinguish between unreachable cluster database hosts and missing MySQL databases

Summary:
Fixes T11577. When we connect to a host and try to select a database which does not exist, we currently treat it as though the host wasn't reachable.

This isn't correct, and prevents storage from being initialized while already in cluster mode, since the "config" database won't exist yet the first time we connect.

Instead, distinguish between `AphrontSchemaQueryException` (thrown on connection if the requested database is not present) and other errors.

Test Plan:
- Put Phabricator into cluster database mode (`cluster.databases = ...`).
- Swapped `storage.default-namespace` to force initialization of a new install.
- Ran `bin/storage upgrade`.
- Before patch: Immediate fatal about unreachablility.
- After patch: Database initialized.
- Also ran initialization steps in tranditional single-host mode (`cluster.databases` empty, `mysql.host` configured).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11577

Differential Revision: https://secure.phabricator.com/D16489

+7 -1
+6
src/infrastructure/cluster/PhabricatorDatabaseRef.php
··· 405 405 try { 406 406 $connection->openConnection(); 407 407 $reachable = true; 408 + } catch (AphrontSchemaQueryException $ex) { 409 + // We get one of these if the database we're trying to select does not 410 + // exist. In this case, just re-throw the exception. This is expected 411 + // during first-time setup, when databases like "config" will not exist 412 + // yet. 413 + throw $ex; 408 414 } catch (Exception $ex) { 409 415 $reachable = false; 410 416 }
+1 -1
src/infrastructure/env/PhabricatorEnv.php
··· 231 231 $stack->pushSource( 232 232 id(new PhabricatorConfigDatabaseSource('default')) 233 233 ->setName(pht('Database'))); 234 - } catch (AphrontQueryException $exception) { 234 + } catch (AphrontSchemaQueryException $exception) { 235 235 // If the database is not available, just skip this configuration 236 236 // source. This happens during `bin/storage upgrade`, `bin/conf` before 237 237 // schema setup, etc.