Skip to content

Conversation

yann-soubeyrand
Copy link
Contributor

@yann-soubeyrand yann-soubeyrand commented Jul 20, 2020

When the connection to the PostgreSQL instance cannot be established straight at startup, a race condition can happen when autoDiscoverDatabases is true. If discoverDatabaseDSNs fails, no dsn is set as the master database, and, if scrapeDSN succeeds, checkMapVersions will have omitted the default metrics in the server metric map. The metric map won't be updated unless the version returned by the PostgreSQL instance changes. With this patch, scrapeDSN won't be run unless discoverDatabaseDSNs succeeded and thus the race condition is eliminated.

When the connection to the PostgreSQL instance cannot be established straight at startup, a race condition can happen when autoDiscoverDatabases is true. If discoverDatabaseDSNs fails, no dsn is set as the master database, and, if scrapeDSN succeeds, checkMapVersions will have omitted the default metrics in the server metric map. The metric map won't be updated unless the version returned by the PostgreSQL instance changes. With this patch, scrapeDSN won't be run unless discoverDatabaseDSNs succeeded and thus the race condition is eliminated. Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
@yann-soubeyrand
Copy link
Contributor Author

Closing in favor of #415 (I used master branch instead of a feature branch and didn't manage to change the PR's branch).

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 64.573% when pulling 91c5150 on camptocamp:master into e2df41f on wrouesnel:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants