Skip to content

gitlab-rails: checks/postgresql detect silent NoDatabaseError

Jason Plum requested to merge deps-detect-silent-NoDatabaseError into master

What does this MR do?

gitlab-rails: checks/postgresql detect silent NoDatabaseError

ActiveRecord::ConnectionHandling.postgresql_connection(config) will emit ActiveRecord::NoDatabaseError when PG::Error includes the name in production.database of database.yml. This is to indicate a problem accessing the database shema, but not the database server.

This error is silenced by ActiveRecord::MigrationContent.current_version which results in a nil return. This nil is not the same as 0, and needs to be treated differntly, as it indicated that we could not determine the version of the schema within the database, because we were unable to access the configured database name.

Found in https://gitlab.zendesk.com/agent/tickets/212382

References:

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Integration tests added to GitLab QA
  • The impact any change in container size has should be evaluated

cc @cat

Edited by Jason Plum

Merge request reports