Skip to content

Allow statement_timeout to be configured inside config/database.yml

Summary

Omnibus includes a postgresql['statement_timeout'] which sets the default statement timeout for all connections. However, this only allows the timeout to be configured if people are using the bundled postgresql server. We should allow the statement timeout to be configured even if they're using an external postgresql server

Proposal

Defaulkt statement timeouts can be configured both client and server-side. The client-side version looks like this in config/database.yml:

production:
  adapter: postgresql
  # ...
  variables:
    statement_timeout: ...

By making this configurable in omnibus, like:

gitlab_rails['db_statement_timeout'] = nil # defaults to postgresql['statement_timeout']

we can ensure this important setting is configured by default for people even if they aren't using the bundled postgresql server.

References

https://til.hashrocket.com/posts/b44baf657d-railspg-statement-timeou

Noticed while investigating https://gitlab.com/gitlab-org/gitlab-ce/issues/65306