@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.

Use the "@" operator to silence connection retry messages if initializing the stack with database config optional

Summary:
Depends on D20780. Ref T13403. During initial setup, it's routine to run "bin/config" with a bad database config. We start the stack in "config optional" mode to anticipate this.

However, even in this mode, we may emit warnings if the connection fails in certain ways. These warnings aren't useful; suppress them with "@".

(Possibly this message should move from "phlog()" to "--trace" at some point, but it has a certain amount of context/history around it.)

Test Plan:
- Configured MySQL to fail with a retryable error, e.g. good host but bad port.
- Ran `bin/config set ...`.
- Before: saw retry warnings on stderr.
- After: no retry warnings on stderr.
- (Turned off suppression code artificially and verified warnings still appear under normal startup.)

Maniphest Tasks: T13403

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

+19 -4
+11 -3
src/infrastructure/env/PhabricatorEnv.php
··· 249 249 } 250 250 251 251 try { 252 - $stack->pushSource( 253 - id(new PhabricatorConfigDatabaseSource('default')) 254 - ->setName(pht('Database'))); 252 + // See T13403. If we're starting up in "config optional" mode, suppress 253 + // messages about connection retries. 254 + if ($config_optional) { 255 + $database_source = @new PhabricatorConfigDatabaseSource('default'); 256 + } else { 257 + $database_source = new PhabricatorConfigDatabaseSource('default'); 258 + } 259 + 260 + $database_source->setName(pht('Database')); 261 + 262 + $stack->pushSource($database_source); 255 263 } catch (AphrontSchemaQueryException $exception) { 256 264 // If the database is not available, just skip this configuration 257 265 // source. This happens during `bin/storage upgrade`, `bin/conf` before
+8 -1
src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php
··· 126 126 $code, 127 127 $ex->getMessage()); 128 128 129 - phlog($message); 129 + // See T13403. If we're silenced with the "@" operator, don't log 130 + // this connection attempt. This keeps things quiet if we're 131 + // running a setup workflow like "bin/config" and expect that the 132 + // database credentials will often be incorrect. 133 + 134 + if (error_reporting()) { 135 + phlog($message); 136 + } 130 137 } else { 131 138 $profiler->endServiceCall($call_id, array()); 132 139 throw $ex;